sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
414129ac4fef31a5af73476dec5532e8dc2214e6f373016988e2774ab3c015eb
Python
1,178
43
#!/usr/bin/python3 def vcf_to_plink2(vcf): sys.stdout = sys.__stdout__ cmd = ['plink2', '--vcf', vcf, '--make-pgen', "--out", args.out, '--vcf-half-call', 'm', '--exclude-if-info', 'MAF < ' + args.maf, '--extract-if-info', 'R2 >= ' + a...
c07e5c38c2990612e80ce1bff563b8c9208f894f3d281d60085ff5a6483ce460
Python
1,178
51
from enum import Enum, auto class QmTarget(Enum): '''Enum class for the different QM attributes to be used.''' # POLARISABILITY POLARISABILITY = auto() NORMALISED_POLARISABILITY = auto() # dispersion energy SVP_DISPERSION_ENERGY = auto() TZVP_DISPERSION_ENERGY = auto() # electronic...
cead8e18e8a05b548f6a76d45381f8adc07d85cbc4a10654842f891bb4e19f48
Python
1,178
38
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.uml import energy_filter class TestEnergyFilter(unittest.TestCase): def setUp(self): # Create a sample DataFrame for testing self.df =...
45e01339d754cacfb56a41bca9acc636c23ea9b44133f1e1ec91f0f558a00614
Python
1,179
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,...
4d0361c9ea6a7d31ca4e5775dcd6f0a78673fd96907d874533440d82cf60aee3
Python
1,179
37
import os from torchdrug import data, utils from torchdrug.core import Registry as R @R.register("datasets.SIDER") @utils.copy_args(data.MoleculeDataset.load_csv, ignore=("smiles_field", "target_fields")) class SIDER(data.MoleculeDataset): """ Marketed drugs and adverse drug reactions (ADR) dataset, grouped ...
d7c4656a32722f2f47ff44a8d63e35f431495417bb74528a2e03a5f88c94c7f2
Python
1,179
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,...
39bf534cffb560c8116caaab8c4919bfcb52a368a76c4a561876b2a34272b80d
Python
1,180
26
"""Packages containing all the possible attributes to recordings, such as - channels (module "chan") with class: - Chan - anatomical info (module "anat") with class: - Surf - annotations and sleep scores (module "annotations") with class: - Annotations Possibly include forward and i...
3d600373074a971cf3afe2f3619077c0bf7b07cf6de7c09a45d8cfa06b79f7a8
Python
1,180
38
#!/bin/env python3 ''' YAML file containing info about the particles to draw them ''' import pdlfeynman as fy import yaml all_particles = fy.particle.PARTICLES all_reactions = fy.reaction.REACTIONS splitting_reactions = [r for r in all_reactions if len(r.reactants) == 1 and 1 < len(r.products)] base = { fy.partic...
4d0698128921c5f3eec5a66a2f0bfdcab6b68adff9118236934e44b85827afbf
Python
1,180
31
from math import floor from PIL import ImageDraw import random from typing import Optional class Shape: """Base class for shapes""" def __init__(self, x: int, y: int, width: int, height: int): self.x = x self.y = y self.width = width self.height = height def draw(self, draw...
4d5ccd36a9134675c3bfb7b80994a0a8f330bba7fe229fcbf7446218d618d633
Python
1,180
35
import numpy as np from cirrocumulus.data_processing import handle_selection_ids def test_dimension_filter(dataset_api, input_dataset, test_data): process_results = handle_selection_ids( dataset_api=dataset_api, dataset=input_dataset, data_filter={ "filters": [{"field": "louva...
7bf917f0630427072267474772c6784bbb59fff044a40e56da328f4317fd1f98
Python
1,180
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 ...
b700985df746e58829f0c66e8902c11cf47ae85f4929480ddee24908ca9f578c
Python
1,180
43
#!/usr/bin/env python3 # A script that plots Chi-1 vs CHi2 scatterplot from sys import argv, stderr import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as mcl COLUMN_CHI1 = 4 COLUMN_CHI2 = 5 chi1 = [] chi2 = [] for line in open(argv[1]) : tokens = line.strip().split() if len(tokens) > CO...
bfe41c5648da597e727f4c5aba9f7f2b249a9d596677a2e1bb31211a99938935
Python
1,180
44
"""distutils.command.install_headers Implements the Distutils 'install_headers' command, to install C/C++ header files to the Python include directory.""" from ..core import Command # XXX force is never used class install_headers(Command): description = "install C/C++ header files" user_options = [ ...
74c840ce0aee634c0a095967fa7172c22590370d47e6ef3cbd2f136ded8e045c
Python
1,181
43
#!/usr/bin/env python # -*- coding: utf-8 -*- """Copyright (C) 2012 Computational Neuroscience Group, NMBU. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at you...
ca077cba418d05624fd2e2a1daaa51172fcd5078e8e83ecbc1a1397c3942adf3
Python
1,181
31
import pathlib from pandas._typing import FilePath from ord.data.data_llm import DEFAULT_PROMPT_TEMPLATE, ReactionData, LlmData from ord.utils import json_dump, json_load def make_cre_dataset_singular(cre_singular_json: FilePath): data = json_load(cre_singular_json) records = [] meta_record = dict(test_...
2309a26f25bd0529ff47c6c721eb66326dfba170ca08c056377e8d7266244a9a
Python
1,182
41
import numpy as np from .utils import AtomsDataset, register_dataset from typing import List, Optional from ase import Atoms @register_dataset("rmd17") class RevisedMD17(AtomsDataset): def __init__( self, datapath: str, indices: Optional[List[int]] = None, cutoff: float = 4.0, ...
0e24fa3d5ed51401c40f91fe7c0757ad481d462afe31dbb1063c1e33440692e6
Python
1,184
41
# -*- coding: utf-8 -*- from glob import glob from tempfile import TemporaryDirectory import os import pytest from dcm2bids.dcm2niix_gen import Dcm2niixGen from dcm2bids.utils.utils import DEFAULT TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), "data") @pytest.mark.skip(reason="Too long for now") def test...
ed5a5e74fe29bc5dab5ffd7401b274692af7bd0065cb4f7abc8c1207e79902af
Python
1,184
29
""" toposampling - Topology-assisted sampling and analysis of activity data Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation...
28c5b8459981fa689f6a9545c6b602f65c763bec1ff5b54d655c15217d86144f
Python
1,185
39
#!/usr/bin/env python import os import pandas as pd from nilearn import masking as nmask from bids.layout import BIDSLayout ### create mask across subjects # project location proj_path = '/project/3011157.03/Simon/proj_2022_CABB_movie/MRI' # location of movie data fmriprep_path = os.path.join(proj_path, 'BIDS_movi...
4a0efd9b3726925136f92ba298de2d3664c98d5597777f47c34385b6438a358c
Python
1,185
37
import cocotb from cocotb.clock import Clock from cocotb.triggers import RisingEdge, Timer from elasticai.creator.testing.cocotb_prepare import read_testdata @cocotb.test() async def precomputed_test(dut): data = read_testdata(dut._name) clock_period_ns = 10 dut.enable.value = 1 # Has no impact dut....
4e30bbb6b6ec7952e358990850af1d2ca1355c38da017b0eea22d111844495f1
Python
1,185
23
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/06_constants.ipynb. # %% auto 0 __all__ = ['ROOT_DIR', 'DATA_DIR', 'NTBK_DIR', 'IMGS_DIR', 'RES_DIR', 'WORM_FILE', 'EB_BODIES_FILE', 'EB_BODIES_PSEUDO_4', 'EB_BODIES_PSEUDO_6', 'EB_BODIES_PSEUDO_25', 'EB_BODIES_PSEUDO_82', 'DYNGEN_INFO_FILE', 'DYNGEN_EXPR_F...
c11fd89285c984824341b0050d27ac33039aa484d6a18d1357d23c2fadf720e0
Python
1,185
42
import torch import torch.nn as nn class FreqEncoder(nn.Module): def __init__(self, input_dim, max_freq_log2, N_freqs, log_sampling=True, include_input=True, periodic_fns=(torch.sin, torch.cos)): super().__init__() self.input_dim = input_dim self.incl...
de1b9f44fbabaf7cc5f6f33f1e4d7f84186a8e460fc5079fed74af2be6dbd751
Python
1,185
41
from pylearn2.utils import serial import sys _, model_path = sys.argv model = serial.load(model_path) space = model.generator.get_output_space() from pylearn2.config import yaml_parse from pylearn2.gui.patch_viewer import PatchViewer import numpy as np dataset = yaml_parse.load(model.dataset_yaml_src) grid_shape = No...
f22219be1c2cf2077ae2244cb54a888af4cbb8e8ed8550036c9f9dde722eed44
Python
1,187
34
#!/usr/bin/env python from setuptools import find_packages, setup import NDATools with open("README.md", "r") as fh: long_description = fh.read() setup( name='nda_tools', description="NIMH Data Archive Python Client", install_requires=['boto3>=1.36.18', 'tqdm', 'requests', 'packaging', 'pyyaml', 'ke...
2b553d3a4ecae2b34915056247f090ff8e7bb9d5d6a56bedb13485fc19deee7f
Python
1,189
47
## # \file multiply.py # \brief Script multiply images with each other. # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date October 2017 # import os import SimpleITK as sitk import pysitk.python_helper as ph import niftymic.base.data_writer as dw from niftymic.utilities.input_arparser impor...
7859cac0bcacba25cb6d0dfc42490982612f30b889f6ef8d6348e034b64cacda
Python
1,189
35
# 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...
88363d1203ae2741899d089ad98e5659eaa784805086b4bd2a57e8f46465ae8f
Python
1,189
41
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from setuptools import setup with open("esm/version.py") as infile: exec(infile.read()) with open("README.md") as f: readme = f.rea...
47307a175ad1a6e6c371767fb4cec01c8d065699d422d4f4e61803e81026a0c0
Python
1,190
26
# # 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,...
fe7dab1cecc8604053dc140001c1f8c7afb16b25ac4b2d97bdb4f5db424bd192
Python
1,190
43
#!/usr/bin/env python # Copyright (c) 2020 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module provides an example controller for actors, that use an external software for longitudinal and lateral control command calc...
6482d5f3e3d852fa5917da95763782126daf05e27f74d68496418cb8b37ef63d
Python
1,191
23
from .dictionary import PerfectHash, Dictionary from .graph import Graph, PackedGraph, cat from .molecule import Molecule, PackedMolecule from .protein import Protein, PackedProtein from .dataset import MoleculeDataset, ReactionDataset, ProteinDataset, \ ProteinPairDataset, ProteinLigandDataset, \ NodeClassific...
bcda89e8ebb92b85bcda179510b466c6bd8a50b041c9c2718728b1782efaf45d
Python
1,191
46
import json import os from abc import ABC, abstractmethod import pandas as pd from cirrocumulus.api import get_file_path class AbstractDataset(ABC): def __init__(self): super().__init__() @abstractmethod def read_dataset(self, filesystem, path, keys, dataset): pass @abstractmethod ...
31b5e0c1ae425a256a03428c8eed5ad325b4e17f5183628f9e996d1cb4216cd9
Python
1,192
42
from typing import Any, Dict import torch import torch.nn.functional as F from torch import nn, Generator from ..prixfixe import FinalLayersBlock class BHIFinalLayersBlock(FinalLayersBlock): def __init__( self, in_channels: int = 320, seqsize: int = 110, hidden_dim: int = 64, ...
3acc49abc062126bdff79795dc1daac81e58eec3a34fde4c2322c8b17fce4d88
Python
1,192
44
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from downward import suites from common_setup import IssueConfig, IssueExperiment REVS = ["issue551-base", "issue551-v1"] BENCHMARKS = os.path.expanduser('~/downward-benchmarks') SUITE = suites.suite_satisficing() CONFIGS = [ IssueConfig("lama-first", [],...
493fa67642d7f4a34ad37dbbb86725f0f60075f4bfa032240ec9bb1aaa6c21d0
Python
1,192
35
import os class Settings: def __new__(cls): cls.DEFAULT_OUTPUT_DIR_NAME = 'output' cls.PROCESSING_DIR_NAME ='img_process' if not hasattr(cls, 'instance'): cls.instance = super(Settings, cls).__new__(cls) return cls.instance def output_suffix(self): return f'LM{self.large_median}_SM{sel...
850b1a57efdf0a70f26f73e935ab4a0fe0db2bb6f1a154ddcfea86aed5c9f639
Python
1,192
41
################################################################################ # 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....
cbd0671d280dd2cb702f4f68ea10be6a78a9844b23f2f0b353aed54cfe881ead
Python
1,192
30
# 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...
37482c0e1df6ff5e353871dca507eaf65e9814ca4a7fe52400cebf3a5d1dacfb
Python
1,193
37
# Material "Transparent", 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 Tr...
e46a18539f3a4abc5444cbc39ff8c13092278adbe2260e0ee7e88e53ee88d166
Python
1,193
39
"""Utilities for defining models """ import operator from typing import Any, Callable, Type class KeyBasedCompareMixin: """Provides comparison capabilities that is based on a key""" __slots__ = ["_compare_key", "_defining_class"] def __init__(self, key: Any, defining_class: Type["KeyBasedCompareMixin"]...
1719297dc26f34cc61fd270a866355fc833309cc1f63f0e2543c8962c20eb2b2
Python
1,194
13
"""posthoc_real_pn_dep_levels_2026-09-29.py (POST HOC, descriptive): why does depression lower the fit to the real PNs? Mean PN response in driven and undriven glomerulus-odour pairs, model with/without depression vs real (Seki).""" import sys; sys.path.insert(0, 'D:/eucys/03-CODE') import numpy as np, SIGN_FROM_FUNCTI...
9050363d392959c884cb880ec62af41eeaab90a6f42bf704bd835e5c3f98cb4f
Python
1,194
39
from setuptools import setup, find_packages setup( name='CryoVesNet', version='0.5.0', url='https://github.com/Zuber-group/CryoVesNet', packages=find_packages(), license='MIT', # Please confirm or change the license as appropriate author='Amin Khosrozadeh, Guillaume Witz, Benoît Zuber', au...
bb883354bc5fdedabbb2ce7ed2c4f180cdd0185dba5f2d19cb52ebbcfc791223
Python
1,194
35
import os from regtools.registration.core.stage_dirs import STAGE1_DIRNAME, STAGE1_DIRNAME_LEGACY, resolve_stage1_dir def test_prefers_new_name(tmp_path): new = tmp_path / STAGE1_DIRNAME new.mkdir() assert resolve_stage1_dir(str(tmp_path)) == str(new) def test_falls_back_to_legacy(tmp_path): ...
ce3375b89b1d3949a80e69bb261c446ad38cff273c75010c7f3bc8091c1928d4
Python
1,194
39
from __future__ import print_function from __future__ import division import numpy as np import logging def upsample_filt(alg='nn', dtype=None): if alg == 'nn': x = np.array([[0., 0., 0., 0.], [0., 1., 1., 0.], [0., 1., 1., 0.], [0., 0., 0....
d881a05ee13b87fcfe809dc32c7208d8b9a239d3ce48d3f791345f2943ef34e5
Python
1,194
48
#! /usr/bin/env python # -*- coding: utf-8 -*- """ Before you can run the experiment you need to create duplicates of the two tasks we want to test: cd ../benchmarks/tidybot-opt11-strips for i in {00..49}; do cp p14.pddl p14-$i.pddl; done cd ../parking-opt11-strips for i in {00..49}; do cp pfile04-015.pddl pfile04-01...
f5d8cf9dcfca401819054f5f2b2f49c0f4cab102942882ba970f3a34995ad56c
Python
1,194
26
# # 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,...
075e301ce50d2c7d0af51525625ad6af7e8fc1d1c90fcbd860c2d96007b025d0
Python
1,195
45
import numpy as np from numba import jit @jit(fastmath=True, nogil=True, nopython=True) def exponential(x, slope: float = 1, offset: float = 0): return np.exp(slope * x) + offset @jit(fastmath=True, nogil=True, nopython=True) def linear(x, slope: float = 1, bias: float = 0): return slope * x + bias @jit(f...
53868df1e691d0433b652949c05944834ed1349cb04d010035c7b01e90c08fda
Python
1,195
43
###################################################################### # # energy.py: calculate the energy of a molecule # ###################################################################### from __future__ import print_function from openbabel import openbabel import sys # Make sure we have a filename try: filen...
6d3b7986e56c6be8548384a83d285eac0403d9d78f9ec37b6e612633ae22a61b
Python
1,195
29
from .colors import Color from .shapes import Shape from .textures import Texture from typing import Optional class Stimulus: """Combination of a shape and a color or texture. Used to generate the actual stimulus picture.""" def __init__(self, shape: Shape, pattern: Color | Texture, background_...
b3380b74723c5ee20f80827bf990cb39b1e92ae97f4a3d7471cf3a2c53b6631c
Python
1,195
22
from setuptools import setup setup( name='nails', version='1.0.0', packages=['helper', 'helper.base', 'helper.utils', 'helper.losses', 'helper.metrics', 'helper.datasets', 'helper.decoders', 'helper.decoders.fpn', 'helper.decoders.pan', 'helper.decoders.unet', 'helper.decoders.m...
c44f89fb9749bc4383af68f16dcfcd3c95b1b2baaf7b17928b9c7fc4d4fe2f23
Python
1,195
34
"""Signal-to-noise ratio (SNR) calculation.""" import numpy as np def signal_to_noise_ratio(signal: np.ndarray, dwell_time: float, window_width: float | int = 3000) -> float: """Calculate the signal to noise ratio in dB. Parameters ---------- signal Centered spectrum of the acquired signal ...
13728ed4b51578e27d2708c0c1217f20c4dda1a87c07d01a5a9c7c6ae9dddebb
Python
1,196
36
import os from tqdm import tqdm import numpy as np import pandas as pd import matplotlib.pyplot as plt import torch import torch.nn as nn from torchvision import datasets, transforms from torch.utils.data import DataLoader, Dataset class BaseDatasetShape(Dataset): def __init__(self, data_root, num_data): ...
bb65d24810bf31e0d9eb7f93b5e09bc02548b7f57e4a3d9997fcb132bdef2633
Python
1,196
35
# 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...
1fc43345ed9135dcdebd7a2d1f60433f94672941b251ca90b6cb00ed2278b709
Python
1,197
35
# 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...
52f9aa4c0c2aad1fd264a4eaf5ca98c4e343e79d0abb6e7ef36515d537ac5ef2
Python
1,198
36
import unittest import os import random import shutil from torcheeg.model_selection import KFoldCrossSubject from torcheeg.datasets import DEAPDataset class TestKFoldCrossSubject(unittest.TestCase): def setUp(self): shutil.rmtree('./tmp_out/') os.mkdir('./tmp_out/') def test_k_fold(self): ...
73dfc2c761505c76d68ce2ecac5909c35ef439539874bcfd0e3e322a8ca01146
Python
1,198
33
from src.conv_onet import models def get_model(cfg, nice=True): """ Return the network model. Args: cfg (dict): imported yaml config. nice (bool, optional): whether or not use Neural Implicit Scalable Encoding. Defaults to False. Returns: decoder (nn.module): the network mod...
a99351236d318e0387bdbc61eb0891467fda466a98c48f4fa95bd760cd5dedff
Python
1,198
39
import torch from prosper_nn.models.dhcnn import DHCNN 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 deepness = 3 batchsize = 5 ...
d2d21a34042b7b76c75a9f88f2e81dd58b78897625a5852510594934571f9b7f
Python
1,198
26
# # 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,...
f94fdf46054940624ee2af4682adc2b574f25817bce19ce1ad431288b72ffa05
Python
1,198
55
""" An undecorated example of a script that allocates memory in multiprocessing workers to demonstrate the use of memory_profiler with multiple processes. Run this script with mprof run -M multiprocessing_example.py You can then visualize the usage with mprof plot. """ import time import multiprocessing as mp # Big ...
10db09be8724994d8c425ca4f56d6a9ae24ba30f14ec05b2c263b884af77bb55
Python
1,199
44
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from downward import suites from common_setup import IssueConfig, IssueExperiment REVS = ["issue551-base", "issue551-v2"] BENCHMARKS = os.path.expanduser('~/downward-benchmarks') SUITE = suites.suite_satisficing_strips() CONFIGS = [ IssueConfig("lama-firs...
21b0a3a1e1e36b0f2bb9ff04c1b377ac8105ab855e29146fb89e930e6924e495
Python
1,199
44
# pylint: disable=too-many-function-args, invalid-name """ HCP ICA dataset with time-direction labels loading script""" import numpy as np import pandas as pd from omegaconf import DictConfig from src.settings import DATA_ROOT def load_data( cfg: DictConfig, dataset_path: str = DATA_ROOT.joinpath("hcp_time/...
398af327ea2b141404d9604ca4f893cfb5b303d708b4e88592d304101f1116b3
Python
1,199
29
from .colors import Color from .old_shapes import Shape from .textures import Texture from typing import Optional class Stimulus: """Combination of a shape and a color or texture. Used to generate the actual stimulus picture.""" def __init__(self, shape: Shape, pattern: Color | Texture, backgro...
40f9f219bb6fc2bb8b3aebb6dcbd72f212e84b55a0d1c30a0272e4ea195b8674
Python
1,199
35
from typing import Any import torch class RoundToFloat(torch.autograd.Function): @staticmethod def forward(ctx: Any, *args: Any, **kwargs: Any) -> torch.Tensor: if len(args) != 3: raise TypeError( "apply() takes exactly three arguments " "(x: torch.Tensor, ...
54dd4c4f23565c4d5b74809c0a3f3cc41e693b3fc2d11019e0b80ba4010ffe38
Python
1,199
39
"""GUI wiring for the DeepSlice auto-detect checkbox in the registration tab.""" import os import sys PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) if PROJECT_ROOT not in sys.path: sys.path.insert(0, PROJECT_ROOT) os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") imp...
800287df8b487c03ee26905882c62bb02dd0ba8cd41374d95f20e613f76d5cd8
Python
1,199
44
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from downward import suites from common_setup import IssueConfig, IssueExperiment REVS = ["issue551-base", "issue551-v3"] BENCHMARKS = os.path.expanduser('~/downward-benchmarks') SUITE = suites.suite_satisficing_strips() CONFIGS = [ IssueConfig("lama-firs...
aa3695d3849ab9715bfaa5d479e35cb037baf3c17e014d998057883d3a999dc0
Python
1,199
27
import tensorflow as tf import numpy as np # Elman dynamics class RNN(): def __init__(self, input_size, hidden_size, add_noise=False): xav_init = tf.contrib.layers.xavier_initializer self.input_size = input_size self.hidden_size = hidden_size self.W = tf.get_varia...
b63447d639b2bf97d1f0a4dd039b9bfec21bd5f393425ab6bb633bc46940e897
Python
1,199
22
import argparse from eval import main parser = argparse.ArgumentParser(description='Evaluate few-shot prototypical networks') default_model_path = 'results/best_model.pt' parser.add_argument('--model.model_path', type=str, default=default_model_path, metavar='MODELPATH', help="location of pretrai...
03bf0bfab62a240062ab2ba17465283cb3753a405b0f266d002b9589fb8eed57
Python
1,200
27
import argparse import sys from Bio import SeqIO def do_count(passengers, alignments, countfile): counts = initialize_counts(passengers) for line in alignments: tokens = line.rstrip().split('\t') if tokens[2] != '*': counts[tokens[2]] += 1 for key in counts.keys(): count...
28a19afdee76fa18953307645b63a601824cbd110177dd5dd747073a7c8c4c5a
Python
1,200
26
# # 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,...
30bfd495365f9286a73f42b42b4f20a89107790eb7eaeecdc92abf74fb2b0227
Python
1,200
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...
17fa0292c876fbc45ae53454a09513a74345f024444de1c364c19216159b4688
Python
1,201
52
import sys import traceback import getopt def main(parameters): """ The main function, which starts to software according to the given command line arguments. :param parameters: the command line parameters: * -h help * -c command line * -g graphic interface """ for o,a in parameters: if o=="-h": print("...
1ecebb6e248615b58043ff201d366cc65c4ab073ef0f3890d55c397cb6b5f5de
Python
1,201
31
from REACTRL.env_modules.net_framework import * from REACTRL.env_modules.signal_conv import * from REACTRL.img_modules.signal_data import train_loader, test_loader from boss.bo.bo_main import BOMain from boss.pp.pp_main import PPMain from datetime import datetime import pandas as pd def func(X, model=None, method='ls...
ef6e56ec8489ce849836d2e710fd45c197bf20c527d57aba34463015b5e0eb79
Python
1,201
57
""" A simple log mechanism styled after PEP 282. Retained for compatibility and should not be used. """ import logging import warnings from ._log import log as _global_log DEBUG = logging.DEBUG INFO = logging.INFO WARN = logging.WARN ERROR = logging.ERROR FATAL = logging.FATAL log = _global_log.log debug = _globa...
fc0d2e916eb04b90c5106cae5f6e523bab5de433f962d4714d188630cfcde38d
Python
1,201
37
import pandas as pd import numpy as np from rpy2 import robjects as ro from rpy2.robjects import pandas2ri from rpy2.robjects.packages import importr from rpy2.robjects.vectors import StrVector, FloatVector import rpy2.robjects.packages as rpacks pandas2ri.activate() R = ro.r def call_Rpackage(call="function", design...
feb769edd4eb1bf6fa9f3a16a48009aef0345d6502b958bf374400dec425a03f
Python
1,201
40
from pathlib import Path import pytest from scanpy import settings from pertpy.metadata._metadata import MetaData @pytest.fixture def cachedir(tmp_path): original = settings.cachedir settings.cachedir = tmp_path yield tmp_path settings.cachedir = original def test_download_metadata_skips_when_cach...
1a8b6716a613b7d134249c197a780964e1a41d7ee077c218a366dbb665b8063f
Python
1,202
35
"""Transform PyTorch models to IR. The translation process is highly customizable. (`Torch2Ir`)[elasticai.creator.torch2ir.Torch2Ir] is responsible for the translation process and will call *module handlers* to extract attributes from modules. These attributes are then attached to the corresponding nodes in the IR. E...
4ebb715694a22de0fb7ecf97f30781c2ad932b46524790b7f7fa108706d27afd
Python
1,202
26
import torch import torch.nn as nn from collections import OrderedDict def load_video_pretrained_weights(model, video_resnet18_pretrain_path): state_dict = torch.load(video_resnet18_pretrain_path)['state_dict'] new_state_dict = OrderedDict() for k, v in state_dict.items(): name = k[7:] # remove 'mo...
63a8b6235e1db9b594f0073affa9f21d5e683b4fdcc9843982b084a9f241f76d
Python
1,202
48
import unittest class TestImports(unittest.TestCase): @classmethod def setUpClass(cls): from neurolib.models.fhn import FHNModel fhn = FHNModel() fhn.run() cls.model = fhn from neurolib.utils.parameterSpace import ParameterSpace pars = ParameterSpace({"x": [1...
77c68eeaa24bc3701575a170b6fbf3c983f83d04cb9cfe7feb6eb536518f278e
Python
1,202
32
import torch.nn as nn class Conv2_5d(nn.Conv3d): """ Decorater class for Conv2_5d, in which kernel size is (1, K, K) or (K, 1, K) or (K, K, 1). Args: unsqueeze_axis: optional, the default axis is -3, resulting in a kernel size of (1, K, K) Other arguments are the same as torch.nn.Conv3d ...
869ae6b4a85bc8af676d63ec72dd3eb8903e038495c27b3502e46c685dbcab17
Python
1,202
26
# # 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,...
db132bbae0a5811a4e4d916fa79a030107d02fa259057083d3dddab5f5838520
Python
1,202
26
# # 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,...
7f97e4f643486887332b633a48342c180497d76582a52f7018a92aed55385940
Python
1,203
42
import importlib import torch.nn as nn # from .pdfam import * # from .lap_experiments import * def find_module_using_name(module_name): if module_name == "none": return None module_base_path = "models.modules.attentions" module_filename = module_name + "_module" if 'pdfam' in module_name: ...
9acc93f8a129d7871be9c158cc46d68dad8781317236a97156967f7065b7a2e6
Python
1,203
53
from __future__ import annotations import csv from pathlib import Path from typing import Iterable, Any def save_configuration_csv( output_dir: str | Path, rows: Iterable[dict[str, Any]], ) -> Path: """ Save the effective configuration used in the analysis to: <output_dir>/Technical_Record/c...
cc517069fe8391649d051b3987716aadcf9e1716c9542ba25ccdf5ca2152f464
Python
1,203
34
import os import sys import logging import functools from termcolor import colored @functools.lru_cache() def create_logger(output_dir, dist_rank=0, name=''): # create logger logger = logging.getLogger(name) logger.setLevel(logging.DEBUG) logger.propagate = False # create formatter fmt = '[%(...
0870e680fdf176ee39b800328ceddfa920d86bf1ff7b839b9344ea792274868a
Python
1,204
29
from elasticai.creator.base_modules.tanh import Tanh as TanhBase from .precomputed_module import PrecomputedModule class Tanh(PrecomputedModule): def __init__( self, total_bits: int, frac_bits: int, num_steps: int, sampling_intervall: tuple[float, float] = (-float("inf"), ...
2e3e57986af56c70026f76da27f875a3699092f3ee7e0e721e6bd552e842b185
Python
1,204
24
# 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...
3dae2205e814d7b991110cf12ad2a848d0a9e60dda27d4174007b643e4034315
Python
1,204
38
from typing import (Any, Iterable, Literal, Optional, Protocol, Union, runtime_checkable) import numpy as np from numpy.typing import NDArray __all__ = ['Recording', 'RealArray'] RealArray = Union[NDArray[np.integer], NDArray[np.floating]] @runtime_checkable class Recording(Protocol): """I...
58d4e65f063df8baef4a0293b288a0b6cd81c5771b0b421bc2cea924a2f00567
Python
1,204
36
import xlrd # version 1.2.0 import numpy as np def read_excel(filename, sheetname): wb = xlrd.open_workbook(filename=filename) sheet = wb.sheet_by_name(sheetname) nrow = sheet.nrows ncol = sheet.ncols return sheet, nrow, ncol def read_excel_array(filename, sheetname): con_sht, nrow, ncol = read_excel(filena...
886e522e7e5e1bea60a07d1032ddc3b1c2f526fc233a051a575fb608e17c25dd
Python
1,204
37
import bpy from bpy.types import Collection from databpy.collection import create_collection def mn() -> Collection: "Return the 'MolecularNodes' collection, creating it first if required" return create_collection("Molecular Nodes") def data() -> Collection: "Return the MolecularNodes/data collection an...
e38de355749d165314bde99c94f3cee7d71d627ccb5b17932063f9d5e0ac70c4
Python
1,204
48
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under th...
f1deada161c5dbd1f7f70b93f7b95a8b4265719a1b9ed71595ef1f5d823d36c8
Python
1,204
29
from elasticai.creator.base_modules.silu import SiLU as SiLUBase from .precomputed_module import PrecomputedModule class SiLU(PrecomputedModule): def __init__( self, total_bits: int, frac_bits: int, num_steps: int, sampling_intervall: tuple[float, float] = (-float("inf"), ...
f6793412af87bc643b6f9b6912dfa528b6273d7b57d3d8da80e3e71bb803db9c
Python
1,204
34
# SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL # # SPDX-License-Identifier: AGPL-3.0-or-later # Function for comparing per-cell reliabilities using ROC analysis # Basic functions def renormalize_samples(sampleA,sampleB): "Renormalize the two samples together to lie between 0 and 1" t_min=np.amin([...
5b86570dbac2d5db646ae0963861641611817d171441aaf5a1e77aef2dc064cd
Python
1,205
24
# 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...
740891679e95971f20f064e5a355e88f39ac93ec840367cc24e175eb1da566fa
Python
1,205
45
from __future__ import absolute_import, division, print_function, unicode_literals import argparse import logging import os import sys import tensorflow as tf import matplotlib.pylab as plt from tensorflow.keras import layers from tensorflow.keras import models import numpy as np import PIL.Image as Image import glob ...
2c18034822b2c104413719944a823ac31e70e5c83d4f98ce443f5623f198317b
Python
1,206
35
import os import tempfile import warnings from replicate.client import Client from cog import ExperimentalFeatureWarning, Input, Path, Secret warnings.filterwarnings("ignore", category=ExperimentalFeatureWarning) def run( image: Path = Input(description="Input image to test"), replicate_api_token: Secret =...
3111f79f76c394c89d8037f4a4c4356ab8cf2823f77929ec57972e00d5e974c4
Python
1,206
31
# 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...
454490c008bfa4dbf3fe29931e59bdb1f3330124061c965a27886f1895ae2bf1
Python
1,207
28
""" Main run function for getting (and saving) connectivity matrix last modified: András Ecker 09.2022 """ import logging from conntility.connectivity import ConnectivityMatrix from assemblyfire.config import Config from assemblyfire.utils import get_bluepy_circuit_from_root_path L = logging.getLogger("assemblyfire"...
5fe53c4c8bec8fb86d7046a2c281eed6fdbe150c1c88d57c0fde085a9011c582
Python
1,207
39
import torch from prosper_nn.models.crcnn import CRCNN 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 n_branches = 3 batchsize = ...
684c28a9bdebaca6cba34a1cf044b7bbd097a209ccd0f98c5f62e88891c96992
Python
1,207
38
import os from torchdrug import data, utils from torchdrug.core import Registry as R @R.register("datasets.ClinTox") @utils.copy_args(data.MoleculeDataset.load_csv, ignore=("smiles_field", "target_fields")) class ClinTox(data.MoleculeDataset): """ Qualitative data of drugs approved by the FDA and those that ...
b37cf37dd2b9c1d827d6252507df4e202ddba2dfbf47891f59b4f87b5038bf1a
Python
1,207
45
import jax.numpy as jnp import jax.scipy as jsc from jax import jit from . import utils @jit def ln(input, filter): try: outputLinear = utils.conv(input, filter) except: outputLinear = input return outputLinear[:input.shape[0], :] @jit def ln1d(input, filter): try: outputLinea...
25cfda5113dc130ba174eb5ee6983294a7cd00a88315431c325f21981203747e
Python
1,208
35
# 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...
3794612ba4982f53f7a57e89d5eff168b79e5781703336fc7954545ca3a56f17
Python
1,208
53
from pathlib import Path from typing import TypedDict, Union class Params(TypedDict): chunk_size: int rescale: bool rescale_value: float lowpass: bool common_reference: str spike_duration: float amp_avg_duration: float threshold: float min_avg_amp: float AHP_thr: float neig...