sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0b5b88f2ee13c4cfee90dd361d669d1d620582f4445841623cb3b0664e5596ee
Python
7,702
237
""" Bonito nn modules. """ import torch from torch.nn import Module from torch.nn.init import orthogonal_ layers = {} def register(layer): layer.name = layer.__name__.lower() layers[layer.name] = layer return layer register(torch.nn.ReLU) register(torch.nn.Tanh) @register class Swish(torch.nn.SiLU)...
6825f8f3d8116b836ed1d30a445c86855ea6689afad2e1329eee6e09b291e108
Python
7,702
246
import errno import itertools import logging import os.path import tempfile from contextlib import ExitStack, contextmanager from typing import Any, Dict, Generator, Optional, TypeVar, Union from pip._internal.utils.misc import enum, rmtree logger = logging.getLogger(__name__) _T = TypeVar("_T", bound="TempDirectory...
a0dd90ca6a368f008e6cfd9590a198090c509dc05252d35584aab13ebaddd2d6
Python
7,703
262
"""Radiated flux of a lossless dielectric disc in cylindrical coordinates. Tutorial Reference: https://meep.readthedocs.io/en/latest/Python_Tutorials/Near_to_Far_Field_Spectra/#radiation-pattern-of-a-disc-in-cylindrical-coordinates """ import math from typing import Tuple import matplotlib.pyplot as plt import meep...
b78f9dac38a3fc29b014da28b8a7421bdc5a6b26df968d69e814c9240fe9999b
Python
7,705
221
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
aa477575b582847242d91ef6649b8a9a8bc4516a45ef1d6d9d424f183fe3f1af
Python
7,707
285
from __future__ import annotations import pytest dask = pytest.importorskip("dask") pytest.importorskip("distributed") import gzip from shutil import which from dask.distributed import default_client from quacc import get_settings settings = get_settings() pytestmark = pytest.mark.skipif( which(str(settings.E...
4b8e54ec0edef336752326e07a484202d245540ea9dd0c9493769116d0db220f
Python
7,709
199
import os import logging import re from utilities.Log import define_root_logger import logging import pickle import torch import utilities.Log as Log import numpy as np import yaml def init(args, default_path, config): if not os.path.exists(default_path): os.makedirs(default_path) exp_num=0 el...
68cda8ba6cdabb98855e7035aa0d8e2b3f0765606dcc3c93ddb7e9a151bbb147
Python
7,709
270
import click import numpy as np import pandas as pd import tensorflow as tf from lib.model import simplified, standard, saluki from lib.sequence import SeqClassificationDataLoader1D, SeqRegressionDataLoader1D model_type = { "standard": standard, "simplified": simplified, "saluki": saluki } # options @clic...
f6a4fe2dfd785c67e2e7227d2912fda15b37d332f7895f14d116854647b2ec41
Python
7,709
207
import geohash2.geohash as geoh import shapely.geometry as geos import numpy as np def linecell_lons_bigger_step(p1, p2, cell_start, lons_all, lats_all, lons_center_all, lats_center_all): reverse = False if p2[1] < p1[1]: tmp = p1 p1 = p2 p2 = tmp reverse = True lats_start...
f39e4d647bab6ecb57be193b523a734b1e9f876d34958d0599ac08c54fa00964
Python
7,710
279
import os os.environ["OMP_NUM_THREADS"] = "6" # export OMP_NUM_THREADS=1 os.environ["OPENBLAS_NUM_THREADS"] = "6" # export OPENBLAS_NUM_THREADS=1 os.environ["MKL_NUM_THREADS"] = "6" # export MKL_NUM_THREADS=1 os.environ["VECLIB_MAXIMUM_THREADS"] = "6" # export VECLIB_MAXIMUM_THREADS=1 os.environ["NUMEXPR_NUM_THREA...
fbff3f6cc11b82203547851f9548b9a76c5751eddf6728baac27f2baf33ca942
Python
7,710
224
import torch import torch.nn as nn from elasticai.creator.nn.integer.addition import Addition from elasticai.creator.nn.integer.conv1dbn import Conv1dBN from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule from elasticai.creator.nn.integer.quant_utils import ( AsymmetricSignedQParams,...
3b9c22b80605a7553901d2adb64bb6990947a2dd06da9dba866a4635fffdd2ea
Python
7,711
112
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
7a6f2499bfa02a45e5f93b9876b41ae376c066d24b5ddd1bb059d8196bbea48f
Python
7,716
192
import SimpleITK as sitk import pandas as pd import numpy as np from skmultilearn.model_selection.iterative_stratification import iterative_train_test_split from data.constants import * def anonIDToRadiomicsUID(anon_id, patient_key): # Find UID from a given filename # Look up UID in patient key -re...
d77995a59f6c4c3162e87662d9b3f0222a519c9ff3437ce396d5683584ed401f
Python
7,716
198
"""Tests for the report_figures/<kind>/*.png embed sections (Phase 2 Task 5).""" import json import os import struct import zlib from regtools.registration.report import build_html_report from regtools.registration.report.analysis_figures import ( _render_cell_density, _render_checkerboard, _re...
25d8f643d5a90673f6bff88786d1a079a503ed925e1a96ef73c7304edf40d6d3
Python
7,717
182
""" Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free software: yo...
5b15dac3bedd3698ce5d479f0aef882519e243430ae60fcfbd4cfcbc4e1a4446
Python
7,717
225
# -*- coding: utf-8 -*- # IMPORTS import sys from PIL import Image import numpy as np import pandas as pd import matplotlib.pyplot as plt import random import argparse import os import time import glob from tqdm import tqdm USER = os.getenv('USER') sys.path.append('../.') # torch packages import torch import torchvisi...
d5ae8286bdeb3f6e8438ed6c1d4ceda88d26a3decc0ebe50ca1bf199437c2095
Python
7,717
199
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
38be2f46832ee1be6787cbec1b3eca23d0eca4a3d4cbe77fb41308d3d7f48c81
Python
7,719
198
# -*- coding: utf-8 -*- r""" This file implements a combination of the atomic charge dipole model and the bond charge dipole model with regularization resulting in the AC+BC(R) dipole model. Atomic property predictions from the network are interpreted as atomic charges. A charge neutrality constraint is applied to enf...
7c4f790472c76daa2c43bf23fd359d9acdb0f637319627f11e33c7989dd1279f
Python
7,719
209
import torch from torch import nn from torch.nn.functional import normalize from torchvision.models.resnet import Bottleneck, BasicBlock, conv1x1 class BackBoneModel(nn.Module): def __init__(self, input_shape: int, output_shape: int): super().__init__() self.conv_...
8075f4155000aa9c07253f0bd507418db3653e9c67760cb7d34dd0ae3e5b9482
Python
7,719
183
"""""" """ Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free softw...
00691541e3d289dce762af9046e3a5e18ab1d1508848fa3eddb05e719b52128b
Python
7,723
204
import torch import torch.nn as nn import torch.nn.functional as F class Attention(nn.Module): # Checked def __init__(self, dim, num_heads, attn_dropout=0.0): super(Attention, self).__init__() self.num_heads = num_heads head_dim = dim // self.num_heads self.scale = head_di...
d9c5c8aa321b10e9dbc6c0727d33ca031558770892c1b7d07b22afd0d15df47c
Python
7,724
215
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
432ff1f4fd2c49b747b0fe343089a3ad15fba1bb9d869485ea232667af23886b
Python
7,727
202
import numpy as np import pytest from molecularnodes import framing def random_basis(rng) -> np.ndarray: "A random orthonormal (right, up, forward) basis." basis, _ = np.linalg.qr(rng.normal(size=(3, 3))) if np.linalg.det(basis) < 0: basis[0] *= -1 return basis def frustum_slack(points, loca...
8980d37b794495fab32663f45208092cd10a4040c6aeb8c75615c0cabfe879c8
Python
7,727
221
import numpy as np import nibabel as nib import re import os os.environ["OMP_NUM_THREADS"] = "15" # export OMP_NUM_THREADS=1 os.environ["OPENBLAS_NUM_THREADS"] = "15" # export OPENBLAS_NUM_THREADS=1 os.environ["MKL_NUM_THREADS"] = "15" # export MKL_NUM_THREADS=1 os.environ["VECLIB_MAXIMUM_THREADS"] = "15" # export VE...
0cbf000e4e43f1496f7b800db00bccf5b6358ed8d31aa8366a12eda4b3abb776
Python
7,728
274
import numpy as np import torch from hippo.models.hmm import HMM from hippo.agents.memory import Memory from hippo.free_energy.tree import construct_tree from hippo.models.cscg_tools import add_death from hippo.free_energy import free_energy from pymdp.maths import softmax from gymnasium import spaces import netwo...
0618e4a053f713a076d207afb69bebe6d5f514cc2cb91d9befeaab35e38674a7
Python
7,732
240
""" (*)~--------------------------------------------------------------------------- Pupil - eye tracking platform Copyright (C) 2012-2020 Pupil Labs Distributed under the terms of the GNU Lesser General Public License (LGPL v3.0). See COPYING and COPYING.LESSER for license details. ------------------------------------...
50efb122b61975c62a1f7829f1104d5e7cc76f6d050a8986490d8b7574e1abef
Python
7,732
181
#!/usr/bin/env python # Copyright (c) 2019-2020 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ Change lane scenario: The scenario realizes a driving behavior, in which the user-controlled ego vehicle follows a fast driving ...
eee652c65e26d8e94a794462250c2eb9dc86aeb0c5cf875a428c415cb9e60b5e
Python
7,733
129
"""REAL_PN_BADEL.py 2026-10-01. Pre-registration: 04-NOTES/PREREG-2026-09-30p-BADEL-REAL-PN.md (frozen before the data). A second real fly: Badel, Ohta, Tsuchimoto & Kazama (Neuron 2016) Table S2, projection-neuron responses of 37 glomeruli to 84 odours. Hallem & Carlson (2006) receptor responses (DoOR) drive the anten...
f0346ffc6209ec78312e4f41f37bd25edfc247f204a9d4e9a33bacb236fde60e
Python
7,734
171
import warnings warnings.filterwarnings("ignore") warnings.filterwarnings("ignore", category=UserWarning, message="A NumPy version >=1.18.5 and <1.25.0 is required for this version of SciPy*") import sys import os import argparse import pandas as pd from glob import glob from nilearn.glm.first_l...
95476143407c36162f82df567364d3743c500164d15c5826f7095953b3b8332b
Python
7,735
250
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
7a4cdc956d7c5d278e62fcc1c259ddd595900def408effa5485128c48f4013bf
Python
7,736
217
## # \file run_reconstruction_parameter_study.py # \brief Script to study reconstruction parameters and their impact on the # volumetric reconstruction quality. # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date September 2017 # import os import numpy as np import SimpleITK as si...
39e8dc75e281433d08dec16c1d01a39a5f4a0de105425e2eaf6e62b717feb050
Python
7,737
211
"""Assemble the report's data payload. The redesigned report is interactive - point-set switching, metric switching, region search, hierarchy roll-up, threshold switching - so numbers can no longer be baked into markup at build time. This module collects everything the front end needs into ONE JSON-serialisable d...
7d90ac0f987cd2ad587a16f2585396b08e8a5c0a4526d352466e90fcdf373fee
Python
7,740
197
"""Estimate all possible number events starting from a base model or the maximum possible.""" import gc from typing import Any import numpy as np import pandas as pd import xarray as xr from hmp.basedata import BaseData from hmp.models.base import BaseModel from hmp.models.event import EventModel from hmp.patterndat...
aace557756195fbc7276fd3fb0f913ed6293543ec05871b3943e39e327fa8a47
Python
7,740
172
from torch import nn from typing import Optional from segmentation_models_pytorch.base import ( SegmentationModel, SegmentationHead, ClassificationHead, ) from segmentation_models_pytorch.encoders import get_encoder from .decoder import DeepLabV3Decoder, DeepLabV3PlusDecoder class DeepLabV3(SegmentationM...
ac7f44b548cb04213dcbb3d72676adc47131cfc844e3ed6ac48f6ce719d68aa3
Python
7,740
216
from pathlib import Path import numpy as np import torch from torch import nn from elasticai.creator.nn.integer.design_creator_module import DesignCreatorModule from elasticai.creator.nn.integer.matrixmulti import MatrixMulti from elasticai.creator.nn.integer.quant_utils import ( AsymmetricSignedQParams, Glob...
e0b065ce594bf8e120bde9bf148d5b1b7282ea75bfcfbe132949663e5b2c5e81
Python
7,742
168
import os.path from collections import defaultdict from lxml import etree import zipfile from ckg.graphdb_builder import mapping as mp, builder_utils ######################### # Drug Bank # ######################### def parser(databases_directory): config = builder_utils.get_config(config_name="drugBan...
6f35fd075e4be4d62880203d3547f8d451cce51402bee677eb737ee84674020b
Python
7,744
225
# Plots the individual trials and trial average of the epidural recordings # used in Fig 1B from os.path import join from get_paths import * import numpy as np import matplotlib.pyplot as plt from scipy.io import loadmat from scipy import signal from colors_paultol import colors plt.rcParams["mathtext.default"] = "re...
28d6ef13700ee66e43c31243b93ac97910cef30769658aa6d773799a97657f42
Python
7,745
299
import abc import logging import os import subprocess import time import cv2 logger = logging.getLogger(__name__) class BaseVideoEncoder(object): """ Base class for encoder interfaces. """ def __init__( self, folder, stream_name, resolution, fps, color_format...
389af1172b8ae830dc940283a5e7197d05ab6d9ec15c673bb383c03d957f84bf
Python
7,745
166
import argparse import cv2 import glob import os from basicsr.archs.rrdbnet_arch import RRDBNet from basicsr.utils.download_util import load_file_from_url from realesrgan import RealESRGANer from realesrgan.archs.srvgg_arch import SRVGGNetCompact def main(): """Inference demo for Real-ESRGAN. """ parser ...
908973f04f48e815fd3f55f2b2b49e1f1f68c3250f111406ad1fc2034a67ba73
Python
7,745
218
import os.path as osp import numpy as np import torch import pandas as pd from torch_geometric.data import InMemoryDataset from torch_geometric import data as DATA from rdkit import Chem from rdkit.Chem import MolFromSmiles import networkx as nx from rdkit import Chem from rdkit.Chem import ChemicalFeatures from rdkit ...
f1a5bda1f7053c13e6142f5561af8bdbfa443ddfd3547f699896a9e2589152ea
Python
7,745
247
from collections import namedtuple, Mapping from heapq import heappop, heappush import operator from .utils import INF, get_pairs, merge_dicts, flatten # TODO - Visibility-PRM, PRM* class Vertex(object): def __init__(self, q): self.q = q self.edges = {} self._handle = None def clea...
c31557da01e4c4d6ecb2d9ecde63766d73e11eab477a33ca2b566799ad12bd4e
Python
7,746
193
"""Preset UI in the Parameters tab (issues #114, #116). Builds a real RegistrationApp offscreen (so the Parameters tab has its sibling RegistrationTab combos) with the preset JSON sandboxed via redirect_to. """ import os import sys PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")...
a5c72e34b2d4f3a2f570dde4e0d59913b91f28ea2237451e5f4e5f72d1e11bc3
Python
7,748
229
import numpy as np import matplotlib.pyplot as plt from hippo.environments.w_maze import get_wmaze from hippo.environments.action_perception import action_perception_loop from hippo.visualization import visualize_trajectories from hippo.evaluation.replay import ReplayEvaluation import logging from copy import copy ...
a8cad7b8423a168a3df46950b0d3e6e2d515da8c2d10d3915dcf735d938e382c
Python
7,749
180
""" Script for plotting bivariate statistical analysis of pattern pairs Input: - Path to the input UniStat pickles for two set of patterns - Parameters for the bivariate analysis Output: - Plot graphs with the statistical bivariate analysis of every pair """ __author__ = 'Antonio Martinez-Sanche...
2849e1e9d53de7da1fd4e994084823f3b517ad633700178cee68d5c36b8444c2
Python
7,750
220
import torch import torch.nn as nn from elasticai.creator.nn.integer.addition import Addition from elasticai.creator.nn.integer.fusedsepresidualblock.design import ( SepResidualBlock as SepResidualBlockDesign, ) from elasticai.creator.nn.integer.quant_utils import ( AsymmetricSignedQParams, GlobalMinMaxObs...
4563093b5be02c9b37887b84e72df160912cbb64fb9fe3d056e8cec6ea46eff4
Python
7,750
154
""" EFFECTOME_SIGN_PERTURBATION.py THE POINT OF THIS SCRIPT, in one paragraph. Pospisil's supplementary information asks, in his own words: "would our results change if the protocol for measuring the connectome had changed, or if the connectome of a different fly had been measured?" He answers it by adding Gaussian n...
54a3be0cea92d5f801bdfe1c4e828bc3601a6b7fa4bcdb8f0c7481cdc578209b
Python
7,751
220
import numpy as np import keras #from keras.datasets import mnist from keras.models import Sequential from keras.layers import Dense, Dropout, Flatten, Merge from keras.layers import Conv1D, MaxPooling1D, AveragePooling1D from generic_tajD import calc_S_and_k_from_seqs, count_all, tajD from random import choice from ma...
82ebffd1bc67896b7803636d23c62f42d2d672146c3c933562d740fd35c4c666
Python
7,751
287
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
9bdd48dc67e5527bd17fab51daebb87a29c549a6a40bb54aaac8101fbbf8f939
Python
7,751
187
from __future__ import annotations import pytest pytest.importorskip("tblite.ase") from copy import deepcopy import numpy as np from ase.build import bulk, molecule from numpy.testing import assert_array_equal from quacc import change_settings from quacc.recipes.tblite.core import freq_job, relax_job, static_job ...
8445acded58edc11f84345f2d9c4560453442495fb57f3c94850eaedc3747edb
Python
7,752
214
# # MIT License # # Copyright (c) 2022 GT4SD team # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,...
9ce47a358bbb485fd49bf9d632b60128ef943d4d44305f5f2998288b9bdeae31
Python
7,753
154
from PyQt5.QtGui import QFont from PyQt5.QtWidgets import QDialog, QGridLayout, QLabel, QHBoxLayout, QSpinBox, \ QCheckBox, QComboBox, QPushButton from src.settings import Settings class ImagePipelineSettingsDialog(QDialog): def __init__(self, parent=None,apply_flag=False,process=False,progress_bar=None): s...
06fd182621bbfc44a3b964ea419f80bd335d296f4a3a31bd9b3cfe8eb019227e
Python
7,755
216
"""Unit tests. """ import unittest from os.path import abspath, curdir, join import pyensembl from agfusion import database, model, parsers data_mouse = pyensembl.EnsemblRelease(84, "mouse") db_mouse = database.AGFusionDB(abspath(join(curdir, "agfusion.mus_musculus.84.db"))) db_mouse.build = "mus_musculus_84" data...
c7a21e552968d2f3c737015834a481fa0484d21fc0f7fd0665cff7a161c25fdf
Python
7,761
197
"""End-to-end integration tests against the real bundled Allen CCF. These exercise the full pipeline the way a user would: load real CCF + real brain backdrop -> make a small set of edits -> export the modified annotation -> re-load the exported session -> verify the export reconst...
444d1513847c1c985529538db2dcc443a3a53fe7b659aabf361349b75eac3cc0
Python
7,764
186
import importlib import networkx from merlin.core import analysistask from merlin.core import dataset class SnakemakeRule(object): def __init__(self, analysisTask: analysistask.AnalysisTask, pythonPath=None): self._analysisTask = analysisTask self._pythonPath = pythonPath @s...
defcac05f44d363d1e06b04f12bc129f20885c256adedd2fed98c69f883e0f1a
Python
7,764
242
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
2cd51fe7e5162155ce8f9a1a8b975e8b2862da4b85b4afeb25f2d4bf1eb09657
Python
7,765
239
"""Transition state recipes for Q-Chem.""" from __future__ import annotations from importlib.util import find_spec from typing import TYPE_CHECKING from monty.dev import requires from quacc import job from quacc.atoms.core import perturb from quacc.recipes.qchem._base import run_and_summarize_opt from quacc.recipes...
421e5aebbf1e84fd88dfcb778712107521f9d6e621eb62602c74660cd87a2530
Python
7,767
215
import sys import os import schnarc import logging import shutil import argparse import numpy as np import datetime import copy import time (tc, tt) = (time.process_time(), time.time()) #import schnet import schnetpack as spk import torch import torch.nn as nn from torch.optim import Adam from torch.utils.data.sampler ...
4505f536d033aa12204280c8ef188de04c4f107ba5409cd09e6a65b8e79d7025
Python
7,767
194
from neuron import h import neuron import math import numpy as np from matplotlib import pyplot as plt class test_cell(object): def __init__(self, channel_name, step_v, gbar, area, volumn, tstop) -> None: # channel_name = ['shl1', 'egl2' ...], a list # step_v = list(range(stim_start, stim_end+1, st...
61f734dd85b68705c452e06b7ba2041665b9f98f6a7754ebac7765ca2360a13f
Python
7,767
230
## # \file show_evaluated_simulated_stack_similarity.py # \brief Script to show the evaluated similarity between simulated stack # from obtained reconstruction and original stack. # # This function takes the result of evaluate_simulated_stack_similarity.py as # input. # \author Michael Ebner (micha...
4059b6b9de0de303b157c37428f2d531a2089c5221d8c8ac17b7e5b8e76c2ed8
Python
7,768
285
"""Methods for loading files and handling the resulting objects.""" import os from typing import Union from mne import read_epochs from coh_handle_files import generate_sessionwise_fpath, load_file from coh_signal import data_dict_to_signal, Signal def load_preprocessed_dict( folderpath_preprocessing: str, d...
7edd94cd9b7e604442d6c7206c0bdc395c7b283a8563444783b7f6f0a5cbca3a
Python
7,768
209
""" Authored by: Neel Kanwal (neel.kanwal0@gmail.com)""" # This file provides inference code for binary DCNN and ViT models mentioned in the paper. # Update paths to processed datasets if __name__ == "__main__": import warnings warnings.simplefilter(action='ignore', category=FutureWarning) war...
41a7f5bff7c25859587c4c47a1459362e5c043d4d56648c2f6b57d6ed5dea211
Python
7,770
242
# -*- coding: utf-8 -*- # # Tempo documentation build configuration file, created by # sphinx-quickstart on Mon Jan 13 15:59:22 2014. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All c...
1473c6eaeff9ababce1b17c93d106920805349e3c5ce2e3bb7d8ccf81af0fb9b
Python
7,772
185
"""Tests for fingerprint comparison metrics. Author: Seth Axen E-mail: seth.axen@gmail.com """ import pytest import numpy as np from scipy.sparse import csr_matrix from scipy.spatial.distance import cdist from e3fp.fingerprint import metrics, fprint, db from e3fp.fingerprint.metrics import array_metrics, fprint_metri...
ebdbd321e02398a830bdf071214f56237382fc76787d49e380c4c8c5af9e6775
Python
7,772
236
#!/usr/bin/env python3 # ****************************************** # # SHARC Program Suite # # Copyright (c) 2023 University of Vienna # # This file is part of SHARC. # # SHARC is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by...
34c272591c5d115f2b74174f223a1822a9b7e110a21378a1117cef4b4c916c96
Python
7,773
222
"""upload_docs Implements a Distutils 'upload_docs' subcommand (upload documentation to sites other than PyPi such as devpi). """ from base64 import standard_b64encode from distutils import log from distutils.errors import DistutilsOptionError import os import socket import zipfile import tempfile import shutil impor...
d8d18901e0a2a0912f5765a84a4bcdd168a5b4d0e1a5d80abad37edba21906df
Python
7,773
243
# -*- coding: utf-8 -*- from __future__ import annotations import os import pickle import struct from io import BytesIO from typing import Any, Iterable, Optional import torch from torch.distributions.utils import lazy_property from supar.utils.logging import get_logger, progress_bar logger = get_logger(__name__) ...
7ae2810832a7b1f94a53e055695dcca6e9199fe4c5e451531eb63d1b886c0a5a
Python
7,776
197
# # Tests for memory_profiler module # # Copyright © 2026 Ernst Strüngmann Institute (ESI) of the Max Planck Society # # SPDX-License-Identifier: BSD-3-Clause # from unittest.mock import patch, MagicMock from acme.memory_profiler import MemoryProfiler from acme.argument_processor import ArgumentProcessor class TestM...
8fa393962188f00c3e2ad8d1dd6b2962d823016f690ee88d65a4c4b9272a55f6
Python
7,780
183
import torch import torch.nn as nn import cv2 import numpy as np from flytracking.detection.utils.process import postprocess from flytracking.detection.utils.efficientdet import ( BBoxTransform, ClipBoxes, ) def calc_iou(a, b): # a(anchor) [boxes, (y1, x1, y2, x2)] # b(gt, coco-style) [boxes, (x1, y1...
0844860b87463190b9c472fa62046251cc578ab515f4c6e07685c111a2865bf2
Python
7,782
253
# coding: utf-8 """ This code is based on the following paper: Renner, A., Sheldon, F., Zlotnik, A., Tao, L., & Sornborger, A. T. The Backpropagation Algorithm Implemented on Spiking Neuromorphic Hardware. arXiv:2106.07030 (2021). This is a numpy implementation of the backpropagation algorithm for the binary neu...
2bbebfa8d0d66f6a3bb10ede12c1eb929448a8d20e85cbfe8c51eab66e910838
Python
7,782
181
import os os.environ['KMP_DUPLICATE_LIB_OK']='True' import numpy as np import torch from torch_geometric.nn import GCNConv import networkx as nx import GNN_core import argparse import random import torch.optim as optim import copy from sklearn.metrics import confusion_matrix, roc_curve, auc parser = argparse.Argument...
05ae8dccca1ef5f103bdbb9b6ae97feb11123cade1da515ef9968b19c5283f2e
Python
7,783
175
import numpy as np import unittest import pyntbci FS = 120 N_TRIALS = 11 N_CHANNELS = 7 N_SAMPLES = 2 * FS N_CLASSES = 5 CYCLE_SIZE = 1.0 class TestGenerateImpulseResponse(unittest.TestCase): def test_default(self): ir = pyntbci.eeg.generate_impulse_response(FS) self.assertEqual(ir.ndim, 1) ...
c3b436bd309a554e8bc2f6956d4bbfb4c0279356c520b7f1deb21d68b16297fd
Python
7,783
200
import torch import torch.nn as nn from model.backbone import get_visual_backbone from model.encoder import get_encoder, TransformerEncoder from model.decoder import get_decoder from utils.utils import * import numpy as np class MLMTransformerPretrain(nn.Module): def __init__(self, cfg, src_lang): super(...
1feeabe3a4655874b33ab77672ba3334a8f24d46ccc0c6f3aaa9188ddc0d0d2c
Python
7,784
199
"""Write a copy of an input ``.h5ad`` with registered CCF coordinates and per-cell atlas labels appended - without materializing ``X``. The source file is copied byte-for-byte (``shutil.copy2``) so the expression matrix and all existing metadata are preserved on disk, then the new elements are appended in-place w...
c4b9f0e6ec7225c60ba12790ce9784ea40a8da8b206de40a5ad383b87f172ec0
Python
7,784
200
import gc import multiprocessing as mp import os import tempfile import unittest from copy import copy import numpy as np import pandas as pd from torcheeg.datasets import BaseDataset from torcheeg.io import EEGSignalIO from torcheeg.model_selection import Subcategory from torch.utils.data import DataLoader def _re...
3b0bd69c6cf8e2ad946b603dbce215865f8425ad91f5b6f8efbbb8e435440be3
Python
7,788
225
# -*- coding: utf-8 -*- # IMPORTS import sys from PIL import Image import numpy as np import pandas as pd import matplotlib.pyplot as plt import random import argparse import os import time import glob from tqdm import tqdm USER = os.getenv('USER') sys.path.append(f'/home/{USER}/CODE/Pytorch-fingerprints/') # torch pa...
6c016dd7fc90c10069ec1e04725e8eaef47deee21a2bd7ecbe43377a43d6c04a
Python
7,788
146
"""Language-model loading and logit comparison (the Qwen3 adapter's loader). Coupling policies live in coupling.py and the interface mathematics in interfaces.py; they are re-exported here for existing imports. """ from __future__ import annotations import time from typing import Any import numpy as np import torch ...
99335be8f773bf5072b17f64f05bc68705be1def1c0fb01e6b2e16103649d1d9
Python
7,788
208
#!/usr/bin/env python #================================================================ # Copyright (C) 2022 Yufeng Liu (Braintell, Southeast University). All rights reserved. # # Filename : main_projection_analyzer.py # Author : Yufeng Liu # Date : 2022-08-03 # Description : # #======...
3223516b758e0d4acd44d5235c5cf52e84649d8d2303b3a7da0ce65f69a23030
Python
7,789
227
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Written by Tong He and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md """ import os import time import random import argparse import numpy as np from pathlib import PurePath import torch import torch.utils.data import torch.nn as ...
a5bb824f822e10f65623ced3ccd066feb39c6a3e656f7bf4d71bb663aca6ae62
Python
7,792
257
import os import argparse import numpy as np import pandas as pd import torch from maldi_nn.models import SpeciesClassifier, MaldiTransformer from maldi_nn.utils.data import SpeciesClfDataModule from lightning.pytorch.callbacks import ModelCheckpoint, EarlyStopping from lightning.pytorch.loggers import TensorBoardLogge...
c1a1af13a7435329300b4a84e6baed8dbdc07d0dd0ae3722f1d5f1fae1b05a9c
Python
7,796
196
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
c9f46393556620726077d4cb6c67d1346000846315fa0fa5a984e7fc99c97de7
Python
7,800
228
#!/usr/bin/env python # requires band_deeph.json and band_dft.json created by plot_bands.py import numpy as np import json import matplotlib.pyplot as plt import matplotlib.lines as mlines min_plot_energy = -2.5 max_plot_energy = 4 trim_gap = True trim_min = 0.1 trim_max = 1.0 fontsize = 22 legend = False legend_k...
03e7e376bbdcbf38f3816440c2fb8174f7f0896aac6dc793476015624997745c
Python
7,801
213
# # MIT License # # Copyright (c) 2022 GT4SD team # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,...
327b366893e903c64408011b98d5c1d8ebe6701f71f000cc21029c30ac3cbf90
Python
7,801
263
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
15424caa574d687a497f0c07f6e4f97270d4949f04c9b09705ae1c3f186fe37a
Python
7,803
204
import tensorflow as tf from tensorflow.keras.layers import Dense, Layer, Concatenate, AveragePooling1D from tensorflow.keras import Model from tensorflow.keras.activations import sigmoid, linear from tensorflow import transpose, matmul, expand_dims from tensorflow import keras from tensorflow import reshape from tenso...
ab8053b8a794716c1751b4980655504bfe1c6304de0699adc2787b43b0b3b201
Python
7,803
190
import configparser import logging import logging.config import multiprocessing import os import time import yaml from pkg_resources import resource_filename import NDATools from NDATools import NDA_TOOLS_LOGGING_YML_FILE from NDATools.upload.cli import NdaUploadCli from NDATools.upload.submission.api import Submissi...
fde14b849c6872b04a91029fde0c7b0ecc68296c18dd3e442093f1bcf50ee790
Python
7,804
161
import os import pandas as pd import numpy as np import matplotlib.pyplot as plt import re from scipy import stats def one_sample_ttest(sample_data, null_hypothesis_mean=0.0, significance_level=0.01): # Calculate the T-test for the mean of ONE group of scores t_statistic, p_value = stats.ttest_1samp(sample_dat...
00c004d1c83834a34103fc23cd78253fe96452876eec11fc43c974afc63a9838
Python
7,809
236
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
76b690ffd262860f3fdff731cc0f1163b5f5f6c7ca2dd6ad066a4222b8ce0d98
Python
7,810
176
from typing import Tuple import torch import torch.nn as nn class BEncoder(nn.Module): r''' The variational autoencoder consists of two parts, an encoder, and a decoder. The encoder compresses the input into the latent space. The decoder receives as input the information sampled from the latent space and pro...
bf497f06915159d4363ae50eb0e7da73d398352c02c89b30d4a7a344ae4971bc
Python
7,810
248
import os import numpy as np from ...annotations.base import BaseAnnotation from ...annotations.manager import BaseAnnotationManager from ...nodes._utils import get_final_style_nodes from ..annotations import Label2D, Label3D from ..base import EntityType class DensityAnnotation(BaseAnnotation): """ Base clas...
d13237bc2e4772f30d636edf23f6e2da8513e78b1f48c07356e62c4f86921c36
Python
7,811
120
"""SFF_SEARCH.py 2026-09-28. Pre-registration: 04-NOTES/PREREG-2026-09-28-SFF-SEARCH.md Test 2 of SIGN_FROM_FUNCTION got stuck far above the truth's loss. Can a search that does not know the truth find it, and does the lowest loss pick it? Four searches (literature start, steepest from the classifier, two random starts...
04aa3bc4469c1f0577ba5080d588821b62c47c1cb42e7eff19e71fc14f70113d
Python
7,812
193
from __future__ import annotations from shutil import which import pytest DFTBPLUS_EXISTS = bool(which("dftb+")) pytestmark = pytest.mark.skipif(not DFTBPLUS_EXISTS, reason="Needs DFTB+") import logging import os import numpy as np from ase.build import bulk, molecule from quacc import change_settings from quacc....
61434df00ae5eef7f6295295ad002cfecef9517bf17dc3b04d409407bdd62de6
Python
7,813
163
# SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL # # SPDX-License-Identifier: AGPL-3.0-or-later '''Description: Functions to extract (and cut) spike trains in topo-sample format using bluepysnap and SONATA circuit configs Author: C. Pokorny Date: 09/2023 ''' import json import numpy as n...
544e538a2f22364436aea00226230b656f7d81e219e2be8b046a192e23f3f593
Python
7,815
240
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, ...
a25dd659be49ebc01c8adc373da01d1b9ceaf05c29fcfba24ee407ac6896db11
Python
7,815
260
import cocotb import pytest from cocotb.clock import Clock from cocotb.triggers import RisingEdge, Timer from cocotb.types import LogicArray from cocotb.utils import get_sim_time import elasticai.creator_plugins.mac_delta as mac_delta import elasticai.creator_plugins.multipliers as multipliers from elasticai.creator.a...
3f5df0a23d9294bb8897dc88930e729f18487695c897c2f8ef348e1c34196b7f
Python
7,816
209
import os from multiprocessing import Process, Queue from queue import Empty import numpy as np import open3d as o3d import torch def normalize(x): return x / np.linalg.norm(x) def create_camera_actor(i, is_gt=False, scale=0.005): cam_points = scale * np.array([ [0, 0, 0], [-1, -1, 1.5...
291ba0d8dddbf9898d193f880434436b9a7357fdcd330417bf32b51747e117dd
Python
7,817
249
#!/usr/bin/env python3 import pysam import sys import numpy as np import pandas as pd import numpy as np from sklearn.mixture import GaussianMixture import argparse import logging import tqdm import pickle def coordinateConversion_MMTag(sequence, base, modification_coords): """Sequence is array of bases. Base is ...
dc0be37cf1dedeaddba70ddf35ff40de07418109a6f35093b50085effc1f526f
Python
7,817
234
import torch import torch.nn as nn import torch.nn.functional as F import argparse import os #import wandb import tqdm import numpy as np import pandas as pd import data import util import net as networks from sklearn.model_selection import KFold from torch.utils.data import DataLoader """ Optimized Hyperparameter ...
123f973de307e76764d56d5f1f8eac1d8145e742826ce674ffdda9572267c856
Python
7,819
175
''' Description: Test scNODE when using different number of pre-training timepoints and fixing the latent space. Author: Jiaqi Zhang <jiaqi_zhang2@brown.edu> ''' import os.path import sys import matplotlib.pyplot as plt import torch import torch.distributions as dist import numpy as np import pandas as pd fro...
10edf4bf262dad2ee1ab5f746d6c9262605bb1ec182e2d8ee03b2ae58cdd6274
Python
7,820
233
# -*- coding: utf-8 -*- import tensorflow as tf from tensorflow.python.util.deprecation import deprecated from .. import _logging as logging from .core import * __all__ = [ 'LambdaLayer', 'SlimNetsLayer', 'KerasLayer', 'EstimatorLayer', ] class LambdaLayer(Layer): """A layer that takes a user-d...
fccb2c3b072d8567d49d134c06bffb657927a89b1dddda4a8d1c16d103f25d4f
Python
7,821
184
# coding=utf-8 # Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Lice...
8b0929629350557a12c312bddf59887191d7ee0a1b28affd0239d74aece9f203
Python
7,824
169
import numpy as np import torch from transcal.utils import get_weight, ECELoss, VectorOrMatrixScaling, TempScaling, CPCS, TransCal, Oracle from transcal.TransCal import cal_acc_error class ECE: def __init__(self, n_bins=10): self.n_bins = n_bins self.n_samples = 0 self.correct = [[] for ...