sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
16786510e203cbe1bda200d3f877e304cc40686edbec3ca6068d1f16ea58d990
Python
1,625
42
# Copyright 2023 DeepMind Technologies Limited # # 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 agr...
cf22adf1f7786c67cb1354819f01100bff68ed7283ac310de7e1fd3ff5d98e22
Python
1,625
57
import argparse from pathlib import Path import torch def convert_weights(weight): """Weight Converter. Converts the weights from timm to mmcls Args: weight (dict): weight dict from timm Returns: converted weight dict for mmcls """ result = dict() result['meta'] = dict() te...
49c02a1efd17afeeaf1103feed6aee949005119416ab3c1a0b89e524f2f01a35
Python
1,626
50
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun class CenterCropPad(OpRun): def _run(self, input_data, shape, axes=None): axes = axes or self.axes input_rank = len(input...
2176efc0965f3bb68c32fc4a69d1a73d25162202b3031911925b54691a82eeb1
Python
1,627
40
import matplotlib.pyplot as plt import numpy as np from neuron import h def plot(x, y, xlabel, ylabel, title, filename): plt.plot(x, y) plt.xlabel(xlabel) plt.ylabel(ylabel) plt.title(title) plt.savefig(filename) plt.show() name_of_sim = 'youngPN' target_path = './Results/' + name_of_sim so...
bdf4f093b9f3be150fd36f82567fb4f8e9a7269c8e856c48bb88043acea0c281
Python
1,628
48
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Unit tests for (dunder) composition functionality attached to the base class.""" import numpy as np import pytest from sktime.classification.compose import MultiplexClassifier from sktime.classification.dummy import DummyClassifier from sktime...
89b71ffd6aff1f671efe1bddad56c8a020fa2943483e565ec94e87eda6271f3c
Python
1,630
64
#!/usr/bin/env python3 # CBDA validation and training set creation. # This script lists the contents of the Pickle file containing the validation # ordinals, etc. import sys import argparse import os import pickle def defineArgs(args=None): parser = argparse.ArgumentParser() msg = 'The file name of the Pi...
d09dbb115a0432c1bd3459668d8d5db6a388343acb25f7e8acb398d591d4a01b
Python
1,630
45
from setuptools import setup setup( name='colorednoise', version='2.2.0', description='Generate Gaussian (1/f)**beta noise (e.g. pink noise)', long_description="""Generate Gaussian distributed noise with a power law spectrum. Based on the algorithm in Timmer, J. and Koenig, M.: ...
297fad411b643c1805c850150fea1b7e16c922c169b024dc96f73bec75aa2964
Python
1,632
55
# SPDX-License-Identifier: LGPL-3.0-or-later """Isolated Python reference calculations for native LAMMPS tests.""" import json import subprocess import sys import tempfile from pathlib import ( Path, ) from typing import ( Any, ) def run_python_reference(script: str) -> Any: """Run a reference calculatio...
3410d4f6a201c0b165160f66a3afc90a029b5d4d11ad0afb71493a6ad7b7af2a
Python
1,632
56
############################################################################### # DoC Stage 4 but with a fake mouse ############################################################################### from camstim.change import DoCTask, DoCImageStimulus, DoCTrialGenerator from camstim.automation import PerfectDoCMouse, Stu...
64a2aa638b0036a68bed22556a0afa3fee9b97644ac40e3e661312f2983091fb
Python
1,632
42
r""" An interactive python script that lets you change the save location of datasets, models and logs to wherever you want them to be (also migrates existing data). """ from pathlib import Path import json import shutil from vp_suite.utils.utils import timed_input from vp_suite.defaults import SETTINGS if __name__ =...
7d0c89f2e43d839fd442641980390bdbc0215cb2221100d5c78529e50b22a2bc
Python
1,633
48
import os from keras.models import load_model import numpy as np import scipy as sp def load_all_models(config, model_string=''): models_dir = f'tl_models/transfer_learning/{config.tl_data}/set{config.set}/{config.train_type}/' all_models = [] model_ind = 0 model_path = models_dir + 'model...
f5cef99484b1b03dbad188b34382d55613a85b5f364b095a062032f70f83126e
Python
1,633
52
import torch import torch.nn as nn from .cnn1d import CNN1d class ARModel(nn.Module): def __init__(self, n_channels: int, n_feats: int, cnn_hparams: dict): super().__init__() self.convs = CNN1d(n_channels=n_channels, n_out=45, **cnn_hparams) self.feat_encoder = nn.Sequential( ...
1a19243d3f70208167f3008229f7542dac473114808cbb387a5e98a52695ed9a
Python
1,634
57
"""A simple script to extract the colors of the rects in an svg-file. """ import json import re import xml.dom.minidom import numpy as np PALETTE_SVG_IN = "palette.svg" PALETTE_JSON_OUT = "palette.json" RECT_DTYPE = [("x", float), ("y", float), ("fill", "U7")] NAME_DTYPE = [("x", float), ("y", float), ("name", "U15...
4e719fe43f044b27da8e83ac5a52cc4706c8520886639b0214d70b22123ef32d
Python
1,634
50
# Mocapy: A parallelized Dynamic Bayesian Network toolkit # # Copyright (C) 2004 Thomas Hamelryck # # This library 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...
6dfc6d59080f86995a78b14fa4ace9c29d0d57738ac0e6a64156fd63a0f936c9
Python
1,634
51
#!/usr/bin/env python from __future__ import print_function import sys,os import re import argparse import logging desc = 'Converting "contigs_report_contigs_filtered.mis_contigs.info" to a tsv table' epi = """DESCRIPTION: Only mis-assembly contigs will be included. Output table columns: *) contig ID *) misassembly t...
5739fddfc458d00b0ead8f5cb1400147806ca494c2f62d5b528998abce4565da
Python
1,635
62
from __future__ import division import os import sys import pandas as pd ################################# args = sys.argv[1:] if len(args) > 0: path = args[0] if path != 'test': if not path.endswith('/'): path += '/' path += 'output/' surface_stat = pd.DataFrame() ...
61eaf404ae66254e01d00e29aa796102ca00fcb959f20fbd92ec35f5511862ea
Python
1,636
64
# coding=utf-8 # 2021.03 modified (1) replace tensorflow with pytorch # 2021.03 deleted (1) glob, plt; # (2) get_init_path, count_accuracy, plot_solution # Huawei Technologies Co., Ltd. # # Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. # # Copyright (c) Ignavier Ng (https:...
9a5d6260fe474e7f095e63ee40f7dc8d74506ff285f0dcdee14ccad6fa2e8537
Python
1,636
49
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...
2a4e577de4f3721e4148604656ef5c1dc913cbce6bd4291ad9a8caa92cb9d8da
Python
1,638
57
############################################################################### # DoC Stage 1 ############################################################################### from camstim.change import DoCTask, DoCStimulus, DoCTrialGenerator from camstim import Window, Experiment from psychopy import visual import logg...
4371489b00a889f8ecb591c880adf4736f87ff1299f2881f3fd6124ba4fc7174
Python
1,638
41
import time from connect_laser_device import connect_laser_device class ConnectionCheckClient: # def __init__(self, host, port): def __init__(self): # 出力デバイスとの接続 # self.connected2serialClient = False # print('in __init__ of classifierClient, self.connected2serialClient = False') ...
a7c08e733927f0a128f6c73c22094a5418bc7194e27597139583d25b80eec85b
Python
1,639
48
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # 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 appl...
ef21888b51345af7ccbfc00716501cb57ffa65258d14fe36015e77b6d7ba7842
Python
1,640
52
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect from onnx.numpy_helper import create_random_int class BitwiseOr(Base): @...
04c681867ad9b88d874f0a10585b25959a8cde799f9e9cd5ee4f3c1543f4c946
Python
1,641
57
import dolfin as df from .model_base import ModelBase class Model(ModelBase): """ Problem with input zone in the middle. """ def __init__(self, mesh, L, t_PDE, j_in_const, stim_start, stim_end): ModelBase.__init__(self, mesh, L, t_PDE) self.stim_start = stim_start # time of input onset (s) ...
739f1d199ead5a4402cfe6e6e18842c2d8b60ca19d34b131994935c4ab2ca064
Python
1,641
59
"""Default models for ParaDime. The :mod:`paradime.models` module implements default models for several applications, such as a simple :class:`paradime.models.FullyConnectedEmbeddingModel`. """ import torch class Model(torch.nn.Module): """A placeholder model that lists all methods used by the losses defined ...
fbaa499eb27cafcf10976d7bb16f907f12a7f8a4fc0adcac5934f3eb515a2021
Python
1,641
54
"""Dummy anomaly detector which detects no anomalies.""" from sktime.detection.base import BaseDetector class ZeroAnomalies(BaseDetector): """Dummy anomaly detector which detects no anomalies ever. Naive method that can serve as benchmarking pipeline or API test. Detects no anomalies. Examples ...
212d6fff885b1458966246f3d4da8e7ae5eafd4fba4c207fe5f648996b9171a9
Python
1,642
45
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...
0d45dc70dffd940013b6e4434a443bd131b4f710d6e5a6314aef58d63a024dd4
Python
1,643
70
#!/usr/bin/env python3 """Generate slim ontology files Usage: slimgen [options] (chebi|gene|doid)... slimgen [options] all Options: -h --help show this -j --jobs=NJOBS number of jobs [default: 1] -d --debug """ from pyontutils import clifun as clif import nifstd_tools.chebi_slim ...
7d6e79150b483a94419976df082350e6b41c3599c2de789069d7ffe4df8e7c0f
Python
1,644
56
############################################################################### # DoC Stage 2 ############################################################################### from camstim.change import DoCTask, DoCStimulus, DoCTrialGenerator from camstim import Window, Experiment from psychopy import visual import logg...
b308f46c3743d6f827bac4766cafba03120382b90e649188ad253c60e9f60061
Python
1,644
49
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # 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 appl...
2fd92b97cf960bc6e5cd10570a6798b4aec3a149a18ae7ca73c3c0e0d6cf33e5
Python
1,645
47
"""Tests for detection output converters.""" import pandas as pd import pytest from sktime.detection._datatypes._convert import ( _convert_points_to_segments, _convert_segments_to_points, ) from sktime.detection._datatypes._examples import ( _get_example_points_2, _get_example_points_3, _get_examp...
ca73af32af322dd912d1ad0e9b695fa904f4fa669f693043b67413f8f4b4652b
Python
1,645
55
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class GlobalMaxPool(Base): @staticmethod def export() -> None: ...
08f496be2b9fd08f7375a6362fb6d3308c332cd8124c5de636bdf355d01435f3
Python
1,646
45
#%% import ast import json from glob import glob import nbformat as nbf # Collect a list of all notebooks in the content folder loc = "bilateral-connectome/docs/**/*.ipynb" notebooks = glob(loc, recursive=True) # HACK what is the globby way to do this? notebooks = [n for n in notebooks if "_build" not in n] data_ke...
e0b12cf2118fb2eb50be5764f88080890b9a50872c9532ccccac57920e824ce8
Python
1,646
52
from keras.models import load_model import os import numpy as np import scipy as sp def load_all_models(config): models_dir = f'models/transfer_learning/{config.tl_data}/set{config.set}/{config.pre_train_data}/{config.enzyme}/{config.train_type}/' all_models = [] model_ind = 0 model_pa...
8006bf31cc1234f45425a73670f91abc32c6d8d836df30bac41960315001b4da
Python
1,647
48
import numpy as np import sys from parameterSetup import ParameterSetup from evaluationCriteria import y2sensitivity, y2confusionMat, printConfusionMat, mathewsCorrelationCoefficient, multiClassMCC args = sys.argv params = ParameterSetup() predFileName = args[1] testFilePath = args[2] y_pred = [] with open(params.pre...
8a97009eea15ea1a13bf3f07994a08a797af4dc126c8c6ac992eef93751e09f2
Python
1,647
50
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunReduceNumpy class ReduceMin_1(OpRunReduceNumpy): def _run(self, data, axes=None, keepdims=None): axes = tuple(axes) if axes is no...
5706bb9e2b60989fb7f258e8e3471fce182449948ca9d22ceec15859a1b8edf4
Python
1,649
53
#!/usr/bin/env python # coding: utf-8 import argparse import os import pandas as pd from atom3d.util import file as fi def get_label(pdb, label_df): return label_df[label_df['pdb'] == pdb]['label'].iloc[0] def main(datapath, out_path): valid_pdbs = [fi.get_pdb_code(f) for f in fi.find_files(out_path, 'sdf...
b63152c9231cbd7b4af208cc3ac57dc26aa62cd64e368dcd2fb60691c5f2f190
Python
1,650
51
# Copyright (c) OpenMMLab. All rights reserved. import base64 import os import mmcv import torch from ts.torch_handler.base_handler import BaseHandler from mmcls.apis import inference_model, init_model class MMclsHandler(BaseHandler): def initialize(self, context): properties = context.system_propertie...
d6111e46d604acd667f307100a85edeecdab1a0967b9493663c50d56fdf1a35a
Python
1,653
57
############################################################################### # DoC Stage 4 but with a fake mouse ############################################################################### from camstim.change import DoCTask, DoCImageStimulus, DoCTrialGenerator from camstim.automation import PerfectDoCMouse, Stu...
9ac783e2659c63a9349365b1b4d7e8bce1e3b7287eac157076141694829c4c13
Python
1,657
44
# Copyright 2022 DeepMind Technologies Limited # # 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 agr...
cad484d17239cfe63c60fe271df52ae5f67926be7f079aadec62a4b65a8cffa6
Python
1,657
64
import torch import torch.nn as nn from PIL import Image from torch.utils.data import Dataset class FusionModel(nn.Module): def __init__(self, encoder): super(FusionModel, self).__init__() self.encoder = encoder self.encoder.fc = nn.Identity() self.fusion = nn.Sequential( ...
8f0d5efbf4f38d657eb3c656bbb8cd7fdfe5f95b20cb4798279cec9091603866
Python
1,659
60
import os import pytest from asreview import ASReviewData from asreview.models.feature_extraction import get_feature_model from asreview.models.feature_extraction import list_feature_extraction ADVANCED_DEPS = {"tensorflow": False} REQUIRES_EXTRA_DEPS = ["doc2vec", "embedding-idf", "sbert"] try: import tensorf...
d92a7a4c88dfff19f2ee82d7ac6ec1d62b39cee2d781442097ce977be8d5566c
Python
1,659
48
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...
48857e6c6787a8a208cc3276fc54a6e3e1ee5b659c16c0364dc0640968a4ccaa
Python
1,660
51
# Copyright 2023 DeepMind Technologies Limited # # 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 agr...
4b5879f31ce72fca58ad5dff8389dc8f38b2d1d9b8f63fadc0f965c441f47156
Python
1,660
45
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...
352fdc618ef398b086b92bb37ee50887c7ec625ca4e6b856c8f87c4e5f7aab44
Python
1,662
77
import torch import torch.nn as nn from lgn.g_lib import GTau class NoLayer(nn.Module): """ Layer that does nothing in the LGN architecture. This exists just to demonstrate the structure one would want if edge features were desired at the input/output. """ def __init__(self, *args, **kwargs...
339561b287880efb2bb0f595a1cec2e3be055a389afaef50657b49e128eda848
Python
1,664
46
# Copyright 2022 DeepMind Technologies Limited # # 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 agr...
3caca56ddbdbad82ef6d71d78fa23b6a137e6657e36fce20de0354acb89f0cd8
Python
1,664
56
import unittest import numpy as np from ddt import ddt, data import SPHARM.lib.transformation as tr @ddt class TestTransformation(unittest.TestCase): @data( ([2, 908, -234, 0.3], [654, -6, -64, 2], [-32, 243, 24, -22]), ) def test_spherical_transform(self, coords): x, y, z = coords ...
4ffe84fcf5188bd9ec687227bd6991d15019c01593fc6d8b212db1e6e8f50852
Python
1,664
34
''' Pure-python implementation of UCSC "liftover" genome coordinate conversion. Copyright 2013, Konstantin Tretyakov. http://kt.era.ee/ Licensed under MIT license. PyLiftover is a library for quick and easy conversion of genomic (point) coordinates between different assemblies. It uses the same logic and coordinate...
ed00b8aa8d996be0a4a680e428fff2ab3d18896f69ceda30fdcf64c20e2804b3
Python
1,664
48
# coding=utf-8 # Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. # # 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 # # ...
c0008fa7e89aece8613002f59c1601357530262e2f37bdaf6893f986f7dc428a
Python
1,666
54
""" Palantir - Modeling continuous cell state and cell fate choices in single cell data. Palantir is an algorithm to align cells along differentiation trajectories, identify differentiation endpoints, and estimate cell-fate probabilities in single-cell data. The package provides functions for preprocessing, visualizat...
243142504dc20eab2f2cbc36f4865fcdd84c77ffd33702476a60fc4a0819ee97
Python
1,667
73
#!/usr/bin/python """ test and plot hcno stuff """ import numpy as np import matplotlib.pyplot as plt #Parameters# gbar = 0.0005 # (mho/cm2) vhalf1 = -50 # (mV) # v 1/2 for forward vhalf2 = -84 # (mV) # v 1/2 for backward gm1 = 0.3 ## (mV) # sl...
ec1ed268f32e57307330768ab0d4819a59a06daf05f92374076856bc2fc1b8e6
Python
1,668
55
# Copyright (c) OpenMMLab. All rights reserved. try: import timm except ImportError: timm = None from ..builder import BACKBONES from .base_backbone import BaseBackbone @BACKBONES.register_module() class TIMMBackbone(BaseBackbone): """Wrapper to use backbones from timm library. More details can be found ...
38015794acfcac146a3d2e54ee8aeaeee526105fccd8ae93e6fc02c54e425e0a
Python
1,672
55
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect from onnx.numpy_helper import create_random_int class BitwiseXor(Base): ...
8d15f766a8a17672c63394f5f938a3cdcf2612b0bb68e8800a828a5dc8a5948e
Python
1,672
40
# Copyright 2023 The TensorFlow Authors. All Rights Reserved. # # 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 applica...
a60187acd032b219eac3d014c2570c8a2f8f498b7bad694964c1015b2060a8a7
Python
1,672
53
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import ml_dtypes import numpy as np import pytest from numpy.testing import assert_allclose from onnx.helper import make_node from onnx.reference import ReferenceEvaluator class TestReferenceEvaluatorD...
1816afdb35aec6af8a62a6478fbb5bcab0bfa6d929992c4545ca945e74378d48
Python
1,673
71
from __future__ import annotations from numpy import log as nlog from pandas import SparseDtype from .STDataset import STDataset def cpm_normalizer(dataset: STDataset) -> STDataset: """ Perform CPM on dataset. Parameters ========== dataset : STDataset STDataset to be normalized. Re...
c5a3faf2449ac7c00683ba08fce75ab747983c2e2f4ec0816ee39ab6d057c010
Python
1,673
55
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect from onnx.numpy_helper import create_random_int class BitwiseAnd(Base): ...
f57e2c0066e4ccd58069b7f6cdc3092152873bcaf078b9d98adc54f1cb7d5482
Python
1,673
50
# Copyright 2022 DeepMind Technologies Limited # # 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 agr...
41a1316ef420b5bc2fe0a3cef09e92d91655accc8472676ab798023ea9688f45
Python
1,674
56
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # 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 appl...
931210a84f556c4045af5cc750e41cdb28fd3a975f6c06ae7154a055cf286e9a
Python
1,674
57
# Copyright (c) OpenMMLab. All rights reserved. from abc import ABCMeta, abstractmethod import numpy as np import torch import torch.nn.functional as F from .builder import AUGMENT class BaseMixupLayer(object, metaclass=ABCMeta): """Base class for MixupLayer. Args: alpha (float): Parameters for Bet...
a2fb6706132459ad716d1fd8692be85e119d6751ae6cacd2e71a694ddbafb6ce
Python
1,674
48
import numpy as np import math from scipy.signal import butter, lfilter def butter_bandpass(lowcut, highcut, fs, order=1): nyq = 0.5 * fs low = lowcut / nyq high = highcut / nyq b, a = butter(order, [low, high], btype='band') return b, a def butter_bandpass_filter(data, lowcut, highcut, fs, order...
b0bc825f88cf541193bc9d46b7259fb5b92ed2b5b56636df544c877bd254e506
Python
1,674
49
from sciunit.models.backends import Backend import time class NestBackend(Backend): name = 'Nest' nest_instance = None def init_backend(self, **kwargs): print("Initialize {} backend".format(self.name)) # print("Nest version: {}".format(nest.version())) print("Use memory chache: {}...
d1f8e2108c89b7c6a3d867f64704d42d4dcbc38ddf343b4784a2e90bf02f6afc
Python
1,674
55
# pylint: disable=missing-docstring import json class Model(object): """ Model is a part of the manifest.json. It defines the properties of the model such as name, version as weill as the entry point into the service code through the handler property """ def __init__(self, model_name, serialize...
fc5dd6d76c9e4faeebcf8d548df6f9d5f13f70610d7ccf6c5d51094af1e48cc4
Python
1,674
63
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import pytest pytest.importorskip("sphinx") from docs.docsgen.source import onnx_sphinx @pytest.mark.parametrize( "op_name", [ "BatchNormalization", "GreaterOrEqual", ...
7273f8003921ec4a89a5e510d9b2b1d58139951849cc786da7d5c721247859ee
Python
1,677
70
#%% import matplotlib.pyplot as plt import numpy as np import pandas as pd from pkg.data import load_split_connectome from pkg.io import OUT_PATH from pkg.io import glue as default_glue from pkg.io import savefig from pkg.utils import get_hemisphere_indices from graspologic.match import graph_match FILENAME = "maggo...
72f69f16fee94b4967f2f0ff272192286395400fb0f314623a54a65b7fc892ce
Python
1,679
58
"""Clustering averaging metrics.""" __author__ = ["chrisholder", "TonyBagnall"] from collections.abc import Callable import numpy as np from sktime.clustering.metrics.averaging._dba import dba def mean_average(X: np.ndarray, **kwargs) -> np.ndarray: """Compute the mean average of time series. Parameters ...
298df4f0263a894e0ed79f5653697d1c69ab37b6c8188006dce5e5d180d90a2d
Python
1,680
50
# coding=utf-8 # Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. # # 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 # # ...
eb9d79d09825ca2f137c425c1ccd5a903eda0799538dabae430386e665bad7a3
Python
1,681
54
"""Module for the configuration of how and what is recorded in the log file.""" import sys import logging import warnings def log_exception(exc_type, exc_value, exc_tb): """Sets up the recording of exceptions on the log file @param exc_type: Type of exception @param exc_value: Value of the exception ...
f7e6d21f1fd71d096521a0904e31ea37ef12b819200ecbc6d3cfa608b9adf334
Python
1,681
50
"""Tests for DistFromAligner symmetry.""" import numpy as np import pytest from sktime.alignment.lucky import AlignerLuckyDtw from sktime.datasets import load_unit_test from sktime.dists_kernels.compose_from_align import DistFromAligner from sktime.tests.test_switch import run_test_for_class @pytest.mark.skipif( ...
ae23104d18cd9ea3bdb6eb7a218b654f75019060f0b1b210ffefe1025cb0cd9e
Python
1,684
53
#!/usr/bin/env python3 import csv from io import StringIO import rdflib import requests from pyontutils.utils import rowParse from pyontutils.core import makePrefixes, makeGraph from pyontutils.namespaces import makePrefixes, TEMP try: breakpoint except NameError: from IPython import embed as breakpoint def m...
47aa3b6bf2c228f717688ff097cb8ea22da32c994edc5b23b903717f7f6e7cd4
Python
1,685
47
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.ops._op import OpRunReduceNumpy class ReduceMax_1(OpRunReduceNumpy): def _run(self, data, axes=None, keepdims=None): axes = tuple(axes) if axes is no...
51c8fbf278f24b802d3cadf8789ce2feed41e99ae57bf9ee2d4301fa61473d3b
Python
1,685
39
import matplotlib matplotlib.rcParams["figure.dpi"] = 100 matplotlib.rcParams["image.cmap"] = "Spectral_r" matplotlib.rcParams["axes.spines.bottom"] = "on" matplotlib.rcParams["axes.spines.top"] = "off" matplotlib.rcParams["axes.spines.left"] = "on" matplotlib.rcParams["axes.spines.right"] = "off" matplotlib.rcParams[...
53b2bf62d7bd5d9ac3a4a6ac855b9b2e30c14a84aeac9231a00aed8528d60004
Python
1,685
48
import torch from base.proposer_base import Proposer from gln.test.model_inference import RetroGLN from typing import Dict, List class GLNProposer(Proposer): """GLN proposer, wrapping around gln.test.model_inference.RetroGLN""" def __init__(self, model_name: str, model_args,...
9b80300536eab7ffb2a022852b150237fa23975a631e394dd3f1599a1bff48a5
Python
1,686
53
# coding=utf-8 # Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. # # 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 # # ...
c7f673b962d62b39066e3a3c255064a046748022d6a85f91befa0ba316d1f365
Python
1,687
69
# SPDX-License-Identifier: LGPL-3.0-or-later """The atomic model provides the prediction of some property on each atom. All the atomic models are not supposed to be directly accessed by users, but it provides a convenient interface for the implementation of models. Taking the energy models for example, the developere...
09ddee4ef44fb12bc289455272d9a218d0a1ef699b3186fe48215738bd42607f
Python
1,692
60
# Copyright 2026 DeepMind Technologies Limited # # 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 agr...
b19072c27461d340677defa1aa19bfedbd1a5883bf10536c9fcdd4e9e2ccebf1
Python
1,692
44
from src.data.process_ephys_data import ephys_mat_to_pkl import os # About # This is a copy of process_m2_ephys_good.py but to process the data # from recordings in naive mice. The main changes are # (1) processing active condition is removed # (2) there is no need to remove active / passive mismatch # Created: 2021-0...
03c6b6d916e07a7c92ac4a0ef36e29bea2beca7bc90196bc4b3fd73619b8dbda
Python
1,693
50
# coding=utf-8 # Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. # # 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 # # ...
643ab8efe079d7003b95b78804bee7eb5cb93e28bca32d551a69b836b1ae7e32
Python
1,694
38
"""Quantile subset for the training loss. The backbone's native pinball loss is computed over a quantile grid that does not match the quantiles GIFT-Eval actually scores. PatchTST-FM predicts 99 quantiles, while only 9 of them (0.1 .. 0.9) enter the score, so 90 quantiles receive gradient without ever affecting the me...
55f305f6563ca11dab6e7c7aa7fbb2df68c7f71b7cd39934bd417237c363fc18
Python
1,695
66
# coding=utf-8 # Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. # # 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 # # ...
5eb679617969f97eef7e164f832252452c35f19e1c864ba7e8fea9cc86ad7a90
Python
1,695
46
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun _acceptable_str_dtypes = ("U", "O") def pad_empty_string( split_lists: list | np.ndarray, padding_requirement: list | int ) -> list: ...
b9b22e354d333cd9f6c368762e2548f7845c4a6b2b20c5eb8ba223ffc139ffc0
Python
1,695
40
# Copyright 2019-2021 The AmpliGraph Authors. All Rights Reserved. # # This file is Licensed under the Apache License, Version 2.0. # A copy of the Licence is available in LICENCE, or at: # # http://www.apache.org/licenses/LICENSE-2.0 # from setuptools import setup, find_packages from ampligraph import __version__ ...
603c8597738387e6da5dfa5066cdd0e5828ad4ec47fe84b69a8c991584da5b9a
Python
1,697
50
# coding=utf-8 # Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. # # 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 # # ...
787b1b8d725dbb8bdc7eb6ec99ffd154c8d26d16e27c8d2f184cab86667cf803
Python
1,697
64
from scipy.sparse import find, csr_matrix import pytest import pandas as pd import scanpy as sc import numpy as np from palantir.utils import compute_kernel @pytest.fixture def mock_data(): n_cells = 50 n_genes = 10 rng = np.random.default_rng() return pd.DataFrame( rng.random((n_cells, n_gen...
8fa6f2f450cb9d6a53c37db450871187411733357a1471a22ddf159ce03ede9e
Python
1,697
40
import torch import torch.nn as nn import torch.nn.functional as F class MLP(nn.Module): """A basic feed-forward neural network (MLP), with tunable hidden layer number and dimension. The number of layers is assumed to be equal to :math:`len(hidden\_dims) + 2`, including the input and output layers. ...
9530343f7f963c0dbea18cbe6f8e2e2c5dda353f3f0000ac86853bdda2f6b6b7
Python
1,698
58
"""To compile and install locally run "python setup.py build_ext --inplace". To install library to Python site-packages run "python -m pip install --use-feature=in-tree-build ." """ import platform import sys import sysconfig from pathlib import Path from setuptools import setup, Extension import numpy as np from Cyth...
72909bff17c4e3c8e952f9412ac2d92e3cd29793516e13ec1729335a6f196a58
Python
1,699
51
from netplotbrain import plot as npbplot import pytest import pandas as pd import numpy as np # Example node and edges dataframes included with package nodes = pd.read_csv('./examples/example_nodes.tsv', sep='\t', index_col=0) edges = pd.read_csv('./examples/example_edges.tsv', sep='\t', index_col=0) # Create an edge...
bec75c028f22a51d37bb09a2594ecb65fc795b15b26e7a9486a7bdb86337fa53
Python
1,699
51
"""Tests for bycycle.cyclepoints.extrema.""" import pytest import numpy as np from scipy.signal import argrelextrema from bycycle.tests.tsettings import FS, F_RANGE from bycycle.cyclepoints.extrema import * ################################################################################################### ########...
0e83315600d207e33190caa03e74f30fa3aca75b51155f2a91ba4f73de546cb0
Python
1,700
48
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...
0ddd57fe1e91437298d846e17a9ca1ff60c9cf3e5aa2117f6fcd34a98872ec71
Python
1,701
58
from __future__ import division import torch import torch.nn as nn class Sparsemax(nn.Module): def __init__(self, dim=None): super(Sparsemax, self).__init__() self.dim = -1 if dim is None else dim def forward(self, input): input = input.transpose(0, self.dim) original_size...
7b935840f88888ffea799583d800ed92910f22e1faa1d0bd1e6322f842c5149a
Python
1,701
50
import os import numpy as np import pandas as pd def writeToFile(authors, features, author2id, paper_ids, content): """ Writes all data into files The following files are written - dataset/features.csv - dataset/authors.txt - dataset/paper_ids.csv - dataset/author2id.csv - dataset/content.c...
d40b37f850c9286c3c7ac8e245ff1dcde37893c062046901e282fa2bf51614e2
Python
1,701
57
import os import numpy as np # Read in all files and split them according to the specification. with open("dataset/content.csv") as f: content = f.read().strip("\n").split("\n") with open("dataset/features.csv") as f: features = f.read().strip("\n").split("\n") with open("dataset/paper_ids.csv") as f: pa...
95a337d32067bb8b6b5ab67f34f44af6b3f1290c9401f11dfcedd127085f809c
Python
1,703
44
import qt, ctk, slicer from AbstractScriptedSubjectHierarchyPlugin import * class ElastixPresetSubjectHierarchyPlugin(AbstractScriptedSubjectHierarchyPlugin): # Necessary static member to be able to set python source to scripted subject hierarchy plugin filePath = __file__ def __init__(self, scriptedPlugin): ...
ab3d0315b28658c47679be8dd518b6c1360bec1e8ae95d7444507432bf9b6a3c
Python
1,703
47
""" Test the ccstim generator. Usage: python test_ccstim.py This script runs ccstim for each of it's potential inputs, and plots the resulting waveforms. """ import sys import numpy as np from cnmodel.util import ccstim import pyqtgraph as pg pulsetypes = ['square', 'hyp', 'timedSpikes', 'exp'] def test_cc_stim(...
c633d09bf9418d146f1140a9bf9fa0caee51c1262a781dca9b672eb6272af874
Python
1,703
49
# coding=utf-8 # Copyright (C) 2022. Huawei Technologies Co., Ltd. All rights reserved. # # 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 # # ...
95b72e7eba29335f9022eaf0a59ace358d32eb64e3d70b3ada44feb97b544d8b
Python
1,705
46
#------------------------------------------------------------------------------- # elftools example: elf_notes.py # # An example of obtaining note sections from an ELF file and examining # the notes it contains. # # Eli Bendersky (eliben@gmail.com) # This code is in the public domain #----------------------------------...
ba3ccaca4b8eafb294438378269c8aea985d7a9f6bdd7ecd26f7c6ccbf56fef8
Python
1,705
48
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # 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 applica...
d4352faa34671ac38bdda58c11d656096c5e0b1fd7ea313fcbbeb1258a007bb2
Python
1,705
59
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from mmcv.utils import digit_version from mmcls.models.utils import channel_shuffle, is_tracing, make_divisible def test_make_divisible(): # test min_value is None result = make_divisible(34, 8, None) assert result == 32 # te...
d72958f02ba44230b3c190a58bebc789fdc21fa3ca58f42a5c9faf91ceb04c4d
Python
1,705
50
# coding=utf-8 # Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. # # 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 # # ...
0475b98445f7cd6980e7fd6135c19e8ca3b1717269ac7c64007809c5000910e7
Python
1,706
59
# Copyright 2019 DeepMind Technologies Ltd. All rights reserved. # # 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 appl...