sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
2d4079fe4c871e9d3f25bcb1ab7254b2bcad6b7f808858f01f4ea0a389cf78af
Python
2,761
41
#! /usr/bin/env python from lab.parser import Parser def add_absolute_and_relative(parser, attribute, pattern): parser.add_pattern(attribute, pattern + ' (\d+) .+', required=False, type=int) parser.add_pattern(attribute + '_rel', pattern + ' \d+ \((.+)\)', required=False, type=float) parser = Parser() pars...
5e12cce0bb3eec58abedbfac50259ff2f5ba71b4d1889a03f3a1712733b819a5
Python
2,761
68
import sys, os import numpy as np import pandas as pd import pickle from scipy.io import loadmat, savemat import concurrent.futures sys.path.append('/m/cs/scratch/networks-pm/effects_externalfactors_on_functionalconnectivity/src/analysis') from utils import get_behav_data_15days #####################################...
3605bfc54a14a9c0468c616bd951eb91815e8d5a9e026c2c192bbf7c641bdfce
Python
2,762
83
"""distutils.command.install_data Implements the Distutils 'install_data' command, for installing platform-independent data files.""" # contributed by Bastian Kleineidam import os from ..core import Command from ..util import change_root, convert_path class install_data(Command): description = "install data fi...
05348d079232d4c5709175e9365749c91a60c4cda85a10b178e0321d92af15c8
Python
2,763
65
import torch import torch.nn as nn import torch.nn.functional as F class GRU(nn.Module): r''' A simple but effective gate recurrent unit (GRU) network structure from the book of Zhang et al. For more details, please refer to the following information. - Book: Zhang X, Yao L. Deep Learning for EEG-Based B...
24668b003178b9f143e6ac61b96be08da4ad894f1fcb4a6f43d8a852397b6b56
Python
2,763
73
import numpy as np from scipy.stats import norm from nilearn.masking import apply_mask, unmask # from nilearn.image import new_img_like, smooth_img # import scipy # from scipy.ndimage import label def hoyer_sparseness(x: np.ndarray, axis: int = 0) -> np.ndarray: """ Calculate sparseness of x over given axis. ...
b6b13e290f58a91ed6aae6e69c71dd3403f41cd1040eb7a39ebac1aed8d85384
Python
2,763
80
import torch import torch.nn as nn from ..initializer import create_initializer class Network(nn.Module): def __init__(self, config): super().__init__() model_config = config.model.vgg self.use_bn = model_config.use_bn n_channels = model_config.n_channels n_layers = model...
e59be5fe362d48f830aa44ea584a7abb998c284b5c3929a79f454e35a43d0957
Python
2,763
79
#! /usr/bin/env python3 import os import subprocess import logging import APT_interface class cd : """Context manager for changing the current working directory, and automagically changing back when done""" def __init__(self, path): self.path = path def __enter__(self): self.old_path = ...
ee490e9785a2f4ea9bc79c7e80feaa264b7c0a2fd6e169cec9a8a1ec2e7354df
Python
2,763
69
import torch import numpy as np import time from src.Liver_Glycogen_Phantoms.src_nn.Network import Network from src.Liver_Glycogen_Phantoms.src_nn.utilities import * from torch.autograd import Variable class NOEMRFReconstruction: def __init__(self): self.device = check_cuda() self.dtype = torch...
1c5218175ca8a5ebb0bf83f8106f9dde6e4596504615a1ca1cd49e3fe3766061
Python
2,764
92
""" Author: David Kappel Copyright (C) 2024, by the author. See the LICENSE.txt file for more information. Code snoopies: run the pairing protocol of Graupner and Brunel 2012 Calcium-based plasticity model explains sensitivity ofsynaptic changes to spike pattern, rate, anddendritic locati...
600ee29d7e81dd88bfbc1a90034acb6d07c10aa3b6f7b1fdbf355fd21be55846
Python
2,764
83
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
aa9d77b3bd9cef10e5f3c5f0fdd897a5e65ff422d03670da1d8e47b33f91b001
Python
2,765
123
import os as _os # project structure ROOT_DIR = _os.path.dirname(_os.path.abspath(__file__)) RESULTS_DIR = _os.path.join(ROOT_DIR, 'results/') DATA_DIR = _os.environ.get("REY_FIGURE_DATA") RESOURCES_DIR = _os.path.join(ROOT_DIR, 'resources/') # architectures REYCLASSIFIER_3 = 'rey-classifier-3' REYCLASSIFIER_4 = 'rey...
dc1e73e41c95b37982dfaeb08955d6cc5386bc590b1a2d9c132bf439946e0d69
Python
2,765
112
## import tensorflow as tf import PoseUNetAttention reload(PoseUNetAttention) from poseConfig import aliceConfig as conf import PoseTools tf.reset_default_graph() self = PoseUNetAttention.PoseUNetAttention(conf) self.train_unet(False,0) ## create the d import tensorflow as tf import PoseUNetAttention reload(PoseUN...
564806d64c8461e64c6db864f22e1a303a0799865c32bf20764750dcbd3063d8
Python
2,766
86
from sockjs.tornado import SockJSConnection, SockJSRouter from tornado import web, ioloop, httpserver from collections import OrderedDict import threading import sys import json import numpy as np import os class Controller: """Simple class to set & get points from neuroglancer """ state = {} clients ...
26d76318e91aff26ea5a7bf312cdb2fe2c121b591dd7a3f170eaa1c4deeb6c57
Python
2,767
85
import pytest import torch from elasticai.creator_plugins.lutron_filter.nn import Binarize from elasticai.creator_plugins.lutron_filter.precompute.truth_table_generation import ( generate_input_tensor_1d as generate_1d_input_tensor, ) from elasticai.creator_plugins.lutron_filter.tensor_conversion import ( torch...
427fad94897425b38fff7bd222a5a69b7577f558f7c375178b53effb9e3b0fe5
Python
2,767
92
# EyeNED OCT-ONH segmentation and feature extraction # Copyright (C) 2024 Erasmus MC # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your optio...
84676322ac504fb9053ae252de7caf1f93b4d9f1f5261728390c94b45e817a9f
Python
2,767
74
""" toposampling - Topology-assisted sampling and analysis of activity data Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation...
547d2fb89fedd6e8d2e0362eabaf1dba1deb3b0a56ec34d6bf3c26b9103572c6
Python
2,768
82
# flake8: noqa # There's no way to ignore "F401 '...' imported but unused" warnings in this # module, but to preserve other warnings. So, don't check this module at all. # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use thi...
80dffab41400c6896306b6ef445ba2645f2d39beee01ef4c6b012d5d21a79faf
Python
2,768
96
import os import textwrap import time from typing import NoReturn import optuna from optuna.artifacts import FileSystemArtifactStore from optuna.artifacts import upload_artifact from optuna.trial import TrialState from optuna_dashboard import ChoiceWidget from optuna_dashboard import register_objective_form_widgets fr...
14128c8997eeaf163c1ae845ae90f69b271480b2145ed4dab69c729913bf3d54
Python
2,769
87
from typing import Dict from skimage import transform import numpy as np from abc import ABC from abc import abstractmethod """ This module contains tools for measuring and correcting chromatic aberrations. """ class ChromaticCorrector(ABC): """ An abstract class for color-specific image transformation. ...
1deec84ae7951cf46d69ea08860843f8eb550312004fa8ef08b8721c2e61da9e
Python
2,769
120
""" We thank CASIA IVA for sharing his code 'https://github.com/junfu1115/DANet' that we have build our code on top. """ import numpy as np import torch import torch.nn as nn from torch.autograd import Variable class CAM_Module(nn.Module): """ Channel attention module """ def __init__(self, in_dim): ...
271ea71b526cf896aafb24cd614f0c17d17ecdec69f3b8fe282e902fa6967831
Python
2,769
75
import matplotlib matplotlib.use("Agg") import torch device = torch.device("cuda" if torch.cuda.is_available() else "cpu") from utilities.script_func import init, post, ScikitFeat_pre import pickle import logging logging.info("") def main(): import Models.models as Models import Models.model_func as Model_F...
b76a8f1bb3b5b2f871773efa40fa556639a30622f99949db65b08b55b33aad20
Python
2,769
80
import torch from torch import nn class BaseObserver(nn.Module): def __init__(self): super().__init__() self.forward_num = 0 def update_float_range( self, running_min_float: torch.FloatTensor, running_max_float: torch.FloatTensor ): raise NotImplementedError @torch.no...
1ac0833880e943b7ea5a8a452660e4e0716a3422188509075235d395b45f0908
Python
2,770
78
"""Test sequence constructors contained in the package.""" import pytest from console.interfaces import Dimensions from console.utilities import sequences @pytest.mark.parametrize("use_sinc", [True, False]) def test_se_spectrum(use_sinc: bool): """Test spin echo spectrum constructor.""" seq = sequences.se_sp...
b502f49c65682d4a0b53ba7d3bcb25604715a5926a63e3a845cbbd90833faaed
Python
2,771
96
import numpy as np import torch from torch import nn def gaussian_filter(sigma, s=11, dims=2): dim = s//2 ranges = np.arange(-dim, dim+1) if dims == 2: xx,yy = np.meshgrid(ranges, ranges) elif dims == 3: xx,yy,zz = np.meshgrid(ranges, ranges, ranges) d = xx**2 + yy**2 d = d +...
a977f6253277f039b05c5fffcd84849ff1aa9a4631ee9d0bf7a38e7d5f559f03
Python
2,774
77
def update_param(name, param): if name == 'data_leakage_handling': param['values'] = ["leave_one_out", "k_fold", "none", "LeaveOneOut", "KFold", "None"] return param return None # param untouched extensions = dict( validate_params=""" if (!missing(columns_to_encode)) columns_to_encode <...
e36430a6deec8a13096f30ecf4bc9b70189ce72b983b99142cbda677d0a3ddd3
Python
2,774
67
from optparse import OptionParser ### help and usage ### usage = "usage: %prog [options] args" description = '''Function: calculate the total number of pairwise differences between sequences from two populations ''' version = '%prog 08.08.2021' parser = OptionParser(usage=usage,version=version, description = descript...
478ec7a6918fd6c4e148b2a5b799ea14d337dbca73b2f1504f4e5ac4ecfd2776
Python
2,775
63
# regtools/registration/gui/orient_overlay.py """Orient a 2D image AND its points through the identical transform pipeline. Used by the Preview2DDialog points overlay. Mirrors the dialog's order (tissuecyte -> rotate -> flip_h -> flip_v) so points stay on the same pixels as the image by construction. Points are (...
935198669b7108befeab33cbacf7c94081e206df42cd3a7de38e881251a6e96f
Python
2,776
69
"""Functions to get and use HED queries.""" import pandas as pd from hed.models import QueryHandler def get_query_handlers(queries, query_names=None) -> tuple[list[QueryHandler | None], list[QueryHandler | None], list]: """Return a list of query handlers, query names, and issues if any. Parameters: ...
5d11ae5fd208526d39e1b38e6ecc060c26cc9f579e0bae9f0b750aecbe1445e2
Python
2,777
73
import SimpleITK as sitk from tiffile import imwrite from coarse import * from utils import genFileName, getTformPath def warpSingle(tform_path: str, f_vol_move:str, n_channel:int, sitkTile=sitkTile()): ''' warp a single (specified) channel in the specified image ''' res = [0.1625, 0.1625, 0.2500] ...
a3954bb307f8823756d3cc79c62392b6aea17700db1aeff8a396ac24b4156569
Python
2,778
83
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Mar 10 15:37:42 2021 @author: eveshalom """ from matplotlib import pyplot as plt import numpy as np from scipy import ndimage as ndimage def checkROIs(Ea,Ev): plt.rcParams.update({'font.size':18}) fig,[ax1,ax2] = plt.subplots(1,2,figsize=(20,10...
9ac3c75b5e1a178b57acf8903cbe13547f2812ceed139309a3cc41819c8712a1
Python
2,779
102
import modiscolite import numpy as np import h5py import click ###################################################################### # Script modified from one written by Han Yuan, Calico Labs ###################################################################### ########## # inputs # ########## @click.command()...
d0bbc98fb9c0d75ce17da491b7961210ed254fd2a890fb0872c7a66a47c909f6
Python
2,779
80
from __future__ import print_function import torch.utils.data as data import os import os.path import torch import numpy as np import sys def gen_modelnet_id(root): classes = [] with open(os.path.join(root, 'train.txt'), 'r') as f: for line in f: classes.append(line.strip().split('/')[0]) ...
130805352a9768582553964f4a444b20261aea7041e3be42242b0fb9ae30db0c
Python
2,780
69
import numpy as np import os.path as path import matplotlib.pyplot as plt from utils.utils import visualize_traces from single_nrn_tune.param_generator import nrn_init, syn_exp, simulation if __name__ == '__main__': cell_name = 'AWAL' sti_info = { "dt": 0.4, "tstop": 7000, "v_init": -8...
9f98cf868535e564b011f9efb7dcef17ad8edaf8ccbfbfad850802632f64ff23
Python
2,782
80
import scipy.integrate import autograd.numpy as np from autograd import make_vjp from autograd.builtins import tuple from autograd.extend import defvjp_argnums, primitive from autograd.misc import flatten odeint = primitive(scipy.integrate.odeint) def grad_odeint(yt, func, y0, t, func_args, **kwargs): # Extende...
39da001dbe675e999b204657d616934b4c638a30dc76b0ae9e93091390a7584b
Python
2,783
81
from importlib.util import find_spec import anndata as ad import numpy as np import pytest import scipy.sparse as sp from pertpy.tools._differential_gene_expression._checks import check_is_integer_matrix, check_is_numeric_matrix if find_spec("formulaic_contrasts") is None or find_spec("formulaic") is None: pytes...
2651743265ba4200a1aeb18f3e3e8a0132e21bfa42df124fdf1b3ef1929521ca
Python
2,784
72
#! /usr/bin/env python from lab.parser import Parser parser = Parser() parser.add_pattern('ms_final_size', 'Final transition system size: (\d+)', required=False, type=int) parser.add_pattern('ms_construction_time', 'Done initializing merge-and-shrink heuristic \[(.+)s\]', required=False, type=float) parser.add_patter...
0a2e1ba8a9c6ffcd1840e4800cf9779fefa990ae4244a38df0f4f8e257a59460
Python
2,785
91
# \file TestSegmentationPropagation.py # \brief Class containing unit tests for module SegmentationPropagation # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date May 2017 import unittest # Import libraries import SimpleITK as sitk import numpy as np import os import pysitk.simple_itk_helper as sitkh...
3edfdf624e06a5857f1f1f962c3e040d655a34a0075c3092b823881c4558790f
Python
2,785
64
# -*- coding: utf-8 -*- import tensorflow as tf class gEKF(): """ gradient-based EKF, this should be equivalent with EKF, but faster Args: learning_rate: learning rate epsilon: scale initial guess for P matrix q_0: initial process noise q_tau: time constant for noise ...
e1f42e23abf46ac93e266e19dff452de6c1719ddf10851f7044449b159d9aabb
Python
2,785
100
from pathlib import Path from types import SimpleNamespace import numpy as np import pytest from calvados import components as components_module from calvados.cfg import Components, Config from calvados.components import Protein, RNA from calvados.sim import Sim TEST_DATA = Path(__file__).parent / "data" def _mak...
36e0fb72d6c5edf1f392762a15fe3b902fee2b1903bdff19bbad2e43c2f1c8a8
Python
2,787
60
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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 # # ht...
f5405b9a91df9e84b99e242ae65b4f760bd965cc177dbcbc767ff765c2f9c691
Python
2,787
98
from enum import Enum, auto class ActionIfExists(Enum): """ Action to take if a statement with a property already exists on the entity. APPEND_OR_REPLACE: Add the new element to the property if it does not exist, otherwise replace the existing element. FORCE_APPEND: Forces the addition of the new ele...
0a41b59516fd4d7a80ccac48b0ea2b96f33d64c0a54e1f0a56151c60da311463
Python
2,788
90
import numpy as np import os from dimensions.bowls.dimensions import BOWL, BOWL_PROPERTIES from dimensions.cups.dimensions import CUP, CUP_PROPERTIES from perception_tools.common import get_models_path from pybullet_tools.utils import create_obj, apply_alpha # in_off = 0.0025 m SCALE = 0.01 # Units are in cm MODELS...
0afebd92aac5391bb06f5235a307be231c8ad1900d8aba868222f2c5c6129c12
Python
2,788
92
""" distutils.command.install_egg_info Implements the Distutils 'install_egg_info' command, for installing a package's PKG-INFO metadata. """ import os import sys import re from ..cmd import Command from .. import dir_util from .._log import log class install_egg_info(Command): """Install an .egg-info file for...
8d373b33fd8035c258f7ea5143345dd54f211cf69ef4f1d66746e44e858a6c88
Python
2,788
70
from torch.utils.tensorboard import SummaryWriter from datetime import datetime class TensorboardWriter(object): def __init__(self, log_dir, logger, enabled): self.writer = None if enabled: log_dir = str(log_dir) # Retrieve vizualization writer. succeeded = Fa...
44e2995e51cecb5ac6a6d764a567196ef83600257083fd366186dd69b5c305c4
Python
2,789
86
import numpy as np import tqdm import os file_path = os.path.realpath(__file__) script_folder = os.path.dirname(file_path) package_folder_path = os.path.dirname(script_folder) """ Preprocessing for the SO(2)/torus sampling and score computations, truncated infinite series are computed and then cached to memor...
62574476036f117db5efd616b09bbe521724225172144837d9cc6a11aa6328d8
Python
2,789
60
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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 # # ht...
3db4fa47624c19de414aa187203101e8099322fe252f7973fdbaa808081124fe
Python
2,790
93
import os from pathlib import Path from setuptools import find_packages, setup def read(filename: str) -> str: """ Read a UTF-8 file relative to this setup script. Parameters ---------- filename : str Relative path to the file. Returns ------- str File contents. ...
81e0a28f9276a42e77ad387b087686f0ed2fbfa7a50066a86acd84280275935e
Python
2,790
98
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
a5d1be589bffdcdd843974d2e466ee8da57dd390cd61864a44d755d1d3292d9f
Python
2,790
89
"""Pre-fitted linear model coefficients. Port of defineLinearModelCoefficients.m """ from dataclasses import dataclass @dataclass class LinearCoefficients: """Coefficients for the linear photoreceptor model.""" sc_fact: float # Scaling factor tau_r: float # Rising time constant (sec) tau_d: float...
4b6aefc00c371b5f09f005bf5ba01599e8215f0b7bddc43427c19e1d1ad4799d
Python
2,791
80
from molecularnodes.nodes.geometry import StyleCartoon, StyleRibbon, StyleSpheres def join_nodes(tree): return [n for n in tree.tree.nodes if n.bl_idname == "GeometryNodeJoinGeometry"] def branches(tree): "The nodes feeding the tree's final join" return [link.from_node for link in join_nodes(tree)[0].in...
567bf45375f7419fd7c543e705e481551eedbf89d28c418e6c49755c50d79fa8
Python
2,791
79
# coding: utf-8 __author__ = 'ZFTurbo: https://kaggle.com/zfturbo' if __name__ == '__main__': import sys import os # For this test, make sure that only the tested framework is available sys.modules['tensorflow'] = None sys.modules['torch'] = None gpu_use = 0 print(f"GPU use: {gpu_use}") ...
83246104e6b25c42f2deffdc863ac84b53083b6ae5d82f28d1b2fcbcaa2da348
Python
2,791
94
## # \file slice_coverage.py # \brief Class to visualize slice coverage over reconstruction space # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date Feb 2019 # import numpy as np import SimpleITK as sitk ## # Class to visualize slice coverage over reconstruction space # \date 2019-02...
9a350a1de3798edface5c5495074a090ee9c9a734d6d3f5564971332ba672cb7
Python
2,791
74
import torch import torch.nn as nn import torch.nn.functional as F def conv3x3x3(in_planes, out_planes, stride=1): """3x3x3 convolution with padding""" return nn.Conv3d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) class BasicBlock(nn.Module): expansion = 1 def __init__(...
9ec290f6ae5b4cfddb133180238da510d7d5bf7e73a507ab050ac0a31d18568e
Python
2,791
79
# coding: utf-8 __author__ = 'ZFTurbo: https://kaggle.com/zfturbo' if __name__ == '__main__': import sys import os # For this test, make sure that only the tested framework is available sys.modules['jax'] = None sys.modules['tensorflow'] = None gpu_use = 0 print(f"GPU use: {gpu_use}") ...
ff02c0b554cae10f6a28913a7d021352b406cade8267b2bf20c16fee487565ea
Python
2,791
72
"""Implementation of nexus acquisition manager for multiprocessing.""" import traceback from collections.abc import Callable from multiprocessing.managers import BaseManager from types import TracebackType from typing import Any from console.spcm_control.acquisition_control import AcquisitionControl # Alias required ...
06126cf85bff06b615b2bafc37eae84591155ed5e039e3e347740e427ad7d006
Python
2,793
68
import pytest from pathlib import Path from hmp import io from hmp import simulations import numpy as np import hmp from test_io import init_data @pytest.fixture def fixt_init_data(): return init_data() @pytest.mark.parametrize("n_comp,whiten,reject_threshold,min_duration,max_duration", [ (5, True, None, Non...
2a043bf462c2e2826a05c54717f90291ddc8739918b7cf74fedc3eb199433dd1
Python
2,793
81
import data_mnist import matplotlib.image import matplotlib.pyplot as plt import autograd.numpy as np import autograd.numpy.random as npr def load_mnist(): partial_flatten = lambda x: np.reshape(x, (x.shape[0], np.prod(x.shape[1:]))) one_hot = lambda x, k: np.array(x[:, None] == np.arange(k)[None, :], dtype=...
80970a8e88e890e0cfccf3039bb2981062c2bc96addefedae6b438e62bb150c3
Python
2,793
80
import numpy.testing as npt import pytest from pertpy.tools._differential_gene_expression import EdgeR try: from rpy2.robjects.packages import importr r_dependency = importr("edgeR") except Exception: # noqa: BLE001 r_dependency = None pytestmark = pytest.mark.skipif(r_dependency is None, reason="Requi...
d0e6970e3aa486bbf4061eccab29320db2574528fd5bc4ae1fdc2598c02725a9
Python
2,793
89
import string from functools import partial from os.path import dirname, join import autograd.numpy as np import autograd.numpy.random as npr from autograd import value_and_grad as vgrad from autograd.scipy.special import logsumexp def EM(init_params, data, callback=None): def EM_update(params): natural_...
59060d932be0f8ca396d5543607593af310568a15fb8c3f0a9154e0c1d099f5e
Python
2,795
41
""" FREEZE_DELTA_ALL_TYPES.py written 2026-09-23, BEFORE any transcriptomic data was opened. The 17 Sept frozen list is the top of a continuous ranking: for every cell type, how much more ambiguous the classifier is on it than on matched control types (`delta`). The transcriptomic test (04-NOTES/PREREG-2026-09-...
c4977b5ea26cfb4f42281525f3638aa6320eb7584e04b14c78dab43ba135f63c
Python
2,795
30
import os import shutil path = os.path.join(os.path.dirname(__file__), "../param/cell") print(path) files= os.listdir(path) AIYL_list = ["I1L","I1R","I2L","I2R","I3","I4","I5","I6","NSML","NSMR","DVA","AINL","AINR","AIML","AIMR","RIH","URBL","URBR","RIR","AIYL","AIYR","AIAL","AIAR","AUAL","AUAR","AIZL","AIZR","RIS",...
0aaba32bd0d0002872ef70aecf354c9f73ed42c635d35452cc9eb6180b8f408c
Python
2,796
77
# -*- coding: utf-8 -*- from __future__ import annotations from collections import Counter, defaultdict from typing import Iterable, Tuple, Union class Vocab(object): r""" Defines a vocabulary object that will be used to numericalize a field. Args: counter (~collections.Counter): :c...
8a50ea575546eec6888f65be1a48179a5106607e6eb8bf1441e22b99d41e6e87
Python
2,796
89
"""Elastic constants recipes for EMT.""" from __future__ import annotations from typing import TYPE_CHECKING from quacc import flow from quacc.recipes.common.elastic import elastic_tensor_flow as elastic_tensor_flow_ from quacc.recipes.emt.core import relax_job, static_job from quacc.wflow_tools.customizers import c...
35efb56e2e6d9c30ae66f4ddf3933ba69dee89411329866c4d271b5fcdd79792
Python
2,798
76
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
8dca5cac131678ca6784f1c6619b30b912181b13b5651e180237c1a74dfdba98
Python
2,798
82
import h5py import numpy as np import torch from torch.utils.data import DataLoader, TensorDataset import torch.nn as nn import torch.optim as optim class Autoencoder(nn.Module): def __init__(self, encode_layer=30, info_layer=1, quantum_number_later=1): super(Autoencoder, self).__init__() self.in...
b3abadef4d992bf8bb30084bb9045ade749ac7baf5f520deecc165ded56b1a38
Python
2,799
65
from __future__ import annotations from functools import cached_property from typing import Literal import pandas as pd from ._metadata import MetaData class Cytokine(MetaData): """Cytokine response signatures of human PBMCs from the Human Cytokine Dictionary.""" @cached_property def dictionary(self) ...
f09ea006a4ae04cbb5198e61307a56ea7e330804e5ce09fea0828764cd18f326
Python
2,799
108
from unittest import TestCase import numpy as np import matplotlib.pyplot as plt from soundsig.sound import plot_spectrogram from soundsig.incrowd import fast_conv from soundsig.strfs import fit_strf_lasso, fit_strf_ridge, strf_conv, make_toeplitz class TestFitStrf(TestCase): def setUp(self): pass ...
cfdf73fd2cb2c1c27e303cd0ba53a0dbdfe6eb8a96e3191b85725d5593f4d852
Python
2,800
81
# Copyright (c) 2020, Ko Sugawara # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and t...
10ab6fc7e703c5af5aeae3fdd848175494919662bf75d1eed96d48bc3eb4d8a6
Python
2,801
81
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
2ea402dc1d8ecca881bd0b34f75f9c53af4ddf7e5740e82d555ddf30c52e377c
Python
2,801
102
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
5f827e5fac05249d14de5ec9a4a01ca002e3c7200f471961b798c4ad421905c9
Python
2,801
63
"""Helper functions that build the translation model with a corroponding graph and session.""" from collections import namedtuple import tensorflow as tf from cddd import models from cddd import input_pipeline def build_models(hparams, modes=["TRAIN", "EVAL", "ENCODE"]): """Helper function to build a tran...
3971dae07c3533d5154e5ef39e3c3ba2313f1ba50565d34ab18c3e7455703ffc
Python
2,802
91
from collections import OrderedDict import hypothesis.strategies as st import torch from hypothesis import given from torch.nn import Linear, ReLU, Sequential import elasticai.creator.torch2ir.default_handlers as t2ir_handlers from elasticai.creator.ir2torch import Ir2Torch from elasticai.creator.ir2torch.default_han...
4e685775ef485407daf3b59ab2511998e555b405c63d05c3a780cd6c87eed159
Python
2,802
50
""" OXASL - Module to generate additional ROIs for analysis Copyright (c) 2008 University of Nottingham """ import numpy as np from fsl.data.image import Image from fsl.data.atlases import AtlasRegistry from oxasl import reg def run(wsp): """ Generate additional ROIs used for reporting and region analysis ...
181eae45716578dbaa37c9f71f6f51ce11a43a1ac54ff4bee56415448df0ec40
Python
2,803
91
from itertools import product from .core import make_jvp, make_vjp, vspace from .wrap_util import get_name, unary_to_nary TOL = 1e-6 RTOL = 1e-6 def scalar_close(a, b): return abs(a - b) < TOL or abs(a - b) / abs(a + b) < RTOL EPS = 1e-6 def make_numerical_jvp(f, x): y = f(x) x_vs, y_vs = vspace(x),...
2062f005e48c475ad27171b037e32fda9634439440c5970f110d4111ea5fa02f
Python
2,803
93
import json import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from pathlib import Path from ..prixfixe.predictor import Predictor from .utils import n2id, revcomp class AutosomePredictor(Predictor): def __init__(self, model: nn.Module, model...
2b4dfd7d8c09d49bad0e7a99ac8fabc5a8c6257f30bf1544192678e19dda2b61
Python
2,803
91
import pandas as pd import numpy as np import scipy.io import h5py import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import multiprocessing from math import ceil import vae_model as VAE from vae_model import vae_model from utils import onehot_test_label def ICVAE_harmonize(HDF5): file = h5py.File(HDF5, 'r')...
c9f3e84188626c08e06c58cd3fa79266b46bdfe09f9c38b33b149343f413fa0b
Python
2,803
59
"""Single source of truth for in-plane image rotation. Counting (cellpose) and registration both rotate sections to orient them. They historically used *different* primitives - ``np.rot90`` (90° steps only) in the counting path and ``scipy.ndimage.rotate`` (arbitrary angle) in registration - which let the two sta...
6df35f33a657091adce6778a701ce08ad5b1a72f8006be24de1eca0c532651f4
Python
2,804
68
"""Tests for the report's light / dark / system theme toggle.""" import json from regtools.registration.report import build_html_report from regtools.registration.report.assets import _CSS, _JS from regtools.registration.report.render import _THEME_HEAD_JS, _THEME_TOGGLE_HTML def _build(tmp_path): met...
96de17f6139377f5525f4a6d13299cce3caa10d69de1c86a60127e264c5d7f94
Python
2,804
88
from torch import Generator from torch.utils.data import DataLoader from pathlib import Path from ..prixfixe import DataProcessor from .utils import (preprocess_df, DataloaderWrapper) from .dataset import SeqDatasetProb class AutosomeDataProcessor(DataProcessor): def __init__( ...
aa3510adef61d546d7e1468ecdc2ef435dd4b592bee8ed96aea3395c07fea30a
Python
2,806
77
""" Specifies parameters common to different individual tomogram (synapse) processing scripts in order to make setting up multiple scripts easier. This file is normally placed in another directory at the seme level as this on (e.g. ../common). Scripts that need to use parameters defined here need to import this scri...
b9fd17423e057a15d4432e85ea8fbe7549bf8b6aa3e459a4b6d6f85798a2ef9b
Python
2,806
76
import numpy as np import scipy.sparse as sp import torch import torch.nn as nn import torch.nn.functional as F import math def sparse_or_dense_dropout(x, p=0.5, training=True): if isinstance(x, (torch.sparse.FloatTensor, torch.cuda.sparse.FloatTensor)): new_values = F.dropout(x.values(), p=p, training=tr...
e62f9e0797e73867b5b49ec42f18de8f87173a24b452366f5fcc51dbe6cae371
Python
2,806
80
#! /usr/bin/env python # ============================================================================== # Copyright (c) 2020, Ko Sugawara # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Re...
0cfe4a746956e80f8aaf30088c1d096ca2910832d2ac8dc08bd864f65e77460a
Python
2,807
96
#!/usr/bin/env python import defopt import sys import logging from pathlib import Path from typing import Optional from cyvcf2 import VCF, Writer from tqdm import tqdm def add_phasing_format_to_header(vcf): vcf.add_format_to_header( dict(ID="PS", Number=1, Type="Integer", Description="Phase set identifier...
a26b2f9230ade95b3d3b2023e045fd421c487af37815f41b1a90977d0bb0f8a8
Python
2,807
100
# -*- coding: utf-8 -*- import logging import os from logging import FileHandler, Formatter, Handler, Logger, StreamHandler from typing import Iterable, Optional from supar.utils.parallel import is_master from tqdm import tqdm def get_logger(name: Optional[str] = None) -> Logger: logger = logging.getLogger(name...
08d97303d555462f0f8498530b35d6ad51ce99d123421a8cb63b6125dabce9c0
Python
2,808
113
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Nov 2 09:59:40 2021 @author: leupinv """ import os import platform platform.system() # define starting datafolder if platform.system()=='Darwin': #os.chdir('/Users/leupinv/switchdrive/BBC/WP1/data/EEG/tsk/') os.chdir('/Volumes/BBC/BBC/WP1/...
90e786d24d226e6f4528ca298024efb095c5ea604a6bc348f7fcc6701c545fda
Python
2,808
38
"""This is an example to show how to interact with GhostInMesh offline""" from os import path from eworm.ghost_in_mesh_sim.pre_interaction import * if __name__ == "__main__": # data_path = path.join(path.dirname(__file__), "output", "find_circuit", # "11-01-1928_active_0.1_1.0_0.000010_0....
ccfb293729c694edfde597865fc3c84121efb5707cdaa47e043fca498b8a7ca3
Python
2,808
113
import matplotlib import numpy as np matplotlib.use("agg") import matplotlib.pyplot as plt from meep.materials import SiO2 import meep as mp resolution = 100 # pixels/um dpml = 1.0 pml_layers = [mp.PML(thickness=dpml)] r = 1.0 # radius of cylinder dair = 2.0 # air padding thickness s = 2 * (dpml + dair + r) ce...
7637b9157ac16aa36a2423342fccd86ecd387c5a21cc595fcfa420ded6c94690
Python
2,809
72
import torch import torch.nn.functional as F from torch.nn import Parameter from net.brainmsgpassing import MyMessagePassing from torch_geometric.utils import add_remaining_self_loops,softmax from torch_geometric.typing import (OptTensor) from net.inits import uniform class MyNNConv(MyMessagePassing): def __ini...
d3bb501f558672131b92f6fd0b39968f47f3eb4e5b6195c4f3d2f8ba802b1790
Python
2,809
30
"""POST HOC confirmation of AL_FIX on Shiu's exact v630 matrix: S vs F4-like (every AL LN inhibitory except bench acetylcholine) vs K_LN+ (excitatory AL LNs silenced). Only AL LNs whose root id is unchanged v630->v783 can be typed (306 of 429); the other 123 keep Shiu's sign, so this is a partial fix. Output 06-OUTPUT/...
d8dd118e87d685e9421a8f94a65d0aeab0e89aad7a0f13d63f8696b32bfad1ef
Python
2,809
79
## # \file residual_evaluator_test.py # \brief Test ResidualEvaluator class # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date November 2017 import os import unittest import numpy as np import re import SimpleITK as sitk import pysitk.python_helper as ph import niftymic.base.stack as st import nifty...
48b3e762b39ec083e603e3a059d79d4b200424f1895f72d74bed3fbb7dc49314
Python
2,811
78
from unittest import TestCase from codex.utils.parsing import tokenize, extract_links class Test(TestCase): def test_tokenize(self): self.assertEqual(["1", "2", "3"], tokenize("'1', '2', '3'")) self.assertEqual(["hello", "world"], tokenize("hello world'")) self.assertEqual(["who's", "home...
c8f28d2d9ed3533d500dc70bbcb44411513c67663e2826087e006943701dae1c
Python
2,811
72
"""A single event process with starting and ending times.""" from hed.errors.exceptions import HedFileError from hed.models.hed_group import HedGroup from hed.models.model_constants import DefTagNames class TemporalEvent: """A single event process with starting and ending times. Note: the contents have the...
2673d6acceaa4a64bff6363704ec2ba447a844cd5e4fbab09a17cd552d132cdf
Python
2,812
82
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
f26d3c51be78f741f88d0e8b617bc5cac1ad80aa0ab0751ddb31ff8bcfd39d5c
Python
2,812
82
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is mozilla.org code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights Reserved. # # Con...
2c756e2471a5f6f131c87d2575640a6514dacaa5a398be12196dad4eaee0111d
Python
2,813
106
from __future__ import annotations from pathlib import Path import numpy as np import pytest from ase.atoms import Atoms from ase.build import bulk, molecule from ase.calculators.emt import EMT from ase.io import read from numpy.testing import assert_allclose from quacc.atoms.core import ( check_is_metal, ge...
8640dd03dc4e094d86a249135c253ea2a4a2fb7dd1a120c92c0bbf56e971ad24
Python
2,813
85
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np class ConvBlock(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, pool_size, dropout): super().__init__() self.conv = nn.Conv1d(in_channels=in_channels, out_channels=out_channels, kernel_size...
13a9536e18d3081fedd559075c1f982ed5afbe57ff187841a51278879c02b0be
Python
2,814
67
"""Main module for training the translation model to learn extracting CDDDs""" import os import sys import argparse import json import tensorflow as tf from cddd.model_helper import build_models from cddd.evaluation import eval_reconstruct, parallel_eval_qsar from cddd.hyperparameters import add_arguments, crea...
315cfec0ad068d5ace37255c737ace2151aadafb0cd67618b53b4fad5ac39fba
Python
2,815
89
import click import pandas as pd import json import numpy as np from collections import OrderedDict from prediction import max_value, weighted_mean transformation = { "maxvalue" : max_value, "weightedmean" : weighted_mean } # options @click.command() @click.option('--predicted', 'pre...
c4b65c4d9f47ff2d0e850fddd5f7aff0c36632fcc9b61be6a4fd3299e123c9a9
Python
2,815
83
# flake8: noqa # There's no way to ignore "F401 '...' imported but unused" warnings in this # module, but to preserve other warnings. So, don't check this module at all. # Copyright 2020 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use thi...
533c6dfd80f5848bc1d405b99b1b7a215721b791bbd7602d32a768e7550c8664
Python
2,816
79
"""Primary application entrypoint. """ import locale import logging import os import sys import warnings from typing import List, Optional from pip._internal.cli.autocompletion import autocomplete from pip._internal.cli.main_parser import parse_command from pip._internal.commands import create_command from pip._intern...