sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
a63650f47e92d1db4de01071111a44ec0e7c17d003b5fe60dde5904e65e3cde9
Python
744
22
import argparse import numpy as np import mne def get_edf_annotations(edf_file, outfile): # Load edf file raw = mne.io.read_raw_edf(edf_file, preload=False) # read annotations anno = raw.annotations.description print(anno) print(type(anno)) np.save(outfile, anno) if __name__ == "__main__...
a32e4926584b6b1eb3062638dd76c247b976e4eb15be6640a0e14337afc5169d
Python
745
31
from . import annotations, base, selections from .annotations import ( MoleculeAnnotation, MoleculeAnnotationManager, MoleculeInfo, ) from .base import Molecule from .calculations import CalculationManager from .dssp import DSSPCalculation from .hbonds import HBondCalculation from .imd import StreamingTraje...
c09d62e850ae01df0daab7a89d6a0bc7666127e9ce5de08c9257a0f71fbc7011
Python
745
22
import os import sys read_dir_path = sys.argv[1] output_dir_path = sys.argv[2] model_name = sys.argv[3] dir_list = os.listdir(read_dir_path) batch=0 modeltype = '' if model_name == "TINYX011": batch=128 modeltype = 'tinynoskipx011' model_path = '../../bonito/models/' + model_name + '/' for dir in dir_lis...
3680a78c9e03144678e44a3ed817572ec5890b01a46a2b75b69ff5ee96a5795c
Python
746
26
# copied from setuptools.logging, omitting monkeypatching from __future__ import annotations import logging import sys def _not_warning(record): return record.levelno < logging.WARNING def configure(): """ Configure logging to emit warning and above to stderr and everything else to stdout. This beh...
72b1d9baeefc0c9d6d49caaad3bdc80fa3731cb17ed1c7432ac14d7782d6461e
Python
746
24
# 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...
a64ad456ec79301874322db2fa13111084f71669c62b04ffd89f41ba91fae322
Python
746
38
# external import pytest # project import textdistance ALG = textdistance.Matrix # https://en.wikipedia.org/wiki/Needleman%E2%80%93Wunsch_algorithm NW_MATRIX = { ('A', 'A'): 10, ('G', 'G'): 7, ('C', 'C'): 9, ('T', 'T'): 8, ('A', 'G'): -1, ('A', 'C'): -3, ('A', 'T'): -4, ('G', 'C'): -5...
1eb0cddaa4d113aefc222ff02f51553de58f474dfc935b28825d26893fd36d95
Python
747
33
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup REVS = ["issue558-base", "issue558-v1"] LIMITS = {"search_time": 300} SUITE = suites.suite_satisficing_with_ipc11() CONFIGS = { "lazy_wa3_ff": [ "--heuristic", "h=ff()", "--search", "lazy_wastar(h,w=3...
cb2c4c298f9011c4325635f9d16217a4b981363d602d9cebc7ae0a26ef211be0
Python
747
26
from constants import * from src.models.rey_regressor import reyregressor from src.models.rey_regressor_v2 import reyregressor_v2 from src.models.rey_classifier import rey_classifier_3, rey_classifier_4 from src.models.rey_multilabel_classifier import rey_multiclassifier def get_classifier(arch, num_classes: int = 2)...
e2a240742fd7bdac664d07edb03b09d9a3e65150a39e152e957bf13efd932d79
Python
747
34
from __future__ import print_function import os import sys import argparse name = 'gui' help = 'opens the topaz GUI in a web browser' def add_arguments(parser=None): if parser is None: parser = argparse.ArgumentParser('Opens the topaz GUI in a web browser.') return parser def main(args): # ope...
f0b71c3f890624015ee5971b5fe8c7602783d13b7948c6865ef7f3302f87e0a8
Python
747
26
import os, sys from distutils.sysconfig import get_python_inc from setuptools import setup, Extension, find_packages def getInclude(): dirName = get_python_inc() return [dirName, os.path.dirname(dirName)] def setup_package(): __version__ = '0.1' url = 'https://github.com/donglaiw/ExM-Toolbox' set...
11d6f4c6e41dd19860f5e1681accfb87d6684ed432d98b886d978b1cfc9e5d18
Python
748
25
# -*- coding: utf-8 -*- from .chain import LinearChainCRF, SemiMarkovCRF from .dist import StructuredDistribution from .tree import (BiLexicalizedConstituencyCRF, ConstituencyCRF, Dependency2oCRF, DependencyCRF, MatrixTree) from .vi import (ConstituencyLBP, ConstituencyMFVI, DependencyLBP, ...
42b1c3774e8fb5252a51f7669ebd3b0fb6b7e8b0d26709783a1409c8cedfb4b2
Python
748
31
# set QT_API environment variable import os import sys import argparse 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 as gui #import control.gui_2cameras_async as gui #import control...
84948cc41f191ed2645e49303e00020bfde408cd7d925930e51a43a6cc9ea614
Python
748
27
import sys import pytest argv = sys.argv argv = argv[argv.index("--") + 1 :] # run this script like this: # /Applications/Blender.app/Contents/MacOS/Blender -b -P tests/run.py -- . -v # /Applications/Blender.app/Contents/MacOS/Blender -b -P tests/run.py -- . -k test_color_lookup_supplied def main(): # bpy.ops....
ceecc17dc083d93d4be6613171027063b50827a312c3335b0f5a8d64f9d3274c
Python
748
26
from autograd import make_vjp from autograd.builtins import tuple from autograd.extend import defvjp, primitive, vspace @primitive def fixed_point(f, a, x0, distance, tol): _f = f(a) x, x_prev = _f(x0), x0 while distance(x, x_prev) > tol: x, x_prev = _f(x), x return x def fixed_point_vjp(ans...
f2fe5b794da1d5cd78e5948947b1ebbc9eb098072c82d56947db4036b6d3d5d1
Python
748
35
# .. an example to test decorator with precision keyword argument .. """ Test profiling using command line ``profile`` function (either ``TimeStamper`` or ``LineProfiler``) with precision specified as command line parameter. The precision argument specified in the decorator, therefore, is not used. """ import time @p...
189d7cd04c99aa2b47ed701ec31c6ff1ebac7aaf760cdf7530b875284486c3d1
Python
749
21
from __future__ import annotations from logging import INFO, WARNING, getLogger def test_emmet_task_doc_log_filter(caplog): logger = getLogger("emmet.core.tasks") with caplog.at_level(INFO, logger="emmet.core.tasks"): logger.info("Getting task doc in: /path/to/calculation") logger.info("Anot...
63efb0844ccc4007b9f6bf797c326fee644aa7784a092ebc5f4bff2814832439
Python
749
31
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import configs import common_setup REVS = ["issue436-base", "issue436-v2"] LIMITS = {"search_time": 1800} SUITE = suites.suite_satisficing_with_ipc11() default_configs_satisficing = configs.default_configs_satisficing(extended=True) CONFIGS...
db8365258e588c2bb93c6fcea3ffac08ba5e71e86c534915aa4f7767e82e0f78
Python
749
22
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ''' Script to submit to cluster supplemental ROI analyses ''' import os from warnings import filterwarnings from stormdb.cluster import ClusterBatch from stormdb.access import Query project = 'MINDLAB2020_MEG-AuditoryPatternRecognition' os.environ['MINDLABPROJ']=project o...
2367c4cdba17ddce7682f1d02787bcff05d9e6b26e4d93a62ec55c0b180f8a6f
Python
750
30
from collections.abc import Callable from typing import Protocol from .convolution import DummyLowerable class Translator(Protocol): def register(self, name: str) -> Callable: ... class LoweringPassPluginSymbol: def __init__(self, fn: Callable[[DummyLowerable], str]): self._fn = fn def load_lo...
724883282ebc8294adf92da19ac5c3c57cccffa1b57ba7f4df22b4b4c51e1acc
Python
750
27
# -*- coding: utf-8 -*- from .affine import Biaffine, Triaffine from .dropout import IndependentDropout, SharedDropout, TokenDropout from .gnn import GraphConvolutionalNetwork from .lstm import CharLSTM, VariationalLSTM from .mlp import MLP from .pretrained import ELMoEmbedding, TransformerEmbedding from .transformer ...
79f2f73bf1fc4330abdc5557ad4d0658df9bade6425236abbada5b85a1699ff5
Python
750
34
#! /usr/bin/env python # -*- coding: utf-8 -*- import downward.suites import common_setup import configs CONFIGS = configs.default_configs_satisficing(ipc=False, extended=False) # The following lines remove some configs that we don't currently # support. DISABLED = [ ] for key, value in list(CONFIGS.items()): ...
c3d86785515f9b9c49210d2282993aeea5a22a7f3339d0f2c72df0eb77d8f0a7
Python
750
38
# Copyright (c) OpenMMLab. All rights reserved. from mmcv.cnn import MODELS as MMCV_MODELS from mmcv.cnn.bricks.registry import ATTENTION as MMCV_ATTENTION from mmcv.utils import Registry MODELS = Registry('models', parent=MMCV_MODELS) BACKBONES = MODELS NECKS = MODELS HEADS = MODELS LOSSES = MODELS CLASSIFIERS = MOD...
8477d4b8377157aaccb2699c6b5be1b1d6c861878301d6b941c0a64ac5ee4368
Python
751
26
from .model_zoo import TimmRegressor def build_model(config): model_type = config.MODEL.TYPE # accelerate layernorm if config.FUSED_LAYERNORM: try: import apex as amp layernorm = amp.normalization.FusedLayerNorm except: layernorm = None prin...
0dd9030c9b366c1162e5c1861f40e59969b9b2a79066b9c371b050d651337174
Python
752
25
from __future__ import print_function, division from topaz.utils.picks import scale_coordinates name = 'scale_coordinates' help = 'scale particle coordinates for resized images' def add_arguments(parser): parser.add_argument('file') parser.add_argument('-s', '--scale', default=0.25, type=float, help='scaling...
8676fc2f3c16be2a892a752234a245abb6849b17025384dc851b9abd7af7d111
Python
753
29
#! /usr/bin/env python # -*- coding: utf-8 -*- import downward.suites import common_setup import configs CONFIGS = {} INCLUDE = ("lazy", "lama") EXCLUDE = ("lazy_greedy_add", "lazy_greedy_cea", "lazy_greedy_cg") for key, value in configs.default_configs_satisficing(ipc=False, extended=True).items(): if any(x in ...
c322126730d4ec0760c3571940eb221c29104b8ebba2a87ea0dd5f948bdb789d
Python
753
23
############ # https://github.com/lessw2020/mish/blob/master/mish.py # This code was taken from the repo above and was not created by me (Fabian)! Full credit goes to the original authors ############ import torch import torch.nn as nn import torch.nn.functional as F # Mish - "Mish: A Self Regularized No...
b854107b118b48c5c364e54b0d581a7c0dbeb63c29d06f16a685574e770e2730
Python
754
29
import pandas as pd from subprocess import Popen, PIPE, DEVNULL, STDOUT DEBUG = 1 def execute_command(cmd): """Wrapper for executing CLI commands. Args: cmd (str): Command to execute. """ if (DEBUG): print(cmd) process = Popen(cmd, shell=True, stdout=PIPE) else: pro...
3b155b1ce4aadee4e6d646ca96b5c54707d60c3bf463f17cad2553c2b2060a80
Python
755
31
from numpy.testing import assert_array_almost_equal from pytest import raises from wonambi import Dataset from .paths import ktlx_file def test_xltek_data(): d = Dataset(ktlx_file) data = d.read_data(begsam=1000, endsam=1001, chan=('FZ', )) assert_array_almost_equal(data.data[0][0, 0], -90.119315) def...
5e5c4a94e4e6220b584f5848b4f4a09cfa72aec11c450bd682f2584ce3ac9190
Python
755
27
import trimesh from trimesh.exchange import ply from trimesh.smoothing import filter_laplacian class CreateTriMesh: def __init__(self, reduction, smoothing): self.reduction = reduction self.smoothing = smoothing def __call__(self, vertx, faces, normals): mesh = trimesh.Trimesh(vertice...
cfc563f12afa524967116dfe7ca8d04179fd26284152bde2c6fa42eb20aa4c39
Python
755
28
import os import sys from contextlib import contextmanager from typing import Iterator @contextmanager def suppress_output() -> Iterator[None]: out_fd = sys.stdout.fileno() err_fd = sys.stderr.fileno() out_dup_fd = os.dup(out_fd) err_dup_fd = os.dup(err_fd) try: with ( open(os...
a22f5b4c1cce19ab91089e24a8fc617e82526b7cf811fd288a021ee007886545
Python
756
33
from ..neuralnodes import params import dataclasses @dataclasses.dataclass class Params(params.Params): filter_inh_dur: float = 8.0 filter_inh_gain: float = 1.0 filter_delay: float = 7.0 filter_exc_dur: float = 4.0 filter_exc_gain: float = 0.1 taum: float=1 tref: float=.001 taua: flo...
b5b2daa6c08ebe30d4e442f463857d06d4f0606c0311c48cb96de9b49ee4c55b
Python
756
30
# built-in from math import isclose # external import pytest # project import textdistance ALG = textdistance.JaroWinkler @pytest.mark.parametrize('left, right, expected', [ ('elephant', 'hippo', 0.44166666666666665), ('fly', 'ant', 0.0), ('frog', 'fog', 0.925), ('MARTHA', 'MARHTA', 0.961111111111...
d7ad80015dd7bc0cafe1b486d8b73b92a2e338c78667ec7c15345a8699fb839e
Python
756
26
import cv2 import numpy as np np.random.seed(0) class GaussianBlur(object): # Implements Gaussian blur as described in the SimCLR paper def __init__(self, kernel_size, min=0.1, max=2.0): self.min = min self.max = max # kernel size is set to be 10% of the image height/width sel...
226af26d295edbe25eb71585066c60e34767882fa8df66a0448d7442fb5ff9f5
Python
757
29
import numpy as np from .basic_euclidean import eucl_dist def discret_frechet(t0, t1): """ Usage ----- Compute the discret frechet distance between trajectories P and Q Parameters ---------- param t0 : px2 numpy_array, Trajectory t0 param t1 : qx2 numpy_array, Trajectory t1 Retur...
8f211e5a92df15e4d23bdf6c81bc6892842d995e1bfec96cd7a2aa9e1ecfac1b
Python
757
29
import yaml import os from pathlib import Path GLOBAL_PARAMS_PATH = Path("global_params.yaml") def load_params(name:str) -> dict: with open(name, "r") as f: params = yaml.safe_load(f) return params def load_experiment_params(name:str, project_name:str) -> dict: params_path = Path(os.getcwd()) / ...
d302f3bf372c672c533e1a5ee3026b038089352acc8709dea24860533e28e62c
Python
757
23
import torch from .defaults import get_default_config def update_config(config): if config.dataset.name in ['CIFAR10', 'CIFAR100']: dataset_dir = f'~/.torch/datasets/{config.dataset.name}' config.dataset.dataset_dir = dataset_dir config.dataset.image_size = 32 config.dataset.n_cha...
eb5cadb25a029a70dba00a83c26b1d7e800838e8a94868c4acd4d11c76682e09
Python
758
18
# class from: https://github.com/tanjimin/C.Origami/blob/main/src/corigami/data/data_feature.py # made for comparison with the c.origami to compare with HiC data import numpy as np import cooler class HiCDataset(): def __init__(self, hic_file_name, res): self.hic_dataset = cooler.Cooler(f"{hic_file_name}:...
baad8cc3482b2fd2ba7fcbb880b86103794aaa665e8d80cedb5684515f298e5a
Python
759
31
from __future__ import annotations import pytest def mock_execute(self, *args, **kwargs): pass @pytest.fixture(autouse=True) def patch_execute(monkeypatch): from ase.calculators.onetep import OnetepTemplate monkeypatch.setattr(OnetepTemplate, "execute", mock_execute) def mock_read_results(self, dire...
e5a43894e83c8e396e396527411faa111fc7f5292f90708a09dab2d6c1c7116d
Python
759
28
from median.buffer import Buffer from median.filter_median import FilterMedian fm7 = FilterMedian(L=7, dtype=int, initB=[5, 7, 8, 8, 9, 10, 11]) def update_desc(buffer: Buffer, value: float | int): print(f"Insert: {value:>3}") print(f"Before: | {' | '.join([f'{i:>2}' for i in buffer.getBuffer()])} |") bu...
4fc0ce129f0efd7ffb84207d6991996f5dd85a39c330a1d46f4537300e25a910
Python
760
28
"""Small Qt helpers shared by the viewer module and its mixins. Importing from a tiny module avoids a circular import: mixins can't import from viewer.py (they're imported BY viewer.py), but both need the ``_block_signals`` context manager. """ from __future__ import annotations def _block_signals(widget)...
9c0fdb19668370bdbb9c814689897e066ea525cefaad26c793468eb5b04ed8d9
Python
760
23
from __future__ import annotations from pathlib import Path import pytest from ase.io import read from numpy.testing import assert_equal from quacc.atoms.deformation import make_deformations_from_bulk FILE_DIR = Path(__file__).parent def test_make_deformations_from_bulk(): atoms = read(FILE_DIR / "ZnTe.cif.gz...
12b0cc5360d03995972e35de1d534b9fe9421bc6d6d1f8b3bf29ee968a782718
Python
761
22
import argparse import json import torch from MolNexTR import molnextr import warnings warnings.filterwarnings('ignore') if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--model_path', type=str, default=None, required=True) parser.add_argument('--image_path', type=str, ...
1a743b7304c197663a1f2ca078534b0bbe9c1169e41d271d9ba74286355c3971
Python
761
20
from collections import defaultdict from unittest import TestCase from codex.data.catalog import _CODEX_DATA_SCHEMA class CatalogTest(TestCase): def test_column_intersections(self): col_counts = defaultdict(int) for cols in _CODEX_DATA_SCHEMA.values(): for c in cols: co...
68504c99b9aa63000e917f6cd57c9a8c690013bd618cd0819b0eb65f63411585
Python
761
25
try: import binutil # required to import from dreamcoder modules except ModuleNotFoundError: import bin.binutil # alt import if called as module from dreamcoder.domains.text.main import main, LearnedFeatureExtractor, text_options from dreamcoder.dreamcoder import commandlineArguments from dreamcoder.utilitie...
7776da30d5dad14fa1b28ad8744a0a7ea5bd6bd83397b577b251af71fc63b4d9
Python
761
23
from .classifier_ops import * from config import classifier_list def get_classifier(args): bias_flag = args.classifier_bias num_features = args.num_features num_classes = args.num_classes if not args.classifier in classifier_list: raise NotImplementedError("Unsupported Classifier: {}"...
e154daf8dcca4759e059775e72e442561bd8af11314b90299a0914e8f0c2418a
Python
761
22
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 import glob, os import pandas as pd from DiscRisk_constants import dir_NHANES_dataset dirs_collections = glob.glob(dir_NHANES_dataset + r'/*Data') for dir_collection in dirs_collections: if not os.p...
4a5f670de4e5ca24ebcac84086272ab43da8eaa8625b97c4ed25ccdd115c1f23
Python
762
28
""" This script flattens NeSys .xyz files containing in-brain coordinates. """ import os def flatten_xyz(fname): result = ["RGB 0 0 0\n"] with open(fname,"r") as xyz: for line in xyz: if not (line.startswith("SCALE") or line.startswith("#") or line.startswith("RGB") or line.s...
ae2ed92c0fb9e9eae83c32df8d28d524c9e8f00691d7d6e9a9e9c27482db429f
Python
762
31
# set QT_API environment variable import os import sys import argparse 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_2cameras_sync as gui #import control.gui_2cameras_async as gui #...
cfd27eeda9a2acafc9a9a4b72296addff99bb35edfc445d027439b13f74d745b
Python
762
25
#! /usr/bin/env python from lab.parser import Parser parser = Parser() LEGACY_TO_NEW_EXIT_CODES = { 'critical-error': 'search-critical-error', 'input-error': 'search-input-error', 'unsupported-feature-requested': 'search-unsupported', 'unsolvable': 'search-unsolvable', 'incomplete-search-found-no...
7060d0853f94c7db8ff016e85b8240e5fcb94da4af4f31b2f02c754aeaf364b8
Python
763
25
""" Modified by Mayank Kabra Adapted from 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 Adapted from DeeperC...
7ebb6bbfea810d4eec865e8151a7152593957ddbca0d6809b42f23ff1c5e23f0
Python
763
31
# set QT_API environment variable import os import sys import argparse 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_toupcam_IMX571 as gui #import control.gui_2cameras_async as gui ...
02856f6aa338d001c9dd207cbaf0ade2996e13e26978ea00fb794a326b84cf93
Python
764
30
import pytest import pertpy as pt @pytest.fixture def test_data(rng): X = rng.normal(size=(100, 10)) Y = rng.normal(size=(100, 10)) C = rng.normal(size=(100, 10)) return X, Y, C def test_compare_class(test_data): X, Y, C = test_data pt_comparison = pt.tl.PerturbationComparison() result ...
215bd94549926135c811d8a863967be343a84df5b982783d173ef3d2b4c9146b
Python
764
16
"""Atlas-specific utilities (Allen CCF, Waxholm). This package owns code that's specific to the brain atlas data formats the registration pipeline depends on. Separated from regtools.utils to make the dependency direction explicit: atlas-specific tools live here, generic utilities stay in regtools.utils. Submo...
fc0e820564acaac950e0092376a0b86df84c476da1984b2bbe901539aaeb4979
Python
764
24
import warnings import functools __all__ = ["deprecated"] def deprecated(func): """This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emitted when the function is used.""" @functools.wraps(func) def new_func(*args, **kwargs): warnings...
343f38460358e26dd07e35394bec3b13ec72bb36edc3b4978dbfdaac29208ae7
Python
765
30
import torch from prosper_nn.models.feedforward.feedforward import FFNN # Set model and data parameter input_dim = 10 hidden_dim = 15 output_dim = 1 n_batches = 100 batchsize = 5 # Initialise Deep Feedforward Neural Network feedforward = FFNN(input_dim=input_dim, hidden_dim=hidden_dim, ...
5069914af1da1214167a6cd75248cf0f17d87aac4ed879a2931d9e67cc3ed5cc
Python
767
22
import numpy as np seven_circle = np.array([[0,0,1,1,1,0,0], [0,1,1,1,1,1,0], [1,1,1,1,1,1,1], [1,1,1,1,1,1,1], [1,1,1,1,1,1,1], [0,1,1,1,1,1,0], [0,0,1,1,1,0,0]]) five...
50a6477573123d0fd7ead0c5405fc5387c34bfbea0b43f6f8747332528505ad5
Python
767
21
from ETL.Transform.tf_SLICER_BIDS import sclicer_bids_integration # Main program if __name__ == "__main__": """ Main workflow to convert NIFTI files to BIDS format 1. Read the export_info.json file to get the subject information 2. Create the BIDS root and derivatives dir and Patients dir (if not exis...
8eea3a9a6438b6fae6f262bffa4b8251e821a790218c03ee25b3af1c67a0471b
Python
767
34
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import common_setup REVS = ["issue558-base", "issue558-v1"] LIMITS = {"search_time": 300} SUITE = suites.suite_satisficing_with_ipc11() CONFIGS = { "lazy_wa3_ff": [ "--heuristic", "h=ff()", "--search", "l...
dfb6cf249c00dbbf5f7e62051a2ad6ab43bb92d68eabdf888636e375fe39942a
Python
767
26
from pathlib import Path # Paths HOME_DIR = Path.home() PARSING_MODEL_DIR = HOME_DIR / ".local/share/bllipparser/GENIA+PubMed" # Observation constants CARDIOMEGALY = "Cardiomegaly" ENLARGED_CARDIOMEDIASTINUM = "Enlarged Cardiomediastinum" SUPPORT_DEVICES = "Support Devices" NO_FINDING = "No Finding" OBSERVATION = "ob...
319755fe7ffff98ffa8448ba17f0e56b648484b06baababae622cb78cc683996
Python
768
26
import math, random def selectPopSize(meanFoldChange, maxFoldChange): foldChange = 1+randBoundedExp(meanFoldChange-1, maxFoldChange-1) if random.random() <= 0.5: return foldChange else: return 1/foldChange def selectGridOfTimesLogScale(gridSize, maxTime): gridTimes = [] interval = ...
71be753258bb92f771ad57e36ebbe40efd9690fe347881d49830795aaceb2020
Python
768
36
# I/O utilities sub-package # TIFF reading, NIfTI creation, and unified data loading from .tiff_io import ( read_tif_section, read_tif_wrapper, get_stacked_data, read_multipage_tif, read_tif_page, is_multipage_tif, get_tif_page_count, load_tiff_volume, check_section_shap...
83519a598a3974b32fd927c499bb4a25309cbe0c6e90cf973ff2cd963dc0a3eb
Python
768
27
try: import binutil # required to import from dreamcoder modules except ModuleNotFoundError: import bin.binutil # alt import if called as module from dreamcoder.domains.logo.main import main, list_options, LogoFeatureCNN from dreamcoder.dreamcoder import commandlineArguments from dreamcoder.utilities import...
b0c9a2ff4a1e99206d09f40aa1fe5a2a2efec93063873cc065a37eaa346cf9a8
Python
769
24
import pytest from pupil_recording_interface.decorators import device, stream, process from pupil_recording_interface.device.video import VideoDeviceUVC from pupil_recording_interface.stream import VideoStream from pupil_recording_interface.process.display import VideoDisplay class TestDecorators: def test_devic...
9ec09fd9778e9a4f27d9243e7fdbaf76bfcbe34d9a8799a25a437e8c5577f42a
Python
770
36
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from downward import suites import common_setup DIR = os.path.dirname(os.path.abspath(__file__)) REPO = os.path.dirname(os.path.dirname(DIR)) REVS = ["issue414-base", "issue414"] LIMITS = {"search_time": 1800} SUITE = suites.suite_optimal_with_ipc11() # T...
f1359a9589f6fd0a96a1c9a0e138bd964ce26110539ccb9950b455c47e845540
Python
770
32
import json from typing import Any import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from pathlib import Path from ..prixfixe.predictor import Predictor from scipy import stats import pandas as pd class UnlockDNAPredictor(Predictor): def __init__(self, mode...
e57070eede5ac23b853a955449dab6876d9a5eb14f62c449726bcbfe45bda7c3
Python
771
28
from __future__ import print_function import argparse from topaz.utils.image import downsample_file name = 'downsample' help = 'downsample micrographs with truncated DFT' def add_arguments(parser=None): if parser is None: parser = argparse.ArgumentParser() parser.add_argument('file') parser.add...
63a85661972d70428de7bbdf9dcd3a26e1ad70423c5491f3301f600a44fd31cd
Python
772
21
"""PeerJCode URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') C...
93883bf2c4d2e1c9edec937568b14b316b6e01aed436d193b93d655ea906e2fe
Python
772
27
from setuptools import setup, find_packages setup( name="GZSper", version="0.1.0", packages=find_packages(), install_requires=[ "scanpy", "matplotlib", "seaborn", "pandas", "numpy", "scipy", ], author="Benjamin-JHou", author_email="zjy888zjy88...
b426c9075951d6f7258e70414162f0f64b29316ad46a7a00d59bb4d0c5c666ec
Python
772
35
import os import sys sys.path.append(os.path.dirname(__file__)) from app.arrayexp import ArrayExp as Device import numpy as np class SDK(): def __init__(self, chip_num=1): # self.ARRAYs = ARRAYs_4K(chip_num) pass def connect_device(self): self.device = Device.ArrayExp() ...
06f1e405bbcdbabfad36592452422477533f0f3f0e3fed7c1237bf9781e51ab7
Python
773
24
import os.path import subprocess DIR = os.path.dirname(os.path.abspath(__file__)) TRANSLATE_DIR = os.path.dirname(DIR) REPO = os.path.abspath(os.path.join(DIR, "..", "..", "..")) BENCHMARKS = os.path.join(REPO, "misc", "tests", "benchmarks") DOMAIN = os.path.join(BENCHMARKS, "gripper", "domain.pddl") PROBLEM = os.path...
3453bc3e6cd54118a2c98eeb5ed3913b5aaedf9a0e1b95f4c0db9d90bdaefb7c
Python
773
32
import os from flask import current_app from .envir import CIRRO_AUTH, CIRRO_DATABASE, CIRRO_MOUNT def get_database(): return current_app.config[CIRRO_DATABASE] def get_auth(): return current_app.config[CIRRO_AUTH] remapped_urls = dict() if os.environ.get(CIRRO_MOUNT) is not None: tokens = os.enviro...
d927c8866851c0d48873f21e6119e8d403202bb100970780e6e43990374e127a
Python
773
41
"""Integration tests for dependencies. Author: Seth Axen E-mail: seth.axen@gmail.com """ class TestRequiredDependencies: def test_rdkit(self): import rdkit def test_numpy(self): import numpy def test_scipy(self): import scipy def test_murmurhash(self): import mmh3 ...
4478083f0b4e6e1e4a84cadddd8653925f336d51bee8e92697b61b157e04860d
Python
774
27
from contextlib import ExitStack, contextmanager from typing import ContextManager, Generator, TypeVar _T = TypeVar("_T", covariant=True) class CommandContextMixIn: def __init__(self) -> None: super().__init__() self._in_main_context = False self._main_context = ExitStack() @contextm...
5f7f8a319db41e8dd5b6ac95697725a5e429173a24479344f2d6527ef295681f
Python
774
33
# SPDX-FileCopyrightText: 2015 Eric Larson # # SPDX-License-Identifier: Apache-2.0 from .adapter import CacheControlAdapter from .cache import DictCache def CacheControl( sess, cache=None, cache_etags=True, serializer=None, heuristic=None, controller_class=None, adapter_class=None, ca...
9322e86a77217bc9b287b110a8013c6ba84ac99728547128dc4755453ee73d41
Python
774
30
import torch import numpy as np import matplotlib import seaborn as sns matplotlib.use('Agg') import matplotlib.pyplot as plt def confusion_matrix(output, target): try: from sklearn.metrics import confusion_matrix as cm except ImportError: raise RuntimeError("Confusion Matrix requires scikit-l...
d60de55f3a0ce45d64831b60fbfb0b05c03386dc6061889bc825b03630163937
Python
774
30
from setuptools import setup, find_packages from hotpp import __version__ with open('README.md') as f: long_description = f.read() setup( name="miaonet", version=__version__, author="Wang Junjie", author_email="141120108@smail.nju.edu.cn", url="https://git.nju.edu.cn/bigd4/tpn", packages...
063982c2ebff9909ddb0eb051e4ddf207f85c10bed1971e13443414026355f89
Python
776
18
# -*- coding: utf-8 -*- from .const import (AttachJuxtaposeConstituencyParser, CRFConstituencyParser, TetraTaggingConstituencyParser, VIConstituencyParser) from .dep import (BiaffineDependencyParser, CRF2oDependencyParser, CRFDependencyParser, VIDependencyParser) from .sdp import ...
2343264f5cd36132c8a60c99bdb62bc83e135127923a309b86718485f736bd63
Python
776
27
from .modeling_finetune import ( vit_base_patch16_224, vit_giant_patch14_224, vit_huge_patch16_224, vit_large_patch16_224, vit_small_patch16_224, ) from .modeling_pretrain import ( pretrain_videomae_base_patch16_224, pretrain_videomae_giant_patch14_224, pretrain_videomae_huge_patch16_224...
3b143c0f04dc9e975fc80c1355cab4521fe8dc3f700b29eb708f53c2876f8e54
Python
776
26
# Testing the coherence import numpy as np import matplotlib.pyplot as plt from soundsig.coherence import coherence_jn from soundsig.signal import lowpass_filter # Make two gaussian signals sample_rate = 1000.0 tlen = 2.0 # 2 second signal # Make space for both signals s1 = np.random.normal(0, 1, int(tlen*sample_r...
7366c5d023c06b00b2ceaf0078ad36dedc9469ddc1ffc368f98ad0ac4d1bd5f1
Python
776
28
""" This simple demo will show you how to quickly get started with PySPI. """ import numpy as np from pyspi.calculator import Calculator import matplotlib.pyplot as plt dataset = np.random.randn( 3, 1000 ) # Generate multivariate data with 3 processes and 100 observations calc = Calculator( dataset=dataset, ...
2ac0aab56745678fe5f9a11829616806dea23eefbdbd6b0b254b33c494bf2c95
Python
777
39
from .blocks import \ UNetConvBlock, \ UNetAttentionBlock, \ UNetUpBlock from .functions import \ _CONV_DICT, \ _CONV_TRANS_DICT, \ _AVG_POOL_DICT, \ _MAX_POOL_DICT, \ _NORM_DICT, \ _REFLECTION_PAD_DICT, \ _CENTER_CROP_DICT, \ _ACTIVATION_DICT, \ activation_from_str fro...
6f2abc75b9a11d5105dc446c6618bf4e2676b743540bebf4f70c1bdc0aeeaed1
Python
777
34
# based on https://math.stackexchange.com/questions/1287634/implementing-ornstein-uhlenbeck-in-matlab # # Baseline implementation of standard OU process with constant mu and sigma. import numpy as np import pylab as pl def gen_ou_process(th, mu, sig, t, N=1, x0=0): # Allocate output vector, set initial condition ...
e003d89c0d468671c6a6a25ee9b88b6acfa1f6f210bd9d36d4704961dd3cc88a
Python
777
29
# This file is for neuron's h setting # set_h_before is used before network initialization # set_h_after is used after network initialization from neuron import h, load_mechanisms def set_h_before(config): cell_info = config["cell_info"] cells_id_sim = cell_info["cells_id_sim"] cells_name_dic = cell_inf...
189e08f60c43dedefd8d3758509049ec5006dddabe289a6a9b691098bccea3bf
Python
778
33
from pytest import raises from autograd.extend import defvjp from autograd.test_util import check_grads from autograd.tracer import primitive def test_check_vjp_1st_order_fail(): @primitive def foo(x): return x * 2.0 defvjp(foo, lambda ans, x: lambda g: g * 2.001) with raises(AssertionError...
2cdc7bbea06775874753c62e26de7769bffcaf33064d756bbcc6fb099264c46d
Python
778
32
# SPDX-FileCopyrightText: 2015 Eric Larson # # SPDX-License-Identifier: Apache-2.0 try: from urllib.parse import urljoin except ImportError: from urlparse import urljoin try: import cPickle as pickle except ImportError: import pickle # Handle the case where the requests module has been patched to no...
02258928d839ab7747ebcefadfc9d9b05c3cda50f7cb2f5bb5b938d3b338f877
Python
779
34
from pupil_recording_interface.encoder import VideoEncoderFFMPEG class TestVideoEncoderFFMPEG: def test_get_ffmpeg_cmd(self): """""" cmd = VideoEncoderFFMPEG._get_ffmpeg_cmd( "test.mp4", (1280, 720), 30.0, "libx264", "bgr24", ) assert cmd == [ "ffmpeg", ...
287e5db0575a7e0c256f28ec7979989ccacb4da9efa077a41b383c4f9548ad49
Python
779
25
"""Tests for optional file I/O in MLIP recipes.""" from __future__ import annotations from ase.build import bulk from ase.calculators.emt import EMT from quacc.recipes.mlip.core import relax_job def test_relax_job_without_files(tmp_path, monkeypatch): monkeypatch.chdir(tmp_path) monkeypatch.setattr( ...
5324934d4cf020c17c70d9f7f22fe410d2c0e69ae99ffc9c49684e146071873c
Python
779
33
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import configs, suites import common_setup SEARCH_REVS = ["issue439-base", "issue439-v1"] LIMITS = {"search_time": 300} SUITE = suites.suite_satisficing_with_ipc11() configs_satisficing_core = configs.configs_satisficing_core() CONFIGS = {} for name in [...
574f1047e2031f33e5bcc8a13cbe3d147aaa66742c02de17a2be589ce0e2e631
Python
779
24
import numpy as np import pytest import molecularnodes as mn from .emdb_pooch import fetch_emdb_map @pytest.fixture def emdb_density_map(isolated_density_file): # copy out of the pooch cache so the generated .vdb is written to a temp dir return isolated_density_file(fetch_emdb_map("EMD-48397")) @pytest.mark...
2b3d249d761eea6fca8dec63906d7ec851f20d01b4b9c13cbf8008c9e03acb31
Python
780
32
#! /usr/bin/env python # -*- coding: utf-8 -*- from downward import suites import configs import common_setup REVS = ["issue436-base", "issue436-v1"] LIMITS = {"search_time": 1800} SUITE = suites.suite_optimal_with_ipc11() configs_optimal_core = configs.configs_optimal_core() CONFIGS = {} for name in ['astar_merge...
08180e08ab6cc9442f09dd339f1056077eb09d160e70252ecf96e4358636ad75
Python
781
30
from datetime import datetime from PyQt5.QtCore import QDateTime from wonambi.widgets.modal_widgets import DateTimeDialog from .paths import GUI_PATH start_time = datetime(2018, 1, 1, 12, 0, 0) duration = 120 def test_widget_labels(qtbot): d = DateTimeDialog('lights out', start_time, duration) qtbot.addWid...
0bdb0861843757ed20020b8df1d07616146581b3ce72f7f351db0267e19a9107
Python
781
31
import mne import numpy as np import torch from omegaconf import OmegaConf from utils import load_model, generate def main(cfg): # load diffusion model model = load_model( cfg=cfg.path.inference_config, ckpt=cfg.path.model, is_safetensor=True) # load neuroral activity data da...
a7dc59241cba667c60e9b5ed55bf7e4ef45232c1446932e991aefa576c602b88
Python
781
30
import torch import torch.nn as nn import torch.nn.functional as F class simam_module(torch.nn.Module): def __init__(self, channels=None, e_lambda=1e-4): super(simam_module, self).__init__() self.activaton = nn.Sigmoid() self.e_lambda = e_lambda def __repr__(self): s = self.__...
880777f1248d24a4335a3ad035b935824506a1159accfa145c6dee0b1f22b850
Python
782
29
import re class NameRegistry: def __init__(self): self._registry = {} def _get_name_count(self, name): return self._registry.get(name, 0) def prepopulate(self, names): for name in names: match = re.match(r"(.+)_(\d+)$", name) suffix = 0 if matc...
ffd0d4a14cf598ac6abf7add05c510784970db0fdc2b1f312544a64e1b1db412
Python
782
45
#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import matplotlib.pyplot as plt # In[45]: IMAGE_SIZE = "232 x 300" SAVE_DIR = "./ablation_study_{}".format(IMAGE_SIZE) # In[43]: results = [1.228, 1.1613, 1.259, 1.148] labels = ['Vanilla', 'Only data aug', 'Only tta', 'Both tta + data aug'...
48325c967ce990ea68c89999db700eec96507ddb1da5698e3b4c687f38bde584
Python
783
28
from __future__ import annotations # built-in from itertools import permutations, product from typing import Sequence __all__ = ['words_combinations', 'find_ngrams'] def words_combinations(f, *texts) -> float: m = float('Inf') # split by words texts = [t.split() for t in texts] # permutations t...
5c3ea988a563a6100d9a38555a5ad56272f1552186ddc37e197e88306820bbba
Python
783
30
import uuid from memory_profiler import profile from queso.sensors.pennylane.sensor import brick_wall_probe from queso.sensors.pennylane.sensor import Interaction, Measurement, Sensor from queso.sensors.pennylane.sensor import Phase, U3 @profile def test_calculate_state(method): n_layers = 2 n = 10 prob...
61372efa05d7d8662b06cfb34a8d2d05d1ea4a15d106d960fee0ea5b3531aca7
Python
783
28
import numpy as np class Rosenbrock_func: def __init__(self, a=1, b=10): self.a = a self.b = b self.name = 'rosenbrock' self.formula = r'$\min\ f(x_1,x_2)={0}(x_1-1)^2+{1}(x_1^2-x_2)^2$'.format(self.a, self.b) def function(self, x): return self.a * (x[0] -...
b7b6af9bbcc439d304d1a30c905a2f89367fa59179248d77d59ebe2f8b2f000b
Python
783
29
from __future__ import print_function,division import sys import os import pandas as pd import topaz.utils.star as star from topaz.utils.conversions import star_to_coordinates name = 'star_to_coordinates' help = 'convert .star file coordinates to tab delimited coordinates table' def add_arguments(parser): pars...
b64305a5e1a199fe793a29e08dc61023c76451b5834866a950e50ee584a4520f
Python
784
25
from typing import List, Optional from cog import BaseRunner, File, Input, Path class Runner(BaseRunner): def run( self, text: str = Input(description="Required anchor field"), # PEP 604 optional lists opt_tags: list[str] | None = Input( description="Optional list of s...