sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a8f161260f326d0c07554067997e949b79e5e15ac1ed7423bf1b5c427d6fe32f
Python
1,771
60
# 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...
30972f25531eb8b336e1dd3bf49a7703f96f01230af0ceea2ec7c474de769dcd
Python
1,772
55
""" Optuna distributed optimization example that optimizes an sklearn classifier for the Iris dataset on Kubernetes. This example's code is mostly the same as the sklearn_simple.py example, except for two things: 1 - It gives a name to the study and sets load_if_exists to True in order to avoid errors when the code i...
9579b6b7329d635b31dc86c9e455313376d302b8c7823e674797c226f632eef2
Python
1,772
53
import sys from pybioshell.std import vector_std_shared_ptr_core_data_sequence_Sequence_t from pybioshell.core.data.io import read_fasta_file from pybioshell.core.alignment import AlignmentType from pybioshell.core.protocols import PairwiseSequenceIdentityProtocol if len(sys.argv) < 3 : print(""" Reads a .fasta f...
cf5d2984abb64b86ead02789ad56bd3d06cf75fa719d44e2fa27263693b4bc59
Python
1,772
47
# Copyright 2020 The HuggingFace Team. All rights reserved. # # 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 applicabl...
d7e9bd35b69bfb0623e56cb8bef2e60b90cd39dab4efe57bcd96338eadb22b68
Python
1,773
37
# Copyright (c) 2021, Ko Sugawara # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and t...
282bd2ae15c55f1c81cd7692c3b15be2162403ab50f6ead45178253c4834c173
Python
1,774
52
import os import sys read_dir_path = sys.argv[1] ref_path = sys.argv[2] model_name = sys.argv[3] out_dir_path = sys.argv[4] batch=0 modeltype = '' if model_name == "default": batch=512 modeltype = 'default' elif model_name == "TINYX1": batch=1600 modeltype = 'tinynoskipx1' elif model_name == "...
f6a1cd265b93fdbe7ad7a9721fbf15e44882fbbba4a22f2a9183e37b70f5d6c5
Python
1,774
45
#----Figure_04_K_preparation----------------------------------------------------- #------------------------------------------------------------------------------- # This is the code which has to be run in preparation for Figure 04 K # for the connectivity analysis for Reinhard and Fukuda et al. 2024 #--------------...
0a25f8c0f72accd311a368f719ce3d6e590ab02e286e800efaffe5b729e48a7b
Python
1,775
57
import numpy as np from skimage import filters from skimage.color import rgb2gray as skimage_rgb2gray from skimage.morphology import erosion as skimage_erosion from skimage.exposure import adjust_gamma as skimage_adjust_gamma from src.preprocessing.helpers import cutdown, resize_padded def preprocess_image(image, t...
48b868b79c030df3c546bc6b83b13f4e9151d0d554e3c0b9f3c32a57ff132244
Python
1,775
56
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn import torch.nn.functional as F from .sr_backbone_utils import default_init_weights class PixelShufflePack(nn.Module): """ Pixel Shuffle upsample layer. Args: in_channels (int): Number of input channels. out_channels (int)...
6c46a7a6d4274e5c8d2c05fc0b13a35377819720a00e12b25cb0a7a813b22a48
Python
1,775
51
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Sep 9 15:55:48 2023 @author: trianaa1 """ import numpy as np import pandas as pd from scipy.io import loadmat import matplotlib.pyplot as plt ############################################################################### conn_path = '/m/cs/scratch/n...
f30febdf12aef8174639c82820a9d8eac81f6bdf111cd2ca675721fff4cfaf3a
Python
1,775
56
#! /usr/bin/env python # -*- coding: utf-8 -*- #! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from lab.reports import Attribute, arithmetic_mean, geometric_mean import common_setup from common_setup import IssueConfig, IssueExperiment from rel...
a72ad364bc9afd182a769016439ed92627f592d375197b588727079df5bce7a5
Python
1,776
39
import tensorflow as tf import os #from tf_explain.callbacks.grad_cam import GradCAMCallback class CallBacks: def __init__(self, learning_rate=0.01, log_dir=None, optimizer=None, validation_data=None): self.log_dir = log_dir self.learning_rate = learning_rate self.optimizer = optimizer ...
6bf922fbcc53ed2660c0934fafb0b81e8a8e441fb25e4526e728b42abe456308
Python
1,777
51
import numpy as np import matplotlib.pyplot as plt file=np.load('heatmap_SEModularity.npz') SE=file['SE'] modularity=file['modularity'] file1=np.load('heatmap_SEModularity_0.9.npz') modularity1=file1['modularity'] file2=np.load('heatmaps_spectrums.npz') SD_KOP=file2['SD_KOP'] KOP=file2['KOP'] K_all_values=np.arang...
9d707800d93b6c7340df0fa7b6510d060a8c52f5f22d046551197ee045a87749
Python
1,777
34
# 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...
e33ca8db6eb41f41a85a1c9a2b34126adee0aeb46186381d97f2417d6f52df80
Python
1,777
47
import os import os.path as op import mne import mne_bids import nibabel as nib from utils import load_raw from params import BIDS_ROOT as bids_root from params import SUBJECTS as subjects from params import TEMPLATE as template # get plotting information subjects_dir = op.join(bids_root, "derivatives") fs_subjects...
a1aa15cd259a19be97d8d71fd1804eb9f478b6031bd72a02abc46651d782b2ca
Python
1,778
47
"""register_ndim / registration() forward affine_method, affine_overrides, reuse_affine into rg.runRegistration and record them in metadata.""" import inspect import regtools.registration.pipeline as pipe def test_register_ndim_signature_has_affine_params(): sig = inspect.signature(pipe.register_ndim) ...
d33b7b7f5e93043c9c0826a1430b31ddd9bc063322934d0928ad82cf0b91fee9
Python
1,778
36
# THIS FILE HAS BEEN AUTOGENERATED. To update: # 1. modify: models/auto/modeling_auto.py # 2. run: python utils/class_mapping_update.py from collections import OrderedDict MODEL_FOR_QUESTION_ANSWERING_MAPPING_NAMES = OrderedDict( [ ("BigBirdConfig", "BigBirdForQuestionAnswering"), ("ConvBertConfig...
0cdf76b4eb103e73efafeec6deaf34a40d0f367ec10cd1fef87ce5655ed72ad7
Python
1,779
53
# 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...
17f658e991f4c02d302f1f431eed13b92cfac059af3a78df90676046e1d1db19
Python
1,779
53
"""HiDisc loss module. Copyright (c) 2024 University of Michigan. All rights reserved. Licensed under the MIT License. See LICENSE for license information. """ from typing import Tuple, Dict, Optional, Any import torch from torch import nn from fastglioma.losses.supcon import SupConLoss class HiDiscLoss(nn.Module)...
41833e795686e8f92215a867a1e77ca02a5963d4edf6aca6b349ffa1da9eeb3c
Python
1,779
52
# Import package import syncopy as spy from syncopy.tests import synth_data # basic dataset properties nTrials = 100 samplerate = 5000 # in Hz # add a harmonic with 200Hz adata = 2 * synth_data.harmonic(nTrials, freq=200, samplerate=samplerate) # add another harmonic with 1300Hz adata += synth_data.harmonic(nTrials...
14534fd33e4fc674e58dfb1e168660d2d123bf7b8dcef196ca14281fe9d4162b
Python
1,780
65
############################################################################################################ # Set classes for handling pexceptions in the PySeg package # # __author__ = 'martinez' ################################################################################################ # Exceptions class PySe...
8bf96a9826eb603e42059971bdee7111a7775785ed8491f35c95109ae4e264b3
Python
1,780
57
"""GPU (torch/CUDA) metric backend: parity with CPU + the CPU-force override. The parity test skips on a CPU-only box (CI). The override test always runs - it is the guarantee that a machine can opt out of the GPU path. """ import numpy as np import pytest from regtools.registration.core import metrics as M...
0e8340299273f7d32c0338d573bd6ca82d3ce22cffec63a88d88dc689e20ea34
Python
1,781
53
from sklearn.metrics import roc_auc_score import numpy as np from sklearn.model_selection import permutation_test_score from tqdm import tqdm def is_ndarray(img): return isinstance(img, np.ndarray) def permutation_test(v1, v2, fct, seed=1, permutations=2000, verbose=False): if not is_ndarray(v1): v1 =...
4e8a382189824a313291c79c4a299e875dc25c045b4b8471c26fa20a767304a5
Python
1,781
65
from datetime import datetime as dt import numpy as np import scipy.stats from tabulate import tabulate def timestamp_human(): return dt.now().strftime('%d-%m-%Y %H:%M:%S') def timestamp_dir(): return dt.now().strftime("%Y-%m-%d_%H-%M-%S.%f")[:-3] def print_dataframe(df, n=-1, n_digits=3): print(tabul...
52f7a7b73da935955f64eea3686e5d2402caef69c2c507a54abda7908db0855c
Python
1,781
30
# https://arxiv.org/abs/2105.02786 GENERAL_REGION_LIST = [['FP1', 'FPZ', 'FP2'], ['AF7', 'AF3', 'AFZ', 'AF4', 'AF8'], ['F7', 'F5', 'F3', 'F1', 'FZ', 'F2', 'F4', 'F6', 'F8'], ['FC5', 'FC3', 'FC1', 'FCZ', 'FC2', 'FC4', 'FC6'], ['C...
da1ac084ed39306c59d084b4480a17ebcb44148f73b896bac1054087978c6ee6
Python
1,781
47
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn.functional as F def flow_warp(x, flow, interpolation='bilinear', padding_mode='zeros', align_corners=True): """Warp an image or a feature map with optical flow. Args: x...
45bd77436f32a0b8748f5829c79494d239517ac35cb76d5e40246c9da3bdc4a0
Python
1,782
54
import logging from optparse import Values from typing import List from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import ERROR, SUCCESS from pip._internal.operations.check import ( check_package_set, create_package_set_from_installed, warn_legacy_versions_and_specifi...
8789b0bce02d28a5f020f642966eaf47dc6acaf269182425d35932b714992226
Python
1,782
48
import torch from wsilearn.dl.pl.pl_modules import ModuleBase class SurvModule(ModuleBase): def __init__(self, loss=None, epoch_metrics=['cind'], **kwargs): """ loss: name of the loss, dictionary(loss=Name,etc) or None """ if loss is None or len(loss)==0: loss = {'name':'coxph'} ...
9a825df5efe5225e39afa07c56aebf71fdc680acd1898fc0d772fcb24c9fc520
Python
1,782
50
import torch def compute_accuracy(config, outputs, targets, augmentation, topk=(1, )): if augmentation: if config.augmentation.use_mixup or config.augmentation.use_cutmix: targets1, targets2, lam = targets accs1 = accuracy(outputs, targets1, topk) accs2 = accuracy(outpu...
eedf82d2cc7d54924d0e8a35371063eef8daef70bc77b260d5d1d49083f72adf
Python
1,783
51
# 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...
7a31a5258678add8b4e9859277932bf2b6010fd60039311e5c8d1b9c7e2bc1f3
Python
1,784
58
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DI...
94ba192d5fe2c9e386773e8cd65b64216deba0e2b4027602aebab0b890bc6f23
Python
1,784
53
import os import anndata import pytest from cirrocumulus.envir import CIRRO_DB_URI, CIRRO_TEST from cirrocumulus.launch import configure_app, create_app from cirrocumulus.prepare_data import PrepareData from cirrocumulus.serve import cached_app @pytest.fixture(scope="session", params=[True, False]) def app_conf(req...
ae7dc56d9b218cc4c3ae82b74beded984f2fa7b2c0167f15a564483f0bdbe8bf
Python
1,784
52
"""A BIDS tabular file including its associated sidecar.""" import os from hed.models.tabular_input import TabularInput from hed.tools.bids.bids_file import BidsFile from hed.tools.bids.bids_sidecar_file import BidsSidecarFile class BidsTabularFile(BidsFile): """A BIDS tabular file including its associated side...
fe1b21be12dfa57d8b827bb333f2cbf23b274f54bddd4212939cbfa0a46d96d3
Python
1,784
49
from cloudvolume import CloudVolume, Storage from shapely.geometry import Polygon, box import numpy as np from io import BytesIO from PIL import Image, ImageDraw mip = 6 mask = Storage('gs://neuroglancer/pinky100_v0/edge_mask') order = Storage('gs://neuroglancer/pinky100_v0/z_order_corrected') out = CloudVolume('gs://...
4d917108cc2fdcaa4057c4c77eed6d8efc08275b997d95b7b60b87107d4a927d
Python
1,785
52
from torch.utils.data import Dataset import linecache import os import numpy as np base2code_dna = {'A': 0, 'C': 1, 'G': 2, 'T': 3, 'N': 4} code2base_dna = {0: 'A', 1: 'C', 2: 'G', 3: 'T', 4: 'N'} def clear_linecache(): # linecache should be treated carefully linecache.clearcache() def parse_...
85e72b36c7c46da5614b7eab3aee863418e1fff5f9f05bc1d8a995917dbefee7
Python
1,785
47
import torch import numpy as np from scipy.spatial import distance_matrix, minkowski_distance, distance def calcADJ(coord, k=8, distanceType='euclidean', pruneTag='NA', all_conn = False): r""" Calculate spatial Matrix directly use X/Y coordinates """ spatialMatrix=coord nodes=spatialMatrix.shape[0] ...
e42365b134916202f0f7d92684d40659ed71615d854b5da61b74dd9d02aec81d
Python
1,785
56
import os from torch.utils import data as torch_data from torchdrug import data, utils from torchdrug.core import Registry as R @R.register("datasets.YAGO310") class YAGO310(data.KnowledgeGraphDataset): """ Subset of YAGO3 knowledge base for knowledge graph reasoning. Statistics: - #Entity: 123...
41160c1ec0da97150c09984700520ec099e5d7296e037b07dcab73e21c6ba0b3
Python
1,786
33
"""Python function to read CIFTI files without needing to install connectome workbench Adapted and modified from https://nbviewer.org/github/neurohackademy/nh2020-curriculum/blob/master/we-nibabel-markiewicz/NiBabel.ipynb """ import nibabel as nib import numpy as np def read_cifti(file): ''' file: filename...
a56a68f28dc421aaacf5e566a39e75ca4a95b227790a01c5cac6854e3f0b795f
Python
1,786
73
import os import time import numpy as np from plotter import plot_phi, plot_c_alpha, plot_phi_m from ednm import model, solver # number of units N_units = 10 # distance between units [cm] dxu = 5.0e-4 # boundary condition (0: closed, 1: periodic) bc = 1 # simulation duration Tstop = 1.5 # set synapse model (0, 1...
a83629b450c320a6b60bf5e86649bf9fb1e30fcee37ff5bdc42c43ad428217ff
Python
1,787
52
#! /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 = ["issue635-base", "issue635-v2"] CONFIGS = [ IssueConfig( ...
b40b104c1a6482f6419057877596b683dffe984d625d417cb901cadee7bb17a5
Python
1,787
52
#! /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 = ["issue635-base", "issue635-v3"] CONFIGS = [ IssueConfig( ...
cd2e4345c60f25066f345fd9aaee492ca2f6608521b8bedc3bfe75f3dbe7088d
Python
1,787
84
import autograd.numpy as np import autograd.numpy.random as npr from autograd import grad from autograd import isinstance as ag_isinstance from autograd import list as ag_list from autograd.test_util import check_grads npr.seed(1) def test_getter(): def fun(input_list): A = np.sum(input_list[0]) ...
d7e395347ea2d2bb5f38223ec51fd1ae9d105917c4181304a36b53499c68b6de
Python
1,787
43
import numpy as np from trimesh.creation import icosphere from src.utils.general import cart2spher class Sphere: # this is the sphere object, that is used for obtaining the right data for the GEM-CNN. # it contains the points where the image intensities are sampled for each vertex in the mesh def __init__...
d8d62366d4e2dd70f32135d72d63a7162e968bda392a3b8d80fc4c92bd6fd7f4
Python
1,787
80
import math import matplotlib.pyplot as plt import numpy as np import meep as mp def metal_cavity(w): resolution = 50 sxy = 2 dpml = 1 sxy += 2 * dpml cell = mp.Vector3(sxy, sxy) pml_layers = [mp.PML(dpml)] a = 1 t = 0.1 geometry = [ mp.Block(mp.Vector3(a + 2 * t, a + 2 ...
e8f95dee82b8cf12ffd293a93ca2bf4b03c33b24133309cd71687f1c31ff578f
Python
1,787
49
try: import binutil # required to import from dreamcoder modules except ModuleNotFoundError: import bin.binutil # alt import if called as module from dreamcoder.dreaming import backgroundHelmholtzEnumeration from dreamcoder.grammar import Grammar from dreamcoder.program import Program from dreamcoder.recogni...
1472fc26fd0580738762a7b1deba8c789a7bbc1869e1e278dcfd48b0d9073580
Python
1,788
54
import numpy as np import h5py from scipy.stats import pearsonr with h5py.File(('seq_onehot.h5'), 'r') as hf: X = hf['seq_onehot'][:] with h5py.File(('expression.h5'), 'r') as hf: Y = hf['expression'][:] from sklearn.model_selection import train_test_split # split into train and test datasets X_train, X_tes...
4afc6d3f95232edf7e1cb79ebd94ff4c8942c92f23f0388e1deff643975e1713
Python
1,788
50
import os.path from ckg.graphdb_builder import mapping as mp, builder_utils ###################################### # Databases at jensenLab.org) # ###################################### def parser(databases_directory, download=True): result = {} config = builder_utils.get_config(config_name="jensenlab...
5b5d76daf3cdfced411c60d2b306d89d76e6cc28ce21338088950e7b8c82c985
Python
1,788
61
# Taku Ito # 2/21/2019 # Multiple linear regression (with L2 regularization option) import numpy as np def regression(data,regressors,alpha=0,constant=True,betasonly=False,residualsonly=False): """ Taku Ito 2/21/2019 Hand coded OLS regression using closed form equation: betas = (X'X + alpha*I)^(-1)...
abfa77ad7475aeea3957654cf1d85e0defeab2bc4c2b2a40d902d9e2afff59d9
Python
1,788
50
from pylearn2.utils import serial import sys _, model_path = sys.argv model = serial.load(model_path) from pylearn2.gui.patch_viewer import make_viewer space = model.generator.get_output_space() from pylearn2.space import VectorSpace from pylearn2.config import yaml_parse import numpy as np match_train = True if match...
ac81a74326050b275ba6ed9fa5e075690e7d9b4274f692b51691d1445e44c5ca
Python
1,788
55
# 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...
c970cbf230d36da84950aa507eda8aba753894474582ba3b762d7138520059dd
Python
1,788
48
from . import loadDefaultParams as dp from . import timeIntegration as ti from ..model import Model class WWModel(Model): """ Wong-Wang model. Original version and reduced version. Main reference: [original] Wong, K. F., & Wang, X. J. (2006). A recurrent network mechanism of time integrat...
e6284eeb96cda4fdadf0b6394681ca65ae7b921333dd1a514ef1be91437a5ddc
Python
1,788
79
import yaml from src import conv_onet method_dict = { 'conv_onet': conv_onet } def load_config(path, default_path=None): """ Loads config file. Args: path (str): path to config file. default_path (str, optional): whether to use default path. Defaults to None. Returns: c...
22ebfd768fa92e055f40b6ed6690c123fb9739bf62cac731508f569a4d40d760
Python
1,789
39
import os import pandas as pd import numpy as np import unittest import sys sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../src") from hornet.model import normalize class TestNormalize(unittest.TestCase): def setUp(self): self.df = pd.DataFrame({ 'etot': [1., 2., 3.],...
5197ac0f113d9b7e0164050bda73369b7192fee3d9a7012681707c7a2b9db561
Python
1,789
59
""" Optuna example that optimizes a classifier configuration for the Iris dataset using scikit-learn and records hyperparameters and metrics using aim. In this example we optimize random forest classifier for the Iris dataset. All hyperparameters and metrics will be logged to aim via integration callback. You can run...
610d2e61a6567e1815959ec44955c93e5253da87693ed9012c22e7d29a4045b8
Python
1,789
80
import os import numpy as np import torch class BestMeter(object): """Computes and stores the best value""" def __init__(self, best_type): self.best_type = best_type self.count = 0 self.reset() def reset(self): if self.best_type == 'min': self.best = fl...
1b893c1fcf2b53414a2375e7e3ebdcd2e824438bf7aae565334cdfe06235c5dc
Python
1,791
50
import yaml import json import argparse import os import open3d as o3d parser = argparse.ArgumentParser( description='Arguments for prep own data.' ) parser.add_argument('--ouput_config', type=str, help='Path to config file.') parser.add_argument('--scene_folder', type=str, help='Path to the fol...
26ccd52714846c85d156bff003254b9acb0e13c5013a8f8edf1df5c1ec04312b
Python
1,791
63
from typing import cast from elasticai.creator.file_generation.in_memory_path import InMemoryFile, InMemoryPath from elasticai.creator.nn.identity.layer import BufferedIdentity, BufferlessIdentity def test_buffered_identity_generates_correct_vhdl_code() -> None: expected = """library ieee; use ieee.std_logic_116...
b47029c6d8a7db0c4d7e2a30c43859c1b0ddec12acb1530fa026eba3c9cb5fa1
Python
1,791
61
from setuptools import setup, find_packages __version__ = '1.1.3' URL = 'https://github.com/tczhangzhi/torcheeg' install_requires = [ 'tqdm>=4.64.0', 'numpy>=1.21.5', 'pandas>=1.3.5', 'xlrd>=2.0.1', 'scipy>=1.7.3, <= 1.10.1', 'scikit-learn>=1.0.2', 'lmdb>=1.3.0', 'einops>=0.4.1', 'mne>=1.0.3', 'xmltodict>...
ded21297d3b4abfe7d284dd3bda1238c88521b02c105dde5c9cc5c374acc7704
Python
1,792
61
import numpy as np from netket.hilbert import AbstractHilbert from netket.operator import ContinuousOperator, AbstractOperator from .operator.tevo import UFromHOperator COEFFS = [ (), (1,), ((1 + 1j) / 2, (1 - 1j) / 2), ( 0.18673085336460016 + 0.4807738845503311j, 0.18673085336460016...
3f1a6802a97e385b5ff3ed17c847c4c4aafe2b7f10e1244debe6c4f7fbb825ec
Python
1,793
56
#!/usr/bin/env python # -*- coding: utf-8 -*- """Demonstrate usage of LFPy.NetworkPopulation with a ball-and-stick type morphology with active HH channels inserted in the soma and passive-leak channels distributed throughout the apical stick. The corresponding morphology and template-specification is in the files BallA...
4079f73fb7830b7ae565448e6d3138bf25d6855c36fdcf5f3d48f3f44f24914d
Python
1,793
56
import argparse from pprint import pprint import dataset as module_dataset import datasets_manager as module_datasets_manager import runner as module_runner from parse_config import ConfigParser from utils import set_random_seed SEED = 1126 set_random_seed(SEED) def main(config): Datasets = {project_id: config.in...
5248c42c8c47621c04226494ade26e5f2423bbab1a3b6dc512b168575da810cf
Python
1,793
37
from .common import MultiLayerPerceptron, GaussianSmearing, MutualInformation, PairNorm, InstanceNorm, Sequential, \ SinusoidalPositionEmbedding from .block import ProteinResNetBlock, SelfAttentionBlock, ProteinBERTBlock from .conv import MessagePassingBase, GraphConv, GraphAttentionConv, RelationalGraphConv, Grap...
cd2898de6fcb3a9feac4e11d4630c15e9eefef2a23bb6c8b01ecb9821d834db0
Python
1,793
54
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites, configs from downward.reports.compare import CompareConfigsReport import common_setup REVISIONS = ["issue462-base", "issue462-v1"] CONFIGS = configs.default_configs_optimal() # remove config that is disabled in this branch del CONFIGS['asta...
93b710a02c0862160cc45a85a126a5553d16bdc2a2a4a2c6e10d8703de876015
Python
1,794
65
"""Classes for generating and representing templates for HMP event detection. Main class Pattern and including a half-sine wave template (`HalfSine`) Classes ------- Pattern - Main class HalfSine Generates a normalized half-sine wave template for use in signal processing or event detection. """ f...
20d68f29253e59035c18d694f398c865f44df07b8b72680002168b2cb664b2d9
Python
1,795
72
import matplotlib.pyplot as plot import math import sys import re plot.figure() A = len(sys.argv) - 1 assert A == 3 for a,fn in enumerate(sys.argv[1:]): print(fn) ss = [] hs = [] cs = [] es = [] with open(fn,"r") as handle: for l in handle: if not l.startswith("DATA"): ...
299c9ab594c85b853794df7f7eb8764310d4349285afc62c734dce13cf352022
Python
1,795
39
# 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...
4b4e02043d7db13386dfdf3c920b72035079c2939e404789cd8c4174a8cc2124
Python
1,795
50
"""Run simulation ----------------- Run a simulation of the mesocircuit model. """ ############################################################################### # Import the necessary modules. import os import sys import mesocircuit.mesocircuit_framework as mesoframe import mesocircuit.simulation.network as networ...
a68c54a7a14f21d87f2481beb71b1c61f0d99a7178c5da902aa6973c3c8d450a
Python
1,796
75
import sys, os sys.path.append(os.path.abspath(".")) import torch import torch.nn as nn import torch.optim as optim from collections import OrderedDict import prosper_nn.utils.neuron_correlation_hidden_layers as nchl # %% Create dummy data n_data = 10 X = torch.rand([n_data, 100]) Y = torch.rand([n_data, 1]) # %% ...
e6f43ae519b340dc4c5bae4ebda9f53eece501eb030a21a20543389bc2ecffa5
Python
1,796
54
""" Custom function """ import torch def TwoStateFractionFoldedMod( X = None, trainable_parameters = {}): """ 1-dimensional nonlinear transformation relating modified Gibbs free energy of folding to fraction of molecules folded. :param X: list of tensors (required). :param trainable_paramete...
b6f8a52025e4e45651d9bdc7a4ffdb1de75905ed2d1b26c194125b064e578c38
Python
1,797
59
import setuptools import os import sys with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() version_path = os.path.join(os.path.dirname(__file__), 'src') sys.path.append(version_path) from version import __version__ setuptools.setup( name=__version__, version="0.1.0", ...
cee4f73ce29fb583f97e67352767ca9324583a6d7bc97799716a17d9e48c3c7c
Python
1,797
51
import librosa import librosa.display import io import os y, sr = librosa.load('7346_T1a_ADOS\\audio_clip.mp3') y = librosa.effects.harmonic(y) tonnetz = librosa.feature.tonnetz(y=y, sr=sr) print(str(tonnetz)) import matplotlib.pyplot as plt fig, ax = plt.subplots(nrows=2, sharex=True) img1 = librosa.display.specsho...
16c736acc7e83a929a85b28677462a96be9a2024a132afc7bfee9d84fd2ff51d
Python
1,798
49
import sys import argparse import os import struct import torch from utils.torch_utils import select_device def parse_args(): parser = argparse.ArgumentParser(description='Convert .pt file to .wts') parser.add_argument('-w', '--weights', required=True, help='Input weights (.pt) file path (required)') pars...
56245f3f43c842a3d099e641e636a851b095212081d7d94a2596ef04946c54c5
Python
1,798
45
#----Figure_05_A_preparation---------------------------------------------------- #------------------------------------------------------------------------------- # This is the code which has to be run in preparation for Figure 05 Panel A # for the connectivity analysis for Reinhard and Fukuda et al. 2024 #---------...
342980b907a2c43a5fe588d843131368ea46476e0f568f51b8ebd1e7023167f2
Python
1,799
65
# Node group "Inverse Mass" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # Shared by several assets, which import it; not an asset itself. # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated...
caf39c260ce8731cb14876b7a391375e806c638469ac8d5d8d9493dc415d6ccb
Python
1,799
52
""" A simple library to format JSON strings in the format that I wanted them. Removes linebreaks that do not correspond to the start of a JSON object """ import re import json def clean_json_dump(object, fd, *args, **kwargs): """ Dump JSON representation of an object to a file >>> clean_json_dump({'hello'...
af7a4bbb4d69286db70d90bd4aecec00e2d133b69d20001a397947da3cd407d7
Python
1,800
51
import urllib import optuna from optuna.integration.tensorboard import TensorBoardCallback import tensorflow as tf # TODO(crcrpar): Remove the below three lines once everything is ok. # Register a global custom opener to avoid HTTP Error 403: Forbidden when downloading MNIST. opener = urllib.request.build_opener() o...
29b6b96eec2c2ac938030ee09f097e0a8c4be05ae02353a59ab85feab6c7e203
Python
1,801
53
import os from torch.utils import data as torch_data from torchdrug import data, utils from torchdrug.core import Registry as R @R.register("datasets.Fold") @utils.copy_args(data.ProteinDataset.load_lmdbs, ignore=("target_fields",)) class Fold(data.ProteinDataset): """ Fold labels for a set of proteins dete...
6ffb59cb6f33f32d699916c18d0a12466064c0a0d9c4ee077c39bfdc66957dfe
Python
1,801
46
#----Figure_04_J_preparation---------------------------------------------------- #------------------------------------------------------------------------------- # This is the code which has to be run in preparation for Figure 04 Panel J # for the connectivity analysis for Reinhard and Fukuda et al. 2024 #---------...
11e3bf5de7d52fb3eee2233f0fccec321b43652b6265a4d9400beb0177f87944
Python
1,802
62
#!/usr/bin/python3 import sys import argparse import os import subprocess def run_plink_regression(bfile, outfile, misspheno, pheno, covar, chrom = None, remove = None, pheno_name = None): cmd = ["plink", "--bfile", args.bfile, "--out", args.outfile, "--missing-phenotype", args...
4b8c345ced63ab81819d18ebb95c8602f00a27c9dd521a95a19ab8e92e19b7cd
Python
1,802
50
import torch from torch import nn def gaussian_smearing(distances, offset, widths, centered=False): if not centered: # compute width of Gaussian functions (using an overlap of 1 STDDEV) coeff = -0.5 / torch.pow(widths, 2) # Use advanced indexing to compute the individual components ...
4bdd3e7675283f76e49d824bf88bb14099e0e454316e472e5dfe0cb7cdca2658
Python
1,802
50
import torch.nn as nn import torch from models.tools import TransLastTwoC def gen_mlp_module(node_dims, dropout=0.0, norm=True, activation='ReLU', last_acti=False, last_norm=True, norm_type='bn', last_dropout: bool = None): if last_dropout is None: last_dropout = last_acti ...
915067900111b247bb050584d56892af7dd52c5dc9bec9a658ebbebd53b850ec
Python
1,802
66
#! /usr/bin/env python # -*- coding: utf-8 -*- import itertools import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment from downward.reports.compare import ComparativeReport import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterP...
fa7b8b77e530a599a9fb2b5b5ed807446e624dde5f2635acf089b67be05965b5
Python
1,802
50
import io import os import unittest from unittest.mock import patch from hed.scripts.validate_bids import main class Test(unittest.TestCase): @classmethod def setUpClass(cls): cls.data_root = os.path.realpath( os.path.join(os.path.dirname(__file__), "../data/bids_tests/eeg_ds003645s_hed_d...
1c8583881036f831c5855aeb741c1f3b61f117a518d500a350e166894d2dd746
Python
1,803
58
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_D...
1cf83eb492448361ed2bdb0882c983a94ac372074085befd242db5cb3420793f
Python
1,803
56
import argparse from pprint import pprint import dataset as module_dataset import datasets_manager as module_datasets_manager import runner as module_runner from parse_config import ConfigParser from utils import set_random_seed SEED = 1126 set_random_seed(SEED) def main(config): Datasets = {project_id: config.in...
53a459d608dd0ebcfaf1fc69d75522f8c5c91a79e7eab0a26f67bfcf88161186
Python
1,804
62
"""Base jobs for DFTB+""" from __future__ import annotations from typing import TYPE_CHECKING from ase.calculators.dftb import Dftb from quacc.runners.ase import Runner from quacc.schemas.ase import Summarize from quacc.utils.dicts import recursive_dict_merge if TYPE_CHECKING: from typing import Any from ...
06f5a76b5168d1a02c0e73f92ae942c497885cdc468e73deaafd1e0e8c274bb9
Python
1,805
56
# Plots smoothed population rates related to preferential parameters for Fig 6 from os.path import join from get_paths import * import pickle import matplotlib.pyplot as plt import numpy as np from os.path import join import h5py from colors_paultol import colors save_flag = 0 # Load simulation result...
3447eb4fea478ff5f1c017926ac533235def7074cb4a7a18acad92dcb7ee848e
Python
1,805
63
import os import re import fnmatch import torch class AverageMeter(object): """Computes and stores the average and current value""" def __init__(self, name, fmt=':f'): self.name = name self.fmt = fmt self.reset() def reset(self): self.val = 0 self.avg = 0 ...
f2e04aea1e01daad8b1c60baa1a228fd9a9495bed49cb822e093007efcdd9a28
Python
1,805
57
# Cython compile instructions import numpy from setuptools import setup, Extension from Cython.Build import build_ext # To compile, use # python setup.py build --inplace # extensions = [ Extension("pyshot", sources=["pyshot.pyx", './src/shot_descriptor.cpp'], include_dirs=[ ...
034df226042d9866bf37f88801d1cc21bb702e2c84f124fa810f35f127aefddd
Python
1,806
54
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from lab.reports import Attribute, gm from common_setup_no_benchmarks import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport def main(revisions=None): suite = suites.suite_optimal_with_ipc11() confi...
07908679fa4f3b5f1b0431af78b94ba9ff7be3e5778f5793b671a8f70505ef2c
Python
1,806
66
""" Impute missing values using K-Nearest Neighbors""" # import libraries import numpy as np import pickle import sklearn #from nmf_with_missing_values import nmf_with_missing_values import matplotlib.pyplot as plt from sklearn.metrics.pairwise import euclidean_distances from sklearn.neighbors import KNeighborsRegress...
68104d74cf85f9e6023a1a383baa849504c67a5997bf1b428a3766c22711b501
Python
1,806
56
# -*- coding: utf-8 -*- # @title Main # @file main.py # @author Romain Beaubois # @date 06 Oct 2023 # @copyright # SPDX-FileCopyrightText: © 2023 Romain Beaubois <refbeaubois@yahoo.com> # SPDX-License-Identifier: GPL-3.0-or-later # # @brief # # @details # > **06 Oct 2023** : file creat...
c227733f022d66bb937f48802d03311d0f25982e6088cdfc70fea5145c473130
Python
1,806
70
from function import * ''' 入力を受け取る ''' parser = argparse.ArgumentParser(description=''' model training ''') parser.add_argument("model_name", help="model name") parser.add_argument("weight_path", help="weight_path") args = parser.parse_args() model_name = args.model_name weight_path = args.weight_path df = pd.read...
95f440541997332dd0b60cac8779a2dc0aa372444ec93acb00077cbd7c648f12
Python
1,807
55
import sys import scanpy as sc import anndata import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import cell2location import scvi from matplotlib import rcParams rcParams['pdf.fonttype'] = 42 # enables correct plotting of text import seaborn as sns fpath = "/scratch/mshru...
b0383938ac8f238e443331193b021fcdd47a5444c124fe8af84c606668cc643d
Python
1,807
65
from types import SimpleNamespace import openmm import pytest from calvados.sim import Sim, _split_steps @pytest.mark.parametrize("steps", [1, 7, 10, 11, 105]) def test_split_steps_preserves_requested_total(steps: int) -> None: batches = _split_steps(steps) assert sum(batches) == steps assert len(batch...
75acaa11d2bf7f9aaf10942a5408684736b72a486cc715a6d18b0740ecd24dfd
Python
1,808
43
# 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...
7867acff53bb5fd53be76db809bbf574ebdc315e9cf17dea1c72f9acde20d59c
Python
1,808
69
# Node-group asset "Rotation cisTEM" (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_CHECKI...
cfaf1c416c30d32fb4e7754e807dd2cc3d0c09ed61ee932a98231eba8352c873
Python
1,808
71
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from torch.distributions import Normal from torch.optim import Adam from collections import deque, namedtuple import copy from .initi_update import soft_update, hard_update, weights_init_ class Actor(nn.Module): def ...
72d40843f829135c43892a07d4319082f069b03470070658ad9b4ef5528d1a8c
Python
1,809
59
# 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...
91789a28243c71dc4084027808f805f359a452ba8371c0db16f7463cb6947a45
Python
1,809
55
from PIL import Image import numpy as np import h5py import os import sys import cv2 # Maybe consider implemeting more involved auto-balancing # http://wiki.cmci.info/documents/120206pyip_cooking/python_imagej_cookbook#automatic_brightnesscontrast_button def open(fn): print "Opening " + fn ext = os.path.splitext(fn...