sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
8a299618fad1be29c4c65575fbcb64c72c47204d9c02e5fd1418ba35f1faad87
Python
469
10
import synapseclient import synapseutils syn = synapseclient.Synapse() syn.login() outdir = "data/mc_caa/" # files = synapseutils.syncFromSynapse(syn, 'syn17010931', path = outdir + "Metadata/", ifcollision="keep.local") # files = synapseutils.syncFromSynapse(syn, 'syn21547862', path = outdir + "Genetic_Variants/", ...
8bf39d4f8d4a22b7457cd1e71a3b333c20c6dc7cee3b9bc72823bb6de7eb8c9e
Python
469
18
import os import random import numpy as np import torch def seed_everything(seed: int): os.environ["PYTHONHASHSEED"] = str(seed) random.seed(seed) # Seed for NumPy's random number generation np.random.seed(seed) # Seed for PyTorch (both CPU and CUDA) torch.manual_seed(seed) if torch.cuda....
2264d7cbf9a753f5dfdc8dafdea1de019150afaf7544e0b7f28a0e0d9d30f885
Python
470
22
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup CONFIGS = { 'astar_lmcount': [ '--search', 'astar(lmcount(lm_merged([lm_rhw(),lm_hm(m=1)]),admissible=true,optimal=true),mpd=true)'], } exp = common_setup.IssueExperiment( search_revisi...
4bf9aad28f76f7b12c5d333136dfacf2a77d6d124899f0806515cbddbad9da03
Python
470
11
import os import torch def save_model_w_condition(model, model_dir, model_name, accu, target_accu, log=print): ''' model: this is not the multigpu model ''' if accu > target_accu: log('\tabove {0:.2f}%'.format(target_accu * 100)) # torch.save(obj=model.state_dict(), f=os.path.join(model...
717ebf1216e48cc30d0c56209f395853d8e01049d18efadff8e25a0625c0d1da
Python
470
25
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from common_setup import IssueConfig, IssueExperiment REVS = ["issue592-base", "issue592-v1"] SUITE = suites.suite_optimal_strips() CONFIGS = [ IssueConfig("seq-opt-bjolp", [], driver_options=["--alias", "seq-opt-bjolp"]), ] exp = Issu...
771d20f383e1f71601f725ffbe8a41bb5acd2702122354fd7bb66b7b9e647c69
Python
470
15
import os import pytest import merlin from merlin import merlin as m @pytest.mark.fullrun @pytest.mark.slowtest def test_merfish_2d_full_local(simple_merfish_data): with open(os.sep.join([merlin.ANALYSIS_PARAMETERS_HOME, 'test_analysis_parameters.json']), 'r') as f: snakefilePa...
a70419a9927f8a134befb43b558361f0f7fd0d518ab653aa3014522062d9d270
Python
470
22
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup CONFIGS = { 'astar_lmcount': [ '--search', 'astar(lmcount(lm_merged([lm_rhw(),lm_hm(m=1)]),admissible=true,optimal=true),mpd=true)'], } exp = common_setup.IssueExperiment( search_revisi...
b526ed7c8856d055d42e195d4e7dc23ff1edce55a4107d1c535b2c3832157ba1
Python
470
22
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup CONFIGS = { 'astar_lmcount': [ '--search', 'astar(lmcount(lm_merged([lm_rhw(),lm_hm(m=1)]),admissible=true,optimal=true),mpd=true)'], } exp = common_setup.IssueExperiment( search_revisi...
be0cfc6a28e70ed9063293bbda410b3bb115972e7089afd0bf980a20b0b66362
Python
470
25
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from common_setup import IssueConfig, IssueExperiment REVS = ["issue592-base", "issue592-v2"] SUITE = suites.suite_optimal_strips() CONFIGS = [ IssueConfig("seq-opt-bjolp", [], driver_options=["--alias", "seq-opt-bjolp"]), ] exp = Issu...
d861d709c8cb195241d7323382d4a14e4d9b2c1e6c3914ef1f402eb60cf607e3
Python
470
25
#! /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("seq-opt-bjolp", [], driver_options=["--alias", "seq-opt-bjolp"]), ] exp = Issu...
e001497f955be7967796c2951f0c7bb2a5beef30d3c15e7ec3849d69559f64ba
Python
470
17
# This file is autogenerated by the command `make fix-copies`, do not edit. from ..file_utils import requires_backends class ImageFeatureExtractionMixin: def __init__(self, *args, **kwargs): requires_backends(self, ["vision"]) class DeiTFeatureExtractor: def __init__(self, *args, **kwargs): ...
f76a5b36040060c86f5976f90fa9f2771485e89ed11181cfa5a038962bf07783
Python
470
22
# set QT_API environment variable import os import sys os.environ["QT_API"] = "pyqt5" import qtpy # qt libraries from qtpy.QtCore import * from qtpy.QtWidgets import * from qtpy.QtGui import * # app specific libraries import control.gui_tiscamera_simulation as gui #import control.gui_2cameras_async as gui #import co...
858f9ffc2a8ce026e213663e32aef5115ea478ff5f7f963546a51eca0b43559e
Python
471
22
import pytest @pytest.mark.xfail def test_that_you_wrote_tests(): from textwrap import dedent assertion_string = dedent( """\ No, you have not written tests. However, unless a test is run, the pytest execution will fail due to no tests or missing coverage. So, write a real test and t...
8a2056de38dff59235f691c803758292ff31b315f971ca27916175622f638e9a
Python
471
10
from ..utils import IKFastInfo from ..ikfast import * # For legacy purposes # TODO: deprecate this file #FRANKA_URDF = "models/franka_description/robots/panda_arm.urdf" #FRANKA_URDF = "models/franka_description/robots/hand.urdf" FRANKA_URDF = "models/franka_description/robots/panda_arm_hand.urdf" PANDA_INFO = IKFastI...
aad2eee3bec76faad2127343516f72f18a7e2100a76b73c77b800b31091a13df
Python
471
17
import random from .shape import Shape class ShapeSet: def __init__(self, shape_groups: list[list[Shape]]): self.__shape_groups = shape_groups def __len__(self): return len(self.__shape_groups) def __getitem__(self, idx): if idx >= len(self.__shape_groups): raise ...
ce685c86c52b161d84c004ec9d9fd9b3a4578cb9e090cffb0444f56a4f4820be
Python
471
21
import unittest class TestTowerMain(unittest.TestCase): def test_imports(self): try: from dreamcoder.domains.tower.main import ( Flatten, TowerCNN, tower_options, dreamOfTowers, visualizePrimitives, ...
22a2625e068d42ad658aacd643bc6964fc277432ed43aa0fbf0848ba6ffb4836
Python
472
23
# SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL # # SPDX-License-Identifier: AGPL-3.0-or-later ''' Compute rc densities for original and many samples of a control Author(s): Daniela Egas S. Last updated: 12.2023 ''' import json import sys sys.path.append('../../../library') from structural_basic import * de...
44882fe3ad4a1158951e6572ac046645f7c4c2f8d5d22a81b9d62419e32286ab
Python
472
25
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites from common_setup import IssueConfig, IssueExperiment REVS = ["issue481-base", "issue481-v1"] SUITE = suites.suite_satisficing_with_ipc11() CONFIGS = [ IssueConfig("lama", [], driver_options=["--alias", "seq-sat-lama-2011"]), ] exp = I...
52a5fc81e467f14fea69d31d0ec979e4ab0b5ee65aef8d5f11a26f3cb4670362
Python
473
22
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup CONFIGS = { 'astar_lmcount': [ '--search', 'astar(lmcount(lm_merged([lm_rhw(),lm_hm(m=1)]),admissible=true,optimal=true),mpd=true)'], } exp = common_setup.IssueExperiment( search_revisi...
8cdf7d42f955d4fb28d5a014a6de8dc7bab3c73e174b14446173e0fb6285c54c
Python
473
19
from preprocessing import Preprocessor from tokenization import Tokenizer from config import Raviv1 from language import load_input_language from learning_experiment import LearningExp def test_preprocessing(): lang = load_input_language('S5') prep = Preprocessor(Raviv1, lang) lexp = LearningExp.load('da...
a1a25f05a086d6e0bf4063ec364384def6d5686036fde7d2bea9cd450b68bb71
Python
473
13
from cog import BaseRunner, File, Input, Path class Runner(BaseRunner): def run( self, image: Path = Input(description="An image path"), document: File = Input(description="A file upload"), # Optional variants mask: Path | None = Input(description="Optional mask path", defa...
b044ba7ac808d8b42831700923b5d99bcc1f6db427112c0767e657db779e148b
Python
473
28
from unittest import TestCase import numpy as np import matplotlib.pyplot as plt from soundsig.basis import RadialBasis1D class TestBasis(TestCase): def setUp(self): pass def tearDown(self): pass def test_radial_basis(self): nsamps = 500 x = np.random.rand(nsamps) ...
8263491b9915a8b4a540714a00f74052daddea066c19198496aab6e15ebab259
Python
474
18
## Enable from <module> import * from os.path import dirname, basename, isfile, join import glob modules = glob.glob(join(dirname(__file__), "*.py")) __all__ = [ basename(f)[:-3] for f in modules if isfile(f) and not f.endswith('__init__.py') ] ## Set up logging from cuppa.logger import initialize_logging ...
734254f2c41e91cdd171590ed1b800879335d23d9ba0927048d4014135d87099
Python
475
12
from setuptools import setup, find_packages setup( name='synergy-3dmm', version='0.0.1', description='Library for accurate and fast 3d landmarks, face mesh, and face pose prediction', packages=find_packages(exclude=('artistic*', 'benchmark*', 'loss_definition*', 'demo*', 'img*', 'pretrained*', 'Sim3DR'...
8a5c02369fa700cc76560a7b5539a4bd480e27abd14a12e67240ddeb1d359343
Python
475
15
from prettytable import PrettyTable def count_parameters(model): table = PrettyTable(["Modules", "Parameters"]) total_params = 0 for name, parameter in model.named_parameters(): if not parameter.requires_grad: continue param = parameter.numel() table.add_row([name, param]) ...
fd1e7ee7b993f9a20f62fcb6bc8c5cdc976eaca15449abcee05112703276b105
Python
475
22
import time import threading class Temp: def __init__(self, queue, is_values): self.queue = queue self.is_values = is_values self.thr = threading.Thread(target=self.run,args=()) self.thr.start() def run(self): while True: if self.queue.qsize() < 10: self.queue.put(['measure','temperature_...
19de2f1fd275cbb20036d87b62adec00c597a2e4565ce2fecb46b2f0ab70950b
Python
477
14
#!/Users/csmfindling/anaconda/bin/ python from distutils.extension import Extension from Cython.Distutils import build_ext from distutils.core import setup from Cython.Build import cythonize import numpy setup( cmdclass = {'build_ext': build_ext}, ext_modules = [Extension("smc_c", ...
e1305862dbe9e381819c05f0d5e21df584bef6beab2073538f041bac5bd10009
Python
478
18
#!/bin/env python3 ''' Create figures for PDL topology paper introducing Feynman diagrams. This file creates figures in the classical phase singularity view point. ''' import yaml import sys import pdlfeynman as fy yp = lambda *x: print(yaml.safe_dump(x, allow_unicode=True)) assert len(sys.argv) == 3 diagram = yaml.s...
912f15fbefa955c7aaaf0d26e65102ffb18ea7ebf0ec98bf8a659c0fc191e0b1
Python
479
12
# Copyright (c) OpenMMLab. All rights reserved. from .backbones import * # noqa: F401, F403 from .base import BaseModel from .builder import (build, build_backbone, build_component, build_loss, build_model) from .common import * # noqa: F401, F403 from .registry import BACKBONES, COMPONENTS, LOS...
4480caf374e6c35329905c0a9fc876a53eaafdace1c32ee10a99833830f08d99
Python
480
9
"""Runs condition B of REAL_ODOURS.py in a second process (same code, same seeds -> identical counts), writing to tmp/real_odours_counts_B.npz; merged into 06-OUTPUT/real_odours_counts.npz before `analyse`. 2026-09-25.""" import sys, runpy sys.argv = ['REAL_ODOURS.py', 'x'] g = runpy.run_path('D:/eucys/03-CODE/REAL_ODO...
fe0d07075c7d0b4ea8a6084bc04eea54cdde1be36b7f1c6bedd53e3173c95abf
Python
480
16
from elasticai.creator.file_generation.savable import Path from elasticai.creator.file_generation.template import ( InProjectTemplate, module_to_package, ) class ENV5Constraints: def save_to(self, destination: Path): template = InProjectTemplate( package=module_to_package(self.__module...
04c9389189552e703374934bdb51c76ae690aa43f4e2b95e9baa730ba6e24e02
Python
481
18
# Copyright (c) OpenMMLab. All rights reserved. from mmcv.utils import collect_env as collect_base_env from mmcv.utils import get_git_hash import mmedit def collect_env(): """Collect the information of the running environments.""" env_info = collect_base_env() env_info['MMEditing'] = f'{mmedit.__version_...
04eee7107998c1bd11a860206be18439c375a4675d161d5a0479df50b885516e
Python
481
17
#!/usr/bin/python # -*- coding:utf-8 -*- import logging def setlogger(path): logger = logging.getLogger() logger.setLevel(logging.INFO) logFormatter = logging.Formatter("%(asctime)s %(message)s", "%m-%d %H:%M:%S") fileHandler = logging.FileHandler(path) fileHandler.setFormatter(logFormatter) ...
06354e553e97521e60d5c8220ecdc3a5a957617594eb9dd39827a345941e60d8
Python
481
16
from elasticai.creator.file_generation.savable import Path from elasticai.creator.file_generation.template import ( InProjectTemplate, module_to_package, ) class ENV5ReconfigTop: def save_to(self, destination: Path): template = InProjectTemplate( package=module_to_package(self.__module...
4a83420c0cec2c5a4fa5c188dbc300e0d4a4fe6e91e6e9a71b03a4884769d981
Python
481
11
def inv_lr_scheduler(optimizer, iter_num, gamma, power, lr=0.001, weight_decay=0.0005): """Decay learning rate by a factor of 0.1 every lr_decay_epoch epochs.""" lr = lr * (1 + gamma * iter_num) ** (-power) i=0 for param_group in optimizer.param_groups: param_group['lr'] = lr * param_group['lr_m...
8acb8cbfc2f0c8cdea0ce77afa40e91593f7c2f383509e7edbe8cf2aca7fd6f0
Python
481
20
import unittest class TestRegexesMain(unittest.TestCase): def test_imports(self): try: from dreamcoder.domains.regex.main import ( LearnedFeatureExtractor, ConstantInstantiateVisitor, MyJSONFeatureExtractor, regex_options, ...
8ff667d6a5e2831c11e1fe7360679e108ffc4a3d79502132179f42e2ceea2471
Python
481
11
import os import sys group = sys.argv[1] start = int(sys.argv[2]) stop = int(sys.argv[3]) for i in range(start, stop+1): os.system(f"mkdir patients/{group}{i}/results32") os.system(f"scp larswd@saga.sigma2.no:/cluster/projects/nn8017k/Lars/experiments/meshes/{group}{i}/results32/*.txt patients/{group}{i}/res...
923f56eddf82b09970795843fdfd89a1e5630cd32c04b9471538aef27deb692a
Python
482
19
from elasticai.creator.ir import Registry from ._ir import ( DataGraph, pattern_rule, ) from ._ir import ( sequential_with_interface as _sequential_with_interface, ) def _replacement_fn(g: DataGraph, registry: Registry) -> tuple[DataGraph, Registry]: return _sequential_with_interface(("activation", "...
95ab0ca5ae7d88b374d7bf38c90eca0db625e2826137a23c4e58976bf8d8dfcb
Python
482
12
from .amigos import AMIGOSDataset from .bci2022 import BCI2022Dataset from .deap import DEAPDataset from .dreamer import DREAMERDataset from .mahnob import MAHNOBDataset from .seed import SEEDDataset from .seed_feature import SEEDFeatureDataset from .seed_iv import SEEDIVDataset from .seed_iv_feature import SEEDIVFeatu...
a3c6d4ceec2a3afa9170468d50b2452c2d91e369d20450c219e8aae4802f324a
Python
482
15
"""The hub's updater entry uses icon='download'; it must exist in the registry.""" from regtools.gui import icons def test_download_glyph_registered(): assert "download" in icons.NAMES assert "download" in icons._SVGS def test_download_glyph_is_themable_svg(): svg = icons._SVGS["download"] ...
fdd9d20896cc7727a1870783a1d8c1031404c682dd8f55a53ed65d98f4e3068b
Python
482
18
# Copyright (c) Open-MMLab. All rights reserved. __version__ = '0.14.0' def parse_version_info(version_str): ver_info = [] for x in version_str.split('.'): if x.isdigit(): ver_info.append(int(x)) elif x.find('rc') != -1: patch_version = x.split('rc') ver_in...
f20eb628921a1cdb43ccf8684a36ffe7b7fa897016d4f1efddfdee076f9add18
Python
483
20
from abc import ABC, abstractmethod from elasticai.creator.file_generation.savable import Path, Savable from elasticai.creator.vhdl.design.ports import Port class Design(Savable, ABC): def __init__(self, name: str): self._name = name @property def name(self) -> str: return self._name ...
1a0872a59b931d6f1f562eca00cf9ec05f148bd48cfce42ca917ee533eda55e9
Python
484
13
from setuptools import setup, find_packages exec(open('plantsegtools/__version__.py').read()) setup( name='plantsegtools', version=__version__, packages=find_packages(exclude=["tests"]), include_package_data=True, description='Suite of Python tools for plant-seg https://github.com/hci-unihd/plant-s...
5699ff0644d5a2c4a96cde36358b9ae4634a91ac85673456a98025b6452411b9
Python
484
8
def test_annotation_grid_matches(): from regtools.registration.point_registration import annotation_grid_matches # in-plane (y,x) of the annotation must equal the expected (y,x) assert annotation_grid_matches((528, 320, 456), (320, 456)) is True assert annotation_grid_matches((512, 512, 512), (320...
d561fc079721baa8ed6af73893998eed9f9e9af3f8eaaa12376a702d4b3a6b7a
Python
484
12
from HPRO.aodiag import AODiagKernel kernel = AODiagKernel() kernel.setk([[0.000000000000, 0.000000000000, 0.000000000000], [0.333333333333, 0.333333333333, 0.000000000000], [0.500000000000, 0.000000000000, 0.000000000000], [0.000000000000, 0.000000000000, 0.000000000...
3044c8e5c63a9fb6c8559b1e6fc437d327a92043a2dd83234cc9e2d3c8d5b547
Python
485
21
"""Distributional, single-time, and static discrimination metrics.""" from .distributional import concordance_time_dependent from .single_time import auc, auc_cr, auc_cr_per_event from .static import ( concordance, concordance_cr, concordance_cr_per_event, concordance_ic, ) __all__ = [ "auc", ...
4c083b6fd8aaa1238336ef619907bfdae189bc633e390cc162a2c57e7823ebb9
Python
485
13
from typing import Tuple import thop import torch import torch.nn as nn import yacs.config def count_op(config: yacs.config.CfgNode, model: nn.Module) -> Tuple[str, str]: data = torch.zeros((1, config.dataset.n_channels, config.dataset.image_size, config.dataset.image_size), ...
a9c48274c81b8c61ea540f692ad65cc86ade487fffe042df36d70d65eb91ea81
Python
485
16
from __future__ import annotations import pytest pytest.importorskip("pymatgen.analysis.defects") from pymatgen.core import Lattice, Structure from quacc.atoms.defects import get_defect_entry_from_defect def test_get_defect_entry_requires_dummy_site(): defect_supercell = Structure(Lattice.cubic(5), ["Si"], [[...
91c48748d64f159b24f57f1d8225e57c764ff38501bcffaeda774967c2bd3a32
Python
486
20
from .resnet_cifar import * from .resnet import * from .mobilenetv2 import mobilenet_v2_cifar model_dict = { "resnet18": resnet18, "resnet34": resnet34, "resnet50": resnet50, "resnet101": resnet101, "resnet152": resnet152, "resnet20": resnet20_cifar, "resnet32": resnet32_cifar, "resnet...
c5bb4068cff7287cd7ecb37adffbe996cd65bd4dd783e046072219d7d15b1c8a
Python
486
20
from setuptools import setup, find_packages requirements = [ "numpy", "pandas", "xarray", "scipy", "msgpack<1.0", # TODO figure out conda dev setup and add "opencv-python", ] setup( name="pupil_recording_interface", version="0.5.0", packages=find_packages(), long_description=op...
c721a25968280443a0c936d375cfb4e05c3cffae8d8bcc0d45070c7f7410b597
Python
486
18
from abc import ABC, abstractmethod import torch from elasticai.creator.vhdl.design.design import Design class DesignCreatorModule(ABC, torch.nn.Module): @abstractmethod def create_design(self, name: str) -> Design: ... @abstractmethod def forward( self, inputs: torch.FloatTensor, given_inp...
00627182df2c25eb74ed864c3139ee516acf5b7f89e8fb22e806ce6ab3fc46ec
Python
487
13
import os import sys ref_path = sys.argv[1] fasta_dir_path = sys.argv[2] sam_dir_path = sys.argv[3] dir_list = os.listdir(fasta_dir_path) for dir in dir_list: test = dir.strip().split(".") print("\nbio minimap2 -a -x map-ont --secondary=no -t 40 " + ref_path + " " + fasta_dir_path + dir + " > " + sam_dir_pa...
a2a28c13a4f9a9465360a10d8d09ac3e9d9f33bc467887176df01d0f20fba49c
Python
487
24
# external import pytest # project import textdistance ALG = textdistance.Hamming @pytest.mark.parametrize('left, right, expected', [ ('test', 'text', 1), ('test', 'tset', 2), ('test', 'qwe', 4), ('test', 'testit', 2), ('test', 'tesst', 2), ('test', 'tet', 2), ]) def test_distance(left, rig...
5c11a0d566efe5ebe73fbc0d4b828a50a79e8569569d446255c14fa1ecb590ff
Python
489
13
from dimension_encoding.b5k import B5kLoader, compute_noise_ceiling_b5k from tqdm import tqdm if __name__=="__main__": dl = B5kLoader() for subj_int in tqdm(range(1,5), total=4): subject = f"CSI{subj_int}" responses = dl.load_responses(subject) stimdata = dl.load_stimdata(subject) ...
525688284f35015e02032cf24301f84379903605ad408414e9ea2bbb5b06e26f
Python
490
14
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by Bin Xiao (Bin.Xiao@microsoft.com) # ------------------------------------------------------------------------------ from __future__ import absolute_import from __futu...
ad69629f4b5409823277b05f536dd2f00f324305a02effb0c2e8e642bb33c2c6
Python
490
13
from setuptools import setup, find_packages setup(name='mesocircuit', version='1.0.0', description='Mesocircuit Model', long_description=open('README.md').read(), long_description_content_type='text/markdown', url='https://github.com/INM-6/mesocircuit-model', author='see docs/source...
b87f788022ff933ff86d9c9fa40eec5b3bc6274c2b243d14aeafa88ca51a00f8
Python
490
12
from HPRO.lcaodiag import LCAODiagKernel kernel = LCAODiagKernel() kernel.setk([[0.000000000000, 0.000000000000, 0.000000000000], [0.333333333333, 0.333333333333, 0.000000000000], [0.500000000000, 0.000000000000, 0.000000000000], [0.000000000000, 0.000000000000, 0.000...
1a8c0380aba4773b29be1d769ca841956c8d123a21252b6400b7627c7d227dea
Python
491
25
#! /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_optimal_with_ipc11() CONFIGS = { "blind": ["--search", "astar(blind())"], "ipdb": ["--search", "astar(ipdb(max_time=150))"...
373f3462501eb35f3c078281afa3e05ed2fd5173834dd3fb82391d37c36f32bb
Python
491
24
# external import pytest # project import textdistance ALG = textdistance.Levenshtein @pytest.mark.parametrize('left, right, expected', [ ('test', 'text', 1), ('test', 'tset', 2), ('test', 'qwe', 4), ('test', 'testit', 2), ('test', 'tesst', 1), ('test', 'tet', 1), ]) def test_distance(left,...
39412a515849035f93161236809a667bed32d8f66ae1b3a95928a5df69ad5e2a
Python
491
24
#!/usr/bin/python # -*- coding:utf-8 -*- from datasets.CWRU import CWRU from datasets.CWRUFFT import CWRUFFT from datasets.PU import PU from datasets.PUR import PUR from datasets.PUFFT import PUFFT from datasets.PU_type import PU_type from datasets.PUFFT_type import PUFFT_type from datasets.JNU import JNU from dat...
3bbd58ebf67ef37947e9dbdc44dfe847d74f02c78db45c0a1ca11fe51bf4b266
Python
491
13
from .dataprocessor import AutosomeDataProcessor from .first_layers_block import AutosomeFirstLayersBlock from .coreblock import AutosomeCoreBlock from .final_layers_block import AutosomeFinalLayersBlock from .predictor import AutosomePredictor from .trainer import AutosomeTrainer __all__ = ("AutosomeDataProcessor", ...
42bb8d3b355e066e337c02f1963ae550857b775294900a233296c1d6c692b6df
Python
491
28
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Documentation: Tests for hybridLFPy classes and methods """ def _test(verbosity=2): ''' Run unittests for hybridLFPy Arguments --------- verbosity : int verbosity level Returns ------- None ''' import unittest f...
619cecc7a04818973e5c285cb28a1e38dc610e316abf830040f669b30efc8989
Python
491
22
""" Registration backend subpackage. Provides ANTs SyN and Elastix B-spline registration backends, plus a unified method-agnostic interface. """ from .ants import ( antsRegistration, antsTransformation, exportAntsDeformationField, antsTransformPoints, build_fixed_mask_from_annotation, ...
741825f3d7bf62b3ac9a732c69505ebaf42b722933d884cbed9c0c9a92737575
Python
491
35
from re import L import numpy as np from topaz.model.features.basic import BasicConv, Conv63, Conv127 class TestBasicConv(): def test_init(self): layers = [5] units = 5 model = BasicConv(layers, units) def test_fill(self): pass def test_unfill(self): pass ...
9027a19b2d146816bda15303ed9219ae7b307e73f72d767996f9cd2402f92413
Python
491
23
"""Wrappers to call pyproject.toml-based build backend hooks. """ from ._impl import ( BackendInvalid, BackendUnavailable, BuildBackendHookCaller, HookMissing, UnsupportedOperation, default_subprocess_runner, quiet_subprocess_runner, ) __version__ = '1.0.0' __all__ = [ 'BackendUnavaila...
d31ce86a919e2f643d3cc42841d6c4929b82ad028c4962aca1ec8e285ec13aac
Python
491
24
# built-in from math import isclose # external import pytest # project import textdistance ALG = textdistance.Overlap @pytest.mark.parametrize('left, right, expected', [ ('test', 'text', 3.0 / 4), ('testme', 'textthis', 4.0 / 6), ('nelson', 'neilsen', 5.0 / 6), ]) def test_distance(left, right, expect...
16bc4cc35863bf7f061ab7d5c8e89d72eea499a1f0c5dab59375da532ec71576
Python
492
25
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup REVS = ["issue511-base", "issue511-v1"] LIMITS = {"search_time": 1800} SUITE = suites.suite_optimal_with_ipc11() CONFIGS = { "astar_blind": ["--search", "astar(blind())"], "astar_hmax": ["--search", "astar(hmax())...
2fb0a8a2292331735117d312b217f8172cc60b0d94dfe3a0ad417770ba7d77a5
Python
492
25
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup REVS = ["issue456-base", "issue456-v2"] LIMITS = {"search_time": 1800} SUITE = suites.suite_optimal_with_ipc11() CONFIGS = { "astar_blind": ["--search", "astar(blind())"], "astar_hmax": ["--search", "astar(hmax())...
86b9c6ae74ae6ba3f573e41ded8e5eec5d171d15e22575cc24847ead560dcdef
Python
492
25
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup REVS = ["issue456-base", "issue456-v1"] LIMITS = {"search_time": 1800} SUITE = suites.suite_optimal_with_ipc11() CONFIGS = { "astar_blind": ["--search", "astar(blind())"], "astar_hmax": ["--search", "astar(hmax())...
2c723d05a4f25d89cb20fc5fc4a35749d128dcba9ca49dc0b9746d6ecc8ca85f
Python
493
23
import numpy as np import scipy.stats as st def toRanks(A): AA = np.zeros_like(A) for i in range(A.shape[1]): AA[:, i] = st.rankdata(A[:, i]) AA = np.array(np.around(AA), dtype="int") - 1 return AA def gaussianize(Y): N, P = Y.shape YY = toRanks(Y) quantiles = (np.arange(N) + 0....
94b3c7522e2e0f10b7b60a43d763d27e229b847ad86a3c1979bb2ab8cfa55ec9
Python
493
13
from elasticai.creator_plugins.combinatorial.wiring import connect_data_signals def test_connecting_explicit_data_signals(): edge = ("src", "dst", ((1, 1),)) code = tuple(connect_data_signals((edge,))) assert code == ("d_in_dst(1) <= d_out_src(1);",) def test_connecting_data_signals_by_range(): edge...
b47dd5f15d0d246edad9b1308bad465517d1911f14403bed2373a8b317a6cacf
Python
495
19
from numpy.random import seed from wonambi.utils import create_data from wonambi.trans import concatenate seed(0) data = create_data(n_trial=5) def test_concatenate_trial(): data1 = concatenate(data, axis='trial') assert data1.number_of('trial') == 1 assert data1.list_of_axes == ('chan', 'time', 'trial...
d5878fb71dfa4ca7266907855fe0cb24fbd35502dbba0d98cfba709cd336b18d
Python
495
21
import unittest class TestEcModule(unittest.TestCase): def test_imports(self): try: from dreamcoder.dreamcoder import ( commandlineArguments, ECResult, ecIterator, evaluateOnTestingTasks, default_wake_generative, ...
4c1d414cfdfd51107695ba5b565ccd4b4b1dcdabb4ca6731337d63c089f0f488
Python
496
17
import pandas as pd class UniqueAggregator: def __init__(self, column): self.column = column def execute(self, adata): # column can be cell index or bin number if self.column == "index": values = adata.obs.index else: values = adata.obs[self.column].uni...
9c7c3568e1859942a81911544b6303f7b1b7b6ab95f30c52aa4797c40d616554
Python
496
16
# Auto-generated by nodebpy.assets.dump_library — do not edit manually. from .ambient_occlusion_internal import AmbientOcclusionInternal from .color_ao import ColorAO from .flat_internal import FlatInternal from .mn_color import MNColor from .outline_mask import OutlineMask from .transparent_outline_internal import Tra...
d92e2d9170e29ef421bb819c0f300c1db90ac3efd5447f95f8db1a4bf44473d9
Python
496
16
from typing import Tuple import torch import torch.nn as nn class MixupLoss: def __init__(self, reduction: str): self.loss_func = nn.CrossEntropyLoss(reduction=reduction) def __call__( self, predictions: torch.Tensor, targets: Tuple[torch.Tensor, torch.Tensor, float]) -> torc...
1c1fbe1388fe8e876a100b5e934763e62e49e69ea5df1e28be421567b5dfd192
Python
497
16
from typing import Tuple import torch import torch.nn as nn class CutMixLoss: def __init__(self, reduction: str): self.criterion = nn.CrossEntropyLoss(reduction=reduction) def __call__( self, predictions: torch.Tensor, targets: Tuple[torch.Tensor, torch.Tensor, float]) -> tor...
382eb87214218e0920b54c99ec3105e7e035420a38c9c3860ff5e358b8cea129
Python
497
14
# There is some weird behaviour with importing the utils module here vs that in the datasets module. # Relative imports are fine but to make the base utils module available at top level we have to # import it before the datasets module, and give it another name. from . import utils as core_utils from .cluster import *...
ac5080be0ae2defb658a2861d3a95bd5b790b25421b390f7d6573bb9f035c66a
Python
497
19
# By Shuran Liu, 2023 import torch import torch.nn.functional as F class lossfun(torch.nn.Module): def __init__(self): super(lossfun, self).__init__() def forward(self, gt, oups, bayesian=False): if bayesian: mean = oups[:,:,0:1,:,:] std = oups[:,:,1:2,:,:] ...
bd4cbbfc2a3c54014e953e00f68f609856be8a91c966920786487b18491bfe66
Python
497
13
from .aliases import Alias, Aliases from .basemodel import BaseModel from .claims import Claim, Claims from .descriptions import Descriptions from .forms import Form, Forms from .labels import Labels from .language_values import LanguageValue, LanguageValues from .lemmas import Lemmas from .qualifiers import Qu...
26327f718470636c684bf26395c27ea9f4c56ec41d3ef5faca18c781c2217924
Python
498
24
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup REVS = ["issue554-base", "issue554-v1"] LIMITS = {"search_time": 1800} SUITE = suites.suite_optimal_with_ipc11() CONFIGS = { "astar_hmax": ["--search", "astar(hmax())"], "gbfs_gc": ["--search", "eager_greedy(goalc...
586d8f48ad90ac7368c21c0b1440fb8469a87222abd3c7d3763bd739d884dd03
Python
498
20
import numpy as np import syncopy as spy from syncopy import synthdata cfg = spy.StructDict() cfg.nTrials = 50 cfg.nSamples = 2000 cfg.samplerate = 250 # 3x3 Adjacency matrix to define coupling AdjMat = np.zeros((3, 3)) # only coupling 0 -> 1 AdjMat[0, 1] = 0.2 data = synthdata.ar2_network(AdjMat, cfg=cfg, seed=42) ...
c18c6939f1a472fc1747f1fd0bc4e6df4a2b86c6f0d4013f659573430d2f5277
Python
498
24
import numpy as np import traj_dist.distance as tdist import pickle traj_list = pickle.load(open("/Users/bguillouet/These/trajectory_distance/data/benchmark_trajectories.pkl", "rb"))[:10] traj_A = traj_list[0] traj_B = traj_list[1] # Simple distance dist = tdist.sspd(traj_A, traj_B) print(dist) # Pairwise distanc...
f350dac8d2469e39ef446b9685e1830a3a81cd621038e03debb4087db801657d
Python
499
15
"""The launcher writes a crash log to the project root on bootstrap failure.""" import os def test_write_crash_log_creates_file(tmp_path, monkeypatch): from regtools.updater import launch monkeypatch.setattr(launch, "get_project_root", lambda: str(tmp_path)) try: raise ValueError("boom...
91266222f5913c79cd844ee9c3b1ab87c2fa09b9c1760e6ccf9a9e207f71d700
Python
500
16
import umap def fit_trafo_umap(x_train, x_test, umap_params): fit_params ={"n_neighbors": 100, "min_dist": 0.5, "n_components": umap_params["n_components"], "metric":'euclidean', "n_jobs": 10} dim_red = umap.UMAP(**fit_params) trafo ...
92c776522fb902ce0b9e8319c67577c0310bdc47ef18eb2dc3448fc57a671b63
Python
500
13
import numpy as np from regtools.registration.run_provenance import region_voxel_volumes def test_region_voxel_volumes(): ann = np.array([[1, 1, 2], [2, 2, 0]], dtype=np.int32) # region1: 2 vox, region2: 3 vox v = region_voxel_volumes(ann, 2.0) # 0.025³ etc. in practice assert v[1] == 4.0 and v[2...
d0225644200dcef395d10a62190ee348565361a238208cb246a127091970da92
Python
500
10
import importlib from basicsr.utils import scandir from os import path as osp # automatically scan and import arch modules for registry # scan all the files that end with '_arch.py' under the archs folder arch_folder = osp.dirname(osp.abspath(__file__)) arch_filenames = [osp.splitext(osp.basename(v))[0] for v in scand...
58e09007731c8ff5b76939bcc0b8e58f7b63333055d262179fb6700bea19f2b3
Python
501
21
import unittest class TestTextMain(unittest.TestCase): def test_imports(self): try: from dreamcoder.domains.text.main import ( ConstantInstantiateVisitor, LearnedFeatureExtractor, competeOnOneTask, sygusCompetition, ...
9185594a65d3e825889d3e1424f0edad2401019bbc7ccb85071a6fe46b034cb9
Python
501
15
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. __title__ = "packaging" __summary__ = "Core utilities for Python packages" __uri__ = "https://github.com/pypa/packaging" __version__ = "23...
953ad1b4842acdff9b913cbfa461fc70622971f9875f1318241a4a678f3e30ab
Python
501
14
from .k_fold import * from .k_fold_cross_subject import * from .k_fold_cross_trial import * from .k_fold_groupby_trial import * from .k_fold_per_subject import * from .k_fold_per_subject_cross_trial import * from .k_fold_per_subject_groupby_trial import * from .leave_one_subject_out import * from .split import * from ....
c9303d4514c8b09f2ccc87d1048fd4b408f46b253198d3dc46443d9b53cda5bd
Python
502
29
from .config import ( MappingConfig, ) from .selection import ( select_cluster_prototypes, select_high_confidence_examples, select_boundary_examples, ) from .rendering import ( render_selection_montage, ) from .stage import ( MappingStage, MappingResult, ) __all__ = [ "MappingConfig...
c071733eee333911c1737129eb4b361fb9681bf15ec2e0f5db64eebe704fa320
Python
503
20
"""``pyflagser`` is a python API for the C++ flagser library.""" # PEP0440 compatible formatted version, see: # https://www.python.org/dev/peps/pep-0440/ # # Generic release markers: # X.Y # X.Y.Z # For bugfix releases # # Admissible pre-release markers: # X.YaN # Alpha release # X.YbN # Beta release # X.YrcN # Releas...
0e040629a6fc83cc4ead0497d96825f126d700a4a714ad3abcd16ab037662758
Python
506
11
"""Example B: a dockable panel. Qt is imported only inside the factory, so headless use never needs it.""" def create_panel(context): from .panel import TelemetryPanel # imported on the GUI thread, only when the panel is shown return TelemetryPanel(context) def register(plugin): plugin.panel("example_t...
37f94d2a045342588e1c451e5e5ee4763d3ea2ce88189733c3d3abe8edb87615
Python
506
25
import numpy as np import pandas as pd from topaz.utils.conversions import (boxes_to_coordinates, coordinates_to_boxes, coordinates_to_eman2_json, coordinates_to_star, mirror_y_axis) def test_boxes_to_coordin...
7af3e6d7690b818a939bea5bce6eb46cebae9ae993f08a41356169d2e332af31
Python
506
36
"""Read resources contained within a package.""" from ._common import ( as_file, files, Package, ) from ._legacy import ( contents, open_binary, read_binary, open_text, read_text, is_resource, path, Resource, ) from .abc import ResourceReader __all__ = [ 'Package', ...
e2ed0e736acc49ae04ff317e30f3f3c536a62a6961992db595cd43f7199c66c7
Python
506
13
from .model import Model from .basecall import basecall from .modeltinynoskipx4 import ModelTinyNoSkipX4 from .modeltinynoskipx1 import ModelTinyNoSkipX1 from .modeltinynoskipx0111 import ModelTinyNoSkipX0111 from .modeltinynoskipx011 import ModelTinyNoSkipX011 from .modeltinynoskipx01 import ModelTinyNoSkipX01 from .m...
3c1bb6cd764421307051182e3d4dc61da856747238d04751275303cf0cb26147
Python
507
23
import numpy as np import matplotlib.pyplot as plt def history_plot(history: dict, figname: str, show: bool = False): # make plot plt.figure(1, figsize=(10, 8)) n = np.ceil(np.sqrt(len(history))).astype(int) for i, (k, v) in enumerate(history.items()): plt.subplot(n, n, i + 1) plt.pl...
50083d11a5c9710f9b7dbd4ca012f8e3721fd0c78f63a36a6a0a1a0d82a13ede
Python
507
13
# -*- coding: utf-8 -*- # File : __init__.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 27/01/2018 # # This file is part of Synchronized-BatchNorm-PyTorch. # https://github.com/vacancy/Synchronized-BatchNorm-PyTorch # Distributed under MIT License. from .batchnorm import SynchronizedBatchNorm1...
b47e81b0629f76d71f9927e3bab83c179b5c2d32d0a6d7ae548722d14455bc2d
Python
507
17
import optuna from optuna_dashboard import run_server def objective(trial): x = trial.suggest_float("x", -100, 100) y = trial.suggest_categorical("y", [-1, 0, 1]) return x**2 + y if __name__ == "__main__": storage = optuna.storages.InMemoryStorage() study = optuna.create_study(storage=storage, s...
e92dee6a1efb3c981bf424dbce646844a5b7abccfd61591c5f974c2f6a0fc777
Python
507
13
from .dataprocessor import UnlockDNADataProcessor from .first_layers_block import UnlockDNAFirstLayersBlock from .coreblock import UnlockDNACoreBlock from .final_layers_block import UnlockDNAFinalLayersBlock from .predictor import UnlockDNAPredictor from .trainer import UnlockDNATrainer __all__ = ("UnlockDNADataProces...