sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
fd4ea6f7873b701b0857dc036a85966ceb0ae86252fd9aab895e6adfa81de271
Python
1,355
57
# Copyright contributors to the TSFM project # from typing import TYPE_CHECKING # rely on isort to merge the imports from transformers.utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) _import_structure = { "configuration_patchtst_fm": [ "PATCHTSTFM_PRETRAINED...
10b3a7d67a7599b45898307f622af3ba128937a28420128e6f7689ed3192e7e2
Python
1,356
62
import os from tqdm import tqdm import shutil import argparse parser = argparse.ArgumentParser(description="...") parser.add_argument( "--source", help="...", type=str, required=True ) parser.add_argument( "--target", help="...", type=str, required=True ) args = parser.parse_args() SOURCE_DIR = ...
ec0719373dcb252181f22626987fb6ed58eaaeec69e1de8ca8803b262e08a82e
Python
1,358
63
import pandas as pd import seaborn as sns from matplotlib import pyplot as plt import sys import numpy as np colors = sns.color_palette("Set1", 12) c = 0.5 colors = [(c, c, c), (c, c, c)] dfo = pd.read_csv(sys.argv[1], sep="\t", index_col=0) df = dfo.melt(value_name="number_of_variants") df.number_of_variants +=...
df37487c978f635410a5b0c45c3d93ab200af67abe839a60efa9963372292624
Python
1,359
28
"""Convert raw graph samples of the FG-dataset to Pytorch Geometric format.""" import argparse import sys sys.path.insert(0, "../src") from gnn_eads.functions import get_id from gnn_eads.paths import create_paths from gnn_eads.constants import FG_RAW_GROUPS from gnn_eads.create_graph_datasets import create_graph_data...
a24b5befdeb6ecc5f5a258de44ec32dbb6e2be2d9bab5a0e12c66fb9f4bd27c0
Python
1,360
30
# Copyright 2019-2020 The ASReview 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 appl...
834973db93158816403bf824a5c44d42e63f85716a9f249e62208c60ba15dd4c
Python
1,361
41
# 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...
0616e9bca80f4568eb042f05056760fdcc1213d01c4d3f79e609dc216bdf48df
Python
1,362
44
import unittest import numpy as np import sys sys.path.append("..") import pyfilterbank.sosfiltering as sf class SosFilterTestCase(unittest.TestCase): def setUp(self): self.signal = np.random.randn(1000) self.frames = len(self.signal) b = [0.5, 0.0, 0.5] a = [1.0, -0.8, 0.7] ...
90fd34cb69189ddbb6106dc816f989a74997a0648e244258de35d8afd2798ddc
Python
1,362
47
""" ini_set('display_errors', true); error_reporting(E_ALL); // Put these befor the line to display complete errors! """ import requests import json import os base_url = 'http://localhost:8080/api/1/' prime_term_url = base_url + 'ilx/add' add_term_url = base_url + 'term/add' api_key = os.environ.get('LOCAL_SCICRUNCH_...
149a436ddcbd861006309121e79243b58b4c07c2e076eeffe563491f57ac55d3
Python
1,364
30
# 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...
23e67d05304d8c279e3443627f0499405408f878e8b9193b74e1369c5f4569df
Python
1,364
43
# 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 # import numpy as np from ampligraph.evaluation.metrics import rank_score, mrr_sc...
702e06b05ba5b20875e31f17738e7792214c08c4f886598684feff090564e82f
Python
1,364
42
# 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...
332cbbd3123fe8c098098a7067c2cb2587465669ceb8ef59464fcf7e571b0b41
Python
1,365
43
"""precipitation_dataset.py""" """ Author: Yimin Yang Last revision date: Jan 18, 2022 Function: dataloader for precipatation maps dataset Ref: https://github.com/HansBambel/SmaAt-UNet """ from torch.utils.data import Dataset import h5py import numpy as np class precipitation_maps_oversampled_h5(Dataset): def ...
8700476077a4415885a5f52354e5de8557b2c3277552ded344c3a736c63250bc
Python
1,366
45
import logging from collections.abc import Mapping from typing import Any from flair.trainers.plugins.base import TrainerPlugin log = logging.getLogger("flair") default_metrics_to_collect = { ("train", "loss"): "train_loss_history", ("dev", "score"): "dev_score_history", ("dev", "loss"): "dev_loss_histo...
d92c95b28e3a9aee6ee6a3fafdde45eeb67167e17aba1c4ee8313d13b0ebbda4
Python
1,366
40
""" Read and set paths """ from pathlib import Path from typing import Union import toml def set_data_paths(): """Set the full path for a figure, with a specific extension This is a tool to keep the figure files organized and consistently named. Parameters ---------- fignum : int Figure ...
37ed1349f652a15ad94819e579defca3aa830385f505355ad7e53b92e99430fa
Python
1,367
47
# 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 Mean(Base): @staticmethod def export() -> None: data_0...
3da7fd7d7d8e1b52b1ef4e3fed30d4e924fd28afa91d6814a790299ca1ecca85
Python
1,367
29
import pytest from vp_suite.datasets import DATASET_CLASSES from vp_suite.utils.dataset_wrapper import VPDatasetWrapper from vp_suite.utils.utils import PytestExpectedException from helpers.test_helpers import skip_on @skip_on(PytestExpectedException) @pytest.mark.parametrize('dataset_str', DATASET_CLASSES.keys(), i...
8b51de0f4dfe0ea2dc85b9da05b5fbc123d58ba7cfd242f47f7f32ca45a682a2
Python
1,367
41
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Common private utilities for checkers and converters.""" __author__ = ["fkiraly"] def _metadata_requested(return_metadata): """Return whether some metadata has been requested.""" return not isinstance(return_metadata, bool) or return_...
dd4a83cc6a9ef3ff3d6100f02f719b440e866affbe98a0c5162db450731b5c61
Python
1,367
37
# 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...
305259dd4e2e584b8b54f17fabbac91443510d35b23765089b4e4136ae217dde
Python
1,368
37
# 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...
b80e95d32cee4e1658cae2c526bd765fd2506abad3e97bb26b6359caea092333
Python
1,368
39
# Copyright 2019-2026 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 ampligraph.datasets.sqlite_adapter import SQLiteAdapter from ampligraph.da...
6ab822f6737723432f5f912f218cf8bdcdfa64c0f9900825147ccd331ff937ae
Python
1,370
46
import argparse from pathlib import Path import torch from mmcls.apis import init_model def convert_repvggblock_param(config_path, checkpoint_path, save_path): model = init_model(config_path, checkpoint=checkpoint_path) print('Converting...') model.backbone.switch_to_deploy() torch.save(model.state...
97d530cd745cb45504f1654886cca9884cc1f5458aede34746055030bbe9e0c7
Python
1,370
41
# SPDX-License-Identifier: LGPL-3.0-or-later from deepmd.dpmodel.descriptor.unimol import DescrptUniMol as DescrptUniMolDP from deepmd.pt_expt.common import ( torch_module, ) from deepmd.pt_expt.descriptor.base_descriptor import ( BaseDescriptor, ) @BaseDescriptor.register("unimol") @torch_module class Descr...
b897df86af6dd8e3f886ab82034de252524de1c72604dff0b29d266e723acb43
Python
1,371
62
#!/usr/bin/env python3 # tifffile/tiffcomment.py """Print or replace ImageDescription in first page of TIFF file. Usage: tiffcomment [--set comment] file """ import os import sys try: from .tifffile import tiffcomment except ImportError: try: from tifffile.tifffile import tiffcomment except Imp...
e8c95739a7705dc0ac71e384e259b2e1f2c9c8068108256f245e816653188d4f
Python
1,371
67
# Copyright 2018-2025 # Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH # 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/LICE...
1a39a766d398521ea1958a645551360688600eda2743d45ebb0df1207cb42cfa
Python
1,372
58
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx import helper from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class Upsample(Base): @staticmethod def expo...
3c0cca7d1e3b48cfb82273a787e9feaf41315ee598719dc523e7dc82a6af2c64
Python
1,372
39
""" Showcase the features of the render engine. """ from sns_toolbox.neurons import SpikingNeuron from sns_toolbox.connections import NonSpikingSynapse, NonSpikingPatternConnection from sns_toolbox.networks import Network from sns_toolbox.renderer import render import numpy as np neuron_type = SpikingNeuron() synaps...
a2e0598b14bdcd51eafcb1d75197f0141147f9b37b00ead3666ef0a5eb7af3af
Python
1,373
32
import serial def connect_laser_device(): """ RobotDyn UNOはブートのタイミングによってwebserial1420だったりwebserial1410だったりする この他のIDでマウントされることは確認していないが、あり得る そこで、IDの候補をあらかじめリストとして保持し、 リスト中のID全てでSerialのインスタンスを作るよう試行を行う """ id_candidate_list = ['/dev/tty.usbserial-1410', '/dev/tty.usbs...
922a8757eeec87f710796be92902656a4130468734484316baef0e5b89f9678b
Python
1,374
50
""" Overlapping densities ('ridge plot') ==================================== """ import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt sns.set_theme(style="white", rc={"axes.facecolor": (0, 0, 0, 0)}) # Create the data rs = np.random.RandomState(1979) x = rs.randn(500) g = np....
cd48c180329b503aad67e09860d006c3bfd36b896dd4477729c26fffce322b6c
Python
1,379
65
#!/usr/bin/env python __doc__ = """ Inference functions Nicholas Turner <nturner.cs@princeton.edu>, 2017-8 """ import sys,time import torch import numpy as np import utils def forward(net, scanner, scan_spec, activation=None): with torch.no_grad(): start = time.time() inputs = scann...
f8302fe802514532a3f830c84a1dcb615f6eaed0bdcd35932b4f740903c2511a
Python
1,381
47
"""Set classifier function.""" __author__ = ["TonyBagnall"] from sktime.clustering.k_means import TimeSeriesKMeans from sktime.clustering.k_medoids import TimeSeriesKMedoids def set_clusterer(cls, resample_id=None): """Construct a clusterer. Basic way of creating the clusterer to build using the default s...
8137cddf464894e49fbef584527a74df140f590b3a0e4b1497820eec0b804fcc
Python
1,383
58
"""Base class for encoders and generic multi encoders.""" import torch.nn as nn from onmt.utils.misc import aeq class EncoderBase(nn.Module): """ Base encoder class. Specifies the interface used by different encoder types and required by :class:`onmt.Models.NMTModel`. .. mermaid:: graph BT ...
c53193872cd57156cf4c7ba9cd4ee027e3c5856ddc9f978aafa986e4b99b47c3
Python
1,383
33
# Copyright 2015 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...
c7b47fbb3b4766fa6b87e5a4f993bbbc1982aa89a8743d6cf25fe008cbf4347e
Python
1,384
35
#------------------------------------------------------------------------------- # elftools tests # # Seva Alekseyev (sevaa@sprynet.com) # This code is in the public domain #------------------------------------------------------------------------------- import os import unittest from elftools.elf.elffile import ELFFil...
ccf191c573d904f5e74a222c887752112925a138588eecec0b5f208f526a4778
Python
1,384
49
import os, tempfile from multiprocessing import Pool import cnmodel.an_model.cache as cache import cnmodel.util.sound as sound from cnmodel import an_model def new_cache(): # Do all cache testing on a temporary cache directory cdir = tempfile.mkdtemp() cache._cache_path = cdir def run_sim(*args): cf ...
48abba852da248531ed79a876deef01e4825ff684d7b3a80a062797bb18359c7
Python
1,385
65
#!/usr/bin/env python __doc__ = """ Inference functions Nicholas Turner <nturner.cs@princeton.edu>, 2017-8 """ import sys,time import torch import numpy as np import utils def forward(net, scanner, scan_spec, activation=None, verbose=True): with torch.no_grad(): start = time.time() ...
588c5e2874606042ee500d2ede18b6723db9092f2b02e28e2847e5f509ea2701
Python
1,385
29
import face_recognition # Load the jpg files into numpy arrays biden_image = face_recognition.load_image_file("biden.jpg") obama_image = face_recognition.load_image_file("obama.jpg") unknown_image = face_recognition.load_image_file("obama2.jpg") # Get the face encodings for each face in each image file # Since there ...
28c2342db27dfc690b1b9608098831140c1836ca67d264920ce22cb723ccbe8e
Python
1,386
42
import unittest import biom import pandas as pd import numpy as np from skbio.util import get_data_path from q2_differential._model import DESeq2, SingleDESeq2 from birdman import ModelIterator from xarray.ufuncs import log2 as xlog import pandas.testing as pdt class TestDEseq2(unittest.TestCase): def setUp(self)...
58df15668c87d1d83276f588b8b98354a6586ffc3db7f03fafbfabc6a842346a
Python
1,387
43
from __future__ import annotations import numpy as np import pytest from jetnet import evaluation from pytest import approx test_zeros = np.zeros((50_000, 2)) test_ones = np.ones((50_000, 2)) test_twos = np.ones((50_000, 2)) * 2 def test_fpd(): val, err = evaluation.fpd(test_zeros, test_zeros) assert val ==...
0ae5d991e450f06df6a558a5b90706fc62d7da638c24816aa91d9a52bbee2db1
Python
1,388
40
# 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 # # ...
714662007c183b3f8387179292eac44a6f5e6064f6a8754ebffdff3dbf84e6a0
Python
1,388
35
import unittest from ensembl import mygene_get_synonyms class MyGeneApiTest(unittest.TestCase): def test_list_response(self): gene_synonyms = mygene_get_synonyms(["ensembl:ENSMUSG00000033774"]) synonyms = gene_synonyms["ENSMUSG00000033774"] self.assertTrue("Gpr7" in synonyms) sel...
787bba0aba44694ad90199c8ef90557ee3bb3e573744cd72f3373e251ff9127b
Python
1,388
42
import numpy as np from sklearn.model_selection import RandomizedSearchCV from sklearn.svm import SVC from sklearn.metrics import balanced_accuracy_score class SVMClassifier: def __init__(self, X_train, X_valid, y_train, y_valid): y_train, y_valid = np.asarray(y_train), np.asarray(y_valid) asse...
3fc1813e2c764ae758da8c39d1b6ba613fc7858e2e6ddc175cbfa6ae29c58e85
Python
1,390
42
# 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...
47e7edacf014760dca0b99207b650b5fa73f9559676276312532c841a8351bcb
Python
1,390
44
from __future__ import print_function from neuron import h import neuron as nrn from ..util import nstomho from .cell import Cell __all__ = ['HH'] class HH(Cell): """ Standard Hodgkin-Huxley mechanisms from NEURON """ def __init__(self, debug=False, message=None): super(HH, self).__init__() ...
58e45ebc3853258e1f746b095af021b4d5c3bb9b6a0f41b80d0ce10cfb9d652e
Python
1,391
47
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import itertools import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class Transpose(Base): @staticmethod def export_de...
4fc4d3db93b3baac367df017c9d9a1748230ef0d3c675f975efd54d8e53b21c3
Python
1,392
43
"""Tests for specific bugfixes to conversion logic.""" __author__ = ["fkiraly", "ericjb"] import pytest from sktime.datasets import load_airline from sktime.datatypes._series._convert import convert_MvS_to_UvS_as_Series from sktime.tests.test_switch import run_test_module_changed @pytest.mark.skipif( not run_t...
3d5f6c9d026c58121978f095245dc389ec6259b1224e6a27941d8dd01758964b
Python
1,393
61
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jun 1 16:54:07 2022 @author: sudhanshu Runs Prediction on input directory from command line Usage: python predict_directory.py [pdb_directory: default '../sample_dir' ][model_directory: default './models_DL/cb_model.pth.tar'] Returns: PDB_NAME: predic...
4ab0868de62130dd2f765eb4b5335ae8535724c869353a737644a799d20b84ad
Python
1,393
40
# 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...
62350fb6d0c27c022837854007362dc2f4786d0f4b6271ee9b17a7b5c6c13ce6
Python
1,394
44
import joblib import wrangle_data as wd import model_predict_functions as mpf # inputs features_list = ["FA","MD","ad","rd","uFA","C_c","MKi","MKad"] data_filename = 'data.csv' outputsFileName = 'paper_' modelFileName = 'rf.sav' # load RF model optimized with rf_tunning.py rf = joblib.load(modelFileName) # Load dat...
97fa0ca2626c84d2ac0cf59a846d11bd75563bdf612ddb605b59fa83db337dc1
Python
1,395
47
"""Tests for bycycle.features.features.""" import pytest import numpy as np from bycycle.features import * ################################################################################################### ################################################################################################### @pytest....
e478d332472f528f513acbc7dd16eaf77034ee35035b0fadb226714c2742991e
Python
1,396
39
import torch.nn as nn r""" The model is composed of the embeddingbag layer and the linear layer. nn.EmbeddingBag computes the mean of 'bags' of embeddings. The text entries here have different lengths. nn.EmbeddingBag requires no padding because the lengths of sentences are saved in offsets. Therefore, this method is...
0efe8d59220bc88b24d2124cf524976c0a53db45892cf0875004cecd1fa1b807
Python
1,399
35
# 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...
fd10d5ee769aeff6d438fd042f8fe263d56d333362f013627b0a2518ccd8e24f
Python
1,400
49
import io from PIL import Image def _plot_gif(fig, ax, gif_duration, savename=None, gif_loop=0): """ Create a GIF from plot Requires the function 'plot' to contain the paramater 'frames' (two or more frames needed) Takes return values from the function 'plot' Parameters --------------------...
daa3b6057363c4844a22b8ea30fa314db45d2afbf4ed4f50204bd67c0df7dd1f
Python
1,403
43
# 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...
9b568ad45aef9d6a38e49a00dafd6531a39dc139cd50da5792015cac0e0cd4e5
Python
1,404
39
# 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...
72b358be6c8fc63b3a1bd5228f5a0357c64d00b3a89289a380b40cfc757e2aab
Python
1,406
33
# 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...
b29dd27956996a89132498a4033258165f733bf0ac56ef9d6dcd5aa144130c16
Python
1,410
39
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import ml_dtypes import numpy as np from onnx import TensorProto from onnx.reference.op_run import OpRun _STASH_TYPE_TO_DTYPE: dict[int, np.dtype] = { int(TensorProto.FLOAT): np.dtype(np.float32), ...
7ddd864a10a6cb941dbb3d641cf90c2f234d48982302c44b570a75a629c1c476
Python
1,411
42
# 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...
d218c34c5142e04ea36657bb4488a8d40a3e48c5ff971391b5f802f773058dd9
Python
1,416
44
"""ItalyPowerDemand dataset.""" from sktime.datasets._single_problem_loaders import load_italy_power_demand from sktime.datasets.classification._base import _ClassificationDatasetFromLoader class ItalyPowerDemand(_ClassificationDatasetFromLoader): """ItalyPowerDemand time series classification problem. Exam...
42fad1434cee36ada4e68bde88d0459983287bf23a033888d4c78de771149c84
Python
1,417
47
# ------------------------------------------------------------------------------- # elftools: ehabi/structs.py # # Encapsulation of Construct structs for parsing an EHABI, adjusted for # correct endianness and word-size. # # LeadroyaL (leadroyal@qq.com) # This code is in the public domain # ----------------------------...
656842f6dbf3a1ea3c7f1ec2696d2b71155a3d200c0fd682d40c4bb99be2ea79
Python
1,417
54
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.reference.op_run import OpRun def cast_to( x: np.ndarray, to: onnx.TensorProto.DataType, saturate: bool, round_mode: str = "up" ): if to == onnx.Tensor...
49fa676b22be956e926bc1371725426a39bacc44d0b380ece87375d0d42de20a
Python
1,419
43
# 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 # # ...
afb6898492836470429de9fa5d4a2062e172394e1369d45422fa4c87a50b7c59
Python
1,419
43
# Unit tests; run with pytest -v tests.py from domain_and_clustering_analysis import SpatialTest def test_domain_count(): S = SpatialTest( variants=[1, 3, 9, 11, 14, 17, 29, 30, 31, 33, 38, 40, 42, 45, 50, 55], length=75, domains={ "reg1": 10, "reg2": 14, ...
2659fcf126e3b2666ae5f231cc5f8f3f277308469996f5b4fde8aca74399f38e
Python
1,420
44
# 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...
4806e54d2974f550352756050735805301901a7da3343bee8139032d3aef3613
Python
1,421
68
import random from sys import argv dna = set(["A", "C", "G", "T"]) def deletion(seq): chars = list(seq) idx = random.choice(range(len(chars))) del chars[idx] return "".join(chars) def insertion(seq): chars = list(seq) idx = random.choice(range(len(chars))) new_base = random.choice(list(dna)) chars.insert(idx,...
62cae530b5f1baddd17442b149c9568669d8e92c26d28937973a0c59278539d1
Python
1,422
49
import os from pathlib import Path from typing import Collection, Union, List import pandas as pd def str_to_column_id(column, df): if isinstance(column, str): if column not in df.columns: try: column = int(column) except ValueError: raise ValueErro...
af4ea6b6832ca46afc3a73eb2bf26ed209ba4dd5f8ea078e2549f2016d173048
Python
1,422
57
from nipype.algorithms.confounds import FramewiseDisplacement, TSNR import PIL sub = '1' sess = '2' rp_path = '\\NFTII\\sub-0'+sub+'\\Session'+sess+'\\CMRR\\rp_CMRR_sub0'+sub+'_sess0'+sess+'.txt' plot_path = 'fd_plot_sub'+sub+'_sess' + sess +'.png' calc_path = 'fd_calc_sub'+sub+'_sess' + sess +'.txt' fd = FramewiseD...
5188852f02bfbad63d90ae112f9ac2d6ecd92e3ff289f870fbef4ae643c941a4
Python
1,423
36
from sns_toolbox.neurons import NonSpikingNeuron from sns_toolbox.connections import NonSpikingSynapse from sns_toolbox.networks import Network import numpy as np from sns_toolbox.backends import SNS_Numpy delay = True spiking = True # Design neuron_type = NonSpikingNeuron() # Define a neuron type synapse = NonSpi...
738d34433274e42e99e256f08664a347247b71f39addb38d0a4c84fad72c3a6f
Python
1,423
40
from .entity_linker_model import SpanClassifier from .entity_mention_linking import EntityMentionLinker from .language_model import LanguageModel from .lemmatizer_model import Lemmatizer from .multitask_model import MultitaskModel from .pairwise_classification_model import TextPairClassifier from .pairwise_regression_m...
495b343b601748080a832fd1e09abc7d03ae12a0ba334e035fdab0f175906f7f
Python
1,424
38
# Copyright 2007 Zachary Pincus # This file is part of CellTool. # # CellTool is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. """Tools to read and write numpy arrays from and to image files. """ ...
e03991fe8c49bae519545eba42852eb50952915be3b3feec15cae12657470646
Python
1,424
43
"""Forecasting models.""" import sys import warnings from importlib import import_module # alias dictionary to map old module names to new module names # if an old module name is queried, imports work, but # a deprecation warning is issued to update the import statement # old_name -> new_name _MODULE_ALIASES = { ...
b62e29e95aad2cd09c60a54e51eb2cd905b7ac068567146dc0af0ced7e244a64
Python
1,426
45
"""OSULeaf dataset.""" from sktime.datasets._single_problem_loaders import load_osuleaf from sktime.datasets.classification._base import _ClassificationDatasetFromLoader class OSULeaf(_ClassificationDatasetFromLoader): """OSULeaf time series classification problem. Example of a univariate problem with equal...
b7cd2d54e7ef75c51867275b8f77d6c1f49cc1404f73d715addd54161034a63b
Python
1,426
43
# 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...
f96566916ffed7fe4693003a0397f5db0a88125dc05d3eceb4e9fa98b71f5ddd
Python
1,426
45
""" Example of the random undersampling for compositional data, applied on synthetic data generated with the function smote_cd.dataset_generation.generate_dataset, having 2 features and 2 classes. """ import numpy as np import matplotlib.pyplot as plt import smote_cd def create_imbalanced_dataset(): n_featu...
c16eab5704162e16c752b3fbd50810cae58d9abd08386741daf99df61b1b8e4b
Python
1,427
45
# 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...
e712986488df43d96f0c3ba764df60b974309b1a76fdd4fbe00eba47c336c31f
Python
1,427
47
from fig import Config as C from eval import run_mot_eval, run_mot_trace def main(): print("App configuration:") C.show() config_as_dict = C.as_dict() app_config = config_as_dict["app"] app = list(app_config.keys())[0] if len(app_config) > 1: raise Exception( f"Multiple a...
e53f9190e88929c52664e1295de8655ee266b7d4084d5902719f481874e8b4ae
Python
1,429
33
from __future__ import print_function import numpy as np from scipy import signal from parameterSetup import ParameterSetup from featureExtractor import FeatureExtractor from featureDownSampler import FeatureDownSampler from algorithmFactory import AlgorithmFactory class FeatureExtractorMerged(FeatureExtractor): ...
472abcaf2148ab8efda83a95de92b5254b83cb0cf38afee521d05f909d6ac075
Python
1,430
57
"""A dummy classification catalogue.""" from sklearn.metrics import accuracy_score from sklearn.model_selection import KFold from sktime.catalogues.base import BaseCatalogue class DummyClassificationCatalogue(BaseCatalogue): """Dummy catalogue of datasets, classifiers, metrics, and cv. Examples -------...
95b5f4fcc9bea4c42a9e6fefaec83e212b6bca004a01c0c9d937b947acac3ecf
Python
1,430
46
"""Tests for bcblib.imaging.convert.""" import numpy as np import nibabel as nib import pytest from bcblib.imaging.convert import convert_format, create_image def _make_nii(shape=(3, 3, 3)): data = np.ones(shape, dtype=np.float32) return nib.Nifti1Image(data, np.eye(4)) class TestConvertFormat: def te...
dc4ecb401d91d897430fc60fd8d8f384eda786bbb59d43a9e4b9fea2312ce178
Python
1,430
42
import pytest from itertools import repeat from time import time import os import numpy as np import siibra from siibra.features.image.image import Image from siibra.volumes.volume import Volume TEST_ALL_PRECONF_BBOXES = eval(os.getenv("TEST_ALL_PRECONF_BBOXES", "False")) RANDOM_SEED = os.getenv("RANDOM_SEED", None i...
0e7d46678009e0e54c3dda4346e6b41aefcf2cccb0a193e86a6b7f647eb65669
Python
1,431
46
# -*- coding: utf-8 -*- # # Copyright © 2013 Charles E. Vejnar # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://www.mozilla.org/MPL/2.0/. # import glob import logging import os from ..ut...
e0078c17a5b994e24c05f4c10a3ce5d15e4bbcf889090b8903dd0c29125fdc0f
Python
1,431
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...
ec2d332f26367fae4af23ea6be22bcf3a22ac2f8d7e746ee443322f0d1262cac
Python
1,432
52
import json import numpy as np from scipy.integrate import solve_ivp from Historia.ep.model import Gattoni2016 from Historia.shared.constants import RESOURCES_PARAMETERS_DIR, posix_path DEFAULT_PARAMS_PATH = posix_path( RESOURCES_PARAMETERS_DIR, "ep/parameters.json" ) class EPSolution: """ This class i...
cdfad9b369875c1686cd63a43e394a6ea93342f6030dd47667166e3c92550b2d
Python
1,436
40
# 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...
ddee751841ad2eea0f02547167588f9d4cac4563759cb333ad8acc0c09a6e2fa
Python
1,436
52
# 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 from onnx.reference.ops.op_conv import _conv_implementation class ConvInteger(OpRun): def _run( self, X, W, ...
db5be90deea42eb4eb073b620a20ab34c399095351888273cc8d18dc0247eba3
Python
1,437
42
from PyQt5 import QtWidgets, QtGui from PyQt5.QtCore import Qt class PredictionResultLabel(QtWidgets.QLabel): def __init__(self, parent=None): QtWidgets.QLabel.__init__(self,parent) self.labelContent = '-' self.stageColors = [Qt.black, Qt.red, Qt.darkCyan] self.stageCode = 0 ...
f6c831f260e412db34847737426996b6340ad156c409758660f0451d4de035f9
Python
1,438
41
# 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...
93e27a5512d09fa21aa09cd518ff1df9ebc7dd43dfdb7037e42b457dd6cb332b
Python
1,439
45
# SPDX-License-Identifier: LGPL-3.0-or-later from deepmd.dpmodel.output_def import ( FittingOutputDef, OutputVariableDef, fitting_check_output, ) from .invar_fitting import ( InvarFitting, ) @fitting_check_output class LatentChargeFitting(InvarFitting): r"""Per-atom latent charges predicted from ...
abbb7db28e4aced64c3a7f89f1e2b2be4878ffc655d1c8af0b6d1ec67139aa67
Python
1,439
34
from PIL import Image, ImageDraw import face_recognition # Load the jpg file into a numpy array image = face_recognition.load_image_file("biden.jpg") # Find all facial features in all the faces in the image face_landmarks_list = face_recognition.face_landmarks(image) pil_image = Image.fromarray(image) for face_landm...
8306f923fdb24b7c7d5235d97918d86a9ff622cac7a8568213b1fb66fb44b52c
Python
1,441
49
from torch.utils.data import Dataset import torch import logging class JetDataset(Dataset): """ PyTorch dataset. """ def __init__(self, data, num_pts=-1, shuffle=True): self.data = data self.shuffle = shuffle if 'Nobj' not in data.keys(): try: data...
e26271514ad2a6a302bf73db8cd1ec75ac39d035f50791671c7e7535c8e68c47
Python
1,441
43
import torch import torch.nn as nn import torch.nn.functional as F def _assert_no_grad(variables): for var in variables: assert not var.requires_grad,\ "nn criterions don't compute the gradient w.r.t targets" def FFT_trans(x, eps): vF = torch.fft.fft2(x, norm='ortho') vF = t...
f81b324b5260ca02f473aae12e94b68b6d7e34c914f2af01dc7392870f192776
Python
1,441
39
from networkunit.tests.power_spectrum_test import power_spectrum_test from networkunit.capabilities.ProducesSpikeTrains import ProducesSpikeTrains from networkunit.utils import use_cache, parallelize from elephant.statistics import time_histogram from elephant.spectral import welch_psd from elephant.signal_processing i...
ad2f5d1ade3e17ef536c84b6a2244f4c0f096e70cbd16740f14fc8bf36218393
Python
1,443
36
import scipy as sp def test_model(config, model, test_data): spearman_result = {} if config.transfer_learning: # TODO exit(2) else: print('Testing pre-train model') if config.enzyme == 'multi_task': enzymes = ['wt', 'esp', 'hf'] for enz...
c6096a8b97375e7279d58a8a1f711fd987b3b501c4a92bdc05560e658786bc38
Python
1,444
54
"""Shampoo Sales dataset.""" from sktime.datasets._single_problem_loaders import load_shampoo_sales from sktime.datasets.forecasting._base import _ForecastingDatasetFromLoader __all__ = ["ShampooSales"] class ShampooSales(_ForecastingDatasetFromLoader): """Load the Shampoo Sales dataset for univariate time seri...
ccbc604d89c345c294ebb973aafb394e5a71028493a23df74a098705cf0f2052
Python
1,444
44
# Copyright 2019-2020 The ASReview 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 appl...
151ab945f04140e62bb8dff209cbd296cfc849396e3e270f546309ed745f7c95
Python
1,445
50
# Copyright (c) OpenMMLab. All rights reserved. import os import os.path as osp import tempfile import mmcv.utils.logging from mmcls.utils import get_root_logger, load_json_log def test_get_root_logger(): # Reset the initialized log mmcv.utils.logging.logger_initialized = {} with tempfile.TemporaryDirec...
4905b63fcf245b7dd18a982aac05475655cdd337d198a562deae03c41b9dd5c9
Python
1,445
53
from pyontutils import scigraph_client from pyontutils.config import auth scigraph_client.BASEPATH = auth.get('scigraph-api') # WARNING if you import this module anywhere in your program # and you change the BASEPATH from what it is in auth-config # you may LEAK YOUR API KEY !!!!!!! To avoid this import # from scigra...
99019f1f61277f2eaa409ea19fd54b711c93dd26c3063ff7ba175d97f34fa031
Python
1,445
48
"""Hierarchical sales toy data for hierarchical forecasting.""" from sktime.datasets._hierarchical_demo import load_hierarchical_sales_toydata from sktime.datasets.forecasting._base import _ForecastingDatasetFromLoader __all__ = ["HierarchicalSalesToydata"] class HierarchicalSalesToydata(_ForecastingDatasetFromLoad...
6fea986920b7a47b1211bb912f93f60b35a9e9f68a1ef6a073ae3784516757b0
Python
1,447
37
"""to execute Python 3 code in Python 2. redefines builtin `range` and `input` functions and `abc` either via `collections` or `collections.abc` if available. """ import sys import collections as _collections range = range # to allow (trivial) explicit import also in Python 3 input = input if sys.version_info[0] ==...
f3a2fd2658ce8848098691750f1d3315af4b7f0076928c1721efc555638e7451
Python
1,447
47
# Copyright 2019-2021 The ASReview 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 appl...
3fd916d59cd0231ef7e5c1434ebaeb9af20d99b3d950a4aa43bcb2d221e28125
Python
1,448
55
"""A dummy forecasting catalogue.""" from sktime.catalogues.base import BaseCatalogue class DummyForecastingCatalogue(BaseCatalogue): """Dummy catalogue of datasets, forecasters, metrics, and cv. Examples -------- >>> from sktime.catalogues import DummyForecastingCatalogue >>> catalogue = DummyF...