sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
dded7452adf5c4739bf782ab809d4db9904369f0101b904f83a0fcfd7c91ecd4
Python
559
15
# 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. def configuration(parent_package='',top_path=None): from numpy.di...
e33087d4e2ddbdce429d08bc193b803e969f1503ede1b9b0fc5ad878bf836858
Python
559
19
import numpy as np import torch import atom3d.util.results as res import atom3d.util.metrics as met # Define the training run name = 'logs/lep_test/lep' print(name) # Load training results rloader = res.ResultsGNN(name, reps=[0,1,2]) results = rloader.get_all_predictions() # Calculate and print results summary = me...
9a7945168d4644c6369c499298b7c57e01b1ed573d8cace31504a77304d16bcf
Python
560
15
# 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. def configuration(parent_package='',top_path=None): from numpy.d...
e776d37dd577ac017ca48b39f941f288a64509f1b604c1b6504ccc9d551f8a91
Python
560
12
from pathlib import Path from yarl import URL # local path where the package stores its data CACHE_PATH = Path.home() / ".genomic_benchmarks" # local path where the references are stored REF_CACHE_PATH = CACHE_PATH / "fasta" # where the interval datasets are stored (if read from local) DATASET_DIR_PATH = (Path(__file...
439982db47d7d9d95b6decbac9925e62d5ae7d6bdc9944f47f908bdb82bd7e50
Python
562
29
""" Stacked histogram on a log scale ================================ _thumb: .5, .45 """ import seaborn as sns import matplotlib as mpl import matplotlib.pyplot as plt sns.set_theme(style="ticks") diamonds = sns.load_dataset("diamonds") f, ax = plt.subplots(figsize=(7, 5)) sns.despine(f) sns.histplot( diamon...
41b3c8e81835f7c3a315912d6c09f3447612a47e726ce7765bd08f55cc2a1550
Python
563
15
from setuptools import setup setup(name='pymtrf', version='0.0.1a0', description='Translation of the matlab mtrf toolbox, see http://www.mee.tcd.ie/lalorlab/resources.html', url='http://github.com/storborg/funniest', author='Simon R. Steinkamp', author_email='simon.steinkamp@googlemail.co...
119c8368806091b30003e5d89282d725a460d151ce92d6ff211bc48243f6beac
Python
564
24
# 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 OpRunUnaryNum class Hardmax(OpRunUnaryNum): def _run(self, x, axis=None): axis = axis or self.axis if x.size == 0: ...
63d43824628ed5741a47ba1fcde857c8781733e2ac26a28209c45fcf38edbc29
Python
565
23
"""Training data streams used by Tabby-Pretrain.""" from .real_data import ( BlastRealIterableDataset, concat_mixed_batches, discover_blast_shards, ) from .synthetic_data import ( ArrowCauKerSCMIterableDataset, ArrowSyntheticIterableDataset, OnlineCauKerIterableDataset, discover_arrow_files...
a4e83134ddb0b5edaaf74ed3a11578185b8af23e3bae8b30674942af4d9784b3
Python
565
27
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 3 14:59:25 2022 @author: sam """ import argparse from tqdm import tqdm import cv2 if __name__ == '__main__': p = argparse.ArgumentParser('write frame') p.add_argument('--frames', nargs="+", type=int) p.add_argument('--video') a...
0166b9e587e00614f175d7290f0284167c17d667876c1b9949e6fc5cb3892396
Python
567
19
from pathlib import Path # REPO_ROOT = Path('C:\\Users\\Richard\\Desktop\\ABCD_Study\\Publication\\abcd_paper') REPO_ROOT = Path(__file__).resolve().parent.parent RAW_DATA_DIR = REPO_ROOT / 'data' / 'raw' PROCESSED_DATA_DIR = REPO_ROOT / 'data' / 'processed' RESULTS_DIR = REPO_ROOT / 'results' # Color blind friendly ...
3e0c0c4ed50d12dc1defb53514e80b9ec751c77723608882bff7d6a9ad2d8884
Python
567
15
import sys from parameterSetup import ParameterSetup if __name__ == '__main__': args = sys.argv classifierIDs = args[1:] res = [] for classifierID in classifierIDs: paramFileName = 'params.' + classifierID + '.json' params = ParameterSetup(paramFileName=paramFileName) stageLabel...
669bdb460fc7b8f396f27ed076c0417b489cfb45be0f21c126c455db836c45e5
Python
567
24
# 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 Abs(Base): @staticmethod def export() -> None: node = ...
8fd80b8b9077dc67eb99ba0da35688c6d8b88bb0a453dbd3325fb9eb9124afb8
Python
568
11
import os import sys # Append OpenSpiel (included in this package's git repository) to the system path so it can be imported. _OPEN_SPIEL_MODULES_PATH = os.path.abspath(os.path.join(__file__, "../../../dependencies/open_spiel")) _OPEN_SPIEL_PYBIND_PATH = os.path.join(_OPEN_SPIEL_MODULES_PATH, "build/python") sys.path....
fd037bf9112b505a1ef14ab8d2ff595cce9c034b401b09db94aff9303f22479b
Python
568
20
# 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 IsInf(OpRun): def _run(self, data, detect_negative=None, detect_positive=None): if detect_negative: if detect_p...
00ffd138755587ebc9fce2ef8e980b64410a88e59d5f5789c2c688880e3b131e
Python
569
20
# from Cython.Build import cythonize # from distutils.sysconfig import get_python_inc # from setuptools import setup, Extension from setuptools import setup setup( name='dataprovider3', version='0.0.1', description='DataProvider3.', url='https://github.com/torms3/DataProvider3', author='Kisuk Lee',...
36beaac3f2ff7f99395388486f5eab6b649426499e20b94e84edb1a222e32b11
Python
569
23
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from typing import TYPE_CHECKING from onnx.reference.ops._op import OpRunUnaryNum if TYPE_CHECKING: import numpy as np def _leaky_relu(x: np.ndarray, alpha: float) -> np.ndarray: sign = (x > ...
827779d4cdf4a3e4981d89b2abfbb646ad415e2fd7d8197bc9135ec7918ac7ae
Python
569
24
# 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 Sign(Base): @staticmethod def export() -> None: node =...
f0682cbd40ec0e0bcf69cef9d7774980b4a48b5fab05255389643a7661acf37f
Python
569
20
# -*- coding: utf-8 -*- # from __future__ import print_function class Error_dataset_name(Exception): def __init__(self): super().__init__('Please check dataset name. It should be NIH_Covid') class Error_nor(Exception): def __init__(self): super().__init__('Please check normalize state') clas...
a4fb8ae6206a47d574b3825ec2d8161b8b7b37e3e9346379bcca24c34bf7f2a0
Python
570
22
import h5py import numpy as np import os def imread(fname): _, ext = os.path.splitext(fname) if ext == '.h5' or ext == '.hdf5': with h5py.File(fname, 'r') as f: data = np.asarray(f['/main']) else: raise RuntimeError("only hdf5 format is supported") return data def imsave(...
d1bfd8d06669c967b04788f16459aaf3b2c141dd849a51564fdf37eb88869874
Python
570
28
# pylint: disable=missing-docstring import json class Publisher(object): """ Publisher object is a part of Manifest.json """ def __init__(self, author, email): self.author = author self.email = email self.pub_dict = self.__to_dict__() def __to_dict__(self): pub_...
b3e93921d542ca824a34050ed87c745b10111d55284cc9d5724617de747a2777
Python
571
18
import importlib def create_instance(config_map): '''Expects a string that can be imported as with a module.class name''' module_name, class_name = config_map['import'].rsplit(".", 1) try: print('Importing {}.{}'.format(module_name, class_name)) somemodule = importlib.import_module(module...
9bbf0f8e9584d846c488625d7e145f916a85b0aa216a10dd88739482ad941d5d
Python
572
20
import sciunit.models.backends as su_backends import inspect try: from .storage import storage except ImportError: storage_backend = None print('Could not load storage backend') try: from .nest import NestBackend except ImportError: nest_backend = None print('Could not load Nest backend') ava...
1f31d8c65c43d03dc84c9f6af7e933dc489d33497ddfb0bd7e16f5a9afbaae43
Python
574
28
import sys fi=open(sys.argv[1]) fo=open(sys.argv[2],'w') fa=open('/home/disk/database/data/ICS_scHIC/f03_atlas/eQTL/LIST.txt') i=1 old=set() for line in fa: seq=line.rstrip().split('\t') input_path='/home/disk/database/data/ICS_scHIC/f03_atlas/eQTL/GTEx_Analysis_v8_eQTL/'+seq[0]+'.format/tag.bed' if inpu...
5f94efe5f474faa99f7b1b13e43ea7dcabc256edb4324791361cdc7077143401
Python
574
16
import numpy as np from sktime.dists_kernels._numba_distances import twe_alignment_path def test_twe_alignment_path_default_bounding_matrix(): """Test twe_alignment_path with default bounding matrix to avoid IndexError. This test ensures that the twe_alignment_path function works correctly when no boundi...
90c58de764815fe0545fe6c6ebf6d5d1275248565b130576ce80142d4e056cc9
Python
574
17
from . import lddmm # Subpackage. from .lddmm import resample # Function. from .transform import Transform # Class. from .visualization import heatslices # Function. from .file_io import save, load # Functions. from . import preprocessing # Subpackage. from .preprocessing import preprocess # Function. from . impor...
3105887f2793fec8b8bb0bca5ffe14839edaa45d54649303e01e9c7f3ff9d270
Python
576
20
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from packaging.version import parse as version def numpy_older_than(ver: str) -> bool: """Returns True if the numpy version is older than the given version.""" import numpy # noqa: PLC0415 ...
97c3f01d677337fe37af0b5e04b88279f6e9eb32589c9c31037d272fa62b6186
Python
576
17
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.helper import np_dtype_to_tensor_dtype from onnx.reference.ops._op_common_random import _CommonRandom class Bernoulli(_CommonRandom): def _run(self, x, dtype=None, seed=None): if ...
75d3ec72d40fe595de0b8158d9a9a81769feca8ab215bc21424ef6fc7dd5c853
Python
577
21
# 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 Where(OpRun): def _run(self, condition, x, y): if ( x.dtype not in (y.dtype, object) and x.dtype.ty...
59dbc6616cff22cd688595e2367c61e41270ff2af94921fd02b243d505f936bd
Python
578
17
# 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. import os, numpy def configuration(parent_package='',top_path=None):...
6df817fa0e62e1be98153588c7b5ad6c9a7035c764cb60b23210a9cffcc99986
Python
581
21
from __future__ import print_function from pathlib import Path import neuronvis.swc_to_hoc as swc SWC = swc.SWC soma = SWC('tests/test_data/cellbody.swc', types={1:'soma', 2:'axon', 3:'dendrite'}) soma.set_type(1) axon = SWC('tests/test_data/axonnonscaled.swc') axon.set_type(2) dend = SWC('tests/test_data/dendnonscale...
9fe602e4ba50c3e2132ce2d18ceb5b02b11b4988724e27f16cb67f6406a09c86
Python
581
32
""" test_window.py Just tests that the major programs in the package are all compatible with a psychopy stimulus window. """ from camstim import Window, SweepStim, Behavior, VisualObject import pytest @pytest.fixture(scope="module") def window(): w = Window() yield w # teardown w.close() def t...
27041afaf29ee2cd83d3ee8351c12737ee36988040176c45a4b96ac341aaf066
Python
582
26
from setuptools import setup, find_packages setup( name='nlgc', version='0.3.1', description='Latent Causal inference for M/EEG data', author='Behrad Soleimani', packages=find_packages(), python_requires='>=3.8', install_requires=[ 'numpy', 'scipy', 'matplotlib', ...
e010cad7a0387085722a5e1f39fe659b6991203436dc7bfcba095f7672c53624
Python
582
24
# 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 Relu(Base): @staticmethod def export() -> None: node =...
bb4c7d924316c7bff5527f14bca998839243b43afc44d81c9eb3556f1b5c1e86
Python
584
28
import cooler,sys COOL_FILE=sys.argv[1] BED_FILE=sys.argv[2] OUT_FILE=sys.argv[3] c = cooler.Cooler(COOL_FILE) fi=open(BED_FILE) fo=open(OUT_FILE,'w') for line in fi: if line[:3]=='chr': seq=line.rstrip().split('\t') this_c1=seq[0] this_s1=seq[1] this_e1=seq[2] this_c2=seq...
bbe907f9c00ab63eed223ad07869aadf01e6d7695497f23ad780f1f511d67da9
Python
584
19
from rxnebm.proposer.retrosim_config import retrosim_config from rxnebm.proposer.retrosim_proposer import RetrosimProposer def test(): proposer = RetrosimProposer(retrosim_config) product_smiles = [ "[Br:1][CH2:2]/[CH:3]=[CH:4]/[C:5](=[O:6])[O:7][Si:8]([CH3:9])([CH3:10])[CH3:11]", "[Br:1][c:12...
37a88e657d345de29b8baf15072e730982b0e512b8455fa78b2788a12bc51ba8
Python
587
29
""" plot_slice ========== .. autofunction:: optuna.visualization.plot_slice :no-index: The following code snippet shows how to plot the parameter relationship as slice plot. .. _visualization-plot-slice-plotly-content: """ import optuna def objective(trial): x = trial.suggest_float("x", -100, 100) y...
af5513694bd407adcae1511d3ae38dadec3fc7acc62dd05e4dedfeffe9259484
Python
588
21
#!/usr/bin/env python3 import rospy from gazebo_msgs.msg import ModelStates from geometry_msgs.msg import Pose def callback(data): global pub index = data.name.index("jackal") pose = data.pose[index] pub.publish(pose) if __name__ == '__main__': rospy.loginfo('Initializing Node') rospy.init_n...
c8c8485f75ff612599842df2ee747343f4d6edca2bb6c52dd0e3a9dfccf447ec
Python
589
14
"""Configures the command-line arguments the programs can be called with""" import argparse def get_args(): parser = argparse.ArgumentParser() parser.add_argument('-i', '--input', help='input file to read the calculation details.', required=True) parser.add_...
0cb10821872f34c482578045f19a9ee2b3a22de886a44044b50b501a94eec085
Python
590
25
from types import ModuleType from importlib import import_module import torch_geometric.loader import torch_geometric.transforms import torch_geometric.utils import torch_geometric.profile import molgnn.data from molgnn.pygdata import RedDB from molgnn.molgnn import MolGCNConv, MolGATConv from molgnn.molfeatures impor...
9afa956f7047201c08cc7425b5e8c605750f600970739d6d2425b3c244cf7580
Python
590
19
# 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 OpRunUnaryNum class LpNormalization(OpRunUnaryNum): def _run(self, x, axis=None, p=None): axis = axis or self.axis p = p or se...
d064de5a0509b0d4e1c5a5d6cea6e30f3980351a992cd20562cefa52c39c2358
Python
592
20
# 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 Transpose(OpRun): def _run(self, data, perm=None): perm_ = None if (perm is None or len(perm) == 0) else perm if pe...
11579fba5cb3f281a4a7ee8b5d5f8cb29a95a0132b36b5733b47eeb8af39009c
Python
594
24
""" Scatterplot with continuous hues and sizes ========================================== _thumb: .51, .44 """ import seaborn as sns sns.set_theme(style="whitegrid") # Load the example planets dataset planets = sns.load_dataset("planets") cmap = sns.cubehelix_palette(rot=-.2, as_cmap=True) g = sns.relplot( data...
57357e8ad0e4c9cbe342e59176a447e988bf7b98b8f9642934f1604dd2ffe518
Python
594
13
# 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...
789bd8dd6cae07867423a1508304d40cb46e5506c6a124e515450bd74a96f80e
Python
594
13
# 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...
99ee438da3d1221b4b90b2940df14d9891c84f22bee906343ef0823a4ff59c65
Python
594
27
#!/usr/bin/env python # cloud_workstation 1.0.0 import os import re import subprocess import dxpy def _run_cmd(cmd): print (cmd) subprocess.check_call(cmd, shell=True) @dxpy.entry_point('main') def main(**job_inputs): if 'fids' in job_inputs: for fid in job_inputs['fids']: cmd = 'dx d...
de821d9397fd7047fce8a29fd3352849c939dadd4574e19782a0af1d93509dba
Python
594
13
# 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...
5c9e85d1d6a0b3a55d7bad83771e099629706524537c21ef847e0d45ef8aa29f
Python
595
14
# 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...
2d0ca0869ce0291d5d1b35a165d8581721f15221a6e9718b5cba50d3cc3b6aaa
Python
596
15
# 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...
69c6b0ed621100c0c7fd4d4b104e4498de89c42ad8e29f57193c636f69ab50b0
Python
597
17
# 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 .EmbeddingModel import EmbeddingModel from .TransE import TransE from .Dis...
b054ccf987455a93fa58371ef3b0493cee51461172453eea9811f7f0719f1b3c
Python
598
15
# Copyright (c) OpenMMLab. All rights reserved. from .cls_head import ClsHead from .conformer_head import ConformerHead from .deit_head import DeiTClsHead from .linear_head import LinearClsHead from .multi_label_head import MultiLabelClsHead from .multi_label_linear_head import MultiLabelLinearClsHead from .stacked_hea...
75de36e209a913d9602fcda5de7d1cbab05f45a9af6e7f669aeffe82c79d4a48
Python
599
29
""" plot_contour ============ .. autofunction:: optuna.visualization.plot_contour :no-index: The following code snippet shows how to plot the parameter relationship as contour plot. .. _visualization-plot-contour-plotly-content: """ import optuna def objective(trial): x = trial.suggest_float("x", -100, ...
dfab28eede2258570067dd27aa8329b38fbecce2323eaaa9eec70b5f80fb078c
Python
600
15
__all__ = ['extract', 'roiwise_stats_indiv', 'extract_multiedge', 'load_run', 'get_edge_values', 'export_to_nx', 'parcellate', 'freesurfer', 'read_freesurfer_atlas', '__version__'] from importlib.metadata import PackageNotFoundError, version from graynet import parcellate, freesurfer from grayne...
45d3e7b0eadaa6860d16d054f36d18b93db4a3714778b7fe799af6fc15124046
Python
601
18
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.helper import tensor_dtype_to_np_dtype from onnx.reference.op_run import OpRun class Optional(OpRun): def _run(self, x=None, type=None): # type: ignore[override] # noqa: A002 if...
6b39b0a593deb276e46ca4989bddcf07d48eed8d2e3caacb086830cb905daac3
Python
601
15
"""Interval based time series classifiers.""" __all__ = [ "TimeSeriesForestClassifier", "RandomIntervalSpectralEnsemble", "SupervisedTimeSeriesForest", "CanonicalIntervalForest", "DrCIF", ] from sktime.classification.interval_based._cif import CanonicalIntervalForest from sktime.classification.int...
3304d8f143b86d3a6809eed5af67714f35d1a176ecea931f99121b28a4cab069
Python
602
23
# First need to import the CG dictionary from lgn.cg_lib.cg_dict import CGDict # First need to import the CG dictionary from lgn.cg_lib.cg_module import CGModule # Import tau calculation for cg_ops from lgn.cg_lib.cg_ops_tau import cg_product_tau # Now for your regularly scheduled imports from lgn.cg_lib.cg_ops impo...
81c1801272be82a6994342f4d06e28230c82d5d553353e5bc96b975e6cb3f98b
Python
602
27
__test__ = False import imp import numpy as np import pyfilterbank from pysoundfile import SoundFile from pysoundcard import Stream filename = r'bonsai.wav' ofb = filterbank.OctaveFilterbank(nth_oct=3.0, start_band=-18, end_band=12, lphp_bounds=True, filterfun='cffi') st = Stream(input_device=False) sf = SoundFile...
6c2aac88650866d50ed25b3e0fdfe0d78d3f4580bdcfadbeb199f2adc9edf042
Python
603
27
from data_util import load_pdb_npz_to_static_data_and_coordinates import os import numpy as np types= ['train', 'val', 'test'] for t in types: files = os.listdir("../dataset/"+t+"/pdb_npz") count = [0,0] for i in files: if not i.endswith('npz'): continue count[0]+=1 ...
d8168ff36b6ae0d4b9ffd1af6ded0e4fb82251e2fa3e6fa342323e9fe0cf32dc
Python
604
16
from enum import Enum, auto class DiagnosticKeys(Enum): """ This enumeration serves as the centralised source for all keys used in Redis publish/subscribe operations throughout the diagnostics package: - RedisPublisher uses these keys to publish diagnostic data - DiagnosticsModel uses thes...
4eae521afd2dea13f5a7846ec998f148a346ebda506b3ed821afe83316e4f3e0
Python
605
16
# 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 # """This module contains utility functions for neural knowledge graph embedding ...
cbe0a52d4b52e7f69857c7afa5d076f6d93114b2a989354886353e21d0433a9d
Python
605
28
""" plot_slice ============ .. autofunction:: optuna.visualization.matplotlib.plot_slice :no-index: The following code snippet shows how to plot the parameter relationship as slice plot. .. _visualization-plot-slice-matplotlib-content: """ import optuna def objective(trial): x = trial.suggest_float("x",...
d7a011c3ebaa37b68807033e4383583b4430fb2a9c4d07462f7e52848b61ef3a
Python
606
24
import config import os output_FF_layers = [100, 1] #[4000, 1000, 100, 1] #[200, 200, 100, 100, 1] cur_work_dir = os.getcwd() d_model = 64 attention_heads = 32 attention_dropout = 0.0 n_layers = 1 k_dim = 10 add_seq_cnn = True add_parallel_cnn = False cnn_dropout = 0.2 attention_norm = False attention_layer_norm = Fal...
cbc4d053911fac4a9587fdabcde5ef8897e754032e3152a5e2de0120703b47f6
Python
607
17
import os import unittest from elftools.common.exceptions import ELFError from elftools.elf.elffile import ELFFile class TestSectionSelfLink(unittest.TestCase): def test_self_link(self): test_file = os.path.join('test', 'testfiles_for_unittests', 'section_link_to_self.elf') with open(test_file, '...
85f22a805a5728558dfd4a2854601e47e883fc243edf71373a80f0954d3ecd8d
Python
608
20
# 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 Upsample(OpRun): def _run(self, x, scale, mode=None): if mode == "nearest" and scale.astype(np.int64).tolist() == scale.tol...
d6883d2fa6bbf0425301be4e15145261eda4decb4acfe186e5dfbac4b86de9b5
Python
608
15
# 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...
6aaf1c8e9073d53430af88e5d1455f10b5abbad1e9ec942caed355122f5ced92
Python
609
19
"""Tests for dummy detectors.""" import pandas as pd def test_dummy_changepoints(): """Test expected output for DummyChangePoints.""" from sktime.detection.dummy._dummy_regular_cp import DummyRegularChangePoints y = pd.Series([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) d = DummyRegularChangePoints(step_size=3)...
0b8bc389e5920d43367c2ca2598433f069acf6ce11d1ba5664878141aa499681
Python
610
26
""" timeit decorator """ import time from functools import wraps def timeit(func): """ Use this decorator on a method to find it's execution time. :param func: :return: """ @wraps(func) def time_and_log(*args, **kwargs): start = time.time() start_cpu = time.clock() ...
63318db9f2c7da68e46280ae26a13f6ad332e67f1fa5455a4e0dff2887eda13b
Python
611
13
# 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...
c6513584002b3528e60ff1d9f2041dd8755b7742019d2eae77b7e3dbcaa79ce7
Python
611
13
# 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...
6a140c9714a080b8f7b2b64992116842984ab8e7aad02eaf06bbdb03c32e4280
Python
612
14
# 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...
460b3242f3ec41a91b9c555342f2abc99e2f666b2a1352e585f21d9794224a1d
Python
613
15
# 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...
9d4ea3a69478fe3e882c790219afba23d2ebc4741dd11fbf1c63f3498c4f0664
Python
613
28
""" Read the swc soma reconstructions and genereate hoc files. This data is not in the shared database. """ from pathlib import Path import vcnmodel.util.swc_to_hoc as swc_to_hoc from vcnmodel.util.get_data_paths import get_data_paths config = get_data_paths() swcPath = Path(config["disk"], config['baseMorphologyD...
06a998133c92428cf78c3548b096272ae31b4b965250441afc0130f5f8a5d237
Python
615
28
""" plot_contour ============ .. autofunction:: optuna.visualization.matplotlib.plot_contour :no-index: The following code snippet shows how to plot the parameter relationship as contour plot. .. _visualization-plot-contour-matplotlib-content: """ import optuna def objective(trial): x = trial.suggest_fl...
39bcf52e2e7ef38f264a6a9c412baf00085926f5c426367af250e4e2b9aa8e2e
Python
615
27
import os import time import yaml from dotmap import DotMap def get_config_from_yaml(yaml_file): """ Get the config from a yaml file :param yaml_file: :return: config(namespace) or config(dictionary) """ # parse the configurations from the config yaml file provided with open(yaml_file, 'r...
532ab324e0eab3f8926f1ac69699295d530ccc190b4737c13c1c3115dabdbe06
Python
617
23
""" Bivariate plot with multiple elements ===================================== """ import numpy as np import seaborn as sns import matplotlib.pyplot as plt sns.set_theme(style="dark") # Simulate data from a bivariate Gaussian n = 10000 mean = [0, 0] cov = [(2, .4), (.4, .2)] rng = np.random.RandomState(0) x, y = rn...
565466e4f1085cd4b4fc13ac7525b61845e8134f031d6ecee92ec238313613bf
Python
618
17
# # # Different template styles # # [Open interactive notebook in Binder](https://mybinder.org/v2/gh/wiheto/netplotbrain/main?filepath=docs/gallery/template_styles.ipynb) # # There are currently four different template style options to choose from: suface, filled, cloudy, glass. # You just need to change the specifi...
14928f44569adcf5918a1f254a8667be27c3d10edbb714652f7baad7e50489c3
Python
619
24
import torch class Dataset(torch.utils.data.Dataset): 'Characterizes a dataset for PyTorch' def __init__(self, dataset,datasetf, labels): 'Initialization' self.labels = labels self.dataset = dataset self.datasetf=datasetf def __len__(self): 'Denotes the total number...
2448eb590744ab8929e24ce9e3ef64a5dd405b9b89ca1125f391da7ccc315048
Python
619
23
"""Preprocessing utilities for AxialTAD Hi-C patch input.""" from __future__ import annotations import numpy as np def standardize_patch(a: np.ndarray, patch: int) -> np.ndarray: """Per-row standardization for Hi-C patch input. Args: a: Input array of shape (..., patch, patch, 1) or similar. ...
4d234a7ba4baf3214879d361478dee9e3f4bd905c4d8b74e696e919b6ddd4ccb
Python
619
18
import os import unittest from elftools.common.exceptions import ELFError from elftools.elf.elffile import ELFFile class TestSectionHeaderEntrySizeCheck(unittest.TestCase): def test_size_check(self): test_file = os.path.join('test', 'testfiles_for_unittests', 'section_header_bogus_size.elf') with...
cf1d25e4db159d48f90e2f227e5e42e5051d59374bb61010f7983f8abc2610a0
Python
619
23
import os from pathlib import Path from tempfile import gettempdir import shutil import pytest from pyontutils.core import log as _log log = _log.getChild('test') temp_path = Path(gettempdir(), f'.pyontutils-testing-base-{os.getpid()}') temp_path_ap = temp_path.as_posix() def ensure_temp_path(): if temp_path.ex...
358a8d7fc9905f729fe6ad93b7388f079c435a4f112b99b40432393c3a4aa4c9
Python
620
26
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import math import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class Erf(Base): @staticmethod def export() -> None: ...
b69631734f9a8fe99b1cd94fead6f91947e5f8378e739a55b50ca68b20a131aa
Python
621
21
import os import unittest from elftools.elf.elffile import ELFFile class TestDWARFv5(unittest.TestCase): def test_dwarfv5_parses(self): dwarfv5_basic = os.path.join('test', 'testfiles_for_unittests', 'dwarfv5_basic.elf') with open(dwarfv5_basic, 'rb') as f: elf = ELFFile(f) ...
057ef9f0fdafe2846e9dca218986bf78fc14aad516bf664adffd2e7080cba876
Python
622
13
#Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. #This program is free software; #you can redistribute it and/or modify #it under the terms of the MIT License. #This program is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHA...
974d2371385dcdd0e206e40c871bd655dec58d9c274bf6b78a7ccfd6fa356dbc
Python
623
29
""" plot_optimization_history ========================= .. autofunction:: optuna.visualization.plot_optimization_history :no-index: The following code snippet shows how to plot optimization history. .. _visualization-plot-optimization-history-plotly-content: """ import optuna def objective(trial): x = t...
32e03a9fdb33423a1374ab313bd0f769fccca08e0bf588712ad929e1b7f715df
Python
624
16
# Test data constants EXPECTED_AREA_METRICS = { 'area_sum': 3721912.0, 'max_label': 3481, 'column_sums': [231498829.0, 150952363.0, 75868924.0, 151411232.0, 82555688.0] } # VarBayes iteration deltas EXPECTED_ITER_DELTAS = [ 1.0, 0.8998741, 0.6707933, 0.4703735, 0.62746835, 0.58092755, 0.604991, 0.2...
905e2d6abc05ee0f6cbf62ec5fc7fd9af9930a77472c2fecab71379339c7247c
Python
625
19
"""Shapelet based time series classifiers.""" __all__ = [ "MrSEQL", "MrSQM", "ShapeletLearningClassifierPyts", "ShapeletLearningClassifierTslearn", "ShapeletTransformClassifier", ] from sktime.classification.shapelet_based._learning_pyts import ( ShapeletLearningClassifierPyts, ) from sktime.c...
df3d8a0fa176efa78602734bb347e20c42dadc137f69a92be3adaca22f5ff454
Python
625
29
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from dataclasses import dataclass from typing import TYPE_CHECKING if TYPE_CHECKING: from collections.abc import Sequence import numpy as np import onnx @dataclass class TestCase: na...
fe2ec987e08147799ee2b97a18b826e07d8edd1f765670fe0b2e9ca44bb27b6f
Python
625
21
# 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 Gather(OpRun): def _run(self, x, indices, axis=None): if not x.flags["C_CONTIGUOUS"]: x = np.ascontiguousarray(...
9a1694a9b768e8d1454fdd56e63effdb6d0503caead761b2796650beda40bfbb
Python
628
19
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.helper import np_dtype_to_tensor_dtype from onnx.reference.ops._op_common_random import _CommonRandom class RandomNormalLike(_CommonRandom): def _run(self, x, dtype=None, mean=None, scale...
e7f7d31838696fcdffb341f1b8d3f1a33a1356d53296761409981b5b6ca2218c
Python
628
30
""" plot_pareto_front ================= .. autofunction:: optuna.visualization.matplotlib.plot_pareto_front :no-index: The following code snippet shows how to plot the Pareto front of a study. .. _visualization-plot-pareto-front-matplotlib-content: """ import optuna def objective(trial): x = trial.sugge...
e23440ba9ab7ecfa977667b56247b7a31479fe6316a9bcb8eaeb958acb1aeb2f
Python
629
19
"""Loads NetworkUnit plot classes""" from .correlation_matrix import correlation_matrix from .covar_pdf_ei import covar_pdf_ei from .covar_pdf import covar_pdf from .eigenvalues import eigenvalues from .eigenvector_loads import eigenvector_loads from .mu_std_table import mu_std_table from .power_spectral_density impor...
157e7cd87a2186cf39c2f21c3e06995de7da166d7799a1adf0fc614d1a064a55
Python
630
19
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from onnx.helper import np_dtype_to_tensor_dtype from onnx.reference.ops._op_common_random import _CommonRandom class RandomUniformLike(_CommonRandom): def _run(self, x, dtype=None, high=None, low=...
2c45f269afff9745be18682a014089770d5971900cd809e8ccd56660875e7480
Python
634
14
# 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 # # ...
532fedf13dd1290a5f4b58bc7226803e874224fbba6a6b2e62807a3491278212
Python
634
17
"""Dummy detectors for baselines and testing.""" from sktime.detection.dummy._dummy_pretrained_an import DummyPretrainedAnomalies from sktime.detection.dummy._dummy_regular_an import DummyRegularAnomalies from sktime.detection.dummy._dummy_regular_cp import DummyRegularChangePoints from sktime.detection.dummy._zero_an...
5ee6ae3df0524a824eceda8c273c6f7a5a2e2ae07ee2c00ee04e7f33cfc0d25b
Python
634
14
# 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 # # ...
3c135193df9e2d47e7c9971a332e8d945f9cef6a0c4b7fe7cabb2e4227017acd
Python
635
15
# 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 # # ...
9f36740abb1303b73d9493dd51eabe4d84318c5d8d4d189531583688ad01b291
Python
635
31
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import sys import atheris with atheris.instrument_imports(): import onnx def TestOneInput(data): try: model = onnx.load_model_from_string(data) _ = len(model.graph.node) ...
a657ce7355782eb970f95fd0d2e26eec5b9023212d2b655814da6e15b70510b4
Python
635
21
import torch from .modules.lpips import LPIPS def lpips(x: torch.Tensor, y: torch.Tensor, net_type: str = 'alex', version: str = '0.1'): r"""Function that measures Learned Perceptual Image Patch Similarity (LPIPS). Arguments: x, y (torch.Tensor): the input tensors t...
78b264b98bcaa8f5b0c52864e1bd976cf61613c8416680024e9ba670c22b4396
Python
637
27
import sys import argparse def _parse_args(): '''Parse the input arguments.''' ap = argparse.ArgumentParser(description='Rename contigs') ap.add_argument('-p', '--prefix', help='Prefix of contigs.', default='contig', required=False) return ...
9d355bda032206e90e017ecd91f4dd2036a95710d2e0df86c935583e7141c684
Python
637
23
""" Line plots on multiple facets ============================= _thumb: .45, .42 """ import seaborn as sns sns.set(style="ticks") dots = sns.load_dataset("dots") # Define a palette to ensure that colors will be # shared across the facets palette = dict(zip(dots.coherence.unique(), sns.color_palet...
199794d9ae4ee5b2d6379c329ce61e746d8f104eebeaa628dda8b9672f626b5d
Python
638
22
import networkx as nx import numpy as np from graynet.utils import warn_nan from pathlib import Path # <<< change the out_dir to the folder contianing the GraphML files here: out_dir = '/Users/Reddy/dev/graynet/example_data/freesurfer/test_outputs' out_dir = Path(out_dir).resolve() for gml_path in out_dir.rglob('*.gr...