sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
32e013918b9584244a70622935a86fcb948747d3a7ca4af1e8ff5fcf2cef50b5
Python
3,360
73
import functools from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from brainscore_vision.model_helpers.check_submission import check_models from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file from brainscore_vision.models.mobilenet_v2_0_5_192.model impo...
4b3a3be0c4e51ce762eeb1d3e5e5b7de82f858e438a1d24ad91716f6ea213dab
Python
3,360
73
import functools from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from brainscore_vision.model_helpers.check_submission import check_models from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file from brainscore_vision.models.mobilenet_v2_0_5_192.model impo...
8dcc591532f7d5ea97dfac212ef5ef40f1c02ba986f581d61eec361f27a78d80
Python
3,360
92
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from django.core.management.base import CommandError from django.db import migrations OLD_APP_LABEL = "auth" NEW_APP_LABEL = "iam" CONFLICTING_USER_CONTENT_TYPE_ERROR = """\ Cannot re-label the user content type: the "{db_table}" table holds both "...
d313d58ec57a5da73e0652a26bd03257d86350cf908d420a517b635225842b09
Python
3,360
73
import functools from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from brainscore_vision.model_helpers.check_submission import check_models from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file from brainscore_vision.models.mobilenet_v2_0_5_192.model impo...
dc39a4e69d6fb2ecfae6b27db7c95fb33c0695f942419bb48e999b7301ab39ab
Python
3,360
73
import functools from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from brainscore_vision.model_helpers.check_submission import check_models from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file from brainscore_vision.models.mobilenet_v2_0_5_192.model impo...
df1f3c49123037792f0ba846baa84c0f60806a6b1c172316577acb57ef5477c1
Python
3,360
103
from torch.utils.data import DataLoader from geoseg.losses import * from geoseg.datasets.vaihingen_dataset import * from geoseg.models.DCSwin import dcswin_small from catalyst.contrib.nn import Lookahead from catalyst import utils # training hparam max_epoch = 70 ignore_index = len(CLASSES) train_batch_size = 8 val_ba...
a41db6106a0b468c5018e913f8280b451c601d4a74d29624a5347ba3ba4638e3
Python
3,361
113
"""Functions and routines to get ZBrain, brain and regions, contours.""" import os import sys import h5py import numpy as np def get_vals_from_ref(file, ref): """Handle h5 file referencing system. :file: <HDF5 file> .h5 file opened with h5py. :ref: <HDF5 object reference> hdf5 reference. return ...
bf2f1b91935fab75a784f4a41d1da493d606966fd2f9b3e0dad6db65d7900fc4
Python
3,361
102
#!/usr/bin/env python """ Peak finder for use by the camera based focus locks. This version requires the storm-analysis project. Hazen 11/17 """ import numpy import tifffile import storm_analysis.sa_library.dao_fit_c as daoFitC import storm_analysis.sa_library.fitting as fitting import storm_analysis.sa_library.ia_u...
00f9d8c1f687f1fb2fdb10ffce83bb25093dee92284f1368959d1e2e84feea73
Python
3,362
73
import torch import torch.nn as nn import copy def generate_train_id(num_class, test_ids): train_idxs = list(range(num_class)) for test_id in test_ids: train_idxs.remove(test_id) return train_idxs def generate_negative_samp_id(id_list, test_ids): neg_samp_id = copy.deepcopy(id_lis...
61252778ccfe1c57d6223fd660324483044a03cdaacda2d99416676eff72aa53
Python
3,362
84
import pytest from bism.backends.unet import UNet_2D, UNet_3D from bism.backends.unext import UNeXT_2D, UNeXT_3D from bism.backends.r_unet import RUNeT_2D, RUNeT_3D from bism.backends.cellpose_net import CPnet_2D, CPnet_3D from bism.modules.runet_block import RBlock2D, RBlock3D from bism.modules.residual_block import...
c8d1538d925b4947ff3887b68e515cc99ce7b7100967acf30878bf2011f86818
Python
3,362
107
import torch import numpy as np import glob import os from deepcardio.neuralop_core.transforms import UnitGaussianNormalizer from data_processing import CustomDataProcessorGINO from torch_geometric.loader import DataLoader from torch_geometric.data import Data DataScaler = UnitGaussianNormalizer def create_grid(mi...
e7735af64d9e5e11fcd349a233a859c30d49aef68575396ff1e22ea69af3f21b
Python
3,362
90
"""Flat @tool variant of the ALCF IRI Facility API integration. Comparison baseline for :mod:`chemgraph.tools.alcf_iri_tools`. Instead of exposing 7 category-dispatcher tools (each with a discovery protocol), this module generates one @tool per action -- ~43 tools bound to the LLM upfront. Purpose: benchmark the cate...
3c14392c3affd12e02b6e3364c6a26b78e58ca7f4f9814afd5a2a38fe32157b7
Python
3,363
113
# -*- coding: utf-8 -*- """ Created on Fri Aug 18 18:23:26 2023 @author: DELINTE Nicolas """ import numpy as np from tqdm import tqdm from itertools import combinations from unravel.core import get_microstructure_map, get_weighted_mean def get_metric_along_trajectory(fixel_weights, metric_maps, roi_sections, ...
da67e37500c73297bb7692065b0e907074e9d8203747befc20c44c837f83d21c
Python
3,364
74
import sys sys.path.append('..') import torch import torch.nn as nn from mace_layer import MACE_layer from layers.predictor import Predictor, MixtureDensityNetwork from models.graph_models_pyg import mdn_message from layers.pooling_pyg import SumPoolingPyg, WeightAndSumPyG, WeightAndMeanPyG, AttentiveFPPoolingPyG, Wei...
960fe6435c315f907f9d4d2bd399ff9738c80591bf19041a567c5885d23c66c8
Python
3,365
76
""" Code to perform 3d stack segmentations. """ from bl3d import models, utils import torch import numpy as np from os import path #torch.backends.cudnn.benchmark=True # time efficient but memory inefficient def segment(stack, method='ensemble', pad_mode='reflect', seg_threshold=0.8, min_voxels=65, max...
076cbdf99c8c47fbb4552d6ff3b811cb38c9f2c6be44eef4cc1c1e0a75dfc21d
Python
3,366
74
import functools from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from brainscore_vision.model_helpers.check_submission import check_models from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file from brainscore_vision.models.mobilenet_v2_0_5_192.model impo...
5b2c7dec7b6a9f7305a76f4de936abb2cd4514f529d522b1a036c0eb1b948a1a
Python
3,366
96
import bism.utils.cropping import waterz import os.path import os import torch import torch.nn as nn from torch.cuda.amp import GradScaler, autocast import torch.optim.swa_utils from bism.models.construct import cfg_to_bism_model from bism.utils.io import imread from tqdm import tqdm import fastremap import numpy a...
3c68e98e91ceba49a5806672e8276a301ad9cf3371b3cbddc1f1626997183584
Python
3,367
96
import os import numpy as np import nibabel as nib from scipy import ndimage from nipype.interfaces.base import ( BaseInterface, CommandLine, CommandLineInputSpec, BaseInterfaceInputSpec, TraitedSpec, File, Directory, ) from traits.api import Enum, Str, Bool, File import hipsta from cvdpro...
ef392d54cd52c88fabaf1d7d99e9b8ab54c1e7d2907f82c691df183e66000dd4
Python
3,367
122
import unittest import warnings from unittest.mock import patch from rscvp.statistic.sql.main_osds_pie import OriDirPieStat from rscvp.visual.main_polar import VisualPolarOptions from rscvp.visual.main_reliability import VisualReliabilityOptions from rscvp.visual.main_sftf_pref import VisualSFTFPrefOptions from rscvp....
ddcb47cbc9ed959b3d662776ddeab2899be1d22682f544fdbcc0b16ec8fb7533
Python
3,369
79
import os import pandas as pd import matplotlib.pyplot as plt from importtdt07 import data_estractor import sys import re lista_dataframes = [] errors = [] # Inicializa la lista para almacenar errores def buscar_subdirectorios(directorio_raiz): patron = re.compile(r'\b[1-9][0-9]?-[1-9][0-9]?-.*\b(ODD|ASC|DESC).*...
fdd0ffa61538b825006579b64a8686f0fa5940ba3b4a9346eede8356066cbb34
Python
3,369
121
import inspect import re __all__ = ["parse_numpy_docstring"] def _white_space(text): if text is None: return None else: return re.sub(r"[\n\t\s]+", " ", text).strip() def _split_parameter_blocks(docstring): # First extract just the Parameters section params_section = re.search( ...
0260550d224390b20b7fca0b8d43de50801c2fce1dc973b71e20eb76bb4dbee5
Python
3,370
99
import os.path as op from typing import Union import matplotlib.pyplot as plt import nibabel as nib import numpy as np from matplotlib.ticker import AutoMinorLocator def plot( input: str, output: str, bval: Union[str, None] = None, mask: Union[str, None] = None, ) -> None: """Plots and saves the ...
79da7815ab06ef2a973402c80ddab9179c8371ccfab7008232bf21f6b3396c0b
Python
3,370
62
#!/usr/bin/env python3 # Author: Francois Aguet import argparse import subprocess import os from datetime import datetime import gzip import pyBigWig parser = argparse.ArgumentParser(description='Computes coverage in bigWig and/or bedGraph format from input BAM.') parser.add_argument('bam_file', help='Input BAM file'...
2953460f26169a891074c1d9806ba2d7c526d5135ec47ea92f415270518ee8b2
Python
3,371
74
import faiss import torch import logging import numpy as np from tqdm import tqdm from typing import Tuple from argparse import Namespace from torch.utils.data.dataset import Subset from torch.utils.data import DataLoader, Dataset import visualizations # Compute R@1, R@5, R@10, R@20 RECALL_VALUES = [1, 5, 10, 20] ...
a93a68010c4a41b3512cfd47793258d1eccf13442962657818dd1a44dc189228
Python
3,371
92
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
b5fe2fabc6938848980507ac8fe4f621ed6fbf8d1c1b2bfc11bae78b77c5f4c6
Python
3,371
110
''' HO3 ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for HO3: 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 and g...
25f137027a7c4d13702124339b4bfa40b562c80ac386825a13cbb8b05dc568f9
Python
3,372
61
"""Average motion corrected (aka registered) echos.""" import os import numpy as np import nibabel as nb NII_NAMES = [ [ "/home/faruk/DATA-PT35_SLABS/derived/sub-10_WB_crop/01_mag/02_upsample/sub-10_ses-01_run-01_dir-def_part-mag_ME3DEPI_crop_echo-1_ups2X.nii.gz", "/home/faruk/DATA-PT35_SLABS/derived/su...
6a0a8c0515fa9f999dca1eb055e5e164b82db00a7411549bd66cbfeaea88ae99
Python
3,372
82
"""Joystick action space for controlling agent avatars.""" from moog import action_spaces from dm_env import specs import numpy as np class Joystick(action_spaces.AbstractActionSpace): """Joystick action space.""" def __init__(self, scaling_factor=1., action_layers='agent', constrained_to_x...
6a9c312626722e7a9efa6279e153cd282037d3ccb7005a872fe15b49d4cb8895
Python
3,372
98
from deepreg.callback import build_checkpoint_callback from deepreg.registry import REGISTRY from deepreg.util import build_dataset import deepreg.model.optimizer as opt import deepreg.train as train import tensorflow as tf def set_GPU(device): gpus = tf.config.list_physical_devices('GPU') if gpus: tr...
e8be55af1b750493274aeb8cfac90f1a2306dfd167726652d52fb44d6d0628ce
Python
3,372
48
# NOTE timm.models.layers is DEPRECATED, please use timm.layers, this is here to reduce breakages in transition from timm.layers.activations import * from timm.layers.adaptive_avgmax_pool import \ adaptive_avgmax_pool2d, select_adaptive_pool2d, AdaptiveAvgMaxPool2d, SelectAdaptivePool2d from timm.layers.attention_p...
284bd3737e000d8a62106d9f2716d76e46182095a3f3ea7eeece46751fbd2aae
Python
3,373
110
from ..qt import * from .. import thalamus_pb2_grpc from ..observable_item_models import FlatObservableCollectionModel from ..config import ObservableDict from ..task_controller.util import create_task_with_exc_handling import datetime import asyncio import time import bisect import logging LOGGER = logging.getLogger(...
61f9147214627f88a508d241af288746fdb8f0ca6c33e4d0dabdb8ad19fe5cb6
Python
3,373
73
# Copyright 2021 HIP Applied Computer Vision Lab, Division of Medical Image Computing, German Cancer Research Center # (DKFZ), Heidelberg, Germany # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy...
67005b3a14d7cb48902c9204c45004428d4b48454ad53e699fd92ac04300ed40
Python
3,374
94
from pathlib import Path import click import dolfin as df import meshio import numpy as np import panta_rhei as pr import pyvista as pv def mesh_to_pyvista_grid(mesh: meshio.Mesh, dim: int): geometry = mesh_to_geometry(mesh, dim) cells = cell_matrix_to_vtk_cells(geometry["polytopes"]["tetra"]) celltypes ...
dbc22e0360158d3d880fb637f7985f1667ea358c0f48cae274c9d7728cc2cf25
Python
3,374
79
"""Axion-event-driven stimulation times (partial port of ``axionStimEventsTool.m``). For the ``axionStimEvents`` detection method, stimulation times come from the Axion `.raw` file's ``StimulationEvents`` (selected via a CSV that maps ``rawName, well, electrode`` rows to recordings), **not** from the voltage trace. *...
e60c9db6080ef6676c2267f2240bc3a53c9b9900b99757e48e250220d530c818
Python
3,374
116
#!/usr/bin/env python # author: Jannes Spangenberg # github: https://github.com/JannesSP # website: https://jannessp.github.io from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, Namespace import os def parse() -> Namespace: parser = ArgumentParser( formatter_class=ArgumentDefaultsHelpForm...
89f324bc7d1b2e31e54f67637f3ff36bd98f7a99688278828c92a9cb05ff36c0
Python
3,375
80
import numpy as np from sklearn.metrics import roc_auc_score, f1_score from sklearn.linear_model import LogisticRegression from sklearn.model_selection import train_test_split import pandas as pd '''链路预测''' path1 = r'E:\毕业论文\对比方法\sigat\tw1.npy' path2 = r'E:\毕业论文\数据集\台湾选举\tw_zf1.csv' # path2 = r'E:\毕业论文\数据集\哇哈哈\Wahaha...
996b9c380d2d70f5d9eb60aa11420cd2370ed04a390a15a4915854bb7338f63f
Python
3,375
103
# -*- coding: utf-8 -*- # python standard library inputs import os # external inputs import nibabel as nb from nipype.interfaces.freesurfer import MRIConvert from nighres.surface import probability_to_levelset from nighres.laminar import volumetric_layering def calc_equivol3(path, sub, n_layers, path_output): "...
2a054e76adbcb22f3e48a4e8f43dfb8523bbf5cca6f2257e189c9d3ed5be3696
Python
3,376
110
import numpy as np from matplotlib.axes import Axes from typing import Optional from argclz import AbstractParser, argument, int_tuple_type from neuralib.plot import plot_figure from neuralib.plot.colormap import insert_colorbar from neuralib.suite2p import get_neuron_signal from rscvp.util.cli.cli_output import DataO...
91d9b4e94e71abd88b235383b90d258f2b11ecc9296b9365c00f7d3a07ebc91e
Python
3,376
98
from typing import Type from neuron import h from ..cells import NeuronCell from .simulation import Simulation, WaveformType from neuron.units import ms, mV class SpikeSimulation(Simulation): """A NEURON simulation with the functionality to run simulations and record action potentials in all compartments for...
4a0da46ef4276376eb85ece3697a95adb0eab6125ae2dfbf65e55dcc02ba0f45
Python
3,378
124
# SPSOAP descriptor functions # Imports import json import glob import numpy as np import numpy.typing as npt import ase import ase.io import dscribe.descriptors from modules.build_data.fhi_aims.descriptors.default_settings import ( DEFAULT_SPSOAP_SETTINGS, ) from modules.tools.strings import xyz2formula from ...
9b65a1782ccf6f5c5289c474504caebde1b07dea705e8845e54ec9de4ce0035e
Python
3,379
85
import torch from tqdm import tqdm from dataset_tool import fast_merge import numpy as np from transformers import pipeline import os import pandas as pd import json user=pd.read_json('../datasets/Twibot-22/user.json') user_text=list(user['description']) each_user_tweets=json.load(open("processed_data/id_tweet.json",...
e8e0b228f04023cc4da25d70f12947ae02aad3c9e585e52d117500d9856ca30c
Python
3,379
81
import os import sys from pathlib import Path p_dir = str(Path(__file__).absolute().parents[1]) if p_dir not in sys.path: sys.path.insert(0, p_dir) import torch from classifier.utils_hparams import args_short_to_long def _get_ckpt_path_from_dir(exp_path: Path): version = "version_0" # If running all folds...
eb845ba2f9b613b486f788a98abc14578fcaa04c7a89ecdf4669ae815b7e2805
Python
3,379
109
''' H3Cl ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for H3Cl: 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 and...
5bffe153d13a6c3e4feae9bd04dc77f13032fcc3cce69e1d73cd3e225ec58ff1
Python
3,380
116
#!/usr/bin/env python3 # tifffile/tiffcomment.py # Copyright (c) Christoph Gohlke # SPDX-License-Identifier: BSD-3-Clause """Print or replace ImageDescription in first page of TIFF file.""" from __future__ import annotations import argparse import contextlib import sys try: from .tifffile import tiffcomment ex...
8be40bd5e63fa436aaa7ae8ce0ae02bfaffad270d88ac1db2deef88c06c9a9cc
Python
3,380
81
import nibabel as nib import numpy as np from loguru import logger from nibabel.orientations import apply_orientation, axcodes2ornt, inv_ornt_aff, io_orientation, ornt_transform def pad_volume_to_shape(volume, target_shape=(256,256,256)): """ Given a volume, adds necessary constant padding to yield desired sh...
222c71f5e83963b237f57039bd9932def69022b4ef74affb400cb6669f0936f5
Python
3,381
81
import numpy as np from numpy.typing import NDArray def correlation_max(a, b, sample_index) -> tuple[int, float, NDArray, NDArray, NDArray]: """ Calculates the correlation (np.correlate(a, b, 'full') between a and b, and returns the index of maximum correlation, the maximum correlation, and the correlatio...
9d5596c58a1a1d6ba1f4a28d5d90e91fb3124b4f90f0a991488483267e4715c1
Python
3,381
88
from typing import Callable, Union import torch from batchgeneratorsv2.helpers.scalar_type import RandomScalar, sample_scalar from batchgeneratorsv2.transforms.base.basic_transform import ImageOnlyTransform class GammaTransform(ImageOnlyTransform): def __init__(self, gamma: RandomScalar, p_invert_image: float, ...
9f2539cf6aa314efa39dd92a56afb4788ac00717b84d886030757a332fe66dac
Python
3,382
127
from types import SimpleNamespace import numpy as np import pytest from napari_dmc_brainmap.results.results_helpers.slice_handle import SliceHandle def _make_slice_handle(location_mm): handle = SliceHandle.__new__(SliceHandle) handle.regData = {"atlasLocation": {"0": [0, 0, location_mm]}} handle.regi_di...
0b1bfdf119cb836c099d072dd27ca96f21845ef933d0838e3c82e81d9176d22a
Python
3,383
83
import torch from tqdm import tqdm from dataset_tool import fast_merge import numpy as np from transformers import pipeline import os user,tweet=fast_merge(dataset="Twibot-20") user_text=list(user['description']) tweet_text = [text for text in tweet.text] each_user_tweets=torch.load('./processed_data/each_user_tweets...
19d0c72e0841eb38a4e2208c94069e564fbcabbb41852d86ab9ac04896b5d071
Python
3,384
133
'''Code to convert RGB to other color spaces ''' # # Color transformations from # /auto/k1/shinji/matlab/colorspace/colorspace2.m # /auto/k1/shinji/matlab/strflab_adds/preprocColorSpace.m # # Code originally by Pascal Getreuer (https://getreuer.info/) 2005-2006: # https://www.mathworks.com/matlabcentral/fileexchange/28...
7d1de6b4ce9567b99b5ef7b081614b2d8eed461c729e29b756693983bb1bd9a9
Python
3,384
112
#!/usr/bin/python # ## @file # # Handles "communication" with the THUM temperature reader. # # Hazen 3/09 # import time ## Thum # # "Communicates" with a THUM temperature reader. The THUM reader periodically # updates a file with the current temperature, etc. reading. This just reads # that file every ...
827f6b96a9ca6242f2281df1de7e60e1d8231bb2d8efe64e77e5e692552383f7
Python
3,384
116
import os import subprocess import time from collections.abc import Sequence from pathlib import Path from docs.doc_modules.experiments import AutoDocExperimentInfo, run_capture_and_save from eir.setup.config_setup_modules.config_setup_utils import load_yaml_config from eir.utils.logging import get_logger logger = ge...
900b5fd5d466fec4155bbb254d080c3ebe53252ec0b691387d93b17aadd79abe
Python
3,384
106
import sys import os import time import numpy as np import pandas as pd import matplotlib import matplotlib.pyplot as plt import random from sklearn.preprocessing import normalize import statsmodels.api as sm from statsmodels.stats.multitest import multipletests from sklearn.decomposition import PCA inpt = "mock_genom...
d145903b4e295efd959bffeb37bc573c8c0734fa90756f76b44482729d2d54d8
Python
3,384
95
# -*- coding: utf-8 -*- import numpy as np from scilpy.gradients.gen_gradient_sampling import generate_gradient_sampling from scilpy.gradients.optimize_gradient_sampling import ( add_b0s_to_bvecs, correct_b0s_philips, compute_bvalue_lin_b, compute_bvalue_lin_q, compute_min_duty_cycle_bruteforce, compute_pe...
e446a058241613616232eccfeb87e580192687d4c7e797dcaf4ae666526cbb73
Python
3,384
96
import sys import getopt import numpy as np # functions def get_trackEM(param :str) -> np.matrix: """ handle '-0.010963829,-0.999939895,0.999939895,-0.010963829,-129.2603788,1664.628308' @return reverse affine matrix. """ affine = np.zeros((3,3)) in_data = np.array(param.split(',')).as...
6fe74b1cf075c7d87be0de5de81b67c325ade5beb8e3ca054b3e556af9327029
Python
3,385
83
import torch from tqdm import tqdm from dataset_tool import fast_merge import numpy as np from transformers import pipeline import os user,tweet=fast_merge(dataset="cresci-2015") user_text=list(user['description']) tweet_text = [text for text in tweet.text] each_user_tweets=torch.load('./processed_data/each_user_twee...
ba4ac8db86659ee6f629118bcfd63fe780088cb3534372f7d05f08eecf4b185d
Python
3,386
38
from testsetclass import TestsetClass class HEAVY28(TestsetClass): def __init__(self): self.weak = 1.0 self.molecules = ['pbh4_2', 'bih3_hcl', 'pbh4_hbr', 'hi', 'teh2_2', 'sbh3', 'bih3_nh3', 'hcl', 'teh2', 'pbh4_teh2', 'sbh3_nh3', 'sbh3_hi', 'bih3_hbr', 'pbh4_h2o', 'bih3_h2s', 'h2o', 'teh2_nh3', '...
987049d17fb1166fa9d60fe396781730b8a2fe9652f5bb91991d6dbeae181946
Python
3,387
62
import os import markdown import dtiplayground.dmri.preprocessing as prep class MANUAL_Exclude(prep.modules.DTIPrepModule): def __init__(self,config_dir,*args,**kwargs): super().__init__(config_dir,*args,**kwargs) global logger logger = self.logger.write def generateDefaultPro...
b654e260cbb6b89487d71f0956ea4f0e10e01998e7a29f59577a1463184b7722
Python
3,387
108
''' CH5p ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for CH5p: 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 and...
e5d1a1829e3b7a385e60ee9068d1003a3012b0fe9df0685969b74ccc716c70ee
Python
3,387
112
# The ImpedanceFitter is a package to fit impedance spectra to # equivalent-circuit models using open-source software. # # Copyright (C) 2021 Julius Zimmermann, # julius.zimmermann[AT]uni-rostock.de # # This program is free software: you can redistribute it and/or modify # ...
b162284bfea5803111298e46f971be02b7081f51b430ebb45537ff160a24f648
Python
3,388
73
################################################################################################## ### Script that averages over trials of Q and MI data, employing 'extractParamsQMIfromSpikes.py' # ################################################################################################## ### Copyright 2023 Jann...
4ad11b6858bfff8dd1cbf717116cfa2bc722ea3739a2bb0a6e1b40dd97f62f1e
Python
3,389
91
import torch import torch.nn as nn import torch.nn.functional as F import skimage.io as skio import numpy as np import config def get_dice(pred, organ_target): ''' Tversky loss :param pred: (B, C, 32, 256, 256) :param organ_target: (B, C, 32, 256, 256) ''' # the organ_target should...
e38e952fc15cd2777610efd7af51eb21b41a2b2e0d2e482a7ff5ac669053eada
Python
3,389
193
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license """Ultralytics neural network modules. This module provides access to various neural network components used in Ultralytics models, including convolution blocks, attention mechanisms, transformer components, and detection/segmentation heads. Examples...
f4aa3e491e2140f5f7f2505f2b1729c40fd7464d47f627471ea2f20896503f2f
Python
3,389
98
from os import listdir import os import sys import gzip import subprocess import time import sys from os.path import expanduser import json ### FILE PATHS ### ASSEMBLED_DIRECTORY = sys.argv[1] FILTERED_DIRECTORY = 'filtered/' ### FILTER OPTIONS ### MIN_LENGTH = 300 F_ANNEALING_REGION = "ACTCCTACGGGAGGCAGCAGT" R_ANNEA...
4b5afa0428b56662ebf95c10ee598cc0652df746bc7a796fafa7b7cc80b5caeb
Python
3,390
81
#!/usr/bin/env python """ Subtract one set of genomic intervals from another (base-by-base or whole intervals). The returned GenomicIntervals will be in the order of the first set of intervals passed in, with the corresponding meta-data. """ from warnings import warn from bx.intervals.io import ( BitsetSafeReader...
8d355801c78f4befcdc71ce1b5fa333bef6fd89b906a8d8024eb20a12d10a85a
Python
3,390
85
""" Save nuisiance regressors so that they can be used in a FSL GLM """ import glob import pandas as pd import os import numpy as np from scipy import interpolate import nibabel as nb # subs = ['sub-15', 'sub-16', 'sub-17', 'sub-18'] subs = ['sub-12'] ROOT = '/Users/sebastiandresbach/data/s1Anfunco/Nifti' modaliti...
925a38ccd252744b3598e9f8ebacfdace51e49476304c2f4afba5b27c94a1998
Python
3,390
102
from __future__ import annotations import numpy as np def hedges_g(x: np.ndarray, y: np.ndarray) -> float: """Hedges' g for two independent samples (x - y).""" x = np.asarray(x, dtype=float) y = np.asarray(y, dtype=float) nx = x.size ny = y.size if nx < 2 or ny < 2: raise ValueError('...
bc6fafe695a124502d6c34e4fb03e52bc559e03930bf7bb4f3a59716de3167e8
Python
3,390
87
# Copyright (C) 2019-2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import zipfile from pathlib import Path from typing import BinaryIO from datumaro.components.dataset import StreamDataset from cvat.apps.dataset_manager.bindings import ( GetCVATDataExtractor, NoM...
0294354d49c3267cd34c67aeb4505636a94726341338d310155717d11b2763e4
Python
3,391
140
"""Example script for running DyNeStE on simulated HMM-MVN data. This script should take less than a couple minutes to run and achieve a dice coefficient of ~0.99. """ print("Importing packages") import os import pickle import numpy as np from osl_dynamics.simulation import HMM_MVN from osl_dynamics.data import Dat...
67f3fae560b711947292dbb8e10d06e9ba05f7dff800bd03cf9f259b7720a582
Python
3,391
124
# 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...
c3238c702c46d43a9650f5945795b3b0d00ffb9125fc2d17962b634f956669f3
Python
3,391
94
import os import numpy as np from matplotlib import path import matplotlib.pyplot as plt import h5py import yaml import sys from glob import glob pathpath = 'PATHS/filepaths_carlen.yml' figdir_gen = pathdict['figdir_root']+'flatmap_rasterization' fformat = 'png'#png to avoid too many dots dpi = 300 with open(path...
90c1648a4b2639aab15a86163eee4d2108e087f4e971dce21f0b3fd7f6f8d1f9
Python
3,392
111
from ..qt import * import asyncio import dataclasses import inspect import typing import logging from ..config import ObservableCollection from ..observable_item_models import FlatObservableCollectionModel, TreeObservableCollectionModel, TreeObservableCollectionDelegate LOGGER = logging.getLogger(__name__) WAVE_PROP...
15f56b0352439b447e923ed81103e36b98141a029a467907c4cf3db9c516c884
Python
3,393
82
from __future__ import annotations import multiprocessing import os from typing import List from pathlib import Path from warnings import warn import numpy as np from batchgenerators.utilities.file_and_folder_operations import isfile, subfiles from nnunetv2.configuration import default_num_processes def _convert_to_...
7288bb10f5dfa2c920b3738c83f9e834275580d7c8bc302ae123042d204689ea
Python
3,393
104
import pandas as pd import pyfocus as pf import numpy as np from pandas_plink import read_plink class ExprRef(object): def __init__(self, geno, sample_info, var_info, pheno=None, covar=None, gene_info=None): self._geno = geno # IID x SNP self._sample_info = sample_info # info on ...
e16b65fa77490d507b35764e1a2e4912d2d8cce241d9ae4670789affafe53a25
Python
3,393
98
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import math from collections.abc import Sequence import numpy as np from numpy.typing import ArrayLike, NDArray def encode_mask(bitmap: ArrayLike, /, bbox: Sequence[float] | None = None) -> list[float]: """ Encodes an image mask into an ar...
b6663126b60965afc23f9a02d42bb6d15c3089c42d9fedfc319c0dda79b632f8
Python
3,394
110
import pytest from nems import Model from nems.registry import layer from nems.layers.base import Layer class KeywordTester(Layer): @layer('tester') def from_keyword(keyword): options = keyword.split('.') kw_head = options[0] layer = KeywordTester() layer._kw_head = kw_head ...
f0b54db703815e4d0e19beced1c5bfc5bbd26ac209f29f2cfba7d851d52baad1
Python
3,394
83
import sys, os, gzip, argparse import numpy as np import pandas as pd from scipy.sparse import * parser = argparse.ArgumentParser() parser.add_argument('--input_csv', type=str, help='') parser.add_argument('--dge_path', type=str, help='') parser.add_argument('--output', type=str, help='') parser.add_argument('--key',...
46b709f2d7087d1bb4ab42ca3cd16549af1e2ea31752070a0485087378b3be64
Python
3,395
103
''' ''' # Anwar O. Nunez-Elizalde (Apr, 2020) # # Updates: # # # import numpy as np from .core import (mk_spatiotemporal_gabor, generate_3dgabor_array, dotspatial_frames, dotdelay_frames, mk_3d_gabor, ...
a32fdbc364fc4191e20d9d3098d49a236aff8e23a4b538d536cd2be9077aafb4
Python
3,395
90
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import init from torchvision.models import resnet50 # 使用 ResNet 结构 from model.coatnet import conv_3x3_bn, MBConv # 你之前的 CoatNet 部分 class MoCoatResNet(nn.Module): def __init__(self, num_classes=6): super(MoCoatResNet, self)._...
bbf082568e3709717ab02db18d0c2763fe525ca4e9ac29fe11c0d417ff35ede4
Python
3,395
96
# Copyright (c) OpenMMLab. All rights reserved. from mmcv.cnn import build_conv_layer, build_norm_layer from mmcv.runner import Sequential from torch import nn as nn class ResLayer(Sequential): """ResLayer to build ResNet style backbone. Args: block (nn.Module): block used to build ResLayer. ...
f9bb161ad84fcac3ceb2d53bb551a1da2c034fb6f2341f53ed8f384c069f94d5
Python
3,395
90
# This file was automatically generated by SWIG (http://www.swig.org). # Version 4.0.2 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info as _swig_python_version_info if _swig_python_version_info < (2, 7, 0): raise Runtime...
1fdb3950fa6c82aec4a4142c71c51e6b3dcfdaca34a9f4d52b3dd50526551851
Python
3,396
94
from seisbench.data.base import WaveformBenchmarkDataset class PiSDL(WaveformBenchmarkDataset): """ A dataset for induced seismicity from different regions in Canada, Switzerland, Germany, and France. Induced seismic events are caused by hydraulic-fracturing based fluid injection, geothermal power pla...
4abe24d822174dc1cdbf055446179e2468d1f04adadbf3ef7212a9f3cdbda443
Python
3,397
75
from brainscore_vision.model_helpers.check_submission import check_models from .helpers.resnet_helpers import res2net50_26w_4s import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images def get...
5c912ed3db743074b4d22428961b8d1eb8b2836128a2fe59516d766a2272f311
Python
3,397
111
''' K2Rb2 ''' import numpy as np import sys def intro(): print(""" SHORT List of potential energy surfaces for K2Rb2: 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 a...
7936f000426b223ee0b97e09b8384fcb1e4d9bec7af75fc7887ca1db4fc68d36
Python
3,397
114
import numpy as np from matplotlib import pyplot as plt from matplotlib.axes import Axes from neuralib.plot.colormap import insert_colorbar from neuralib.typing import ArrayLike, ArrayLikeStr __all__ = ['selective_pie', 'dir_hist', 'mismatch_hist'] def selective_pie(n: ArrayLike, labels: Array...
ac3c5cf0af85484c451c96d3944ac7f304291f5ed392dc59b469e6f5fd88e939
Python
3,397
96
import os import pandas as pd import logging from typing import Tuple from util.config_vars import config class FilterDataset: """ Filters the overview CSV-file according to inclusion criteria and returns tuples of subject-, session-, and scan-ids for each MRI-scan. """ def __init__(self, csv_pat...
aa4d5486e085ee88b1ef8d91b98bc6d19d39bd5fc5a693a661bbe53e64ebe4c1
Python
3,398
83
""" Creates a plugin that is composed of a new window with a text field (QLabel) The plugin hooks into updateMainWindowOnMouseMove and gets the X and Y position of the mouse in the current axes each time this method is run. This information is then displayed on the screen. """ from PyQt5 import QtGui, QtWidgets from ...
acbddddde9ab8e9c1c82d4fc5bf9e264394603175833487b1726e78e1d7f1fdf
Python
3,398
80
import numpy as np from sklearn.metrics import f1_score, precision_score, average_precision_score, recall_score, accuracy_score, roc_curve from sklearn.metrics import roc_auc_score, precision_recall_curve from sklearn.utils import shuffle import pylab as pl from chinn.common import col1Width, colors import xgboost as x...
456cca6e32742e3ce95ab69bbe658917a80e96002c9c09140d07f14a816b7da3
Python
3,399
80
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from copy import copy import torch from ultralytics.models import yolo from ultralytics.nn.tasks import OBBModel from ultralytics.utils import DEFAULT_CFG, RANK class OBBTrainer(yolo.detect.DetectionTrainer): ...
ea9060046795c4908f01f825b7140817436835cabcfdfb719715876d071c35ea
Python
3,399
131
# Copyright 2022 Andrew Lehr ### License: Apache-2.0 (http://www.apache.org/licenses/LICENSE-2.0) import numpy as np import os.path as path ''' Paths to required directories and files ''' # raw data paths root = path.abspath(path.join(__file__ ,"../..")) raw_data_dir = root + '/raw_data/' spike_data_dir = raw_data_d...
b3b29c3e1c2ee48d9263ae7637f1c2ad91b5eb6b58e59fae95fb71857a479952
Python
3,400
68
"""Check published metadata joins, configuration/asset integrity, and local links. Uses only release files. It does not download images or inspect a local dataset. """ from __future__ import annotations import csv import hashlib import json from pathlib import Path import re import sys from urllib.parse import unquot...
ca8c6574d1cc90c2acc3998c7549178a3fe37885dc64df23f5f0dbdeff0b64fc
Python
3,401
125
# -*- coding: utf-8 -*- # python standard library inputs import re # external inputs import numpy as np import matplotlib.pyplot as plt from numpy.fft import fft, fftshift def get_rf_pulse_bw(file_in, npad=1000, ninterp=1000000): """Get RF pulse BW. This function computes the bandwidth in Hz of an RF pulse...
dd1f2f5ed7914a7fa78e17aea8831551d011bce1945a55acc10d05662f78edfb
Python
3,401
98
#!/usr/bin/env python """ Motorized or piezo Z stage functionality (software control, see voltageZModule for DAQ control). The convention is that down is lowering the objective and up is raising the objective (on an inverted microscope). Hazen 04/18 """ from PyQt5 import QtCore import storm_control.hal4000.halLib....
e677a4035d979227d96cdb975ce307bc43be241075dbdbe29354b7f47b369225
Python
3,401
98
import os import torch from torch.utils.data import random_split, Dataset import torch_geometric.utils from dgd.datasets.abstract_dataset import AbstractDataModule, AbstractDatasetInfos class SpectreGraphDataset(Dataset): def __init__(self, data_file): """ This class can be used to load the comm20, sbm ...
764b299821526a57f280e42585cb8f40f897f6f0a20320e33f61de54f86616e7
Python
3,402
94
import yaml #def check_filexists(ymlfilepath): import logging import logging.config import os import importlib.util import sys import numpy as np import pandas import collections def iter_paths(d): def iter1(d, path): paths = [] for k, v in d.items(): if isinstance(v, dict): ...
10726213af9425cfdb84b2a5716fe94b78ea3fe355715677c507c6bf65e3a4da
Python
3,403
120
import simplejson import numpy as np import pandas as pd import networkx as nx from biothings_client import get_client mg = get_client('gene') # Change to new DOI if updates to DrugMechDB DOI = 3708278 # set to metapaths_biolink to use biolink model metagraph_sheet = 'metapaths' def read_spreadsheet(location): ...
49f02e63a8b2a32c77aa1c867b226701f8f21fc69c8ac8313ae0437d9d526462
Python
3,404
82
# Copyright (c) DP Technology. # 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 numbers from torch.nn.parameter import Parameter from torch.nn import init from torch.nn import functional as F try: import unicore_fused_l...
8725be4e4e7bd500f01fcc2042d9c129da97c1acf2df7dc8d86d480b0f2221f5
Python
3,406
98
""" Registering statistical maps to anatomical data """ import glob import subprocess subs = ['sub-05', 'sub-07', 'sub-09', 'sub-10', 'sub-12', 'sub-14', 'sub-15', 'sub-16', 'sub-17', 'sub-18'] subs = ['sub-06'] ROOT = '/Users/sebastiandresbach/data/s1Anfunco/Nifti' for sub in subs: funcDir = f'{ROOT}/derivat...
fac8f9148495077a03d10ae6d2c9646b967b4d48c2e8c0476533f6c20522731a
Python
3,407
94
import argparse def parameter_parser(): """ A method to parse up command line parameters. By default it gives an embedding of the Bitcoin OTC dataset. The default hyperparameters give a good quality representation without grid search. Representations are sorted by node ID. """ parser = argp...
48753e4cd3f7cbdc1bf27fb0c65feea14e60f1f0f711e4b887a57927c20df4df
Python
3,408
111
# coding=utf-8 """ Tests for deepreg/model/backbone/local_net.py """ from typing import Tuple import pytest import tensorflow as tf from deepreg.model.backbone.local_net import AdditiveUpsampling, LocalNet def test_additive_up_sampling(): """ Test AdditiveUpsampling. """ batch = 3 filters = 4 ...