sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
2fd6eb7562615d35ba5d8d34b24d5fd91c06510a6544d197c45b302885ad60c5
Python
2,245
50
#TO BE UPDATED from NeuronModel.NeuronClass import neuronClass import numpy as np import matplotlib.pyplot as plt hsv = plt.get_cmap('hsv') def colors(n): return hsv(np.linspace(0., 1.0, len(n)+1)) class MSN(neuronClass) : parameters = {'save': True, 'spike': True, 'tau': 10., 'R': lambda x:10., 'u_rest': -6...
e4ee7ef9b4d51e6771dbcdb829490c9a52ea45d6d2fa1b1cace2ab9dfc1a554c
Python
2,245
72
"""There are three configurable things: predictors/models, data, training/evaluation. Only first two require factories. """ import os import pandas as pd import logging from src.domain_chop import PairwiseDomainPredictor from src.models.rosetta import trRosettaNetwork from src.domain_assignment.assigners import Spa...
04e6b16973755bc49ea42027f6690b9cfaeae9b8ad042a0009910c77a65b113e
Python
2,246
76
""" In this file the testing for the GCAPS for the 123 bus network is performed """ import numpy as np import gym from stable_baselines3 import PPO import torch from stable_baselines3 import A2C, PPO from stable_baselines3.common.callbacks import CheckpointCallback, BaseCallback from stable_baselines3.comm...
a0f6c38e9d339f9be4a564fe4bcff360a2fd46bffb24fce8cf1f55b395962ac2
Python
2,246
66
import argparse import json from pathlib import Path def open_json(fp): """ Open a JSON file and return the object :param fp: The path to the object :return: The dictionary object """ with open(fp, mode="r", encoding="utf-8") as open_file: obj = json.load(open_file) return obj d...
75b902945a8080263826c252a0e8992d03808a221887ae7231586f1a38d87a9b
Python
2,247
67
import logging import warnings import torch from torch import nn from torch.nn import ModuleDict from .base import Shifter logger = logging.getLogger(__name__) class StaticAffine2d(nn.Linear): def __init__(self, input_channels=2, output_channels=2, bias=True): """ A simple FC network with bias ...
59f1d68bf5a562a039146f2610b0977d4f1e8a45df4e2fe3596122640d7426f6
Python
2,248
58
""" openff-evaluator Report results for free energy simulations. """ import sys from setuptools import setup, find_namespace_packages import versioneer short_description = __doc__.split("\n") # from https://github.com/pytest-dev/pytest-runner#conditional-requirement needs_pytest = {'pytest', 'test', 'ptr'}.intersecti...
c7f97694233e7ccb3d22fa11aca6cb46f698c841d9d61d43f174826afa6d8eba
Python
2,249
68
import sys sys.path.append(".") import argparse from tqdm import tqdm import gzip from crystallm import ( extract_formula_nonreduced, extract_space_group_symbol, extract_volume, extract_formula_units, ) try: import cPickle as pickle except ImportError: import pickle import warnings warnings.f...
390e9f62bc198930019280647fd250abdb26a7a9ecedf0d997a3d919fcd9219b
Python
2,252
77
from tqdm import tqdm import hashlib import os import argparse import pandas as pd def formatter(x): try: x = float(x) return '{:.1f}'.format(x) except: pass try: x = pd.to_datetime(x) return str(x) except: return x def main(): parser = argparse.A...
6daadac701a85029a92780f405284c563ee4d35a8cc76b4f6b06b62541db77d3
Python
2,252
69
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.agent_toolkits.github.toolkit import ( BranchName, CommentOnIssue, CreateFile, CreatePR, CreateReviewRequest, DeleteFile, Dire...
a14731a3a0b7af6a17ac11fe1913974ea5fd4d1b56d156ef2e452fcff5d19b4c
Python
2,252
64
from collections.abc import Hashable import numpy as np from pgmpy.structure_score.log_likelihood_gauss import LogLikelihoodGauss class BICGauss(LogLikelihoodGauss): r""" BIC structure score for Gaussian Bayesian networks. This score penalizes the Gaussian log-likelihood to discourage overfitting. The ...
1cde379d53fdb117e8f8916dc8a6c2836304179536be66c9eefe6d24bb186186
Python
2,255
83
#!/usr/bin/env python3 import os import warnings import argparse from pathlib import Path import pandas as pd from src.drop_width.preprocessing import DropDataProcessor from src.drop_width.model import build_lstm_model # Suppress TensorFlow and warnings os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' warnings.filterwarnings(...
8884e63ddb7f0fa84bd89bfd956fbefa10db687fa0cfc3380b85d06837be4474
Python
2,255
60
import argparse from pathlib import Path import torch from openbabel import openbabel openbabel.obErrorLog.StopLogging() # suppress OpenBabel messages import utils from lightning_modules import LigandPocketDDPM if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('checkpoint', ...
c329e9321687a314852a5b21e98160c416d1f9f6f35c6342299ad53ac42701d8
Python
2,256
63
# -*- coding: utf-8 -*- #################################################################################### # # STEPS - STochastic Engine for Pathway Simulation # Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan. # Copyright (C) 2003-2006 University of Antwerp, Belgium. # # S...
c69ccee98fa546228a5c71a5eea659a92eed054c7bf5f832f028254387a8038c
Python
2,256
67
import glob import numpy as np from scipy.stats import iqr import matplotlib.pyplot as plt from paths import TEST_DATA_PATH test_data_path = TEST_DATA_PATH + "/baseline/" ground_truth = np.squeeze(np.load(test_data_path + "baseline.npz")["oxygenations"]) wls = [] results = [] est_oxy = [] names = [] for filename in...
359c945c0fe23cc6cc191fa11c854b01425a553a8ec138915e269c14d747b992
Python
2,257
80
# direct prediction using iComFormer import sys sys.path.append("/yourpath/Comformer") import pickle as pk import os import torch import numpy as np import pandas as pd from jarvis.core.atoms import Atoms from comformer.graphs import PygGraph, PygStructureDataset from torch.utils.data import DataLoader from comformer.m...
381d4540e55715142ef62a64e8529f275e87a79d1b57a752e8fc9236b96ad912
Python
2,260
67
# Load in pre-trained model weights and evaluate its goodness (ECE, MCE, error) also saves logits. import keras import pickle from keras.models import Model from keras.optimizers import SGD from sklearn.model_selection import train_test_split from load_data_birds import load_data_birds from keras.layers import Global...
285ea900cd57eb961c426a78381f293d716ca2a9d26f707fb7523cf81c777a84
Python
2,261
58
# Copyright 2024 DeepMind Technologies Limited # # AlphaFold 3 source code is 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...
f9e8f56f5630286c3fc7bf3ecc58f0436f1b0498a0fc9177802250eb57f1e356
Python
2,262
69
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master...
0abb07f11a1b34ea881536e40a055489c191aff7e6de13422c30228b915e264a
Python
2,265
31
"""Page distance between each float and its in-text citations in main.pdf (or the PDF given as argv[1]). Columns: kind, number, float page, first citation page, float page - first citation page, nearest citation page (either side, earlier page on ties), float page - that page. Body floats are flagged when the nearest...
ec107b1d83fc805376ed593719b3bae9b89aaef812afd48d1a6d8e8136c3924d
Python
2,266
36
''' This datageneratormust be defined before training the network. Custom Keras datagenerators are elaborately described and illustrated here, https://towardsdatascience.com/implementing-custom-data-generators-in-keras-de56f013581c The generators must return (EEG, PMA) or (EEG, PMA, sample_weights) where: - EEG is...
1c400471a5f9a83fdd7e0f5060bd61ab3d37b01f6e76e3dd1c8e6709aee1b945
Python
2,267
69
import json import re from typing import TypeVar import yaml from langchain_core.exceptions import OutputParserException from langchain_core.output_parsers import BaseOutputParser from pydantic import BaseModel, ValidationError from typing_extensions import override from langchain_classic.output_parsers.format_instru...
fe55f0fe26e51a4e43749d0901953ba6678e87e9ad2d140dfd17460ca5d0d17b
Python
2,267
77
#! /usr/local/bin/python #'################################################################################# #'################################################################################# #' Prune a neural network defined in Keras #'################################################################################...
0259f06a4a066ec5f64db39855581200f796368b0a451fabb19a9a10c63c7739
Python
2,268
66
# Import necessary modules of astroCAST import os import pathlib from pathlib import Path from astrocast.denoising import Network, SubFrameGenerator root = Path("/tf/data/") model_path = root.joinpath("model") save_path = root.joinpath("model_retrain") train_paths = root.joinpath("pub_data/InVivoSuppRaw.h5") infer_i...
18daf4e88fb8bf633e4676a9bff315c861b72d2132021605dc54d2a82302736d
Python
2,268
64
from queue import Queue import torch from torch.nn import Module from torch.nn.parameter import Parameter from functions.batchnormp import BatchNormPFunction class BatchNormSync(Module): sync = True checking_mode = False def __init__(self, num_features, eps=1e-5, momentum=0.1, affine=True, ...
e38a9f91eea60e5e4b39e0e445cf91c66dca770e5714ff47328e454d1d876a13
Python
2,268
48
import hyperopt import numpy as np import os from src import utils from src import data_loader from src import constants from src import model i = 0 def optimize(config, ranges, num_evals, output_name="best_hyperparameters.json"): params = config.copy() # Define hyperparaments and ranges params["hid...
3757b6f74c1d859eb90bb07b52ce056dd16545cb7c2aa125e26224c623f375a9
Python
2,269
69
import sys import math import argparse import re from itertools import combinations def dist(p1, p2): dx = p1[0] - p2[0] dy = p1[1] - p2[1] dz = p1[2] - p2[2] return math.sqrt(dx**2 + dy**2 + dz**2) def read_atoms(file, chain=".", model=1): pattern = re.compile(chain) current_model = model ...
5f3f60bfcb0f41539fe61546b22a17e4121742d4e68294b712f2cd17cad121ff
Python
2,269
66
import numpy as np import copy import itertools def neurons_initialization(neuron_init, correlation, MDC_data, n_neurons, data_min, data_max, depth, rng, ord): def masked_norm(a, b, ord=2): mask = ~np.isnan(a) & ~np.isnan(b) if not np.any(mask): return np.inf return...
ba2ac6066c453097481108b001c93a2e7baefef9a29bb42d5c90d70fecea6e6d
Python
2,269
92
import numpy as np if __name__ == '__main__': ''' path = './acm/labels.npy' x = np.load(path).astype('int32') print(x) print(len(x)) print('max = ', max(x), 'min = ', min(x)) ''' database = 'aminer' path = './{}/train_20.npy'.format(database) x = np.load(path) print(x) ...
7acb113181f2308a7c1ce2b075183ce7741db55eb417c126e4bd4b9ac71d8b16
Python
2,271
72
# Load in model weights and evaluate its goodness (ECE, MCE, error) also saves logits import numpy as np import collections import pickle from resnet_sd import resnet_sd_model from sklearn.model_selection import train_test_split from keras.models import Model from keras.optimizers import SGD from keras.datasets impor...
95749c9c6bedbafbb1e5a9c3deeff593bbab1b6b93762b0f072c6893968da2c5
Python
2,271
74
import logging def createFormattedStrings(fields, values, widths=None, pad=2, alignment='<', float_format='.3f'): """ automatically create a formatted string based on fields and values """ if widths is None: widths = [max(len(f)+pad, 6) for f in fields] header_format = "" values_format = "" ...
76ece9e6e4e81faa4a8da27e087817f2c851039c8d66780f17e5ee42f309ce71
Python
2,273
60
import jax import jax.numpy as jnp import jax.random as jrng import jax.tree_util as jtu import flax.linen as nn from flax.core.scope import DenyList, union_filters from flax.core.frozen_dict import freeze from projectlib.utils import grow_to class LayerwiseModule(nn.Module): def init(self, rngs, *args, ...
ec0aba983a707a17efeca75f0ed1d3b2eff4dd27b799981e456f0d94145fc03c
Python
2,273
60
import logging import os import socket import sys import pandas as pd from configs.configs import get_config_dict from helpers.brain_states import extract_number_of_brain_state_switches def _save_number_of_brain_state_switches( config_dict: dict, num_basis_states: int, connectivity_metric: str = 'correl...
6c29bb3a6ca9590ffacd936e1231c91a19a09befeb8fba27d23643d352aecab1
Python
2,274
62
# -*- coding: utf-8 -*- """ Created on Fri Apr 24 16:46:26 2020 @author: gritti """ import os # import sys # sys.path.append(os.path.join('..')) from orgseg.GUIs import inspection from orgseg.DatasetTools.segmentation import io as ioSeg from orgseg.DatasetTools import io as ioDT ####################################...
7494ba2b0f7a37a2eca1b170b49ec5cdf23373e475b8faad36f97c45040d1ddc
Python
2,274
36
''' This datageneratormust be defined before training the network. Custom Keras datagenerators are elaborately described and illustrated here, https://towardsdatascience.com/implementing-custom-data-generators-in-keras-de56f013581c The generators must return (EEG, PMA) or (EEG, PMA, sample_weights) where: - EEG is...
84479d26a7ca35e574deb4e185794830b51c344918e0ab907bfa57c4937fefb3
Python
2,274
56
import torch.nn as nn import torch.nn.functional as F from models.pointnet2_utils import PointNetSetAbstractionMsg,PointNetFeaturePropagation class get_model(nn.Module): def __init__(self, num_classes): super(get_model, self).__init__() self.sa1 = PointNetSetAbstractionMsg(1024, [0.05, 0.1], [16,...
f9957fcc6b09c769c13096f751745c00a2da9e94179c68ce0c8ce1e474f6bef3
Python
2,274
65
from collections.abc import Hashable from pgmpy.structure_score.log_likelihood import LogLikelihood class AIC(LogLikelihood): r""" AIC structure score for discrete Bayesian networks. AIC balances discrete log-likelihood against model complexity using a sample-size independent penalty. The local scor...
56f4f4b0865d9156bc905a0f1d65c7227078cf59d68e625e2851e89de96b0f21
Python
2,275
61
import math import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from .functionals import softplus_inverse, cutoff_function import e3nn.o3 as o3 def check_irrep(irrep): if not isinstance(irrep, o3.Irreps): irrep = o3.Irreps(irrep) return irrep def Shifte...
e395e284a386157e4ddff60869a7b3e77f34f43ab583d01e34953422534dc417
Python
2,276
66
import os import sys import torch import argparse import numpy as np from tqdm import tqdm, trange from genie.utils.model_io import load_model def main(args): # device device = 'cuda:{}'.format(args.gpu) if args.gpu is not None else 'cpu' # model model = load_model(args.rootdir, args.model_name, args.model_ver...
10b57b5700eec1da77cff02604681d216e1ca5fc8267d3374f4f4d4fe9581c70
Python
2,277
78
import math import torch import torch.nn as nn import torch.nn.functional as F class ChannelSelfAttn(nn.Module): def __init__(self, F): super().__init__() self.conv1 = nn.Conv2d( 1, F, kernel_size=(1, 1), stride=(1, 1), padding=(0, 0), bias=True ) self.conv2 = nn.Conv2...
694b6fec65dc486b69bcbc5de3d30a9d82a4cec13f4fa9930328c5f22b6bb7d2
Python
2,277
85
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import nibabel as nib import numpy as np import os import pylab as plt DESCRIPTION = 'Fit Rayleigh Distribution to noisemap data. Cornelius Eichner 2020' np.set_printoptions(precision=2) def rayleigh_dist(x, sigma): f = (x / sigma**2) * np.exp(- ...
87dbe8e8d2f0ca5b9d14a07d1c02dbbda35493ed4259562f7695546e7a4ce98a
Python
2,277
63
""" Script for updating NDStorage/AcqEngJ/NDViewer to latest version It runs on the *-update branch and is called by an action in NDStorage/AcqEngJ/NDViewer repo """ import xml.etree.ElementTree as ET from pathlib import Path import sys import os import requests import time dep_name = sys.argv[1] if len(sys.argv) == ...
cab6c46dfcb513dd85e13d033bd527d581000ce832800b793e7467fa4e715a86
Python
2,277
64
import json import logging import os import socket import sys import pandas as pd from configs.configs import get_config_dict from helpers.hcp import get_human_connectome_project_subjects if __name__ == "__main__": data_split = 'all' experiment_dimensionality = 'multivariate' model_name = 'SVWP_joint' ...
f915e9fcf5317e333dc594c9255b8bb1120cea4c1a6bfe7947d296050b70b060
Python
2,277
96
"""Example04.""" # pylint: skip-file import numpy as np import torch import compare_models import pandas as pd import argparse parser = argparse.ArgumentParser() parser.add_argument('--dtype', help='dtype', default='float64') args = parser.parse_args() keys = ['EMB3 (PyTorch)', 'EMB4 (PyTorch)'] torch.jit.optimize...
c6650083bb0c708426d5875a19cdf930c53c7b4ec9a85903b40ba40a7b4e6336
Python
2,278
73
# Load in model weights and evaluate its goodness (ECE, MCE, error) also saves logits. import numpy as np import collections import pickle from resnet_sd import resnet_sd_model from sklearn.model_selection import train_test_split from keras.models import Model from keras.optimizers import SGD from keras.datasets impo...
95226eac101ce069db5773f6ca9919bd1eed2ad92a9ba5d1e8ec210e8baf6f78
Python
2,280
79
""" Nuclei of the auditory brainstem model provided by Verhulst et al. (2018). This script is downloaded from https://github.com/HearingTechnology/Verhulstetal2018Model. Reference --------- Verhulst, S., Altoè, A., & Vasilkov, V., (2018). Computational modeling of the human auditory periphery: Auditory-nerve response...
fd2601e776d71f0b14520e23514967f53a999c6d1fb29be08f1314dc2d194f2b
Python
2,281
71
#! /usr/local/bin/python #'################################################################################# #'################################################################################# #' Export tcga model results #'################################################################################# #'###########...
3859b361ce87c1362b1431cc3e8d9b37d45f5732f33f2955bb14e2641bf8483d
Python
2,282
118
TORCHVISION = [ "vgg11_bn", "vgg13_bn", "vgg16", "vgg16_bn", "vgg19_bn", "densenet121", "densenet169", "densenet201", "inception_v3", "resnet18", "resnet34", "resnet50", "resnet101", "resnet152", "shufflenet_v2_x0_5", "mobilenet_v2", "wide_resnet50_2",...
37c0e92d355a569cbf6acecd09f1ccb969ba6363505a3718d9dbd8926b57ac34
Python
2,284
87
#! /usr/GenNet/env_GenNet/bin/python #'################################################################################# #'################################################################################# #' Export tcga model results #'################################################################################# #...
4fc4fc16cec6a358c865239780d90830a059661981a89a07cedd18649fafaa93
Python
2,285
67
from collections.abc import Hashable import numpy as np from pgmpy.structure_score.log_likelihood_cond_gauss import LogLikelihoodCondGauss class BICCondGauss(LogLikelihoodCondGauss): r""" BIC structure score for Bayesian networks with mixed discrete and continuous variables. This score penalizes the co...
38c95d17d62fd9c8b2c7a9039c9b778ec083850e81b90c18711ce0ffe6c30efa
Python
2,286
67
from pdearena.configs.config import Config from pdearena.configs import ( Coal, Blast ) from importlib import import_module import os config_prefixes = { Coal: "coal", Blast: "blast", } CONFIGS = dict() CONFIG_PATH = "pdearena.configs" def get_config_names(path: str, configs: dict): ...
afcc16bb87b41d5f280089bfd22334f6b2a0a7bd6526bfd5e9173b64638b0acd
Python
2,286
79
"""Chain that runs an arbitrary python function.""" import functools import logging from collections.abc import Awaitable, Callable from typing import Any from langchain_core.callbacks import ( AsyncCallbackManagerForChainRun, CallbackManagerForChainRun, ) from pydantic import Field from typing_extensions imp...
f540aa864cd13974ec48b6759a838340268993cea3746e9bbf3147cc5f00d33c
Python
2,287
62
""" Import a General data. Import data from any source, even transcriptomics/ metabolomics/etc. To construct its own data, user should prepare an Excel file with 3 sheets. 1. The 1st sheet must be the assay data, in which the first row is the sample name and furthers are the expression levels of each protein/metabo...
2cf8d476adbd34fadb9a565254103c3aa01e93933340ba3ced283d783cb83106
Python
2,288
95
''' cgatflow.py - Computational Genomics Analysis Workflows ======================================================= :Tags: Genomics To use a specific workflow, type:: cgatflow <workflow> [workflow options] [workflow arguments] For this message and a list of available keywords type:: cgatflow --help To get...
c6a4f022cc3ee521229722547c9c999d85fa39259a95d56dafd9078a94cf0c94
Python
2,288
87
from __future__ import print_function import argparse import sys # for commanad line import os # for file paths import re import itertools import cPickle as pickle import numpy as np def main(): '''Read reactions''' global v found_counts = [] times = [] candidate_counts = [] # Read from file print('Readi...
f238a276a4171329e9e151e3921a0c2bba8ee270e128932f79c0efea599aaaf5
Python
2,288
58
# class for collecting statistical tests for analysing cellsdata import numpy as np import scipy.stats as stats import statsmodels.api import statsmodels as sm from packerlabimaging import AllOpticalTrial """STATISTICS FOR TESTING FOR SIGNIFICANCE OF PHOTOSTIM RESPONSES""" def runWilcoxonsTest(array1, array2): ...
880151c72792d9572adbe384cf2d3d318cbf0169414fce6cc46aa78709cedf7d
Python
2,289
70
from collections import OrderedDict import copy import torch import torch.nn as nn from openfold.utils.tensor_utils import tensor_tree_map class ExponentialMovingAverage: """ Maintains moving averages of parameters with exponential decay At each step, the stored copy `copy` of each parameter `param` is ...
192db55a69fca568d583b6cdfebf0b6323b2d8c0beb97f286beded6f1befd08c
Python
2,291
66
from mimic3models.metrics import print_metrics_binary import sklearn.utils as sk_utils import numpy as np import pandas as pd import argparse import json import os def main(): parser = argparse.ArgumentParser() parser.add_argument('prediction', type=str) parser.add_argument('--test_listfile', type=str, ...
373d34fcbf4eaffc98cfd4ccbc3bae034701b5b7341e7680f755e90da61aeb36
Python
2,293
74
import dataclasses import pathlib import pickle @dataclasses.dataclass class CiliaAnalysisDataset: cilobjs_array: list cn_to_cilobj: dict cn_to_skelcd: dict cn_to_mpskel: dict cn_to_bbox_mesh: dict @property def cellnames(self): return ( self.cn_to_cilobj.keys(...
ad64772551c1689ed3a505807267fcb8d2779f4108c16085f1bd81649150f14a
Python
2,293
67
import os import mne import numpy as np from audio_utils import WaveProcessor from tqdm import tqdm def create(wav_folder: str, tg_folder: str, out_folder: str, segments_list: list, config: dict) -> None: """ Create feature from audio snips. This function creates a feature from audio snips. The feature is a ...
e896c1e2e8371d0c836801c7ad93bea8997ac75268c1fda5de90e0b5d8fc342a
Python
2,293
55
"""Class registry for models, layers, optimizers, and schedulers. """ optimizer = { "adam": "torch.optim.Adam", "adamw": "torch.optim.AdamW", "rmsprop": "torch.optim.RMSprop", "sgd": "torch.optim.SGD", "lamb": "src.utils.optim.lamb.JITLamb", } scheduler = { "constant": "transformers.get_const...
00e103eb43b52943747653ea0ec8aec4518d6c3ebe58d17cfa8e677f9cce2623
Python
2,297
51
import tempfile from pathlib import Path from mrQA import monitor, logger from mrQA.config import status_fpath from mrQA.tests.conftest import THIS_DIR from mrQA.tests.simulate import copy2dest from mrQA.utils import send_email # @settings(max_examples=10, deadline=None) # @given(args=dcm_dataset_strategy) def run(f...
86b4af5021a05a58544ac05f525b376d74ac3983f011025d821747f743f59f06
Python
2,297
82
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import numpy as np import nibabel as nib import pylab as plt import os DESCRIPTION = """ Align Shifted LR and RL Data for TopUp using only axis roll. This step is required due to a shift on Bruker scanners if the PE direction is reversed. Cornelius E...
bd45d2c5a6fac01d3d52ec6a851e41aea260f9585a5ea7c30c3ee80b0dcb1db8
Python
2,297
80
import argparse import numpy as np from scipy.signal import filtfilt def lp_filter_zero_phase(x, fc): """ lp_filter_zero_phase - Second-order zero-phase Lowpass filter. Syntax: y = lp_filter_zero_phase(x, fc) Inputs: x: Vector or matrix of input data (channels x samples). fc: -3dB cut-off...
60da01c03ea5b1157580baff65e9a1d99029e4b3219709fa038513eb2f577fe6
Python
2,298
71
#################################################################################### # # STEPS - STochastic Engine for Pathway Simulation # Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan. # Copyright (C) 2003-2006 University of Antwerp, Belgium. # # See the file AUTHORS for d...
4c15df25ebf1b24a59fffd12b928696d10eac74fbfd6e923d7c2599259deaed7
Python
2,299
75
# Copyright 2022 DeepMind Technologies Limited. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
2357e7f0e34a1d48379fa92afe16b92b5ac53c97d50f4df55d3298324150f72a
Python
2,301
82
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Apr 8 23:20:18 2023 @author: weihan """ import torch import torch.nn.functional as F from torch_geometric.nn import ChebConv, LayerNorm, GCNConv class ChebConvConvolutional(torch.nn.Module): """ Graph convolutional network by ChebConv method. ...
ee7fa0f552779d63c4d3c2bccb3810f4e12adf1b8008c9590fb228cabf59f8fa
Python
2,301
64
from openff.interchange.drivers.all import get_openmm_energies from openff.toolkit import ForceField, Molecule, Topology from openff.toolkit.typing.engines.smirnoff import LibraryChargeHandler, vdWHandler from openff.units import Quantity, unit sage_21 = ForceField("openff-2.1.0.offxml") sage_21_uc = ForceField("openf...
1c7f5c6c2027045d082f5e30994ca977ec2fda218f27fa51f18c2ab57dedd702
Python
2,302
60
"""Evaluation protocols for battery SOH prognostics. P1 random-row split (leaky: cycles of the same cell in train and test) P2 within-cell chronological (first `train_frac` of each cell's cycles -> train, rest -> test; leaky w.r.t. cell identity) P3 cell-disjoint (GroupKFold by cell inside each dataset; the realist...
a4a24570ef0a35739178caabb66bf1fe84c75ecffefe233fbf110732472f7055
Python
2,303
82
from bindsnet.encoding import bernoulli from bindsnet.environment import GymEnvironment from bindsnet.learning import MSTDP from bindsnet.network import Network from bindsnet.network.nodes import Input, LIFNodes from bindsnet.network.topology import Connection from bindsnet.pipeline import EnvironmentPipeline from bind...
89df467f662aed27e0b64483a54b689abf4d795ce3a766fe28b6205f1ebbd9f3
Python
2,304
77
import sys import argparse from yolo import YOLO, detect_video from PIL import Image def detect_img(yolo): while True: img = input('Input image filename:') try: image = Image.open(img) except: print('Open Error! Try again!') continue else: ...
be499ce327090f5d1e3845e49b9e1c37689a3a09c76f12ec7659c953c7413e9e
Python
2,304
78
import matplotlib.pyplot as plt from dival.util.plot import plot_image from dival.measure import PSNR, SSIM from dival import DataPairs from dliplib.utils import Params from dliplib.reconstructors.dip import DeepImagePriorReconstructor from dliplib.utils.helper import load_standard_dataset, set_use_latex set_use_la...
cbc467447dfbabb7e6951e0f5bf5a51c35a4d624a3766ca5ce22884aac01665f
Python
2,304
60
import torch.nn as nn import torch.nn.functional as F class View(nn.Module): def __init__(self,shape): super(View, self).__init__() self.shape = shape def forward(self, input): return input.view(*self.shape) class Net(nn.Module): def __init__(self, dims): super(Net, self)._...
add062713190d0344d141cac9f21ded39022ae2c452dd0b821d43e5d8c295b8b
Python
2,306
73
import argparse import numpy as np def baseline_sliding_window(x, l, approach): """ baseline_sliding_window - Baseline wander extraction from biomedical recordings using a single stage of median or moving average filtering. Syntax: b = baseline_sliding_window(x, L, approach) Inputs: x: Vector ...
2f7181ad446ede924d77dabba02f21d06e0e9d57fc1bd545c9a15ff7e6807854
Python
2,307
61
"""Process-global default `TracePolicy` for agent middleware. `TracePolicy` (from langgraph) shapes what a middleware hook span records. This module adds a process-wide default that individual middleware override via their own `trace_policy` attribute. Set it once at startup with `configure_trace_policy`; the default ...
07ab4f2ec1ee0cf301e37b3e74e329af5ed4840c57d1a369f8a6ae4920ead104
Python
2,308
90
#!/usr/bin/env python3 import argparse import pathlib from typing import Optional import yaml import pandas as pd def parse_arguments( key: Optional[str] = None, stage: Optional[str] = None, method: Optional[str] = None ): """ Parses command line arguments """ parser = argparse.ArgumentParser(de...
813b25b19745c295f881016dde50d2fb011db2d54054b60b0af5ab7d8d18211c
Python
2,310
53
#!/usr/bin/env python # Imports import unittest import os import sys import tempfile import shutil import filecmp PATH_TO_DATA = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data') sys.path = [os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')] + sys.path from enrichm.generate import Genera...
93df83307e085bccf7f759c8ceee49a7aef79d8343b949e9b4c2611b15f34c58
Python
2,310
68
from logging import Logger from pathlib import Path from typing import List import re import numpy as np # needed in eval from ..data import (AnnotationTable, WorldlineTable) from ._utilities import default_args @default_args("_this, _now, *") def delete_annotations(dataset: Path, annotations: AnnotationTable, ...
a19fcd97e9f7f1261d7cfb3758aa2368ed8fc268af9bc252512c0ab8acd18e80
Python
2,310
57
import unittest import torch from EPI_MRI.LinearOperators import Conv3D, FFT3D, getLaplacianStencil from EPI_MRI.utils import m_plus class TestLaplacians(unittest.TestCase): def setUp(self): """ Initialize any common data or setup needed for the tests. """ self.m = torch.tensor([128, 192, 256]) ...
343053f9143cdff2b0f58eaccbbc3a05b6c52f8c6c7317735defaf1b3e8a37c1
Python
2,313
89
""" Functions used for the scaden model """ import logging import collections from anndata import read_h5ad import numpy as np import tensorflow as tf from sklearn import preprocessing as pp import pandas as pd logger = logging.getLogger(__name__) def dummy_labels(m, labels): """ Create dummy labels needed f...
4dbda64ff0b1b7e21f76983dc40fefbab707e6bdbf83f655fbab275c135a2eb9
Python
2,313
80
from tqdm import tqdm import os import argparse import pandas as pd def formatter(x): try: x = float(x) return '{:.1f}'.format(x) except: return x def get_all_csv_files(dir): csv_files = [] for subdir, _, files in tqdm(os.walk(dir), desc='Getting all csv files'): for...
55f2932bf45c7ef470b8954961adb6cee54cc1b66a91505ca9764edf65e7a42e
Python
2,313
69
""" This script runs tensorQTL in python. """ import pandas as pd import argparse, session_info from functools import lru_cache from tensorqtl import cis, read_phenotype_bed from tensorqtl import calculate_qvalues, genotypeio @lru_cache() def get_genotypes(): plink_prefix_path = "../../plink_format/_m/genotypes" ...
6e5dae50b856b38e4c1432bcd277d89dc43b7047d24c8621f7304621a0444459
Python
2,314
74
import pickle import copy import numpy as np import scipy import scipy.stats class networkClass: parameters = {} def __init__(self, populations, weights, inputs): self.populations = populations self.weights = weights self.inputs = inputs def subclass(self, params, **kwargs): ...
e6366d5efc61d928481df0a0eca7d33e24baa9fdf1d54eaaa13682b3e44ef50f
Python
2,314
56
""" Classes that wrap instance of known java objects for ease of use """ from pyjavaz import JavaObject, DEFAULT_BRIDGE_PORT, DEFAULT_BRIDGE_TIMEOUT from mmpycorex.core import ZMQRemoteMMCoreJ # Don't delete this, its called by other code class Magellan(JavaObject): """ An instance of the Micro-Magellan API ...
10f2af9decd2c974853239c3c7c454151c2edf171e4eefeb6acc85117857ef05
Python
2,315
72
import hydra from hydra.core.config_store import ConfigStore from config import Scenario from model import Net import os from utils import * from matplotlib.ticker import FormatStrFormatter from tqdm import tqdm import matplotlib as mpl from matplotlib import font_manager from scipy.stats import pearsonr import yaml fr...
6e6f3a3015554ac835b8a83cee8378309434e0e146cdfeaae2c585f3361d009e
Python
2,315
50
import numpy as np import torch from torch.utils.data import Dataset import os import pandas as pd import networkx as nx from networkx.algorithms import tree from math import pi from rdkit import Chem from rdkit.Chem.rdchem import BondType from Bio.PDB import PDBParser import warnings from Bio.PDB.PDBExceptions import...
af42fcf58259ceebb6a39e315403f0b975b68d5487f4ef0a815411ad3cc072e3
Python
2,315
54
from scipy.integrate import solve_ivp import matplotlib.pyplot as plt import numpy as np import time from edNEGmodel.edNEGmodel import * from solve_edNEGmodel import solve_edNEGmodel start_time = time.time() I_stim = 36e-6 # [uA] alpha = 2 t_dur = 30e3 # [ms] stim_start = 10e3 stim_end = 20e3 sol, my_cell = so...
f9cf5565ca8033abb2bc006a4de3f4d0824dfc79bf0a9d867371bc76510e1149
Python
2,316
73
import torch import torch.nn as nn from enformer_pytorch import from_pretrained, seq_indices_to_one_hot from typing import Optional, Union from transformers import PretrainedConfig, PreTrainedModel from enformer_pytorch import Enformer, seq_indices_to_one_hot class EnformerConfig(PretrainedConfig): model_type = "...
d2e3d53cb830ce95002597709990037695646dc16c0730ec8f5f7b532bab37ed
Python
2,317
77
from OCC.Extend.DataExchange import STEPControl_Reader from OCC.Extend.TopologyUtils import TopologyExplorer from OCC.Core.StepRepr import StepRepr_RepresentationItem from get_information import get_brep_information from write_h5_file import write_h5_file def check_face_in_map(topo, face_label): # 用来检查是否所有的B-rep面...
6da65cca718fa4951f943ff654f2037e8b76e6b5407ed8ef95ed2314d798dd0f
Python
2,318
70
# -- coding: utf-8 -- # @Time : 2022/10/16 9:11 # @Author : Biao Zhang # @Email : littlebiao@outlook.com # @File : predict.py import numpy import torch from utils import load_data, set_params, evaluate from module import HeCo import warnings import datetime import pickle as pkl import os import random from utils.logger...
d40d9575317ebe34b16afe59115c088a087e0471a136bccb43a7c2d970ab2983
Python
2,319
68
#### This script compares GENCODE version 25 with version 41. import session_info import polars as pl import seaborn as sns from pyhere import here import matplotlib.pyplot as plt from scipy.stats import spearmanr def load_annotation(fn, comp): return pl.read_csv(fn, separator="\t")\ .filter((pl.col(...
3b5845c022f1e3d74b497df13e46809deecc5426b04f491499ebe2855407ed33
Python
2,320
65
import tempfile import typing as tp from pathlib import Path from typing import Tuple from MRdataset import DicomDataset from hypothesis import strategies as st from hypothesis.strategies import SearchStrategy from mrQA.tests.simulate import make_compliant_test_dataset from mrQA.tests.utils import download param_str...
3d36eca5e96b74c46b392bf0c002fee888e687efb575fd07a25b03279e66a061
Python
2,320
55
from __future__ import annotations from langchain_core.agents import AgentAction, AgentFinish from langchain_core.exceptions import OutputParserException from langchain_core.utils.json import parse_json_markdown from langchain_classic.agents import AgentOutputParser from langchain_classic.agents.conversational_chat.p...
d55132f092f39066d0e10e12fa688e5f23d89c9e5053909dd40fafd50b1d0147
Python
2,320
56
import torch import torch.nn as nn class EstBN(nn.Module): def __init__(self, num_features): super(EstBN, self).__init__() self.num_features = num_features self.weight = nn.Parameter(torch.ones(num_features)) self.bias = nn.Parameter(torch.zeros(num_features)) self.register...
c0254484e09b263e235f835904e9b5b5c5f17bac949e8871758f71dd079f6d8c
Python
2,321
46
from src.PID import continuous_functions, format_data, discrete_functions from src.PID import PID_utils def compute_continuous_measures(X, src_idx, tgt_idx, args): if src_idx is None or tgt_idx is None or X is None: return {} measures = dict() measures['immi_syn'], measures['mi'] = continuous_funct...
49e80d2383c4c0bc1fa764b8b3381840c174729721978aa04f9312be586a2766
Python
2,322
73
import torch import numpy as np def thresh_func(mask, thresh=0.5): mask[mask >= thresh] = 1 mask[mask < thresh] = 0 return mask def dice_loss(pred, target): pred = torch.sigmoid(pred) pred = pred.contiguous().view(-1) target = target.contiguous().view(-1) intersection = torch.sum(pred...
ac98f4eb38edf8ce588a294758389fc85c34194c33d20b60bcaa876ec4d18083
Python
2,324
79
import argparse import pathlib from typing import Optional import numpy as np import pandas as pd import yaml import networkx as nx import itertools def parse_arguments( key: Optional[str] = None, stage: Optional[str] = None, method: Optional[str] = None ): """ Parses command line arguments """ p...
dda81ebfeb9f2d6f1b37c7da9386df40b293cfa1e8ff3a71f0d30fc653fa9a25
Python
2,324
52
import tensorflow.compat.v1 as tf from tensorflow.keras import layers from tensorflow.keras.models import Sequential class EmbeddingLayer(layers.Layer): def __init__( self, atom_size, atom_embedding_size, bond_embedding_size, name='embedding_layer', activation=None,...
1dd8992fd00cfd3ff6aeb5e2e29db2a3747967ac880f6c1c6aa15dc023adcec3
Python
2,326
72
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import torch import torch.nn.functional as F def scaledlp_loss(input: torch.Tensor, target: torch.Tensor, p: int = 2, reduction: str = "mean"): assert input.dim() == 5 and target.dim() == 5 # B, T, C, S, S input = input.flatten(3) ta...
6d0fd1bf3e4eae04159f08709bcef87930c7955fc3116797b778e83db3083d27
Python
2,326
69
"""Benchmarks for tool-to-OpenAI schema conversion. Agent loops convert every bound tool on every model call (token counting and `bind_tools`), so conversion cost is paid per step. The warm benchmark measures the steady state with the `tool_call_schema` memo populated; the cold benchmark measures first-time conversion...
9102b180c552e2d0e3cea88e01146f5b17d88920b724bd0284ea7383a9c6ef37
Python
2,328
76
# Copyright 2024 DeepMind Technologies Limited # # AlphaFold 3 source code is 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...