sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
bef27b8b7553425c38de5ae67c6ef37e8fbaa9e62b9a18ba8e2fb91b062ef7ef
Python
4,138
127
"""Logging utilities.""" import logging class CustomFormatter(logging.Formatter): """Custom formatter for logging.""" def __init__(self, fmt: str, datefmt: str | None = None): """Initialize the custom formatter.""" super().__init__(fmt, datefmt) grey = "\x1b[38;20m" yellow =...
c37f71ec53bcc2bd2a6732a59ff666c970de22fcbcb294f2a3253a1ccdee3ff5
Python
4,138
130
import argparse import torch import torch.nn.functional as F from ogb.nodeproppred import PygNodePropPredDataset, Evaluator from logger import Logger class MLP(torch.nn.Module): def __init__(self, in_channels, hidden_channels, out_channels, num_layers, dropout): super(MLP, self).__init...
c94d0c4f4578627e6d370faff10830d6a50a676012ddb9c3d6a193761eaaeace
Python
4,138
104
import argparse import utils import keras from keras.models import load_model from os.path import join import numpy as np import gc ''' calculate standard deviation of ensemble predictions for train/test/val data for DeepSTARR ''' def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("--mod...
2c106e419e2a65e5ee27defcf3457ba6dd74231097deb9cb96a3250e436f11d8
Python
4,140
143
from __future__ import annotations from typing import Final import pytest from PySide6.QtCore import QPoint from PySide6.QtCore import QPointF from PySide6.QtCore import Qt from pytestqt.qtbot import QtBot from labelme._app import MainWindow from labelme._widgets._canvas import Canvas from ..conftest import close_o...
365de9d86a74842c4313e0bafc527eec6268da9701e9b9dfcce1255a448e8761
Python
4,142
107
from collections import OrderedDict from collections.abc import Callable, Mapping from typing import cast from eir.train_utils.ignite_port.base import Serializable from eir.train_utils.ignite_port.engine import Engine from eir.utils.logging import get_logger logger = get_logger(__name__) __all__ = ["EarlyStopping"] ...
c3443393ed9d666d44ab1f384d1b2dad874742fa8f41b2ccc73ef227ac46cc48
Python
4,142
139
# import tensorflow as tf import numpy as np from scipy.special import expit as logistic, logit # from tf_agents.environments import utils # from tf_agents.environments import tf_py_environment from metamdp import * # from metamdp_functions import * import os import json import time ## Optimization hyperparams N_SIM...
1d150d938c228e5203b99263650f707d54de35e8afb09454fef2aa8dcc39a5f6
Python
4,144
205
from seisbench.data.base import WaveformBenchmarkDataset class CREW(WaveformBenchmarkDataset): """ Curated Regional Earthquake Waveforms (CREW dataset) """ def __init__(self, **kwargs): citation = ( "Aguilar Suarez, A. L., & Beroza, G. (2024). " "Curated Regional Eart...
2625d9b45425bd4d765b5a0742d1da1cdcfcc0648c9eafa151d84790c89e0b4f
Python
4,146
108
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import json import traceback from typing import Any from django.dispatch import receiver from rest_framework.renderers import JSONRenderer from rq.job import Dependency as RQDependency from rq.job import Job as RQJob from rq.job import JobStatus f...
b2e7070d0931ee4746ef21793474c8b24d468f1e89ac92a12d98f4884dc8a465
Python
4,146
121
import sys import cebra import os import tempfile import torch import pandas as pd import numpy as np import pickle as pkl import matplotlib import cebra.models import cebra.models import cebra.data from cebra.models.model import _OffsetModel, ConvolutionalModelMixin from torch import nn from scipy import stats from ce...
dfe78d82b39afcae56169f95c2b114772161ee592446044e1bad6730fdb18868
Python
4,146
119
import rsatoolbox from rsatoolbox import rdm from scipy.spatial import distance as D import torch def calc_cosine_rdm(regressor): return D.pdist(regressor, 'cosine') def compute_RDMs_torch(data, metric='correlation', ranked=True): if metric == 'cosine': RDMs = calc_cosine_rdm_torch(data) ...
fde00d577489e4c45227775686baf57bfc28a5868f7d6c19f1afbb263d650ef3
Python
4,146
186
import re def get_user_id(user): return str(user['id']) def get_username(user): return str(user['username']) def get_screen_name(user): return str(user['name']) def has_description(user): des = str(user['description']) if des is None or des == ' ': return False else: retu...
605c2e72f3b32214ecfa7b03a79960c5f4592e8d949cca244086135b4cbfbd61
Python
4,147
85
# -*- coding: utf-8 -*- """ Created on Tue Jan 17 14:56:29 2023 @author: gligorov """ import tensorflow as tf import numpy as np from utils import plot_history def create_model(input_shape, num_classes, dense_layers = [128, 64, 32, 16], conv_layers = True, conv_filters=32, conv_kernel_size= 3, activation='r...
d96d4dd355411d48c4d2c65c88bb8aee9af2bd5a0c4bebde6c63154b19ea11df
Python
4,148
125
#!/usr/bin/env python """ A TCP communications class that provides the basic methods for relaying TCP messages. Jeffrey Moffitt 3/16/14 jeffmoffitt@gmail.com Hazen 05/14 """ from PyQt5 import QtCore, QtNetwork from storm_control.sc_library.tcpMessage import TCPMessage class TCPCommunicationsMixin(object): """...
c6226697edfa26e475ffebd98c32876cce5b4fa51aada6e643376a3368eb96b6
Python
4,149
129
# -*- coding: utf-8 -*- # @Author : LG import os from typing import Union import imgviz import numpy as np import tqdm from PIL import Image from skimage.draw.draw import polygon from ISAT.formats.isat import ISAT class VOC(ISAT): """ VOC format Attributes: keep_crowd (bool): keep the crowded...
c86c161e9335f87e390bb336cc7c4d8960228c4d40f4985e7629778212bda393
Python
4,149
117
import numpy as np from matplotlib.axes import Axes from argclz import AbstractParser, argument from neuralib.plot import plot_figure from neuralib.util.verbose import fprint from rscvp.util.cli import Suite2pOptions, DataOutput from rscvp.util.cli.cli_camera import CameraOptions from rscvp.util.util_lick import peri_...
a90a65e19a191dcf81bb5bc1bd4cf9e0610cafa99a50fa013711b2938f1c72f6
Python
4,150
117
import filecmp import os import string import subprocess import tempfile import unittest from io import StringIO class TestFile: def __init__(self, text=None, filename=None): assert text is None or filename is None, "Cannot specify both text and filename for input" self.text = text self.fi...
bc8ebe70532b650d6f4e241d3b1da54c70018e3819d5c139ba548e02df799091
Python
4,150
148
"""Shared event log for Academy-ChemGraph campaign runs. The dynamic campaign layer treats agent messages and ChemGraph job updates as one append-only event stream. The dashboard and HPC run scripts can consume this file without knowing which science use case created the event. """ from __future__ import annotations...
d55dcca96cd6c10924fc2fb49cbeb66c9cc866efe990b701089c7f803638315d
Python
4,150
120
"""Compute the fMRI response distance (in MDS space) between the different image classes. Parameters ---------- subjects : list List of the used NSD subjects. data_ood_selection : str If 'fmri', the ID/OD splits are defined based on fMRI responses. If 'dnn', the ID/OD splits are defined based on DNN features. ncsnr...
d5f4c179bdd6170e4621011926d8f1a9b619e4a9b516b59ad93f471e9d50202c
Python
4,151
111
import numba import numpy as np import multiprocessing as mp from functools import partial import random # Cite from https://github.com/numba/numba-examples @numba.jit(nopython=True, parallel=True) def get_bin_edges(a, bins): bin_edges = np.zeros((bins+1,), dtype=np.float32) a_min = a.min() a_max = a.max()...
f1891bddc1189207ba739b1bb5d72fde51149109d6245dd09729c7894acd6de2
Python
4,151
137
# -*- coding: utf-8 -*- """Layering tools.""" import os import numpy as np from nibabel.freesurfer.io import read_geometry, write_geometry from ..surface.mesh import calculate_area __all__ = ["calc_equivol_surf", "get_meshlines"] def calc_equivol_surf(file_white, file_pial, n_surfs, hemi, path_output): """The...
05b5ca94d06efcc5bcd7514c3131e1f39f0147078036bd73742296f02ba4a22c
Python
4,152
115
import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from matplotlib.ticker import FuncFormatter from matplotlib.ticker import AutoMinorLocator def main(): merged_final_csv = pd.read_csv( "output/csv_files/raw_data_step4/raw_merged_eval_feature_data_final.csv" ) merged_final_cs...
7085d13ee296cdecbd8ce7d67709a0c375b6187323d8f51d683e993849c73334
Python
4,152
105
import numpy as np from ivim.models import NO_REGIME, DIFFUSIVE_REGIME, BALLISTIC_REGIME, INTERMEDIATE_REGIME from ivim.seq.lte import MONOPOLAR, BIPOLAR from ivim.optimize import crlb D = np.array([0.5e-3, 1e-3, 1.5e-3]) f = np.array([0.05, 0.15, 0.05]) K = np.array([1.0, 1.2, 2.0]) Dstar = np.array([10e-3, 15e-3, 20...
a92bd352e18b92569eae21590d8530dd55ee9a62231b2f89f2afefa62f4270d5
Python
4,152
105
import argparse import os from math import log10 import numpy as np import pandas as pd import torch import torchvision.utils as utils from torch.autograd import Variable from torch.utils.data import DataLoader from tqdm import tqdm from utils import ssim from utils.dataset import TestDatasetFromFolder, display_trans...
4733ae47a090bee4cc24c55a6f56cd23a63bdd9ef242418d3d7b786156f3b925
Python
4,153
106
# Copyright (c) 2026 Rohit Jena. All rights reserved. # # This file is part of FireANTs, distributed under the terms of # the FireANTs License version 1.0. A copy of the license can be found # in the LICENSE file at the root of this repository. # # IMPORTANT: This code is part of FireANTs and its use, reproduction, or...
9921489d298d9f86786a406e1ec966e1d05986bd1e0aa9a5ff62745d9cf6248d
Python
4,153
131
#!/usr/bin/env python # Copyright 2014-2015 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. """ Entry point for the Pyt...
db6b580f339a00ba1e2d1618f382af9077c871bae4fd89b6a0f40ea54d55ad01
Python
4,156
76
from brainscore_vision import benchmark_registry from .benchmarks.cavanaugh2002a_benchmark import MarquesCavanaugh2002V1SurroundSuppressionIndex, \ MarquesCavanaugh2002V1GratingSummationField, MarquesCavanaugh2002V1SurroundDiameter benchmark_registry['Marques2020_Cavanaugh2002-grating_summation_field'] = \ Mar...
f5fd19bafdc522cc03be7ba5bd6cdea23d4bdb3c7129208eb692bb3d0fc31cc2
Python
4,157
107
import torch import torch.nn as nn import torch.nn.functional as F from conf import global_settings as conf_set class Snn_Conv2d(nn.Conv2d): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, ...
edc0859a29118472de6be7a888b70e5edd1da925554837abcfb3acac58420536
Python
4,158
166
""" This module simulates MRI signal based on Bloch equations. Author: Zhengguo Tan <zhengguo.tan@gmail.com> Soundarya Soundarresan <soundarya.soundarresan@fau.de> Julius Glaser <julius.glaser@fau.de> """ import numpy as np import torch.utils.data as data def get_B(b, g): num_g, num_axis = g.shape ...
c159b2377c1584d5a417bc02f1bfdfc66acf4fa8cb51c23de3ef60851f34ec98
Python
4,159
88
import numpy as np from result_caching import store from brainscore_core.supported_data_standards.brainio.assemblies import DataAssembly from brainscore_vision import load_dataset, load_metric from brainscore_vision.benchmark_helpers.properties_common import PropertiesBenchmark, _assert_grating_activations from brains...
74da1bd30ae98ca640a0d4c6019ddc1fc2469614d17dead4a38efa2c5514ce48
Python
4,160
144
#!/usr/bin/env python """ split bam file into .shrt.bam and .long.bam Created by Rongxin Fang Modified by Armen Abnousi """ import sys import pysam import collections from itertools import islice from itertools import combinations import time import os import subprocess import shutil import glob def main(): input_b...
de60c45dcb15aca20940446ac67b74e9a3d98e5687329844a3b16cd4b4d4061b
Python
4,160
186
import re def get_user_id(user): return str(user['id']) def get_username(user): return str(user['username']) def get_screen_name(user): return str(user['name']) def has_description(user): des = str(user['description']) if des is None or des == ' ': return False else: retu...
eb94cd011014d1f2ddeda4d8e0e03c6ba638ea250125b3b6ad07731efd354406
Python
4,161
116
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT """List the jobs of an existing task or project with their stage, state, and assignee, optionally as a CSV report. Steps: 1. Query jobs scoped to --task-id or --project-id, most recently updated first. --stage / --state filter server-side, so...
1944304a1beeaa79baa24016d3c85324a842f61441bbd7c34684fa6f2362e3f9
Python
4,162
100
# A hyperparameter optimisation of MPNN model using approach # from Greenman et al. https://doi.org/10.1039/D1SC05677H # original training data was cleaned and enriched with natural colourants data # training goes on GPU the chemprop must be configured accordingly import numpy as np from hyperopt import hp, fmin, tpe,...
84125f1d5994ce9bcfaf76e3096fa63e3a6c7e46ab55a96b4adac5d46f3e5f39
Python
4,163
106
# Specify the directory of the QSMnet+ code from Github # QSMnet_HOME = '/project/3015069.05/bids/code/QSMnet/'; import sys import os sys.path.append(os.path.join(QSMnet_HOME,'Code')) import tensorflow as tf import scipy.io import time import network_model import numpy as np from utils import * # # Description : # ...
3daafd78f7e33639f083484891aa44ab668b257346c956506767c919d3ebf4be
Python
4,164
135
#!/usr/bin/python3 # import os import sys import argparse from sklearn.neighbors import NearestNeighbors from uac import utils # Create the parser my_parser = argparse.ArgumentParser(description="Calculation of new atrial coordinates for RA") # Add the arguments my_parser.add_argument("target_path", metavar="path", ...
98fd7b4edc7bb5c32d151506691d6c14ac3379bed52a17b941e4de5d92d0eafe
Python
4,165
133
import argparse import h5py import os import pathlib import torch import yaml import matplotlib.pyplot as plt import numpy as np import sigpy as sp from sigpy.mri import muse import torch.nn as nn import torch.optim as optim from deepdwi import prep from deepdwi.models import mri from deepdwi.models import autoencod...
fba9394e90c7384fa50888cd771776a533ff529146747fa6499a8000ad1d9e13
Python
4,166
104
# Copyright 2024 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
73f0ca550432cc761fb60a143bed7606eaa1b01248fe1e9273283a1b3b9ef9f6
Python
4,167
95
import csv import os import pkgutil import re from typing import Dict, List, Optional, Union from .dataset_info import DatasetInfo # NOTE no ambiguity wrt to mapping from # classes to ImageNet subset so far, but likely to change _NUM_CLASSES_TO_SUBSET = { 1000: 'imagenet-1k', 11221: 'imagenet-21k-miil', # m...
04ab8d110ac154fda37e9bb0dd21eeab5a47aabaac79d7d1d68ace0f32d3f777
Python
4,169
105
import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy import stats def analyze_middle_20_slices(data, use_unnormalized=True): # grab middle 20 slices from each series and average them series_averages = [] # pick which column to use fosb_column = 'mean_fosb_per_pixel_ast...
a6d57f86896ef4353a92432f00ce3c4db52005d1e4f518df8a9abcfe6e1217b9
Python
4,170
80
import numpy as np import torch from threadpoolctl import threadpool_limits from nnunetv2.training.dataloading.base_data_loader import nnUNetDataLoaderBase from nnunetv2.training.dataloading.nnunet_dataset import nnUNetDataset class nnUNetDataLoader3D(nnUNetDataLoaderBase): def generate_train_batch(self): ...
ec0a0d304f9facb98f78b1cf8e0bf4ab9cba20602272eaf70ac91f1119d72d2b
Python
4,170
107
import os import glob import json import sys import shutil from os.path import join as ospj from smriprep.interfaces.surf import normalize_surfs ######################################## # Set variables and dirs ######################################## # Parse command-line arguments subject = sys.argv[1] config_file =...
858e712c5728515b82a2dccbe946949ac10e99491e1b433462a8c26cea566a0a
Python
4,171
149
# FetMRQC_SR: Quality control for fetal brain MRI # # Copyright 2025 Medical Image Analysis Laboratory (MIAL) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lic...
962a5b64373c842110c4053b9ec4ef781786f8818098756ed06483a989814a9d
Python
4,171
87
import numpy as np import os from brainscore_core.supported_data_standards.brainio.assemblies import NeuroidAssembly from brainscore_core.supported_data_standards.brainio.stimuli import StimulusSet from brainscore_vision import load_ceiling, load_metric, load_dataset from brainscore_vision.benchmark_helpers.neural_comm...
c001c4ae39eba072128d3d405b21c1b3d46acbc81b9249ef305e5277d7ea9ef6
Python
4,172
137
import nibabel as nb import numpy as np import glob from matplotlib import pyplot as plt from sklearn import metrics as skm from argparse import ArgumentParser def adjusted_mutual_info(atlas1, atlas2): """Calculate adjusted mutual information between two atlases Parameters ---------- atlases : [type]...
9da9bf1f760bb5b7a1e1a63712b5954986ad5d8d70a0a18cfb0efeea2aab9d5c
Python
4,173
114
import arbor as A from arbor import units as U class recipe(A.recipe): def __init__(self, n): # Call our parent; needed for proper initialization. A.recipe.__init__(self) # Cell count; should be at least 3 for the example to work. assert n >= 3 self.cells = n # Unif...
cc2c071b0b85f3237c37e82f34e576769605c4640d77e613929804b7ad64bbaa
Python
4,174
100
import sys import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader from geoseg.models.MixerUnet import reparameterize_model from geoseg.losses import * from geoseg.datasets.cvc_clinic import CVC_Dataset from geoseg.models.MixerUnetcopy import Rep_UNET_down from catalyst i...
9ff7c3804225ea3d000d0c10cd76ae3fad6ca1e1666e8186b9ee3eac4d811f9f
Python
4,175
129
"""resnext in pytorch [1] Saining Xie, Ross Girshick, Piotr Dollár, Zhuowen Tu, Kaiming He. Aggregated Residual Transformations for Deep Neural Networks https://arxiv.org/abs/1611.05431 """ import torch.nn as nn import torch.nn.functional as F #only implements ResNext bottleneck c #"""This strategy exp...
c35e87a1c57eb72fbc580f421f1b48cc26ed595045b3768055474cc2c5f44a31
Python
4,176
98
import matplotlib from numpy import loadtxt from fig import module_utility import numpy as np import matplotlib.pyplot as plt from pathlib import Path sub_group = list(range(1, 29)) sub_group.extend([30, 32,33,34,35]) # exp data num_subject = len(sub_group) angle_colume = 19 # col20 subj10 (do not forget -1) num_sa...
8eedb2851e83de1b8492043aa64e089e0383775fa0bdb02d3e0fcf74980e943b
Python
4,177
119
# Copyright 2025 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
d387179a540488720dafa5ebaa1d0b809af9dd3b7ac082635e39fe579dd4a262
Python
4,178
127
# 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...
4ee738d77cd93328a229a280d9c4fa6d971de8bc6d175f114d668171f7b01e4a
Python
4,179
90
import argparse import torch import pandas as pd import esm from tqdm import tqdm import constants device = torch.device("cuda" if torch.cuda.is_available() else "cpu") # Define the command-line argument parser def create_parser(): parser = argparse.ArgumentParser(description="Compute log-likelihood ratios for DMS...
f601992504291340d34ec3a56307cc104ab5acc7754aaec6c7eb30f36446e48c
Python
4,179
104
"""What the number in a lag/bin folder name means, and what to call it. Every functional-connectivity measure in the pipeline has one timescale parameter, and every output is filed under it — ``1000mslag/``, a ``Lag`` column, a ``Lag1000ms/`` group folder. But the parameter is not the same thing in each measure: * **...
05783156747fbecf45863dc7fd30e689bb17ab8fefbaf264c72549e4df60b129
Python
4,180
113
import os import numpy as np import pandas as pd import time as tm from sklearn.svm import LinearSVC import rpy2.robjects as robjects from sklearn.calibration import CalibratedClassifierCV def run_SVM(DataPath, LabelsPath, CV_RDataPath, OutputDir, GeneOrderPath = "", NumGenes = 0, Threshold = 0.7): '''...
6fde7e6ca39ed42a6246d3a86c21959d4b3f563ce4ee1654882076a382c617eb
Python
4,180
100
import sys import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader from geoseg.models.MixerUnet import reparameterize_model from geoseg.losses import * from geoseg.datasets.cvc_clinic import CVC_Dataset from geoseg.models.MixerUnetcopy import Rep_UNET_down from catalyst i...
4d419b0dc245fe0f7a1b9d85c2c281a0798babd70a18038ab93e1805e07c992a
Python
4,181
138
from collections.abc import Sequence from dataclasses import dataclass from typing import TYPE_CHECKING import pandas as pd from eir.data_load import label_setup from eir.data_load.label_setup import ( TabularFileInfo, al_label_transformers, transform_label_df, ) from eir.experiment_io.label_transformer_i...
4a1dba80efe5000cc483316f2cfaa5c1ed7ef858dd9b932416fdcc97a596a070
Python
4,182
83
from tensorflow import function as tf_function, where as tf_where, GradientTape from tensorflow.math import reduce_mean, square, abs as tf_abs LAMBDA_CYC = 30 class Discriminator_trainer: def __init__(self, discriminator, generator, optimizer): self.discriminator = discriminator self.generator ...
d0df48efd9266c83ceaeb9461974f5c6a04f76c5d03e1a68c517f29b4cddb25a
Python
4,182
113
import numpy as np def GenerateSpikes(IntensityFunc, MaxRate, PositionFunc, TotalTime): # Start by generating spikes for a homogeneous Poisson process nHomogeneousSpikes = np.random.poisson(MaxRate * TotalTime) tHomogeneousSpikeTimes = np.random.uniform(0, TotalTime, nHomogeneousSpikes) tHomogeneousSp...
16c9e21e3a452ab213dbbfcac0a6872e077e3436b2c275ff2d3d774621e28c0f
Python
4,184
121
import brainpy as bp import brainpy.math as bm import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec import scipy import sys, os sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from cann import CANN1D from matplotlib.animation import FuncAnimation ...
58579685fd001eed4fdb5a1f25a6ea9204ace424516b15b50f60f9c6d4df744a
Python
4,184
115
from argclz import AbstractParser, union_type, str_tuple_type, as_argument from neuralib.plot import plot_figure, ax_merge, plot_peri_onset_1d from rscvp.behavioral.util import * from rscvp.behavioral.util_plot import * from rscvp.util.cli.cli_output import DataOutput from rscvp.util.cli.cli_stimpy import StimpyOptions...
d2c2e7b500e584d7aa391d19a57e7c9395aaf24a0b613598c32a7d8a843303fa
Python
4,184
133
# System cutoff techniques for local analyses # Imports import sys import ase import ase.io import ase.atoms import numpy as np def find_atom_order_to_interface( mol_xyz: ase.atoms.Atoms, clus_xyz: ase.atoms.Atoms, site_size: int ) -> ase.atoms.Atoms: """From the molecule and cluster xyz files, returns two l...
d44894341213c24009339de3ab3f59374872502026671e25b41ea9b4b63a05f1
Python
4,184
59
from brainscore_vision import benchmark_registry from . import benchmark DATASETS = ['colour', 'contrast', 'cue-conflict', 'edge', 'eidolonI', 'eidolonII', 'eidolonIII', 'false-colour', 'high-pass', 'low-pass', 'phase-scrambling', 'power-equalisation', 'rotation', 'silhouette', 'ske...
4f9c2f48a378cf92bfde0321ca9512de25cd61fa51ea873f0d55de1eb646346e
Python
4,185
147
# 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. import torch from functools import partial from .modeling import ImageEncoderViT, MaskDecoder, PromptEncoder, Sam, TwoWa...
8f145f421b66983255bdcd06613ed6279a442cdb20bc7fa6a389fbed0e71a005
Python
4,185
135
############################################################################# ### Recursively moves through directories and extracts parameters and the ### ### mean firing rates of neuronal subpopulations ### ############################################################################# ### Cop...
4b0c36e325a1bde72b850a9b503a7848ebcf335bce9e819a8c98b1d17a4536ff
Python
4,186
110
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Save connections as TRK to HDF5. This script is useful to convert a set of connections or bundles to a single HDF5 file. The HDF5 file will contain a group for each input file, with the streamlines stored in the specified space and origin (keep the default if you are ...
b5d329ae97ed6b7da0bbf47011c14b6fe4179e15caf9c722713e7f938455f340
Python
4,186
107
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT """Inspect an existing task (labels, jobs, frames), export its dataset to a local zip, and export its event log to report quick analytics. Steps: 1. Retrieve the task and print a summary: labels, jobs (stage/state), frames. 2. Fetch the server's...
da8e801533edf42651997569fe57bd2ee328a382636c4afe4320d7fa206d0bc8
Python
4,186
123
''' ClH2O ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for FH2O: P: potential energy, G: Gradient, D: Nonadiabatic coupling vector This is listed at the end of description to show the availability. For example: P/G means both potential energy an...
e99e6ec6803b8627d91b560e00ddb55f8d9f85d014c697f9ab96f0ef5490d944
Python
4,186
146
from __future__ import annotations import json import pytest # Skip when the optional 'academy' extra is absent. The dashboard # module itself is pure stdlib, but the import guard is applied # uniformly across the academy test suite. pytest.importorskip("academy") import chemgraph.academy.dashboard as dashboard fro...
d3a96752fbca76588550c3a7b858e1d8b05184c4033e353d97988098e1dbf5b1
Python
4,187
125
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved """Necks are the interface between a vision backbone and the rest of the detection model""" from copy import deepcopy from typing import List, Optional, Tuple import torch import torch.nn as nn class Sam3DualViTDetNeck(nn.Module): def __...
fee49bc226227252c2bc4920e040c394a4ac74a3008f101714ae29e66271c417
Python
4,187
107
#!/usr/bin/env python3 # -*- coding: utf-8 """ Script that runs cell2location on simulated data, sent from Vitalii Created on 2020/02/03 @author romain_lopez """ import os # this line forces theano to use the GPU and should go before importing cell2location os.environ["THEANO_FLAGS"] = 'device=cuda0,floatX=float32,f...
86145d8da594ebcc549b09e1040eaad7b9a3cbe48f06c6ecd76c90b15d0c2f6b
Python
4,188
118
import argparse import os def gen_rosetta_script_xml_str(variant, template_fn, offset, chain): """ Generate RosettaScript XML string from mutation variant(s). Parameters: variant (str): Mutation string, e.g., "A23D,C45K" template_fn (str): Path to the template directory (without filenam...
ec14a987173cce9797f50b245eb660c420939079f36448ed685b97215fb92790
Python
4,188
122
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2017 Timothy Dozat # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless ...
4e595a9395a2a14249f628bfba668e602c58ed617337498183a1d08e591f467d
Python
4,190
99
from torch_geometric.loader import DataLoader import scanpy as sc import torch import torch_geometric #from torch_cluster.knn import knn_graph from sklearn.neighbors import kneighbors_graph import numpy as np from scipy.spatial.distance import pdist, squareform def get_dataset_loaders(h5ad_path: str, sample_id_name: ...
27876088fec6b1e418055fe847055f886c7d58518705b70b1ad93595d704fcc0
Python
4,191
96
from qtpy.QtWidgets import QWidget, QDialog, QLabel, QPushButton, QLineEdit, QFileDialog, QVBoxLayout, QSpinBox from napari_dmc_brainmap.utils.general_utils import split_to_list from typing import List, Optional, Tuple class GeneInfoDialog(QDialog): """ Dialog for entering gene information, including file sele...
1274ad1b129b33c0261a4eb0469e23bad294d533d0322287810743c250858298
Python
4,193
128
# 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. from functools import cmp_to_key from nab.de...
14110a620b833a6426e676c8347dda7b651b84bb0b833b0b7fb5c725972d0fa5
Python
4,193
128
# src/config.py """ Central configuration for the strabismus-surgery ML project. Usage ----- >>> from src.config import C >>> C.DATA_PATH PosixPath('.../data/Data_M1D6_Preproc.csv') """ from __future__ import annotations import os import random from dataclasses import dataclass, field from pathlib import Path from...
e2213867da86a611c737456d38c8a43defa25352fc426db138a05bc25fda82c6
Python
4,194
83
"""One colour per cell type, shared by the tracking pages. Both the per-cell page and the run viewer's network view can colour cells by every marker at once. They are separate pages, so the rule lives here once as a JavaScript snippet each of them inlines, and the two can never disagree on what a colour means. The ru...
410da52a15376576f049ee3eae0a55cf6b1b8e1c1d3f5ee4f07371315eb66753
Python
4,196
123
import os.path as op import typing as t from pydantic import BaseModel, StrictBool, ValidationInfo, field_validator from .errors import FileExtensionError class modelmrtrix(BaseModel): """Define model validator for common MRtrix3 CLI options.""" input: t.Optional[t.Union[str, t.Any]] = None output: t.O...
0e1fb591987c4e46e29c42ec6b08ae6752cbfaab464d34a2881d0a95919c290d
Python
4,197
129
import numpy as np import pytest from ase import Atoms from chemgraph.tools.ase_tools import ( run_ase, ) from chemgraph.models.atomsdata import AtomsData from chemgraph.models.ase_input import ASEOutputSchema, ASEInputSchema def is_fairchem_installed(): try: import fairchem.core return True ...
d7b70c9e23ad5ffd7b39a87d0eb638bf96757f2029c23e6ac673f76a1ee31b44
Python
4,197
100
import sys import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import DataLoader from geoseg.models.MixerUnet import reparameterize_model from geoseg.losses import * from geoseg.datasets.cvc_clinic import CVC_Dataset from geoseg.models.MixerUnet import ConvMixer_UNET_down from catalyst ...
44f713f1b66c7502eafdb8cce8b81a35a060dfff08eb3199085cc8dde132a2bb
Python
4,199
119
# %BANNER_BEGIN% # ------------------------------------------------------------------------------------ # # # # # # # ------------------------------------------------------------------------------------ # %AUTHORS_BEGIN% # # Creator: Vishal Sharbidar Mukunda # # %AUTHORS_END% # -----------------------------------...
9644929af4fb2f2f9f013792c7655fe489313b9ce3cade7dc477d031b48c9681
Python
4,200
73
''' embeddings::power.py Common functions for power simulations. Available as embeddings.power.* ''' from .internal import * import numpy as np from scipy.stats import chisquare as chsq from scipy.stats import ttest_ind as tt_ind def chisquare(N: int, R: int, p: np.ndarray, k: int = 1e4, alpha: float = 5e...
c03578140ac5b8f20d7afc5e9e43ddc54386c4117bac235f7c98f1e4632d668f
Python
4,201
129
# -*- coding: utf-8 -*- """Estimate scan-to-scan repeatability.""" import os import random import matplotlib.pyplot as plt import nibabel as nb import numpy as np from nibabel.freesurfer.io import read_label, read_morph_data from scipy.stats import pearsonr __all__ = ["estimate_reliability"] def estimate_reliabili...
fae6d8a9361d0db9a6f2c5565066fff363fb1cd15eccbe95963465fb1ecd301a
Python
4,201
156
"""Elekta Task Dataset: AE-HMM Pipeline. In this script we train an Amplitude Envelope Hidden Markov Model (AE-HMM) on source reconstructed task MEG data. The examples/toolbox_paper/elekta_task/get_data.py script can be used to download the training data. Functions listed in the config are defined in osl_dynamics.co...
79cd869a9cc7a530ed9ff5327a68cc167512e74368da0f58202a9d431b2c8cc9
Python
4,203
119
"""Ground-truth dataset loading and validation for ChemGraph evaluation.""" import json from pathlib import Path from typing import Any, Dict, List, Optional from pydantic import BaseModel, Field from chemgraph.utils.logging_config import setup_logger logger = setup_logger(__name__) class GroundTruthItem(BaseMode...
d2c2ccf8d2145f52d5e372b9024858302d460eaf7fd2b699722dc9a0e68dca65
Python
4,203
109
import os import numpy as np import pandas as pd import time as tm import rpy2.robjects as robjects def run_ACTINN(DataPath, LabelsPath, CV_RDataPath, OutputDir, GeneOrderPath = "", NumGenes = 0): ''' run ACTINN Wrapper script to run ACTINN on a benchmark dataset with 5-fold cross validation, ...
5b1dd5753b2fc046b030f8e756fcef7f9f8dc7e5536fe75dd4214746d9f02a72
Python
4,204
132
from __future__ import annotations import os import tempfile from collections.abc import Sequence from io import StringIO from pathlib import Path from typing import Final from ruamel.yaml import YAML from ruamel.yaml.comments import CommentedMap from ruamel.yaml.comments import CommentedSeq from ruamel.yaml.error im...
95d44352d1b51233a202bf2b1341364852fc19ee8b70e76f1a7338dd51b9ccea
Python
4,204
116
import numpy as np from scipy.sparse import csr_matrix def compute_sparse_decisions(bundles_being_recognized, n_streamlines): """ Compute a sparse matrix of distances to ROIs for the streamlines that are currently being recognized. This can be used to weight decisions by distance to ROIs, without havi...
a4b6aa2537aaaf89a367231c7461da647fd84496fa7fb3a22c9653dfaa840518
Python
4,204
98
#%% from deep_events.database.extract_yaml import MAIN_PATH from deep_events.database import get_collection, get_cluster from pathlib import Path from pymongo import MongoClient from benedict import benedict import tifffile import os import shutil def main(folder = MAIN_PATH, collection='mito_events'): #pragma: no cov...
2657891a2af7ff2c10a0bacc891e900570a14f1e5c9857d776bdd3273dfefe38
Python
4,206
131
import unittest import numpy as np class TestUtils(unittest.TestCase): # Correctly identifies and replaces outliers in a 1D numpy array def test_hampel_filter(self): from dynamont.segmentation.utils import hampel signal = np.array([1, 1, 1, 10, 1, 1, 1]) expectedOutput = np...
489e2b8393b9e23ae3fb3303f3efc85b766751454c712e2abcee3382c0376d5c
Python
4,206
93
#!/usr/bin/env python #!/usr/bin/env python import warnings warnings.filterwarnings("ignore", message="numpy.dtype size changed") warnings.filterwarnings("ignore", message="numpy.ufunc size changed") import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.externals import joblib from PAINTeR...
400764e5faa12aae1d3ef100d67199c3bc1c692d7968b2f079df4f1e2dafe065
Python
4,207
136
# This script will import Cytosim's filaments into Blender # It must be run from within Blender, and will read "actin####.txt" files # to generate a collection of NURBS spheres # # The input files should be generated by Cytosim's tool "cymart" # and copied to a local blender directory called 'cymart' # # Authors: Richa...
b844e7ff8ab37d4ca11a462f9026d46a2456635e055e55fc5dd3282595dd80df
Python
4,208
120
import jax.numpy as jnp import matplotlib.pyplot as plt import glob import sys import os import re import json plt.rcParams["font.sans-serif"] = ["DejaVu Sans"] # Best available plt.rcParams["font.family"] = "sans-serif" plt.rcParams.update({ "font.size": 10, "axes.titlesize": 10, "axes.labelsize": 8...
3c6e7f392527eeab9bc3e3bd7a6bc424df003b862bee4db1385c90becbcbfaf9
Python
4,209
112
import numpy as np import warnings import scipy.io as sio from scipy.stats import pearsonr from sklearn.model_selection import cross_val_predict from sklearn.kernel_ridge import KernelRidge K = 10 run_session = '1LR' mykernel = 'cosine' # cosine linear alpha_list = [0.1,1,2,5,10,15,20,50,80,100,150,200,300,1000,100...
c01e68da8ed3d5873e9f2cd40bebd68024589ae1af19215c44bc78b373cf07e1
Python
4,209
164
import copy import torch import optuna from torch.optim.lr_scheduler import ReduceLROnPlateau from utils import ( device, clip_gradients ) from save import save_embeddings def train_epoch( model, optimizer, data_loader, loss_fn, max_grad_norm=5.0, clip_method='n...
29b48eed8597327fd51d62f2c98bc95cb53e754c482eed282acb0c1965d4d3f7
Python
4,210
100
import pytest pytest.importorskip("fireants_fused_ops") import torch from time import time from torch import nn from torch.nn import functional as F from fireants.interpolator.grid_sample import torch_affine_warp_3d from fireants.interpolator.fused_grid_sample import fused_affine_warp_3d import itertools # set seeds ...
a9ebb6505279d976740c63449430d03a4ab38daecb40153daf5e8209d84c59d0
Python
4,211
106
# 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. import torch from torch import nn from torch.nn import functional as F from typing import Any, Dict, List, Tuple from .imag...
6a2ae5823e351918b6f7d38ec2afe244b841898f5609eebb3ee4ccfb6c6d460b
Python
4,212
128
""" Example usage of HarveST package """ import os from harvest import Harvest import torch import numpy as np import random 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.see...
469db54c96d72b4b8440b70c4adce4dbcd9ebcc7b7ced205c205afd60863f673
Python
4,214
148
# Copyright 2014 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 copy import numpy as np import os import pandas...
694ccac5f57804f8d6402cefc429db4b7db4755355858aeecf4f3a974806a58e
Python
4,214
128
import os import pandas as pd from util.config_vars import config from step3_1_get_features.step3_b_sim import ImageComparison2D from step3_1_get_features.step3_a_3drender import Make3DRender from step3_1_get_features.step3_c_voxel_analysis import VoxelAnalysis CSV_HEADERS = [ "Original Nifti", "Defaced Nift...
4e427fbb232ed0c120074548905577f237daaa9b8c6af18987f8fa012074c4fc
Python
4,215
114
import argschema as ags import numpy as np from skeleton_keys.io import read_bytes, read_csv from skeleton_keys.cmds.process_morphology_features import ( select_and_convert_depth_columns, analyze_depth_profiles, ) from skeleton_keys import cloudfields class CalcHistogramLoadingsParameters(ags.ArgSchema): ...