sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
753277411be1ed54dc4c35f595203ed81a94355a4b1d3a4c55e944f027c2fe30
Python
4,536
129
"""experiment for the ADT Network ablation study.""" import glob import json import logging import os # set gpu private os.environ['TF_GPU_THREAD_MODE'] = 'gpu_private' import tensorflow as tf import numpy as np import sys # add base path to sys sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) fr...
76e7028b18c23714300fd3a243956102f86407c2830d03bf616b22429a3962fd
Python
4,537
130
import torch import torch.nn as nn from torchsummary import summary class ResidualConv(nn.Module): def __init__(self, input_dim, output_dim, stride, padding): super(ResidualConv, self).__init__() self.conv_block = nn.Sequential( nn.BatchNorm2d(input_dim), nn.R...
673ae9268f6cc4ba8f6386de58da7babc5b479cc24eaeb2dab75b6836a6811d2
Python
4,539
122
"""What a multihead run reports per head, and what it leaves out. Multihead is the normal case, so per-head reporting is the product: the validation lines during training, the rows of the final error table, and the `head` field on every row of the results log a plot is drawn from. None of it was covered, and the three...
975ca2abe8d35d0d818e20a6c7ec124d5236d21a72a1e8eabaddc40bf9f573cf
Python
4,540
166
import scipy as sp import pylab as plt from scipy.integrate import odeint class HodgkinHuxley(): """Full Hodgkin-Huxley Model implemented in Python""" C_m = 1.0 """membrane capacitance, in uF/cm^2""" g_Na = 120.0 """Sodium (Na) maximum conductances, in mS/cm^2""" g_K = 36.0 """Posta...
ab64e84f839fb6f68e974f9340920b914b708d86f07a0b311556cb453e1b87ad
Python
4,540
104
import sys from miscFuncs import * vcfFileName, maskedRefFileName, fastaFileName1, fastaFileName2 = sys.argv[1:] arm = vcfFileName.split("/")[-1].split(".phased.vcf")[0] #TODO: this pulls out all sechellia individuals included in the analysis for # the FILET paper. These genomes had identifiers ranging from SECH_17 ...
aee30d8f6d6383f758e122f6be1b7a12e9bc99298c55536a333db8d291d97c5d
Python
4,541
89
""" Created on Sat September 16 21:15:06 2023 Description: Color palettes 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 matplotlib.colors as color bg_gray_color = ...
cd182e59eae9c116bd9096e5d3901961c3102878930425077fbe3dba3f8161fc
Python
4,541
165
# -*- coding: utf-8 -*- """ Created on Thu Apr 22 14:30:31 2021 @author: nicol """ import os, glob, tqdm from skimage.io import imread, imsave import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from matplotlib import rc import matplotlib as mpl import scipy.ndi...
6dc0dddbc7131c914510f47da2bb00b16240700b4c01719301452a99ea9d9064
Python
4,547
157
import torch.nn as nn import torch from torch.autograd import Variable import numpy as np class RNN_GRU(nn.Module): """ Generative or multi-class classifier RNN using the GRU cell. Params ------ input_size (int): Vocabulary size for initializing the embedding layer. In the ...
a777fa5e38c13aee1d316039f36a359387dd46144f7c3a1302695672dd577b02
Python
4,550
127
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Dump requirements file test module.""" from pathlib import Path import pytest from pip._internal.operations import freeze from openfl.utilities.workspace import dump_requirements_file ORIGINAL_PREFIXE_LINES = ['-o option\n', ] ORIG...
5fc1c8451511084d2c5a51d8b730c162e40acb47de3ab5397d241996cf746433
Python
4,551
99
"""Regression cases for the shared TRA/TRD annotation migration in #1405.""" import polars as pl from vdjdb.annotate.cdr3fix import markup from vdjdb.assemble.evidence import structures from vdjdb.score.evidence import integrate def test_shared_v_proposals_and_supported_anchor_repairs(): # One batch across speci...
8a462cad37c25aae8b64ff2d437b8bb4ae48b076d7269e84ea0a531f3680a1ad
Python
4,551
148
import hashlib import io import shutil import os import tarfile from pathlib import Path from typing import List, Hashable import hypothesis.strategies as st import onnxruntime import pytest from hypothesis import given, settings from onnxruntime.datasets import get_example from chromadb.utils.embedding_functions.onn...
c9fb51d7d10148ed1e7bbc12ed24010df0dd142d5208be6989677956a37e27f1
Python
4,551
155
import glob import numpy as np import math import os import csv from scipy.integrate import simps from scipy.signal import butter, filtfilt def procrustes(a, b): #translate the points to be centred at 0, 0 a1 = a - a.mean(axis=0) b1 = b - b.mean(axis=0) #scale the points to have unit variance. a1 /= np.s...
4ac0a73de51ec753fb4c3b8cfc85a08e06d702b5bb50ec948218748a3a9dbdda
Python
4,555
86
import os, random, sys trainingOutDir = sys.argv[1] os.system("mkdir -p %s" %(trainingOutDir)) """ AIC: 10303.1237186 with u = 3.500000e-09 Nref: 487835.088398 nu1_0 : 117605.344694 nu2_0 : 4878347.23386 nu1 : 9279970.1758 nu2 : 26691.779717 T : 86404.6219829 2Nref_m12 : 0.0128753943002 2Nref_m21 : 0.0861669095413 ""...
f42e8d6f525d1dd8b908e1e3f48d6adfa18b10a1c7a995c4bd7201ab44e0775c
Python
4,556
146
from pathlib import Path import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt from holoviews import opts ### CONSTANTS n_per_ftr_typical = 5 ### SOURCE DATA def save_source_data(di, subfolder, base_folder='fig/source_data/'): folder = Path(base_folder) / subfolder folde...
36a49fad9235e112a65f9b10962b691e414bdf45263458a752000ca22ea1702d
Python
4,557
107
# Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université # "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. " from mpi4py import MPI import pathlib import os from nest_elephant_tvb.utils import crea...
4757d96631ae6d0233011f5d297231d1423a45944daef87bcaa23ac1ab66ff1d
Python
4,558
167
import functools import glob import hashlib import logging import os from pathlib import Path from typing import Optional, Tuple, Union import numpy as np from src import settings from src.data.files import delete_files, cd logger = logging.getLogger("nrn_helpers") initialised = False __KWARGS__ = {} def init_nr...
cdbdee8ead76badbfbd2fb7621fe7cd84b381ecd497a137fc242d431db2721ea
Python
4,558
123
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math from dataclasses import dataclass import torch.nn.functional as F from fairseq import metrics, utils from fairseq.criterions impo...
c3cf8bca85406dd284fc54d9c0ea9fe01095f231624c209b4b3196a87499757c
Python
4,561
116
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import random import os # os.environ['CUDA_VISIBLE_DEVICES'] = "2" device = torch.device('cuda' if torch.cuda.is_available() else "cpu") thresh = 0.1 lens = 0.5 probs = 0.5 decay = 0.6 from SNN_layers.spike_dense import * from SNN...
6451a81f2bfc814be17cd0660037febc0bf1e6ba16596d9f3ff1f78812195085
Python
4,564
95
from PymoNNto.NetworkCore.Behavior import * class Instant_Homeostasis(Behavior): def get_measurement_param(self, n): if self.compiled_mp is None: self.compiled_mp = compile(self.measurement_param, '<string>', 'eval') result = eval(self.compiled_mp) if self.measurement_min is ...
a85810eb1af3a48915712a7c716d9c8d8cc7369b9d20a1ca0611be27a909306c
Python
4,567
144
"""Global brain-space configuration: frozen dataclass + set/get/with API.""" from contextlib import contextmanager from dataclasses import dataclass, replace from collections.abc import Iterator from .paths import _resolve_paths from .registry import SUPPORTED_RESOLUTIONS, TemplateName, Resolution @dataclass(frozen...
2310ed8fbfd9bead44ee794ed0053fe9421f3a0eb39eeb19011b7f7fd8a874e4
Python
4,568
133
# 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...
370f2b67ead07cd61bb2ffbfc55a4e2bc304e0b76596867d6681cea22de5083d
Python
4,568
108
from typing import Any, Callable, Sequence from jax import numpy as jnp from flax import linen as nn from .flax_utils import linear_activation from .jax_utils import val_and_jacrev, val_and_jacfwd from jax import vmap Dtype = Any class TransportModel_PVT(nn.Module): features: Sequence[int] dtype: Dtype = jnp...
b8b849ffb1b170c59c2a663d979dbf9ba634c7b066ade6772f06597c666cb5be
Python
4,568
164
# 20210525 import os import sys import logging from logging.handlers import RotatingFileHandler from pathlib import Path """ DEBUG INFO WARNING ERROR CRITICAL """ """ LOGLEVEL = os.environ.get('LOGLEVEL', 'WARNING').upper() print('LOGLEVEL:', LOGLEVEL) print('os.environ') for k,v in os.environ.items(): print(f' ...
bee58d378086b248979088e87777c417cce4a7d39daf80e0a33c5c655b990e30
Python
4,569
122
"""Two things `mace_eval_configs` could not do, both fixed by copying itself. `--return_node_energies` accumulated one entry per *batch* and then built a rectangular array out of it, so it worked only while every structure had the same number of atoms. `--descriptors`, four lines above in the same function, already ac...
e2effdfc8f2e99143dc99fe58dcbf65ac38e4ea04cd54f63c55d400d868a7559
Python
4,569
88
from typing import List import haiku as hk import jax.numpy as jnp from deeperwin.model.gnn import DenseGNN, MessagePassingLayer from deeperwin.configuration import MLPConfig, EmbeddingConfigGNN, EmbeddingConfigMoon from deeperwin.model.definitions import InputFeatures, Embeddings, DiffAndDistances from deeperwin.mode...
98d34cda1e2e3bbcf562fb6c88afa6b97d200c73f1dc1e928169030a66302985
Python
4,571
141
"""Filter and preprocess SMILES with RDKit""" from __future__ import annotations __all__ = ["RDKitFilter"] import logging from typing import Optional, TYPE_CHECKING from rdkit import Chem from rdkit.Chem.MolStandardize import rdMolStandardize as Standardizer from ..logger import setup_mp_logger if TYPE_CHECKING: ...
bf47373eeebd5e7194df3d768084b6e448264a67efa8563a05bc9c6d1ec53142
Python
4,571
131
""" Masking Example =============== This tutorial illustrates methods to help with masking data. """ ######################################################################### # Load Data # --------- # # First, let's load the pain data for this example. from nltools.datasets import fetch_pain data = fetch_pain() ...
6e73278e6324d96bd5e61eb473065f16f10c34b4253e4922d03ce64c7f826333
Python
4,572
163
import random import pytest import geomstats.backend as gs from geomstats.geometry.hermitian_matrices import HermitianMatrices from geomstats.geometry.hpd_matrices import ( HPDBuresWassersteinMetric, HPDEuclideanMetric, HPDLogEuclideanMetric, HPDMatrices, ) from geomstats.geometry.spd_matrices import ...
4f0ab464e7ae169008c4a00f9214d5541c972e15848b280c7f1b32202dd8b58c
Python
4,573
149
# -*- coding: utf-8 -*- """ Created on Wed Jun 16 15:52:15 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 ...
5a4113b3a46cfd47ae4be3fddb8f9d4645233a6ef28c58df0e03cf4a0f5a6c7a
Python
4,575
151
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 """ PDB parsers for large files with Biopython. Modified from https://biopython.org/wiki/Reading_large_PDB_files """ import sys import Bio.PDB import Bio.PDB.StructureBuilder from Bio.PDB.Residue import Residue cla...
7e99cefb1ecd9e9f74a9b73563c3c439b42fb1f9e9710fe80389caa895fce3b0
Python
4,577
114
""" Extract the annotations of Neo objects and structure them in a DataFrame to complement a wave characterization. """ import argparse import numpy as np import pandas as pd import quantities as pq import re from utils.io_utils import load_neo, save_plot from utils.parse import none_or_str from utils.neo_utils import...
55e95f53ab4f7c146b0180fdbfa21479ad84dfe63fe8b95fab0c0e454c5a24a0
Python
4,579
126
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from dataclasses import dataclass, field import torch.nn.functional as F from fairseq import metrics from fairseq.tasks import F...
8fc3ff864657e1bc80f58d18b1367e00909d3c1f8f9870db2a285fe1eb65bec1
Python
4,583
94
# Plot Kuramoto oscillators import numpy as np import matplotlib.pyplot as plt # np.random.seed(123) N = 100 # Number of oscillators rad = 1. # unit circle # No sync theta0 = np.random.uniform(0, 2*np.pi, N) # initial phase omega0 = np.random.uniform(0, 1, N) # color indicates velocity X0 = rad*np.cos(theta0) Y0 = ...
4f9ef43e9db1840ccbe709eb6699de7f0f326e7da42c716c791951a0de9e8498
Python
4,586
139
import pytest import torch from nequip.data import AtomicDataDict from nequip.nn import ( AtomwiseLinear, AtomwiseReduce, PerTypeScaleShift, SequentialGraphNetwork, GraphModel, ) from nequip.nn.embedding import NodeTypeEmbed from nequip.utils import dtype_from_name, torch_default_dtype from nequip....
c5aefbd58e38580739235911ac261d412dda283a2689ea98888f6d68b7ef97bf
Python
4,586
123
""" API-convention guards for the inference layer. `nltools/algorithms/inference` is an internal package whose entry points are partly re-exported through `nltools.algorithms` and partly reached by their own import path. These tests hold the whole family to the conventions in CLAUDE.md rather than checking only the na...
cc0b9eda01a6102e41ceaf1c2cf4849ef6bdfb8709b03a9697c05496272cdaf2
Python
4,587
92
from deeperwin.run_tools.geometry_database import load_geometries, load_datasets, Geometry from deeperwin.utils.utils import ANGSTROM_IN_BOHR, PERIODIC_TABLE import argparse import os import shutil import subprocess import time def write_orca_input(geom: Geometry, fname, method, basis_set, frozen_core, n_proc, memory_...
0153971491e4b4d7385a458fc6d4c2195a7220ec73aedb3ee09c34093538187c
Python
4,591
113
from tqdm import tqdm import numpy as np from numpy.random import multivariate_normal import pandas as pd from numpy.typing import ArrayLike from theory_simulation.regression import regression_performance from theory_simulation.utils import fsolve_bounded_monotonic, project_onto_subspace def run_simulation(dim_eco: i...
4809c5c88b27aa7809483a7592cff458aa9d8dd1d05fd273da2eeab925acbcc2
Python
4,592
135
import random import time from pathlib import Path import matplotlib.pyplot as plt import numpy as np import ppafm.ml.AuxMap as aux import ppafm.ocl.field as FFcl import ppafm.ocl.oclUtils as oclu import ppafm.ocl.relax as oclr import torch from ppafm.ml.Generator import InverseAFMtrainer from ppafm.ocl.AFMulator imp...
2dd0fc36c57241c60ad98c356cf2096775614f96edd063416a05faef289e70fc
Python
4,594
158
# -*- 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 Cogn...
ebe643cedf7d991d5881b35545dbb53b1ada7d19b4f8607b5790a359e5dac8d8
Python
4,595
135
import random import time from pathlib import Path import matplotlib.pyplot as plt import numpy as np import ppafm.ml.AuxMap as aux import ppafm.ocl.field as FFcl import ppafm.ocl.oclUtils as oclu import ppafm.ocl.relax as oclr import torch from ppafm.ml.Generator import InverseAFMtrainer from ppafm.ocl.AFMulator imp...
6bf51445db844f308d455048a204e2255e0f4a73a95302f7854d2e20068c0aca
Python
4,597
164
"""Hybrid cueq + openequivariance model converter.""" import argparse import logging import os import torch from mace.modules.wrapper_ops import CuEquivarianceConfig, OEQConfig from mace.tools import deprecation from mace.tools.scripts_utils import extract_config_mace_model from mace.tools.torch_tools import restore...
ce5d2b23fd496496772fada715a14763d273b3d391d66b2b04cbf8347927c0d5
Python
4,597
158
# -*- 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 Cogn...
e6f1f5bdb387ed0c77ea550705cf133ae9c102529fda424a8e9d52801a01c8e3
Python
4,597
126
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """PyTorchDataLoader module.""" from openfl.federated.data.loader import DataLoader class GaNDLFDataLoaderWrapper(DataLoader): """A class used to represent a data loader for the Generally Nuanced Deep Learning Framework (GaNDLF)....
ca48baae30bc733a191c9d57fb8ccc2fc31a62cd263a59c2846ac54e8d2bc7b4
Python
4,599
115
""" Extract the annotations of Neo objects and structure them in a DataFrame to complement a wave characterization. """ import argparse import numpy as np import pandas as pd import quantities as pq import re from utils.io_utils import load_neo, save_plot from utils.parse import none_or_str from utils.neo_utils import...
f469b937b14e8055a1d9fec7ebc8813cc871751f8e53db78246c90b399851a2a
Python
4,599
98
import pandas as pd import os from sklearn.preprocessing import MinMaxScaler methyl_dir = "./preprocessing_methyl/" acc_dir = "./preprocessing_acc/" gene_dir = "./preprocessing_rna/" resDir = './final_preprocessing/' try : os.mkdir(resDir) except : print('exist!') dataTypeList = ['train', 'test'] for dataType in ...
f187a5767575ec55e8e2c9fb70724bc621bfabc8a709ea5f0fae8edbb7495995
Python
4,602
177
import os import pickle import sys from typing import List import psutil def batch_iterator(iterator, batch_size): if len(iterator) <= batch_size: return [iterator] output = [] i = 0 while (len(iterator) - i) > batch_size: output.append(iterator[i : i + batch_size]) i += batc...
1c68c33960115d6392a45d3d443f02ac2c2f452b3fb729c9c5090b044f8c925a
Python
4,603
147
import os import rdkit import rdkit.Chem as Chem from tqdm import tqdm from .chemutils import get_clique_mol, tree_decomp, get_mol, get_smiles, set_atommap, enum_assemble, decode_stereo from .vocab import * import argparse class MolTreeNode(object): def __init__(self, smiles, clique=[]): self.smiles = s...
b7e2134b782ec1176b8f1013f5a0dea07bf02b27e6a753d86378b8d61c543085
Python
4,606
119
import torch import numpy as np from torch.utils.data import Dataset class seqDS(Dataset): """ A Dataset class for phase coding working memory task """ def __init__(self,task_params,dataset_len=256): """ Initialise dataset object Args: task_params: dictionary of ...
96cbe23bf1aa402c650a2eceb3137763c9408c2b8973917cf4d1e2ca15ad1b67
Python
4,608
148
# Author: Guoqing Bao # School of Computer Science, The University of Sydney # Date: 2019-12-12 # GitHub Project Link: https://github.com/guoqingbao/Pathofusion # Please cite our work if you found it is useful for your research or clinical practice # from IPython import get_ipython import os # os.environ["CUDA_VISIBL...
22c875944934fcbe724b8645e2c7972c7901bd12ef00fc4a4dfdf88aa1f2f4a1
Python
4,610
158
# Copyright (C) 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Envoy CLI.""" import logging import sys from pathlib import Path import click from click import Path as ClickPath from click import group, option, pass_context from dynaconf import Validator from openfl.experimental.workflow.compone...
2e502006e07e2c3016138e5535e4e38ad034a5e83cd1b3d6c2eed26489f2f781
Python
4,613
102
from PymoNNto.Exploration.Network_UI.TabBase import * import random class single_group_plot_tab(TabBase): def __init__(self, variables=['output', 'excitation', 'inhibition'], colors=[(0, 0, 0), (0, 0, 255), (255, 0, 0), (155, 0, 155), (0, 155, 0), (155, 155, 0), (0, 155, 155)], net_lines=[], neuron_lines=[], titl...
e41513b352e2066a21cae1ab75242020eff8aca4de54b981d650e5515686be6f
Python
4,614
120
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import torch import torch.nn.functional as F from fairseq import metrics, utils from fairseq.criterions import FairseqCriterion, ...
6b26ed7fa8ba63f42a86e03bcff93fa10641a8676b6a3f0a607e99851d142160
Python
4,615
122
from PymoNNto.Exploration.Network_UI.TabBase import * class DrawItem(pg.GraphicsObject): def __init__(self, parent=None): super().__init__(parent) self.picture = QtGui.QPicture() def get_rnd_color(self): return (np.random.rand()*255.0,np.random.rand()*255.0,np.random.rand()*255.0,255....
bf69b0b94a52fb5a3891b59f12f9d56e2f3e1b59fb976706ff80479439eb988b
Python
4,616
152
#!/usr/bin/env python3 import argparse import numpy as np import scipy.sparse as sp import odil def operator(ctx): mod = ctx.mod extra = ctx.extra args = extra.args res = [] # Value in cell (i, j) taken from face (i-0.5, j). u_xm = ctx.field("ufx", 0, 0, loc="cc") # Value in cell (i, ...
8fa72ba3dd1d2c90a45cc40cc628bd164f47b71bd4b71141d16548b3a9342799
Python
4,617
137
# Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université # "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. " class CommunicationInternAbstract: """ Abstract class for internal communication...
aa969480355d559574bced9f06b19eacf0b79e775df87d8dc23962917b5cb375
Python
4,618
115
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging from openfl.experimental.workflow.interface import FLSpec from openfl.experimental.workflow.placement import aggregator, collaborator log = logging.getLogger(__name__) class TestFlowExclude(FLSpec): """ Testflow to ...
0221dc390e792a356d6c24610ff97d93969457fcbf2fe01f7e7aea469a5cf4fd
Python
4,619
121
# Copyright 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import hashlib import pytest from unittest.mock import MagicMock, patch from openfl.federated.data.sources.azure_blob_data_source import AzureBlobDataSource @pytest.fixture def mocked_azure_blob_ds(): connection_string = "DefaultEndpointsPro...
35778cb7811ee56eeda176661cc0327c4837ce2add896605b83c8c9166afc66a
Python
4,623
137
# ============================================================================== # Copyright 2023 Technical University of Denmark # Author: Nikolas Borrel-Jensen # # All Rights Reserved. # # Licensed under the MIT License. # ============================================================================== import collectio...
85bcf0d5f04c76a9853adefac7524ec079908766b6ee408018634a9fd212cd15
Python
4,623
115
import numpy as np from hyperopt import hp from odl.discr import uniform_discr from dival.datasets.dataset import Dataset from dival.evaluation import TaskTable from dival.measure import L2, PSNR from dival.reconstructors.regression_reconstructors import LinRegReconstructor from dival.hyper_param_search import optimize...
1243ddfcdf86396196c071889b2a673e9138e0e9136180e537aa18b7d8c70153
Python
4,628
141
"""The n-dimensional hyperbolic space. Poincare half-space representation. Lead author: Alice Le Brigant. """ import math import geomstats.backend as gs from geomstats.geometry._hyperbolic import HyperbolicDiffeo, _Hyperbolic from geomstats.geometry.base import VectorSpaceOpenSet from geomstats.geometry.euclidean i...
1dd269f806c1328ebef574e09d8f711ae20ca29a18bdb380cf04adda772f8cb5
Python
4,629
143
import numpy as np from data import indicator_basis, ou_process from utils import allclose_sign, allclose_trajs import ivac def make_data(ns, dt, nbins): """Generate featurized data for testing.""" return [indicator_basis(ou_process(n, dt), nbins) for n in ns] def gram_schmidt(x): """Perform the Gram-S...
73b096541add9367657dbeed081b706c6b4cdd2e70db09c671fc94bc4b5f4628
Python
4,634
156
import numpy as np import warnings import re from pathlib import Path import sys from .io_utils import load_neo def get_base_type(datatype): if hasattr(datatype, 'dtype'): datatype = datatype.dtype elif not type(datatype) == type: datatype = type(datatype) if datatype == list: war...
0b3009f4fc784e301271a0f36d4c6c684d77e9d842d48d2ab94b1754b8e6ea37
Python
4,635
103
import config import numpy as np import pandas as pd from assist. experiment_names_lookup import diffusion_paper_313_datasets, diffusion_paper_2021_datasets names_to_table_isbi = {'UNet-202209-Brats313-256-geoaug-imaug-valid-lr5.0e-02': '\\checkmark & 0 &', 'UNet-202209-Brats313-synthetic_1GAN-2...
68c11cceca5f33050a37c9d190383f7d5cd8fd8ca7e97c7e3999f105e5862f18
Python
4,635
138
from __future__ import absolute_import from functools import wraps import numpy as np from . import CI from decorator import decorator def mod2pi(f): """ Decorator to apply modulo 2*pi on the output of the function. The decorated function must either return a tuple of numpy.ndarrays or a numpy.ndarr...
abb1b04dacd22b879dd85c4b527e9de38a560c96cd9723a96d1d9c8cea9034c9
Python
4,635
146
"""Meta data definition for model files""" from __future__ import annotations __all__ = ["ModelMetaData", "update_model_data", "check_valid_hash"] from dataclasses import dataclass, field, asdict import time import copy import pickle import xxhash import platform from uuid import UUID from typing import List, Tuple ...
cd984babd09327861add4647d0070b0ddabdb5e5d961deb65b1fc7bd89aa13e6
Python
4,635
124
import os import cv2 import mediapipe as mp import numpy as np import pandas as pd from tqdm import tqdm mp_drawing = mp.solutions.drawing_utils mp_drawing_styles = mp.solutions.drawing_styles mp_hands = mp.solutions.hands def collect_hand_keypoints_pipe(video_path: str, hand_query, output_path: str = None, thresho...
1c0e5543ad5c66959aff88c290a2f751347d3e981637762a849566c78e0287c8
Python
4,638
146
import os, sys import numpy as np import pandas as pd import neo sys.path.append('/home/georg/code/SSSort') import sssio import quantities as pq import elephant as ele def p2stars(p, ns=False): """ turns a p-value into significance stars with the classic alpha levels 0.05, 0.005, 0.0005 """ if ns: ...
5e9dcf7ff7a9ac6672441cd4da99708179db6276b124d4e0ad79210ec4906213
Python
4,639
140
# ============================================================================== # Copyright 2025 Technical University of Denmark # Author: Nikolas Borrel-Jensen # # All Rights Reserved. # # Licensed under the MIT License. # ============================================================================== import json impo...
6226d488de65c4d9a7b8c37cfdfb661fde36054c3b5d08668e005af0e5dff267
Python
4,639
104
import os import ops os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" os.environ["CUDA_VISIBLE_DEVICES"] = "0" import glob from configobj import ConfigObj from models import att_unet_2d from tqdm import tqdm from losses import * import scipy.io as sio import matplotlib.pyplot as plt import batch_utils f...
fbf2c295bffb25797b8e25d20039e16a3b3b82ae13620b9c35ad998ca05d2aa0
Python
4,639
152
import experiment as exp import asyncio from canvas import Canvas class TiledCanvas(Canvas): def __init__(self, canvas_id, duration, logger, offset=[0, 0], on_disconnect=None): super().__init__(canvas_id, on_disconnect=on_disconnect, logger=logger) self.offset = offset self.size = None ...
058e9b58ebe7240efe7d75dcdd5bd19fcdc4073ff7c8731b1fc9ed43c9e3c76f
Python
4,640
139
import io from pathlib import Path from shutil import rmtree import tarfile import numpy as np import pytest def test_tar_writer(): from mlspm.data_generation import TarWriter base_path = Path("./test_writer") base_name = "test" base_path.mkdir(exist_ok=True) with TarWriter(base_path, base_nam...
edbfce7e786bb1dc6c401b02dd0891efaff94342deb8b3d241447aae96180236
Python
4,641
116
""" Extract the annotations of Neo objects and structure them in a DataFrame to complement a wave characterization. """ import argparse from pathlib import Path import numpy as np import pandas as pd import quantities as pq import re from utils.io_utils import load_neo, save_plot from utils.parse import none_or_path, ...
97a9d7404ee396ead3076dcdd3f7b7578cefae98bacc58a48f7ddd66b410fc74
Python
4,643
120
# Author: Guoqing Bao # School of Computer Science, The University of Sydney # Date: 2019-12-12 # GitHub Project Link: https://github.com/guoqingbao/Pathofusion # Please cite our work if you found it is useful for your research or clinical practice # from IPython import get_ipython import os # os.environ["CUDA_VISIBL...
3e7203e9474be9dd1e0129bdd1716939365f230dbf96dd845623073642ec9273
Python
4,645
154
import numpy as np import pandas as pd from skimage import io import cv2 as cv import matplotlib.pyplot as plt import csv import seaborn as sns class microMSData(): def __init__(self, coords_file_paths, image_path_dicts): self.coords_file_paths = coords_file_paths self.image_path_dicts = image_path_dicts se...
6de4f4444fb6ed3cdaebb4f1281dba57158971951036e4f2e20805301aead73a
Python
4,645
122
"""Tests for explicit mutation of per-spike analysis results.""" from typing import Any import pandas as pd from qtpy import QtWidgets from sanpy.bAnalysisResults import analysisResultList, get_plot_result_definitions from sanpy.bAnalysis_ import bAnalysis from sanpy.interface.bScatterPlotWidget2 import bScatterPlot...
64c26372838589c84ffa12845ddc0528e8aff8636d4a66b4808ba393ca0e6318
Python
4,647
134
# 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...
6747379df10f0395a274554cff156d9c1fecc1ff0e1cb5ef32c5b6f7260e0544
Python
4,652
147
import argparse import os from typing import List from dotenv import load_dotenv from openai import OpenAI from openai.types.chat import ChatCompletionMessageParam import chromadb def build_prompt(query: str, context: List[str]) -> List[ChatCompletionMessageParam]: """ Builds a prompt for the LLM. # Thi...
52141301efa31b8e6c42ac05f91202aec0ecba32ea9af8a0e019745ccc7785f9
Python
4,659
176
"""Autograd based linear algebra backend.""" import functools as _functools import autograd.numpy as _np import autograd.scipy as _scipy from autograd.extend import defvjp as _defvjp from autograd.extend import primitive as _primitive from autograd.numpy.linalg import ( cholesky, det, eig, eigh, e...
aaaa35f1ea3130a633a053ee6ff3cb0fbaf30e181d92c2e92f1c53d2a4dbf5c9
Python
4,659
116
""" Extract the annotations of Neo objects and structure them in a DataFrame to complement a wave characterization. """ import argparse from pathlib import Path import numpy as np import pandas as pd import quantities as pq import re from utils.io_utils import load_neo, save_plot from utils.parse import none_or_path, ...
f68aaaa67175e28b9efe96cc2695c2c34d616c971a39baa0c94f9fcb1b7fd4f7
Python
4,663
136
import numpy as np def initialize_w_rec(params): """ Initializes (full rank) recurrent weight matrix Args: params: python dictionary containing network parameters Returns: w_rec: recurrent weight matrix, numpy array of shape [n_rec, n_rec] dale_mask: diagonal matrix indicatin...
140b1d45d9357e7b63983f6edbd16ea4feaf1097e289e70277d314565eb40e5a
Python
4,668
136
from __future__ import annotations import argparse import logging from pathlib import Path from typing import Any import pytest from hypothesis import given from hypothesis import strategies as st from snakebids.plugins.pybidsdb import Pybidsdb from snakebids.tests import strategies as sb_st from snakebids.utils.uti...
b713c37983ea61d2b52eb83888ce31b08bf21a65cf70cb89b493b349cdb1db83
Python
4,668
127
#### 2D TRANSFER LEARNING #### sim_tag = "rect2x2_transfer" ids = [ ("rect2x2_reference", "2mx2m reference"), ( "rect2x2_freeze_BN_0_1_TN_0_batch_size_600_src_pos_3ppw_target_2D", "2mx2m target (60% samples)", ), ] sim_tag = "Lshape_2_5x2_5_transfer" ids = [ ("Lshape2_5x2_5_reference", ...
0f5f936642760d7ccfc9c78609e46e10b6ae925ece326e74d3426b739f8516e5
Python
4,670
137
import torch import torch.nn as nn import torch.nn.functional as F class RelationGraphConvolution(nn.Module): """ Relation GCN layer. """ def __init__(self, in_features, out_features, edge_dim=3, aggregate='sum', dropout=0., use_relu=True, bias=False): ''' :param in/out_features: sca...
ac857aed491e025381fec890e7857b98855015a70ad7be61e8ae2693e4cbee0e
Python
4,672
120
"""Tests for `_hyperalign`, the Procrustes template loop behind `align`. Hyperalignment (Haxby et al., 2011) builds a common template, refines it over `n_iter` rounds of align-and-average, then aligns every subject to the refined template. `align(method='procrustes')` is the only caller. """ import numpy as np import...
ba2e1ffb12f4a1258822a9349a2acef0d1860735bdb73554a9e48f0ec3482a6e
Python
4,672
110
"""The LAMMPS export goldens: the libtorch numbers and the ML-IAP interface.""" from __future__ import annotations from pathlib import Path from tests.golden import harness from tests.golden.paths import REPO_ROOT from tests.golden.targets import anchors as anchors_target ORDER = 60 HELP = "the LAMMPS export golden...
a1dcb1ab8990ff34fa4f03ff379b26fc950864c2df47b63ab831c112ba8a49b4
Python
4,673
117
from PymoNNto import * import scipy as sp import matplotlib.pyplot as plt #multi compartment version of #https://hodgkin-huxley-tutorial.readthedocs.io/en/latest/_static/Hodgkin%20Huxley.html #with a simplified version of the cable theory to connect compartments class HH_main(Behavior): def alpha_m(self, V):#Cha...
4b30f0ed90a3a480921446dfe511ac79698901d1f40bbb11f1388658093b7d44
Python
4,677
112
"""Coordinate conversions: every pair round-trips, and junction is never confused with CDR3.""" from __future__ import annotations import polars as pl import pytest from hypothesis import given from hypothesis import strategies as st from vdjdb.convert import coords AA = st.text(alphabet="ACDEFGHIKLMNPQRSTVWY", min_...
dd2432d3473bf02b348a02d00a52e11c5accbe8a1f656347dd18e3fce204e517
Python
4,677
130
"""Tests for ``bExport`` report headers.""" import csv from pathlib import Path import pandas as pd import sanpy from sanpy.bAnalysisResults import get_analysis_result_definitions from sanpy.bExport import bExport def test_summary_header_uses_file_metadata(test_data_dir: Path) -> None: """Report file metadata ...
d072bb09474688725af4954881dd41868b695eb2d9084183bd687f8290bd977a
Python
4,678
139
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import random from pathlib import Path from typing import Dict, Optional, Tuple import torch import torch.nn as nn logger = l...
e58b0a8710257f9898393bee910c54cbb1d011d924d9767964355d2d1d9ed26e
Python
4,678
88
"""Evidence integration preserves observational and missingness boundaries.""" import polars as pl import pytest from vdjdb.score.evidence import categorical, integrate def test_categories_keep_unknown_separate_from_zero(): frame = pl.DataFrame({'a_studies': [None, 0, 1, 2, 9], 'iptm': [None, .2, .5, .8, 1.]}) ...
415e47a9c7c73a9ed292e3f78ca0da1c0a4daaa52be110aebe7ed9e29f716535
Python
4,685
121
# Copyright (c) 2020 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 app...
77e7d82d26f4fbf8ad20af53ffc684f4fec4cbd2929a06045b948f78c5b83fee
Python
4,685
131
from __future__ import annotations from pathlib import Path from snakebids.paths._config import get_bids_func from snakebids.paths.specs import LATEST def bids( root: str | Path | None = None, *, datatype: str | None = None, prefix: str | None = None, suffix: str | None = None, extension: st...
9820a5d72a2d18b137436043e4d744c21b41016c8ab3c29cc82efa25303cea4a
Python
4,688
140
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging import concurrent.futures import time import psutil import subprocess # nosec B404 import tests.end_to_end.utils.defaults as defaults import tests.end_to_end.utils.docker_helper as docker_helper import tests.end_to_end.util...
a5f4803ff6be91740ba17387a4f8159ff99c2a1b3a50b3bb7a9d1ca251895c4c
Python
4,689
138
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F class RelationGraphConvolution(nn.Module): """ Relation GCN layer. """ def __init__(self, in_features, out_features, edge_dim=3, aggregate='sum', dropout=0., use_relu=True, bias=False): ''' :param i...
250246f500876564689a35ca4c34d6c16d4c39bc5129e14f4cbfecb8eb8550ac
Python
4,690
124
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Adagrad optimizer module.""" from typing import Dict, Optional import numpy as np from openfl.utilities.optimizers.numpy.base_optimizer import Optimizer class NumPyAdagrad(Optimizer): """Adagrad optimizer implementation. Im...
346d4bacc5f3f629665a547faf745cbe2492bc8a32380e40979c26cc808eafc5
Python
4,691
127
"""Tests for nltools.algorithms.corrections — multiple comparison corrections.""" import nibabel as nib import numpy as np import pytest from nltools.algorithms.corrections import fdr, holm_bonf, threshold, multi_threshold class TestFDR: """Test false discovery rate correction.""" def test_fdr_basic(self):...
65741ebabca3293820c6a0e52ef6d5abb2a39e5bfa195c889ee727b968220501
Python
4,694
137
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # import torch from functools import partial from utils import logger from utils.ddp_utils import is_master from utils.tensor_utils import image_size_from_opts from .datasets import train_val_datasets, evaluation_da...
039acfe8ebef4b45c8080d7c061548a4a66b55b20fac690224f488bdd64c6fc6
Python
4,702
125
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Random grouped assigner module.""" import numpy as np from openfl.component.assigner import Assigner class RandomGroupedAssigner(Assigner): r"""The task assigner maintains a list of tasks. Also it decides the policy for whic...
d9f4241c8eee014e460012c70f307e2918ecd628fa09579c24c10ca2a82b77c1
Python
4,702
107
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import torch from typing import Final, Callable, Optional, List # NOTE: persistent modifiers are modifiers that fundamentally change the behavior of the model (same input will lead to different output...
b234be3cdb5cebd1381fe04e6f588f1ebfefbf95626cf7484e1f5c44df917c14
Python
4,704
136
from chromadb.api.types import EmbeddingFunction, Space, Embeddings, Documents from chromadb.utils.embedding_functions.schemas import validate_config_schema from chromadb.utils.embedding_functions.utils import decode_embedding from typing import List, Dict, Any, Optional import os import numpy as np import warnings fro...