sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e0c1b041740aa2fc56fe900f612269d3aefe2700cf3b4e072d819ca3889311f9 | Python | 3,150 | 71 | import sys
sys.path.append("..")
from tabulate import tabulate
from vp_suite.models import MODEL_CLASSES
from vp_suite.model_blocks import MODEL_BLOCK_CLASSES
from vp_suite.datasets import DATASET_CLASSES
from vp_suite.measure import LOSS_CLASSES, METRIC_CLASSES
def _build_table(info_list, header, title, out_filenam... |
100a5284ee31ea0659dc2dffba628a4df304d2623ef9eca6b027d46c6a0495d4 | Python | 3,152 | 68 | import dxpy
import subprocess
import time
import sys
import ast
def latest_job(name_string,project):
# --origin-jobs
job_id = subprocess.check_output('dx find jobs --name {0} --origin-jobs --state done --brief --project {1}'.format(name_string,project),shell=True)
job_id = job_id.strip().split('\n')
... |
2aadb2471cbc66ee8e163b3633c6d89c06acf1f1b84c39d6ecd585f504895dc7 | Python | 3,152 | 98 | # 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... |
4804136fa954fb0781fe7c4074f5d885b3816b04c16a08b7ee8b5ea1f4813a37 | Python | 3,154 | 98 | import pytest
import numpy as np
import pandas as pd
# Skip all tests in this file if pygam is not installed
try:
import pygam
except ImportError:
pytestmark = pytest.mark.skip(reason="pygam not installed")
# Handle scipy compatibility issues
try:
import scipy.sparse as sp
test_matrix = sp.csr_matrix(... |
c2560e3f3176e862f4c9ead65865d324ce2fe81b69d57161a4a363796be9f11e | Python | 3,155 | 75 | """Unit tests for early classifier input output."""
__author__ = ["mloning", "TonyBagnall", "fkiraly", "MatthewMiddlehurst"]
import numpy as np
from sktime.classification.tests.test_all_classifiers import (
TestAllClassifiers as ClassifierTests,
)
from sktime.tests.test_all_estimators import BaseFixtureGenerator... |
2276de2ca36ce4ceebf4a152785ece6d70d759e718b91765b78da203433a6506 | Python | 3,160 | 84 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Tests the aliasing logic in the Tag Aliaser."""
from sktime.base import BaseObject as _BaseObject
from sktime.base._base import TagAliaserMixin as _TagAliaserMixin
class AliaserTestClass(_TagAliaserMixin, _BaseObject):
"""Class for testin... |
aecef5e727759801a8f2623f9c93a27f3c22596f6dd2647b8bda6fb1120390fb | Python | 3,163 | 63 | from setuptools import setup, find_packages
import os
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='bcblib', # This is the name of your PyPI-package.
version='0.7.2', # Update the version number for new releases
# data_files=[('priors', [... |
a2b544ca470e1c9f3246914982dbbb2f1bec4a1d0e81c2aa2796488723d604c6 | Python | 3,164 | 77 | # 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... |
b6392cc707b5be2003b33f1ff18ee5ce574e5d2e35afab577f9cdd666e098fd9 | Python | 3,164 | 117 | import json
import os
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
from myst_nb import glue as default_glue
def _handle_dirs(pathname, foldername, subfoldername):
path = Path(pathname)
if foldername is not None:
path = path / foldername
if not os.path.isdir(path... |
b76bd80f74b17c88ebd5dc3257bc1f0f4ea125e9c2b03d7e1203a156ab7958f3 | Python | 3,166 | 87 | # 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... |
c7fb5c0e3606e3fc30215df74ab3572b5305ad930ab412f6bea24196f1721442 | Python | 3,166 | 106 | # -*- coding: utf-8 -*-
"""
Created on Thu December 10 11:41:02 2022
@author: Pawan Panwar, Quanpeng Yang, Ashlie Martini
PyL3dMD: Python LAMMPS 3D Molecular Dynamics/Descriptors
Copyright (C) 2022 Pawan Panwar, Quanpeng Yang, Ashlie Martini
This file is part of PyL3dMD.
PyL3dMD is free software: you can redistri... |
42c4c7de61dd565ae0cc4cb65b3f527a062b1ecf183f856915c1238fe0d9b0ce | Python | 3,167 | 125 | #%%
import datetime
import time
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from graspologic.embed import AdjacencySpectralEmbed
from pkg.data import load_split_connectome
from pkg.io import OUT_PATH
from pkg.io import glue as default_glue
from pkg.io import savefig
fro... |
2a51ae9166271d3ab18988831dc876bf97860db942d2fdd2fa6dfe5fe61c3054 | Python | 3,170 | 91 | # Copyright 2018-2023
# 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... |
448c754227372b55c367ba89baa10e35cd3d1e8343cda4b3a518c44cd4088ec4 | Python | 3,170 | 96 | import qiime2.plugin
import qiime2.sdk
from qiime2.plugin import (Str, Int, List,
MetadataColumn, Categorical)
from q2_matchmaker import __version__
from q2_matchmaker._type import Matching
from q2_matchmaker._method import (
negative_binomial_case_control,
matching
)
from q2_types.f... |
9ac022c008c29e2d40eb998dc3d01a481bdada386c7d51dc458ffdb8d1783950 | Python | 3,170 | 83 | # 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... |
460b1d3bc110e24ed3b1bd7021b1ebe8b3035715ac44021f933485edea336f9a | Python | 3,178 | 107 | # 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... |
830f4d5c03a119cac41ea1e71108304a00dd6eff9cfcc9cda2fa0d7b4f26cee2 | Python | 3,179 | 112 | """
Create presynaptic and postsynaptic neurons, automatically connect them with
a synapse, stimulate the presynaptic cell, and analyze the resulting PSCs
in the postsynaptic cell.
"""
import faulthandler
faulthandler.enable()
import os, pickle, pprint
import numpy as np
import neuron
import cnmodel
import cnmodel.ce... |
10eba190eba87a9a3938e9920a190a489d06e6ec665279ca573d482357604ba0 | Python | 3,180 | 89 | from typing import List, Tuple
from molucn.filter import get_num_cmn_sites
import numpy as np
from sklearn.metrics import f1_score
from torch_geometric.data import HeteroData
f_score = lambda x, y: f1_score(x, y, zero_division=1)
EPS_ZERO = 1e-8
def aggregated_color_direction(
color_pred_i: List[float],
co... |
1213a8261742e2f54e90c4359d54e16af6c252f8bdad6f3d1b4deabd1c472c84 | Python | 3,181 | 92 | # 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... |
7b9b7707f681e44289ceb14983914596be7fac675ded79ea03acd228f2784212 | Python | 3,182 | 91 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx import TensorProto
from onnx.helper import np_dtype_to_tensor_dtype, tensor_dtype_to_np_dtype
from onnx.reference.op_run import OpRun
from onnx.reference.ops._quant_utils im... |
051f46b7e53404858ece818688f1420e8fdafe36ee39f1e20587ec70f9855601 | Python | 3,183 | 102 | import duckdb
import pyarrow as pa
import pyarrow.parquet as pq
import pandas as pd
import glob
import numpy as np
import pyarrow.feather as feather
import sys
import molbeam
import similarity
dataset_dir = sys.argv[1]
output_dir = sys.argv[2]
csv_file = sys.argv[3]
fp_size = int(sys.argv[4])
fp_radius = int(sys.argv[... |
ffe7068a8effa2e82408c3a6d680b6e2e12a239a560622efd9a665b4ea721b06 | Python | 3,185 | 94 | # 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... |
04992529d057ad7822e48ddb693435c2593984652a7c0075611dd90e3592859e | Python | 3,186 | 80 | import logging
import numpy as np
import pyqtgraph.multiprocess as mp
from .population import Population
from .. import cells
class SGC(Population):
"""A population of spiral ganglion cells.
The cell distribution is uniform from 2kHz to 64kHz, evenly divided between
spontaneous rate groups.
"""
... |
0b7287420e81c3f0657919a1b7c4409cfecea4232bc5d6f9c8b8ee9a871dd876 | Python | 3,186 | 93 | # copyright: skpro developers, BSD-3-Clause License (see LICENSE file)
"""Base class for data types."""
__author__ = ["fkiraly"]
from sktime.datatypes._base import BaseDatatype
class ScitypeTable(BaseDatatype):
r"""Data Frame or Table data type.
The ``Table`` data type is an abstract data type (= :term:`sc... |
c26874aa0f18631ac9f2691487fab96dd8ae2f6e83f9e8cd580756ebba99c1d2 | Python | 3,186 | 73 | # ----------------------------------------------------------------------------
# Copyright (c) 2017-2026, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... |
841264ee1fea2ea7ddf38c20afe549e1335f5d3d22a9200d6ab94e93d9283fc6 | Python | 3,189 | 95 | """
Test generating a series of EPSPs in a bushy cell in response to tone pip.
This script:
1. Creates one SGC and one bushy cell.
2. Connects the two cells with a synapse.
3. Specifies a tone pip input to the SGC cell.
4. Records the bushy cell Vm.
The auditory nerve spike train is generated automatically by the Du... |
4ada51acc9618d8658194419e4eb74af1d34668312d4c5f320f5bab2ecf64297 | Python | 3,190 | 107 | import datetime
def get_years(start_year=2021):
year = datetime.datetime.now().year
if year > start_year:
return f'{start_year} - {year}'
else:
return f'{year}'
# -- Project information -----------------------------------------------------
project = 'cebra'
copyright = f'''{get_years(2021... |
f9c3025643fdc69d2e0be5760dc563af34157b84b4781b1df36d761e4a318d2b | Python | 3,190 | 86 | # 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... |
a709ac124a663ad137ad0408387c3a5692da1d07baee85161eface9063009e83 | Python | 3,191 | 117 | import sys, os
import numpy as np
def main(*args):
if len(args) > 3:
print("Too many args")
print(
"USAGE: python3 mot_to_absolute.py [path_to_source_file] [path_to_target_dir] OPTIONAL [--include_confidence]"
)
sys.exit(0)
elif len(args) < 2:
print("Too fe... |
a74e52f6894c3ab67fbc856820941ac83e38c9f6fba22c4789ec8b1ff2cbafd9 | Python | 3,191 | 104 | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 15 17:48:41 2016
@author: daniel
"""
import pandas as pd
import json
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
def mg_block(mg, alpha, v, eta = 1/3.57, x_offset = 0):
block = 1 / (1 + mg * eta * np.exp(-alpha * (v + x_offset)) )
ret... |
98c240d406b903b28788c60f10440b190c4558cc0ed88cf3c2cf23b739c4a193 | Python | 3,193 | 110 | #!/usr/bin/env python3
"""
This tool is intended to serve as nexus between openbabel and pyRDTP. Note
that it uses the vasp file format to read and write from pyRDTP, so many things
will not be preserved when a conversion is performed.
"""
import os
from tempfile import mkstemp
from openbabel import pybel
from pyRDTP ... |
bb8bc65ceb9ff4217f8ba61ef7d02f934f9518f665a9b2b3d2019bf11a15fc31 | Python | 3,194 | 110 | import os
import random
import sys
import librosa
import numpy as np
import pandas as pd
from transformers import HfArgumentParser
from preprocessing.helpers import prepare_data
from utils.arguments import DataArguments, AudioArguments
from utils.constants import (
SEED,
PATIENT_DF_FILE,
SAMPLES_DF_FILE,
... |
112cf7562b1dbc09fff0a511252e996500e21094e7c052da999a907bb643bd33 | Python | 3,197 | 111 | #!/usr/bin/env python
import sys
import logging
import glob
import numpy as np
from PIL import Image
from skimage.transform import resize
import os
import re
import subprocess
import numpy
BIN = os.path.join(os.path.dirname(__file__), "jpegdir", "jpeg")
if not os.path.exists(BIN):
print("jpeg is not built yet; us... |
2a9883b7bff8831c9506127afa967104be5bfa6b64aa609c54d5427181f9bd13 | Python | 3,197 | 54 | import importlib
class AlgorithmFactory:
def __init__(self, params, extractorType):
self.params = params
self.extractorType = extractorType
def generateExtractor(self):
# print('@@@@@@@ in AlgorithmFactory, extractorType = ' + self.extractorType)
if self.extractorType == 'clas... |
d2fd58961b05be1a08356415917bb997cc60313da1645b7f5e3bb110d76acc7f | Python | 3,197 | 82 | # Copyright 2018-2022
# 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... |
74bbb8c4f4c90f705d8f966c3ca0170737c3305c06151dc5e889f5636bc272d0 | Python | 3,198 | 84 | # 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.latent_features import optimizers
import pytest
import tensorf... |
849a61e77d6bb2f1fe80a043e77778e2e84f6e7cd1a0218fc7f565aac4c543af | Python | 3,201 | 111 | import pytest
import pandas as pd
import numpy as np
from anndata import AnnData
import palantir
@pytest.fixture
def mock_adata():
n_cells = 10
# Create mock data
rng = np.random.default_rng()
adata = AnnData(
X=rng.random((n_cells, 3)),
obs=pd.DataFrame(
{"palantir_pseudo... |
942c74157a825f1ca9d10672cef927403f9945de4db8bbd888ed07509839c9f6 | Python | 3,201 | 104 | import torch
from torchvision import transforms
from packaging import version
def data_transforms(cfg):
data_aug = cfg.data.data_augmentation
aug_args = cfg.data_augmentation_args
input_size = format_input_size(cfg.data.input_size)
operations = {
'random_crop': random_apply(
trans... |
c3444b8768a6638e7e5b40575e90b167337a6e68e54245edd47c4e7559b83f58 | Python | 3,201 | 76 | # 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... |
4d87b455192b72a8597ce9eade91dbf3c686748682ea0d17742a797094836dc3 | Python | 3,202 | 78 | #-------------------------------------------------------------------------------
# elftools tests
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import os
import unittest
from elftools.elf.elffile import ELFFile
... |
e329395e7ff784a3d48b6aaecf740995811e27baa515b57229ab528ebe893fce | Python | 3,202 | 111 |
import numpy as np
import pandas as pd
import pytest
from seaborn._core.rules import (
VarType,
variable_type,
categorical_order,
)
def test_vartype_object():
v = VarType("numeric")
assert v == "numeric"
assert v != "categorical"
with pytest.raises(AssertionError):
v == "number... |
2ac0d849f7439682922035e874bcdc876b6002d439d2e3b384c175d8cf3fcadb | Python | 3,203 | 108 | import re
import os
import sys
from pathlib import Path
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)
_... |
e33b42a0e9b1fbcf29fc848e4855651151ae266d98f65c1dae5c49c1af65d2d9 | Python | 3,205 | 64 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 19 16:09:41 2019
@author: wanglab
"""
import cv2, numpy as np, os
from skimage.external import tifffile
from utils.io import read_roi_zip, swap_cols
#
#roifld = "/home/wanglab/mounts/wang/zahra/conv_net/annotations/prv/201905_human_curated_inputs_v... |
2d23a56a95e2cf111717191ca9924cb46e217cdeaa51794d4aab86e9f2579b8b | Python | 3,206 | 102 | # 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... |
70227c89525ccc2b90c3392561169b65a247e28478bab71084271c8a8c167877 | Python | 3,207 | 88 | #!/usr/bin/env python3
"""Prepare matched Illumina/Nanopore Visium spots from the post-MI study."""
from __future__ import annotations
import argparse
import sys
from pathlib import Path
import anndata as ad
import numpy as np
import pandas as pd
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
... |
064b76d543b39360b57d97e14a68798d6822fffc18156771c48e3ead60d9fe5d | Python | 3,208 | 105 | # 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
#
# ... |
e1e1d1f1c370bbe892b5961c47d89745c14a7de557446f70166e2759c72ff961 | Python | 3,208 | 90 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import math
import numpy as np
from onnx.reference.ops._op import OpRunReduceNumpy
def _mean(data, axes, keepdims):
# Preserve NumPy's precision and fast path for ordinary finite results.
wit... |
fa312436a9105f3f38680bc690973a0c527a8cad368fdeef68927d500dddf8a9 | Python | 3,209 | 83 | # 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
import tensorflow as tf
from ampligraph.latent_features impo... |
01cf2d5e594fc62b2e6aede94916cd3bcbdce4090e9483b419018660645893cd | Python | 3,210 | 88 | import pytest
import os
import torch
import numpy as np
import atom3d.datasets as da
import atom3d.splits.splits as spl
# -- Test the general split function. --
def test_split():
# Load LMDB dataset
dataset = da.load_dataset('tests/test_data/lmdb', 'lmdb')
# Split with defined indices
indices_train,... |
059e5ef851f9f428e86691bf084ff5d3b8dbab92450a823e8f80d089718b4dd0 | Python | 3,211 | 86 | # 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... |
5c7c7d9169a1c7782dbe9dd833c280c69b8b6043e35804c2b7a86154514f9e48 | Python | 3,211 | 106 | # 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... |
33b6157120cde26d2791435bb6da5bf119b0da8e0628923efbfb4631d52eb162 | Python | 3,213 | 118 | import pytest
import numpy as np
from dolfin import *
from ffian.zero_flow_model import ModelBase
from ffian.zero_flow_model import Model
from ffian.zero_flow_model import Solver
import matplotlib.pyplot as plt
def project_to_function_space(mesh, u):
""" Project u onto function space """
CG1 = FiniteElement... |
540768a17cc3c44d08f37e7254ddb342bf95973b50d6a4d37a9854867ebd5919 | Python | 3,213 | 100 | """
This script produces figure 4d of the paper.
This is the fitted kernels for a neuron during the passive condition.
"""
import pandas as pd
import pickle as pkl
import numpy as np
import os
import glob
import matplotlib.pyplot as plt
import matplotlib as mpl
from tqdm import tqdm
# Plotting
import sciplotlib.polis... |
84045e3173a85887937e6d92c4f3916795ec2e5a077037f826c856617f1919dd | Python | 3,213 | 121 | # 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... |
1b31e1d4a312855c9c9770f92e06dd8812a9be6eeb1c66da9e2d1d429d3d39b4 | Python | 3,214 | 80 | """Tests for _SktimeRegistry duplicate ID warning message."""
__author__ = ["NAME-ASHWANIYADAV"]
import warnings
import pytest
from sktime.benchmarking.benchmarks import _SktimeRegistry
from sktime.classification.dummy import DummyClassifier
from sktime.tests.test_switch import run_test_module_changed
@pytest.mar... |
3ada1ca5162e6260bddb78fb0c4d272d57db8325c5407d2d862348d975d9e2c5 | Python | 3,214 | 75 | import matplotlib.pyplot as plt
import numpy as np
import pickle
data = pickle.load(open('dataBackendTimesNonspikingSparse.p', 'rb'))
numNeurons = data['shape']
npRawTimes = data['numpy']
npAvgTimes = np.mean(npRawTimes,axis=1)*1000
npVar = np.std(npRawTimes,axis=1)*1000
torchCPURawTimes = data['torchCPU']
torchCPUA... |
b1aad50ccf15a21a50e872b72a3358deb432e60c1920093c67ea07f58b0838bc | Python | 3,215 | 107 | """
The Singular Angle Similarity (SAS) Score is introduced in
Albers, Kurth et al. (2024)
doi: doi.org/10.5281/zenodo.10680478
https://github.com/INM-6/SAS
"""
import numpy as np
import sciunit
class singularangle(sciunit.Score):
"""
The singular angle score evaluates whether two real matrices have similar
... |
c595fdaaf221d8c001b696fece4477debcd9496673fbf6ee5aee3532960e0357 | Python | 3,217 | 89 | # 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... |
f71e5723831c64e4b5ee18945c4fd9570b1372a04ec29ce0e0aaecec5acafe48 | Python | 3,217 | 106 | default_config = {
"train_batch_size": 512,
"finetune_batch_size": 5000,
"transfer_batch_size": 512,
"train_epochs": 50,
"finetune_epochs": 50,
"transfer_epochs": 50,
"train_task": "supervised_group_identification",
"finetune_task": "supervised_group_identification",
"transfer_task":... |
52a54c4e5ad39931969e9f4276df91d46f49757a724ec4b67c8819210781666a | Python | 3,218 | 62 | import pandas as pd
import numpy as np
from scipy.stats import hypergeom
from statsmodels.stats.multitest import fdrcorrection
import matplotlib.pyplot as plt
df_overlap = pd.read_csv('num_pairwise_intersection_genes_donor.txt', sep = '\t', header = 0, index_col = 0)
df_meta = pd.read_csv('num_pairwise_intersection... |
8c219541790e5818b23bed9d1981fe78e6cc7446bdc7d4a38943267fd7bdcf94 | Python | 3,219 | 83 | """
@file: densenet.py
Created on 03.04.19
@project: CrazyAra
@author: queensgambit
Adaption of the Desnet architecture to process crazyhouse or chess games
Densenet - Densely Connected Convolutional Networks" <https://arxiv.org/pdf/1608.06993.pdf>.
introduced by Gao Huang, Zhuang Liu, Laurens van der Maaten.
The nai... |
f8da163ca873987bf963fd17b14c5a03ab60c10f9a8b88bc1391c0b31a0986b4 | Python | 3,220 | 96 | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
from mmcv import Config
from mmdet.apis import inference_detector
from mmdet.models import build_detector
from mmcls.models import (MobileNetV2, MobileNetV3, RegNet, ResNeSt, ResNet,
ResNeXt, SEResNet, SEResNeXt, SwinTransform... |
13ca07ceb14985f9d43157fb9296f0581a4e124fabaeae401c960b733190a149 | Python | 3,221 | 88 | import os
import pickle
import random
import time
from concurrent.futures import ProcessPoolExecutor as Pool
from pathlib import Path
from typing import List, Optional, Tuple, Union
import nmslib
import numpy as np
import rdkit
import scipy
from rdkit import Chem, DataStructs
from rdkit.Chem import AllChem
from rdkit.... |
b022e7f0cf5e26f63d05e574c93d5c45405b90da63e03ed46f08a37a4b446634 | Python | 3,223 | 105 | #!/usr/bin/env python3
# This is a demo of detecting eye status from the users camera. If the users eyes are closed for EYES_CLOSED seconds, the system will start printing out "EYES CLOSED"
# to the terminal until the user presses and holds the spacebar to acknowledge
# this demo must be run with sudo privileges for... |
a0f77b29d69b656c743437139ea5f54e290d6d43019b1d468750d18096a6068e | Python | 3,226 | 76 | import matplotlib.pyplot as plt
import numpy as np
import pickle
data = pickle.load(open('dataBackendTimesSpikingDense.p', 'rb'))
numNeurons = data['shape']
npRawTimes = data['numpy']
npAvgTimes = np.mean(npRawTimes,axis=1)*1000
npVar = np.std(npRawTimes,axis=1)*1000
torchCPURawTimes = data['torchCPU']
torchCPUAvgTi... |
cfd5e342a11ccbd0ae38c9ffafccdbc17dcc2b2231c0195e8ae1c4d1dc4f0324 | Python | 3,227 | 99 | from jetnet.datasets import utils
import numpy as np
import pytest
test_data_2d = np.random.rand(4, 3)
test_data_3d = np.random.rand(5, 4, 3)
@pytest.fixture
def features_order():
return ["eta", "phi", "pt"]
@pytest.mark.parametrize(
"data,features,expected",
[
(test_data_2d, ["phi", "pt"], t... |
009ffa0e139a46e5749b35e2c7399e88a31275aa0cb765e33f65d7dfefc726b4 | Python | 3,230 | 105 | """Hidden Markov Model based detection from hmmlearn.
This code provides a base interface template for models
from hmmlearn for using that library for detection of time series.
Please see the original library
(https://github.com/hmmlearn/hmmlearn/blob/main/lib/hmmlearn/hmm.py)
"""
import numpy as np
import pandas as... |
57b7d261e4ff6524abc502e4be28cac74d7208c1e4afc39544d21a066451385e | Python | 3,232 | 84 | import logging
from typing import Any
import torch.distributed
from flair.optim import LinearSchedulerWithWarmup
from flair.trainers.plugins.base import TrainerPlugin
log = logging.getLogger("flair")
class LinearSchedulerPlugin(TrainerPlugin):
"""Plugin for LinearSchedulerWithWarmup."""
def __init__(self,... |
e9df94ad3a56c975a0e966235750195be8795d462b199a3c7dc71b0a2cd7efd9 | Python | 3,233 | 93 | # SPDX-License-Identifier: LGPL-3.0-or-later
from typing import (
Any,
)
import torch
from deepmd.dpmodel.fitting.ener_fitting import EnergyFittingNet as EnergyFittingNetDP
from deepmd.pt_expt.common import (
torch_module,
)
from deepmd.pt_expt.kernels.graph_fitting import (
fitting_eligible,
graph_fi... |
757a0d768637ef30d3fca792806c62b4add60607fa330454893877f94bf37bd5 | Python | 3,235 | 97 | # -*- coding: utf-8 -*-
#
# Copyright © 2013 Charles E. Vejnar
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://www.mozilla.org/MPL/2.0/.
#
import logging
import os
from ..interfaces imp... |
e3449b99f75eabc263fdc4c5f64828b201f5598e7204aa48b6a6b1f1dfaca34a | Python | 3,235 | 107 | #!/usr/bin/env python
# coding: utf-8
""" Python module for plotting connectivity results
Run as:
python Visualize/plot_connect.py
"""
import numpy as np
import matplotlib.pyplot as plt
def get_sep_lines(labels):
""" Get the separation lines for heatmap plot based on the network labels
Parameters
-... |
ac1b304db46154d10b05e1e9409685fb1daa601241293c93fd25e02bdaaa5cbc | Python | 3,236 | 94 | from __future__ import print_function
from scipy import interpolate
import numpy as np
def find_point(x, y, peakindex, val, direction='left', limits=None):
"""
Given a waveform defined by *x* and *y* arrays, return the first time
at which the waveform crosses (y[peakindex] * val). The search begins at
... |
ff419a6d8913c1d1bd9ee7237b499ff6b92dd0380198d554a0bfc7d1a7a4a118 | Python | 3,236 | 89 | # 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... |
19315169ef3cdccabe2384bae52529b260e39e39b9a964f22b9b6c9336673daf | Python | 3,238 | 84 | from __future__ import annotations
from collections import defaultdict
from pathlib import Path
import networkx as nx
import pyarrow.csv as pacsv
import pyarrow.parquet as pyarrow_parquet
from graynet.writers import (
RAW_EDGE_FILE_NAME,
ROI_STATS_FILE_NAME,
SUMMARY_EDGE_FILE_NAME,
read_run_metadata,... |
70abf44599cd8dda983db024fd0e21b8fe9e5acb53a7e5253d967e6147153dfd | Python | 3,239 | 88 | """
plot_adjacency_matrix.py
Plot all neuron interactions as adjacency matrices. R neurons are excluded due
to the plastic nature of those connections. See the main paper and
extended_ring_model.py for anatomical justification.
"""
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
from exten... |
dab7d382340c7e69a31a436204c24d52631365232f8ffb4003fd6cbe74a4360c | Python | 3,244 | 87 | #!/usr/bin/env python
# import
## batteries
import sys,os
import copy
import argparse
import logging
import random
import itertools
import statistics
from math import log
from random import shuffle
from functools import partial
from collections import deque, defaultdict
from multiprocessing import Pool
## 3rd party
imp... |
c9dcc998130b5b3d12fc6eb700529875b87bc83345ada546fb5e1c47eb160598 | Python | 3,246 | 106 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or module... |
72a8b754fcc21af30d69ce94dee316d7f66fb5eca02e4a9c8414564fd41f5e9b | Python | 3,248 | 96 | # 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... |
0acc840835622d6c07df329b3a1775ee5a6f264b89310e39c82fab54c0ee2ea1 | Python | 3,250 | 70 | ## Reference from https://github.com/NeuroanatomyAndConnectivity/gradient_analysis/blob/master/01_create_human_connectome.ipynb
## https://github.com/satra/mapalign
## Download MSM-All-registered group-average rfMRI dense connectivity data: HCP_S1200_1003_rfMRI_MSMAll_groupPCA_d4500ROW_zcorr.dconn.nii
import sys
sys.p... |
435b19762b99f00e7559d6e274eb1f8321efdea77fcc17259508fb1b9df2f18d | Python | 3,252 | 99 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from ..builder import HEADS, build_loss
from ..utils import is_tracing
from .base_head import BaseHead
@HEADS.register_module()
class MultiLabelClsHead(BaseHead):
"""Classification head for multilabel task.
Args:
loss (dict): Config of cla... |
2374ce1d02e4332cc07c6a7c46bdec5ec713823f84c1b75d9bf6ca3f9dcde318 | Python | 3,257 | 88 | # 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... |
afa975937e1ddb889df3aa7343dc8fb1b5efcc099d47b4237e30394a34a0919a | Python | 3,257 | 106 | # 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
#
# ... |
f8cbd3e0fdd3944f07260758d087c8daebeb255e29f5b1306ab6213fd6a9fad9 | Python | 3,257 | 100 | import numpy as np
from skan import Skeleton, summarize, draw
from skimage import morphology
from scipy import interpolate
from scipy import ndimage as ndi
import pandas as pd
import nrrd
def skeletonize(image, um_per_voxel):
skeleton3d = morphology.skeletonize_3d(image)
skeleton3d = cleanup_skeleton(skeleton3... |
1a690f94af6989219623bcbbbf0e7ce210f406f542ada469c12eb63a7b8d88aa | Python | 3,259 | 91 | import collections as col
import logging
import os
import re
import sys
import click
import numpy as np
import pandas as pd
import atom3d.datasets.datasets as da
import atom3d.splits.splits as spl
import atom3d.util.file as fi
import atom3d.util.formats as fo
logger = logging.getLogger(__name__)
def _filter(data... |
e8fd66d70639e5e821b16813cdeee4d62f157dac2d341eb87392ac14a29eed9e | Python | 3,260 | 70 | import numpy as np
import tensorflow
import config as cfg
import loadsave
class DataGenerator(tensorflow.keras.utils.Sequence):
def __init__(self, fixed_filenames, path_fixed, moving_filenames, path_moving, batch_size,shape, fixed_seg_filenames, moving_seg_filenames):
self.fixed_filenames = fixed_... |
0152df40ad0af54bf3ed97a48d8d9cd077b66c831bdd4e34795164df9671ebf2 | Python | 3,261 | 86 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Lucky dynamic time warping distance."""
from sktime.dists_kernels.base._delegate import _DelegatedPairwiseTransformerPanel
class LuckyDtwDist(_DelegatedPairwiseTransformerPanel):
"""Lucky dynamic time warping distance.
Implements luc... |
654b8e97b4c9be69823a13db7edfe6c437ba6796932d52ce680b1b427b4dbe7a | Python | 3,262 | 90 | """Tests for state-aware clone and set_params functions on arbitrary objects."""
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
import numpy as np
import pytest
from sklearn.linear_model import LinearRegression
from sktime.base._pretrain import _clone_at, _set_params_at
from sktime.forecasti... |
e68135284abd97eb4e6a310124fa11c1083aa8cb98c8ef7f8f76f71c3f57d16a | Python | 3,263 | 135 | # 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... |
9d4d50f2faec19210d0700b51e0edafe201a5c9bb3ce62f29a1180d4c0c6aa1c | Python | 3,264 | 72 | #------------------------------------------------------------------------------
# elftools tests
#
# Seva Alekseyev (sevaa@sprynet.com)
# This code is in the public domain
#
# The error that motivated this fix was in an iOS binary in Mach-O format. It
# had v2 DWARF data, but it was targeting a 64 bit architecture. Bef... |
d0ce132aaef8f35971fcdb01ba45323951d5f86081b3b1c17e3bd93eb736ee9a | Python | 3,267 | 91 | from pyontutils.core import OntGraph, OntResIri
from pyontutils.namespaces import rdfs, ilxtr
from neurondm.core import Config, graphBase
from neurondm.core import OntTerm, OntId, RDFL
def multi_orig_dest(neuron):
for dim in neuron.edges:
if 'hasAxonPre' in dim or 'hasAxonSens' in dim or 'hasSoma' in dim:... |
8dbff2dc5120078a1e4bb391e236aca5e9590ae2330c4292ee319e776dd18477 | Python | 3,268 | 83 | #-------------------------------------------------------------------------------
# elftools example: elf_low_high_api.py
#
# A simple example that shows some usage of the low-level API pyelftools
# provides versus the high-level API while inspecting an ELF file's symbol
# table.
#
# Eli Bendersky (eliben@gmail.com)
# T... |
1e75238da216ae810e79853f580effdc27f81417d6ef899b212ec3cc2a79e653 | Python | 3,269 | 104 | import os
import sys
from .context import wordsegment
from wordsegment import (
clean, load, main, isegment, segment, UNIGRAMS, BIGRAMS, WORDS,
)
load()
def test_unigrams():
assert 'test' in UNIGRAMS
def test_bigrams():
assert 'in the' in BIGRAMS
def test_clean():
assert clean("Can't buy me love!") ... |
45b90d57a47dac1428891f8413eb8f9658b397829189fcfd3d874d65b535d632 | Python | 3,269 | 107 | # 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... |
2ea7ad98cb261cb2baf288b523cb8f1fb6f7414b4377d97f678dcaad9ecd65d7 | Python | 3,270 | 96 | # 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... |
c3c4be974b2143a8778a53bffa5a43bd0f90f9ebc95cecf1262787001f640e8f | Python | 3,275 | 92 | # 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... |
92c8001e398d81f54ad95f1cc541f3cddc71ac4ef1d2589b80931ceb5a998891 | Python | 3,276 | 111 | import pandas as pd
import seaborn as sns
import matplotlib
matplotlib.use("Agg")
sns.set_style("whitegrid")
from matplotlib import rc
#from brokenaxes import brokenaxes
rc('font',**{'family':'sans-serif','sans-serif':['Arial']})
from matplotlib import pyplot as plt
import sys
colors = sns.color_palette("Set1", ... |
a4a8cdb1adcbbcb8e8002d8341ebe7fbaa245e69ad084f0f030eb821fc889559 | Python | 3,278 | 87 | # 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... |
d3a2053ff2a84827e8ce41b86c49c06950502edf9b76403a3f34a50b7e318a42 | Python | 3,278 | 109 | # SPDX-License-Identifier: LGPL-3.0-or-later
import copy
import unittest
import numpy as np
import paddle
from deepmd.pd.model.model import (
get_model,
)
from deepmd.pd.utils import (
env,
)
from ...seed import (
GLOBAL_SEED,
)
from ..common import (
eval_model,
)
from .test_permutation import ( # ... |
d6f6adca7b63ffb292a3b196ea7f7a75edb8dae77c661c57d1437239263ec26e | Python | 3,279 | 108 | atacseq_config = {
"train_batch_size": 512,
"finetune_batch_size": 5000,
"transfer_batch_size": 512,
"train_epochs": 10,
"finetune_epochs": 10,
"transfer_epochs": 20,
"train_task": "supervised_group_identification",
"finetune_task": "cross_model_prediction_clas",
"transfer_task": "su... |
ec8b225b5668a291448e9685a50849981a84dfc7766d5f7593b6cdc2f570104e | Python | 3,281 | 99 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.