sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
8f7d3c43eb1c43e2e33afc8c993f2f45fdd34e0fa5bb327697b20e0ac129d7a9
Python
2,006
26
import argparse from .run import RapidParcTckEval import torch def main(): parser = argparse.ArgumentParser(prog="rapidparc-run", description="Apply RapidParc on a .tck tractogram") parser.add_argument("--tck_path", type=str, required=True, help="Path to the input tck file.") parser.add_argument("--out_pat...
95340c5107ec772cf9cd4c1ec6bc4fadf7231199eeaea466feb518e86b9d4b26
Python
2,006
59
import numpy as np from brainways.transforms.base import BrainwaysTransform from brainways.transforms.compose import Compose class MockTransform(BrainwaysTransform): def __init__(self, value: int = 1): self.value = value def transform_image(self, image, output_size=None, mode="bilinear"): re...
c6e8f0acc5c797c593a572c71b797788f8148c31e076c663cc1869d23085bacf
Python
2,006
52
""" Group Contrast ============== In this tutorial we will cover how to do statistical significance testing with GLM permutations. """ #%% # Get features # ^^^^^^^^^^^^ # First we need to estimate subject-specific features. For example, this can be the static power map for each subject, which would be a (subjects, pa...
d4b024f364104f73b3deaf924a9d8d01d53f158e31cccefa836b43746c2e21ea
Python
2,006
61
import sys import numpy as np import matplotlib.pyplot as plt def read_transmembrane_potential(input_file, dt, print_rate): data = np.genfromtxt(input_file) n = len(data) ms_each_step = dt*print_rate end_simulation = n / ms_each_step timesteps = np.arange(0,n)*ms_each_step vms = data re...
fcda73f59bd062be7f0f016ad26e7f000f2db839aa8adfb639eb408f92fd19c6
Python
2,006
66
# -*- coding: utf-8 -*- # # test_contexts_mpi4py.py import unittest import arbor as arb from .. import cases # check Arbor's configuration of mpi mpi_enabled = arb.__config__["mpi"] mpi4py_enabled = arb.__config__["mpi4py"] if mpi_enabled and mpi4py_enabled: import mpi4py.MPI as mpi """ all tests for distribut...
8e7c4be65a575bb75f119befb84c5aacc67b5a0e6f473b90cf7a6d341a452804
Python
2,007
54
import torch from reducers import AvgNonZeroReducer from utils import loss_and_miner_utils as lmu from losses.generic_pair_loss import GenericPairLoss class ContrastiveLoss(GenericPairLoss): def __init__(self, pos_margin=0, neg_margin=1, **kwargs): super().__init__(mat_based_loss=False, **kwargs) ...
4672aaad6d0ecd7c9bc995d39c93e84da7b51a8a9ebd5655b46f8c9f9fe08978
Python
2,008
70
from dipy.io.streamline import load_tractogram, save_tractogram import glob import json import nibabel as nib import numpy as np import os from os.path import join as ospj import re import sys ########################### ## Set variables and dirs # ########################### subject = sys.argv[1] config_file = sys.a...
94cc5a382fe67629b9d1e2ab4eb263bfb1770d5a1e5c5b912ddcf6a6c5febc58
Python
2,008
61
from .resnet import cifar10_resnet20 from .resnet import cifar10_resnet32 from .resnet import cifar10_resnet44 from .resnet import cifar10_resnet56 from .resnet import cifar100_resnet20 from .resnet import cifar100_resnet32 from .resnet import cifar100_resnet44 from .resnet import cifar100_resnet56 from .vgg import c...
cd2728c74cec37c91e1ae62b7ad4a278ab6073aba51fcc760f9cc9e441c5d0ed
Python
2,008
78
CORPUS_CALLOSUM = [ 251, 252, 253, 254, 255, ] CEREBRAL_WM_RANGES = [ *[2, 41], # aseg left/right cerebral white labels *list(range(3000, 3036)), # wmparc-left-labels *list(range(4000, 4036)), # wmparc-right-labels *[5001, 5002], *[28, 60], # VentralDC included in white matte...
ce8d6df1766e0e72e9fdd2751b5f407f809c2d670a05b857bf07504b163f51e0
Python
2,009
62
from __future__ import annotations from pathlib import Path import numpy as np import pandas as pd import matplotlib.pyplot as plt def save_rgi_plot(df: pd.DataFrame, outdir: str | Path, fname: str = 'fig_rgi_min.png') -> Path: outdir = Path(outdir) outdir.mkdir(parents=True, exist_ok=True) fig, ax = p...
8d2cf8911d0ad3c01d6753ce91fc4342b6df0e5b17fd52334475cd826b57ac2c
Python
2,012
61
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
1bc8fb72c87d78d4056817ea71b37e17160aad70d374b55cf987a252064f3dd0
Python
2,014
110
import numpy as np from impedancefitter.elements import (Z_R, Z_C, Z_L, Z_w, Z_wo, Z_ws, Z_stray, Z_CPE, parallel) omega = 2. * np.pi * np.logspace(1, 8, num=20) R = 100 alpha = .5 def test_Z_R_type(): Z = Z_R(omega, R) assert isins...
4d5aa52788cefb0fcdceac34bb4eba2572557f977afc47da044421be6bf503e4
Python
2,014
71
""" Example to use this repository This example shows how to load the files from disk and save the output files back to disk. """ # Load the python libraries import os, sys import numpy as np import nibabel as nib from dipy.io import read_bvals_bvecs from dipy.core.gradients import gradient_table from dipy.segment....
cfce49f2e93e7c7b2f70a84b627c2307165ee5da1de9e5fa42954783730fdb1f
Python
2,014
65
"""Step 3: Coregistration.""" from pathlib import Path from osl_dynamics import files from osl_dynamics.meeg import parallel, rhino from osl_dynamics.utils.filenames import OSLFilenames # ---------------------------------------------------------------------------- input_dir = Path("BIDS") output_dir = Path("derivativ...
4ddf863c6cc1da40571cf819dc80cbd36a53e5b2a0f6fccdc47857835ae118db
Python
2,015
64
import subprocess import shlex import util, slurm import os nb_gpus = 20 # Number of GPUs used to render the dataset nb_scenes = 15000 # Each scene leads to 9 images --> roughly 121000 training images, 7000 validation images and 7000 test images rendertime = 75 # Number of seconds to render 9 images. Above and the re...
9b02c58ede9f86ebaa769a9aa07959eab0eab2cf7ed49e31f854b4a2d476868b
Python
2,015
51
import torch from tqdm import tqdm import numpy as np from transformers import pipeline, T5Tokenizer, T5EncoderModel import os import pandas as pd path='/data2/whr/czl/TwiBot22-baselines/datasets/Twibot-22/' user=pd.read_json(path+'user.json') pretrained_weights = 't5-small' tokenizer = T5Tokenizer.from_pretrained(pr...
e3e0942ab9e118019d28badb604f1cf912767ac7d0d3db400386adfc602b8ba1
Python
2,015
58
#@File(label="Input file (leave empty for demo):", required="false", description="Reconstruction file (.traces, .swc, json) to be analyzed. A folder of files is also supported.") input_file #@String(label="Restrict to :", choices={"All processes", "Axon", "Dendrites"}) subtree_choice #@ImageJ ij #@SNTService snt snt.r...
02f415ed529f91eec3c63a1a1030ca7e685d84cf8925ce763a2c42d7907b50b1
Python
2,016
57
""" Network Response ================ In this tutorial we will cover how to do statistical significance testing for a 'network response'. This is the average state/mode time course epoched around events of interest. We test is the response is significantly different from zero. """ #%% # Get network response # ^^^^^^^...
6745224708429615ca11e048feea6095408b9a78e36ebf4d31d690ca8c447c48
Python
2,016
58
import torch from torch_geometric.nn import GCNConv import torch.nn.functional as F class GCN(torch.nn.Module): def __init__(self, config, feat_type, input_dim, out_dim): super(GCN, self).__init__() self.config = config self.feat_type = feat_type self.hidden_dim = config["hidden_ch...
aa4ab15ca760444e9df5b8e88a17b2531cc3bbaf9d8ccabae543c1c4d52c0e8f
Python
2,016
81
from collections import defaultdict import anndata import numpy as np from tqdm.auto import tqdm from abm import CellModel, get_lr_interactions2 def copy(adata): return anndata.AnnData(X=adata.X.copy(), obs=adata.obs.copy(), var=adata.var.copy()) def _accumulate_results(fin, res): for dic in res.values():...
fd0d2449426818109ceae6e433baedffb501cd9839d522eba397586ebace0d87
Python
2,016
71
#!/usr/bin/env python3 import matplotlib.pyplot as plt import numpy as np from scipy.signal import savgol_filter import networkx as nx def plot_network(rec, prefix=""): fg, ax = plt.subplots() ax.matshow(rec.connections) fg.savefig(f"{prefix}matrix.pdf") fg.savefig(f"{prefix}matrix.png") fg.savef...
46960516a6985aad4154c17716cf84428f9064374b4232073dd925dddd8c396e
Python
2,017
80
r"""Model package.""" from .mlp import MLP from .basic_gnn import GCN, GraphSAGE, GIN, GAT, PNA, EdgeCNN from .jumping_knowledge import JumpingKnowledge, HeteroJumpingKnowledge from .meta import MetaLayer from .node2vec import Node2Vec from .deep_graph_infomax import DeepGraphInfomax from .autoencoder import InnerProd...
bc942ec70db5cde49891fe8f6e32435d4a6151ee1722a413a6cea78f5e9d3983
Python
2,017
83
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Aug 22 20:25:48 2023 @author: rl05 """ import sys import os import os.path as op from mne import make_bem_model, make_bem_solution, write_bem_solution from mne.viz import plot_bem sys.path.append('/imaging/hauk/rl05/fake_diamond/scripts/preprocessing...
f00ab4b4d097236adf99511bce0704cb0955380894d0b8232377ac2f49a00ecc
Python
2,019
87
import torch import gc from time import time import numpy as np __all__ = ['start_timer', 'stop_timer', 'print_timing'] TIMINGS = {} def convert_seconds(seconds): if seconds // 60: minutes = seconds // 60 seconds %= 60 else: minutes = 0 if minutes // 60: hours = minutes /...
e77fbc2dba177406dd58c70bb199985e36b0d4ae02d3045454fac67cb10287c8
Python
2,021
59
import numpy as np import pandas as pd from sklearn.preprocessing import LabelEncoder from eir.train_utils import evaluation def test_parse_valid_classification_preds(): test_val_true = np.array([0, 0, 0, 0, 0, 1, 1, 1, 1, 1]) test_val_preds = np.array([1, 1, 1, 0, 0, 1, 1, 0, 0, 0]) test_val_probs = np....
fcd9b4888126212fe7384726c828ad6e21447abb638e8c59553486ddd76bd71c
Python
2,021
59
""" SPDX-License-Identifier: MIT SPDX-FileCopyrightText: © 2022 Renaud Bastien, Stephane Sanchez <stephane.sanchez@ut-capitole.fr> Université Toulouse Capitole - Institut de Recherche en Informatique de Toulouse Real Expression Artificial Life (REVA) Research Team https://www.irit.fr/departement/calcul-intensif-simulat...
78320a06447f5e9e6df31d6b4d99da7837490b48637af57d26cd013b9d4006f5
Python
2,022
71
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Download data for tests. This is used to download our internal tests into your home/.scilpy. """ import argparse import logging import tqdm import nltk from scilpy.io.dvc import pull_test_case_package from scilpy.io.fetcher import fetch_data, get_testing_files_dict ...
cdf63c33ee6fb2bf942bd0f59a63800befda359f353bfa000f62dd0555bfb3f0
Python
2,022
65
import argparse from pyrosetta import * import numpy as np import sys init() ''' This file creates the every individual the variant file at every individual residue position. ''' amino_acids = ["A", "C", "D", "E", "F", "G", "H", "I", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "Y"] def main(args): pdb...
22306cb79955ac97a4ae554a3a8b669caadf665297e3f689ef1e6ea260aa9bb1
Python
2,023
71
import pubchempy as pcp import random import time import json from chemgraph.tools.ASE_tools import ( smiles_to_atomsdata, molecule_name_to_smiles, ) def get_random_molecule_names(n=2, cid_range=(0, 10000000), seed=2025, max_natoms=20, min_natoms=6): """Get a list of random molecule names and smiles from ...
267e8288e35fba5c52b22cca697740806d71db5f7847ca8383603f59beb7770e
Python
2,023
61
# The ImpedanceFitter is a package to fit impedance spectra to # equivalent-circuit models using open-source software. # # Copyright (C) 2018, 2019 Leonard Thiele, leonard.thiele[AT]uni-rostock.de # Copyright (C) 2018, 2019, 2020, 2021 Julius Zimmermann, # julius.zimmermann...
55b4ba4dc97f7c5d2313a37cdea68784b84bd1e586857b9dacd8d4a9b28b437c
Python
2,023
69
# -*- coding: utf-8 -*- import sys import pandas as pd sys.path.append('..') from nerpy import NERModel def test_my_bertspan_train(): # Creating samples train_samples = [ [0, "HuggingFace", "B-MISC"], [0, "Transformers", "I-MISC"], [0, "started", "O"], [0, "with", "O"], ...
51ef74988beffcd7b417d1b6f537e5f176e2e59e564bce42cfd3cd791f69c344
Python
2,024
76
import os from importlib import import_module from pathlib import Path cell_graph_config = { "cell_f_list": [ 'area', 'r_equiv', 'r_maj', 'r_min', 'angel', 'ecc', 'maj_x', 'maj_y', 'min_x', 'min_y', ], "edge_f_list": [ ...
87ec4968fa30291d8a142b79028b1cd13219191fae405850655d2a49f8cccfb1
Python
2,024
47
""" Iter-7 record attempt — DINOv2 ViT-L/14 + ImageNet linear classifier at HIGHER RESOLUTION (336px). Same model + recipe as our best dinov2_vitl14_lc (overall 0.41), changing ONLY the input resolution 224 -> 336 (24x24 patches vs 16x16, ~2.25x more tokens). DINOv2 interpolates its positional embeddings, so the linea...
3f6ef2c6371289b50908f1b60c4c533c025ec120294e802861c373fe853761ff
Python
2,025
61
'''MobileNet in PyTorch. See the paper "MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications" for more details. ''' import torch import torch.nn as nn import torch.nn.functional as F class Block(nn.Module): '''Depthwise conv + Pointwise conv''' def __init__(self, in_planes, out_...
979683e48c00214728028820510c55db37a8441bdf8b6e0d27893b2030584ce5
Python
2,025
50
# mypy: disable-error-code="method-assign" from unittest.mock import MagicMock, Mock, create_autospec import pytest from qtpy.QtWidgets import QMessageBox from brainways.ui.controllers.registration_controller import RegistrationController from brainways.ui.widgets.registration_widget import RegistrationView @pytes...
62d95b44342f4f82a845ea09c0d52f266cdf642b83e06cd85aad67e8101592d0
Python
2,026
69
# -*- coding: utf-8 -*- """Utilities for time series noise removal.""" import os import matplotlib.pyplot as plt import nibabel as nb import numpy as np __all__ = ["nuisance_regressor"] def nuisance_regressor(file_in, wm_mask, csf_mask, path_output): """This function creates nuisance regressors from a function...
7532081fabb9df6cbf9d4c54912ad96b088167f08e7b2a0d2bf4885d264eddcd
Python
2,027
55
# ============================================================================== # Binaries and/or source for the following packages or projects are presented under one or more of the following open # source licenses: # eval.py The OpenLane Dataset Authors Apache License, Version 2.0 # # See: # https://g...
02cd24d8e1ae6adc512f8874b1d1bc098939856744f1f19a73267a51477e04bb
Python
2,028
52
from numpy.distutils.core import setup, Extension from numpy.distutils.misc_util import get_numpy_include_dirs import os, sys mods = ['gradunwarp.core.coeffs', 'gradunwarp.core.globals', 'gradunwarp.core.__init__', 'gradunwarp.__init__', 'gradunwarp.core.utils', 'gradunwarp.core.unwarp_resamp...
3f65513f8be0d9a89e32c820683a64dcd91fe3414fd69d7000e697a34dc02699
Python
2,028
59
import torch from torch_geometric.nn import GATConv import torch.nn.functional as F class GAT(torch.nn.Module): def __init__(self, config, feat_type, input_dim, out_dim): super(GAT, self).__init__() self.config = config self.feat_type = feat_type self.hidden_dim = config["hidden_ch...
d5765ce4340d8c42c7ec0ce412ccd1f199decd7c139b4a0bf5fd230e4e2657c9
Python
2,028
36
from testsetclass import TestsetClass class UPU23(TestsetClass): def __init__(self): self.weak = 1.0 self.molecules = ['3b', '4b', '2p', '7a', '1p', '3a', '6p', '8d', '3d', 'aa', '1b', '0a', '2a', '1g', '1e', '1c', '1f', '1a', '5z', '9a', '7p', '2h', '0b', '1m'] self.exp_values = {'0': 4.8...
2fac2e7f539e3fa087846ca27899880e42afd23406ce690ac8c277d6a0143bd5
Python
2,029
69
import numpy as np from mc_analysis.simulator.apply_irf import convolve_with_irf, remove_padding def test_convolve_with_IRF_raises_error_for_invalid_irf_std_tof(): G1 = np.random.rand(10, 20, 30) tofs = np.linspace(0, 1.6e-9, 30) try: convolve_with_irf(G1, tofs, irf_std_tof="invalid_value") ...
53bf42c97833bce0c35ad58160c1097235fdbcb73b7a4c706bbb2cc15ddc0947
Python
2,029
47
# This file is part of Mooney computational modeling project. # # Mooney computational modeling project is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) an...
a381385af9a57ffc1f569e38af3e8487ce180a76f79852e00119dbd5d73e9d1c
Python
2,029
82
""" Lists of supported models for different LLM providers. """ # OpenAI models that are supported supported_openai_models = [ "gpt-4o-mini", "gpt-4o", "gpt-4.1", "gpt-3.5-turbo-0125", ] # Ollama models that are supported supported_ollama_models = ["llama3.2", "llama3.1"] # ALCF models that are suppor...
d6ddc33fb40efdd3273ee9a46ca41305f6eaf4e05996956db5563735290e4e2a
Python
2,029
65
# ================================================================= # Author: Lucas Berg # # Program that plot the APD over a line # This script only works if the grid is a plain tissue # ================================================================= import sys import numpy as np import matplotlib.pyplot as plt de...
26197006f6beb7872dc1447a4f4502a9b365e3f9c3156eff68b288e97c01a9d6
Python
2,030
55
# -*- coding: utf-8 -*- import logging from dipy.denoise.noise_estimate import piesno import numpy as np def estimate_piesno_sigma(data, number_coils=0): """ Here are Dipy's note on this method: > It is expected that > 1. The data has a noisy, non-masked background and > 2. The data is a repe...
6ed031b730359a681b6364b11d322bf28ceb2baacf09d84c3f7c02dcdd58b417
Python
2,030
50
""" Tests for `bx.phylo.phast`. """ from io import StringIO from numpy import ( allclose, array, ) from bx.phylo.phast import TreeModel test_data = """ALPHABET: A C G T - ORDER: 0 SUBST_MOD: HKY85+Gap TRAINING_LNL: -178667772.836697 BACKGROUND: 0.227006 0.169993 0.169307 0.227262 0.206432 RATE_MAT: -0.9...
a3f29ec7c46f98b1ec7ea2bd82d05d9340f5d7aa7f3ff06b65383d3d4a969df1
Python
2,031
60
# SPDX-FileCopyrightText: Copyright © Jørgen Riseth and Timo Koch # SPDX-License-Identifier: GPL-3.0-or-later from pathlib import Path import click import pyvista as pv import nibabel as nibabel import numpy as np import simple_mri as sm def mri_data_to_ndarray( grid: pv.StructuredGrid, data_name: str, shape: t...
8eb640ada507c827a7e10108e3cd9ac7be2062617d9bc5ea1a95d88205c8c7b1
Python
2,032
45
# -*- coding: utf-8 -*- import os import sys import unittest import time sys.path.append('..') from nerpy.ner_model import NERModel class QPSPredictTestCase(unittest.TestCase): def test_bertsoftmax_speed(self): """测试bertsoftmax_speed""" model = NERModel("bert", "shibing624/bert4ner-base-chinese"...
dc26ff86520648359144a65a69a837887172dcbe98fec2f299cfa3c14f595374
Python
2,032
57
from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images import ssl import functools import timm from brainscore_vision.model_helpers.check_submission import check_models ssl._create_default_https_context = ssl...
2c8e976a07b5f7e0c410365536a69a3a37a644056a5644a51f89b18e3b9bc3e0
Python
2,033
63
""" impyute.contrib.describe """ from impyute.ops import matrix def describe(data): # verbose=True): """ Print input/output multiple times Eventually will be used instead of matrix.nan_indices everywhere Parameters ---------- data: numpy.nd.array The data you want to get a description fro...
cf9ed7f99c37c4b5b9614068b2130945061a3da5e5926b368f26d149ac8ab7b8
Python
2,033
58
import datajoint as dj import inspect import warnings import os import git import datetime def gitlog(cls): """ Decorator that equips a datajoint class with an additional datajoint.Part table that stores the current sha1, the branch, the date of the head commit,and whether the code was modified since the l...
17e288b7771afec08109df3a340ce5d8e790aea1948f86192a28a7e3240ac35d
Python
2,034
72
# Non-osipi dependencies # osipi utilities # osipi implementations import numpy as np # from utils.data_simulation.GenerateData import GenerateData from src.original.fitting.ETP_SRI.LinearFitting import LinearFit author_lookup = { 'ETP_SRI': LinearFit } # print('hi!') def ivim_fit(authors=None, signals=Non...
27fe7bc4e02f628e208c923ef09868f6814a6947fa99bf067065336a18035f95
Python
2,034
58
import torch import torch.nn as nn import torch.nn.functional import torchvision.models as models from PIL import Image from torchvision import transforms def load_model(model_path): # Assume using the modified ResNet18 model model = models.resnet18() model.conv1 = nn.Conv2d(1, 64, kernel_size=...
62e530f2415e7bc7cec3306ef6e8c4582b5a81ccc404db27f43d91d681ff6751
Python
2,034
71
import h5py import os import matplotlib.pyplot as plt import numpy as np DIR = os.path.dirname(os.path.realpath(__file__)) HOME_DIR = DIR.rsplit('/', 1)[0] HOME_DIR = HOME_DIR.rsplit('/', 1)[0] print('> HOME: ', HOME_DIR) DATA_DIR = HOME_DIR + '/data/' print('> DATA: ', DATA_DIR) recon_list = [ '/examples/2024...
925e0d7bd4de2766f38f048617b0cb1ef90278e1d414e4e800567eac341cbc8f
Python
2,034
64
import argparse from omegaconf import OmegaConf from torch.utils.data import DataLoader from modules.utils import instantiate_from_config import torch def get_parser(): parser = argparse.ArgumentParser() parser.add_argument( "--base", type=str, default="./configs/config.yaml" ) ...
a27228f9bc2242b6f9c01f0c26368a796def6cf94dce7a5c276a5db94f8667fa
Python
2,034
39
import numpy as np import pandas as pd from . import ELA_Network_functions #----------------------------------------------------------------------------------- # ①calc E of all state from h and J #----------------------------------------------------------------------------------- #------------------------- # input:pa...
cb25d89d3d85a4abfe170a5b0a7030bb3ce4c51f8566d4058abbf61cf70b5753
Python
2,034
52
# Info: originates from SEAL_OGB: https://github.com/facebookresearch/SEAL_OGB # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch import sys # stolen from M.Zhang (OGB SEAL reposi...
3878091c538978a078a0ef4c33f7bc42f1bb1915a30492710638eb63e18b2b36
Python
2,036
48
from train_gtex import * def main(): parser = argparse.ArgumentParser(description="Run a training experiment") parser.add_argument("--config_path",type=str) parser.add_argument("--fold",type=int) parser.add_argument("--model_type",type=str) args = parser.parse_args() config_path = args.config_p...
edebce7ed0f49c9634157a7d50f744c973b5d36474c542c1ec31e641040eb241
Python
2,036
61
# Generated by Django 4.2.21 on 2025-11-21 16:21 from django.db import migrations def init_settings_in_existing_tasks(apps, schema_editor): """ Initialize default quality settings for tasks that do not have them. This is done at task creation for new tasks, but the old ones might need to be updated. ...
58490fb9bc07b86c04f1471c8f110a418bf123c5822160aa4f2895f3725b6671
Python
2,037
27
from testsetclass import TestsetClass class SIE4x4(TestsetClass): def __init__(self): self.weak = 1.0 self.molecules = ['nh32+_1.0', 'nh32+_1.75', 'nh32+_1.25', 'h2+_1.75', 'he2+_1.75', 'he2+_1.0', 'h2o2+_1.75', 'he', 'h2+_1.25', 'nh3+', 'h2+_1.5', 'h2o', 'h2o2+_1.25', 'h2+_1.0', 'h2o2+_1.5', 'he2...
f2645645ef7ebe97c6872d30e6579df9710470cd8174dbc61e757fe575f98b61
Python
2,037
66
import os os.environ["XLA_PYTHON_CLIENT_MEM_FRACTION"] = "0.5" os.environ["XLA_PYTHON_CLIENT_PREALLOCATE"] = "false" import jax import jax.numpy as jnp from jax.scipy.stats import norm import matplotlib.pyplot as plt import argparse import json import numpy as np import matplotlib.pyplot as plt import jax.numpy as ...
09893dcbd64c1f397d889248bbb571687cf68b747214af1f919a6c0f69564e42
Python
2,038
72
import logging from time import time import dipy.tracking.utils as dtu import numpy as np logger = logging.getLogger("AFQ") def get_percentile_threshold(mask, threshold): zero_mask = mask == 0 mask[zero_mask] = np.nan new_threshold = np.nanpercentile(mask, 100 - threshold) mask[zero_mask] = 0 re...
92aa9ed6c3bbf7b2c6150b4135d4d4fe481b28b95b2824cf4614ccc0873d9bf0
Python
2,038
78
import os os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") import pytest pytest.importorskip("PySide6") from PySide6.QtCore import Qt from PySide6.QtWidgets import QApplication from musclex.ui.widgets.batch_folder_selection_dialog import BatchFolderSelectionDialog @pytest.fixture(scope="module") def qapp():...
2e023320f41164e6f0e933389c646adbd6d679882f1e6936c2aa83a02fce4050
Python
2,039
85
# -*- coding: utf-8 -*- """ Generate 2D ODC This script creates a two-dimensional ODC pattern. """ # external inputs import numpy as np import matplotlib.pyplot as plt from scipy.signal import correlate from numpy.fft import fft2, fftshift # local inputs from fmri_tools.simulation.odc import odc_2d # 2D parameters...
ff0e389e8f98aeec757549b15c528521d802ae9db99ce8a58b6c24a013a089a1
Python
2,039
75
"""vgg in pytorch [1] Karen Simonyan, Andrew Zisserman Very Deep Convolutional Networks for Large-Scale Image Recognition. https://arxiv.org/abs/1409.1556v6 """ '''VGG11/13/16/19 in Pytorch.''' import torch import torch.nn as nn cfg = { 'A' : [64, 'M', 128, 'M', 256, 256, 'M', 512, 5...
45679b595d2cb076cc5536652deba1063444fa97eac1c33488d6aadff2724212
Python
2,041
69
import argparse import logging import os from pyment.data.utils.ensure_fastsurfer_crops_exists import ( ensure_fastsurfer_crops_exists, ) logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s: %(message)s', level=logging.INFO, ) logger = logging.getLogger(__name__) def create_fastsurfer_co...
7fa21a515e20fcca90e856be73c5ab73024e773db0bf3758df6ee6a2247d7f99
Python
2,041
67
# Copyright (C) 2018-2022 Intel Corporation # # SPDX-License-Identifier: MIT from functools import update_wrapper __plugins = {} def add_plugin(name, function, order, exc_ok=False): if order not in ["before", "after"]: raise Exception("Order may be 'before' or 'after' only. Got {}.".format(order)) ...
94761a184860fc8e3acc6499de693c2b6487db607d6527da35e0b4577f6216a6
Python
2,041
69
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Script to flip a given surface (FreeSurfer or VTK supported). Can flip surface coordinates around a single or multiple axes Can also be used to reverse the orientation of the surface normals. ----------------------------------------------------------------- Reference...
b0a430d81f436d7861f4067f3ee4d53a53fc6a78c7cd833e9f9fa0464eb2b5fd
Python
2,041
56
import torch from distances import CosineSimilarity from losses import GenericPairLoss from utils import loss_and_miner_utils as lmu class IntraPairVarianceLoss(GenericPairLoss): def __init__(self, pos_eps=0.01, neg_eps=0.01, **kwargs): super().__init__(mat_based_loss=False, **kwargs) self.pos_ep...
e9adfb44cf946f02397e69d564d2c52139be66dc806a62e7e2463a2575e2e229
Python
2,041
52
#!/usr/bin/env python """ HAL module for controlling a Thorlabs filter wheel. Hazen 04/18 """ import storm_control.hal4000.halLib.halMessage as halMessage import storm_control.sc_hardware.baseClasses.amplitudeModule as amplitudeModule import storm_control.sc_hardware.thorlabs.FW102C as FW102C # FIXME: Should be am...
2e0a2f75deef1f42b682c2388e417c719061f7561689f636b66273f113828676
Python
2,042
71
import networkx as nx import pandas as pd import numpy as np import random from tqdm import tqdm from sklearn.decomposition import PCA import os from gensim.models import Word2Vec dataset_name='Twibot-22' edge_path=dataset_name+'/edges.npy' edge_index=list(np.load(edge_path)) edges=[] #id_list=np.load('/data2/whr/lyh/t...
7f1546eb43da63ee2f96ae58f7f33f16a70e6e50d482cb2fce201d9a153b9bb7
Python
2,042
67
from __future__ import annotations import numpy as np import PIL.Image import pytest from numpy.typing import NDArray from pytestqt.qtbot import QtBot from labelme._utils._image import img_qt_to_arr from labelme._widgets._brightness_contrast_dialog import BrightnessContrastDialog @pytest.fixture() def rgba_img() ->...
d767e2ffec3a56d3897fc90e451b3ba5f689c11e19fef9d9c5293685c525c17f
Python
2,042
68
from paraview import simple import os from sys import argv, exit import glob import re def natural_sort(l): convert = lambda text: int(text) if text.isdigit() else text.lower() alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ] return sorted(l, key = alphanum_key) import arg...
77b91f7f86a1d3fe6609634268c199998482af92571e9ff8c49927966c8f619b
Python
2,044
70
# ----------------------------------------------------------------------------- # Copyright © 2014-2015 Colin Duquesnoy # Copyright © 2009- The Spyder development Team # # Licensed under the terms of the MIT License # (see LICENSE.txt for details) # ----------------------------------------------------------------------...
c3e1305a5aa05cd5bd1b529984f79388f119a5723374cec955aed2b734464c3a
Python
2,045
66
# -*- coding: utf-8 -*- """ Created on Wed Oct 7 14:46:26 2020 @author: Yoshi """ import csv import numpy as np from background_calculator import * def data_sorter(path,raw_data,folders_list,framerate_information): # Defines path to key folder key_path = f"{path}/Data/Key" # Reads frame key...
e80707c6292f8b3bec9e3320e26cfe1415759ea1af0790916a2a385ba3d80338
Python
2,045
66
import nibabel as nib import numpy as np from dipy.align import resample from scipy.ndimage import gaussian_filter from skimage.morphology import skeletonize from skimage.segmentation import find_boundaries def fit_wm_gm_interface(PVE_img, dwiref_img): """ Compute the white matter/gray matter interface from a...
3d4959d360565bea1ed20c57855d2205b6f1e4050a0f5762fe450fd216866abb
Python
2,046
70
#!/usr/bin/env python import numpy as np import pandas as pd import click as ck import sys from collections import deque, Counter import time import logging from deepgo.utils import FUNC_DICT, Ontology, NAMESPACES logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.INFO) @ck.command() @ck.option( ...
887a195d58329ff809e328fc5ee912d2dd19fbb63c8806199a63d3b42e9783e7
Python
2,046
54
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master...
e26c12c76db4397de22717b915d0b035b07111cf870526dc2464e1600099bf2c
Python
2,046
53
from __future__ import annotations import torch import torch.nn as nn import torch.nn.functional as F class BasicBlock(nn.Module): def __init__(self, in_ch: int, out_ch: int, stride: int = 1): super().__init__() self.conv1 = nn.Conv2d(in_ch, out_ch, 3, stride=stride, padding=1, bias=False) ...
c78e4a36382b7e0d6d35dbcab8d403f6a9c28064b882d8590120f4b9f7182ab7
Python
2,047
55
import json import os.path as op import pytest from MEGnet import megnet_init def _set_model_paths(monkeypatch, tmp_path): weights_path = tmp_path / 'model_v2k3' monkeypatch.setattr(megnet_init, 'weights_path', str(weights_path)) monkeypatch.setattr(megnet_init, 'model_path', str(weights_path / 'model_v...
6b468c5a4e55085fd0c763a23b8e6a5a43612d3979b840ddfb56dfda8d2dd31b
Python
2,048
57
import fire import pickle import numpy as np import nilearn.plotting from rsatoolbox.data.dataset import Dataset from rsatoolbox.rdm.calc import calc_rdm from nilearn.glm.contrasts import expression_to_contrast_vector, compute_contrast data_path = "../bids_dataset/derivatives" mapping = { "adults": { "rIP...
82610bc2bffcd7ed905985feb086dd54e99efe6ce253d6abe1cab616326127e6
Python
2,049
51
# Copyright (C) 2020-2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import shutil from datumaro.components.dataset import StreamDataset from cvat.apps.dataset_manager.bindings import GetCVATDataExtractor, import_dm_annotations from cvat.apps.dataset_manager.util import ma...
890b3019ce17db4c05fbfb5b7ce4503e32726da9ccd4525acc5c4849814e5b16
Python
2,049
53
import numpy as np import torch from distances import CosineSimilarity from utils import common_functions as c_f from utils import loss_and_miner_utils as lmu from losses.generic_pair_loss import GenericPairLoss class TupletMarginLoss(GenericPairLoss): def __init__(self, margin=5.73, scale=64, **kwargs): ...
cc8b89ec7e8d87a6edeab907423df6bc63ed16c754f90cf25062d7ccbd32311c
Python
2,049
70
"""Save HMM extract features. The data needed to run this script has not been provide. You the get_data.py script in the parent directory to download the output of this script. """ import pickle import numpy as np import pandas as pd from glob import glob from osl_dynamics.analysis import power, connectivity from os...
e1642806c297d0327504d5a7637a51fae4c51859243ea1068c31b944306bc291
Python
2,049
55
import csv import mido from mido import Message, MidiFile, MidiTrack, bpm2tempo def csv_to_midi(csv_filename, midi_filename='output.mid', note_duration=0.3, tempo_bpm=120): """ Convert a CSV with columns 'time' and 'midi_values' into a MIDI file. Parameters: - csv_filename: str, path to the input ...
e58db6d25e845d95c2fb618d5b24e277683aa0fb9872e1434d4f80d61a80b539
Python
2,049
60
from __future__ import annotations from pathlib import Path import pytest from PySide6.QtCore import Qt from pytestqt.qtbot import QtBot from ..conftest import close_or_pause from .conftest import MainWinFactory from .conftest import draw_and_commit_polygon from .conftest import draw_triangle from .conftest import s...
06cb983e3e35a8931f8c3355c3150ffa58770da140eb21b19e103e84c8f6d570
Python
2,050
58
import torch from pathlib import Path from torchvision.models import resnet18 from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.brain_transformation import ModelCommitment from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_im...
322f50d0db19a509517aec9e7edf5c50b7499dabdbb5b2d78226edfbc6edd47f
Python
2,051
59
import numpy as np """ Functions for projecting slices onto the same coordinate system from partial alignment matrices obtained by PASTE2/ """ def partial_stack_slices_pairwise(slices, pis): """ Projecting all slices onto the same 2D coordinate system. In other words, project: slices[0...
48b15839d748af1141c37c6faaebd99532c15da420e4f170eb3e93bcc29f5d26
Python
2,051
60
import user_features as uf import csv import ijson import pandas as pd import time def get_user_vector(user): user_vector = { "id": uf.get_user_id(user), "screen_name_length": uf.get_screen_name_length(user), "description_length": uf.get_description_length(user), "account_longvity"...
ccc2fb3f79c0bfabdb9bfb0115cf2da370bee672096d055428eb8397a9a474d8
Python
2,051
75
''' Plot the place field of cells in the CANN model. Created on 2021-04-20 by Tianhao Chu, MOdified by Zilong Ji ''' import brainpy as bp import brainpy.math as bm import numpy as np import matplotlib.pyplot as plt from cann_fft import CANN1D #set default ramndom seed for reproducibility np.random.seed(0) #set backend ...
ce5f4695c0f800bdb66a44a30d8c51c435955478c2316ed3b4346236860f1b04
Python
2,051
72
""" .. _surface_picking_example: Picking a Point on the Surface of a Mesh ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This example demonstrates how to pick meshes using :func:`surface_mesh_picking() <pyvista.Plotter.enable_surface_picking>`. This allows you to pick points on the surface of a mesh. """ ############ IMPO...
ea649c562491c7654f2d3da7f7fb2fcca823fdd2d6959ae9820445d5aa33386f
Python
2,051
74
import time import json import asyncio import grpc from ..qt import * from .. import thalamus_pb2 from ..task_controller.util import create_task_with_exc_handling from ..util import IterableQueue class ChatEdit(QTextEdit): def __init__(self): super().__init__() self.on_apply = lambda: None def keyPressEv...
05d00605617428106d45a4214046ce4425d0c482c3a1e1b0d5adbd7560daaa95
Python
2,052
58
import user_features as uf import csv import ijson import pandas as pd import time def get_user_vector(user): user_vector = { "id": uf.get_user_id(user), "screen_name_length": uf.get_screen_name_length(user), "description_length": uf.get_description_length(user), "account_longvity"...
aae047c17a8ae5746ba36a55de32a39d3616e4538aebfd977f039aa7694cb957
Python
2,052
69
from pathlib import Path from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet from brainscore_core.supported_data_standards.brainio.packaging import package_stimulus_set stimuli = [] image_paths = {} stimuli_directory = '../datasets/edge' ''' Dataset Meta Info (from https://github.com/rge...
2c952ceaf71f07fddcd6caaf6a65de8630ad734043c0f6d057ea5b2af886c5f3
Python
2,053
73
"""Direct Gemini endpoint (Google-native protocol). Logic moved verbatim from ``models/gemini.py``: ``GEMINI_API_KEY`` with interactive prompt, curated model validation, ``max_output_tokens=6000``. """ from __future__ import annotations from chemgraph.models.endpoints.base import ( CredentialPolicy, Endpoint...
3e50cffc796156c41f5bc732a208ad274bb5ffc884246e62b98fd6e766747753
Python
2,053
91
import re def count_characters(all_text): cnt = 0 for item in all_text: item = item.replace('\n',' ') cnt += len(item) return cnt def count_hashtags(all_text): cnt = 0 for item in all_text: hashtags = re.findall(r'#\w', item) cnt += len(hashtags) return cnt de...
41757e006c5c2e831ebfce0743b472192da45268c76ac5483ce151fc5491579a
Python
2,053
64
# Copyright 2016 Numenta Inc. # # Copyright may exist in Contributors' modifications # and/or contributions to the work. # # Use of this source code is governed by the MIT # license that can be found in the LICENSE file or at # https://opensource.org/licenses/MIT. import os import math import simplejson as json from ...
8bf8d06f22b8bbac80ff1dbb217cae2ddad27a0bacc21b7b19671d3256163eb7
Python
2,053
65
#@String(value="This script converts all .ndf files in a directory into ROIs (as ZIP files). Conversion log is shown in Console.", visibility="MESSAGE") msg #@File(label="Directory of .ndf files:", style="directory") input_dir #@Boolean(label="Open Console", value=false) open_console #@String(value="NB: ROI Manager wil...
1e45e5255e524cca9d624085419437747c8bbafe259b591abc90d90e524cef10
Python
2,054
64
from typing import Generator, Callable, List, Tuple, Any from zigzag.classes.stages.Stage import Stage from zigzag.classes.cost_model.cost_model import CostModelEvaluation from zigzag.classes.hardware.architecture.accelerator import Accelerator from zigzag.classes.mapping.spatial.spatial_mapping import SpatialMapping ...
6c6f8f0ff0a352981faec292f32805ac29172f8687fbcfe2673f43c8d5408b0f
Python
2,054
47
#!/usr/bin/env python import argparse import json import csv from collections import OrderedDict parser = argparse.ArgumentParser() parser.add_argument('-i', '--configFile', metavar='FILE', help='configuration file input (REQUIRED)', type=argparse.FileType('rt'), required=True, dest='config') parser.add_argument('-s...