sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
716b59aa0356fb521703ab1a9d8167b1f48f94c2e4a3d97c4c3ad529ac77123d
Python
473
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['alexnet_7be5be79'] = lambda: ModelCommitment(identifier='alexnet_7be5be79', ...
737a4e2a70490e374c3a77ecbd6772c95315d479fd98b8cfd837e8637293e7a0
Python
473
17
# Script to copy the saved state from the folder with the newest timestamp # (c) Jannik Luboeinski 2021 import numpy as np from pathlib import Path import shutil import os rawpaths = Path('.') folders = sorted([str(x) for x in rawpaths.iterdir() if x.is_dir() and "_TRIPLET" in str(x)]) latest_folder = folders[len(fol...
dd3a02b8a10f290bb18777023950d2a3e6b78b01d1b06938f46807ef02fc7f9f
Python
473
17
import torch from .base_reducer import BaseReducer class MeanReducer(BaseReducer): def element_reduction(self, losses, *_): return torch.mean(losses) def pos_pair_reduction(self, losses, *args): return self.element_reduction(losses, *args) def neg_pair_reduction(self, losses, *args): ...
1a44cac76817a96ab607d0fa0494fbd8a0aab4940ec02b82cf27c5d477b09d00
Python
474
18
BATCHGLM_OPTIM_GD = False BATCHGLM_OPTIM_ADAM = False BATCHGLM_OPTIM_ADAGRAD = False BATCHGLM_OPTIM_RMSPROP = False BATCHGLM_OPTIM_NEWTON = False BATCHGLM_OPTIM_NEWTON_TR = False BATCHGLM_OPTIM_IRLS = False BATCHGLM_OPTIM_IRLS_GD = False BATCHGLM_OPTIM_IRLS_TR = True BATCHGLM_OPTIM_IRLS_GD_TR = True BATCHGLM_PROVIDE_B...
57858ca086379b64cf1dc3369ea993a9cb3d8339832e76f7bbc227f714924436
Python
474
20
import os import numpy as np import warnings def preprocess_vol(vol): assert vol.ndim == 4, f"Expected 4D image, got {vol.ndim}D" if vol.shape[1] != 4: warnings.warn( f"Expected 4 channels, got {vol.shape[1]} channels. " "This may lead to unexpected behavior." ) # C...
960e8b498183f397f7618b4444c841a22307b354a4dcdf2a1b48c7161fe4a7fd
Python
474
13
import setuptools setuptools.setup( name="biographs", version="0.1", author="Rodrigo Dorantes-Gilardi", author_email="rodgdor@gmail.com", description="A package to work with protein structure networks", url="https://github.com/rodogi/biographs", keywords=["protein contact network", "protein...
80a3b23b6e41b2fcd83557c6d449f09214bb92b79f12c5ecf40684e6a7067591
Python
475
5
"""CoRelAy is a package to compose small-scale (single-machine) analysis pipelines. Pipelines are designed with a number of steps (:py:class:`~corelay.pipeline.base.Task`) with default operations (:py:class:`~corelay.processor.base.Processor`). Any step of the pipeline may then be individually changed by assigning a ne...
9917fb256a889b91f3dcb508c96031dfa5ae452054b3a9bc2a41fa871a6aabb1
Python
475
18
#!/bin/env python import numpy as np import math import sys inp = sys.argv[1] lines = np.loadtxt(inp, dtype=np.float, comments='#', usecols=(0,1,2,3), unpack=False) nlines = len(lines) for i in range(nlines): for j in range(i+1, nlines): x0, y0, z0, d0 = lines[i] x1, y1, z1, d1 = lines[j] # dist = math...
a3fa5ff71e2e2eca8cf853b7c10c4a6f9a433d3d8bcc5ce07b97dab6905c1d06
Python
475
18
# Copyright (c) OpenMMLab. All rights reserved. from mmcv.utils import collect_env as collect_base_env from mmcv.utils import get_git_hash import depth def collect_env(): """Collect the information of the running environments.""" env_info = collect_base_env() env_info['Depth'] = f'{depth.__version__}+{ge...
f6b4ef8985dca7d396132db6fac5e912dc1f93ca884499042cd1cd832c0a2b7a
Python
476
12
from brainsmash.workbench.geo import volume from brainsmash.mapgen.sampled import Sampled import scipy.io as sio coord_file = "voxel_coordinatesageType10NgE.nii.txt" output_dir = "../0~8" filenames = volume(coord_file, output_dir) brain_map = "valueforsp.nii.txt" gen = Sampled(x=brain_map, D=filenames['D'], ...
30f5cde9b3981a0e6642db856c279620a19e2a9a4f69fe65331a4d96ed0a3800
Python
477
13
from generate_features import account import json import numpy as np dataset_name='Twibot-22' #dataset_path='/data2/whr/czl/TwiBot22-baselines/datasets'+'/'+dataset_name files=['train','test'] for file in files: with open(dataset_name+'/' + file + '.json','r') as f: data=json.load(f) acc_mat=account...
822c86a5d60f27ae3fabfc4b8589184702f54ce6a7dc3c893b8f7b5f546e0ec8
Python
477
8
from brainscore_vision import model_registry from .helpers.helpers import CORnetCommitment, _build_time_mappings from .model import get_model, get_layers, TIME_MAPPINGS model_registry['CORnet-S'] = lambda: CORnetCommitment(identifier='CORnet-S', activations_model=get_model('CORnet-S'), ...
d6fd04f229d85f779cb8aad24f5fcefdb47e2e34abeda901b69e6c545081fc4f
Python
477
15
""" A simple subclass of PlotWidget to add a lasagna viewbox in Qt Designer """ from pyqtgraph import PlotWidget from lasagna.lasagna_viewBox import lasagna_viewBox class LasagnaPlotWidget(PlotWidget): def __init__(self, *args, **kwargs): if 'viewBox' not in kwargs.keys(): kwargs['viewBox'] =...
f029d18d75e0dd04a16c2ea37778f9545a11e0a48642c082692b35af46d23008
Python
477
11
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['dinov2_vitl14_reg_lc_featread'] = lambda: ModelCommitment( identifier='dinov2_vitl14_reg_lc_featread', activations_model=get_mod...
196a43062d76da2e7371f24812e19c50227b874cbbd0e6b6ce460ac6b559e514
Python
478
20
from rscvp.spatial.main_slb import PositionLowerBoundOptions from rscvp.util.util_demo import run_demo class ExampleRun(PositionLowerBoundOptions): exp_date = '210315' animal_id = 'YW006' plane_index = 0 neuron_id = 0 session = 'light' shuffle_times = 300 with_heatmap = True signal_typ...
575824940ae9a1b127bbf2a7b72501f0c74332937b767d426dba33cfd520e5f8
Python
479
21
"""Print the free energy of different runs. """ import pickle import numpy as np best_fe = np.inf for i in range(1, 11): try: history = pickle.load(open(f"results/run{i:02d}/model/history.pkl", "rb")) free_energy = history["free_energy"] print(f"run {i}: {free_energy}") if free_en...
ad0a623c1d632f994f80624b9c66beb98bc3118e1284c73fdfad4116c91f0fcf
Python
479
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['efficientnet_b0'] = lambda: ModelCommitment(identifier='efficientnet_b0', ...
c080e6f48e55a64519304496ec9f92011b7df8c1b0538a14bece33913b4e54d5
Python
481
15
from neuralib.util.utils import ensure_dir from rscvp.atlas.main_roi_top_view import RoiTopViewOptions from rscvp.util.io import RSCVP_CACHE_DIRECTORY from rscvp.util.util_demo import run_demo class ExampleRun(RoiTopViewOptions): SOURCE_ROOT = ensure_dir(RSCVP_CACHE_DIRECTORY) / 'rscvp_dataset' / 'analysis' / 'hi...
ffa6883864c168e866126000f562fa8690a890e00e217cce8d0680505cb5d164
Python
481
16
from setuptools import setup, find_packages import pathlib here = pathlib.Path(__file__).parent.resolve() setup( name="bannotator", version="0.1.0", author="Xingjian Zhang", description="A GUI application to annotator animal behavior videos", packages=find_packages(), project_urls={"Source Co...
8622e3fc86d980ab7e94edf29b313d35c6e3eea583124dc9334ca53d7e968a2d
Python
482
20
"""# Directory dialog widget A dialog to select a directory. """ from pathlib import Path from magicgui import magicgui # Select a directory, instead of file(s) @magicgui(directory={"mode": "d", "label": "Choose a directory"}) def directorypicker(directory=Path("~")): """Take a directory name and do something ...
cac90496eb2a5053045c0c11b3cb0006c992a88740e94f9715c42a12ec5d858c
Python
482
6
from mmsdk.mmdatasdk.computational_sequence.computational_sequence import computational_sequence as computational_sequence from mmsdk.mmdatasdk.dataset.dataset import mmdataset as mmdataset from mmsdk.mmdatasdk.dataset.standard_datasets import CMU_MOSEI as cmu_mosei from mmsdk.mmdatasdk.dataset.standard_datasets import...
fb5b5f617071a5bfb2dab601ec7e680f64746f16f011f297211773f1dcd6e492
Python
482
19
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from .bot_sort import BOTSORT from .byte_tracker import BYTETracker from .deep_oc_sort import DeepOCSORT from .fast_tracker import FASTTracker from .oc_sort import OCSORT from .track import register_tracker from .track_tracker import TRACKTRACK __all...
9cb74ad5ccf6d881006f269f9613983971bd5ea0577e6c8f2d5836e06578d460
Python
483
18
#!/usr/bin/env python """ Test getting the stage position. """ from storm_control.test.hal.standardHalTest import halTest def test_hal_gsp_1(): halTest(config_xml = "none_tcp_config.xml", class_name = "GetStagePosition1", test_module = "storm_control.test.hal.tcp_tests") def test_hal_gsp...
44274c75f6d9ea1cca3c02df8b1cd0e7916440106eeaa3fc6d0a340105f91b34
Python
484
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_in1k_gram_aligned_dinov3'] = lambda: ModelCommitment(identifier='deit3_base_patch16_224_fb_in1k_gram_aligned_d...
5aa1b824c017241503f4f37806b5d9e78c3890d55230cdb50d99b3592e1353e1
Python
484
11
"""Vendored numeric helpers for iterative 2D background fitting. Currently holds the 1D per-sector cone-background model used by the step-0 projection pass. Copied from the bg-optimization research repo (``src/bg_removal/gen_bg_fit/fit_sector_var_model.py``); depends only on numpy/scipy so it is self-contained. """ f...
9a5ea4e76a057f5fa5a03b9f1bc09c7ca3cc7ce58ba04864c1d05ca08ea84138
Python
484
13
from self_attention_cv import UNETR import torchinfo if __name__ == '__main__': model = UNETR(img_shape=(32, 256, 256), input_dim=1, output_dim=2, embed_dim=512, patch_size=16, num_heads=10, ext_layers=[3, 6, 9, 12], norm='instance', base_filters=16, ...
a1e4fa8d5117f2aee6c5cc083b3eba2d64551a8b26e9a9f05ca773fa27d3b58c
Python
484
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['convnext_base_fb_in22k_ft_in1k_gram_aligned_dinov3'] = lambda: ModelCommitment(identifier='convnext_base_fb_in22k_ft_in1k_gram_aligned_d...
e16005b2186812049719532406e846e649f563d21db1d36d0bdfd3638f31a9a1
Python
484
17
import argparse import os parser = argparse.ArgumentParser() parser.add_argument('dataset', type=str, help='name of the dataset used for training') args = parser.parse_args() print('running DeeBotPro on '+args.dataset) order="python "+args.dataset+".py" os.system(order) print('process_1 finished') order="python des_em...
e39ffaa52926b4008a0f34e9bffeae34edac3c4c095510755656661ddd49dece
Python
484
24
#!/usr/bin/env python3 """ command line tool to convert voxel coordinates to world coordinates usage: voxel-to-world.py <nifti_file> <x> <y> <z> """ import sys import nibabel as nib if len(sys.argv) != 5: print("Usage: voxel-to-world.py <nifti_file> <x> <y> <z>") sys.exit(1) nifti_file = sys.argv[1] x = in...
0a8114e6e49ffc39a07422aedc03180ecc114db95aae4060c0f9d647dd541d81
Python
485
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['antialias-resnet152'] = lambda: ModelCommitment(identifier='antialias-resnet152', ...
2d77efdfeb252d6d350bba496f16ce072f0bb1539e07845598e2f63973227fb1
Python
485
24
import requests def send_request(url: str, payload: list[dict]): response = requests.post(url, json=payload) return response.json() payload = [ { "flchain": { "age": 65, "sex": "M", "flcgrp": "1", "kappa": 1.5, "lambdaport": 1.2, ...
8462215e5bb1d370076c6d2ca2f9665dd15162cadb8a720cf04ade14d2d5f807
Python
485
12
from .l1_ngc_da_bnac import L1_NGC_DA_bNAC from .l23_pc_cadpyr import L23_PC_cADpyr from .l4_lbc_cacint import L4_LBC_cACint from .l4_lbc_cstut import L4_LBC_cSTUT from .l4_lbc_dnac import L4_LBC_dNAC from .l4_nbc_cacint import L4_NBC_cACint from .l4_nbc_dnac import L4_NBC_dNAC from .l4_sbc_bnac import L4_SBC_bNAC from...
ce3abae88b2035a5e1f90c0bd5a6fa22297ef7fd8af1d066fc2d337163dae2c0
Python
485
23
#!/usr/bin/env python3 import argparse import os import sys import arbor P = argparse.ArgumentParser( description="Verify that a mechanism catalogue can be loaded through Python interface." ) P.add_argument("catname", metavar="FILE", help="path of the catalogue to test.") args = P.parse_args() catname = args.ca...
4c73ab111e3e77e5b4d94ff58600a081bc785c7e82ce834337b8ceea0aa78dff
Python
486
14
import os import subprocess # List of .ui files to convert and merge path_to_ui = os.path.join(os.getcwd(), "bannotator","ui") ui_files = [f for f in os.listdir(path_to_ui) if f.endswith(".ui")] # Convert .ui files to .py files for ui_file in ui_files: py_file_path = os.path.join(path_to_ui,'ui_'+ ui_file.replac...
fb86bcdb6fc29a89c45f66800753f062bc1520f8c169eeee7350aceadefbe1fb
Python
486
8
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['ViT_L_32_imagenet1k'] = lambda: ModelCommitment(identifier='ViT_L_32_imagenet1k', ...
45d6560af775b38ccc2d93501e741d7854cede7c084cb91e5e375eb22f4609e1
Python
487
19
#read_dataset_by_folder.py #reads a dataset from a dataset folder import mmsdk from mmsdk import mmdatasdk import argparse parser = argparse.ArgumentParser(description='Reading dataset from a folder') parser.add_argument('path', metavar='path', type=str, help='the folder path to read dataset fro...
65301dc89a7f214cb4ad4dc88bf1f14fe26e5700e0b1ac1424a5c6a3011bcca2
Python
487
21
import os import subprocess import unittest import pytest SVMTK_test = os.path.abspath( os.path.join(os.path.dirname(__file__), "bin", "SVMTK_test") ) class MainTest(unittest.TestCase): @pytest.mark.skipif(not os.path.exists(SVMTK_test), reason="C++ tests not built") def test_cpp(self): print("\...
9ce11508e49e2390fbaee599153473787eb267f7a1bae07c91d1afd175722bda
Python
487
16
# 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...
9d088b56d292da8e762fe3c2b7f653d98ee6dff78c50373746504b1565191473
Python
487
17
import os import random import numpy as np import torch def setup_seed(seed): """Set random seed for reproducibility across all libraries.""" torch.manual_seed(seed) torch.cuda.manual_seed_all(seed) np.random.seed(seed) random.seed(seed) os.environ['PYTHONHASHSEED'] = str(seed) os.environ[...
b94812281730efe9f0205c48e67852ecea6f05138a6fa9658d32bdc6e9627209
Python
487
13
from brainscore_vision import metric_registry from .metric import ErrorConsistency metric_registry['error_consistency'] = ErrorConsistency BIBTEX = """@article{geirhos2020beyond, title={Beyond accuracy: quantifying trial-by-trial behaviour of CNNs and humans by measuring error consistency}, author={Geirhos, Rober...
cf6647ee9ec4c1838c3307a1c8317b5a348951bc2bff89a2bf1cc9a5fc3a3790
Python
487
19
def unique_keep_order(lst: list): """ Get all unique elements from a list without altering the order in which the elements appear. Note that set() does alter the order, which can cause problems in some parts of the code. Params ------ lst: list with arbitrary data Returns ------- l...
fc5a7def02c8d5cc45148d5094e92f5882b0766b5068f1201fdeca9ad4036682
Python
487
17
from abc import abstractmethod class Reader: def __init__(self): pass @abstractmethod def _filename(self, index, basename=False, absolute=False): pass def filename(self, index, basename=False, absolute=False): return self._filename(index, basename=basename, absolute=absolute)...
1f9d83eea17cc15be2748dc8259a02bcf917650c2cc5a3e0f51fbc4d35ffc9a4
Python
488
21
# coding=utf-8 """ Tests for deepreg/model/backbone/interface.py """ import deepreg.model.backbone as backbone def test_backbone_interface(): """Test the get_config of the interface""" config = dict( image_size=(5, 5, 5), out_channels=3, num_channel_initial=4, out_kernel_initi...
3dc14aeaf0c2062797816aa1ec1d6d30c7d1fbdcd5a821eddecb6527b16d752f
Python
488
23
from mpi4py import MPI world = MPI.COMM_WORLD color = None leader = None if world.rank == 0: color = 0 leader = 1 else: color = 1 leader = 0 group = world.Split(color) inter = group.Create_intercomm(0, world, leader, 42) if __name__ == "__main__": print(f"{world.rank:2d}/{world.size:2d} {group.r...
7d9f67b55dff8b07df8977e64c0c7bd478d6ef340b2be696f14121328851e7dc
Python
488
16
#!/usr/bin/env python """DEPRECATED shim -> `morphometrics pycurv`. This script has moved into the installable `surface_morphometrics` package and is now invoked as `morphometrics pycurv ...`. This thin wrapper forwards to that command and will be removed in a future release. """ import sys from surface_morphometrics...
aee63b80b62a749f33f89eb95ec8feac5bb35367017d9a09a9275839ff4f3a61
Python
488
25
from setuptools import setup, find_packages setup( name='Lasagna', version='0.1', packages=find_packages(), include_package_data=True, install_requires=[ 'pyqt5==5.15.6', 'numpy', 'tifffile', 'pynrrd', 'pyqtgraph', 'pyyaml', 'sip', 'sc...
bb1f827787a7e5c8af000ba1b768e72349ba8e1cef7694aeb763878c587d0fd0
Python
488
23
from scipy import stats import numpy as np from .base import Distribution class HalfNormal(Distribution): """HalfNormal prior. Parameters ---------- sigma : scalar or ndarray Standard deviation of distribution """ def __init__(self, sd): self._sd = np.asarray(sd) ...
eee8c623a81eb25296f9792d8927f23771e8a3d9bbd26d15b38da84ec166236c
Python
488
15
def check_and_add_suffix(filename: str, suffix: str) -> str: """ Adds a suffix to the filename if it doesn't already have it. Parameters: filename (str): The filename to check and potentially modify. suffix (str): The suffix to add to the filename. Returns: str: The filename wi...
13bd7f7018c67f964361cfd7d9646d41ae448ee927a2f147b5f16505362c49e1
Python
489
26
# # A very simple test of Kilroy. # from PyQt5 import QtCore import time import pytestqt import storm_control.sc_library.parameters as params import storm_control.test as test import storm_control.fluidics.kilroy as kilroy def test_kilroy_starts(qtbot): parameters = params.parameters(test.kilroyXmlFilePathAnd...
75e26651172d626f29525f306ecd71e44d0fafdd1432eb252228705f8291a726
Python
489
18
import pandas as pd label = pd.read_csv('/data2/whr/czl/TwiBot22-baselines/datasets/cresci-2017/label.csv') main_user = pd.read_csv('./user_feature.csv') user = main_user.loc[0:len(main_user)-1] user_list = list(user['user_id']) del_list = [] for i,r in label.iterrows(): if r[0] not in user_list: del_li...
7d96d2528446476b5d7afea3fb3e5697c11dbd0b1983775e47c1fdf91a539f56
Python
489
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['mobilenet_v2_1_4_224'] = lambda: ModelCommitment(identifier='mobilenet_v2_1_4_224', ...
9071411a45364894dcda20747f6f0718584653fd1f53fdaf3b7144347c281284
Python
489
18
class Loop: """ Class that stores a single for loop's information. """ def __init__(self, dimension: str, size: int, type: str = "temporal"): """ Initialize the loop with the given dimension string and size. """ self.dimension = dimension self.size = size ...
ddf6c4f8eabc3de79d951ea88cfaa5d4f757a79c102aabfd7adbbe91e821ca03
Python
490
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['mobilenet_v2_1_0_224'] = lambda: ModelCommitment(identifier='mobilenet_v2_1_0_224', ...
ebe707947d464468cb2ff2517fa3c9f633d70b71a3ac03d7200f1ef48204944c
Python
490
14
# 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 .version import version as __version__ # noqa from .data import Alphabet, BatchConverter, FastaBatchedDataset # noqa from .model impor...
beff6e39e4c08400ec221158e91fac4329a68cdd5518f5d0b4803a98c089fbc1
Python
491
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['fixres_resnext101_32x48d_wsl'] = lambda: ModelCommitment(identifier='fixres_resnext101_32x48d_wsl', ...
0e7f61a7a1dd8ed53c3be4d47dc5ab9ba502fb377492a65ecec48840f113ad40
Python
492
19
import nilearn import glob from nilearn.image import threshold_img import nibabel as nb folder = '/Users/sebastiandresbach/data/s1Anfunco/Nifti/derivatives/sub-07/func/statMaps' statMaps = sorted(glob.glob(f'{folder}/sub-07_D*vsAll_VASO.nii.gz')) for i, statMap in enumerate(statMaps, start=2): nii = nb.load(statM...
12d632c78e73590fe201e589fb69ac8d0e5f2d70084b6ed088a3a309327ecdd5
Python
492
19
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from .common import Target from .project_dataset import ProjectVisionDataset from .task_dataset import TaskVisionDataset from .transforms import ( ExtractBoundingBoxes, ExtractInstanceMasks, ExtractSingleLabelIndex, LabeledBoxes, ...
5af7ee3dda90ca98de553652e96d341b91d40c4c9bbf58b6316e244dd289f0b2
Python
492
13
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_model, get_layers model_registry['eicircuit_resnet18_bn_20260919'] = lambda: ModelCommitment( identifier='eicircuit_resnet18_bn_20260919', activations_model=get...
aa4758a74e06ae56c67837be449693d986cf72c179a8eab7a21c6ceffdb63ea4
Python
492
16
#!/usr/bin/env python """DEPRECATED shim -> `morphometrics hist2d`. This script has moved into the installable `surface_morphometrics` package and is now invoked as `morphometrics hist2d ...`. This thin wrapper forwards to that command and will be removed in a future release. """ import sys from surface_morphometrics...
efb059bc8dfc38015655860f7aee7b3fdc2417099253b11d606af0d9c2a49ace
Python
493
25
import pytest try: import fury # noqa: F401 from AFQ.viz.utils import Viz test_viz = True except ImportError: test_viz = False @pytest.mark.skipif( not test_viz, reason="Skipping viz tests, unable to import viz utils" ) def test_viz_name_errors(): Viz("fury") with pytest.raises( ...
f7e72de7013bc43f66240b445254a0b26d2f0adbf5536205d77c877f181794b8
Python
493
14
from dtiplayground.dmri.common.tools.base import ExternalToolWrapper class DTIEstim(ExternalToolWrapper): def __init__(self,binary_path= None, **kwargs): super().__init__(binary_path, **kwargs) def estimate(self,dwi_path, output_path, options=[]): arguments=[] arguments+=['--dwi_image'...
fcfa55a1e1cb61e9705ba953f1748f20cdbc0e9c70ee8f1adcebd19b2b3823b5
Python
493
16
#!/usr/bin/env python """DEPRECATED shim -> `morphometrics stats`. This script has moved into the installable `surface_morphometrics` package and is now invoked as `morphometrics stats ...`. This thin wrapper forwards to that command and will be removed in a future release. """ import sys from surface_morphometrics.c...
93bf17e432b9c45b55f9079b5c3fc36a2c9bf318c75802105393aea1fbf3bfa7
Python
494
11
from brainscore_vision import stimulus_set_registry from brainscore_core.supported_data_standards.brainio.s3 import load_stimulus_set_from_s3 # stimulus set stimulus_set_registry['ImageNetSlim15000'] = lambda: load_stimulus_set_from_s3( identifier="ImageNetSlim15000", bucket="brainscore-storage/brainio-brainsc...
ff341ece8867386564c04d016f915f3ea76d275197558e3f0617cd544cbacc69
Python
494
15
import os import numpy as np # Data from Ahlgren et al 2016 NMRinBiomed Delta = 7.5e-3 # 7.5 ms delta = 7.3e-3 # 7.3 ms # For DDE sequence we have # b = 2y^2G^2d^2(D-d/3), c = 2yGdD => c = sqrt(b 2D^2/(D-d/3)) bval_file = os.path.join(os.path.dirname(__file__),'ballistic.bval') b = np.loadtxt(bval_file) c = np.sqrt(b...
1a39933b71438d4a35909abae27482077ff395a17029365a5ccff52fd60c9cde
Python
495
19
# -*- coding: utf-8 -*- # @Author : LG from .transforms import ResizeLongestSide import numpy as np from typing import Tuple import cv2 class Med2dTransforms(ResizeLongestSide): def apply_image(self, image: np.ndarray): image = cv2.resize(image, (256, 256), interpolation=cv2.INTER_NEAREST) ret...
264667f099d51b3f0aff8da6d1e8feecdda386f615e1d88d8c39d0bae3318f2b
Python
495
16
""" Batch_Location Decoder """ import re import numpy as np from pathlib import Path from LocationDecoder import LocationDecoder FolderLocation = Path(r'D:\Data\Lobster\Lobster_Recording-200319-161008\20JUN1') OutputFileLocation = Path(r'D:\Output') for tank in FolderLocation.glob('#*'): tank_name = re.search('#....
465ece07aff0651854a5932ba3e4ad52265f13396008ab647ba491d4f45bfd89
Python
495
27
# Default predictor settings DEFAULT_KRR_SETTINGS = { "alpha": 1.0, "kernel": "linear", "gamma": "", "degree": 3, "coef0": 1.0, } DEFAULT_MLP_SETTINGS = { "network": { "hidden_layers": [24, 12, 6], "activation_fn": "ReLU", }, "optimization": { "optimizer": "Adam...
57dcdb3cb95086c5a638cb174c5614b46132cc6c99f3126984078ff1ee631992
Python
495
9
from reducers.avg_non_zero_reducer import AvgNonZeroReducer from reducers.base_reducer import BaseReducer from reducers.class_weighted_reducer import ClassWeightedReducer from reducers.divisor_reducer import DivisorReducer from reducers.do_nothing_reducer import DoNothingReducer from reducers.mean_reducer import MeanRe...
9048ad7cd64fc5cd74d91ca43d0025bc564c9ec6c2aaf1ae1c803082930f3238
Python
495
13
import numpy as np # filename = str(baseline_atp) + '_regular_'+str(int(firing_freq))+'Hz_' + str(t_ca[ii]) + '_' + labels[ii] + '.npz' c_reg_fn = '100_regular_20Hz_7_Control.npz' l_reg_fn = '100_regular_20Hz_20_Letm1.npz' c_reg = np.load(c_reg_fn) l_reg = np.load(l_reg_fn) np.savetxt('Control_Ca_20Hz.csv', ...
936bedcd6bd976251663134735535d379dafdaa4d0cb574ae8b82ec50de11cac
Python
495
20
"""# Password login A password login field widget. """ from magicgui import magicgui # note that "password" is a special keyword argument # it will create a password field in the gui by default # (unless you override "widget_type") # whereas "password2" will be a normal text field # (unless you override "widget_typ...
51ccbb3148341540bcfe391d60e59fb132301c34413be8b882dd8cb55a951c1a
Python
496
20
import pyro # type: ignore DEFAULT = dict( num_epochs=5000, optimizer=pyro.optim.ClippedAdam, optimizer_kwargs={"lr": 0.01, "betas": (0.95, 0.999)}, scheduler=None, loss=pyro.infer.TraceMeanField_ELBO, loss_kwargs={"num_particles": 1}, ) TEST = dict( num_epochs=200, optimizer=pyro.op...
70c14f46f04cdc9800896190ad26f0aced73112f3a747eb649018f8e6c7caa90
Python
497
19
import unittest from ogo.cli.ImageExam import ImageExam class Test_ImageExam(unittest.TestCase): def setUp(self) -> None: """ Use this method to prep data or files for other tests, if necessary. """ pass def tearDown(self) -> None: """ Use this method to clean up after the tests, if...
9c33950243f286243ec2f11178cd93f59bb758b5f0df43cd60f0f3643181284b
Python
497
23
from __future__ import absolute_import class AverageMeter(object): """Computes and stores the average and current value""" def __init__(self): self.val = 0 self.avg = 0 self.sum = 0 self.count = 0 def reset(self): self.val = 0 self.avg = 0 self.sum...
9dd3403b196870546f8d3c6618e7a3b4b9c2880c2333ab426be3c725806827e3
Python
497
19
""" Functions parsing the config optimizer options """ import tensorflow as tf def build_optimizer(optimizer_config: dict) -> tf.optimizers.Optimizer: """ Parsing the optimiser options and parameters from config dictionary. :param optimizer_config: has key name and other required arguments :retu...
d759a17bd3513ab056ae5dfec8ab9b362852b53ed30dbd5fd6808fa881b6a5f1
Python
497
26
""" nelpy auxiliary objects ``nelpy`` is a neuroelectrophysiology object model and data analysis suite. """ from ._results import ResultsContainer, load_pkl, save_pkl from ._session import Session from ._tuningcurve import ( DirectionalTuningCurve1D, TuningCurve1D, TuningCurve2D, TuningCurveND, ) __a...
3af2170672fe72aa91b59582f5b1035ee8c94a982f86e524f31859ce02f9a616
Python
498
20
# Generated by Django 4.2.18 on 2025-03-12 18:20 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("quality_control", "0007_project_quality"), ] operations = [ migrations.AddField( model_name="qualitysettings", name...
476c811c7523b831aab9f064b8cba06608751b4f0c7d3167209e022d8a04328b
Python
498
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['cvt_cvt-w24-384-in22k_finetuned-in1k_4'] = \ lambda: ModelCommitment(identifier='cvt_cvt-w24-384-in22k_finetuned-in1k_4', ...
83b38d24157afc43f6645792d0573629458535445a7845359f403bbb906bee36
Python
498
14
from pathlib import Path import yaml from deep_events.database import reconstruct_from_folder, get_collection FILEPATH = Path(__file__).parents[1] with open(FILEPATH / "test_database/settings.yaml", "r") as stream: COLLECTION = yaml.safe_load(stream)["COLLECTION"] def test_reconstruct(): folder = FILEPATH / "...
2208b76f01e1b31755b6e2ad186ad6e2acc6440c9ad46eb416681245c65cb691
Python
499
19
import unittest from ogo.util.write_txt import write_txt class Test_Write_TXT(unittest.TestCase): def setUp(self) -> None: """ Use this method to prep data or files for other tests, if necessary. """ pass def tearDown(self) -> None: """ Use this method to clean up after the tests, i...
5aebcc012a4ce50495130b3a1db0c94a5e6f842dec36ce9e56916b823b8911a9
Python
499
19
import unittest from ogo.util.write_csv import write_csv class Test_Write_CSV(unittest.TestCase): def setUp(self) -> None: """ Use this method to prep data or files for other tests, if necessary. """ pass def tearDown(self) -> None: """ Use this method to clean up after the tests, i...
838deb470f8bb9965223431fccccc7120c0465f8f5f2ba7d186ab6c57df86765
Python
499
18
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from abc import ABCMeta, abstractmethod from attrs import define, field, validators from redis import Redis @define class BaseMigration(metaclass=ABCMeta): name: str = field(validator=[validators.instance_of(str)]) app_label: str = field(v...
a1bf531b38cf1f3c850fe0afe7a38fb398b0b8c5a3157286bf2defa1f3e365b7
Python
499
19
import warnings warnings.filterwarnings("ignore", message="It is not recommended to directly access") import numpy as np import torch import secrets import random def generate_random_seed(): return secrets.randbelow(2 ** 32) def set_seed(seed): print(f"[INFO] Using random seed: {seed}") random.seed(seed)...
a9f1dc8e9a2433dced52d6712fae3ff6926cadeb5c398409fc62ed20d08d6ade
Python
499
14
from argclz.commands import parse_command_args from .main_cache_bayes import BayesDecodeCacheBuilder from .main_decode_analysis import DecodeAnalysisOptions from .main_disengagement import DecodeDisengageOptions parse_command_args( usage='python -m rscvp.model CMD ...', description='do the related analysis for...
d186365ce680e48de2e93023a8a061a428a27f78e6de02736f200639ea13623f
Python
499
17
from pathlib import Path tree_str = '' def generate_tree(pathname, n=0): global tree_str if pathname.is_file(): tree_str += ' |' * n + '-' * 4 + pathname.name + '\n' elif pathname.is_dir(): tree_str += ' |' * n + '-' * 4 + \ str(pathname.relative_to(pathname.parent)) + '\\...
ed3f3de56fc8bb4bda3ddbc4c6dc923c7b46bbfcd4605f9ee454e1d868e6e922
Python
499
23
#!/usr/bin/python3 import os import numpy as np from nibabel.testing import data_path import nibabel as nib import sys source = sys.argv[1] target = sys.argv[2] aseg_filename = os.path.join(data_path, source) A = nib.load(aseg_filename) A_data = A.get_fdata() print(A) A_data[np.where(A_data == 42)] = 1 A_data[np....
2c45b0f1809c32411191a9138fff5e0e7f505b696328eabd2082b58d95a65aff
Python
501
18
# Copyright (c) Open-MMLab. All rights reserved. __version__ = '0.1.1' def parse_version_info(version_str): version_info = [] for x in version_str.split('.'): if x.isdigit(): version_info.append(int(x)) elif x.find('rc') != -1: patch_version = x.split('rc') ...
3f8dda2133f3b8f72b564f6c775cc69d998b56b49a2f37ac2986a13412f5724c
Python
501
19
import unittest from ogo.cli.Procrustes import Procrustes class Test_Procrustes(unittest.TestCase): def setUp(self) -> None: """ Use this method to prep data or files for other tests, if necessary. """ pass def tearDown(self) -> None: """ Use this method to clean up after the tests,...
627ceeeabd35121af4e3b3e01a475095b1166826313786e43bc57a2e71b62092
Python
501
19
import unittest from ogo.cli.AnalyzeBMD import AnalyzeBMD class Test_AnalyzeBMD(unittest.TestCase): def setUp(self) -> None: """ Use this method to prep data or files for other tests, if necessary. """ pass def tearDown(self) -> None: """ Use this method to clean up after the tests,...
e136293cb1979bed752085887c98368500566bfb45036a88b09998b913e70301
Python
501
18
from __future__ import absolute_import from .tfidf import TFIDF from .textrank import TextRank try: from .analyzer import ChineseAnalyzer except ImportError: pass default_tfidf = TFIDF() default_textrank = TextRank() extract_tags = tfidf = default_tfidf.extract_tags set_idf_path = default_tfidf.set_idf_path t...
1f7cdf70d228c671d6414b8068b07c98f5ea158dc3e90d2829533c4001357b65
Python
502
21
""" eTSC Models Package All model definitions """ from .resnet3d import ResNet3D18, ResNet3D34 from .resnet3d_dual import DualResNet3D from .efficientnet3d import EfficientNet3DB0 from .efficientnet3d_pretrained import make_efficientnet3d_b0 from .eTSCnet import eTSCNet, LighteTSCNet from .eTSCnet_dual import sTSCnetDu...
57c185ca26567421491acbe54b0aecadb716cda0c54dbe0cd70c387aeb0f7b09
Python
502
24
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from typing import TypeAlias, TypeVar __all__ = ("MaybeUndefined",) _T = TypeVar("_T") class _Undefined: pass MaybeUndefined: TypeAlias = _T | _Undefined """ Can be used to annotate dynamic class members that may be undefined in the object....
eb21a0ec911d322951cea498fdd2d470254dc4478ead71c31f61ce2cb555ea68
Python
502
22
""" Reconstruct a surface """ import SVMTK as svm from pathlib import Path if __name__ == "__main__": print("Start ",__file__) outdir = Path("results") outdir.mkdir(exist_ok=True) surf = svm.Surface() ### Reconstruction Parameters ### angular_bound=20 radius_bound=0.01 distance_...
f8e8095dec9de18d9a898ea81821d5473964522830a2a9c26181d8f02aa3b078
Python
502
13
from brainscore_vision import model_registry from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from .model import get_layers, get_model model_registry["deepeisnn_ei_cifar10_vgg19"] = lambda: ModelCommitment( identifier="deepeisnn_ei_cifar10_vgg19", activations_model=get_model("...
1b297fd32402e862cb917d130f7f620d3706ba7b9b69df3bc555b92a7108db5a
Python
503
14
import torch from .base_miner import BaseTupleMiner class EmbeddingsAlreadyPackagedAsTriplets(BaseTupleMiner): # If the embeddings are grouped by triplet, # then use this miner to force the loss function to use the already-formed triplets def mine(self, embeddings, labels, ref_emb, ref_labels): b...
23c42f01f28f6bf49e139d08c6f386dcd96dd29e5b74dac3a031cc4ac82b8c68
Python
503
17
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from django.urls import include, path from rest_framework import routers from cvat.apps.consensus import views router = routers.DefaultRouter(trailing_slash=False) router.register("merges", views.ConsensusMergesViewSet, basename="consensus_merges")...
2d50be8a000f4ed9e1271a2ad90f232252b2e0f272c27fe70cf0e215cd1e4bb1
Python
503
15
# Copyright (C) 2019-2022 Intel Corporation # # SPDX-License-Identifier: MIT from cvat.apps.engine.label_colors import hex2rgb def make_colormap(instance_data): labels = [label for _, label in instance_data.meta[instance_data.META_FIELD]["labels"]] label_names = [label["name"] for label in labels] if "b...
0d0064baff4cfcf7ab3aff44d83d6495b40c3c9d661b21f2eb6cb3000c6ea63a
Python
504
23
#!/usr/bin/python3 import os import numpy as np from nibabel.testing import data_path import nibabel as nib import sys source = sys.argv[1] target = sys.argv[2] aseg_filename = os.path.join(data_path, source) A = nib.load(aseg_filename) A_data = A.get_fdata() print(A) A_data[np.where(A_data == 43)] = 1 A_data[np...
1ed4c376420c8017d89c78d7eb7f33bd0c1abf1bfa7f8158b0536e6b0007a48a
Python
504
15
import pandas as pd from pathlib import Path version_id_path = Path(__file__).parent / 'version_ids.csv' version_id_df = pd.read_csv(version_id_path, index_col='Unnamed: 0') def build_filename(identifier: str, file_type: str): if file_type == '.nc': filename = f'assy_{identifier.replace(".", "_")}.nc' ...
b64cdbf8893b9fedbc67b3867872f0bd67e9dcf78011c0a3c7cf516f1a80fd26
Python
504
18
import sys import subprocess from glob import glob import os script = 'preprocessing/lick_extraction/lickarts_from_piezo.py' mat_dir = 'ZENODOPATH/preprocessing/licktraces' pathpath = 'PATHS/lickdet_piezo_paths.yml' allfiles = glob(os.path.join(mat_dir,'*.mat')) allfiles = [os.path.join(mat_dir,'%s-probe0.mat'%tag) fo...
35a362d9e283022323af46d26135a6f68dc41d86f9e60c2135e8c03215f208b4
Python
505
19
import unittest from ogo.cli.PrintLabels import PrintLabels class Test_PrintLabels(unittest.TestCase): def setUp(self) -> None: """ Use this method to prep data or files for other tests, if necessary. """ pass def tearDown(self) -> None: """ Use this method to clean up after the tes...