sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9809362f58c200be50f75d3edf5a98dcf2f845b28a58f03244500c254d2f5f80
Python
2,532
95
import typing from pathlib import Path from operator import itemgetter import cv2 import numpy as np def processing(image: np.ndarray, boxes: np.ndarray) \ -> np.ndarray: backgrounds = is_bg(image, boxes) result = boxes[np.where(~backgrounds)] return result def is_bg(image: np.ndarray, boxes: n...
79923371ea2196866f6df8b58e7fb7317b9aa6ffc868ae3db33d245e1f0f9c69
Python
2,533
78
def replace_infs_nans(array): array[np.isinf(array) | np.isnan(array)] = 0 return array data=h5py.File('G:/noise_celling_data/ZUIXINDATA/sub04_DATA/TEST_DATA/noise_celling_hebing/chongfuwumean/sub04_test_mean.mat', 'r') dataset = data['averagedData'] # 根据数据集的名称获取数据集的引用 Y_test = dataset[:] d...
7aed0cf7289129e1920beba82a92b52ac0d4eab4309cfa4be262b2902d96315f
Python
2,533
90
import torch import lightning.pytorch as pl from datamodule import SeqDataModule from test_predict import save_predict from trainer import LitModel, TrainingConfig from utils import set_global_seed from lightning.pytorch.callbacks import ModelCheckpoint from pathlib import Path import glob import argparse par...
906a8f12b224e21b0fbbd8c3217ebcf2b6ee940c0b764617bce0ae1b90e07a63
Python
2,533
59
# -*- coding: utf-8 -*- OPTIMAL = False CONFIGS = [ # eager_greedy_ff (330, ["--evaluator", "h=ff(transform=H_COST_TRANSFORM)", "--search", "eager_greedy([h],preferred=[h],cost_type=S_COST_TYPE,bound=BOUND)"]), # lazy_greedy_ff (411, ["--evaluator", "h=ff(transform=H_COST_TRANSFORM...
9b97940da835ae19b72f949d608c325696701955ae9942d7ffa6680d21ce09b2
Python
2,533
79
from .equiformer_v2_oc20 import EquiformerV2_OC20 as eqv2 import torch import torch.nn as nn import torch_geometric as tg import e3nn.o3 as o3 from torch_scatter import scatter_mean class EuBERT(nn.Module): def __init__( self, num_layers=3, max_neighbors=200, max_radius=16, ...
b878dc3a48817032c3c532df628c260553390f7e40910ce946de87200aba81b9
Python
2,534
72
#!/usr/bin/env python # -*- coding: utf-8 -*- '''setup file for the hybridLFPy Python module''' import os from setuptools import setup, Extension import numpy from Cython.Distutils import build_ext with open('README.md') as file: long_description = file.read() # read version file d = {} exec(open(os.path.join('hy...
ca9d9e4f42671350e0d3625460f91155ede83f499158ba3ca9d13b6ca8f66e4d
Python
2,534
85
# Mancy Chen 25/04/2023 # Convert the Matlab code from Cheima import os import nibabel as nib import numpy as np import pandas as pd from scipy.ndimage import binary_dilation import matplotlib.pyplot as plt # Set the main directory maindir = '.../Matlab_ROI_to_Python/stats/' Output = '.../Matlab_ROI_to_Python/Output/'...
3a93a585855fffa04864afd863094637e17a66ddd1617c2c6d814659c5aa005a
Python
2,535
93
import numpy as np from scipy.stats import pearsonr, spearmanr from PIL import Image import random def load_images(image_paths): images = [] for path in image_paths: img = Image.open(path).convert('L') img_array = np.array(img) images.append(img_array) return images ...
4598f5bfa03c1b0e9f08470c44759ffd17d85c6f372249ccf9cf15ab101e7ee0
Python
2,536
83
# Prediction interface for Cog ⚙️ # https://github.com/replicate/cog/blob/main/docs/python.md import asyncio import logging import time from opentelemetry import trace from cog import ( AsyncConcatenateIterator, BaseRunner, Input, __version__, concurrent, current_scope, ) logging.basicConfig...
b596094485f29fcafc1d3e1b87c9afef7d5d2b28d2414a06a0f90603d43924c2
Python
2,536
44
# + import torch class categorical_crossentropy_2d: def __init__(self, weights=None,mask=False): self.weights = weights self.mask = mask self.eps = torch.finfo(torch.float32).eps def loss(self,y_pred,y_true): if self.mask: loss_sum = torch.sum(self.weights[0...
f6a9d058f6bb954596ce577339411d18ea92184b439e3353645bd6f6b88d3c5e
Python
2,536
79
import numpy as np import torch import torch.utils.data as data import torch.nn.functional as F import torch.nn as nn L = 32 # convolution window size in residual units W = np.asarray([11, 11, 11, 11, 11, 11, 11, 11, 21, 21, 21, 21, 41, 41, 41, 41]) # atrous rate in residual units AR = np.asarray([1, 1,...
a3108e284564a4f2330c1e6a6c52d03d2108b9dd47e56b20bfce1a0bf0432d56
Python
2,537
79
from .equiformer_v2_oc20_v2 import EquiformerV2_OC20 as eqv2 import torch import torch.nn as nn import torch_geometric as tg import e3nn.o3 as o3 from torch_scatter import scatter_mean class EuBERT(nn.Module): def __init__( self, num_layers=3, max_neighbors=200, max_radius=16, ...
e45aa5830e97fa63f0e1bbcdf388e98ac7e72afe5e9395be50ae5a9d8a28078e
Python
2,537
90
import json import sys import torch.nn as nn from model import LegNet from dataclasses import dataclass, asdict from pathlib import Path from dataclasses import InitVar @dataclass class TrainingConfig: stem_ch: int stem_ks: int ef_ks: int ef_block_sizes: list[int] resize_factor: int pool_siz...
6370312a8de4baccfca3751923c3926f7a38495bffb6256d1706cb275a54539c
Python
2,538
66
from typing import Dict, List, Union import numpy as np import torch from ..base_transform import EEGTransform class Contrastive(EEGTransform): r''' To allow efficient training, we need to prepare the data loading such that we sample two different, random augmentations for each EEG in the batch. The easiest...
7e4e501f8c16e4adaa93551398bfdf2ea6965d339303cabdae20ac01a20f0487
Python
2,538
103
from SurvivalEVAL.evaluations.calibration import ( aj_calibration, aj_calibration_per_event, coverage_ic, cr_d_calibration, cr_d_calibration_per_event, d_cal_ic, d_calibration, integrated_calibration_index, integrated_calibration_index_cr, km_calibration, ksd_cal_ic, ksd_...
01de0d1fea1bfdf3a644e20d90f5bacd12bdacf71f2b1dafedf6bc85cddaac9e
Python
2,539
78
## USER INPUT ############################################# files ='/gpfs/Home/cuk476/GeneExpression/20231027_all_coronal_batch/1_subjects_reconstructed_resampled/*_section_resampled.nii.gz' ########################################################### axis = 2 # which axis to iterate through (Default: 2 for z axis) over...
131c93b0576e2caad60dfb28e5d677dd81f985d04653c0a86079bfc3439460f1
Python
2,539
79
# -*- coding: utf-8 -*- # # Implementation of Granger-Geweke causality # # # Builtin/3rd party package imports import numpy as np def granger(CSD, Hfunc, Sigma): """ Computes the pairwise Granger-Geweke causalities for all (non-symmetric!) channel combinations according to Equation 8 in [1]_. The...
3e3f7bfb8d6b42cb0b12f388adc0a1da522c72be47de4b82ab60b6072271d0b6
Python
2,539
51
import numpy as np import pytest import regtools.geometry_registration.pipeline as pl def test_safe_image_warping_installed_on_live_call_site(): # Import submodules directly (the package __init__ re-exports the functions, # not the submodule objects, so we must reach into the submodules themselves). ...
626edf9026b26c56283c4665d1f147e2e6418e832b97cae63a90bad7bbfd12c0
Python
2,539
84
import importlib.util import sys class VendorImporter: """ A PEP 302 meta path importer for finding optionally-vendored or otherwise naturally-installed packages from root_name. """ def __init__(self, root_name, vendored_names=(), vendor_pkg=None): self.root_name = root_name self....
75959f53fa4b6a27ff687a8877602c1f6ddc8e840f07ce083fc4cd437bc3882c
Python
2,540
86
# -*- coding: utf-8 -*- """Some simple test that dataset can be loaded""" import pytest, tempfile import tensorflow as tf import numpy as np from helpers import * def test_numpy(): dataset = get_trivial_numpy_ds() data = get_trivial_numpy() iterator = iter(dataset) out = next(iterator) for k in o...
7cac1a4e6b99af225f4d10a22d9372f45ab4f8756967e267080485a107cb2f08
Python
2,540
56
#!/usr/bin/env python from __future__ import absolute_import from __future__ import print_function from __future__ import division import math import torch from torch import nn from torch.autograd import Function from torch.nn.modules.utils import _triple from torch.autograd.function import once_differentiable import...
feb5e58cb4810748a1d5f43314f430b4a16bd48a0e55521ef30feb14f4b62829
Python
2,540
76
import numpy as np def _ecdf(x): """No frills empirical cdf used in fdrcorrection.""" nobs = len(x) return np.arange(1, nobs + 1) / float(nobs) def fdrcorrection(pvals, alpha=0.05, method="indep", is_sorted=False): """Pvalue correction for false discovery rate. This covers Benjamini/Hochberg fo...
1c6aa9812ef4cc0e1bed9b7be866aa615b1ca841edd03a2a38c3458e184f67f9
Python
2,541
79
""" The quPath project to metadata convert click command """ import os import click import pandas as pd from layer_recognition.io import get_qpproject_images_metadata @click.command() @click.option( "--qupath-project-path", required=True, help="qupath project path that contains images metadata", ) @cli...
4d7aec3d9ac7f1c72253f7847fbb8b94af67c1394c9191170351b73f7d8e8506
Python
2,541
73
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jul 1 07:32:52 2022 @author: haotian teng """ import os import sys import toml import numpy as np import argparse def split(args): collections = {} fs = os.listdir(args.input) for f in fs: if f.endswith(".npy"): try: ...
903e15177075798e1df6aad0d092d2432fd2d2db8bf970aa55a8775d509435c8
Python
2,541
49
"""Tilted (oblique) CCF cross-section extraction — pure numpy, headless.""" import numpy as np from scipy.ndimage import map_coordinates def rotation_matrix(pitch_deg, yaw_deg): """Rotation for volume axes (z=AP, y=DV, x=ML). Public: the viewer imports it. pitch = rotation in the (z, y) plane about...
dfa3599e35ac0ae136f90127f14245b8eb80e71d5eaf818b4c373a56ac3dffba
Python
2,541
79
from .equiformer_v2_oc20_v2_new import EquiformerV2_OC20 as eqv2 import torch import torch.nn as nn import torch_geometric as tg import e3nn.o3 as o3 from torch_scatter import scatter_mean class EuBERT(nn.Module): def __init__( self, num_layers=3, max_neighbors=200, max_radius=16, ...
f8ffcb40489bf814ec1c426314d3ac5a44bf6b759c41cef0fc51a22864ef63d5
Python
2,541
80
""" Bonito CRF basecalling """ import torch import numpy as np from koi.decode import beam_search, to_str from bonito.multiprocessing import thread_iter from bonito.util import chunk, stitch, batchify, unbatchify, half_supported def stitch_results(results, length, size, overlap, stride, reverse=False): """ ...
4a4444cba6d5ca7d812b8c0db8986cb0249198f566d45105cf9b85c8ed1c15fe
Python
2,542
63
def update_param(name, param): if name == 'distribution': values = param['values'] param['values'] = [v for v in values if v not in ['custom', 'ordinal', 'quasibinomial']] return param elif name == 'stopping_metric': param['values'].remove('anomaly_score') param['values']...
736a5fe16d69994162a4d9cb769509052c460906c46a742c174ed01c601c5759
Python
2,542
51
# -*- coding: utf-8 -*- #--------------------------------------------------------------------# # # # Copyright (C) 2019 HOLOEYE Photonics AG. All rights reserved. # # Contact: https://holoeye.com/contact/ # # ...
e2b142c1a388e3e4324c62a2fe5d041e0d5a7758e822fd4abac65d1eb8bec2c5
Python
2,542
34
"""posthoc_margin_map_check_2026-10-03.py — POST HOC (after MARGIN_MAP's pre-registered spiking check returned NO, 0/10). The rate theory counted >= 2,000 neurons firing at g* + 0.1 for the ten checked inputs; spiking counted 594-1,957 (one input, ENS1, exploded on both sides of g*). Is the theory wrong about which inp...
9977666092e61cfc38992d7ad5eeef1433c99dabdf79e5ef5861694ececbfa28
Python
2,545
75
from .virtual_volume import VirtualVolume import struct from .config import * class Segm: def __init__(self, d0, d1, ind0, ind1): self.D0 = d0 self.D1 = d1 self.ind0 = ind0 self.ind1 = ind1 class Block(VirtualVolume): def __init__(self, container, row_index, col_index, file):...
12ae73a42fe33ca4900d09f6e17db2f86b6a4f1798620f67aa2b4f7cb617c41b
Python
2,546
98
import os import numpy as np import random import math import sys outdir = sys.argv[1] observations = sys.argv[2] def addIndividuals(np_array): indexes = range(np_array.shape[0]) list_array_added = [] for j in indexes: if (j % 2) != 0: array_temp = np_array[j, :] + np_array[j-1, :] ...
6060e9fe0124d47b71a3b35deca0ec42dc1d306009148e6a195b189fca733e22
Python
2,546
65
import sys, os import numpy as np import pandas as pd import pickle from scipy.io import loadmat, savemat import concurrent.futures sys.path.append('/m/cs/scratch/networks-pm/effects_externalfactors_on_functionalconnectivity/src/analysis') from utils import get_behav_data_15days #####################################...
92c1640265b8d60e4745c9d509695d743a99138163708a7e9dc5b4ebb3e90972
Python
2,546
79
import os import time import datetime import pickle import yaml import threading import logging import sys import torch.nn as nn from torch.utils.tensorboard import SummaryWriter from src.server import Server from src.utils import launch_tensor_board if __name__ == "__main__": # read configuration file confi...
3c4275fe010f6d6815654bc76fc1d8b0415f53fe49c01abd917e39ed5aa82dba
Python
2,547
70
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
89e0ae60bb686a1bf40e33c1c5f63bb1d6a96672aada96b2404601710972c7e0
Python
2,547
97
import os import pandas as pd from calvados.cfg import Config, Job, Components import subprocess import numpy as np from argparse import ArgumentParser #parser = ArgumentParser() #parser.add_argument('--name',nargs='?',required=True,type=str) #args = parser.parse_args() cwd = os.getcwd() sysname = 'md' ## set the si...
91abd32a21e5ec9e8c67fe3a96461b6f959ea77b60294f894a4264bd8a754258
Python
2,549
76
##Exp varified in all four import pandas as pd import os import numpy as np import csv import json df=pd.read_csv('Exp_Pl_protID_to_OGID.csv') values_ath = set(df['ath']) values_zma = set(df['zma']) values_ppp = set(df['ppp']) values_cre = set(df['cre']) Plastid_Exp_all_Four = list(values_ath & values_zma & values...
7e1d4c9fed7d585d86ff336237435545638a76ef8773c51a5e569e7a8c30570a
Python
2,550
69
import matplotlib.pyplot as plt from mpl_toolkits.axes_grid1.inset_locator import inset_axes import seaborn as sns def heatmap_cycle_data (roi_cycle_data, freq_band, roi_names, ax=None, center=0, cmap_y0 = 0, cmap='RdBu', cbar_kws=None, vmin=None, vmax=None): '...
d423f935db0a3ef2b419665f7b5b0887e86cf2c99ea01c55909e3bd058523576
Python
2,550
79
from .equiformer_v2_oc20_v2_new_afscores import EquiformerV2_OC20 as eqv2 import torch import torch.nn as nn import torch_geometric as tg import e3nn.o3 as o3 from torch_scatter import scatter_mean class EuBERT(nn.Module): def __init__( self, num_layers=3, max_neighbors=200, max_ra...
3a7f40cc20416cd5456fd045159065cf1e47f09a0ab0d9572bd96c4fe813f5fe
Python
2,551
78
# \file TestBrainStripping.py # \brief Class containing unit tests for module BrainStripping # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date December 2015 import os import unittest import numpy as np import SimpleITK as sitk import pysitk.simple_itk_helper as sitkh import niftymic.utilities.brain...
43fbed3b1add8cd5a2f8a12ac5d71a55332d52b642b1cc2ca2f412cf68d3cdb6
Python
2,551
63
import os import argparse import json import pandas as pd import sys from config_train import config as cfg_train from config_eval import config as cfg_eval import hyperparameters_multilabel from constants import REYMULTICLASSIFIER, DATA_DIR from src.analyze.performance_measures import PerformanceMeasures from src.tr...
c23bea53b5b3f0034ed5b40a2ba99432c11da0f801c9fe6e3dd96085fd016fc8
Python
2,551
105
from pathlib import Path from numpy import ndarray from .utils import _match, get_tsv, get_json from ..dataset import Dataset BIDS_ENTITIES = ( 'sub', 'ses', 'task', 'acq', 'ce', 'rec', 'dir', 'run', 'mod', 'echo', 'recording', 'proc', 'space', ) class BIDSNa...
1c83ebab25eb9173bbe24ce947ee71fbf447d6553b71895e2d7e6a5c900446a9
Python
2,552
83
# Node-group asset "Frame ID" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECKING from...
7adab9ab67460dd8fdd593a05a10e3a84540704a3ec44cf334ab9988772db215
Python
2,552
80
#!/bin/env python3 ''' Define a pool of particles, i.e. a dictionary that keeps track of how many time each quasi-particle shows up. ''' import re from frozendict import frozendict from typing import Callable from .yamlrepr import YAML_String_Representer class ParticlePool(dict, YAML_String_Representer): @property...
839de8399b1dd0bb34a813778f97b619074a3788fbd477019697b97af8055e6d
Python
2,552
103
from __future__ import annotations import warnings from pathlib import Path import pytest from emmet.core.tasks import TaskDoc FILE_DIR = Path(__file__).parent PSEUDO_DIR = FILE_DIR / "fake_pseudos" with warnings.catch_warnings(): warnings.simplefilter("ignore") MOCK_METALLIC_TASKDOC = TaskDoc.from_director...
8823f82d767d15453ce8922762f522fdc9eb42a0c69776979930cff4b50280e4
Python
2,552
69
from NAB.nab.detectors.base import AnomalyDetector import numpy as np import math class KnncadDetector(AnomalyDetector): def __init__(self, *args, **kwargs): super(KnncadDetector, self).__init__(*args, **kwargs) self.buf = [] self.training = [] self.calibration = [] self....
ef7c6c1f552587f32b25792b88ecbf9f5b8cc70d02079fc46c471b0fa2fbdbb7
Python
2,552
88
# -*- coding: utf-8 -*- import numpy as np import os import glob import random import argparse import itertools import nibabel as nib from nilearn import plotting from tqdm import tqdm from sklearn.cross_decomposition import PLSRegression from sklearn.linear_model import LinearRegression from sklearn.linear_model impor...
4de2ae6ea99e693f2bcc0fe84482016d43d553350c1997445a07fe8e482ad756
Python
2,553
71
import os from collections import defaultdict from tqdm import tqdm from rdkit import Chem, RDLogger import torch from torchdrug import data, utils from torchdrug.data import feature from torchdrug.core import Registry as R @R.register("datasets.QM9") @utils.copy_args(data.MoleculeDataset.load_csv, ignore=("smiles...
518014f6d883b9beb608ee342a38da24b3a80243d49e144a1d555f3a6da8387b
Python
2,553
90
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
68cb19196cccb84ae56bdc2baa8d5627399a41b86418f15c5cccc5ac3ed2e0df
Python
2,553
88
#!/usr/bin/env python3 import os import pandas as pd out_dir = "/project/3011157.03/Simon/proj_2022_CABB_movie/MRI/TimingsHPC7TMovies" os.makedirs(out_dir, exist_ok=True) movie_names = { "1.1": "Two_Men", "1.2": "Welcome_To_Bridgeville", "1.3": "Pockets", "1.4": "Inside_the_Human_Body", "1.5": "Vi...
b0d748474b191e4b9fa6b2cd7cae38ca4cad7956f27c080ae5723047f6a6e7fc
Python
2,554
70
import matplotlib matplotlib.use("Agg") import torch device = torch.device("cuda" if torch.cuda.is_available() else "cpu") import yaml, io with open("./config/DryBean_config.yaml", 'r') as stream: config= yaml.safe_load(stream) config["default_path"]= str(config["default_path"]) config["split"]= float(config...
ed3d01eef335cd3bc434d92ff8643fd029d8de705f3991e842b3c637b69095dc
Python
2,554
82
import seaborn from matplotlib import pyplot as plt from merlin.plots._base import AbstractPlot class OptimizationScaleFactorsPlot(AbstractPlot): def __init__(self, analysisTask): super().__init__(analysisTask) def get_required_tasks(self): return {'optimize_task': 'all'} def get_requi...
66f0924c763a74cc5592841d419292fef514db4f038a10b3c0a78024e87112e2
Python
2,555
96
""" Graphical Interface used to generate burst_quality metric. The program takes as input images generated by "generate_pred_vs_def_bursts.py", stored in ""data/burst_quality/images"", and show them, together with three buttons: 'Red', 'Blue', 'Equal'. When one of the button is clicked, the information about (image,...
cb336ab60711b27f18ceaca3fdf3ebd8bb4d02778618c2e298eaf4bddd906356
Python
2,555
70
# coding=utf-8 # Copyright 2021 The Eleuther AI and HuggingFace Inc. team. # # 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 requir...
45088f8b5778155336071934e1d4215d9d8faa47a58c42f67d967d498a8843bf
Python
2,556
81
import functools import os import site import sys import sysconfig import typing from pip._internal.exceptions import InstallationError from pip._internal.utils import appdirs from pip._internal.utils.virtualenv import running_under_virtualenv # Application Directories USER_CACHE_DIR = appdirs.user_cache_dir("pip") ...
5e9e45b91b0bbe5bd76dc5699007ea73b8e4a42b5ce409d6f3f09c8233e326d9
Python
2,556
87
class NboDataPoint: """Abstract class as template for NBO single and double data classes.""" def __init__(self, nbo_id, nbo_type, atom_indices, energy, occupation, orbital_occupations, contributions): """Constructor""" # check for equal length of involved atoms and contributions asse...
6546bc825684cd9c99ae61924ffeffab158f83b79c433d8cb2ce53347f525fe7
Python
2,557
83
from pyclbr import Function from dolfin import * import numpy as np import matplotlib.pyplot as plt import sys import os from IPython import embed import argparse # Command line arguments checking for different simulation experiments parser = argparse.ArgumentParser() parser.add_argument("--order", type=int, default=1...
d75fb6a2f02a4a8eb8d5f284d54dc0a20549558a9d8dec447b2bbf3648b21c4c
Python
2,557
84
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
9ab237a408c8c8de85cf2676d3bf0b4fe0e52500d1e0e055187ee585bf0c64bf
Python
2,558
109
import torch from elasticai.creator_plugins.quantized_grads.fixed_point import FixedPointConfigV2 from elasticai.creator_plugins.quantized_grads.fixed_point.quantize_to_fixed_point import ( _clamp, _round_to_fixed_point_hte, quantize_to_fxp_hte, ) def test_round_determinstic_to_fixed_point(): conf = ...
cf90a029c502117a8ee4aac4a8d789f04578403d709bdec03a7b05185051924b
Python
2,558
70
import time import os import threading class Logger: def __init__(self, dir_name, is_values, ought_values): self.dir_name = dir_name self.is_values = is_values self.ought_values = ought_values # Check if directory exists if not os.path.isdir(self.dir_name):...
d291adefd1555579c44539873e4b426ae4e2a35f78468c5149a62afeb78b70cb
Python
2,558
78
import itertools import os import shutil from pathlib import Path import bpy SUBFOLDER = "Molecular Nodes" def list_templates(): paths = bpy.utils.app_template_paths() t_paths = list(paths) if paths is not None else [] names = list( itertools.chain.from_iterable( [[folder.stem for fol...
1a24ede57c2292040127edbe89d550128eb5585a82ff05a56f19305e87b53a3f
Python
2,559
70
import matplotlib matplotlib.use("Agg") import torch device = torch.device("cuda" if torch.cuda.is_available() else "cpu") import yaml, io with open("./config/MNIST_config.yaml", 'r') as stream: config= yaml.safe_load(stream) config["default_path"]= str(config["default_path"]) config["cuda"]= str(config["cud...
a04fd82dcf833057ad89f825b078c5875db1044f1ec9593cf493a56b3775e604
Python
2,559
74
import os from rdkit import Chem from torch.utils import data as torch_data from torchdrug import data, utils from torchdrug.core import Registry as R @R.register("datasets.PDBBind") @utils.copy_args(data.ProteinLigandDataset.load_lmdbs, ignore=("sequence_field", "smiles_field", "target_fields")) class PDBBind(dat...
a16161757b9103b56c5bcb2b7aaa3262e3256895c1f100e6c4818d377e3a144d
Python
2,559
106
import torch from torch import nn __all__ = [ '_CONV_DICT', '_CONV_TRANS_DICT', '_AVG_POOL_DICT', '_MAX_POOL_DICT', '_NORM_DICT', '_REFLECTION_PAD_DICT', '_CENTER_CROP_DICT', '_ACTIVATION_DICT', 'activation_from_str', ] def center_crop_1d(layer: torch.Tensor, target: torch.Tensor) ...
ae106d36a9334a5bf7bbbc1f906bfdce67721f7fa1f367ed4077284dede32650
Python
2,559
101
# -*- coding: utf-8 -*- """Participant class""" from os.path import join as opj from dcm2bids.utils.utils import DEFAULT class Participant(object): """ Class representing a participant Args: name (str): Label of your participant session (str): Optional label of a session """ def _...
b862ff4b61f0fb4c4b9eb46725697a96e84e38406de3e0f9c6484c99337af25e
Python
2,560
65
from matplotlib import pyplot as plt import numpy as np from sklearn.metrics import confusion_matrix as cm def confusion_matrix(all_labels, all_predictions, metadata, num_clusters, unsupervised, target_fp = None): # confusion matrix for single experiment. If unsupervised, plots the contingency matrix of clusters aga...
d4f3989c043f10eef8b7536276e92f1b298f4eeecc9444fc56558fbdb2738833
Python
2,560
92
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
dc47c852c0a5ade20aa53d4e16d0da9de8ff0c753465b26e8a1c588bdc4dd5ba
Python
2,560
87
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Docs here""" __author__ = "Mitchell R. Vollger" __credits__ = ["Mitchell R. Vollger"] __maintainer__ = "Mitchell R. Vollger" __email__ = "mrvollger@gmail.com" __status__ = "Development" import logging import argparse import pysam import sys from tqdm...
74ba694ec0e70502ccbb631c462bf1cf46a65f8c9813f2becbb8fcea53799198
Python
2,561
83
""" Molecular Dynamics recipes for EMT. """ from __future__ import annotations from typing import TYPE_CHECKING from ase.calculators.emt import EMT from ase.md.verlet import VelocityVerlet from ase.units import bar, fs from quacc import Remove, job from quacc.runners.ase import Runner from quacc.schemas.ase import ...
88aeecb7d37ad16e33d6fab4a9d01961ef663a1b8cac13700ece2f1daf428fa2
Python
2,561
78
import numpy as np import sys import copy class ParamStorage(object): """ Minimal Parameter Storage Unit with some Checks Inspired by: Michael Hughes's ParamBag """ def __init__(self, K=0, doCollapseK1=False, **kwargs): self.K = K self.D = 0 if sys.version_info > (3, 0): ...
d2f18ae34f4c32b57f981db152bfdd43edfd948eb6f07ad21eae5cd9c6876cec
Python
2,561
121
import numpy as np import math print("To estimate m(X,Y) please provide (in micrometers):") print("- the reciprocal of the density of cell-type X:") dx = input() print("- the reciprocal of the density of cell-type Y:") dy = input() print("- the larger of the mean radii of cell types X and Y") mx=input() print("---...
4bed47c9dceffd02d30fac45ca9a79994f099edab229bfd8755b0cc785ba845f
Python
2,562
51
import numpy as np import matplotlib.pyplot as plt import os from pulse_train import PulseTrain_Sinusoid, PulseTrain_TI #################################################################################### ###################### Plotting Sinusoidal Waveforms ############################### #############################...
52619b837907a0225fc68009b1c88e7cd13b34b20650c8608e87b1a1fa739fe7
Python
2,562
108
from __future__ import annotations import pytest ray = pytest.importorskip("ray") from quacc import flow, job, subflow def test_ray_decorators(tmp_path, monkeypatch): monkeypatch.chdir(tmp_path) @job def add(a, b): return a + b @job def mult(a, b): return a * b @job d...
7d295dfae901b10f909b8064e428a6eceabb4a49b7dd27bec35bcdfee3005460
Python
2,562
59
""" Reconvolution events ==================== This tutorial shows the basic building block of the reconvolution approach (see [1]_ and [2]_) that is implemented in the PyntBCI library for analysing code-modulated responses. This tutorial generates an arbitrary code (here an m-sequence) and shows different kinds of eve...
88e0bc19d58b1cbbc27278fab48e6dff671ab4032a4f76af93276ecfbf0df0ee
Python
2,562
88
# pylint: disable=invalid-name, missing-function-docstring, no-member """ MeanTransformer model module """ from random import uniform, randint import torch from torch import nn from omegaconf import OmegaConf, DictConfig def get_model(cfg: DictConfig, model_cfg: DictConfig): return MeanTransformer(model_cfg) ...
0dd832585bb0ff3abd339078eb1ca4440076dd54ab566aaf0f0aaf78198e0c67
Python
2,566
64
from make_outer_surface import make_smoothed_surface import os.path as osp from config import paths import argparse from nibabel import freesurfer as nf from scipy.spatial import distance as dist import json def test_make_smoothed_surface(subject, db_root): for hemi in ['lh','rh']: old_coords,new_coords = ...
35554eff5597c84c50eabcb3a014b55da9fdea5d1bcabf3b55f51ee3adfea262
Python
2,566
72
import os from rdkit import Chem from torch.utils import data as torch_data from torchdrug import data, utils from torchdrug.core import Registry as R @R.register("datasets.BindingDB") @utils.copy_args(data.ProteinLigandDataset.load_lmdbs, ignore=("sequence_field", "smiles_field", "target_fields")) class BindingDB...
735d994bd4f53aa5136aa013ac37389a389cae0ec733d29ec53e757caefe5f3c
Python
2,566
68
from typing import Dict, List, Union import numpy as np import torch from ..base_transform import EEGTransform class Contrastive(EEGTransform): r''' To allow efficient training, we need to prepare the data loading such that we sample two different, random augmentations for each EEG in the batch. The easiest...
d1fe32fc83760b77eeafade1e603f240eb1722c2568753975bf07ad8567bd7a8
Python
2,566
62
# Copyright 2020 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 of the License at # # ht...
6ad7ec4c5d6d919000a1e2fb593ecb024cf66995908b970c57af71cae11fc6ee
Python
2,567
83
# Node-group asset "Assembly ID" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECKING f...
76fe1599112b2e198b595cac5eb4897ce3a17fd5ebcfd63fb7aedb757afd5f8a
Python
2,567
85
#!/usr/bin/env python # -*- coding: utf-8 -*- # Written by Minh Nguyen and CBIG under MIT license: # https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md from __future__ import print_function import argparse import numpy as np import cbig.Nguyen2020.misc as misc def get_args(): parser = argparse.Argument...
3dab8413ec5e5517cb6a25b3c6a36f5082ca6d82ef9765941a1fe75a10750631
Python
2,568
89
from sklearn.model_selection import KFold, StratifiedKFold from torch.utils.data import DataLoader, Subset from engine_real import * from model.resinf_foreal import ResInf import torch.nn as nn import torch.optim as optim import wandb import pickle from sklearn.model_selection import train_test_split from dataloaders.d...
5f33e81fc2fd5fd6df5896f38077c291233f2c051ebbe581a3f32e0a65f4de2f
Python
2,568
76
import tensorflow as tf import pandas as pd import numpy as np from tqdm import tqdm import tensorflow_addons as tfa r_square = tfa.metrics.r_square.RSquare(dtype=tf.float32, y_shape=(1,)) if tf.config.list_physical_devices('GPU'): strategy = tf.distribute.MirroredStrategy() print("All devices: ", tf.config.l...
280f5ed2c60f482b77a670b93e87e32bda95b6f5013df59f47773acb920feba9
Python
2,569
90
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
6bde6fdb7cb405261ca32bad0e5bfc0d3966ef5a1acdca25544edb34e6e8211e
Python
2,569
94
from .ds_utils import _get_clio_client FLYWIRE_MINIMAL_SCENE = { "layers": [ { "source": "graphene://https://prod.flywire-daf.com/segmentation/1.0/fly_v31", "type": "segmentation_with_graph", "selectedAlpha": 0.14, "segments": [], "name": "flywir...
4db156f1fa795262446704f2f4eb3883076aabe7620b8bce64c125c4275b249c
Python
2,570
104
from __future__ import annotations import warnings from pathlib import Path import pytest from emmet.core.tasks import TaskDoc FILE_DIR = Path(__file__).parent PSEUDO_DIR = FILE_DIR / "fake_pseudos" with warnings.catch_warnings(): warnings.simplefilter("ignore") MOCK_METALLIC_TASKDOC = TaskDoc.from_director...
b3ce051de0012e3ad2d2a3a7168c7b043e88aba0f260af8649d41ded4ece01dc
Python
2,571
90
import time from functools import wraps from contextlib import contextmanager import matplotlib.pyplot as plt import torch import numpy as np """ basic tools """ # -------------------------------------------- # dict to string for logger by recursion # -------------------------------------------- def dict2str(opt, inde...
6066eaa1eab3e88f24d48293ce7feda46998974063b2d97b657273ffe2940e1d
Python
2,572
83
# Node-group asset "Symmetry ID" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECKING f...
ace372069dfea4d7b110b47a3ee08860b4b174364696767f7834a3a89308891b
Python
2,572
64
import argparse import matplotlib.pyplot as plt import numpy as np import os import pandas as pd import seaborn as sns sns.set_context("paper") sns.set_theme(style='white') # Read data parser = argparse.ArgumentParser() parser.add_argument('--filename', type=str, default='SGA1-2_summary2.xlsx', nargs='?') parser.add_...
cedd68afbfa7a5ab01df86c6c1ebb24bd34e91a90bf68b8b1d5dd3e738e6f3d1
Python
2,572
75
# # MIT License # # Copyright (c) 2022 GT4SD team # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,...
dfba378be591bb582fb3caf5b6c3bccbaae3da8e9c3ec4c8f2b7078ada3b247c
Python
2,572
53
"""Publication figure: reservoir dynamics over thousands of tokens, from saved continuous runs.""" from pathlib import Path import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import numpy as np from liquidaion_fly.continuous import load_run, repetition_metrics root = Path("results/continuous") o...
c4d2f130d02c4d9764120ef6dc8035fff28859cd86b85405ff342551a49d8fd2
Python
2,573
79
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
87be6375da4f4018c81a8aeec17042d9775a05d1f2f8da24b93be7eccb82c593
Python
2,574
70
"""Visualize atomic attention and save similarity map.""" from typing import Union import numpy as np from tqdm import tqdm from chemprop.args import PredictArgs, TrainArgs from chemprop.data import get_data, MoleculeDataLoader, MoleculeDataset from chemprop.utils import load_args, load_checkpoint, update_prediction_a...
db53d4272c6241f1daf73b3ff7aa91079477697b42af9e4a08734a44c4064e9a
Python
2,574
70
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Nov 8 09:07:07 2019 @author: adele """ import os from os.path import join as joinP import logging import cPickle as cpk import pandas as pd from utils_objet import MetabolicGraph #Setting logging preferences logging.basicConfig(level=logging.INFO) ...
f39ff44279e7100e932747befa33bfbbf7f3c2ddf17e41498f56276a196198cc
Python
2,574
68
"""Test diagnostics interpretation with QC threshold color cues.""" import json import re from regtools.registration.report.metrics import _render_diagnostics from regtools.registration.report import build_html_report def test_bad_folding_gets_warn_class(tmp_path): with open(tmp_path / "registration_dia...
61c233c3250a650d64bf45fac0c3e9417c1b1106418d08ecb53d60c2df20cfa3
Python
2,575
68
import shutil from batchgenerators.utilities.file_and_folder_operations import * import SimpleITK as sitk from nnunet.paths import nnUNet_raw_data if __name__ == '__main__': #data is available at http://medicalsegmentation.com/covid19/ download_dir = '/home/fabian/Downloads' task_id = 69 t...
fa848a6ef17fc0aa78d86e947f7845fb12a6862a926b261e077b79a7773a2091
Python
2,575
64
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from common_setup import IssueConfig, IssueExperiment, is_test_run BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"] REVISIONS = ["issue535-base", "issue535-v5"] CONFIGS = [ IssueConfig( ...
d11dc67ad86fc6cd07444cf44096ef658de82d895ab223439767cc34bc7915ef
Python
2,576
49
# Copyright 2020 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 of the License at # # ht...
d3fff64d0053428aa46a362634fb751f11117117804fa6e854a240df6f29af4e
Python
2,576
106
""" Interface adapters for low-level readers. """ import abc import io import itertools from typing import BinaryIO, List from .abc import Traversable, TraversableResources class SimpleReader(abc.ABC): """ The minimum, low-level interface required from a resource provider. """ @property @ab...
612c54a4737bcffb74f94b5e03b34e96083bd6be063fee6f3e2ab9d604f4b980
Python
2,577
71
import torch import torch.nn as nn import torch.distributed as dist import torch import torch.distributed as dist class GatherLayer(torch.autograd.Function): """Gather tensors from all process, supporting backward propagation.""" @staticmethod def forward(ctx, input): ctx.save_for_backward(input...