sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
5b0fd0cc83bfba38191dec4788937ce3c0e6fb6743aeb1171bb8c7f535c8dca8 | Python | 1,182 | 42 | # 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
def _argmax(data, axis=0, keepdims=True):
result = np.argmax(data, axis=axis)
if keepdims and len(result.shape) < len(data.shape):
... |
603d59e4d83724a5fb9fa2926980134681178812aca82b6965c32f77855841a3 | Python | 1,182 | 53 | """Isolated numba imports for _squared."""
__author__ = ["chrisholder", "TonyBagnall"]
import numpy as np
from sktime.utils.numba.njit import njit
@njit(cache=True, fastmath=True)
def _numba_squared_distance(x: np.ndarray, y: np.ndarray) -> float:
"""Squared distance compiled to no_python.
Parameters
... |
68c3e7b0c73aa1a730b08cc6cf175cbaf836b385e675caf41c9e24bf0ab187a2 | Python | 1,182 | 42 | # 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
def _argmin(data, axis=0, keepdims=True):
result = np.argmin(data, axis=axis)
if keepdims and len(result.shape) < len(data.shape):
... |
d96172e7750f4f0c5ae90bce223ce51d6a2fcd2816d13d4e10510375ecc814fb | Python | 1,187 | 31 | """Tests for bycycle.burst.amp."""
import itertools
import numpy as np
from bycycle.features import compute_burst_features
from bycycle.burst.amp import *
###################################################################################################
############################################################... |
5f40488e0c0d07a85d4210be160552c0043c5828d65195df2c2b1b2825173e45 | Python | 1,188 | 36 | # Copyright 2026 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... |
6926970a31040ada2083fc88e7e2110987a2ff2bef8a885b363d1d5c76eb4fbc | Python | 1,188 | 63 | import sys
ALL_LOOP=sys.argv[1]
L1SNP=sys.argv[2]
L1TSS=sys.argv[3]
L2SNP=sys.argv[4]
L2TSS=sys.argv[5]
fo=open(sys.argv[6],'w')
LOOP={}
fi=open(ALL_LOOP)
i=1
for line in fi:
seq=line.rstrip().split('\t')
LOOP['L'+str(i)]='\t'.join(seq[0:6])
i=i+1
f1=open(L1SNP)
f2=open(L2TSS)
SNP={}
TSS={}
for line in f... |
80d90570d6bcaff5b5362e65f9c09ea889ace4f29e559ea43cb2244b3df6fc21 | Python | 1,188 | 33 | #-------------------------------------------------------------------------------
# elftools example: elfclass_address_size.py
#
# This example explores the ELF class (32 or 64-bit) and address size in each
# of the CUs in the DWARF information.
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-... |
e0ef719e41e107e993ed88c0777197e23f8d45cbb37f72b279cdacfa5024fd73 | Python | 1,191 | 42 | import torch
# Source: https://github.com/UKPLab/sentence-transformers/blob/master/sentence_transformers/util.py#L23
def dot_product(a: torch.Tensor, b: torch.Tensor, normalize=False):
"""Computes dot product for pairs of vectors.
Args:
a: the left tensor
b: the right tensor
normaliz... |
3da04d374ebf372fe1a386e33eca47af9d07adb77857630aa6688cd8a665d14b | Python | 1,192 | 39 | """Nemenyi post-hoc test evaluator for benchmark results."""
__all__ = ["NemenyiTest"]
import pandas as pd
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.benchmarking.analysis._base import BaseBenchmarkAnalyzer
class NemenyiTest(BaseBenchmarkAnalyzer):
"""Nemenyi post-hoc test for p... |
85b5b9174f8f731c27e5c2840ca1b46eaa65db9a7780bb0a3f431bb39a19a5bf | Python | 1,192 | 36 | import siibra
import pytest
from typing import List
import sys
from siibra.features.tabular.regional_timeseries_activity import RegionalBOLD
from siibra.features.feature import CompoundFeature
skip_on_windows = pytest.mark.skipif(sys.platform == "win32", reason="Fails due to memory limitation issues on Windows on Gith... |
c67859ff7cf243beac95ac08f83aea41914cbb01b5e94baaab3859a77721fe1a | Python | 1,192 | 33 | # =============================================================================
# IMPORTS
# =============================================================================
import torch.nn as nn
import torch
import numpy as np
# =============================================================================
# FUNCTIONS
# =... |
ce13f592f5874c488b0215b9a333157b642d15ebd6a5a060bb22e16080582f13 | Python | 1,192 | 39 | # 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... |
f8a27f13009304fdeb0b4f567408c09a83c0807b2cb827f130d09cdfc8cd6aca | Python | 1,192 | 63 | """
"""
import pytest
import time
from camstim.zro.agent import Agent
TEST_SCRIPT = """
import sys
import json
print("HELLO TEST")
param_file = sys.argv[1]
"""
PARAMS = {
"test_param": 5,
}
LONG_SCRIPT = """
import time
time.sleep(10.0)
"""
@pytest.fixture(scope='module')
def agent():
return Agent()
de... |
a80912f3d2a42cb15878201ff368dc6b7ddbd488d3556ed10ca3fd97c14fc8f5 | Python | 1,193 | 40 | """Dataset for sktime deep learning estimators based on pytorch."""
__all__ = ["PytorchDataset"]
__authors__ = ["geetu040", "RecreationalMath", "srupat"]
import numpy as np
from sktime.utils.dependencies import _safe_import
Dataset = _safe_import("torch.utils.data.Dataset")
class PytorchDataset(Dataset):
"""D... |
9f6ed428c4b4165fbbc325045eff0ee721779bb156907b9780a431831a8516d6 | Python | 1,197 | 43 | from __future__ import print_function
import sys
import numpy as np
import pickle
import random
import string
from parameterSetup import ParameterSetup
from fileManagement import getFileIDs
#---------------
# main
splitID = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(4))
print('splitID... |
e0637971627543de2eb91ca92b3838424fb347d948ee6a65194493eeb9bb15d8 | Python | 1,197 | 39 | # 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... |
0b5f6cfd1a442e8dfd94ecfb00c83a8d4ffc0b271051bc6732059a99efc69613 | Python | 1,198 | 39 | # 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... |
2eb0f2f177f3a03d603f7d4dbd9f75cc0f418575e1fc7ea4cd3f24aa95efc8cc | Python | 1,198 | 43 | """
Tests control of monitor settings.
"""
import unittest
import sys
from camstim.gamma.calibrate import WinMonitor
class TestMonitor(unittest.TestCase):
def test_properties(self):
"""
Tests property setting/getting.
"""
mon = WinMonitor(0)
b_cur = mon.brightness
b_... |
5d3910b41b170e5925fe876ed935c9268a47af19098de6110c0505e714a8d1d0 | Python | 1,198 | 42 | # 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... |
6308a83a2750a968e49ab69ed6329d506fa23c6e43b7266426057a2d01d4308e | Python | 1,200 | 46 | # tifffile/tests/conftest.py
import os
import sys
if os.environ.get('VSCODE_CWD'):
# work around pytest not using PYTHONPATH in VSCode
sys.path.insert(
0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
)
if os.environ.get('SKIP_CODECS', None):
sys.modules['imagecodecs'] = None... |
ea59c648ede142154fc83ecf9f4546a87b816ae581b4b51948eacf75e2ba7e5a | Python | 1,200 | 42 | # 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.model import expect
class ShrinkTest(Base):
@staticmethod
def export() -> None:
... |
31c5612a0eb69a7dda1634cca2968bed3c0850700c7e639f5dc5f823c9ce735a | Python | 1,202 | 42 | import os
import sys
import unittest
from pathlib import Path
from tempfile import gettempdir
import pytest
from git import Repo
from neurondm.core import log
log.setLevel('DEBUG')
SKIP_NETWORK = ('SKIP_NETWORK' in os.environ or
'FEATURES' in os.environ and 'network-sandbox' in os.environ['FEATURES'])... |
4a984fc0fe3015884ae4a2222c355657b3773e2a7596511150db6c28dabc82d7 | Python | 1,202 | 49 | #!/usr/bin/env python3
import os
import csv
from glob import glob
from pathlib import Path
import rdflib
from pyontutils.utils import rowParse, async_getter
from pyontutils.scigraph import Graph, Vocabulary
try:
breakpoint
except NameError:
from IPython import embed as breakpoint
current_file = Path(__file__)... |
fab3b5a0b5738abef1847946e748ba62fa952fc99885fce440b6c8efeab9e819 | Python | 1,202 | 42 | import re
from setuptools import setup
def find_version(filename):
_version_re = re.compile(r"__version__ = '(.*)'")
for line in open(filename):
version_match = _version_re.match(line)
if version_match:
return version_match.group(1)
__version__ = find_version('htmlfn/__init__.py'... |
0dd1351973c4b0748d277a7235864d5aee49c437ee234f036eb0c5d6206b5c80 | Python | 1,203 | 24 | # 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... |
08dd62e4e7ea386bb43ff633003039f0d6a22166297079e53c9eed90f196ea08 | Python | 1,209 | 29 | import numpy as np
headerLineNum = 22
finalEpoch = 2160
pred_fp = open('../data/0523/2020-05-23_11-29-28_pred.txt')
test_fp = open('../data/0523/0523natsu_TG.csv')
lines = list(test_fp)
# header_lines = lines[:headerLineNum]
# [print(line, end='') for line in header_lines]
test_lines = lines[headerLineNum+1:]
### tes... |
0bfed7b023872ba793aa76fbb95277a11d143aa1e52cce1c1edc17590c990196 | Python | 1,209 | 47 | """
plot_edf
========
.. autofunction:: optuna.visualization.plot_edf
:no-index:
The following code snippet shows how to plot EDF.
.. _visualization-plot-edf-plotly-content:
"""
import math
import optuna
def ackley(x, y):
a = 20 * math.exp(-0.2 * math.sqrt(0.5 * (x**2 + y**2)))
b = math.exp(0.5 * (... |
172d61d4042a86a9918012b5ce8c5b5f9243ae54691af859e04c54589d1f0fe3 | Python | 1,209 | 40 | # 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... |
9c041b81ddde123aa868fb6c04a6fb2d17765a9e4c7d314108a33d5c6fe9a6d3 | Python | 1,210 | 36 | """
Discovering structure in heatmap data
=====================================
_thumb: .3, .25
"""
import pandas as pd
import seaborn as sns
sns.set_theme()
# Load the brain networks example dataset
df = sns.load_dataset("brain_networks", header=[0, 1, 2], index_col=0)
# Select a subset of the networks
used_network... |
8401017b07d31e15d167cb50b589668c9646879f50a56ef63520095d76d5f5d5 | Python | 1,212 | 43 | import pytest
import flair
from flair.embeddings import TransformerWordEmbeddings
from flair.models import TokenClassifier
from tests.model_test_utils import BaseModelTest
class TestWordTagger(BaseModelTest):
model_cls = TokenClassifier
train_label_type = "pos"
training_args = {
"max_epochs": 2,
... |
dccf7149afd3032c293fcae6038b8f559da661ec8b1108fffe439c8f8f8ff3b0 | Python | 1,212 | 39 | # 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... |
db3db858e74ba77b21348e03f929b59ebcd2d1f4fb0fbc0482a6456137d914f4 | Python | 1,213 | 41 | # 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... |
53ee4a7a1570d89933cc08d0d8b6f78efea886af3b421bb8d03d7de083277b0a | Python | 1,215 | 36 | # Put the seed sequences into a data frame
import pandas as pd
import numpy as np
def main():
datadir = "./data/seed_sequences/"
savedir = "./data/"
fasta_names = {'Mus musculus': 'Q8C8T7',
'Homo sapiens': 'P0C7U0',
'Taeniopygia guttata': 'A0A674HDW1',
'Pelod... |
1ef4fab8c3dbdaaa15a154cdb1a8151dc795100d17e14f127aff19e85cbb6656 | Python | 1,216 | 38 | from setuptools import setup
with open('README.md', 'r') as fh:
long_description = fh.read()
setup(
name='hmmix',
python_requires='>3.5, <3.10',
version = '0.8.2',
description='Find introgressed segments',
py_modules=['bcf_vcf', 'helper_functions', 'hmm_functions', 'main', 'make_mutationrate'... |
6461457bd4f8dd8db123cdca0f3239f3e6ee6aaafa61a94f34a89483fe948993 | Python | 1,219 | 38 | import sys
import logging
import pathlib
from datetime import datetime
from pytz import timezone, utc
class LogHelper(object):
log_format = '%(asctime)s %(levelname)s - %(name)s - %(message)s'
@staticmethod
def setup(log_path, level_str='INFO'):
logging.basicConfig(
filename=log_path... |
1518835271bbc1b566b4216bf02ceea4920c42a5e89f5f7fe74064f12034219e | Python | 1,220 | 34 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Cost functions for change point and anomaly detection."""
from sktime.detection.costs._base import BaseCost
from sktime.detection.costs._empirical_distribution_cost import (
EmpiricalDistributionCost,
)
from sktime.detection.costs._gaussian... |
fa96f1ab2efad66a66a99cc26c1e5139f4929239ebbfef0da6427cea50b0b059 | Python | 1,220 | 53 | from pathlib import Path
import sys
DOCS_DIR = Path(__file__).resolve().parent
REPO_ROOT = DOCS_DIR.parent
sys.path.insert(0, str(REPO_ROOT))
import graynet
project = 'graynet'
copyright = '2017, Pradeep Reddy Raamana'
author = 'Pradeep Reddy Raamana'
version = graynet.__version__
release = graynet.__version__
exten... |
08fcdea624a2af50ab48cd1b6262b51959f6999d7160d63f21ef4476fb250a6e | Python | 1,222 | 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... |
506a0cf1dd9d708f19e01fe9eca5fb14dbfc3162daef240083936289f1e248cc | Python | 1,222 | 45 | # 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 HannWindow(Base):
@staticmethod
def export() -> None:
... |
5ace47e09076cbf87a1a233ae4c2cfc864eebfa00b763ffd33d16a1b75c44614 | Python | 1,222 | 34 | # 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... |
6d2c30c0afd02647cb6c52015ecd98d087ec8038eb149cf9bee3653c89aa5a82 | Python | 1,222 | 55 | '''
printMoleculeInfo
@author: Nicholas Browning
'''
from __future__ import print_function
# Use this to print residue information
from builtins import range
import argparse
from src import MoleculeInfo as mi
import openbabel
def printResidueInfo(mol):
print("Num Atoms:", mol.NumAtoms())
print("Num Bonds:", ... |
99f4655cfe7fbae999c4fe075c1cfedd7cabf185d0e9b6d60ff522b5600c0228 | Python | 1,222 | 32 | #-------------------------------------------------------------------------------
# elftools tests
#
# Eli Bendersky (eliben@gmail.com), Santhosh Kumar Mani (santhoshmani@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import os
import unitt... |
afe3100243de3e47d232516f505eb9a1843f78631d0b6f14be1dc29cf8adde6a | Python | 1,223 | 35 | #-------------------------------------------------------------------------------
# elftools tests
#
# Karl Vogel (karl.vogel@gmail.com)
# Eli Bendersky (eliben@gmail.com)
#
# This code is in the public domain
#-------------------------------------------------------------------------------
import os
import unittest
fro... |
cb48e6a248738d4ed36a7774142b6e702b28bb725579f34aa5cac41878e80374 | Python | 1,223 | 36 | # 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... |
12be8c8a7a4ad4fc62698cdb6768bfe43aec158d34f0bf0963988005b9cf9508 | Python | 1,224 | 35 | #------------------------------------------------------------------------------
# elftools tests
#
# Seva Alekseyev (sevaa@sprynet.com)
# This code is in the public domain
#------------------------------------------------------------------------------
import os
import unittest
from elftools.dwarf.locationlists import... |
216cad5e30e38b03f9b3e893750afe749982d0dd0ab150ab0c3c7d6741bd35ab | Python | 1,225 | 37 | # 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... |
7da434e0d01b1cb005e5e9ce86d6d1a5aad282c3eb692c6de7f90c125a6ff8e7 | Python | 1,225 | 46 | """
plot_edf
========
.. autofunction:: optuna.visualization.matplotlib.plot_edf
:no-index:
The following code snippet shows how to plot EDF.
.. _visualization-plot-edf-matplotlib-content:
"""
import math
import optuna
def ackley(x, y):
a = 20 * math.exp(-0.2 * math.sqrt(0.5 * (x**2 + y**2)))
b = m... |
85c1aaa285fbbb2878acd21520bf9aa4847ffe216c2b630ee32bda675faf6e85 | Python | 1,227 | 46 | from __future__ import division
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
__all__ = ["palplot", "dogplot"]
def palplot(pal, size=1):
"""Plot the values in a color palette as a horizontal array.
Parameters
----------
pal : sequence of matplotlib colors
color... |
1994fc78a68ea8da687f8fd42c54d0d79efebd8fda9d82cc830920270c8879d6 | Python | 1,229 | 47 | import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from bandpassfilter import butter_bandpass_filter, butter_lowpass_filter, bandpass_kaiser
from scipy.signal import freqz
# Filter requirements.
order = 3
### cutoffFreq = 8 # desired cutoffFreq frequency of the filter, Hz
cutoffFreq = 30 # desired... |
2dffde94910d4625414a3dbb959e6759f66afca1c3294226bf2582cab7e707b3 | Python | 1,230 | 36 | # BASILISK: A generative, probabilistic model of side chains in proteins
#
# Copyright (C) 2010 Tim Harder and Jes Frellsen
#
# BASILISK is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... |
3af262b9baed3e7d2db048cd02cbc4b2be06a30685dc6d612f0791a965593fa4 | Python | 1,230 | 44 | # -*- coding:utf-8 -*-
"""Setuptools of castle."""
import setuptools
import sys
from castle import __version__
if sys.version_info < (3, 6):
sys.exit("Sorry, Python < 3.6 is not supported.")
with open("README.md", "r", encoding='utf-8') as fh:
long_desc = fh.read()
setuptools.setup(
name="gcastle",
... |
5d69048e52490d9e9a97052bc5f6fd1c055c88b4c1f9e23f3b16b872ef9cb7c0 | Python | 1,230 | 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... |
f5fbe6c6472da72d59bf68a8d62c3cfe31b42cd3f30cf1b12471caafa8160caf | Python | 1,230 | 27 | # settings for vanilla 2D Unet
# training parameters
import argparse
def configuration():
parser = argparse.ArgumentParser()
# Dataset arguments
parser.add_argument('--data_path', type=str, default='./data/interim/inputData/', help='Dataset path') # input of the data
parser.add_argument('--input... |
e4612eb75ddae5a87743575da6e4f0878928dc17ee2545d2f6c14dfc2f0cbaaf | Python | 1,232 | 38 | """
Compute mean input rates for each cell based on the revcorr data sets
This module is part of *vcnmodel*.
Support::
NIH grants:
DC R01 DC015901 (Spirou, Manis, Ellisman),
DC R01 DC004551 (Manis, 2013-2019, Early development)
DC R01 DC019053 (Manis, 2020-2025, Later development)
Copyright 2019 Pa... |
00f1724a17bbec2afaa8cc786b2827a9376319b7c15899513e8cc0e0da330cb1 | Python | 1,234 | 31 | # 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... |
a5aea3ff2393270c338a666431c79897e856872686397202502319ce885ffcb6 | Python | 1,239 | 42 | # 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
#
# ... |
39892f186fda4f6dab171febcab63374e8e9a2e8e5bf5d36715fbfa8368d3c7b | Python | 1,240 | 57 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 1 16:54:07 2022
@author: sudhanshu
Runs Prediction on Test Set
Usage: python predict_on_testset.py [model_directory: optional]
Returns: Dice scores, TP,FP,FN,TN for each pdb in Test directory
"""
import egnn.egnn as eg
import torch
from torch imp... |
373168c17c6ce79218dd46c8d0e62748223ec167c7407a98dc63406957881f91 | Python | 1,241 | 46 | """
Overlapping densities ('ridge plot')
====================================
"""
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(style="white", rc={"axes.facecolor": (0, 0, 0, 0)})
# Create the data
rs = np.random.RandomState(1979)
x = rs.randn(500)
g = np.tile(l... |
2cff389b439faff44c3b4253c4d05c24d9ae1091d20284a6b3fc5cc5c732ac08 | Python | 1,243 | 30 | import numpy as np
from tqdm import tqdm
def mvsecRectifyEvents(events, x_map, y_map):
"""
Rectifies the spatial coordinates of the input spike events in accordance to the given mapping matrices.
CAUTION: make sure events and maps correspond to the same side (DAVIS/left or DAVIS/right) !
:param event... |
7c3d38925c210215cb32899b6360b9d2f6e25d7e1098311fb39b4e2c51b40ea1 | Python | 1,243 | 36 | import tensorflow as tf
from tensorflow.contrib.rnn import LSTMCell, MultiRNNCell, DropoutWrapper
import numpy as np
#from tqdm import tqdm
class Critic(object):
def __init__(self, config, is_train):
self.config=config
# Data config
self.batch_size = config.batch_size
self.ma... |
d4312a7bc7af9d1d5f7e4e839266bfe4ace987161800b4cd6d93f30df073291e | Python | 1,245 | 32 | #------------------------------------------------------------------------------
# Enforce consistency of test naming for some testfiles.
#
# Seva Alekseyev (sevaa@sprynet.com)
# This code is in the public domain
#------------------------------------------------------------------------------
import os
import unittest
f... |
ed4c1ffc4d05941773473db0af2598f3241966e12c931defb8d7c29a2dc84eca | Python | 1,245 | 33 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from onnx.reference.op_run import OpRun
class SequenceMap(OpRun):
def _run(self, input_sequence, *additional_inputs, body=None, attributes=None):
if len(additional_inputs) == 1 and isinstan... |
ea89fc1708432167706271459c0e1bd4725bf864ee0f33e6b428d4afd41b33ea | Python | 1,246 | 42 | """Euclidean distance."""
__author__ = ["chrisholder", "TonyBagnall"]
from typing import Any
import numpy as np
from sktime.dists_kernels._numba_distances.base import DistanceCallable, NumbaDistance
class _EuclideanDistance(NumbaDistance):
"""Euclidean distance between two time series."""
def _distance_f... |
0f17b1c7cba9a3c7e405fbad12c93bc424fb564e2bdd5ec20c0557179ce21633 | Python | 1,247 | 39 | import torch
import torch.nn as nn
import torchvision
class ConvNet(nn.Module):
def __init__(self,model,num_classes):
super(ConvNet,self).__init__()
self.base_model = nn.Sequential(*list(model.children())[:-1]) # model excluding last FC layer
self.linear1 = nn.Linear(in_features=62720,out_f... |
8feed2f2cd9059e68da5023b8a2b2440150d784b1dd3cb1c75e9a903a6ef7b74 | Python | 1,247 | 37 | # 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 Elu(Base):
@staticmethod
def export() -> None:
node = ... |
dfe100bf974042b08124fd839ca5c048d3be30b0e07425bb9998aaa629d95b7e | Python | 1,247 | 29 | '''
Pure-python implementation of UCSC "liftover" genome coordinate conversion.
IntervalTree test module.
Copyright 2013, Konstantin Tretyakov.
http://kt.era.ee/
Licensed under MIT license.
'''
from pyliftover.intervaltree import IntervalTree
def test_intervaltree():
intervals = [(10, 20), (20, 30), (21, 31), (3... |
f68c5ecc41dafcc313686540b989d39b59bdf55ca143e3275d6b770da0cbc5e7 | Python | 1,248 | 27 |
#=======================================================================================================================
# Copyright (C) 2021 Matvey Safroshkin, Grigory Arutyunov, Patrick Mueller
# Computer Vision Studio
# Friedrich Miescher Laboratory of the Max Planck Society
# Systems Biology of Development, Univer... |
260ff28a9609aca8484efb91fdc279e8ae19ac6ca59e8dad1496496c91cb754d | Python | 1,249 | 58 | from seaborn._docstrings import DocstringComponents
EXAMPLE_DICT = dict(
param_a="""
a : str
The first parameter.
""",
)
class ExampleClass:
def example_method(self):
"""An example method.
Parameters
----------
a : str
A method parameter.
"""
de... |
e111de310a218f72ab9c54a91352fddcfdff4fa78eda8b0eea7fe54301449b3d | Python | 1,249 | 35 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops._op import OpRunReduceNumpy
class ReduceSum_1(OpRunReduceNumpy):
def _run(self, x, axes=None, keepdims=None):
axes = tuple(axes) if axes is not N... |
124b6246b4aa0c7da9ba8b1359d68d8dd0b638613af443caffb252f923a3575d | Python | 1,252 | 43 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.op_pool_common import CommonPool
class LpPool(CommonPool):
def _run(
self,
x,
auto_pad=None,
ceil_mode=None,
dila... |
f6b05ac4fdfd95ffa850698250769079b084f762fd24ae6015f68fea0bdfc984 | Python | 1,252 | 28 | # 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... |
fab8c870c14ac8c7542204af352440ca07d3c7dd6081d8e80b77d78b075e93f1 | Python | 1,252 | 36 | import cv2
import matplotlib.pyplot as plt
import numpy as np
from shapely.geometry import Polygon
from rect import Rect
__brain_dilation_kernel = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (9, 9))
def find_largest_polygon(mask, min_area=0.0005):
ctrs, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_A... |
92fc9be787de80b4807ad9d27d0e6f94bf332f14f96d2c707073cadd56f7d968 | Python | 1,253 | 22 | # Copyright (c) OpenMMLab. All rights reserved.
from .auto_augment import (AutoAugment, AutoContrast, Brightness,
ColorTransform, Contrast, Cutout, Equalize, Invert,
Posterize, RandAugment, Rotate, Sharpness, Shear,
Solarize, SolarizeAdd, ... |
aa287d0f6be661a4a34cc4222eb5553ccb85f9c1204ea79db6469f7342b264cc | Python | 1,253 | 35 | import os
import unittest
from pathlib import Path
import pytest
from git import Repo
from .common import skipif_no_net, _TestNeuronsBase, pyel, tel
class TestWrite(_TestNeuronsBase):
def test_0_write_py_after_load_none(self):
from neurondm import Config, Neuron, Phenotype
#config = Config('test-... |
fe2727362158b0867d6b698b96d7a280d399fd5b4b47f2c44b7470ac4f38b826 | Python | 1,254 | 49 | from __future__ import division
import os
import pylab as plt
from helper_lib.filelib import make_folders
class Profile(object):
"""
Class to handle the surface profile of an ellipsoid obtained after a cut by a xy, yz or xz plane.
"""
def __init__(self, r, theta):
"""
Generate a profi... |
0f4cf37e7b6ec6adb46075a294d6bad0aa0520929e71c88174be2b470cb61892 | Python | 1,256 | 39 | # 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 HardSigmoid(Base):
@staticmethod
def export() -> None:
... |
631723452c7c33c0b9adc441dcc4fd57ac6919516ad167ae35ae3398073c7e77 | Python | 1,256 | 43 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
from onnx.reference.ops.aionnxml.op_svm_helper import SVMCommon
class SVMRegressor(OpRunAiOnnxMl):
"""The class only implement... |
964c018a47bd714523c343e919de633fc55798c1917cf80138d4bb4c2dcdc321 | Python | 1,256 | 43 | # SAFE TEAM
#
#
# distributed under license: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) #
#
import numpy as np
def __padAndFilter(input_pairs, input_labels, input_len, max_num_vertices):
output_pairs = []
output_labels = []
output_len = []
for pair, label, len... |
2ad43ba6e6a9fc778197050f0afdc4776d6169ad43ef1dbd511cef714d37f547 | Python | 1,257 | 40 | # 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.utils.profiling import get_memory_size, get_human_readable_size... |
1a2b33682840483d48a17eed295f4d5f5caf1307ea8928099462d9965c3ba416 | Python | 1,258 | 38 | #!/usr/bin/env python
from __future__ import print_function
import os
import sys
import re
import argparse
desc = 'Remove all non-ascii characters from text file'
epi = """DESCRIPTION:
Output written to STDOUT
"""
parser = argparse.ArgumentParser(description=desc,
epilog=epi,
... |
7e1ba81a0a33c3e63c3875869f8d469da30bd2ea7095d44f95c1082fa6e35f54 | Python | 1,258 | 40 | import pytest
import os
import importlib
import torch
import numpy as np
import atom3d.datasets as da
import atom3d.splits.splits as spl
import atom3d.splits.sequence as seqspl
cutoff = 0.3
seq_dataset = da.load_dataset('tests/test_data/lmdb', 'lmdb')
@pytest.mark.network
def test_cluster_split():
cutoff = 0.3
... |
5cf79b24c09e3a1acebe4276f0af3fb748dae4138097b17e7ab315fe3de9484a | Python | 1,259 | 42 | """Tests for GGS module."""
import numpy as np
import pytest
from sktime.detection.ggs import GGS, GreedyGaussianSegmentation
from sktime.tests.test_switch import run_test_for_class
@pytest.fixture
def univariate_mean_shift():
"""Generate simple mean shift time series."""
x = np.concatenate(tuple(np.ones(5)... |
743876ffc28b0732aa89a4e0ebeca8679f1f2c3a1cd8b58340b94d2d94829387 | Python | 1,260 | 42 | import pandas as pd
import h5py
def map_id2name(ids, lut):
id2name = {}
for _, row in lut.iterrows():
id2name[row["ID"]] = row["region_name2"]
id2name[0] = "NaN"
return [id2name[i] for i in ids]
def map_id2color(ids, lut):
out = []
for i in ids:
row = lut[lut["ID"] == i]
... |
d0f4457d91fa8acf8c2c9e0fb121751a47d7e8704cc6131e52420a464488994a | Python | 1,260 | 38 | import numpy as np
from tensorflow import keras
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten
from tensorflow.keras.layers import Convolution2D, MaxPooling2D
from tensorflow.keras import layers
from tensorflow.keras.preproc... |
146df5bd106ebfce78ea7483fc25cf3d02835bb9ba3a9e26e257e62d14d4908f | Python | 1,261 | 35 | import numpy as np
import matplotlib.pyplot as plt
import time
import tensorflow as tf
gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
try:
# Currently, memory growth needs to be the same across GPUs
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)... |
76d7a78d4bca8376fd70f74332179e4f0629f16855b0d6fe634c3d651068f716 | Python | 1,261 | 32 | """DB5-specific functions."""
import collections as col
import os
def db5_ensembler(pdb_files):
complexes = col.defaultdict(list)
for f in pdb_files:
pdb_code = os.path.basename(f)[:4]
complexes[pdb_code].append(f)
ensembles = {}
for pdb_code, files in complexes.items():
if le... |
01bf5f75234de0c8928fb30b7f5514d4b3f183a18175c222fcb064ce46ec5ee5 | Python | 1,262 | 41 | # Code adapted from tensorflow to pytorch from https://github.com/josejimenezluna/xaibench_tf
from copy import deepcopy
from typing import List
import torch
from torch_geometric.data import Data
from molucn.feat_attribution.explainer_base import Explainer
class Diff(Explainer):
def __init__(self, device: torch.... |
313da62bac7809417f7d00adfbd59433f5435f28be629a7bc8361a11e18f2083 | Python | 1,262 | 40 | # 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... |
a62dcf550ad0bf21445f52582fe5e98fa7cc2bf0aee4b430c5d0e70a7b268545 | Python | 1,262 | 35 | import nbformat as nbf
from glob import glob
import numpy as np
# Collect a list of all notebooks in the content folder
loc = "maggot_connectome/docs/**/*.ipynb"
print(f"Looking for notebooks in: {loc}\n")
notebooks = glob(loc, recursive=True)
# Text to look for in adding tags
text_search_dict = {
"# HIDDEN": "re... |
d419a6e5b86e8f4276e066d61fd52ab34df14606debb6ceb7740c7a86c81cb0d | Python | 1,263 | 12 | import numpy as np
label_res_dict={0:'HIS',1:'LYS',2:'ARG',3:'ASP',4:'GLU',5:'SER',6:'THR',7:'ASN',8:'GLN',9:'ALA',10:'VAL',11:'LEU',12:'ILE',13:'MET',14:'PHE',15:'TYR',16:'TRP',17:'PRO',18:'GLY',19:'CYS'}
res_label_dict={'HIS':0,'LYS':1,'ARG':2,'ASP':3,'GLU':4,'SER':5,'THR':6,'ASN':7,'GLN':8,'ALA':9,'VAL':10,'LEU':11... |
1f52981e1cb1814556f19695286c976fafb3c573c5ad0897301156e9bad5bb76 | Python | 1,267 | 30 | """Module defining inputters.
Inputters implement the logic of transforming raw data to vectorized inputs,
e.g., from a line of text to a sequence of embeddings.
"""
from onmt.inputters.inputter import \
load_old_vocab, get_fields, OrderedIterator, \
build_vocab, old_style_vocab, filter_example
from onmt.input... |
69d7eadaca18c2311816ac5876d8aaef97bd0c771a5ae2c27a4fa49f15b4469c | Python | 1,268 | 44 | from scipy.sparse import find, csr_matrix
import pytest
import pandas as pd
import numpy as np
from palantir.utils import compute_kernel
# Test with DataFrame
def test_compute_kernel_dataframe(mock_data):
kernel = compute_kernel(mock_data)
assert isinstance(kernel, csr_matrix)
# Test with AnnData
def test_... |
2e3e1ca2dbd2e6fa96e318280e716f614ee1914f73a593b6ccf73dbc05ad6870 | Python | 1,269 | 41 | import torch
import extlib
try:
import extlib_cuda
except:
print('not loading cuda jagged ops')
from torch.autograd import Function
from torch.nn import Module
import numpy as np
#----------------------
# jagged_log_softmax
#----------------------
class JaggedLogSoftmaxFunc(Function):
@staticmethod
d... |
9ce29864d68ddd436d3997d5b5e0305a3aee25d9615da5900d96c59ab45b3fbe | Python | 1,269 | 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... |
de819f3c278ef2901a65788e35b6e6d9c942a6de3f7b315c5290937b239a2555 | Python | 1,269 | 38 | # 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... |
22171bf1d978074a1ff6a7a42aab96e594f3bc9344f676e11f86a37c03c7982c | Python | 1,270 | 57 | """
@file: model_config.py
Created on 05.12.23
@project: CrazyAra
@author: queensgambit
Model configuration file
"""
from dataclasses import dataclass
@dataclass
class ModelConfig:
"""Class which stores all model configurations.
Note not all models support all parameters."""
# all models
channels: ... |
41ec03f8d7a35124c49e16dc653408abcee86eb650ff6f611354f3aab827d463 | Python | 1,271 | 41 | import sys
import logging
import pathlib
from datetime import datetime
from pytz import timezone, utc
class LogHelper(object):
"""
Helper class to configure logger
"""
log_format = '%(asctime)s %(levelname)s - %(name)s - %(message)s'
@staticmethod
def setup(log_path, level_str='INFO'):
... |
591fca294b5fa67d1cd61304d71114641152212ab73c356faf4979bca9f48410 | Python | 1,271 | 28 | import numpy as np
import torch
import atom3d.util.results as res
import atom3d.util.metrics as met
# Define the training run
name = 'logs/rsr_test/rsr'
print(name)
# Load training results
rloader = res.ResultsGNN(name, reps=[0,1,2])
results = rloader.get_target_specific_predictions()
# Calculate and print results
... |
df02613055b6ff9b174cc06ba3cb8bcf8fedd464565f4fa0271df74e4a73f7eb | Python | 1,271 | 28 | import numpy as np
import torch
import atom3d.util.results as res
import atom3d.util.metrics as met
# Define the training run
name = 'logs/psr_test/psr'
print(name)
# Load training results
rloader = res.ResultsGNN(name, reps=[0,1,2])
results = rloader.get_target_specific_predictions()
# Calculate and print results
... |
2ae368d4c4b93a194a911d984eeaee542f6c66550c8925e59507db85f7d695d3 | Python | 1,272 | 30 | import numpy as np
from typing import Union, List
def flatten_spike_array(spike_times:Union[np.ndarray, List],
time_window:tuple=(0., 1.0),
isi_flag=False):
"""Make a spike array "flat" (e.g, just a list of spike times across all repetitions)
Optionally, do this ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.