sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
187a4a44ca09a25719701f36e081df6d757bcf0d4a8c728ace75de546c90ab5a | Python | 790 | 28 | # 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 Reciprocal(Base):
@staticmethod
def export() -> None:
... |
3945c251bef3844545e8f62684e27183fc8be41b4ecb8bd50d68e57a8a3fd0fa | Python | 791 | 23 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops._op_common_window import _CommonWindow
class HammingWindow(_CommonWindow):
r"""Returns :math:`\\omega_n = \\alpha - \\beta \\cos \\left( \\frac{\\pi n}{N... |
bb1abee9b867d29271e16fcb4bf2df5d541becf54dc3aab050ed83cdc15db0a6 | Python | 791 | 22 | # 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... |
8a1e6f16256168df52b572f9c14ec8c63ea247b90ff2b0c8b4617faeb37f0672 | Python | 792 | 22 | # 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
#
# ... |
d7cce1946b6efd1d3c8027ddcf50e331710bf2a5399cfd1e00b230241dd35aac | Python | 792 | 32 | #!/usr/bin/env python
#
# Copyright 2010 Google Inc. All Rights Reserved.
"""Runs program specified in the command line with the substituted PATH.
This script is needed for to support building under Pulse which is unable
to override the existing PATH variable.
"""
import os
import subprocess
import sys
SUBST_... |
4f2051da275f68575ad9255d0299b4a8fc6beb9a83182c912adf66965eb2874f | Python | 793 | 25 | """
Scatterplot with categorical and numerical semantics
====================================================
_thumb: .45, .5
"""
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style="whitegrid")
# Load the example iris dataset
diamonds = sns.load_dataset("diamonds")
# Draw a scatter plot while assig... |
94c248fc955aea40ffa468c115b194aa74aabd7857f1db2389e45d3575cfc723 | Python | 794 | 36 |
import subprocess
import multiprocessing
import os
RS='/home/disk/database/data/ICS_scHIC/f03_atlas/single/rs04_cicero.R'
def Work(input_path,a):
print input_path
subprocess.Popen('/home/toolkit/tools/R4.2.0/bin/Rscript '+RS+' '+input_path,shell=True).wait()
fa=open('/home/disk/database/data/ICS_scHIC/f03... |
9f6cd27850f9351c65895157605ab59076dbadbb9b5d808377d95b383f023529 | Python | 794 | 36 |
import subprocess
import multiprocessing
import os
RS='/home/disk/database/data/ICS_scHIC/f03_atlas/single/rs02_getAgg.R'
def Work(input_path,a):
print input_path
subprocess.Popen('/home/toolkit/tools/R4.2.0/bin/Rscript '+RS+' '+input_path,shell=True).wait()
fa=open('/home/disk/database/data/ICS_scHIC/f03... |
286a58c57de4bdd23fc7c33bdd0ab851f25c1c1e8cc9f42e1ab367f223bb428c | Python | 795 | 29 | import os
import sys
import importlib
# Setting the correct config file
config_path = ".".join(["models", sys.argv[1]]) + "." if len(sys.argv) >= 2 else ""
config = importlib.import_module(config_path + "config")
output_FF_layers = [100, 2] #[4000, 1000, 100, 1] #[200, 200, 100, 100, 1]
cur_work_dir = os.getcwd()
d_m... |
54b61e42bc69dcf655359bf2a792e015391ec2216bd51c7bc59b787659107b61 | Python | 795 | 25 | import numpy as np
import constants
domain_sizes = [32, 64, 128, 256, 512]
names = ['memory_entropy', 'memory_precision', 'memory_recall']
def print_row(domain, fname, data):
print(f'{domain},{fname}', end='')
for d in data:
print(f',{d}', end='')
print('')
if __name__ == "__main__":
dir_pref... |
41a835aaf040a10113c91608f7537a7ccdf65a0bc53741abc1d1546ceaed7e2c | Python | 796 | 36 |
import subprocess
import multiprocessing
import os
RS='/home/disk/database/data/ICS_scHIC/f03_atlas/single/rs01_getCount.R'
def Work(input_path,a):
print input_path
subprocess.Popen('/home/toolkit/tools/R4.2.0/bin/Rscript '+RS+' '+input_path,shell=True).wait()
fa=open('/home/disk/database/data/ICS_scHIC/f... |
62dca21253338289c2f2d039a99b0c712e5081354e8354351d4192ceba18b680 | Python | 796 | 22 | # 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... |
c5bb474c3d09187ed9b676e614fde6b8d338c1748d94647ed93b42684c87bdec | Python | 796 | 25 | from setuptools import setup, find_packages
with open("requirements.txt") as req_file:
requirements = list(filter(None, req_file.read().split("\n")))
setup(
name='VesselGen',
version=1,
packages=find_packages(),
package_dir={'VesselGen':
'VesselGen'},
include_package_data=Tr... |
da132a5301bbcb36edfb5d05b048cf97e7da5c91ed4c7b63caec912f04e06cea | Python | 796 | 27 | #-------------------------------------------------------------------------------
# elftools example: elf_show_debug_sections.py
#
# Show the names of all .debug_* sections in ELF files.
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#------------------------------------------------------------... |
58b4163f4c25b9f4885b55d054a0f14b8192f3268187b737f473fc002dfc62ed | Python | 797 | 29 | import os
import sys
import importlib
# Setting the correct config file
config_path = ".".join(["models", sys.argv[1]]) + "." if len(sys.argv) >= 2 else ""
config = importlib.import_module(config_path + "config")
output_FF_layers = [100, 2] #[4000, 1000, 100, 1] #[200, 200, 100, 100, 1]
cur_work_dir = os.getcwd()
d_m... |
9f14a7d84e97efcfd7da94b854ddc9f3948027146a41454a62eb352cb8dd252d | Python | 797 | 28 | # 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 Acosh(Base):
@staticmethod
def export() -> None:
node ... |
b45bee0dff27eaa06c34684223a016cd8d00bebc63c2acb12f7e44cb23473363 | Python | 797 | 27 | import json
import unittest
from pathlib import Path
import yaml
from pyontutils.ontload import identity_json
class TestIdentityJson(unittest.TestCase):
# TODO stability tests with values of known hash
def test_yamls_sl(self):
return self.test_yamls(sl=True)
def test_yamls(self, sl=False):
... |
83fb87c28790d80b844c4218caaa93cca02a3cbcb228bb4423dac22d835fa1ed | Python | 798 | 34 | import unittest
from pyontutils import clifun as clif
class TestClifun(unittest.TestCase):
def test_double_options(self):
class Options(clif.Options):
pass
o1 = Options({'a': True}, {})
o2 = Options({'b': True}, {})
assert not hasattr(o2, 'a')
assert not has... |
feab0e2745b80aaee141ff5bfc24d5fe2df5957b34d21684cc81a23eb8e25f1f | Python | 798 | 28 | # 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 Atanh(Base):
@staticmethod
def export() -> None:
node ... |
bca0b63e6ca08286686883cacb0d9fa2ea9155501f324227ee4a09aeea5b99fd | Python | 799 | 29 | import os
import sys
import importlib
# Setting the correct config file
config_path = ".".join(["models", sys.argv[1]]) + "." if len(sys.argv) >= 2 else ""
config = importlib.import_module(config_path + "config")
output_FF_layers = [100, 2] #[4000, 1000, 100, 1] #[200, 200, 100, 100, 1]
cur_work_dir = os.getcwd()
d_m... |
dc7e86afc50030152410f049e8bd2044c30d51769e0449c18fa28d9b035325b5 | Python | 799 | 30 | """
Analyze the saved data from 'testSpikeResetMechanismSpeed.py', since that experiment takes a long time to run
William Nourse
August 24th 2021
That feels weird, but I'll allow it
"""
import pickle
import numpy as np
import matplotlib.pyplot as plt
data = pickle.load(open('resetMethodComparisonData.p', 'rb'))
plt.... |
da564578f04999b46d873d4785b6d6ed1e6e4d3e1c2b7d988f0d2ad3552df899 | Python | 800 | 14 | """Util funcitons."""
from .plot_utils import _set_axes_equal, _set_axes_radius, _get_view, _rotate_data_to_viewingangle,\
_node_scale_vminvmax, _nrows_in_fig
from .coloring import _get_colorby_colors, _highlight_nodes, _highlight_edges, _colorarray_from_string, _detect_coloring_type
from .setti... |
df3e01ad1cdeb74701798c84cc0fbde3facaae6d56e5a8847ddd9bb97c1926f1 | Python | 800 | 31 | import logging
import numpy as np
import torch.nn as nn
class BaseModel(nn.Module):
"""
Base class for all models
"""
def __init__(self):
super(BaseModel, self).__init__()
self.logger = logging.getLogger(self.__class__.__name__)
def forward(self, *input):
"""
For... |
149385c0cda5a8aa614b9bb38ad970d83ffab2f3b44f669c4076974d5747cead | Python | 801 | 29 | # 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 Constant(Base):
@staticmethod
def export() -> None:
va... |
cfd955257ec2418344c37097258f4af56e8a0c6fe5a3c435df991dcc79ced5b3 | Python | 801 | 37 | #!/usr/bin/env python
__doc__ = """
Asynchronous Sampler
Nicholas Turner <nturner@cs.princeton.edu>, 2017-8
Kisuk Lee <kisuklee@mit.edu>, 2015-2017
"""
import os
import h5py
from queue import Queue
import threading
def sampler_daemon(sampler, q):
" Function run by the thread "
while True:
q.put(sa... |
9f1052714b3a1383ec05ec8eb0c5be47dc74af5a3ccdc3d36d197940e24e8e87 | Python | 802 | 32 | from camstim import MovieStim, SweepStim, Window
import logging
logging.basicConfig(level=logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
window = Window(fullscr=True,
monitor='testMonitor',
screen=1,)
g0 = MovieStim(movie_path="//aibsdata/... |
0c01b6a96f78887d7037f2eb9f7c82f5a0dc30241f5b7e3d3c37c89489d3c997 | Python | 803 | 29 | import os
import sys
import importlib
# Setting the correct config file
config_path = ".".join(["models", sys.argv[1]]) + "." if len(sys.argv) >= 2 else ""
config = importlib.import_module(config_path + "config")
output_FF_layers = [1000, 40, 1] #[4000, 1000, 100, 1] #[200, 200, 100, 100, 1]
cur_work_dir = os.getcwd(... |
c6a3799eaea44d8cc7e2b7946214c6b1c5a6eca07c3007db87f6781f69da470a | Python | 803 | 30 | """
Analyze the saved data from 'testSpikeMethodSpeed.py', since that experiment takes a long time to run
William Nourse
August 23rd 2021
For every church in Rome, there's a bank in Milan
"""
import pickle
import numpy as np
import matplotlib.pyplot as plt
data = pickle.load(open('spikingMethodComparisonData.p', 'rb'... |
5af6885e4921311b2b5f219ade6b49d1f5c01208e5b850ff60d00b9f2a455d9a | Python | 805 | 29 | import os
import importlib
import sys
# Setting the correct config file
config_path = ".".join(["models", sys.argv[1]]) + "." if len(sys.argv) >= 2 else ""
config = importlib.import_module(config_path + "config")
output_FF_layers = [4000, 100, 1] #[4000, 1000, 100, 1] #[200, 200, 100, 100, 1]
cur_work_dir = os.getcwd... |
8aa42d1103196982528efdf0cb4b34ae33432a76aeb754f021e2f2f4192973ad | Python | 805 | 29 | import os
import sys
import importlib
# Setting the correct config file
config_path = ".".join(["models", sys.argv[1]]) + "." if len(sys.argv) >= 2 else ""
config = importlib.import_module(config_path + "config")
output_FF_layers = [4000, 100, 1] #[4000, 1000, 100, 1] #[200, 200, 100, 100, 1]
cur_work_dir = os.getcwd... |
a8437df578ded4e9bece6714f67ce9d5fcbb1b11985156e7186ce184fdc9e14a | Python | 805 | 32 | """Import commonly used libraries"""
import time
import logging
import glob
import os
import numpy as np
import pandas as pd
import collections
# from natsort import natsorted
# matplotlib
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.rcParams['pdf.fonttype'] = 42 # editable text in matplotlib
mpl.rcPa... |
d94fbf6173934f8d5087c2b0a484871aa440d51d823a153183203dc10364338e | Python | 805 | 18 | gln_config = {
# try to use absolute path if possible
"dropbox": "./rxnebm/proposer/gln_openretro/data/gln_schneider50k/processed/",
"atom_file": "./rxnebm/proposer/gln_openretro/data/gln_schneider50k/processed/cooked_schneider50k/atom_list.txt",
"processed_data_path": "./rxnebm/proposer/gln_openretro/d... |
3042f89d44c76ac258517d0c91e63d77908cc07b556862daf65edd3c3e755d5d | Python | 806 | 25 | # 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 Clip_6(OpRun):
def _run(self, data, min=None, max=None): # type: ignore[override] # noqa: A002
amin = min
amax = ... |
368fec8d145bd939adb6ba08b2835634a264c90f2dd98289201beb83f7d5ef62 | Python | 807 | 28 | """
Test that elftools does not fail to load corrupted ELF files
"""
import os
import unittest
from elftools.common.exceptions import ELFParseError
from elftools.elf.elffile import ELFFile
class TestCorruptFile(unittest.TestCase):
def test_elffile_init(self):
""" Test that ELFFile does not crash when par... |
bf1cad1daa4161e928bfe8a2d109b19b0527c4b7d9cf09e5e388234d10090fbd | Python | 807 | 27 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from onnx.reference.ops.experimental._op_run_experimental import OpRunExperimental
from onnx.reference.ops.op_conv import im2col
class Im2Col(OpRunExperimental):
def _run(self, img, kernel_shape, ... |
d9c0e85d4c68736fc07071d650aecbdf80b9795ec2c8d25057635448da7494dc | Python | 807 | 28 | # 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 Softplus(Base):
@staticmethod
def export() -> None:
no... |
dcf8d832b2710403db57ee318d941770675a4ffbfb9f82dad8654277334fded2 | Python | 807 | 40 | # Configuration file for the Sphinx documentation builder.
# -- Project information
project = 'EvoAug'
copyright = '2021, KooLab'
author = 'KooLab'
release = '0.1'
version = '0.1.1'
# -- General configuration
extensions = [
'sphinx.ext.duration',
'sphinx.ext.doctest',
'sphinx.ext.autodoc',
'sphinx.... |
2a183ff5dc7ce4e298f9040266f858c0a2749f93968312cd67a328c7a0f9f7e7 | Python | 808 | 15 | import scanpy as sc
import numpy as np
import pandas as pd
import pickle
adata = sc.read("combined_all_organoids_v2_doubletDetection.h5ad")
adata.obs.rename({"doublet":"doublet_doubletdetection","doublet_score":"doublet_score_doubletdetection"},axis = 1, inplace = True)
with open("doublet_scores_scrublet.pl", "rb") as... |
2788131f6ec06c95453204f793bee1211194ed46c42ca58a265d9914972af330 | Python | 810 | 23 | """Time series classification datasets."""
from sktime.datasets.classification.acsf1 import ACSF1
from sktime.datasets.classification.arrow_head import ArrowHead
from sktime.datasets.classification.basic_motions import BasicMotions
from sktime.datasets.classification.gunpoint import GunPoint
from sktime.datasets.class... |
450a72c53bea24c9d48174f59f919facc24cb62b6d10fa149a4dfb1cd50914d7 | Python | 810 | 28 | """Dummy change point detector which detects no change points."""
from sktime.detection.dummy._zero_an import ZeroAnomalies
class ZeroChangePoints(ZeroAnomalies):
"""Dummy change point detector which detects no change points ever.
Naive method that can serve as benchmarking pipeline or API test.
Detect... |
fcf8721f566e30bd8b6c3cdc2ff16581f147bcd9e8fcacade8c429fee72e5518 | Python | 811 | 29 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""pt_expt wrapper for the analytical bridging pair potential."""
from typing import (
Any,
)
from deepmd.dpmodel.atomic_model.inner_potential import (
InnerPotential as InnerPotentialDP,
)
from deepmd.pt_expt.common import (
register_dpmodel_mapping,
torch... |
9e59f0da6b8b016b5a7b6c68f4dbb7eac2d2f081927257b1cc4aefadee0feb68 | Python | 812 | 17 | # Copyright (c) OpenMMLab. All rights reserved.
from .accuracy import Accuracy, accuracy
from .asymmetric_loss import AsymmetricLoss, asymmetric_loss
from .cross_entropy_loss import (CrossEntropyLoss, binary_cross_entropy,
cross_entropy)
from .focal_loss import FocalLoss, sigmoid_focal_... |
e5a97b8a6352d2cbb572a8022494ef504c89c751047d9853b9d9a022ccd7dbbc | Python | 814 | 25 | # Copyright (c) OpenMMLab. All rights reserved.
from argparse import ArgumentParser
from mmcls.apis import inference_model, init_model, show_result_pyplot
def main():
parser = ArgumentParser()
parser.add_argument('img', help='Image file')
parser.add_argument('config', help='Config file')
parser.add_a... |
6c5e97f14a69e06fc37d14f4c2240ca2653f3e8330ad93672352ecb1285ad1e2 | Python | 818 | 27 | """Clustering usage tests and examples."""
import numpy as np
from sktime.clustering.k_means import TimeSeriesKMeans
from sktime.clustering.k_medoids import TimeSeriesKMedoids
from sktime.datasets import load_arrow_head
def form_cluster_list(clusters, n) -> np.array:
"""Form a cluster list."""
preds = np.ze... |
08c861d5f0a823cfc60db0719feb26ad9cbdb5b37dd9c3bdba0ed93618ea0b8a | Python | 820 | 25 | import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
def power_spectral_density(sample1, freqs1, sample2=None, freqs2=None,
ax=None, palette=None,
sample_names=['observation', 'prediction'],
**kwargs):
if ax is No... |
32de40a6802848b930f942c7c300b521b3f97e16976b47de84e831a171459d34 | Python | 820 | 28 |
def _get_surface_level_for_template(template):
"""
Default values for different templates.
Only templates that differ from default (average between min/max value) need to be specified.
And these can generally be 1.
An important part in the surface detectoin is what the 0 values are.
print(temp... |
b9f6a66a4c3fe972eade837f904136e71b0aedc51b49fc9778ca203d80b75d56 | Python | 822 | 29 | import os
import sys
import importlib
# Setting the correct config file
config_path = ".".join(["models", sys.argv[1]]) + "." if len(sys.argv) >= 2 else ""
config = importlib.import_module(config_path + "config")
cur_work_dir = os.getcwd()
add_seq_cnn = True
add_parallel_cnn = False
output_FF_layers = [200, 1]
d_mode... |
7a48a07c43d4a8771e8b91c38a16d475ea0b5497688ad3773dee46e59850b502 | Python | 823 | 18 | import math
def adjust_learning_rate(optimizer, epoch, config):
"""Decay the learning rate with half-cycle cosine after warmup"""
if epoch < config['warmup_epochs']:
lr = (config['lr'] - config['min_lr']) * epoch / config['warmup_epochs'] + config['min_lr']
elif epoch < config['warmup_epochs'] + c... |
922dfe12df7d9ae6eda1189665d02f5d08a5a5b85a86a6d9ab1e068c570de234 | Python | 824 | 46 | # SPDX-License-Identifier: LGPL-3.0-or-later
from .base_fitting import (
BaseFitting,
)
from .density import (
DensityFittingNet,
)
from .dipole import (
DipoleFittingNet,
)
from .dos import (
DOSFittingNet,
)
from .ener import (
EnergyFittingNet,
EnergyFittingNetDirect,
)
from .fitting import (... |
fc498bbfe20d1936c0fb37e0b3ba49b9762bda3d43a9ac09a2b4c5696d4ae007 | Python | 825 | 29 | import unittest
import random
class TestExample(unittest.TestCase):
def setUp(self):
self.seq = list(range(10))
def tearDown(self):
pass
def test_shuffle(self):
# make sure the shuffled sequence does not lose any elements
random.shuffle(self.seq)
self.seq.sort()
... |
d218a945fc902a75d21b9b6066febce920e8efc653f6ecc0a3b0eebf0168de83 | Python | 826 | 31 | # 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 ArrayFeatureExtractor(Base):
@staticmethod
def export() -> None... |
de249d23cbe24ea3ce38536983350d1648c8e3948aaa9fe6e8396b302d6c5988 | Python | 826 | 23 | r"""
This package contains model blocks that can be used by the video prediction models.
"""
import sys
import inspect
from vp_suite.base import VPModelBlock
from .conv import DoubleConv2d, DoubleConv3d, DCGANConv, DCGANConvTranspose
from .enc import Autoencoder, Encoder, Decoder, DCGANEncoder, DCGANDecoder
from .phy... |
326654929dcf4d7f35155415c0b66bd56a2ecd77bf1198af9823eb3776069818 | Python | 827 | 44 | # SPDX-License-Identifier: LGPL-3.0-or-later
from .base_fitting import (
BaseFitting,
)
from .dipole_fitting import (
DipoleFitting,
)
from .dos_fitting import (
DOSFittingNet,
)
from .dpa4_ener import (
SeZMEnergyFittingNet,
)
from .ener_fitting import (
EnergyFittingNet,
)
from .invar_fitting impo... |
8127a628271f00ce3376b8f0c425d9e2af9b5ba2881376dea477b06722390c13 | Python | 828 | 26 | import click
import pandas as pd
from atom3d.datasets.datasets import LMDBDataset, make_lmdb_dataset
class UpdateTypes():
def __init__(self, df_keys):
self.df_keys = df_keys
def __call__(self,x):
if 'types' not in x.keys():
for key in self.df_keys:
if key in x and ty... |
e965f10c4db9a21f88f58079e4be8293c8316e8afde921be9cda4d5e02316842 | Python | 829 | 28 | def get_model_file(
model_name: str, target_str: str, val_fold: int, test_fold: int
) -> str:
res = "{}_D{}_V{}_T{}.pt".format(model_name, target_str, val_fold, test_fold)
return res
def get_output_file(
model_name: str, target_str: str, val_fold: int, test_fold: int
) -> str:
res = "{}_outputs_D{... |
f1db7f4e9425e4c78d7974d19875dc6c0109094707ec6fdef70bac64ae14e98e | Python | 829 | 22 | # First import G-related modules and classes
# Import some basic complex utilities
from lgn.g_lib.cplx_lib import mul_zscalar_zirrep, mul_zscalar_zscalar
from lgn.g_lib.cplx_lib import mix_zweight_zvec, mix_zweight_zscalar
# This is necessary to avoid ImportErrors with circular dependencies
from lgn.g_lib import g_ta... |
d372ad4fffd0e31b2ce15f62bd1ec5baf214519df6c98adbe9502e50a9085457 | Python | 830 | 36 | import numpy as np
from numpy.testing import assert_raises
from cnmodel.util import stim
from neuron import h
h.dt = 0.025
def test_make_pulse():
params = dict(
delay=10,
Sfreq=50,
dur=1,
amp=15,
PT=0,
NP=5,
)
assert_raises(Exception, lambda: stim.... |
1ea74429d781c70b0c471790e6fb62ae6911830f98c84acc39f42079f69b6132 | Python | 831 | 25 | import numpy as np
import torch
import atom3d.util.results as res
import atom3d.util.metrics as met
# Define the training run
name = 'logs/msp_test/msp'
print(name)
# Load training results
rloader = res.ResultsGNN(name, reps=[0,1,2])
results = rloader.get_all_predictions()
y_true = results['rep0']['targets']['test'... |
d7836f50f7d9dacf2b43c2cea761daf3fbfea904ed19a49df1c581f6900ce1dc | Python | 831 | 20 | from pyontutils import scigraph
from collections import defaultdict
import pandas as pd
import os
sd = scigraph.Dynamic('https://scicrunch.org/api/1/sparc-scigraph')
sd.api_key = os.environ.get('INTERLEX_API_KEY')
organ_records = {}
organList = sd.prod_sparc_organList()
organList_label_curies = [(node['lbl'], node['... |
fc21a50e5b797ef0201a3a83e0cc4c64917d83d9e9d904bb06f6e6941d329850 | Python | 831 | 30 | """Utility functions for testing bycycle."""
from functools import wraps
import matplotlib.pyplot as plt
###################################################################################################
###################################################################################################
def plot_te... |
10f49d8b4ab26753a61c57ec51e534b0947a605faddb1a2ea1d3d695b692331b | Python | 832 | 28 | # Copyright (c) OpenMMLab. All rights reserved
__version__ = '0.19.0'
def parse_version_info(version_str):
"""Parse a version string into a tuple.
Args:
version_str (str): The version string.
Returns:
tuple[int | str]: The version info, e.g., "1.3.0" is parsed into
(1, 3, 0),... |
9c72ba95f73f2af856cdb557a4f27f2487d32ee78273fe8d36922065bd9cee47 | Python | 832 | 18 | import numpy as np
import atom3d.util.results as res
import atom3d.util.metrics as met
labels = np.loadtxt('labels.txt', dtype=str)
conversion = {'A':1.0, 'B':1.0, 'C':1.0, 'mu':1.0, 'alpha':1.0,
'homo':27.2114, 'lumo':27.2114, 'gap':27.2114, 'r2':1.0, 'zpve':27211.4,
'u0':27.2114, 'u298':2... |
608e6e5d05da15aba4e015b1e018c65dec8b52b9b45443ce613dc490e7a37de5 | Python | 833 | 25 | from flair.nn import Model
def test_model_license_persistence(tmp_path):
"""Test setting and persisting license information for a model."""
# Create temporary file path using pytest's tmp_path fixture
model_path = tmp_path / "test_model_license.pt"
# Load a base model
model = Model.load("ner-fast... |
aede8a7b3e646aa46bbf85741a8ba06ef7a706d70503448b21d334bcedbccc92 | Python | 833 | 30 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
"""Check that C++ files do not hardcode the onnx namespace.
Other libraries that statically link with onnx can hide onnx symbols
in a private namespace, so the namespace should not be hardcoded.
"""
from __future__ import annotations
i... |
948c526048177bd88a9b91426d3013e587c21a1183e62876d7c9a71e27e089dd | Python | 834 | 33 |
import sys
fi=open('/home/database/annotation/hg38/gencode.v39.annotation.gtf.pc.sorted.bed')
E2G={}
for line in fi:
seq=line.rstrip().split('\t')
E2G[seq[3].split('.')[0]]=seq[4]
fi.close()
fi=open(sys.argv[1])
fo=open(sys.argv[2],'w')
this_tissue=sys.argv[1].split('/')[-1].split('.v8.')[0]
fi.readline()... |
5ee652b61402af1f6c6e7a07e67f5ad23d0ec4e8423ab78cee65fb992cea1001 | Python | 835 | 35 | # 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.latent_features.misc import get_entity_tripl... |
0d829085ef6a59c0420789bbe572f62549ce0994d5001f5f6916216568fe4edf | Python | 836 | 25 | # 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... |
d0749e1873449d85df190edb4c5c50d7fac1860f3dfb3860b34ef547722ffaff | Python | 836 | 24 | # 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
#
# ... |
ff4c0ca1988c18433ebca889144196f29709f4d3b8d009370e5203bfe62d8dc0 | Python | 836 | 24 | # 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
#
# ... |
7367975281bb8b5f63e589ce23fb0883cf804a567f4de9fc7a827ac797efac32 | Python | 838 | 24 | # 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
#
# ... |
f13a4140236328fce7304061c06b75a906189b86da9d6078a3d31aa7cdb3117e | Python | 838 | 24 | # 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
#
# ... |
18eb90db19e74e03764cde9f616cdd9d5282855eb758dd2cb069bc0a58d0632b | Python | 839 | 35 | import json
import numpy
class NumpyEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, numpy.integer):
return int(obj)
elif isinstance(obj, numpy.floating):
return float(obj)
elif isinstance(obj, numpy.ndarray):
return obj.tolist()
... |
353f7f235e720d92dc4cdd3697af0a0121c6c8c49d5e1ac19b248211d10c3dc9 | Python | 839 | 24 | # 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
#
# ... |
f35b579911946b2475c4e5a36524920102fff9753304425544e57f0a9577e539 | Python | 839 | 33 |
class Morphology(object):
"""
Base class for morphological structure
Provides the ability to read .hoc files for NEURON simulations.
"""
def init():
pass
def hocReader(self, filename=None):
"""
Access the hoc reader
Parameters
... |
0ee817caa1cb5b7de30590b4de50231664c30958e0e84eba057630a9934fdec8 | Python | 840 | 26 | from __future__ import annotations
import numpy as np
import pytest
from jetnet.utils import to_image
# 1 jet with 3 test particles
test_data_2d = np.zeros((3, 3))
test_data_2d[:, 0] = np.array([-0.5, 0, 0.5]) # eta
test_data_2d[:, 1] = np.array([-0.5, 0, 0.5]) # phi
test_data_2d[:, 2] = np.array([1, 1, 1]) # pt
e... |
4efa1882bac741ebaff0b901d0cd240aafececffd6d697cb2294f8ce79d6bc13 | Python | 841 | 24 | # 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
#
# ... |
9f1eb3a5462f8293add182e79acd1d62e28de7a1fc97a575364030daa5980706 | Python | 841 | 24 | # 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
#
# ... |
433eb7f3811260c282cfb89e475158118e1597c535d11f5fdb1ffbc49b568377 | Python | 842 | 24 | # 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
#
... |
6f0c103274871d889aa27c28805c65f1844adba030f3969cfde3c4b127221ac8 | Python | 843 | 35 | # 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 Size(Base):
@staticmethod
def export() -> None:
node =... |
9e7c31654ddac6693fc0183bfc984e97f26f0464201ecbab02ff62345bdad736 | Python | 843 | 24 | # 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
#
# ... |
93719948f34b4a928e3d5574d5668e80e591e9566ab4ff4144f94d0a0396bf44 | Python | 844 | 21 | # 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
#
# ... |
c427539f477ad3d115980d1b1b9ac6835bc20002ba9a4265c179af38e2808ad5 | Python | 844 | 29 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 24 11:58:52 2019
@author: wanglab
"""
import os, sys, pandas as pd, numpy as np
from skimage.external import tifffile
def check_patchlist_length_equals_patches(**params):
"""
checks to see whether the number of patches that are neede... |
ad4d355d42f09276edf35c3c6fdf5925a92d5ab9d277347d6592c0ceea0b21f0 | Python | 845 | 27 | # -*- coding: utf-8 -*-
"""
Setup details for ANLffr
Created on Thu Oct 10 19:00:08 2013
@author: hari
"""
from setuptools import setup, find_packages
setup(
name='ANLffr',
version='0.3.0a1',
author='Hari Bharadwaj',
author_email='hari.bharadwaj@gmail.com',
packages=find_packages(include=['anlffr... |
aa18af51a141608afb373c3ed9c0380fce679765e2f2808cc4e70ca9af016701 | Python | 846 | 24 | # 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
#
# ... |
be26548fbe293cc9619dd7d7e80205acef26119badb71f155c643991b1fd307e | Python | 846 | 24 | # 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
#
# ... |
8dfabaafb15c9520517c934207e6dddef3bc0dccaee1ed7fe183625abcd261f0 | Python | 847 | 36 |
import subprocess
import multiprocessing
import os
SCRIPT='/home/disk/database/data/ICS_scHIC/f03_atlas/eQTL/src/step04_tag2gene.py'
def Work(input_path,a):
print input_path
subprocess.Popen('python3 '+SCRIPT+' '+input_path+'.format/pair.bed '+input_path+'.format/tag.bed',shell=True).wait()
fa=open('/home... |
0c5a1bf9d94571603cbae0a671512d036a6488751aeb7fad240d0fed5b1e7369 | Python | 848 | 36 |
import subprocess
import multiprocessing
import os
SCRIPT='/home/disk/database/data/ICS_scHIC/f03_atlas/eQTL/src/step05_getUniq.py'
def Work(input_path,a):
print input_path
subprocess.Popen('python '+SCRIPT+' '+input_path+'.format/tag.bed '+input_path+'.format/tag_uniq.bed',shell=True).wait()
fa=open('/ho... |
23b29d89df7bad04282e44d2530f16f685747aa3dd3e8da72bdf830c4fc26c15 | Python | 848 | 24 | # 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
#
# ... |
2b5cd51fbb391575e81af4fddf788ed15e8df5c10b3ba7d5bc59ca29302d60d0 | Python | 848 | 48 | """
plot_intermediate_values
========================
.. autofunction:: optuna.visualization.plot_intermediate_values
:no-index:
The following code snippet shows how to plot intermediate values.
.. _visualization-plot-intermediate-values-plotly-content:
"""
import optuna
def f(x):
return (x - 2) ** 2
... |
688af0df01e61f408df621503c0f01c2d105a8a48f7f310d27fbf921d88c50f5 | Python | 848 | 24 | """Test function of DummyClassifier."""
import numpy as np
import pytest
from sktime.classification.dummy import DummyClassifier
from sktime.datasets import load_unit_test
from sktime.tests.test_switch import run_test_for_class
@pytest.mark.skipif(
not run_test_for_class(DummyClassifier),
reason="run test o... |
744cfa282a25c3479b2e611119da07345b25fe4bbfb1e83291ed62aeda72a2c1 | Python | 848 | 31 | # 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... |
c6e557a79789c6ef74ede16ae0f30f9f25d370319bab37886fcf5c1f8e6a9958 | Python | 848 | 28 | # 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
#
"""The module includes performance metrics for neural graph embeddings models,
... |
dc976e7de3b99ee1faf847af8c7d64baaed3732304e574a458e3a3371481d1f5 | Python | 848 | 30 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import functools
import warnings
from typing import TYPE_CHECKING, ParamSpec, TypeVar
if TYPE_CHECKING:
from collections.abc import Callable
_P = ParamSpec("_P")
_R = TypeVar("_R")
def deprecate... |
fbeae69ad4f21e3a971fbaa582f2066abb41ac02ad97df2b4227aed08d17ff39 | Python | 848 | 30 | import torch
from torch import nn
import timm
from torchvision import models
import torch.nn.functional as F
__all__ = ['Effnet']
class GlobalAvgPool2d(nn.Module):
def __init__(self,
device='cpu'):
super().__init__()
def forward(self, x):
return F.avg_pool2d(x, kernel_size... |
4a5c750d058b74754813f114c25af021e9c37c65e1179be3cdc78ca6016e5e05 | Python | 849 | 19 | import numpy as np
import atom3d.util.results as res
import atom3d.util.metrics as met
labels = np.loadtxt('labels.txt', dtype=str)
conversion = {'A':1.0, 'B':1.0, 'C':1.0, 'mu':1.0, 'alpha':1.0,
'homo':27.2114, 'lumo':27.2114, 'gap':27.2114, 'r2':1.0, 'zpve':27211.4,
'u0':27.2114, 'u298':2... |
72b592869e3d9ba55f328a0bd85584c1d914a31bea80e970a78bd2837c871ee4 | Python | 850 | 24 | # 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
#
# ... |
65a17c270beffbaba3e9428b4a1f37f634059a65bb19f8918a41d3ce0eb65d58 | Python | 851 | 36 | # 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
def swish(x: np.ndarray, alpha: float) -> np.ndarray:
return x * (1 / (1... |
8d9ad7a26706a73196e66718749c63d9dbbd6ed2d925b69498d185dbb4f5dd0c | Python | 851 | 31 | # copyright: skpro developers, BSD-3-Clause License (see LICENSE file)
"""Base class for data types."""
__author__ = ["fkiraly"]
from sktime.datatypes._base import BaseDatatype
class ScitypeAlignment(BaseDatatype):
"""Alignment data type. Represents an alignment of two or multiple time series.
Parameters
... |
906c3215f47e0697030eb4d4dc58f32aa0da4b4f0f2d3db23b5ab0a372c70e64 | Python | 853 | 29 | from netplotbrain import plot as npbplot
import pytest
# Plot only cloudy template
@pytest.mark.mpl_image_compare
def test_cloudytemplate():
fig, _ = npbplot(template='MNI152NLin2009cAsym',
template_style='cloudy',
view='SIP',
template_voxelsize=2)
... |
a0cbae7c9040f87c564325cb30db2e376c9fbb1042c4d8e1d46af6ee29297d59 | Python | 853 | 21 | # 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
#
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.