sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9dac64e498cd588cb56e257bda522676b866626cc661fb03d16e8ade8b483446
Python
7,166
221
import ast import yaml import copy import argparse from argparse import ArgumentParser, RawDescriptionHelpFormatter class ArgsParser(ArgumentParser): def __init__(self): super(ArgsParser, self).__init__( formatter_class=RawDescriptionHelpFormatter) self.add_argument( "-o", ...
5a47db2a454139d3a0155269cd18693adf6424c0feab104a668973012ef3b772
Python
7,167
227
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network model_templates and simulations. See also: # https://github.com/pyrates-neuroscience/PyRates # # Copyright (C) 2017-2018 the original authors (Richard Gast and # Daniel Rose), the Max-Planck-Institute for Human C...
4bd76f42b3d762abaf3b12eea329b3b01f3daac16612d2418bff804561cf6f7d
Python
7,168
168
import argparse import numpy as np import pandas as pd import tensorflow as tf import random as python_random from keras.models import Sequential from sklearn.model_selection import KFold from keras.layers import Dense, Conv1D, MaxPooling1D, Flatten, Dropout from sklearn.model_selection import train_test_split from skl...
6fdd4776cd20b9be21d86fc77c309d439f1699796fefc8aa46618aa32ea7107c
Python
7,169
200
import sys import os import numpy as np import networkx as nx import random from rdkit import Chem from rdkit.Chem import rdmolops from rdkit.Chem import rdMolDescriptors from rdkit import DataStructs import torch import torch.nn.functional as F def mol_to_nx(mol): G = nx.Graph() for atom in mol.GetAtoms()...
07639c72dfbea95da393fcd01554833d9590b4aceba37731f5a5eb97597359ae
Python
7,172
186
from brian2.units import * from brian2 import seed """ JSON PARAMETERS HERE (+DEFAULTS) """ # Simulation duration = 1*second # simulation duration debugging = False # run in debugging mode (numpy vs cython, no optimization, reporting) # population sizes per area | [E, I] N_EC = [] # def: [10e3, 1e3] N_DG = [] # def: ...
607dfc9008a967fc3bf7a97c5730c919b206c7fb653b896c776f64750f1a3f80
Python
7,172
170
''' Module focused on the implementation of Prediction Convolutional Layers ''' import torch import torch.nn as nn class PredictionConvolutions(nn.Module): ''' Convolutions to predict class scores and bounding boxes using lower and higher-level feature maps. The bounding boxes (locations) are predict...
a78f710cd7067b59636a1c5b3990c93100c734c1bc211ce6e1126797a7408812
Python
7,179
186
"""`SparseUvuTensorProduct` must agree with the `e3nn.o3.TensorProduct` it replaces. The class is a hand-written torch specialisation of the sparse `uvu` tensor products PolarMACE uses, written so that it can also read and write cuEquivariance's `ir_mul` layout. It builds its weights from a reference `o3.TensorProduct...
d7290aee77c06ee4727dc50c5709db8513fc211bbdc30575eb34cdf15e099b39
Python
7,181
204
from chromadb.api.types import ( SparseEmbeddingFunction, SparseVectors, Documents, ) from typing import Dict, Any, TypedDict, Optional import numpy as np from typing import cast, Literal from chromadb.utils.embedding_functions.config_validation import ( validate_embedding_function_kwargs_are_safe, ) fr...
dc5927cb9ebca3349ef0cc248fb91a265ac0b7dc05371fcbfa986deca6b3bc2b
Python
7,183
215
import numpy as np from pydfc import DFC def test_create_dFC_state_based(): ## STATE BASED ## # create 5 FCSs with 3 regions representing 5 states FCSs = np.array( [ [[0.1, 0.2, 0.3], [0.4, 0.5, 0.6], [0.7, 0.8, 0.9]], [[0.2, 0.3, 0.4], [-0.5, -0.6, -0.7], [0.8, 0.9, 0.1]]...
be244407268c88238bc1c264af1a30c77ff8af7a12924fe5a4f934cfa0c03c72
Python
7,189
212
import tensorflow as tf # A Spatial Transformer specialized for affine transforms. # https://github.com/kevinzakka/spatial-transformer-network def spatial_transformer_network(input_fmap, theta, out_dims=None, **kwargs): """ Spatial Transformer Network layer implementation as described in [1]. The ...
be36360668804642709ccfcc77d975590f3098203b767fc26c6b4baffe75e382
Python
7,190
204
# Author: Youzhi Luo (yzluo@tamu.edu) # Updated by: Anmol Anand (aanand@tamu.edu) import random import torch import torch.nn.functional as F from torch.utils.data import Dataset from torch_geometric.utils import degree class DegreeTrans(object): r""" This class is used to add vertex degree based node feature...
b73054003562c0894198a99ba8d837b991f2d0ee960c4bded73e74d33a327d3c
Python
7,199
256
# -*- coding: utf-8 -*- import os import argparse import logging import matplotlib matplotlib.use("Agg") bounds = dict() bounds[0] = (1., 150.) # theta bounds[1] = (0.01, 0.35) # theta_rho bounds[2] = (0.1, 200.) # nu_ab bounds[3] = (0.001, 1.0) # nu_ba bounds[4] = (0.01, None) # migTime bounds[5] = (0.01, 1.0) # mig...
ed5bec7fb90f2c88a459c12c5154b4a433d713e4f80958042f30d17c09511a7a
Python
7,199
213
import math import geomstats.backend as gs from geomstats.test.data import TestData from .base import LevelSetTestData, VectorSpaceOpenSetTestData from .diffeo import DiffeoComparisonTestData from .invariant_metric import InvariantMetricMatrixTestData from .lie_group import MatrixLieGroupTestData from .pullback_metri...
ecfd945122f47b6397123028023c084a9ec6342ec3b2529c99a6178d950cad92
Python
7,200
211
########################################################################################### # Tools for torch # Authors: Ilyes Batatia, Gregor Simm # This program is distributed under the MIT License (see MIT.md) ########################################################################################### import functoo...
7ffde08de31bef0b7e6598429b9eb967390f39d93a4aef8b7a84aedc29bd0a68
Python
7,203
254
import copy import numpy as np import pandas as pd from pysurvival.utils._functions import _logrankScores # %matplotlib inline for Jupyter notebooks def as_bytes(string_array, python_version=3): """ Transforming an array of string into an array of bytes in Python 3 """ if python_version >= 3: r...
c65472c7a61e2d7eb24e9066ffd9babb86503926e8200468757cfbc18d16a603
Python
7,207
218
"""Shared helpers for the MACE test suite. Consolidates the fixtures/utilities that used to be copy-pasted across test files: * ``run_mace_train`` — run ``mace/cli/run_train.py`` (or another CLI script) in a subprocess with the repo prepended to ``PYTHONPATH``, replicating the historical pattern used throughout t...
3ef4b5cada9fe57f702216bf8785fdececbb9cbd6fc615c6f164cd697d1e8650
Python
7,208
185
import torch from torch import Tensor from torch_geometric.nn import MessagePassing from torch_geometric.nn import global_add_pool, global_mean_pool, global_max_pool, GlobalAttention, Set2Set, GENConv, DeepGCNLayer import torch.nn.functional as F from torch.nn import ReLU from torch_geometric.nn.conv.gcn_conv import gc...
c87e680fdd901a61cfdca78d52fc34cf3f35d38e1613b3693bf85d324311c74e
Python
7,208
212
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # 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 appli...
8a659f0eae247e5af0cc544360a37db8fab921134dc262382f62309cb77c328b
Python
7,211
206
import logging import torch from typing import Optional, Tuple, Callable, Union import numpy as np from dynaphos.utils import (Map, cartesian_to_complex, polar_to_complex, complex_to_polar) def get_visual_field_coordinates_from_cortex( params: dict, coordinates_cortex: Optional[M...
6b9b092e10026f9a8495fd65958be5c66f231c74f4088313d696e80d24d8d07b
Python
7,213
198
import argparse import os import torchvision.transforms as transforms from torchvision.utils import save_image from torch.utils.data import DataLoader import torch from models import * from datasets import * import numpy as np import nibabel as nib import torch.autograd as autograd parser = argparse.Argume...
c3cdbca12f1fc13481f69358e5f065edcaa18738439cf30cad1e4b45c6fa65c9
Python
7,215
228
import click from cloudfiles import CloudFiles from cloudvolume import PrecomputedSkeleton, Skeleton import numpy as np import os import pickle from corgie import scheduling, argparsers, stack from corgie.log import logger as corgie_logger from corgie.boundingcube import get_bcube_from_vertices from corgie.argparsers ...
859169aeb95c7919ae8137f4fe34fba047ebf311d6240b13418ab1ed4bc62e52
Python
7,216
183
from __future__ import annotations import logging import os.path from result_caching import store_dict import pandas as pd from tqdm import tqdm from brainio_base.assemblies import NeuroidAssembly from model_tools.activations.core import flatten from model_tools.utils import fullname from custom_model_tools.hooks impor...
8b9653f5f1f2c735c0fc82bcb25b02248910aeec4973f679d2ba92aeedf45c5e
Python
7,218
189
import numpy as np import sys import pickle import math amino_acid_set = { "A": 1, "C": 2, "E": 3, "D": 4, "G": 5, "F": 6, "I": 7, "H": 8, "K": 9, "M": 10, "L": 11, "N": 12, "Q": 13, "P": 14, "S": 15, "R": 16, "T": 17, "W": 18, "V": 19, "Y": 20, "X": 21 } amino_acid_num = 21 ss_set = {"C": 1, "H": ...
f87807c8b67f2335a3bd079c305cd7b46bcfacd6b15cc3abba9d32e31b353f31
Python
7,218
245
#!/usr/bin/python from smfishHmrf.HMRFInstance import HMRFInstance from smfishHmrf.DatasetMatrix import DatasetMatrix, DatasetMatrixSingleField, DatasetMatrixMultiField from smfishHmrf.spatial import rank_transform_matrix, calc_silhouette_per_gene import sys import os import math import subprocess import numpy as np im...
7ea19aea18df4103b4e52009d07ff4792716a06f7686a880eee548a25946e14b
Python
7,229
213
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import sys from openfl.experimental.workflow.interface import FLSpec, Aggregator, Collaborator from openfl.experimental.workflow.runtime import LocalRuntime from openfl.experimental.workflow.placement import aggregator, collaborator cl...
41577261bd4c53595e96f1d856a0e90ce5c2c21f767cf89cceaaf04651c35505
Python
7,230
195
# Copyright (C) 2020-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """You may copy this file as the starting point of your own model.""" import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import tqdm from openfl.federated import PyTorchTask...
238fd7c6fdd6ae6c86ddcb97113330ab4467ca93f7fad514a982c819f89747cd
Python
7,233
281
"""Logging and monitoring support Setup for Python and RDKit logging. Setup for remote monito """ from __future__ import annotations __all__ = [ "CsvFormatter", "VERBOSE", "setup_logger", "enable_rdkit_log", "setup_responder", "setup_reporter", "get_reporter", ] import json import os im...
baae0f50e90b2124be0c23caf74b63db224010ff1f665a010b5e62421558eb2e
Python
7,236
214
from __future__ import annotations import time from pathlib import Path import matplotlib import matplotlib.pyplot as plt import numpy as np from matplotlib import gridspec from pdfrw import PdfDict, PdfReader from pdfrw.buildxobj import pagexobj from pdfrw.toreportlab import makerl from reportlab.lib.pagesizes impor...
49f30acd26bc1610f5256eff5b42417107dd54c9fa286424a5a5f2a74c0af239
Python
7,244
195
from tensorflow import keras import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Dropout, Flatten, Input, BatchNormalization,ReLU #from tensorflow.keras.layers import Conv1D, Reshape, MaxPooling1D,Conv1DTranspose, UpSampling1D from tensorflow.keras.cal...
63e48227c53141fc4431990538c1b3e729e2fe744a530df8829f1829fe0acd06
Python
7,246
196
from lungmask import mask import lungmask import SimpleITK as sitk import numpy as np import nibabel import platform import glob import torch import skimage from tqdm import tqdm from monai.transforms import Compose, LoadImaged, ToTensord, Spacingd, DivisiblePadd, SpatialCropd, ToNumpyd, AddChanneld, SqueezeDimd, Resiz...
fa5b7a0cba34938c5046b16acce11cad6e5b417c68e99610d87f55b2e11e66ff
Python
7,246
112
#!/usr/bin/env python3 # PYTHON_ARGCOMPLETE_OK import argparse import sys def main(args=None): args = _parse_input_args(args) if args.command == "setup": from deeperwin.run_tools.setup_calculations import setup_calculations setup_calculations(args) if args.command == "restart": from...
b87f1642a6bf3f803f40dd6d87e969c5cc78de75627188ed0b2914f16300c205
Python
7,251
179
"""Load canonical CSV-like ``.sanpy`` recordings.""" import re from typing import Optional import numpy as np import pandas as pd from sanpy.fileloaders.epochTable import epochTable from sanpy.fileloaders.fileLoader_base import fileLoader_base, recordingModes from sanpy.sanpyLogger import get_logger logger = get_lo...
d72c985fc239ec9e076c0d22530962f745cd62cdb76642b42b8e2a52c83c81bb
Python
7,251
163
import os import sys import json import math import pickle import numpy as np import pandas as pd from hyper_dti.settings import constants objectives = { 'RandomForest': { 'BCE': 'gini', 'MSE': 'squared_error', 'MAE': 'absolute_error', }, 'XGBoost': { 'BCE': 'binary:logist...
b88a3eed9e16c207da74ca5c52c2a68467fbb522ee3349c41dab8e2b812bab1d
Python
7,258
173
"""The VDJdb confidence score. `score/confidence.py` was 39 % covered while deciding the number every consumer filters on. These pin the two behaviours the released scores depend on - the `n/m` frequency parse where `n` is a cell count, and the maximum over the sample signature - plus each branch of the two sub-scores...
24ce2a4eb453d30b783c924273a28d74dfbb013fb50d3c3fd746a85092da0c2c
Python
7,270
211
# -*- coding: utf-8 -*- """ Created on Fri Jul 23 11:25:14 2021 @author: nicol """ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 12 15:25:17 2018 @author: ngritti """ import time, os, glob from tqdm import tqdm import numpy as np from skimage.io import imread import seaborn ...
e9e8fbae840498993d9ead29ca6f753e017cdae735091ff1fddf2fe02fc9f516
Python
7,272
303
"""Execution backends. Lead authors: Johan Mathe and Niklas Koep. """ import importlib import logging import os import sys import types import geomstats._backend._common as common def get_backend_name(): return os.environ.get("GEOMSTATS_BACKEND", "numpy") BACKEND_NAME = get_backend_name() BACKEND_ATTRIBUTE...
f672689b0e408aa68b7999b095f082cc1a2c72181175df895d28ccd5ac827647
Python
7,272
185
""" Tests for one-sample permutation tests. Tests both basic functionality and statistical correctness. """ import pytest import numpy as np from nltools.algorithms import one_sample_permutation_test from nltools.algorithms.inference.one_sample import _one_sample_statistics class TestOneSamplePermutation: """T...
74c331a16d1e690142ace2a2ed0f21b8f55fe68de9f59e356c75d7929d937186
Python
7,275
183
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import torch import lightning from lightning.pytorch.callbacks import Callback from nequip.train import NequIPLightningModule class TrainingStatsMonitor(Callback): """Monitor and log detailed trai...
d0ebe2861f039ea61d0f2e19496121605ceefa0f477cfc0b641e604bd2a14fb9
Python
7,278
153
from pathlib import Path import os import pandas as pd import torch import copy from utils import save_projection_axes from data_classes import VOPADataset import numpy as np def parse_args(): import argparse parser = argparse.ArgumentParser( description='...' ) parser.add_argument( '...
a4da0fc9ff9832f67fb9f60c9a766612a807659300fb8cd6ded28d4b974b5866
Python
7,281
187
import os.path as osp import json from numpy import random from rdkit import Chem from rdkit.Chem.Scaffolds import MurckoScaffold from sklearn.utils import shuffle from tqdm import tqdm def main(): split_ratio = [0.6, 0.2, 0.2] split_root = '/mnt/dive/shared/kaleb/Datasets/PubChemQC/utils/splits' print...
1426ccf2fe746757ad3a7a344a47f827786dbe3e377d10e6edb69f025c7ed62e
Python
7,283
260
#!/usr/bin/env python import sys from psychopy import prefs prefs.general['audioLib'] = ['pygame'] from psychopy import visual, gui, event, logging from psychopy import sound, core import time as ptime import serial import os from os.path import join as pjoin, exists as pexists import json import csv import datetime im...
09ba73805e0ca0255dffda75a8915e90298595241981605e22fd1942db2104e8
Python
7,287
230
"""Sore a list of SMILES Passes a list of SMILES to a scoring function of choice. """ from __future__ import annotations __all__ = ["run_scoring"] import os import re from collections import Counter import logging from typing import List, Tuple, Callable import numpy as np from reinvent.scoring.scorer import Score...
541369b4a50fa171c224a24e890927164a996378f6c50895e153cbc634856aa7
Python
7,287
247
import numpy as np import pandas as pd import imageio as io from tqdm import tqdm import pathlib import numpy as np from skimage.draw import disk from PyQt5.QtCore import QObject, pyqtSignal def line_w_sphere(s, p0, p1, r0, r1, color=1, spacing=[1, 1, 1]): """Draw a line with width in 3D space Ar...
a8ae774ac8f6b5da44bca364e17e4ee443a843ebfb088fbb4109f90eb3cebe4e
Python
7,291
331
import numpy as np import seaborn as sns import torch import torch.nn as nn import utils as u import analysis_utils as au import fit_data as fd class Perception(nn.Module): def __init__( self, w_L=0.0, w_N=0.0, hidden_size=2, is_fc=False, ): super().__init__() self.is_fc = ...
43639fb4666d8cf52ba0ed6602beb4e58a1abdfe0f91cd01c1e1af7b96963c09
Python
7,294
172
#perform LRP thourgh AG-Sononet import torch import torch.nn as nn import ISNetLayers as LRP import ISNetFunctions as f import globals class LRPFinalLayers(nn.Module): def __init__(self,model,e): #perform LRP through last layers of AG-sononet #model: dictionary with all layers and fdw indexes (net....
ba089377686fdcf693c251303dba0b7e98b539935b99110bd56b7d797002d3aa
Python
7,297
238
# /// script # requires-python = ">=3.11" # dependencies = [ # "marimo", # "nltools>=0.6.0", # ] # /// # Univariate regression — marimo notebook. Source of truth for the docs page; rendered to the docs page by scripts/marimo_to_zensical.py. import marimo __generated_with = "0.24.0" app = marimo.App(width="med...
46c131a4c2fd47b6d2206dd067b44798729fa6317f9ec829497140e897360f5b
Python
7,300
118
""" This is the configuration file for fine-tuning. We implemented two pretrain tasks: mask prediction and mask contrastive learning. --- Mask prediction is just the same pretrain task used in original BERT paper, predicting the ids of masked tokens --- Mask contrastive learning is our propsed pretraini...
c61a20959fe7f5ce5b786a4910d210aab778fd27b57e3e758b163a24c5e4eb6b
Python
7,300
169
r"""Subspace reconstruction of the low-res MSI transients from the predefined high resolution basis. Basis transients need to be computed from the given high resolution experimental transients. """ import os import argparse import logging import pickle from tqdm import tqdm import subspaceMSI as subspace ...
685e33ff1bf144633ec487225bf9fcda935770fed0fd2da4350449a09dadd1eb
Python
7,301
118
""" This is the configuration file for fine-tuning. We implemented two pretrain tasks: mask prediction and mask contrastive learning. --- Mask prediction is just the same pretrain task used in original BERT paper, predicting the ids of masked tokens --- Mask contrastive learning is our propsed pretraini...
12884ca27e8636b3188dc556096f700d4cad4eebc62febfda2a31b6e800eff3c
Python
7,307
220
"""Classical Reinvent de novo model See: https://doi.org/10.1186/s13321-017-0235-x (original publication) https://doi.org/10.1021/acs.jcim.0c00915 (REINVENT 2.0) """ from __future__ import annotations from typing import Tuple, TypeVar, Iterator, TYPE_CHECKING import torch import torch.nn as tnn from reinvent.models...
909f740c59f16ca08e1bcdb08614c8ad5bac7f37c1e799299f30175a15afb6c4
Python
7,313
183
import numpy as np from odl.tomo import fbp_op from dival.datasets import Dataset, CachedDataset, generate_cache_files def generate_fbp_cache_files(dataset, ray_trafo, cache_files, size=None, filter_type='Hann', frequency_scaling=1.0): """ Generate cache files for a CT dataset, w...
5f751d12ab40572b7c88c3d7f8937bb8ad0206a8caa4b11b65ceb0c9075eceb0
Python
7,314
221
import math import pytest import geomstats.backend as gs from geomstats.test.random import get_random_times from geomstats.test.vectorization import generate_vectorization_data from geomstats.vectorization import get_batch_shape class ProjectionTestCaseMixins: def test_projection(self, point, expected, atol): ...
fc2e6600eb63b29400587eff29f37b56d4106ecea13f1b4b01d07f96796cec43
Python
7,316
200
import argparse import os import numpy as np import torch import pytorch_lightning as pl from pytorch_lightning.callbacks import ModelCheckpoint, EarlyStopping from pytorch_lightning.loggers import WandbLogger from torch_geometric.loader import DataLoader as GeometricDataLoader from pathlib import Path # Imports from ...
d389038d1c54511469bd822bf8c44c6581c0065f55bb372bea984c097eb15a6e
Python
7,317
112
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
774195645341016c8217b3a73cbd5e2c7d977eba39e28da2f6edcab6eef1d82b
Python
7,322
196
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 12 15:25:17 2018 @author: ngritti """ # from csbdeep.models import CARE # from deeprest.rawDataClass import rawData # from deeprest.modelClass import modelRest # from deeprest.timeLapseClass import sampleTimeLapse import time, os, glob from tqdm imp...
6540b0335fee06a1ae2ac447646abcd3b358ffc80a7a43eec2354955831e86ad
Python
7,323
220
"""model.py Functions for Model.ipynb """ import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import matplotlib.gridspec as gridspec import pandas as pd import functions as fc import plotting_help as ph dpi = 300 axis_lw = 0.4 axis_ticklen = 2.5 font = {'family': 'arial', 'weight':...
e4e9a3321d706922fb4db19d9b0f37aafa71250a07266fb5c0d2797439ad8124
Python
7,324
384
"""Numpy based computation backend.""" import numpy as _np from numpy import ( abs, all, allclose, amax, amin, angle, any, arange, arccos, arccosh, arcsin, arctan2, arctanh, argmax, argmin, asarray, broadcast_arrays, broadcast_to, ceil, cl...
252a493c25a326d57b93cacfd71564b3e90c0218934ad02b6505b7704e3ee9bb
Python
7,326
166
import jax import jax.numpy as jnp import jax.scipy.sparse.linalg from typing import Any, Callable, Optional, Tuple, Union from deeperwin.configuration import SRCGOptimizerConfig from deeperwin.optimization.opt_utils import build_optax_optimizer, build_lr_schedule from deeperwin.utils.utils import pmap, pmean, tree_dot...
72e7e1deedc2ba5cc9cc4952838c9ecdced3e369f81a4b52cd5babf29ae7b114
Python
7,326
190
import os import sys import cv2 import numpy import argparse import tifffile from tqdm import tqdm from skimage import filters from skimage import feature from scipy import ndimage as ndi from scipy.ndimage.interpolation import geometric_transform class DriftEstimatorOFFarneback(object): FARNEBACK_PARAMETER = {"...
a4c549cfc8d425644e052e83fb33a4a24eea1e607421dea12889f25994b42fe0
Python
7,328
248
from dataclasses import astuple, dataclass import numpy as np import torch from copy import deepcopy class Binarizer: def __init__(self, binarization): self.bin = binarization def __call__(self, tens): if self.bin is None: return tens elif self.bin[0] == "neq": ...
c2623f9dcf9df96a2d37ce7a7790c2aa3fc17a5fe4b8a49c80029b772f46fff5
Python
7,330
218
# Authors: Mainak Jas <mainakjas@gmail.com> import numpy as np import pytest from hnn_core import simulate_dipole from hnn_core.optimization.optimize_evoked import ( _consolidate_chunks, _split_by_evinput, _generate_weights, _get_drive_params, optimize_evoked, ) def test_consolidate_chunks(): ...
b85110e756a28a2f7e3e6cbb8bccbc37486fc85be0090b1b34538441f1b95b86
Python
7,331
198
"""Tests for nltools.algorithms.similarity — similarity and correlation metrics.""" import numpy as np import pytest from nltools.algorithms.similarity import ( fisher_r_to_z, fisher_z_to_r, compute_similarity, _compute_multivariate_similarity, transform_pairwise, ) class TestFisherTransform: ...
07be7027fd6015741b72df1095dd1958d1b55a20c3c9890e61d2ae0defea5062
Python
7,335
245
"""Generate schema-backed tables while MkDocs renders the Methods page.""" from __future__ import annotations from datetime import date from enum import Enum import math from types import UnionType from typing import TYPE_CHECKING, Any, Mapping, Sequence, get_args, get_origin if TYPE_CHECKING: from mkdocs.config...
c991b2b473aaf5b4801d4543f817368b48e265188e5f7494a48034b5dcf18840
Python
7,352
197
# Copyright (c) 2021 Big Data and Multi-modal Computing Group, CRIPAC # 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, c...
b125224e1f5a4950d53d6f582707a1633962e46cf597d5ad5a2af53a4040d630
Python
7,353
214
import os import numpy as np import logging import argparse import time import torch import torch_geometric.transforms as T from sklearn.metrics import roc_auc_score, average_precision_score from GeNNius import Model, EarlyStopper, shuffle_label_data from utils import plot_auc #####################################...
c940b51cc77484ea0197021656fb60ec9061e510f092aba8f29b0cce2b396d85
Python
7,353
184
from PymoNNto.Exploration.Network_UI.TabBase import * class stdp_buffer_tab(TabBase): def __init__(self, title='STDP'): super().__init__(title) def add_recorder_variables(self, neuron_group, Network_UI): return def initialize(self, Network_UI): self.stdp_tab = Network_UI.Next_Tab...
ac277f00fd158f85894eb19ca1bb92c3ab0e958bbd838761bd1eac99cc3dd363
Python
7,367
196
"""Unit tests for visualization.""" import matplotlib import matplotlib.pyplot as plt import geomstats.backend as gs import geomstats.visualization as visualization from geomstats.geometry.hyperbolic import Hyperbolic from geomstats.geometry.hypersphere import Hypersphere from geomstats.geometry.matrices import Matri...
0c5b2587cdb0f33677ab900b89ed7b180959aa8d6b6a92750b88804eac673f4e
Python
7,370
199
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 28 16:37:02 2022 @author: shah """ import tensorflow as tf from Models import UNetfairSIM, ModelFineTunning from DataGeneratorPreprocessing import CustomDataGenerator from Utils import compileDNN, safelyCreateNewDir import os, datetime,argparse, js...
677956d4f10aac5c067577f2dd15fa95bdad2078a8752e6d956eb5928ee0bbad
Python
7,371
167
from unittest import TestCase import types import torch import torch.nn as nn import numpy as np from torch.utils.data import TensorDataset, DataLoader from smithers.ml.utils_rednet import get_seq_model, PossibleCutIdx, spatial_gradients, projection, forward_dataset if torch.cuda.is_available(): device = torch.dev...
cd0ef346f94dc7950bfebcaa86d5dad66d78f08da9cc7c15af803e5affd7168c
Python
7,374
262
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import math from functools import partial __all__ = [ 'ResNet', 'resnet10', 'resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152', 'resnet200' ] def conv3x3x3(in_planes, out_planes, stride=1): # ...
255d2a7ccfc8461b685ffbdd64c7b2cf8f1ca6671b9152a6abd2f9bdf1f4bfd2
Python
7,383
200
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # 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 appli...
9663497948c4db45027fd1e0433ca762ba142bca66c422e495c944c8a045efe0
Python
7,383
178
""" Analysis of Delayed Differential Equations ========================================== In this tutorial, you will learn how to implement and solve delayed differential equation (DDE) systems via PyRates. DDEs take the general form .. math:: \\dot{\\mathbf{y}} = \\mathbf{f}(\\mathbf{y}, t, \\mathbf{y_{\tau}}) ...
30cfa3d9da5be545a92657e02240a1eac6a711b026b3c38f449b62b44701cc67
Python
7,385
230
import experiment as exp from canvas import Canvas import random import asyncio class RandomShapes(Canvas): def __init__(self, canvas_id, n_nodes, logger, shape="Circle"): super().__init__(canvas_id, on_connect=self.on_connect, on_disconnect=self.on_disconnect, logger=logger) # self.interval = int...
144dfaf66a7fbd2ac1b5414bb050cbdd5e87f0ebcd0407866b55a987a3d4c87e
Python
7,394
179
"""Unit tests for the pure helpers in ``nltools.data.braindata.viewer``. These cover palette generation, display-window and threshold-slider maths, and background resolution, using synthetic arrays and affines — no network, no browser, no widget construction. The LUT, colormap and slice-type helpers are pinned through...
45102d7976106c616dc12c8df9bbc9d2cb008b467b979829074458e0eb1cd4d8
Python
7,400
233
# /// script # requires-python = ">=3.11" # dependencies = [ # "marimo", # "nltools>=0.6.0", # ] # /// # Inter-Subject Correlation — marimo notebook. Source of truth for the docs page; rendered to the docs page by scripts/marimo_to_zensical.py. import marimo __generated_with = "0.23.9" app = marimo.App(width="...
acc5aeb8d2f507524638b4343ca1b51e180a726dd073243e7b2c1483dc9837ec
Python
7,403
218
import os import xml.etree.ElementTree as ET import numpy as np import pyedflib from sleeprnn.data import utils # This path is expected to be the parent path of the paths listed in NSRR_DATA_PATHS NSRR_PATH = os.path.abspath("/home/ntapia/Projects/Sleep_Databases/NSRR_Databases") NSRR_DATA_PATHS = { "shhs1": { ...
c7f088158c93b3daaf296f687cecf6e04d6015bcf6c2cd1263347f0e9349966e
Python
7,406
209
from chromadb.api.types import ( SparseEmbeddingFunction, SparseVectors, Documents, ) from typing import Dict, Any, TypedDict, Optional from typing import cast, Literal from chromadb.utils.embedding_functions.config_validation import ( validate_embedding_function_kwargs_are_safe, ) from chromadb.utils.e...
0c2805f977629e8bcc926a86d56e2953c2f10ef300bbc308b51864362933bf57
Python
7,409
248
"""The vector space of Hermitian matrices. Lead author: Yann Cabanes. """ import logging import geomstats.backend as gs from geomstats import algebra_utils as utils from geomstats.geometry.base import ComplexMatrixVectorSpace from geomstats.geometry.complex_matrices import ComplexMatrices, ComplexMatricesMetric from...
7f832e72c60979515fd23f7fdb07425e7b6ee638870f1a0a5b3e05864dfc7f48
Python
7,409
224
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Experimental Collaborator module.""" import time from logging import getLogger from typing import Any, Callable, Dict, Tuple import dill class Collaborator: r"""The Collaborator object class. Args: collaborator_name ...
9dc305e3ba35c1bc46bfaee9631df7458ddcd1f62e3d82aab48808a9d07e03eb
Python
7,411
216
""" Created on Mon October 23 11:05:36 2023 Description: Visualization functions for Paper url: https://www.biorxiv.org/content/10.1101/2023.09.11.557230v2 @author: Ekaterina Kuzmina, ekaterina.kuzmina@skoltech.ru @author: Dmitrii Kriukov, dmitrii.kriukov@skoltech.ru """ import numpy as np import matplotlib.pyplot a...
a7c68714b4422cb05643668fa1f5ad2b035c2a394f3f25a51e7ccb31411e0372
Python
7,411
222
__all__ = ["MmpPairGenerator"] from argparse import Namespace, RawDescriptionHelpFormatter, ArgumentParser from time import time import logging import tempfile from mmpdblib.do_fragment import fragment_command from mmpdblib.do_index import index_command import numpy as np import os import pandas as pd from .pair_gene...
363b78c872993b13b05e97af38bdca7dd6715911b83e3675aa012149069d4573
Python
7,413
193
from typing import ClassVar, Dict, Optional import logging import threading import uuid from chromadb.api import ServerAPI from chromadb.api.base_http_client import BaseHTTPClient from chromadb.config import Settings, System from chromadb.telemetry.product import ProductTelemetryClient from chromadb.telemetry.product.e...
17b0b25fd880b6237eb157bf165177b58a4ee8c43c64be532052e4c197f6a95c
Python
7,421
199
# -*- coding: utf-8 -*- """ Created on Thu Apr 22 14:27:39 2021 @author: nicol """ import os, glob, tqdm from skimage.io import imread, imsave import numpy as np import matplotlib.pyplot as plt from matplotlib import rc import matplotlib as mpl from skimage.metrics import normalized_root_mse as nrmse im...
780f75c8ab025882f67625bce671e385bc2b94eb772524613fc321138f37e8b3
Python
7,427
176
# based on https://github.com/lopeneljxi/keras-unet-collection from __future__ import absolute_import import tensorflow as tf from tensorflow.keras.layers import Input from tensorflow.keras.models import Model from .backbone_zoo import backbone_zoo, bach_norm_checker from .layer_utils import * def UNET...
3bf787ec1e528607ec83867b6f960ef13686724b10145601499c96ea4f21666a
Python
7,432
164
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved. # # 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 appli...
52cf155913268c8fe758f100f3631a57f466228d1c7fa8c1d051f536127932d5
Python
7,432
171
import argparse import numpy as np import pandas as pd import tensorflow as tf import random as python_random from keras.models import Sequential from sklearn.model_selection import KFold from keras.layers import Dense, Conv1D, MaxPooling1D, Flatten, Dropout from sklearn.model_selection import train_test_split from skl...
76dcd624c1843e195a50fbeb6cacecacf11d6a017fbdf76dd05b3f31ecec3c65
Python
7,432
245
"""Reward strategies for Reinforcement Learning""" from __future__ import annotations __all__ = [ "RLReward", "dap_strategy", "mascof_strategy", "mauli_strategy", "sdap_strategy", "dap_reinforce_strategy", "mascof_reinforce_strategy", "mauli_reinforce_strategy", ] import logging from ...
b66c2396fcf9ba40bb67f6cfd1537a7a15ec858f18ec544387e9bec486f4a85b
Python
7,433
202
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @Author: An Tao @Contact: ta19@mails.tsinghua.edu.cn @File: dataset.py @Time: 2020/1/2 10:26 AM """ import os import torch import json import h5py from glob import glob import numpy as np import torch.utils.data as data shapenetpart_cat2id = {'airplane': 0, 'bag': 1,...
106cf7e67078e6a938fdf8dd7f9098c2cded8486ac33df26c7f33042c067c3c7
Python
7,434
202
# ruff: noqa: PLR2004 from __future__ import annotations from math import inf import pyparsing as pp from hypothesis import assume, given from hypothesis import strategies as st import snakebids.tests.strategies as sb_st from snakebids.core.datasets import BidsComponent, BidsDataset from snakebids.io.printing import...
291fdb23fa9b378e939b36f8c1ff2ee87811c093a8ed1f3c86e8baba8570398e
Python
7,435
221
from configuration import * from spikeinterface.sortingcomponents.benchmark.benchmark_motion_interpolation import BenchmarkMotionInterpolationMearec from spikeinterface.sortingcomponents.benchmark.benchmark_motion_interpolation import plot_distances_to_static from spikeinterface.qualitymetrics import compute_quality_...
7cf1f52f430f60c267717c2d21105b18b1ee83cd2a5de542c8671183a9567919
Python
7,445
263
import click from corgie import scheduling, helpers, stack from corgie.log import logger as corgie_logger from corgie.layers import get_layer_types, DEFAULT_LAYER_TYPE, str_to_layer_type from corgie.boundingcube import get_bcube_from_coords from corgie.argparsers import ( LAYER_HELP_STR, create_layer_from_spe...
80651f4ec1fb5137d9f32365df6632046195975f22484f2a9b5c3dfc15d4acb9
Python
7,446
197
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # 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 appli...
a8d8699c6d857c502d99390d435f1865d51970403f6f5e34c6f830eda51b2eb8
Python
7,446
167
import h5py import sys import numpy as np from pyimzml.ImzMLWriter import ImzMLWriter def imzml(input_filename, output_filename,smoothMethod="nosmooth",centroid=False): import h5py import numpy as np ### Open files h5 = h5py.File(input_filename, 'r') # Readonly, file must exist ### get root group...
30aa222e3c64bbc5a7ec2088ed36507603a12f7e9b64d0ba875e93f06c855365
Python
7,458
181
""" Calculate the wave directions by either interpolating trigger times and locations or by averaging the corresponding optical flow values. """ import neo import numpy as np import quantities as pq import matplotlib.pyplot as plt from matplotlib import patches import os import warnings import argparse import scipy i...
9e24c1885d3ae68be723323edd84824a2ffdefb566676a2529673b025cd508d6
Python
7,462
219
import pytest import renderapi from test_data import (render_params, montage_raw_tilespecs_json, montage_parameters) from bigfeta import bigfeta from bigfeta import jsongz import json from marshmallow.exceptions import ValidationError import copy import os import numpy as n...
d6f96102d2371c6062fbc2ae222321877375f8bc73a2ffac934d0580953cb42a
Python
7,466
182
""" Calculate the wave directions by either interpolating trigger times and locations or by averaging the corresponding optical flow values. """ import neo import numpy as np import quantities as pq import matplotlib.pyplot as plt from matplotlib import patches import os import warnings import argparse from pathlib im...
027c02c7ad5aeb7750df88d637b09f56c26eb8fa49b87669937c7d70b55673fb
Python
7,467
177
import os import warnings import csv import argparse import numpy as np import matplotlib.pyplot as plt from scipy import signal as sig import scipy.spatial.distance as dst import parameters from optlib import cost_func # Main code if __name__ == "__main__": """ Exhibition of the functions to be used """ # ...
e003a40c45df8ce36724f05843b8f3ce2882a813b3496f8006a3de8ddb07ecaf
Python
7,470
252
import argparse import json import os import traceback import numpy as np from joblib import Parallel, delayed from pydfc.ml_utils import extract_task_features, task_presence_classification os.environ["MKL_NUM_THREADS"] = "1" os.environ["NUMEXPR_NUM_THREADS"] = "1" os.environ["OMP_NUM_THREADS"] = "1" ##############...
8c4a2aa64672998716dc2510f4fe4b8518672837bd5dee03c6dd76b1da6687c8
Python
7,473
181
""" Calculate the wave directions by either interpolating trigger times and locations or by averaging the corresponding optical flow values. """ import neo import numpy as np import quantities as pq import matplotlib.pyplot as plt from matplotlib import patches import os import warnings import argparse import scipy i...
28d0581dbbbe1168624ab9bc9f4857dfe6ed1e865057fe17a4488b85d37cdb4a
Python
7,474
140
from collections import defaultdict from utils_ds import * LIGAND_TEST_GROUPS = [ ["AmPhos", "CataCXium A", "Xantphos"], ["P(Ph)3", "P(Cy)3", "P(o-Tol)3"], ["P(tBu)3", "dtbpf", "dppf"], ["None", "SPhos", "XPhos"], ] def ligand_splits(df): """Return training-first splits after normalizing spreads...