sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a044a392a297bed83a9e47115c716d6d6bae58d69a443498d9bd6c2bfb935004
Python
913
22
#!/usr/bin/env python3.9 # train an AI model, track runtime for epochs and save the best models (loss/accuracy) from ownutil import ParseArgs, PrepareData # read command line arguments (data set, epoch number, train/validation size) args = ParseArgs() #model specific wired setup args.modelnum = 3 # model 3 arg...
b08e981fa9ae9c9c4d0c80362d647d3c2b35e81897b3b327802d3a3ac42ff461
Python
913
50
import numpy as np import math import matplotlib.pyplot as plt x = np.arange(-90, 90, 0.1) vhm = -12.2 ka = 4.0 vhh = -52.5 ki = 5.6 atm = 1.5 btm = -8.2 ctm = 9.1 dtm = 15.4 etm = 0.1 ath = 83.8 bth = 52.9 cth = -3.5 dth = 72.1 eth = 23.9 fth = -3.6 y1 = [] y2 = [] y3 = [] y4 = [] for v in x: min...
d441741ce983060e8af83f9c1a6adcc79d255a86af7222c31320e2802d1e768f
Python
913
26
class TestLogging: def _test_log_output_manually(self): from cuppa.logger import initialize_logging initialize_logging("/Users/lnguyen/Desktop/train.log") from cuppa.runners.training_runner import TrainingRunner from cuppa.constants import DEFAULT_FUSION_OVERRIDES_PATH from...
22ae2f8d8f3abb1551f0c66ac6c1178a73b49714c270c5e6e414294ca03bca84
Python
914
29
import sys from pathlib import Path import h5py from bifrost.io import read_affine, read_image def main(): transform_path = Path(sys.argv[1]) with h5py.File(str(transform_path), "r") as h5_handle: # writes aff.mat to transform_path parent dir read_affine(h5_handle, "/syn/affine", directory=t...
9b9f14a968c1f2153a83acc6013db2bc62d9340fd65c37546c85e8974fee039c
Python
914
31
__all__ = [ "QmData", "Graph", "GraphGenerator", "GraphGeneratorSettings", "ElementLookUpTable", "FileHandler", ] def __getattr__(name): if name == "GraphGeneratorSettings": from .graph_generator_settings import GraphGeneratorSettings return GraphGeneratorSettings if nam...
a06b8a3d726cbe9cf81d7b01e3da062c7951db8a04df5fbb5ba06d3a28546d02
Python
914
30
import pytest from pupil_recording_interface.packet import Packet class TestPacket: def test_constructor(self): """""" packet = Packet("stream_name", "device_uid", 1.0) assert packet.stream_name == "stream_name" assert packet.device_uid == "device_uid" assert packet.timest...
ad57f65156e6930e2a0003981130bd921761c7ede065137a32d0f6600fc6baca
Python
914
33
import json import h5py import numpy as np from cirrocumulus.abstract_backed_dataset import AbstractBackedDataset class H5ADDataset(AbstractBackedDataset): def __init__(self): super().__init__() def get_suffixes(self): return ["h5ad"] def is_group(self, node): return isinstance...
41b9844a404b399b3fcdf5d9f7c417ee6443ba3e7208b1a0207e25994a86083a
Python
915
33
import numpy as np import sklearn.preprocessing def data_discretization(X, n_bins): """ This function implements the data discretization function to discrete data into n_bins Input ----- X: {numpy array}, shape (n_samples, n_features) input data n_bins: {int} number of bins to...
5e5888da36f8ef7b3b5cc1e50c4ef407df47d5360a39dbea5ca3d7b4a7b2bd9e
Python
915
31
""" test the configuration parser""" from pathlib import Path import layer_recognition.utilities as tested CONFIG_DIR = Path(__file__).resolve().parent.parent / "Config" def test_converter_config(): config_file_path = CONFIG_DIR / "batch_convert.ini" print(f'DEBUG config_file_path {config_file_path}') ...
b9bf3b99c053d61de3f187db400a2c163c66517b117c46402af73c175530b6d7
Python
915
22
import os import pandas as pd import numpy as np import pickle from tqdm import tqdm from argparse import ArgumentParser, Namespace, FileType parser = ArgumentParser() parser.add_argument('--config', type=FileType(mode='r'), default=None) parser.add_argument('--out_dir', type=str, default='./data/', help='gpu id') arg...
be37f465de70fbc24d91b81f0c593ea5d1063ddc44d53a0a79b6d7c9cca81da2
Python
915
29
# Written by Minh Nguyen and CBIG under MIT license: # https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md import unittest from datetime import datetime from dateutil.relativedelta import relativedelta import numpy as np import cbig.Nguyen2020.misc as misc def inefficient_month_between(end, start): """ ...
c1b161fecf1938dc3069ed8a71c96220208543a32777b92d1920a07790f1dadc
Python
915
31
## Inset the "TER" expression between two chains in PDB ## Usage: python3 chain_ter.py pdb_file ## output pdb filename is extended by the term "_fmt" import sys if len( sys.argv ) < 2: print("provide pdbfile") sys.exit() pdb_file = sys.argv[1] out_file = pdb_file.split(".")[0]+"_fmt.pdb" ## First find the fir...
30237fd92b2fa2eaafb100ecadd2e4e96cb9c6a5e13c052635b4071ddf26df58
Python
916
32
"""Generate the code reference pages and navigation.""" from __future__ import annotations from pathlib import Path import mkdocs_gen_files nav = mkdocs_gen_files.Nav() for path in sorted(Path("src").rglob("*.py")): module_path = path.relative_to("src").with_suffix("") doc_path = path.relative_to("src").wi...
37a8b749626406dc910c37619e1d4bc6d6a3bafe5ae4f707171a481c8f763cb8
Python
916
34
import os import torch import pandas as pd import matplotlib.pyplot as plt from run import * # 1e-3 ,4, 32 LR = 1e-3 input_size = 280 output_sizes = [2] batch_size_label = 128 hidden_sizes = [2048, 2048] Epoch = 8 K = 1 accs= [] accs_inclass=[] Permute = 1 for perm in range(Permute): prediction = [] for k...
ca6cdaee6e21c0cbdbefa16ecdf2b3322beb056b17f59cae0dbaff8faba10172
Python
916
22
#!/usr/bin/env python3.9 # train an AI model, track runtime for epochs and save the best models (loss/accuracy) from ownutil import ParseArgs, PrepareData # read command line arguments (data set, epoch number, train/validation size) args = ParseArgs() #model specific wired setup args.modelnum = 5 # model 5 arg...
991bea16a44d9f0ccd90942befed9345d896c820e6d369d8ab4799c7ed079cdb
Python
917
37
import numpy as np import pandas as pd from sklearn.preprocessing import StandardScaler def simulate_outcome( dfG: pd.DataFrame, dfe: pd.DataFrame, v_caus: float, v_hp: float, frac_hp_snps: float = 0.1, ) -> pd.DataFrame: num_snps = dfG.shape[1] hpr_indices = np.random.choice( r...
43cd120600f1e71d2b3721b5effb958cfc0422280962f3a4151f6486f61708d8
Python
919
38
import numpy as np import pytest from SurvivalEVAL.evaluations.others import cov def test_cov_computes_event_time_coefficient_of_variation(): cdf = np.array( [ [0.0, 0.5, 1.0], [0.0, 1.0, 1.0], ] ) time_grid = np.array([0.0, 2.0, 4.0]) mean_cov, cov_values = c...
b8848531fdc1b8d65e07179e3c5d56f2d435f1be68625f355a7d97d6da8a8109
Python
919
34
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser from bonito.cli import basecaller, train, evaluate, view, convert, download, export modules = [ 'basecaller', 'train', 'evaluate', 'view', 'convert', 'download', 'export' ] __version__ = '0.5.0' def main(): parser = ArgumentParser( '...
dea87e603adb05c7807ce27d8341d159bc53007598d29f7d36d6df4b7d03d2de
Python
919
42
from numpy import isnan from wonambi import Dataset from .paths import (eeglab_1_file, eeglab_2_file, eeglab_hdf5_1_file, eeglab_hdf5_2_file, ) def test_ioeeg_eeglab(): d1 = Dataset(eeglab_1_file) d2 = Dataset(eeglab_2_file) ...
36e599891b254fb81565ace1e4d805ca141fe1c79e1d4bed04f876c9fc7ae93c
Python
920
35
from pickle import load, dump from tempfile import NamedTemporaryFile from numpy.testing import assert_array_equal from wonambi.trans import math from wonambi.utils import create_data def test_pickle_01(): data = create_data() tmpfile = NamedTemporaryFile(delete=False) with tmpfile as f: dump(da...
c641d5c2aa2b3c1c1170948ecc48a16803ee8fa8bdbf15f57dfc8c33f797edd8
Python
920
38
"""SWC data format defintion and services.""" import json import numpy as np class SWC(): """Definitions of the data format.""" TYPES = (SOMA, AXON, DEND, APIC) = range(1, 5) COLS = (I, T, X, Y, Z, R, P) = range(7) # noqa: E741 XY = slice(2, 4) XZ = slice(2, 5, 2) YZ = slice(3, 5) XYZ =...
3b21cc4b11db2501fdb863512e77304b7a1008d66a72201488287bc1cfeb2bdd
Python
921
30
import pytest import elasticai.creator.nn.fixed_point as nn_creator from elasticai.creator.arithmetic import FxpArithmetic, FxpParams from tests.integration_tests.nn.fixed_point.precomputed_routine import ( routine_testing_precomputed_module, ) @pytest.mark.ghdl @pytest.mark.parametrize( "total_bits, frac_bi...
3e86cb43238b20a6832c44451341305dbf93d658455c9b7862fa20970464b4ef
Python
921
33
""" This script will copy the files from the archive folder to the BIDS folder @author: trianaa1 """ import os, glob, sys import shutil import pandas as pd path = '/m/cs/archive/networks-pm/mri' savepath = '/m/cs/project/networks-pm/mri/fast_prepro_bids' #search all eye-tracker files search_str = os.path.join(path,...
5ad1a1a207f0097c7d48ae75afc678eabbc41b8f5e0fc14069ad2c866664251b
Python
921
26
import os import re class QSSHelper: def __init__(self): pass @staticmethod def open_qss(path): """ opens a Qt stylesheet with a path relative to the project Note: it changes the urls in the Qt stylesheet (in memory), and makes these urls relative to the project W...
78f22bdfdde631c209134103a33ac1bbbf34636d6cf58e787011c0aeb53cdd1b
Python
922
32
import os import requests from codex import logger def download(url: str, dest_folder: str): logger.debug(f"Downloading {url} to {os.path.abspath(dest_folder)}") if not os.path.exists(dest_folder): logger.debug(f"Creating folder: {dest_folder}") os.makedirs(dest_folder) filename = url....
c2ff33160ac01c32689389dd7d50abab21a95b3f2501aa82e04763db9d81efab
Python
922
31
r"""Test OpenBabel Python bindings On Windows or Linux, you can run these tests at the commandline in the build folder with: "C:\Program Files\CMake 2.6\bin\ctest.exe" -C CTestTestfile.cmake -R pybindtest -VV You could also "chdir" into build/test and run the test file direc...
12884cabc0ba04caeaf11d2ce49a18b004eb94b6f2fd01e8547d9c4c370f98cc
Python
923
41
# From the Meep tutorial: plotting permittivity and fields of a bent waveguide import meep as mp cell = mp.Vector3(16, 16, 0) geometry = [ mp.Block( mp.Vector3(12, 1, mp.inf), center=mp.Vector3(-2.5, -3.5), material=mp.Medium(epsilon=12), ), mp.Block( mp.Vector3(1, 12, mp.in...
29e7a5e777f2deff0ea1df47c2555643620d7f0c2251d95c306f60fdce429a83
Python
923
23
#! /usr/bin/env python from lab.parser import Parser def calculate_old_state_size(content, props): if 'bytes_per_state' not in props and 'preprocessor_variables' in props and 'state_var_t_size' in props: props['bytes_per_state'] = props['preprocessor_variables'] * props['state_var_t_size'] class StateSi...
8d955aeb352555e118674fbb49f5ac85c8b53fc861eea72202c584197bce0e1d
Python
923
25
import hashlib, numpy as np from regtools.registration.run_provenance import collect_environment, image_stats, file_sha256_short def test_collect_environment_keys(): env = collect_environment() assert "python" in env and "platform" in env and "packages" in env assert isinstance(env["packages"], dic...
e0137ae8c4fab49add5aef9de0bbd4f6388848caec8757bfb306ac40100de636
Python
923
38
"""Computes the number of missing datapoints Parameters ---------- file : str path where the raw data is stored """ import os import sys import datetime as dt import pandas as pd import numpy as np file = sys.argv[1] data = pd.read_csv(file, index_col="date") data["date"] = pd....
4444c78487c9fe2238b16004087adf488d350d9ef20dfb67f4b97daac5114484
Python
924
30
"""Schema validation subpackage for HED schema compliance checking. This package contains all schema validation, compliance checking, and attribute validation functionality. """ from .compliance import check_compliance, SchemaValidator, DOMAIN_TO_SECTION, SECTION_TO_DOMAIN, CONTENT_SECTIONS from .compliance_summary i...
f608ff355a8174d35d78f9006c2ef362a4b5b8e52a465f75d685a3483f46940c
Python
924
25
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Script to submit to cluster the estimation of inverse solution ''' import os from warnings import filterwarnings from stormdb.cluster import ClusterBatch from stormdb.access import Query project = 'MINDLAB2020_MEG-AuditoryPatternRecognition' os.environ['MINDLABPROJ']=...
1fc227bfd00756b166cbb6bd670c441b5bd0f4d9b9c3f3c7690a20eac1df8f1d
Python
925
28
# Parameters used in analysis of simulations params = {} # Window size for analysis of I-waves (ms) params["trange_iwaves"] = 50 # objective.py # Voltage value above which simulation will terminate (mV) params["vthresh_error"] = 1000 # simulation.py # Offset before time of I1-wave to remaining I-waves (ms) params["...
2993579ca8e054650816fb5a2025a14e9858ecb6d4936f6343a74e09384a4078
Python
925
25
extensions = dict( set_required_params=""" parms$training_frame <- training_frame args <- .verify_dataxy(training_frame, x, y) parms$ignored_columns <- args$x_ignore parms$response_column <- args$y """ ) doc = dict( preamble=""" H2O ANOVAGLM is used to calculate Type III SS which is used to evaluate the co...
75f011911560e048d07f35ed79aedd180da8dd148a4fac2cdd3bc3aa0f1c5a76
Python
925
45
#! /usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import argparse import re import subprocess import sys STD_REGEX = r"(^|\s+)std::" def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("cc_file", nargs="+") return parser.parse_args() def check_...
540c951ed3524aea43b88f0105826cba853a1299f6da1984c09767ec71d5e195
Python
926
23
from cuppa.sample_data.cuppa_features import CuppaFeaturesLoader from cuppa.classifier.cuppa_classifier import CuppaClassifier from cuppa.constants import DEFAULT_CUPPA_CLASSIFIER_PATH from cuppa.visualization.visualization import CuppaVisDataBuilder, CuppaVisPlotter import importlib_resources as impresources INPUT_PA...
6944f627a491c240c67fbd7e3635a404e9757d1c294b2ebfa21f36e1cb0dae9f
Python
927
33
# 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...
b6e98c8a70c013690b1ca5c08ee4158aedd0cbd98102b183388e697bc87649a0
Python
928
30
# -*- coding: utf-8 -*- # # Populate namespace with datatype routines and classes # # Import __all__ routines from local modules from . import base_data, continuous_data, discrete_data, methods from .base_data import * from .continuous_data import * from .discrete_data import * from .methods.definetrial import * from ...
8ba83870957a624ee3eca0d033a3fdb2e294c98a6d5e350c94141c60d8bf0e1a
Python
929
34
import pandas as pd import plotly.express as px import matplotlib.pyplot as plt import pdb import seaborn as sns #Strange I know, but sns box plots look better df = pd.read_csv('JPSTHTable.csv') dfstim = pd.read_csv('JPSTHTableStim.csv') #pdb.set_trace() dist = df['dist'] figBox = sns.boxplot(y=df['nElecJ']) ...
6fe60a586defd861a95ca8b8cb7ddcceb220e6ee8d4168e253c6e5902d1ea36e
Python
930
28
# 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...
a6b4ed8e98b18674e54f8b8f7626652ad09835fa504c5ab3e3f8f9ab2c9c3994
Python
930
32
from typing import List, Tuple import numpy as np import torch import yacs.config def mixup( batch: Tuple[torch.Tensor, torch.Tensor], alpha: float ) -> Tuple[torch.Tensor, Tuple[torch.Tensor, torch.Tensor, float]]: data, targets = batch indices = torch.randperm(data.size(0)) shuffled_data = data[ind...
456ad68cc96502cc51b59c6717eeee7333e39a4e44d6054ba3c2c8222aa25163
Python
931
23
# 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...
b4529e179fd18dc77ddbd1a496b8e8085d2e170ef4cf74a679e49dca971ab90a
Python
931
32
import os import subprocess from jinja2 import Template import pandas as pd import numpy as np submission = Template("""#!/bin/bash #PBS -W group_list=ku_10001 -A ku_10001 #PBS -N {{dirname}}_{{ionic}} #PBS -m n #PBS -l nodes=1:ppn=1:thinnode #PBS -l mem=50gb #PBS -l walltime=48:00:00 #PBS -e {{dirname}}_{{ionic}}_err...
4627eed3293ea882e3c3534191a98990b906d365354590b602c685f6ae4c48a1
Python
932
21
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """check_us.py —— 扫描 main.tex 中 \texttt 与数学模式之外的裸下划线。""" import re src = open('game/docs/arxiv/main.tex', encoding='utf-8').read() # 先抠掉 \texttt{...}(允许一层花括号嵌套) stripped = re.sub(r'\\texttt\{(?:[^{}]|\{[^{}]*\})*\}', '', src) bad = [] for i, l in enumerate(stripped.split(...
f94d400246346e698c452c7dc2f41e09417d348de0a29cfcd141e0aa3374daae
Python
932
9
"""POST HOC (not pre-registered), 1 Oct 2026: excitatory share of local-neuron output at the break point of each BREAK_IT order (rows saved by BREAK_IT.py in tmp/break_it_rows.csv). output: 06-OUTPUT/posthoc_break_share.txt""" import pandas as pd d = pd.read_csv('D:/eucys/tmp/break_it_rows.csv'); r = d[d.order != 'W'...
fc24f7e1fc1676965193e5d73c7eca059383d9d853f56388fb6b6a95a49e3107
Python
932
31
import setuptools from os import path this_directory = path.abspath(path.dirname(__file__)) with open(path.join(this_directory, "README.md"), encoding="utf-8") as f: long_description = f.read() with open("requirements.txt") as f: requirements = f.read().splitlines() setuptools.setup( name="neurolib", ...
de8d489d53d9ced2f963453c9357582369ab17a3d27d2c7d34bdd328ba36ce0f
Python
933
33
import torch import torch.nn as nn def loss_selector(loss_type): if loss_type == "mse": return nn.MSELoss(reduction="mean") elif loss_type == "mse_with_mask": return mse_with_mask elif loss_type == "mae": return nn.L1Loss(reduction="mean") elif loss_type == "mae_with_mask": ...
f27beb791ceaf1ddc74b97f332b833750e834a748b7006f0910da0787086c0be
Python
935
36
class Token(object): def __init__(self, token, categ, semantics=None, weight=0.001): self._token = token self._categ = categ self._weight = weight self._semantics = semantics def categ(self): return self._categ def weight(self): return self._weight def semantics(self): return sel...
36eddcd7f8f8a6cb5824b73d70cff0f9d853516d3541428d8cb9c3d401f6ace8
Python
936
27
#54121 -+sycu 6y from psychopy import parallel import platform PLATFORM = platform.platform() if 'Linux' in PLATFORM: port = parallel.ParallelPort(address='/dev/parport0') # on MEG stim PC else: # on Win this will work, on Mac we catch error below try: port = parallel.setPortAddress(address='0xDFF8'...
4fecf8860fc10ec81080bc5464445f10b027606b08b3a992f74d88adffffb917
Python
936
24
from distutils.dep_util import newer_group # yes, this is was almost entirely copy-pasted from # 'newer_pairwise()', this is just another convenience # function. def newer_pairwise_group(sources_groups, targets): """Walk both arguments in parallel, testing if each source group is newer than its corresponding ...
7d662cfc5bc0f77a6047a42006cb021e9c0c5b96aef0f2b9278e74d6a520d2c5
Python
936
24
#----Figure_S01_preparation----------------------------------------------------- #------------------------------------------------------------------------------- # This is the code which has to be run in preparation for Figure S01 # for the connectivity analysis for Reinhard and Fukuda et al. 2024 #---------------...
f8fe82ca93d406218e40fce5b45f640fb3b10b1e42894d4c5f79222236badd89
Python
936
29
''' Description: Differential equation solver. Author: Jiaqi Zhang <jiaqi_zhang2@brown.edu> ''' import torch import torchdiffeq import torch.nn as nn # =========================================== class ODE(nn.Module): ''' Ordinary differential equation (ODE) solver. ''' def __init__(self, inp...
dd0e9565b9d64c73b492249ed9fd77d236d20099543ff0d4b79a874e1b0cbccc
Python
937
26
################################################################################ # Copyright (c) 2021-2024, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # Written by D. Jones <djones@llnl.gov> and UCSD collaborators in listed in CONTRIB.md # # All rights reserved....
9b7be475c8531894770fe6654f96eba1d9d52d0cf35e70fc38c54ead838ab1dd
Python
938
30
import unittest import os import random import shutil from torcheeg.model_selection import train_test_split_cross_trial from torcheeg.datasets import DEAPDataset class TestTrainTestSplitCrossTrial(unittest.TestCase): def setUp(self): shutil.rmtree('./tmp_out/') os.mkdir('./tmp_out/') def tes...
5ae020798138545a23e18901bcc3da0d09ce02c1c9ed767a75fd2b889788a877
Python
939
26
"""Top-level package for pertpy.""" import warnings from anndata._core.aligned_df import ImplicitModificationWarning from matplotlib import MatplotlibDeprecationWarning from numba import NumbaDeprecationWarning warnings.filterwarnings("ignore", category=NumbaDeprecationWarning) warnings.filterwarnings("ignore", cate...
71d8758ca021e268380c52659e665e352eaf237eec04e3b84cf44854cb7f6c9b
Python
939
36
"""SWC data format defintion and services.""" import json import numpy as np class SWC(): # pylint: disable=too-few-public-methods """Definitions of the data format.""" TYPES = (SOMA, AXON, DEND, APIC) = range(1, 5) COLS = (I, T, X, Y, Z, R, P) = range(7) XYZ = slice(2, 5) XYZR = slice(2, 6) ...
cdb314111e28d9d4f52717058695535b2c9951d13c95d0951baacaed75949973
Python
939
36
from collections.abc import Iterable from datetime import datetime from elasticai.creator.file_generation.resource_utils import read_text from elasticai.creator.hdl_ir import DataGraph from elasticai.creator.ir2verilog import ( Code, Registry, TemplateDirector, type_handler_iterable, ) @type_handler_...
8faccf94d992852284d31192dae900467267ddccfa5763ac1aca35265b20cca4
Python
940
36
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup REVS = ["issue540-base", "issue540-v1"] LIMITS = {"search_time": 300} SUITE = suites.suite_satisficing_with_ipc11() CONFIGS = { "blind": ["--search", "astar(blind())"], "lama-first": [ "--if-unit-cost", ...
ca85e41e5e65030ff35271d4e169c59454db298f19f6ebe450adf106c6c3c420
Python
940
27
""" TensorLayer provides rich layer implementations trailed for various benchmarks and domain-specific problems. In addition, we also support transparent access to native TensorFlow parameters. For example, we provide not only layers for local response normalization, but also layers that allow user to apply ``tf.nn.lrn...
30844f0b732d3e5fa3f5a2db26cf3386900fb453228805e01ae9d7a061afa0d5
Python
941
22
# -*- coding: utf-8 -*- OPTIMAL = True CONFIGS = [ (1, ["--search", "astar(merge_and_shrink(merge_strategy=merge_precomputed(merge_tree=linear(variable_order=reverse_level))," "shrink_strategy=shrink_bisimulation(greedy=true)," "label_reduction=exact(before_shrinking=true,before_m...
5ec472dd66690940e5d3f7270e1003779e5b1094b8472738c437e88590906cb7
Python
941
42
from __future__ import annotations from dataclasses import dataclass @dataclass class SegmentationConfig: """ Configuration for canonical instance establishment. connectivity Connected-component connectivity used for internally generated instances. None uses full spatial connect...
01c642df0d95a750ab2946320808899f81a125c62ca3e66d03661fe80d898cea
Python
942
20
import sys sys.path.insert(0, '/projects/f_mc1689_1/TaskFCActflow/docs/scripts/final_analyses/') sys.path.insert(0, '/projects/f_mc1689_1/TaskFCActflow/docs/scripts/final_analyses/ActflowToolbox/network_definitions/') import ActflowToolbox as actflow from calc_removal_coords import * #First run dilateParcels.py, to ...
ddc507aef66ffc544a2973b1c9be1a22270fb8760937921c651f69aa0b9e705a
Python
942
18
from src.model import ModelSpikeSorter from src.data import RecordingCrossVal from src.utils import random_seed from src.plot import set_dpi set_dpi(400) random_seed(123) model = ModelSpikeSorter.load(r"E:\KosikLab\Deep-Learning-for-Realtime-Spike-Sorting\data\models\v0_2\2950") recording_cross_val = RecordingCrossVal...
113893d261b0a945e460478c7c06cd435f22524a7eb6f20da83d8d5c1939d6fc
Python
943
39
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward.suites import suite_optimal_with_ipc11 from downward.configs import default_configs_optimal import common_setup REVS = ["issue386-base", "issue386-v1"] CONFIGS = {'astar_ipdb': ['--search', 'astar(ipdb)']} # default_configs_optimal() TEST_RUN = True if ...
61174be8b7adfb62f4c41b6d29536683949da3eb410d7c8f3a61931ed2e880a0
Python
943
36
from collections.abc import Iterable from datetime import datetime from elasticai.creator.file_generation.resource_utils import read_text from elasticai.creator.hdl_ir import DataGraph from elasticai.creator.ir2verilog import ( Code, Registry, TemplateDirector, type_handler_iterable, ) @type_handler_...
ab71cd6d4f96a1e56a8b9b32d03ba514db9ff5410679b465c62525df9b33173a
Python
943
36
from collections.abc import Iterable from datetime import datetime from elasticai.creator.file_generation.resource_utils import read_text from elasticai.creator.hdl_ir import DataGraph from elasticai.creator.ir2verilog import ( Code, Registry, TemplateDirector, type_handler_iterable, ) @type_handler_...
dd8c16da8aced082828aeafbf2c90222f120df5d7eadf422c3264aaee25f3359
Python
943
36
""" Wrapper for avscale command """ import six import fsl.utils.assertions as asrt from fsl.wrappers import wrapperutils as wutils def extract_avscale_output(fn): def _wrapper(*args, **kwargs): capture = six.StringIO() log = kwargs.pop("log", {}) old_stdout = log.get("stdout", None) ...
5df55d483a90415dfcab09695cf1c8bdb5751dfc15911538710a6fc70f986ed0
Python
944
31
"""""" from warnings import warn class Session: """ Context manager for devices, streams and processes. """ def __init__(self, *instances): """ Constructor. Parameters ---------- instances: iterable of any Any object(s) with a start and a stop method. The objects'...
89fb9807ecd8b05718425f708312f851b86176389125c5d930ddc02d31160e0a
Python
944
30
##get charge and phospho from first 20AAs import pandas as pd def get_NTS_features (file): ProtID=[] Charge=[] Phospho=[] TwentyAA=[] f1=open(file) f2=file.replace('.faa','') f2=f2.replace('.csv','_') for ln in f1: if ln.startswith(">"): ProtID.append(ln.spli...
aec5fda9c988581b53b11001c3aca6c641a3ad84c8bd9a9e404f899585cbdf35
Python
944
30
import cocotb import pytest from cocotb.triggers import Timer from elasticai.creator.testing import CocotbTestFixture, eai_testbench def adder_model(a: int, b: int, cin: int) -> tuple[int, int]: return a ^ b ^ cin, 1 if a + b + cin > 1 else 0 @cocotb.test() @eai_testbench async def adder_truthtable(dut): i...
dc038ea54dfc20ef9174247cc8360a30690532b260f5863857747e2999532520
Python
944
35
import argparse import sys import os import glob import numpy as np import pandas as pd from nilearn import image as img import nibabel # Usage: crop.py <input nifti file to be cropped> <filename to save the cropped data> <events file with info necessary for cropping> # Main function if __name__ == '__main__': inp...
111fea90d4f8fff40b89606b3d75136315a681fc682d14e0173bbe5142810647
Python
946
30
import unittest import os import random import shutil from torcheeg.model_selection import train_test_split_groupby_trial from torcheeg.datasets import DEAPDataset class TestTrainTestSplitGroupbyTrial(unittest.TestCase): def setUp(self): shutil.rmtree('./tmp_out/') os.mkdir('./tmp_out/') def...
34c287b80a930823961bd80355bb9b6696cf7f07bee6dc3a76ae811389e29486
Python
946
32
import warnings warnings.filterwarnings("ignore") import numpy as np from pinn.io import load_numpy, sparse_batch from ase import Atoms import pytest def mock_data(n_data, n_batch): from ase.calculators.lj import LennardJones atoms = Atoms('H3', positions=[[0, 0, 0], [0, 1, 0], [1, 1, 0]]) atoms.calc = Le...
641d5cfe0486281b262aa5115ea2bed5bb1830544d36fd302109ddc8dad724bc
Python
946
35
from setuptools import setup, Extension import numpy setup( name='pylib', version='', packages=['v3d', 'v3d.terafly', 'graph', 'anatomy', 'morph_topo', 'neuron_quality'], url='', license='MIT', author='Yufeng Liu', author_email='', description='', ext_modules=[ Extension( ...
2209077e4843cbf24f1342b923af94bd284c7aea5b007bf8f0939cd627790632
Python
947
35
# pylint: disable=too-many-function-args, invalid-name """ FBIRN ICA dataset (with time direction labels) loading script""" import numpy as np from omegaconf import DictConfig from src.datasets.fbirn import load_data as load_original_data def load_data(cfg: DictConfig): """ Return FBIRN normal + inversed ti...
9356baa0107f2750849e8694b84cb33a551a1e289a7e643bc3611430936ea9fc
Python
947
36
from collections.abc import Iterable from datetime import datetime from elasticai.creator.file_generation.resource_utils import read_text from elasticai.creator.hdl_ir import DataGraph from elasticai.creator.ir2verilog import ( Code, Registry, TemplateDirector, type_handler_iterable, ) @type_handler_...
1883ba94751b859cfae60eb3907fbbf1640afbafbc479540fdf7c9cd75f526a4
Python
948
35
"""Testing module morph.""" import numpy as np from treem import Node, Morph def test_node_str(): """Tests for Node string representation.""" node = Node(value=1) assert str(node) == '1' def test_node_point(): """Tests for Node data point.""" node = Node(value=np.array([1, 1, 0, 0, 0, 1, -1]))...
d1bd1779b4eb4297a45722b4651eca7bc4786cdbe22a1b18b8a10966591d96ff
Python
948
40
from torch import Tensor, nn from torch.nn.utils.parametrize import register_parametrization from elasticai.creator.nn.binary import MathOperations class _Bin(nn.Module): def __init__(self): super().__init__() self._ops = MathOperations() def forward(self, input: Tensor) -> Tensor: r...
0d347499726a5b03c0ab57a8d33e46d8840a7f65ee15740f38ef9943e01854b7
Python
950
27
import logging from logging import handlers class Logger(object): level_relations = { 'debug':logging.DEBUG, 'info':logging.INFO, 'warning':logging.WARNING, 'error':logging.ERROR, 'crit':logging.CRITICAL } def __init__(self, filename, rank, level='info', when='D', b...
e2102384d47dbe47f2cd16f10c45b89916a0b97e24e08666c16a854262105a5e
Python
950
31
# import os # import random # import shutil # from tqdm import tqdm # # # def random_split(raw_data_dir, data_dir): # source_folder = raw_data_dir # train_folder = os.path.join(data_dir, 'train/') # test_folder = os.path.join(data_dir, 'test/') # # if not os.path.exists(train_folder): # os.maked...
3b994eb9a068ce87e32559e0009d39559bcc440d74ae35aa8b9c2f93f39c3a54
Python
951
35
""" Optuna example that optimizes a classifier configuration using OptunaSearchCV. In this example, we optimize a classifier configuration for Iris dataset using OptunaSearchCV. Classifier is from scikit-learn. """ import optuna from sklearn.datasets import load_iris from sklearn.svm import SVC if __name__ == "__m...
2aa97c9944bc4e2926f40aab4f2688618dbde66b05ca38ae98d1e679290ab777
Python
952
26
import numpy as np import pylab as pl def plot_means_and_stds(t, means, stds, color=None): if color is None: color = [0.5,0.5,1.0] color = np.array(color) c_offs = np.ones(3) - color pl.fill_between( t, means+0.1*stds, means-0.1*stds, color=color+0.1*c_offs ) for r in np.arange(0.2,1.0,0....
37d16c8bc9d5627ed87a160854e226a372f31171eddacbc6d7e1fc9fe10d9ee5
Python
952
20
import numpy as np from bayes_opt import BayesianOptimization from bayes_opt import acquisition def f(x): return np.exp(-(x - 2) ** 2) + np.exp(-(x - 6) ** 2 / 10) + 1/ (x ** 2 + 1) if __name__ == '__main__': acq = acquisition.UpperConfidenceBound(kappa=5) # kappa determines explore/Exploitation ratio ...
4546c76c5e562dfd84128f4982a65317513737a62441f64c9b7ff56635fd1a1a
Python
952
29
import numpy as np from utils import max_stats, pickle_dump from joblib import Parallel, delayed from joblib.externals.loky import set_loky_pickler set_loky_pickler('pickle') import os os.environ['OPENBLAS_NUM_THREADS'] = "1" os.environ['MKL_NUM_THREADS'] = "1" NNULLS = 100 conns = {} for res in ['125', '500']: ...
5bcfbadc8fc224b8a5818e211f69460220bef170c9c8da54b5dd4ff5e8bc6116
Python
952
33
import pytest import elasticai.creator.nn.fixed_point as nn_creator from elasticai.creator.arithmetic import FxpArithmetic, FxpParams from tests.integration_tests.nn.fixed_point.precomputed_routine import ( routine_testing_precomputed_module, ) @pytest.mark.ghdl @pytest.mark.parametrize( "total_bits, frac_bi...
a79828d0abe1990b376b0142705356da9739215c039246680934224ab95b7f9e
Python
952
33
# -*- coding: utf-8 -*- # # Test proper functionality of Syncopy's `ContinuousData` class + subclasses # # Builtin/3rd party package imports import os import tempfile # Local imports from syncopy.datatype.util import get_dir_size class TestDirSize: def test_dirsize(self): with tempfile.TemporaryDirector...
0c595c11afa57bda1246d9c4dcf396f4e72123855294577569d70e399b915a0e
Python
953
32
from __future__ import print_function, division import sys import pandas as pd import numpy as np def parse_args(): import argparse parser = argparse.ArgumentParser('Script for filtering an image list to only contain images with particles listed in a targets file.') parser.add_argument('file') parser....
7b9262307877815c5c0f70428b69c1e3a117b8cf7bf66ba90de3a9c36d0e94fa
Python
953
25
# 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...
6aee9b905e7f87f03bec0fd03489af05303871288b0a64061d90498d6438d2b0
Python
955
30
""" Set of specific utilities for spatial analysis # Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry) # Date: 12.06.15 """ __author__ = 'Antonio Martinez-Sanchez' # Analysis from coordinates DEPRECATED from .mb import CMCAnalyzer from .plane import SetClouds from .plane import SetClusters fro...
737ea90f9b12b1fedb26caf96591913051e980528d28d5a6654c97cccb1c9e40
Python
955
38
from torch import nn class SimpleDenseNet(nn.Module): def __init__( self, input_size: int = 784, lin1_size: int = 256, lin2_size: int = 256, lin3_size: int = 256, output_size: int = 10, ): super().__init__() self.model = nn.Sequential( ...
1054e11d5362d2b77a789541b1453a865b90c1be850d24b3b78179fb64ef63d0
Python
956
29
import heapq import math import numpy as np import torch import dgl from dgl.data.utils import load_graphs from copy import deepcopy from tqdm import tqdm def get_summary_tensor(G_dataset, Labels, device, merge_classes=False): num_G = len(G_dataset) Labels = Labels.tolist() node_num = G_dataset[0].ndata['...
68142193185a8d394491b5f666585108cc884900c9e1711b012113464aeb03a2
Python
956
33
import torch import torch.nn as nn class CNN(nn.Module): def __init__(self): super(CNN, self).__init__() self.conv1 = nn.Conv1d( in_channels=80, # input height out_channels=96, # n_filters kernel_size=480, # filte...
0efdac0a4487b7a7467e1652848f2a52668a1ab7240c0dd3af0bc1f71dbf89dd
Python
957
28
import sys # Make sure we are running python3.5+ if 10 * sys.version_info[0] + sys.version_info[1] < 35: sys.exit("Sorry, only Python 3.5+ is supported.") from setuptools import setup def readme(): with open('README.rst') as f: return f.read() setup( name = 'med2image', ve...
1cd77950e4f3f3a71e6bcd2e7d348e098e931c92fba35c673da8199cbf0eb835
Python
957
31
from __future__ import annotations import pytest torch = pytest.importorskip("torch") pytest.importorskip("matgl") pytest.importorskip("phonopy") from ase.build import bulk from quacc.recipes.mlp.phonons import phonon_flow def test_phonon_flow(tmp_path, monkeypatch): monkeypatch.chdir(tmp_path) atoms = bul...
238d7ccb900d436bdff904275ff99b7dfce22bd0d93f0bb39384f1ea96520436
Python
957
27
import sys import os data_dir = sys.argv[1] viral_list = ['AC_000007.1' ,'NC_001526.4', 'NC_001731.1' ,'NC_009334.1', 'NC_045512.2' ,'NC_055231.1', 'NC_063383.1'] list_final = [] list_final = viral_list # Calculate the counts in the full dataset print('default') abundances_dir = data_dir + use_case + '/default/filte...
cb43fdc8e1cd767a566630115aff5985f3e060b8528c8de926edd77267132e6c
Python
957
32
import torch import torch.nn as nn import math class lap_spatial_only_module(torch.nn.Module): def __init__(self): super(lap_spatial_only_module, self).__init__() @staticmethod def get_module_name(): return "lap_spatial_only" def forward(self, x): epsilon = 1e-8 # Small numb...
71b5fb3666f1b8010d162907d18eb709e81a34c639f8d4a0616f2633e0a3bee9
Python
958
32
# import the necessary packages from tensorflow.keras.models import load_model, save_model import argparse import tf2onnx import onnx def model2onnx(): # construct the argument parser and parse the arguments ap = argparse.ArgumentParser() ap.add_argument("-m", "--model", type=str, default="mask_detector.model", ...
bf2c5f066abef29de219184815ee1b0c2f0e4f65373091406d8bff18068b9f1d
Python
958
31
# -*- coding: utf-8 -*- import sys import getopt import shutil from distutils.core import setup import os setup( # data_files=[('optimizer/)], name = "optimizer", version = '0.0.1alpha', packages = ['optimizer'], package_data = {'optimizer': ['*.png']}, author = "Optimizer authors and contributo...
1cacef853f0b690dfa5b3415b2656f65fc6d0d481875c4b5b5d4aea5eb467471
Python
959
36
"""This script is intended as a test case for mprofile""" import time @profile def test1(l): """test1 docstring""" a = [1] * l time.sleep(1) return a @profile def test2(l): b = [1] * l time.sleep(1) return b def test3(l): """test3 docstring""" return l if __name__ == "__main__":...
8416090f2d66da5e9321641c1b617744e176c5579eccb56db20234bb1d225f70
Python
959
28
import os import json import subprocess from protonets.utils import format_opts, merge_dict from protonets.utils.log import load_trace def main(opt): result_dir = os.path.dirname(opt['model.model_path']) # get target training loss to exceed trace_file = os.path.join(result_dir, 'trace.txt') trace_val...