sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9eaf45f0c5ab67f8d698ee6655b5754fc6a0d0bc0ba2619c5146805cab6cb54a
Python
1,139
35
import glob import json from google.protobuf.json_format import ParseDict, ParseError from json_repair import repair_json from ord_schema.message_helpers import find_submessages from ord_schema.proto.reaction_pb2 import Reaction, Compound, ProductCompound from ord.utils import json_load, json_dump data = [] reaction...
edad4c938c99583e88fd9cb46faf1841a8007349c671fe773bbeaea3ebcd71b5
Python
1,139
50
import argparse from meep.materials import Al import meep as mp def main(args): resolution = 40 cell_size = mp.Vector3(z=10) boundary_layers = [ mp.PML(1, direction=mp.Z) if args.pml else mp.Absorber(1, direction=mp.Z) ] sources = [ mp.Source( src=mp.GaussianSource...
a746dc6aad7bedce73e05cb381ad565b086aa2081a9c9a4fc9151f3398617153
Python
1,140
41
import bpy import numpy as np class AnnotationInterface: """ Base class for Annotation Interface AnnotationManager creates a dynamic AnnotationInterface for every instance of an annotation. All the annotation specific inputs and the common annotation params are exposed though this interface for t...
deeee4b71d8354770f48d38b903b75536c214fe83202688f9d36e23d330a9baa
Python
1,140
24
# # 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,...
43399ad0394663705398be6f74efbefb2da7a7ffdb1699737dbee78a1c8af318
Python
1,141
47
import click import h5py import numpy as np import os ########## # inputs # ########## @click.command() @click.option('--scores', 'score_files', required=True, multiple=True, type=click.Path(exists=True, readable=True), help='h5 ISM score file') @cl...
0df9bf97db9efb3da20fdd6d9f8d5c391c08e21b6ad9d3782200194c135c5c22
Python
1,142
35
from analyse import * import os import subprocess from jinja2 import Template import time proteins = initProteins() proteins.to_pickle('proteins.pkl') submission = Template("""#!/bin/bash #SBATCH --job-name={{name}} #SBATCH --nodes=1 #SBATCH -t 10:00:00 #SBATCH --mem=30GB #SBATCH -o {{name}}/cmap_{{replica}}_out #SBA...
d40d66fa7693adf7be9ca0d634c2ab1c405370d1f37e4fe710b70227ecd95eb3
Python
1,142
46
import meep as mp def main(): c = mp.Cylinder(radius=3, material=mp.Medium(index=3.5)) e = mp.Ellipsoid(size=mp.Vector3(1, 2, mp.inf)) src_cmpt = mp.Hz sources = mp.Source( src=mp.GaussianSource(1, fwidth=0.1), component=src_cmpt, center=mp.Vector3() ) if src_cmpt == mp.Ez: ...
382bc687b18a8a582a9d6585b601bd336d46a67785ba6ce50968ce1e5195a590
Python
1,143
54
# -*- coding: utf-8 -*- import json from pathlib import Path from collections import OrderedDict def load_json(filename): """ Load a JSON file Args: filename (str): Path of a JSON file Return: Dictionary of the JSON file """ with open(filename, "r") as f: data = json.loa...
e47b5e8e69babaa75aa21b781d1c940c317bb17ba6d71bfc34ec0fcfcf4b15bd
Python
1,143
68
from __future__ import annotations from typing import TYPE_CHECKING import numpy as np if TYPE_CHECKING: from numpy.typing import NDArray def add(a: float, b: float) -> float: """ A function that adds two numbers. Parameters ---------- a First number to add. b Second nu...
dc53382cfa371eb9a8bdb068d42978a6d38b35130a8ca7421cd171b0565d8c82
Python
1,144
35
import os import torch class Logger(object): """ Save checkpoints to file. """ def __init__(self, cfg, args, slam ): self.verbose = slam.verbose self.ckptsdir = slam.ckptsdir self.shared_c = slam.shared_c self.gt_c2w_list = slam.gt_c2w_list s...
1fd2faeda8d873539700209ec1596f14c79ec55409e8e12dec97d700a7b09bfc
Python
1,145
38
from typing import Dict, Union import numpy as np from ..base_transform import EEGTransform class Flatten(EEGTransform): r''' Flatten the input EEG representation. .. code-block:: python from torcheeg import transforms t = transforms.Flatten() t(eeg=np.random.randn(62,...
25bf9247a5b6643494028c6426e5e9bf4fabc779cd831476731ae5a63f795047
Python
1,145
34
""" collect all notebooks in examples, and check that they run without error """ from __future__ import annotations from pathlib import Path import nbformat import pytest from nbclient.exceptions import CellExecutionError from nbconvert.preprocessors import ExecutePreprocessor this_file_loc = Path(__file__).parent ...
7c3c36e0a4f3ca4ede735f22ddc46c22aea0eb732cd78326e0c2030406057264
Python
1,145
32
from PyQt5 import QtGui, QtWidgets class ColorbarSlice(QtWidgets.QWidget): def __init__(self): super(ColorbarSlice, self).__init__() self.initUI() def initUI(self): self.pen = QtGui.QPen(QtGui.QColor( 200, 200, 200)) # Set the initial pen (which dra...
6c61a6e9a611b84e120637e3c8bb4b7e7f2c92619be5cbe3e0d300a1ab53b02b
Python
1,147
60
#!/bin/env python3 ''' Test constructor for filament ''' import numpy as np import ithildin as ith # empty filament, faces optional print(1) try: f = ith.Filament() print(f) print(f.faces) except Exception as e: print(e.__class__.__name__, e) # this one should be illegal print(2) try: f = ith.Fila...
79697b06340f5100ac87523f07387b809057779b9a4c811fe53b51094d4868a4
Python
1,147
33
''' Provides default parameters used to instantiate the network. ''' params = { # Simulation time (in ms). 't_sim': 1000.0, # Resolution of the simulation (in ms). 'sim_resolution': 0.1, # Masterseed for NEST and NumPy. 'master_seed': 55, # Recording interval of the membrane potential (in ...
7a64062eb8ada39e664a72eb0af7e7b9121393dc23a1f86f22a3ee2c077dde50
Python
1,147
29
""" DeepLabCut2.0 Toolbox (deeplabcut.org) copyright A. & M. Mathis Labs https://github.com/AlexEMG/DeepLabCut Please see AUTHORS for contributors. https://github.com/AlexEMG/DeepLabCut/blob/master/AUTHORS Licensed under GNU Lesser General Public License v3.0 """ from deeplabcut.pose_estimation_tensorflow.dataset imp...
ef9e9ee9876d1d3e78f81913889116999c6e9d777a9cfbb128c3a6b36bf2ef31
Python
1,147
39
"""Prepare ADE20K dataset""" import click import zipfile from pathlib import Path from segm.utils.download import download def download_ade(path, overwrite=False): _AUG_DOWNLOAD_URLS = [ ( "http://data.csail.mit.edu/places/ADEchallenge/ADEChallengeData2016.zip", "219e1696abb36c8ba...
45ee735196049299056ecad9e62660ade6cc79e01120570a47aecf523fb287ef
Python
1,148
34
""" Optuna example that optimizes simple quadratic functions. In this example, we optimize two objective values. Unlike single-objective optimization, an optimization gives a trade-off between two objectives. As a result, we get the best trade-offs between two objectives, a.k.a Pareto solutions. """ import optuna ...
befc66f04ccb4b8ecd766b2f616bd1ecf5267a9b2a7f5df1f44b313caa0a02fc
Python
1,148
24
# # 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,...
de00e58ab56830f161ffcc4562e0a3028a098e8f42b322b07cbb5bd2dc5ea3af
Python
1,148
28
from elasticai.creator.file_generation.savable import Path, Savable from elasticai.creator.file_generation.template import InProjectTemplate class MacDesign(Savable): def __init__(self, name: str, vector_width: int, fxp_params): self._name = name self._vector_width = vector_width self._fxp...
edf0daccddf2d29b6f032dc82eddc07b946f3eab23c7aa916036bd8610432d69
Python
1,148
32
method_label_map = { "gnn_imp": "PEPerMINT", "isvd": "ISVD", "iterative": "MICE", "knn": "KNN", "missforest": "RF", "minprob": "MinProb", "mindet": "MinDet", "bpca": "BPCA", "bpca_t": "BPCA Transpose", "dae": "DAE", "vae": "VAE", "mean": "Average", "median": "Median",...
035f861ef04f9a13c4ddc3b11f19cef702477a08be86cf2c3d6fe09ea6e074bf
Python
1,149
42
# Librairies import os import sys code_path = os.path.split(os.path.split(os.getcwd())[0])[0] sys.path.append(code_path) from scipy.sparse import load_npz import networkx as nx import argparse from setting import * # Arguments argParser = argparse.ArgumentParser() argParser.add_argument("-n", "--name", type=str, help...
7b411b366cbeea9ec84779de409ab3cb375c5de4b0f50d4862e3a402877467ec
Python
1,149
38
import torch from prosper_nn.models.hcnn import HCNN import prosper_nn.utils.generate_time_series_data as gtsd import prosper_nn.utils.create_input_ecnn_hcnn as ci # Define network and data parameters past_horizon = 10 forecast_horizon = 5 n_features_Y = 2 n_data = 20 n_state_neurons = 3 batchsize = 5 # Initialise H...
c12a625f848d593fd5190f8d6799de6489ca0ff67df3794783876d9f56e0d8df
Python
1,149
33
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master...
2806683ee2ee05ccd491f4e95f902b0c15c57884c375f26549f1fc9295e37f13
Python
1,150
41
extensions = dict( skip_default_set_params_for=['training_frame', 'ignored_columns', 'response_column', 'max_confusion_matrix_size', 'distribution', 'offset_column'], set_required_params=""" parms$training_frame <- training_frame args <- .verify_dataxy(training_frame, x, y) par...
6690a5f5959b916139f55413db358e49d463965fa9f7196ece65c0e4322cbea6
Python
1,150
39
from . import loadDefaultParams as dp from . import timeIntegration as ti from ..model import Model class HopfModel(Model): """ Stuart-Landau model with Hopf bifurcation. """ name = "hopf" description = "Stuart-Landau model with Hopf bifurcation" init_vars = ["xs_init", "ys_init", "x_ou", "y...
83947e3d71ac2c87bd9b62ea2ecc7bc947ac732e675b5eb63fc1d1c03e43af6f
Python
1,150
42
import timm import torch.nn as nn class TimmUniversalEncoder(nn.Module): def __init__(self, name, pretrained=True, in_channels=3, depth=5, output_stride=32): super().__init__() kwargs = dict( in_chans=in_channels, features_only=True, output_stride=output_stride,...
269053f69cdb46d6c43d9257f44b76f4c271cac54ac14adb4766bcc2584ca69b
Python
1,151
40
#! /usr/bin/env python # -*- coding: utf-8 -*- from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport import suites configs = [ IssueConfig( "cegar-landmarks-10k", ["--search", "astar(cegar(subtasks=[landmarks()],max_states=10000))"]), Issu...
3d475c82fe7697d87ead9fc8d9ecd7beee105e245068825bf460a73e044f26b9
Python
1,151
27
import torch import torch.nn as nn import math class pdfam_gau_module(torch.nn.Module): def __init__(self, channels=None): super(pdfam_gau_module, self).__init__() self.learn_eps = nn.Parameter(torch.zeros([1, channels, 1, 1])) self.learn_coef = nn.Parameter(torch.ones([1, channels,...
6a2a0d8516e32e66d65927af43cdf3b3781cbd4fef1d933878761c8528293a76
Python
1,151
40
#! /usr/bin/env python # -*- coding: utf-8 -*- from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport import suites configs = [ IssueConfig( "cegar-landmarks-10k", ["--search", "astar(cegar(subtasks=[landmarks()],max_states=10000))"]), Issu...
8d56eef385841b9a42f4595b30144fabe470183f1d41f9465b0870d7e7035940
Python
1,152
50
import argparse from pathlib import Path def add_run_cru_arguments(parser: argparse.ArgumentParser) -> None: parser.add_argument( "--mesh-file", type=Path, default=Path.cwd() / "cru_mesh" / "cru_mesh.h5" ) parser.add_argument( "-o", "--outdir", type=Path, ...
c104b27100846c9e8492fdcd22e6cf7d0c22803d4428b852b15ccb7f1f761bdf
Python
1,152
38
from cloudvolume import CloudVolume from cloudvolume.lib import Vec, Bbox import numpy as np from copy import deepcopy padding = Vec(128, 128, 0) start = Vec(0, 0, 0) - padding stop = Vec(2048, 2048, 100) + padding bbox = Bbox(start, stop) offset = Vec(20002, 12009, 65) dirs = {#'img': 'image', 'mit_new': 'mit_new...
b653eb2e7b242511dc6ab4cdef9c0ad270b565824a5c48cd330a44f563f1c083
Python
1,153
40
""" Created on 25/05/2020 :author: Chinchien Lin :summary: Visualise an image """ import sys import matplotlib.pyplot as plt from src.commands.abstract_preprocessing_command import AbstractPreprocessingCommand from src.utils.frequency_downsampling import FrequencyDownsampling from src.io.interpreters i...
c07ceb81f75950c44f051d647b5960e6686a46c0526e311838cb2e157407f636
Python
1,153
36
"""The purpose of this module is implement PEP 621 validations that are difficult to express as a JSON Schema (or that are not supported by the current JSON Schema library). """ from typing import Mapping, TypeVar from .error_reporting import ValidationError T = TypeVar("T", bound=Mapping) class RedefiningStaticFi...
164bb03b6b12bdb2babf753139ec1ec3a43b16b7941daf7aea2ee45852a3acb7
Python
1,154
34
import sys, os from pandas.io.parsers import read_csv import numpy as np import pandas as pd try: gtffile = sys.argv[1] outputfile = sys.argv[2] except: sys.exit("Please, give: (1) gtf file; (2) exons") #### Convert gtf file in an easy to handle data frame #### df = read_csv(gtffile, comment='#', header=N...
662a02e596431137c972edfa590f524f3592be562aa08304aacecba8df91e896
Python
1,154
22
import torch.nn as nn from .modules import Activation class SegmentationHead(nn.Sequential): def __init__(self, in_channels, out_channels, kernel_size=3, activation=None, upsampling=1): conv2d = nn.Conv2d(in_channels, out_channels, kernel_size=kernel_size, padding=kernel_size // 2) upsampling = nn...
400c8ef317d742025035c23746043f0bcb186eaf5bd060b3faf1456dc0a340f0
Python
1,155
25
# # 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,...
77294088ba0cf215c7a83b4d96120f51d5c02b8e0597fcfe22f803c615a39316
Python
1,155
24
# # 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,...
96c8f720c535082923b038d8a5845fea518d906cdeb9a22563b5d709f06caf04
Python
1,156
35
import argparse import json import os import pandas as pd from src.analyze.performance_measures import PerformanceMeasures parser = argparse.ArgumentParser() parser.add_argument('-r', '--results-dir', type=str, default=None) args = parser.parse_args() def main(results_dir): try: with open(os.path.join(r...
32bdab82a5874b8c5620a75b7ea6f8cd2f946ae2cea0154318ae757642cc66f3
Python
1,157
32
"""Testing CLI command convert.""" import subprocess import os def test_unordered(): """Tests for converting unordered SWC file.""" os.chdir(os.path.dirname(__file__) + '/data') proc = subprocess.Popen(['swc', 'convert', 'fail_unordered.swc', '-o', '/tmp/test_treem.swc'], ...
9a44f074151ca6a1c6e902e1ca463d783ceacad3d81b8a2312789d1868c2e7c6
Python
1,157
54
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from common_setup import IssueConfig, IssueExperiment REVS = ["issue592-base", "issue592-v3"] SUITE = suites.suite_optimal_strips() CONFIGS = [ IssueConfig("lm_zg", [ "--landmarks", "lm=lm_zg()", "--heuristic", ...
9f0aaf5876f98fd86d16965f643f6a1338227ca866dac6ddead78464bd3d1d0c
Python
1,157
38
from elasticai.creator.file_generation.on_disk_path import OnDiskPath from elasticai.creator.nn.fixed_point import Linear from elasticai.creator.nn.fixed_point.lstm.layer import ( FixedPointLSTMWithHardActivations, LSTMNetwork, ) from elasticai.creator.vhdl.system_integrations.firmware_env5 import FirmwareENv5 ...
e7774ae379c38d90983aeba2b7cf99bd671cf8abfd358e059c4eeec7f08f6f20
Python
1,158
37
import os from torchdrug import data, utils from torchdrug.core import Registry as R @R.register("datasets.ToxCast") @utils.copy_args(data.MoleculeDataset.load_csv, ignore=("smiles_field", "target_fields")) class ToxCast(data.MoleculeDataset): """ Toxicology data based on in vitro high-throughput screening. ...
fbb8e891ad4191b03991716c0762477587ea5617ea3a59e80ea5a170d8a0aad4
Python
1,158
32
"""Testing CLI command convert.""" import subprocess import os def test_unordered(): """Tests for converting unordered SWC file.""" os.chdir(os.path.dirname(__file__) + '/data') proc = subprocess.Popen(['swc', 'convert', 'fail_unordered.swc', '-o', '/tmp/test_treem.swc'], ...
0538da8ceb1ea9e4d20c52ad048f21f310e70dd79fb32f62c0d734983386a53c
Python
1,159
24
# # 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,...
4ced56a5d46745128436460421ad7a3019255101005596aa087bfd00d8322db3
Python
1,159
41
import neuralnodes.params import dataclasses @dataclasses.dataclass class Params(neuralnodes.params.Params): filter_inh_dur: float = 8.0 filter_inh_sigma: float = 2.0 filter_inh_gain: float = 1.0 filter_delay: float = 7.0 filter_exc_dur: float = 4.0 filter_exc_sigma: float = 0.5 filter_e...
6bd9c44685be6a9f1965ce704ac95d28ed6851c7d7148e86f10509e3120753ae
Python
1,159
24
# # 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,...
cc921d6e323a4f910fbd6439be3b70d9e5c90670373ab2a856867ea558245fc0
Python
1,159
24
# # MIT License # # Copyright (c) 2023 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,...
df9dc91342a01f5629e37366018052e80bc27e4b88c64817a73deb042012424e
Python
1,159
31
"""Testing CLI command convert.""" import os import subprocess def test_unordered(tmp_path): """Tests for converting unordered SWC file.""" os.chdir(os.path.dirname(__file__) + '/data') proc = subprocess.Popen(['swc', 'convert', 'fail_unordered.swc', '-o', tmp_path / 'test_tr...
150958c0d8e2b1da85e969938cb57d021d1bd7df4e744d0d6f14e463a3148784
Python
1,160
35
# Material "Squishy", dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # The class is a recipe for the material's shader tree — build recreates the material and runs it into material.node_tree. from bpy.types import ShaderNodeTree from nodebpy import TreeBu...
2cb7cf56138902ab8497a87923365c21e36b41b53b464aca77aa54f9b20e7a12
Python
1,160
40
""" This script crops the atlases in the atlases folder, changes their datatype to a minimum and compresses the files with a high enough compression level. This all to reduce the disk size and control the load time (driven by the level of compression). """ from glob import glob import nibabel as nb from nilearn.image...
589b42db195051380213b7e5181c9267bed58c74699b643d45f5acd40087bb95
Python
1,160
30
# 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...
5eb8e28aeedd16c8d1aa47e9d2f1791143120c4813258d35ca4c00f78283e2b5
Python
1,161
44
#!/bin/env python3 """ Example script to calculate conduction velocity and action potential duration """ import ithildin as ith import matplotlib.pyplot as plt import numpy as np # read simulation results sd = ith.SimData.from_stem("results/phase_68") apd, tarr, tdea = ith.pulse.duration(sd.vars["u"], t=sd.times, u_...
88cbb4a8e9312e2e5a8fae0ff547fa56568758d38ba9f6ea534d480f840c1de2
Python
1,161
27
print "----------------------------------------------------------------------------------------------------------------------------------------------------------" print "TAURS-MH is dependent on Bismark, PICARD, python, bowtie, pysam,and samtools. Please make sure you have all of these on your system and provide path f...
b24b3dc1d58c2f77a6695c94cffa14721d5fdd01a7d43aa1e5c285b9933f68b3
Python
1,161
29
# Diana Giraldo # Mayo, 2023 import numpy as np import nibabel as nib def get_slicingdims(lr_fpath, hr_fpath): LR = nib.load(lr_fpath) HR = nib.load(hr_fpath) LR2HR_ornt = nib.orientations.ornt_transform(start_ornt = nib.orientations.io_orientation(LR.affine), ...
b55c13eff83758dc10de48e4b0dc5d2973e7adc22d4d32c4027de3e0f29e8841
Python
1,161
24
# # 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,...
46d308f1c8f918bee3b30896df1e69420dc64aa2004d386f75e4725c25aef8c1
Python
1,162
46
import numpy as np import matplotlib.pyplot as plt from soundsig.plots import boxplot_with_colors from soundsig.spikes import plot_raster def test_plot_raster(): np.random.seed(123456789) max_nspikes = 20 ngroups = 8 max_cells_per_group = 4 spike_trials = list() groups = dict() for k i...
5e073b218d7d53fa4c1fbbfd50e9c2dd359340d2a08a0903a42009b6a0078770
Python
1,162
24
# # 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,...
7540aaf1819c1fbe40e327d6e5dec12acd4020a626e22b6eb47ec805cee5b79d
Python
1,162
36
from gt4sd.frameworks.gflownet.arg_parser.parser import parse_arguments_from_config from gt4sd.frameworks.gflownet.envs.graph_building_env import GraphBuildingEnv from gt4sd.frameworks.gflownet.envs.mol_building_env import MolBuildingEnvContext from gt4sd.frameworks.gflownet.tests.qm9 import QM9Dataset, QM9GapTask from...
d2711fe10ceb6f8e24d78b58a49034f6f93cdedac0195ac9b6761a3f6de21979
Python
1,162
37
import os from torchdrug import data, utils from torchdrug.core import Registry as R @R.register("datasets.ZINC250k") @utils.copy_args(data.MoleculeDataset.load_csv, ignore=("smiles_field", "target_fields")) class ZINC250k(data.MoleculeDataset): """ Subset of ZINC compound database for virtual screening. ...
e52c9b5efb19902beb1805ac0c7b491be88989c0a8c3c6da2ffe56768f13ea04
Python
1,162
32
import unittest import os import random import shutil from torcheeg.model_selection import train_test_split_per_subject_cross_trial from torcheeg.datasets import DEAPDataset class TestTrainTestSplitPerSubjectCrossTrial(unittest.TestCase): def setUp(self): shutil.rmtree('./tmp_out/') os.mkdir('./t...
65a592ca6e192aacc5838903ec62a6738c9dace80e1ace8bd85cdd86843aa8c0
Python
1,163
49
import os import torch import pandas as pd import matplotlib.pyplot as plt from run import * LR = 1e-4 input_size = 280 output_sizes = [2] batch_size_label = 128 hidden_sizes = [2048, 2048] Epoch = 7 l2_lambda = 0 K = 5 accs= [] accs_inclass=[] Permute = 1 pred_all = [] for perm in range(Permute): predict...
56c0b4b799bee9fd1856bf7a3d592cf771b710317c312358e0aa5432f3da8430
Python
1,164
46
from __future__ import annotations from platformdirs import PlatformDirs, __version__ PROPS = ( "user_data_dir", "user_config_dir", "user_cache_dir", "user_state_dir", "user_log_dir", "user_documents_dir", "user_runtime_dir", "site_data_dir", "site_config_dir", ) def main() -> No...
8fd3fcfcb31fbe5eb59b7b69eee5714021a36598399c48dd0ebecf73afd2f195
Python
1,164
45
import sys, os from pandas.io.parsers import read_csv import numpy as np from collections import Counter import pandas as pd import pysam ### Initialize ### try: inputBamFile = sys.argv[1] motifnum = int(sys.argv[2]) motifs = [] for i in range(motifnum): motifs.append(sys.argv[3+i]) except: ...
9be2785cefa0bc57ab958b05cf3497603bebc7cb4b6652454c2803c5cb67f228
Python
1,164
34
from pip._vendor.packaging.utils import canonicalize_name from pip._internal.distributions.base import AbstractDistribution from pip._internal.index.package_finder import PackageFinder from pip._internal.metadata import ( BaseDistribution, FilesystemWheel, get_wheel_distribution, ) class WheelDistributio...
a1ed6828bbac4770e5e3d015ae81e06eba8490ce65f2aff0fae967cf2b461a83
Python
1,165
42
from __future__ import annotations import pytest prefect = pytest.importorskip("prefect") from pathlib import Path from quacc import flow, job from quacc.utils.files import copy_decompress_files def test_copy_files(tmp_path, monkeypatch): monkeypatch.chdir(tmp_path) @job def create_file(name: str, co...
bf97b56431bbc994c7de1ed38db4b96cce69f001b330f54ebbcb240ccbf887a9
Python
1,165
49
from ._compat import Protocol from typing import Any, Dict, Iterator, List, TypeVar, Union _T = TypeVar("_T") class PackageMetadata(Protocol): def __len__(self) -> int: ... # pragma: no cover def __contains__(self, item: str) -> bool: ... # pragma: no cover def __getitem__(self, key:...
1bf0aac67aab6e34958150459818127e48befab2a43e44901de8efd8a5a09a95
Python
1,166
37
import unittest from unittest.mock import patch from IPython.core.interactiveshell import InteractiveShell from memory_profiler import LineProfiler, MemitResult, load_ipython_extension def sample_func(n): arr = [1] * n return len(arr) class TestIPythonMagics(unittest.TestCase): @classmethod def set...
82858b7ea528acd83a932398ff3676b740317fd905dfd5b897ed9883ee4ec5d6
Python
1,166
24
# # 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,...
aa23167e7360cae970479dbbfaa13ce29f5b1d22a103b5d178a639b9ad5a47d9
Python
1,166
48
# -*- coding: utf-8 -*- # # oxasl documentation build configuration file # # This file is execfile()d with the current directory set to its # containing dir. # -- General configuration ------------------------------------------------ import os import sys sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirnam...
3fcbbaedb39e3202a95eab2de603c39f6cf1559ada9263b8a2c43e3c9577cdfb
Python
1,167
41
import sys from pybioshell.core.data.io import find_pdb if len(sys.argv) < 2 : print(""" Prints names of ligand molecules found in a given PDB file. A ligand is defined as a residue located after TER field in a PDB chain USAGE: python3 list_pdb_ligands.py input.pdb EXAMPLE: python3 list_pdb_l...
a1ee72e25ed1074f8bec45383e7f11136dffc2e7079bcf818454272f924dd3be
Python
1,167
45
#!/usr/bin/env python from pathlib import Path from setuptools import setup, find_packages version = ( Path(__file__) .parent.joinpath("src", "neuroquery_image_search", "data", "VERSION.txt") .read_text() .strip() ) description = ( "Search the NeuroQuery dataset for studies with " "activation...
c3ad9bf772b36d9843ab1432100ad56a204675b900c9df6b33c6e7b27a03a7f3
Python
1,167
34
# Written by Minh Nguyen and CBIG under MIT license: # https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md import unittest import torch import cbig.Nguyen2020.rnn as rnn class RnnCellTest(unittest.TestCase): """ Unit tests for recurrent cells """ def setUp(self): torch.manual_seed(0) ...
f9959aead522a56f57baeb68a8fa2f0466c1c08363b7e68f500f35ac3595dd7e
Python
1,167
33
from torch import nn as nn def conv_layer(in_channels, out_channels, kernel_size, norm_layer, padding): return nn.Sequential(nn.Conv2d(in_channels, out_channels=out_channels, kernel_size=kernel_size, padding=padding), norm_layer(out_channels), nn.ReLU()) def con...
e0a3bf31144469977e4a1172f0b9b176a7b459ebb3fe0eafd7a4e53da8feef7c
Python
1,168
37
''' Created on 3 May 2018 @author: Miguel Molina Romero, Techical University of Munich @contact: miguel.molina@tum.de @license: LPGL ''' import unittest from dry.utils import generate_synthetic_data, DryException class TestGenerateSyntheticData(unittest.TestCase): def testEmptyBfile(self): try: ...
71faf6d04a97fcea5f379747cd2a9e458ca1049e6f0ef84114f702682b15eaae
Python
1,169
28
"""Tests for the pipeline's h5ad write-back trigger helper + 3D forwarding.""" import os import pytest from regtools.registration.pipeline import _h5ad_writeback_path def test_writeback_path_only_for_h5ad(): assert _h5ad_writeback_path("/x/cells.h5ad", "/out/cells") == os.path.join("/out/cells", "cells_r...
a0d1db6c3781ab79498f92e037b3aba48e35437ad6a01213f3359822eee4862d
Python
1,169
24
# # 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,...
aaab170ed8b03088d730488855268e8f01f96268ab09a2be748cdbebe5c9b0bd
Python
1,169
36
import codecs import locale import re import sys from typing import List, Tuple BOMS: List[Tuple[bytes, str]] = [ (codecs.BOM_UTF8, "utf-8"), (codecs.BOM_UTF16, "utf-16"), (codecs.BOM_UTF16_BE, "utf-16-be"), (codecs.BOM_UTF16_LE, "utf-16-le"), (codecs.BOM_UTF32, "utf-32"), (codecs.BOM_UTF32_BE,...
25725acf0dfdde84d8bb14c6f2264d480ebd207de8b65c770d2b7f67452adde7
Python
1,170
32
import math import matplotlib.pyplot as plt from scipy.stats import vonmises input_data_file = "test_inputs/THR_chi1.dat" # The same input file as was used to run ap_fit_VonMises_mixture n1, mu1, kappa1 = 16146, -1.02734, 99.996 # direct output from ap_fit_VonMises_mixture n2, mu2, kappa2 = 2972, -3.01446, 17.8191 n3,...
a760525689dce274c8814e375fa993d8827494f2519b3f3dc7ca1f3d985a9b87
Python
1,170
32
import unittest import os import random import shutil from torcheeg.model_selection import train_test_split_per_subject_groupby_trial from torcheeg.datasets import DEAPDataset class TestTrainTestSplitPerSubjectGroupbyTrial(unittest.TestCase): def setUp(self): shutil.rmtree('./tmp_out/') os.mkdir(...
dc15b805b805324d982fbba52b3dd3a15f394def8e360b17ff0e4225786516d6
Python
1,170
24
# # 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,...
76644d0928fdcf2d8c55fe825d3a02c50888cc574d68eb863ac0a0ad0fe747f3
Python
1,171
52
# -*- coding: utf-8 -*- """ Created on Fri Mar 25 17:00:36 2022 @author: Shengze Cai """ import math import numpy as np import matplotlib.pyplot as plt def LHSample(D, bounds, N): # """ # :param D: Number of parameters # :param bounds: [[min_1, max_1],[min_2, max_2],[min_3, max_3]](lis...
bd06700cc025444b14127ab6bfb44ec1143829fbffe017a81fddd9495bed286d
Python
1,171
37
import os from torchdrug import data, utils from torchdrug.core import Registry as R @R.register("datasets.Malaria") @utils.copy_args(data.MoleculeDataset.load_csv, ignore=("smiles_field", "target_fields")) class Malaria(data.MoleculeDataset): """ Half-maximal effective concentration (EC50) against a parasit...
eeb03b370d13f5ca4109e0baeb1d328e66723e6e1aa5458324f6339d1bc976e1
Python
1,171
41
from collections.abc import Iterator from itertools import chain from elasticai.creator.vhdl.design.signal import Signal class Port: def __init__(self, incoming: list[Signal], outgoing: list[Signal]): self._incoming = set(incoming) self._outgoing = set(outgoing) @property def incoming(se...
101b83de7e729b0965b1a495802266ce974b8dc887d54344ba0356de66c7a012
Python
1,172
36
# Material "Flat", dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # The class is a recipe for the material's shader tree — build recreates the material and runs it into material.node_tree. from bpy.types import ShaderNodeTree from nodebpy import TreeBuild...
0a20aaf16a0b01d4dbb50f74f16da11c0dd4da9e9c6e7323786355cb39a35679
Python
1,173
31
from setuptools import setup, find_packages from os.path import join, dirname requirementstxt = join(dirname(__file__), "requirements.txt") requirements = [ line.strip() for line in open(requirementstxt, "r") if line.strip() ] setup( name="AutoOSS", version="0.1.0", author="Nian Wu", author_...
11a75646d1880bb8d552f4f47e094b848c282412a8487c201b75a40e19218404
Python
1,173
29
import sys import argparse from .data import load_single from .vis import draw_task, output_drawing def taskprint(): if len(sys.argv) < 2: print("Usage: arctask <task_id>") return task = load_single(sys.argv[1]) task.show() def tasksave(): parser = argparse.ArgumentParser(description...
294eed3961e4ec52952945b638d1b1d134fa81862088401bcad273d02b4a550d
Python
1,173
49
#!/usr/bin/env python import syncopy as spy import matplotlib.pyplot as plt # Settings plt.rcParams['pdf.fonttype'] = 42 saveFig = 1 # 0:not savefigs 1: save figs # Load data spikeData = spy.load('allen_spike.spy') data_spk = spikeData.trials samplerate = 1250 offset = -0.25 * samplerate # Offset in sa...
c437104f25919ddb9fca9600e18cac0766fb457b3f45692a6c7edac69ae698db
Python
1,173
37
import os from torchdrug import data, utils from torchdrug.core import Registry as R @R.register("datasets.FreeSolv") @utils.copy_args(data.MoleculeDataset.load_csv, ignore=("smiles_field", "target_fields")) class FreeSolv(data.MoleculeDataset): """ Experimental and calculated hydration free energy of small ...
caf6b819fab21081802d301aaeb88ecf6aa426b9de402717edaa987e61db03e4
Python
1,173
32
import os, re from setuptools import setup, find_packages with open('pinn/__init__.py') as f: version = re.search("__version__ = '(.*)'", f.read()).group(1) print(version) def parse_reqs(filename): with open(filename) as f: return f.read().splitlines() setup(name='pinn', version=version, ...
daee8483a6dbccb7661b3b8b5bfe4a78e9766b2e18aba6c7d25a8fde70d849ab
Python
1,173
33
import smart def test_Compartment_initialization(compartment_kwargs_Cyto): """Test that we can initialize a Compartment""" Cyto = smart.model_assembly.Compartment(**compartment_kwargs_Cyto) assert Cyto.V is None assert Cyto.cell_marker == compartment_kwargs_Cyto["cell_marker"] assert Cyto.dimensi...
bd4d6a79d5dcff3ac2201658173090dccf9480776ea603a271eecdc24fc83f88
Python
1,174
20
import openai import json def get_completion(prompt): inference = openai.Completion.create( #model="curie:ft-llm-hackathon-synthesis-parsing-team-2023-03-29-22-57-05", model="davinci:ft-llm-hackathon-synthesis-parsing-team-2023-03-30-00-54-58", prompt=prompt, max_tokens=1000, stop=["###"]) ...
015dc0d96e18f2d1b6cbff3629d15b11e4261e991a8888777d0881d0dd97b64f
Python
1,175
36
# Material "Default", dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # The class is a recipe for the material's shader tree — build recreates the material and runs it into material.node_tree. from bpy.types import ShaderNodeTree from nodebpy import TreeBu...
409bd2a63f7d251bc598ac1a63922925210f48333829a7b95a651d928e5610cb
Python
1,175
37
import torch.nn as nn import torch.nn.functional as F import torchvision.models as models class ResNetSimCLR(nn.Module): def __init__(self, base_model, out_dim): super(ResNetSimCLR, self).__init__() self.resnet_dict = {"resnet18": models.resnet18(pretrained=False, norm_layer=nn.InstanceNorm2d), ...
d692fc936fd8312d89be9dbb4fc04279326cc045ed714e27114b069ba9967afe
Python
1,175
22
import matlab.engine import numpy as np import matplotlib.pyplot as plt import pickle targetPSTH = np.array([2, 4, 6, 4, 8, 3, 2, 4, 3, 5, 2, 3, 1, 5, 5, 2, 4, 4, 3, 5, 3, 2, 1, 1, 5, 4, 3, 4, 2, 3, 4, 5, 4, 5, 4, 5, 3, 5, 5, 6, 7, 4, 6, 1, 7, 10, 21, 18, 11, 11, 11, 10, 3, 5, 8, 11, 9, 8, 9, 11, 8, 12, 8, 3, 9, 5, ...
276d664454cb7520c7f03827f4e33f8ad71a6c83185123cbed792ffd7a582f83
Python
1,176
39
from importlib.metadata import version as _pypackage_version from pathlib import Path import tomlkit as toml from tomlkit.toml_file import TOMLFile class MetaFile: version = "0.1" def __init__(self, data): self._data = data @classmethod def load(cls, file: Path) -> "MetaFile": with ...
27b8949d6186b0beeeb076394525233a10653385436eff1be7453b46035e70d1
Python
1,176
35
import torch from elasticai.creator.base_modules.math_operations_torch import TorchMathOperations from tests.tensor_test_case import TensorTestCase class TorchMathOperationsTest(TensorTestCase): def setUp(self) -> None: self.operations = TorchMathOperations() def test_quantize(self) -> None: ...
722228afe03b836ebd3228db05206b26c3cfdefd6f605d0fcf48571d6acda50d
Python
1,176
33
"""Apply-transforms tab forwards the h5ad field mapping via --h5ad_map.""" import os os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") import json import pytest pytest.importorskip("PySide6") from regtools.registration.gui.apply_transforms_tab import ApplyTransformsTab def test_h5ad_map_args_writ...
24089944a96d00073503e5bf58a3c8ca766763078d645bad154afea9237c89e5
Python
1,178
24
# # 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,...
397ec27ef7ebbc41efc2aa98a67d10185a800f1cb32a09a33e2b41f85fc3325b
Python
1,178
49
from elasticai.creator import ir _ir_factory = ir.DefaultIrFactory() def prepare_executor(): executor = ir.ExecutionOrderGraphReducer() @executor.register() def input(node: ir.Node, acc: str): return f"{acc}input" @executor.register() def A(node: ir.Node, acc: str): return f"{ac...