sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a7db9aba1a22c23eddc4463ed14d6cad80a22c696677919459f2114336421cef
Python
409
16
''' Python Client for MyGene.Info services ''' # import alwayslist helper function here in case users # still use "from mygene import alwayslist" from biothings_client import alwayslist, get_client __version__ = '3.2.2' class MyGeneInfo(get_client('gene', instance=False)): def __init__(self): super(MyGe...
ef8af766dada7156f5f6bda1bd05fa7315b8cba0b86ad6bb3d16e3c8f5150a1c
Python
409
6
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['alexnet_no_specular_iteration=4'] = lambda: ModelCommitment(identifier='alexnet_no_specular_iteration=4', activations_model=get_model('...
1d4e71070224af05637de1d266879d15725a981ef462cb867b1142aaef256ca1
Python
410
19
import pandas as pd split = pd.read_csv('/data2/whr/czl/TwiBot22-baselines/datasets/cresci-2015/split.csv') user = pd.read_csv('./user_feature.csv') user_list = list(user['id']) del_list = [] for i,r in split.iterrows(): if r[0] not in user_list: del_list.append(i) print(len(del_list)) split.drop(inde...
510ab66bafc3dfa59effebc87c556ddbbdbf2deecbe810b6c25e1e572a5698d1
Python
410
13
from avpenet.data.audio_preprocessing import AudioPreprocessor, AudioAugmenter from avpenet.data.visual_preprocessing import VisualPreprocessor, VisualAugmenter from avpenet.data.dataset import PainDataset, build_dataloader, mixup_batch __all__ = [ "AudioPreprocessor", "AudioAugmenter", "VisualPreprocessor...
c3734867d4628e293b12770a5d6b93e4812bdf0969c483229683115850713570
Python
410
9
from PUMI.utils import rpn_model import numpy as np clf = rpn_model(file='../data_in/rpn_model.json') # Load scikit-learn model np.random.seed(42) # Set seed for random number generator for reproducibility X = np.random.rand(7503, 7503) # Generate random matrix of size 7503x7503 output = clf.predict(X) # Let the ...
c64e71d08141d20c970c18ba0a707855e71ec3aa676220dd05bd63972806e634
Python
410
19
import pandas as pd split = pd.read_csv('/data2/whr/czl/TwiBot22-baselines/datasets/cresci-2017/split.csv') user = pd.read_csv('./user_feature.csv') user_list = list(user['id']) del_list = [] for i,r in split.iterrows(): if r[0] not in user_list: del_list.append(i) print(len(del_list)) split.drop(inde...
105a49bd7ee4b12e5f2cfb02a45cf63df0018bbdd4fb871acf89166130f65522
Python
411
9
from brainscore_vision import load_model def test_load_model(): model = load_model('jem_imagenet_p0p9_s1') assert model.identifier == 'jem_imagenet_p0p9_s1' # Brain-Score reads 'logits' from the last registered leaf module: it must be the 1000-way classifier activations_model = model.activations_model...
3fc4f51f8c769f7bb4726423ca5dc5675328d4e7a2a8fbc668a6eb8e81b57c33
Python
411
9
from brainscore_vision import load_model def test_load_model(): model = load_model('jem_imagenet_p0p1_s1') assert model.identifier == 'jem_imagenet_p0p1_s1' # Brain-Score reads 'logits' from the last registered leaf module: it must be the 1000-way classifier activations_model = model.activations_model...
44f5b2747764c6fac8551072e29b401273bf4a2b5b70a670ab78ae38db089216
Python
411
9
from brainscore_vision import load_model def test_load_model(): model = load_model('jem_imagenet_p0p3_s1') assert model.identifier == 'jem_imagenet_p0p3_s1' # Brain-Score reads 'logits' from the last registered leaf module: it must be the 1000-way classifier activations_model = model.activations_model...
4b6a3336c7c39dd14fd426f7c338f1c90879ffb06f40f02e99c98c9980b88c58
Python
411
19
import pandas as pd split = pd.read_csv('/data2/whr/czl/TwiBot22-baselines/datasets/midterm-2018/split.csv') user = pd.read_csv('./user_feature.csv') user_list = list(user['id']) del_list = [] for i,r in split.iterrows(): if r[0] not in user_list: del_list.append(i) print(len(del_list)) split.drop(ind...
777e6bf7bac924bb4eca2b2ca26c72fa9fb889dd75c7ae192baa1daa2a833f6b
Python
411
9
from brainscore_vision import load_model def test_load_model(): model = load_model('jem_imagenet_p0p8_s1') assert model.identifier == 'jem_imagenet_p0p8_s1' # Brain-Score reads 'logits' from the last registered leaf module: it must be the 1000-way classifier activations_model = model.activations_model...
d4627224e9c0a6831d819d58785ff187c361d5bb1d578dbd7813b7f10bae59b9
Python
411
9
from brainscore_vision import load_model def test_load_model(): model = load_model('jem_imagenet_p0p5_s1') assert model.identifier == 'jem_imagenet_p0p5_s1' # Brain-Score reads 'logits' from the last registered leaf module: it must be the 1000-way classifier activations_model = model.activations_model...
ef5baaf69e55533881be7c90657e1e8ae1185d096ceae77aa6fcebcf1eafcf58
Python
411
9
from brainscore_vision import load_model def test_load_model(): model = load_model('jem_imagenet_p0p0_s1') assert model.identifier == 'jem_imagenet_p0p0_s1' # Brain-Score reads 'logits' from the last registered leaf module: it must be the 1000-way classifier activations_model = model.activations_model...
82b09f2abba4121fa3156ae0bb2743c4d98fd65e66f8f7c24debcfa71c841dde
Python
412
16
import numpy as np from brainscore_core import Metric from brainscore_vision.metrics import Score class Accuracy(Metric): def __call__(self, source, target) -> Score: values = source == target center = np.mean(values) error = np.std(values) score = Score(center) score.att...
167e6aace995cd277e29cf4cd47e84604ed56d38d56ffd606f38e8ab8bae84e5
Python
413
17
from .schnet import RANGESchNet, StandardRANGESchNet from .painn import RANGEPaiNN, StandardRANGEPaiNN from .so3krates import RANGESo3krates, StandardRANGESo3krates from .mace import RANGEMACE, StandardRANGEMACE __all__ = [ "RANGESchNet", "RANGEPaiNN", "RANGESo3krates", "RANGEMACE", "StandardRANG...
202c17eceedc60d3ccdb6d52b5daca2f95a3a9b6376a6df7b799cb3a9ef2c0fd
Python
413
5
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['Hojin_Jang_ResNet50_Strong_blur'] = lambda: ModelCommitment(identifier='Hojin_Jang_ResNet50_Strong_blur', activations_model=get_mode...
67e288686cab43c6d182132d85da29cd0a23032454ebf1d4fafed99508d08cad
Python
413
19
#!/usr/bin/env python3 # coding: utf-8 import json import nrn_validation as V V.override_defaults_from_args() # dendrite geometry: all 100 µm long, 1 µm diameter. geom = [(0, 1), (200, 1)] model = V.VModel() model.add_soma(12.6157) model.add_dendrite("dend", geom) model.add_iclamp(5, 80, 0.3, to="dend") data = V.r...
98b952a5a49425874c754249d8da1898f34423d9f77445c78548005e19c4a3b6
Python
413
25
#!/usr/bin/env python """ Read a MAF from standard input and print the fraction of gap columns in each block. usage: %prog < maf > out """ import sys import bx.align.maf def main(): for m in bx.align.maf.Reader(sys.stdin): gaps = 0 for col in m.column_iter(): if "-" in col: ...
996c96e458cff694691d40fba279170e902445ffb834c91f07d98957d7a6fd1b
Python
413
6
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['alexnet_no_variation_iteration=4'] = lambda: ModelCommitment(identifier='alexnet_no_variation_iteration=4', activations_model=get_model...
b75d7809b92b9a2aa45da6afc7983b38ee7674b764b5ff94fff07942a60842f2
Python
413
21
import warnings from typing import Literal import torch_geometric def warn(message: str) -> None: if torch_geometric.is_compiling(): return warnings.warn(message) def filterwarnings( action: Literal['default', 'error', 'ignore', 'always', 'module', 'once'], message: str, ) -> None: if ...
26856d40ea80ae40bf84ee01f157092807c8c883d2445d592a67e073019c89d3
Python
414
18
# Generated by Django 4.2.15 on 2024-12-29 19:08 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("quality_control", "0005_qualitysettings_match_empty"), ] operations = [ migrations.RenameField( model_name="qualitysettings", ...
2ea7b913fd58ca9b8cf4e03dd04c72805570e0e3140f1d93b8e50c3f02cdf676
Python
414
12
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # from .sam import Sam from .sam_model import Sam from .image_encoder import ImageEncoderViT from .mask_decoder import Mas...
52733e1966466f5bc0a0897d0eda58e5aa0d0b9d533e27008b53dc63b62fb275
Python
414
13
from analognas.search_spaces import config_space from analognas.evaluators import XGBoostEvaluator from analognas.search_algorithms import EAOptimizer, Worker CS = config_space('CIFAR-10') surrogate = XGBoostEvaluator(model_type="XGBRanker", load_weight=True) optimizer = EAOptimizer() worker = Worker(CS, eval=surrog...
5fbc0a513c6af69f608238808efddca08387deaf8bd356fe98df00d17b3158ea
Python
414
26
# -*- coding: utf-8 -*- """TODO""" class SyncBuffer: """TODO""" def __init__(self, mpicomm): """TODO""" self._mpicomm = mpicomm def sync(self): """TODO""" pass def push(self, delay, size): """TODO""" pass def pop(self, delay, size): """TO...
c7e25840caba0e3fe9ac903eed784a26becd0948196613cf804c71bf118c4515
Python
414
13
""" get data from different dataloader """ import importlib def get_data(args): loader_name = args['dataloader']['loader_name'].lower() # _, data_name = path.rsplit('/', maxsplit=1) module = importlib.import_module('dataloader.' + loader_name) data_loader = getattr(module, 'get_data_loader') train...
38dac17f4f8a8f112124502fae7c63a012bfc0722e14cf2e364b77ac24d3c63f
Python
415
12
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from allauth.account.adapter import DefaultAccountAdapter from django.conf import settings from django.http import HttpResponseRedirect class DefaultAccountAdapterEx(DefaultAccountAdapter): def respond_email_verification_sent(self, request, use...
451cff9984a5e5e57cf874d13683bf3e9c806b21dd4a491cb63edc26bffe22ea
Python
415
14
default_dict = { "model": "Model", "agegroup": "AgeGroup", "emptystring": "", "simulation": "Simulation", "flowmodel": "FlowModel", "compartmentalmodel": "CompartmentaModel", "modelfile": "model.h", "infectionstatefile": "infection_state.h", "parameterspacefile": "parameter_space.h",...
dd94552f5b1ce482102cf5b61ab0fafa5178fe756748ba3b4815b8adf68e30b0
Python
415
20
""" Utilities used for unit tests """ import numpy as np def return_na_check(data): """Helper function for tests to check if the data returned is a numpy array and that the imputed data has no NaN's. Parameters ---------- data: numpy.ndarray Data to impute. Returns -------...
76f71da17289de5f205402882678595f94f4a52c1b6bf0c8eb2341254d69ea77
Python
416
14
""" get data from different dataloader """ import importlib def get_data(args): # 大写变小写 path = args['dataloader']['path'].lower() _, data_name = path.rsplit('/', maxsplit=1) module = importlib.import_module('dataloader.'+data_name) data_loader = getattr(module, 'get_data_loader') train_loader,...
91a0349877e64de613191d3a415600805a5d1d4dff36962048d64b99fd6611e3
Python
417
22
from __future__ import print_function import sys,time import sys sys.path.append("../../") import jieba import jieba.posseg as pseg jieba.enable_parallel(4) url = sys.argv[1] content = open(url,"rb").read() t1 = time.time() words = list(pseg.cut(content)) t2 = time.time() tm_cost = t2-t1 log_f = open("1.log","w") l...
da9bbb4e973a8ce0e9d12df202eb470970a340703b3b2ddd1c83d7b3569dc923
Python
417
15
import scipy def integrate_from_min_lag_index(target, x_axis, index=0): """ Integrate the jacobian from the minimum lag index to the end of the lags. """ return scipy.integrate.simpson(target[..., index:], x=x_axis[index:], axis=-1) def map_col(x, index, block_size=1000): if x.startswith("g1"): ...
df035c2611d9e5718a16e257d31208eee61da55a861517948069d7f48b5bc665
Python
417
5
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['Zejin_Lu_dvd_s_imagenet_resnet50'] = lambda: ModelCommitment(identifier='Zejin_Lu_dvd_s_imagenet_resnet50', activations_model=get_mo...
f503be5cb7a8e2a6a0b057bac7ba13444219040fc8cd1657e077f66878b44596
Python
417
5
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['Zejin_Lu_dvd_p_imagenet_resnet50'] = lambda: ModelCommitment(identifier='Zejin_Lu_dvd_p_imagenet_resnet50', activations_model=get_mo...
fd41fbdbd9a345e66a2bf73e8fb62bd7f1b7f74f5ceda07b09849c8c946b9d39
Python
417
5
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['Zejin_Lu_dvd_b_imagenet_resnet50'] = lambda: ModelCommitment(identifier='Zejin_Lu_dvd_b_imagenet_resnet50', activations_model=get_mo...
009e50c957cfffc60d53a41004e2848dac97de92e8aa41d52d6479437717faa1
Python
418
19
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, roc_auc_score metrics = { "Acc": accuracy_score, "Pre": precision_score, "Rec": recall_score, "MiF": f1_score, "AUC": roc_auc_score, # "Auc": } def evaluate_on_all_metrics(y_true, y_pred): ret = {} f...
4119bcb51098e6aa72966a2a8c99f2bea530fa7c11776741c8c5b51a3b892f19
Python
419
18
# Copyright (c) OpenMMLab. All rights reserved. def add_prefix(inputs, prefix): """Add prefix for dict. Args: inputs (dict): The input dict with str keys. prefix (str): The prefix to add. Returns: dict: The dict with keys updated with ``prefix``. """ outputs = dict() ...
6f9d091c722036a33eac2ae767eea2a5fdf940c6f47a5710f9b044a64067f252
Python
419
12
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from .sam import Sam from .image_encoder import ImageEncoderViT from .mask_decoder import MaskDecoder from .prompt_encoder...
9a1af58a7d90b635856127db08c02d706f53c3ca8bec717906f9576d5ab7abdc
Python
419
10
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['evresnet_50_4_no_mapping'] = lambda: ModelCommitment( identifier='evresnet_50_4_no_mapping', activations_model=get_model('evresn...
f34fa024931cf42a1198af2dcfdd3654f5cd9c142fa82c53e99537c8fe96c313
Python
419
18
# Generated by Django 3.2.12 on 2022-03-14 10:51 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("engine", "0051_auto_20220220_1824"), ] operations = [ migrations.AlterField( model_name="cloudstorage", name="speci...
fe0d3d63bcc44c4545abd114042b5bee6653df2ff06d16702e96b3015f1a3375
Python
419
25
'''Zennit top-level __init__.''' from . import attribution from . import canonizers from . import cmap from . import composites from . import core from . import image from . import layer from . import rules from . import torchvision from . import types __all__ = [ 'attribution', 'canonizers', 'cmap', ...
6659178dabfe904dda1d217358f76a9cb7ba160cf3b86bd32ae0e48ced19c4be
Python
420
11
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from hydra import initialize_config_module from hydra.core.global_hydra import GlobalHydra if not GlobalHydra.instance()....
b6fc445dec30a7a8e0cba1c7a99467c583e05703420be47c67cd3959adf48be6
Python
420
17
# Generated by Django 4.2.6 on 2024-01-09 09:55 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("engine", "0077_auto_20231121_1952"), ] operations = [ migrations.AlterField( model_name="cloudstorage", name="credent...
bd2a35beeb9e048d1d322d7b55f0a1731ffd225f77cf70745d798d8acfc773ba
Python
420
10
from .doubly_robust import AIPW, PropensityFeatureStandardization, WeightedStandardization from .ipw import IPW from .overlap_weights import OverlapWeights from .standardization import Standardization, StratifiedStandardization from .marginal_outcome import MarginalOutcomeEstimator from .matching import Matching, Prope...
5ab55e4f9bf302fb1fc2b501ce6504b65df3e0f12c6fa6e1d89be7df81d677e5
Python
421
6
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['alexnet_less_variation_iteration=1'] = lambda: ModelCommitment(identifier='alexnet_less_variation_iteration=1', activations_model=get_m...
bb243bae4fcd5b49f194efcedb720050dd89f3d721b85cf18dbdfe89332fa6f5
Python
421
21
"""# Input values dialog A basic example of a user input dialog. This will pause code execution until the user responds. # ![Values input dialog](../../images/values_input.png){ width=50% } ```python linenums="1" from magicgui.widgets import request_values vals = request_values( age=int, name={"annotation"...
c4397f50519ea2cf31940895dd9363e6e31ee921af55e861e29eb52155a4742a
Python
421
6
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['alexnet_less_variation_iteration=2'] = lambda: ModelCommitment(identifier='alexnet_less_variation_iteration=2', activations_model=get_m...
d350103191b53c48af96ea960fbae22c6d9b2616ed260d7960a18016088d544a
Python
421
6
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['alexnet_less_variation_iteration=4'] = lambda: ModelCommitment(identifier='alexnet_less_variation_iteration=4', activations_model=get_m...
e0bc3c44438c37e32c41162bd904c3c8c95f40e1ae8d32c72552ac24152dabc5
Python
421
9
import os import numpy as np working_dir = os.path.abspath(os.path.dirname(__file__)) dirs30 = np.genfromtxt(os.path.join(working_dir, "dirs30.csv"), delimiter=",") dirs256 = np.genfromtxt(os.path.join(working_dir, "dirs256.csv"), delimiter=",") dirs10000 = np.genfromtxt(os.path.join(working_dir, "dirs10000.csv"), de...
7038d930ece09c27ae536b96600af8f829c1996dcf133e4f6d6039cea940226e
Python
422
13
import subprocess import shlex import numpy as np ref_reflectances = list(np.round(np.array([0.2, 0.4, 0.6]), 1)) test_reflectances = list(np.array([0.05,0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])) command = 'blender --background --python render_testset.py --python-use-system-env ' \ f'-- --filename tes...
301cd3df501e775d41c798a4b9bbd1bdfbcd9afb8d7efafec4fe114a4b3c42c7
Python
423
17
#!/usr/bin/env python """ This is the base class for a HAL functionality. Typically these are provided by a module to other modules that want to use some of the hardware that the module controls. Hazen 04/17 """ from PyQt5 import QtCore class HalFunctionality(QtCore.QObject): """ Base class for a functionali...
51f0b0adf948666723ff069a75eff7a0667c7842b8fd746ec7f02b905c6366d9
Python
423
9
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['convnext_tiny_imagenet1k_HAND'] = lambda: ModelCommitment( identifier='convnext_tiny_imagenet1k_HAND', activations_model=g...
5e2d949e5f6474d0c347672174200dc9b29cdfd4afb4a9e7fb1c3a9b1c9c763e
Python
423
19
# -*- coding: utf-8 -*- """TODO""" from core.spiking_group import NodeDistributionMode, SpikingGroup class McNeuronGroup(SpikingGroup): """TODO""" def __init__(self, n, m, mode=NodeDistributionMode.AUTO): """TODO""" super().__init__(n, mode) if self.evolve_locally: self....
8f5b2200f11e3cd060f80acbbbfd8d5f5d07209a0b6c2684b14763688700701f
Python
423
18
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from django.apps import AppConfig class ConsensusConfig(AppConfig): name = "cvat.apps.consensus" def ready(self) -> None: from cvat.apps.iam.permissions import load_app_iam_rules load_app_iam_rules(self) # Requir...
bff9deae0e42e409e9c064254dfa73f55b51d6ef8b373ce692778df9d9e71e56
Python
423
8
from .propensity_metrics import weighted_roc_auc_error, expected_roc_auc_error from .propensity_metrics import weighted_roc_curve_error, expected_roc_curve_error from .propensity_metrics import ici_error from .weight_metrics import covariate_balancing_error from .weight_metrics import covariate_imbalance_count_error fr...
ce249e8f345e16ecdc3333df49f97362f51ac9b42a7a735e578bb210f97bda1d
Python
423
10
from diffxpy.stats.stats import hypergeom_test from diffxpy.stats.stats import likelihood_ratio_test from diffxpy.stats.stats import wald_test from diffxpy.stats.stats import wald_test_chisq from diffxpy.stats.stats import two_coef_z_test from diffxpy.stats.stats import mann_whitney_u_test from diffxpy.stats.stats impo...
af70c3a952db59148478548caf2bae6687b8c8d7777c6f822dacebf6dbfbaa13
Python
424
15
import torch from .base_distance import BaseDistance class DotProductSimilarity(BaseDistance): def __init__(self, **kwargs): super().__init__(is_inverted=True, **kwargs) assert self.is_inverted def compute_mat(self, query_emb, ref_emb): return torch.matmul(query_emb, ref_emb.t()) ...
ebc73fa1b3a0c3342a907e41eef440b4d3af09e6d254e705cd964a6d4c8d5c09
Python
424
12
import pytest import brainscore_vision @pytest.mark.travis_slow def test_barlow_twins_custom(): model = brainscore_vision.load_model('barlow_twins_custom') assert model.identifier == 'barlow_twins_custom' # AssertionError: No registrations found for resnet18_random # ⚡ master ~/vision python -m brainscore_v...
80677b8822dba314a9303f1507faf85e6b8e83d242cfc63b9c6d49537edf5770
Python
425
16
"""# Self reference magicgui widgets Widgets created with magicgui can reference themselves, and use the widget API. """ from magicgui import magicgui @magicgui(auto_call=True, width={"max": 800, "min": 100}, x={"widget_type": "Slider"}) def function(width=400, x: int = 50): """Example function.""" # the wi...
9a7eeca38ac29dda51d78f759f03b1d8c2a5f5c8f5278bcaf79ca8ad3d41f8c3
Python
425
7
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['hmax'] = lambda: ModelCommitment(identifier='hmax', activations_model=get...
eaae7c6573d425b227bf5453a2651f4c09f198c3c0857306b49a9cedc93a56d4
Python
425
12
import numpy as np yeo7_colors = np.array([[0, 0, 0, 255], [0, 118, 14, 255], [230, 148, 34, 255], [205, 62, 78, 255], [120, 18, 134, 255], [220, 248, 164, 255], [70, 130, 180...
9a3958ba363d513da8a6b835bf65610ed46b3d4ed328e3518422aeb97c5544c2
Python
426
19
#!/usr/bin/env python3 # coding: utf-8 import json import nrn_validation as V V.override_defaults_from_args() # dendrite geometry: 200 µm long, diameter 1 µm to 0.4 µm. geom = [(0, 1.0), (200, 0.4)] model = V.VModel() model.add_soma(12.6157) model.add_dendrite("taper", geom) model.add_iclamp(5, 80, 0.3, to="taper")...
a6c9722562d5b46f19746b3326f142c5d9637e2bf6918d357807a7eceb728066
Python
426
8
# median ca_conc in the mitochondria for a sim, control and lemt1 ca_freq_concs = {1: [0.6889664920152534, 1.985134951642442], # 1Hz 2: [1.3935457542367056, 3.9876974385223063], # 2Hz 5: [3.5070601316523886, 10.024326115413015], # 5Hz 10: [7.009985908144186, 20.00345...
9b3b7646055590027f8f5960c2c5ab65c00249bd0c23721a9fa82ffd0ad58206
Python
427
17
#!/usr/bin/env python3 # This script is included in documentation. Adapt line numbers if touched. import glob import pandas import seaborn results = glob.glob("result_mpi_*.csv") df_list = [] for result in results: df_list.append(pandas.read_csv(result)) df = pandas.concat(df_list, ignore_index=True) seaborn.re...
c8d8eb649610b2d51f138481a89617a3dcb61106465121dcb1c2f23affc84c30
Python
427
15
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from .build_sam import ( build_sam, build_sam_vit_h, build_sam_vit_l, build_sam_vit_b, sam_model_regis...
f2ea1d13ef6d0a8e169bade9b49ed0c87860a42cc8f4db358c8724585910236d
Python
427
14
# myelinfccoupling/__init__.py """ Python companion library for the Myelin–FC coupling analysis. Core modules: - config: configuration / options - io: loading edges/nodes tables - model: regression + dominance analysis (global, rsn_pairs, nodewise) - binning: myelin-binned modeling and FC–predictor correlations ...
488ebb27a5606658b805928308f1de5ad91041c23d6116be128039e51f5ed371
Python
428
19
import tensorflow_probability import antspynet import ants t1 = ants.image_read("t1name_here.nii.gz") t2 = ants.image_read("t2name_here.nii.gz") t1t2 = list() t1t2.append(t1) t1t2.append(t2) t1t2_probability_mask = antspynet.brain_extraction(t1t2, modality='t1t2infant', verbose=True) t1t2_mask = ants.threshold_im...
ccbed57e0a9016f5f5d1f766ce89b0e5532eafabc0649e9afbdfd002aa8de9f9
Python
429
12
import unittest import base class Test(base.BaseScriptTest, unittest.TestCase): command_line = "./scripts/out_to_chain.py ./test_data/epo_tests/epo_547_hs_mm_12way_mammals_65.out --chrsizes ./test_data/epo_tests/hg19.chrom.sizes ./test_data/epo_tests/mm9.chrom.sizes" output_stdout = base.TestFile(filename="....
dcaada1cbcbde4fc541ab3e69354fd0df8d7ac997876096fce15e0501e227e50
Python
429
18
from ._version import get_versions from .matlab import import_matlab_result from .structures import PLSInputs, PLSResults from .types import behavioral_pls, meancentered_pls, pls_regression __version__ = get_versions()["version"] del get_versions __all__ = [ "__version__", "behavioral_pls", "meancentered_...
bfa34b7fc0006e3ba75828e1337e4a03cfc82860c59df45b19512348c8fcaef1
Python
430
18
# Generated by Django 4.2.15 on 2024-11-05 14:22 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("quality_control", "0004_qualitysettings_point_size_base"), ] operations = [ migrations.AddField( model_name="qualitysettings", ...
fee544d2f7d19b838eddaecca93b6850c1bade31e8c4707d0edfb4ef39f4f5a9
Python
430
17
from setuptools import setup, find_packages setup( name='Energy_Landscape_Analysis', version='0.0.1', packages=find_packages(), install_requires=[ #Installed automatically : https://packaging.python.org/ja/latest/discussions/install-requires-vs-requirements/ "numpy", "matplotlib", ...
50e07174b8dfcf232da350519c38d48937e3b12cf4f2454636d95e47b2b1a2df
Python
431
19
from typing import Literal from argclz import argument from .cli_model import ModelOptions __all__ = [ 'BEHAVIOR_COVARIANT', 'GLMOptions' ] BEHAVIOR_COVARIANT = Literal['pos', 'speed', 'lick_rate', 'acceleration'] class GLMOptions(ModelOptions): var_type: BEHAVIOR_COVARIANT = argument( '-V', '-...
d645a44c848d31527c352399a64ecbe9c645313ee2785a50034bcf7c5ea31181
Python
432
14
# Copyright (C) 2021-2022 Intel Corporation # # SPDX-License-Identifier: MIT from rest_framework.routers import DefaultRouter from .views import InvitationViewSet, MembershipViewSet, OrganizationViewSet router = DefaultRouter(trailing_slash=False) router.register("organizations", OrganizationViewSet) router.register...
93d24a5fd090d578c2bf5565b96ea5ec06f6a921f4b297b6f94ec6336b998345
Python
433
13
# If files are moved, data in the db files might have to be updated from pathlib import Path from benedict import benedict folder = "//lebnas1.epfl.ch/microsc125/deep_events/data/original_data/event_data" db_files = list(Path(folder).rglob(r'event_db.yaml')) print(len(db_files)) for file in db_files: db_dict = b...
b8184c73ee448ecafa894d3183070e9a2bef0523ec141cd0e02b0bccb60e4198
Python
433
20
# -*- coding: utf-8 -*- """TODO""" simulation_timestep = 1e-3 simulation_mindelay = 8 simulation_min_distributed_size = 16 # Error codes: # -1: Cannot write/open logger logfile. class SimulationDelayTooSmallException(Exception): """TODO""" def __init__(self, message="Axonal delay can not be shorter than ...
595da1c8f8bcd1e5446d9b1e2e88f32a15732da63979c25f678a3a36fcaaa4bd
Python
434
18
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import numpy as np def is_current_report_data(report_data: object) -> bool: return isinstance(report_data, dict) and "groups" in report_data def array_safe_divide(a: np.ndarray, b: np.ndarray) -> np.ndarray: "Scalar (element-wise) array ...
9bcae38eddb663fc009b2da20ed60134f37edbdea6a1329a5837c166eb05efdd
Python
434
13
#!/usr/local/bin/python3 from pipeline import experiment, pupil import logging import datajoint as dj ## database logging code logging.basicConfig(level=logging.ERROR) logging.getLogger('datajoint.connection').setLevel(logging.DEBUG) if hasattr(dj.connection, 'query_log_max_length'): dj.connection.query_log_max_l...
a30f573d9a4843deacc24acee7bb6c93f1509710baf9384e1680112a86cf88e5
Python
434
14
from neuralib.util.utils import ensure_dir from rscvp.atlas.main_roi_atlas import RoiAtlasOptions from rscvp.util.io import RSCVP_CACHE_DIRECTORY from rscvp.util.util_demo import run_demo class ExampleRun(RoiAtlasOptions): SOURCE_ROOT = ensure_dir(RSCVP_CACHE_DIRECTORY) / 'rscvp_dataset' / 'analysis' / 'hist' ...
309ec5ef10415de83f41fadbdb31f0a8b70af2f72a10665c4b9e367de68b32e0
Python
435
9
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['convnext_tiny_imagenet1k_HAND_PS'] = lambda: ModelCommitment( identifier='convnext_tiny_imagenet1k_HAND_PS', activations_m...
4b96029d71cfc2115c3d3dd7b93e4dc33ca90f816294f991619ca8a9045c0ad9
Python
435
16
#!/usr/bin/env python """ Mad City Labs (voltage controlled) Z stage functionality. Hazen 05/17 """ import storm_control.sc_hardware.baseClasses.voltageZModule as voltageZModule class MCLVoltageZ(voltageZModule.VoltageZ): """ This is a Mad City Labs stage in analog control mode. """ def __init__(sel...
55e9b55ac64df5862e584dd9fb3826f7b16e0c036a727b17ca7ec7768a2e1483
Python
435
20
# Generated by Django 2.1.3 on 2019-02-05 17:08 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("dataset_repo", "0002_auto_20190123_1305"), ] replaces = [("git", "0003_gitdata_lfs")] operations = [ migrations.AddField( m...
6101ca7d113c80079fe1cabe937bb6fc30de608e65ab0aecbf8180a663b0e371
Python
435
18
# Copyright (c) DP Technology. # 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. from . import UnicoreDataset class NumSamplesDataset(UnicoreDataset): def __getitem__(self, index): ...
890b019a84e0d1c6a67307cba670ad29a77008df37b7c789b556ae9fbabc69a1
Python
435
9
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['convnext_tiny_imagenet1k_TA_GELU'] = lambda: ModelCommitment( identifier='convnext_tiny_imagenet1k_TA_GELU', activations_m...
9f17671591538159b1b87f09edf8ede57e134019debe2885d465c87cac460e53
Python
435
13
from dtiplayground.dmri.common.tools.base import ExternalToolWrapper class GreedyAtlas(ExternalToolWrapper): def __init__(self,binary_path= None, **kwargs): super().__init__(binary_path, **kwargs) def compute_deformation_fields(self,xml_file,parsed_file): arguments=[ '-f',xml_file,...
b62c888c607bb7f08227c6556b24604fa69bbe750b46ca9861bacbed48184c7e
Python
435
9
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['convnext_tiny_imagenet1k_HANDsum'] = lambda: ModelCommitment( identifier='convnext_tiny_imagenet1k_HANDsum', activations_m...
ddbe88e8b4e529be1471d3b2c02419aecc1288cb35a272e01816fafe79048c00
Python
435
9
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['convnext_tiny_imagenet1k_GELU_PS'] = lambda: ModelCommitment( identifier='convnext_tiny_imagenet1k_GELU_PS', activations_m...
d3f8f7bc5fbf19a78c47f0c842e4ab7e842f90615b067fb3c880f91c0e023234
Python
436
16
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F class PatchMixLoss(nn.Module): """ Refer to models/ast.py for the code of patch mixing """ def __init__(self, criterion): super().__init__() self.criterion = criterion def forward(self, pred, y_a, y_...
6c9459e0b6c3c033f7d8fcd505c9a6453c69eb772f91548c7edcf988555f4f9c
Python
437
22
from scipy import stats import numpy as np from .base import Distribution class Exponential(Distribution): """Exponential Prior. Parameters ---------- beta : scalar or ndarray Scale of distribution. """ def __init__(self, beta): self._beta = np.asarray(beta) self.di...
f137a3fa4139e651af2b676cc9268a30fbd443f3dd40811bef9f445bb921f7bc
Python
437
18
""" nelpy.io ======== This is the nelpy IO module. """ # TODO: add file IO utils such as mkdir, getwd, load, save, glob, etc. # also possibly have examples and support for Jagular # also add hdf5 support, especially for pandas from . import brian, hc3, hc11, hc18, matlab, miniscopy, neo, neuralynx # from . import j...
02fa914c7e9a91e69ecfaed5c0b73e16a0c1063a494c7f922e959694b4ec1190
Python
438
18
# Generated by Django 3.2.15 on 2022-10-11 09:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("webhooks", "0002_alter_webhookdelivery_status_code"), ] operations = [ migrations.AlterField( model_name="webhookdelivery", ...
2916fac1d491cc58f8cdc9d579a412b4ab90fa9f9672c736c43932c1bcd75e03
Python
439
17
# Generated by Django 4.2.1 on 2023-07-26 11:22 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("engine", "0074_alter_labeledimage_source_alter_labeledshape_source_and_more"), ] operations = [ migrations.AddField( model_name="...
6fba82c2ee7e36b3602926ab7c4c31929b1cd55490a50dc069ea092fb2f32b0b
Python
439
31
#!/bin/env python import numpy as np import sys inp = sys.argv[1] lines = np.loadtxt(inp,dtype=int,usecols=(0,4),unpack=False) nstates = np.max(lines[:,1])+1 index = [] for s in range(nstates): index.append([]) for line in lines: iframe, st = line index[st].append(iframe) i = 0 for idx in index: print "...
3ec000144676467ce752e33c7740330dadae9d878f9108e0edc923dee650ca3c
Python
440
18
import requests def send_request(url: str, payload: list[dict]) -> list[dict]: response = requests.post(url, json=payload) response.raise_for_status() return response.json() payload = [ { "text_output": "### Instruction: Write a short story about a robot " "learning to feel emotions....
5ac8677cd91a2c3098dd4d90086873cb5c8d6631f12da22d9e58ea8b590017e3
Python
440
5
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['deit3_base_patch16_224_fb_in22k_ft_in1k'] = lambda: ModelCommitment(identifier='deit3_base_patch16_224_fb_in22k_ft_in1k', activations_mo...
5b78d1761928bf1e00cbb3e266a95fd9bb34ccac433fa731b9886eafa951f769
Python
441
18
# Generated by Django 4.2.21 on 2025-06-22 11:13 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("engine", "0090_asset_content_size_data_content_size"), ] operations = [ migrations.AddField( model_name="profile", ...
8d1c2177cfc385cf22ce67d3007fddb0bc9801b6526c224aadb82224fa06d9aa
Python
441
12
from sklearn.metrics import accuracy_score, roc_auc_score, f1_score, precision_score, recall_score def metrics(y: list, pred: list): print("ACC: {}".format(accuracy_score(y, pred))) print("ROC: {}".format(roc_auc_score(y, pred))) print("F1: {}".format(f1_score(y, pred))) print("Precision: {}".format...
f2f7ff36cb84df4bbb278d90aae0d11f2b51e56965d09261d632c0fdc383381f
Python
441
9
import os import ClearMap.Settings as settings filename = os.path.join(settings.ClearMapPath, 'Test/Data/ImageAnalysis/cfos-substack.tif'); import ClearMap.Visualization.Plot as plt import ClearMap.IO as io data = io.readData(filename, z = (0,26)); import ClearMap.ImageProcessing.BackgroundRemoval as bgr dataBGR = bgr....
f93a1fe13543266d5054a0d8844194e3969432e00699ba0c9685bb5b95be8b8e
Python
441
11
""" Label preprocessing script Converts raw labels to binary classification labels """ import pandas as pd df = pd.read_csv('labels_raw.csv') # Column name: '癫痫控制标签(1有0无)' means 'Epilepsy Control Label (1=yes, 0=no)' # Convert: 2 -> 1 (epilepsy), others -> 0 (no epilepsy) df['label'] = df['癫痫控制标签(1有0无)'].appl...
faba47a6b5a15faaf945fbab1432265895f445e7d56920b5d3573d6649b41c7e
Python
441
15
#!/usr/bin/env python3 import sys,re out=[] in_block=False for line in sys.stdin: # The replacement of name: has to be done only in figure and container blocks if line.startswith(".. figure::") or line.startswith(".. container::"): in_block=True elif line.strip()=="": in_block=False if ...
026f68eee3c44d93e8d62268108ddae507825939259607d28c6467b8bac22df5
Python
442
19
import requests def send_request(url: str, payload: list[dict]) -> list[dict]: response = requests.post(url, json=payload) response.raise_for_status() return response.json() payload = [ { "power_input": "19 3 10 11 14 3 3 4 4 9 39 27 12 5 20 20 38 39 41 61 " "52 31 43 31", "p...
259ec86d2a5e6f7d338b4f248584a4ad249906a9701637e8e09970572a8f89b4
Python
442
23
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from .caching import UpdatePolicy from .common import ( FrameAnnotations, MediaDownloadPolicy, MediaElement, Sample, UnsupportedDatasetError, ) from .task_dataset import TaskDataset __all__ = [ "FrameAnnotations", "MediaD...