sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
6e8ba38be65a39067adfe0f7d058bdf2da7de5d433c6a5232a35b399b60e9e11 | Python | 3,283 | 82 | # Copyright 2019 Google Inc. 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 applicable law or a... |
3879767fa4f77a98153ee500a59b3c1b12c48b472d49055e00eb829db339be6c | Python | 3,284 | 92 | from __future__ import print_function
__author__ = 'pbmanis'
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph as pg
import pyqtgraph.opengl as gl
import numpy as np
class testcyl():
def __init__(self):
self.app = QtGui.QApplication([])
self.w = gl.GLViewWidget()
self.w.show()
... |
f7627eb19b065a39cc6cb72d5f99fcacb7538d1e344e3860cecfdda85f2bd9e6 | Python | 3,284 | 75 | # 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... |
775ec6dcb2c7c2e159719f37a2fe953bc4904a24f632decc7079df6a532636f3 | Python | 3,285 | 77 | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
fb22715e92bd0e9ff667416d48b8fd74e4c32f7c64be0ebd1aaca9d61ace37c0 | Python | 3,286 | 93 | """Tests for the cross-count subcommand."""
from pathlib import Path
import pytest
from corset_tools.cross_count import (
count_cluster_members,
run_cross_count,
summarise_counts,
)
from corset_tools.fileio import read_cluster_map
def test_run_cross_count_writes_table(
tmp_path: Path, data_dir: Pat... |
de8cb1bafa1ed3899dcf46d9e31e1af113d06446e3ce581111530b528fccd506 | Python | 3,287 | 108 | #!/usr/bin/env python2
# encoding: utf-8
"""
cuffdiff_to_gct.py
Created by Cole Trapnell on 2010-08-30.
Copyright (c) 2010 Cole Trapnell. All rights reserved.
"""
import sys
import getopt
import math
help_message = '''
This script transforms a Cuffdiff FPKM tracking file to an IGV-compatible GCT expression file
Usa... |
5004b92b04bdc0bcdd223684b809da1bdb585385c1d9b5a258cbe22417125af6 | Python | 3,289 | 97 | import pytest
import pandas as pd
import numpy as np
import anndata
from scipy.sparse import csr_matrix
from palantir.preprocess import filter_counts_data, normalize_counts, log_transform
def test_filter_counts_data():
"""Test filtering of low count cells and genes"""
# Create test data
data = pd.DataFra... |
882c27ede85e146d11e881e28b923f52ee7bad9449ef3566eea8b5304ce48f84 | Python | 3,291 | 95 | # 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... |
d14371fe909c7d079dc606dec976c9559a933466b57969ce4e90b90e2aec7aeb | Python | 3,297 | 91 | # 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... |
2a54c830743464d0558519adf16112876b266206c24c6c1767cedd11465d395f | Python | 3,298 | 88 | #!/usr/bin/env python3
from pyontutils.config import auth
__doc__ = f"""Generate ttl/catalog-*.xml
Usage:
ont-catalog [options]
ont-catalog [options] <file> ...
Options:
-b --big when creating catalog also import big files
reccomend running this o... |
2b44f7ef0e11dad0bc08a061f3ee0ae113be170d70ed45928c0c421f1be3e119 | Python | 3,299 | 82 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Python codes for 'A Graph Autoencoder Approach to Causal Structure Learning', NeurIPS 2019 Workshop
Authors: Ignavier Ng*, University of Toronto
Shengyu Zhu, Huawei Noah's Ark Lab,
Zhitang Chen, Huawei Noah's Ark Lab,
Zhuangyan Fang*, Peking ... |
1d504cb75b49d67a184bf7404fae0ab3ed671e56c8d9496fda4d94c99b24c380 | Python | 3,300 | 89 | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
844f52ba7d68556589abc4eb9720fc3d155f0bdf99493eeb6272dbb5ccecc956 | Python | 3,300 | 91 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.model import expect
if TYPE_CHECKING:
from collections.abc ... |
6a969e86671e7ca49cf0e9edcc2a790a649b44aaad4b048258bd45c6534f2f2d | Python | 3,301 | 100 | from pathlib import Path
from pytest import mark
import numpy as np
from asreview import ASReviewData
@mark.parametrize("test_file,n_lines,labels,ignore_col", [
("embase.csv", 6, None, ["keywords"]),
("embase_newpage.csv", 6, None, ["keywords"]),
("embase.ris", 6, None, []),
("generic.csv", 2, None,... |
c64a2dcb267acff4aec55da26fe3f70dd41a4c4ec4a9988958ad7239dfe064c1 | Python | 3,307 | 92 | # 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 Equal(Base):
@staticmethod
def export() -> None:
node ... |
a3aebf497dcb087bbd594c3fa2430b7b0d9dfb978d09cc19f05c25aab6db5c06 | Python | 3,308 | 75 | # Analyse ASR results
import topiary
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from src.plotting_utils import plot_ancestor_data, plot_conservation_data
from src.plotting_utils import GRAY, RED
# Determine amount of conservation
# Load extant sequences
df = pd.read_csv("./results/extant_d... |
e77ab035bf80624ccac5a236c73c93832df2f96ffcc84c5e3ad258b2707efc01 | Python | 3,308 | 86 | # 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... |
ef8111d7f07bec2110faa5f4d64897da79adf04f712515133d4094b65e7d2101 | Python | 3,309 | 81 |
"""
Script that processes a folder with experiment hdf5 files and for each experiment creates a csv file
that contains <x,y,z> um coordinates of all caiman unit centroids
"""
from typing import Any
import argparse
import os
from os import path
from experiment import Experiment2P
import numpy as np
class CheckArgs(a... |
86eff5a0b0fb387cad203690de7ec128929ef2ac4b292846ca91d972d8e93438 | Python | 3,311 | 103 | # 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... |
acc6198fa4eb164763bacf675f055192e92051c2c66d96ea718c4fbe382a689d | Python | 3,312 | 103 | # 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... |
e10caf0afae96b08e6dddd40eb7f2b1874dfa716c22a4d750947fcd8b3722cc4 | Python | 3,313 | 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... |
4751e201f02d3fc26f7a898a5ec24e94cc62f5e9b6fb8d521511a7343faeb9fe | Python | 3,315 | 131 | # An extension to: Mocapy
#
# Copyright (C) 2007 Jes Frellsen, Ida Moltke and Martin Thiim
#
# This library 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 of the
# License, or (at... |
c628869a7f4d6144c3b23a14a44294d042ef652a2532f55bd10da7a8e58f2812 | Python | 3,316 | 122 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Evaluation of a trained model against labelled data.
The machinery behind ``dp test``: a tester walks one system in chunks,
evaluates each chunk and combines the errors. Lazy data sources such as LMDB
therefore need not fit in memory; ordinary ``DeepmdData`` systems mate... |
aa40b55b91bfa4200cf355307c87c207feab6450ebf745d8f4398663bccbf4fe | Python | 3,318 | 93 | """
This scripts generate figure S6j : percentage of CCCP neurons
Internal notes:
This is from the notebook: figure-4-paper-with-pip
"""
import pandas as pd
import os
import matplotlib.pyplot as plt
import sciplotlib.style as splstyle
import glob
def main():
fig_folder = '' # where to save the figure
fig_n... |
cff79b97d83aea4b0e8be67d5b9495f2474f72f6d85c20d43b411f80d20988b4 | Python | 3,319 | 98 | ###############################################################################
# Two AFC Task Example
###############################################################################
# Imports are subject to change
from camstim.foraging import AFCForaging, AFCStimulus, Cue, FailureCue
from camstim import Window, Exper... |
e1defa6efb3fb9fc8f7a9557c1a7a94ea6ce05741836008ad44b9b847d917c3f | Python | 3,319 | 86 | import numpy as np
from scipy.signal import convolve
from nipy.modalities.fmri.hemodynamic_models import spm_hrf
def convolve_hrf(X, onsets, durations, n_vol, tr, ops=100):
"""
Convolve each X's column iteratively with HRF and align with the timeline of BOLD signal
Parameters
----------
X : arra... |
acf392dfeb9c85cd3e8967821026794abcc0f8dea606564e4f8f09d7d067e384 | Python | 3,321 | 96 | """
Logging configuration for the corset-tools package.
This module provides functionality to initialize and configure logging with rich
formatting for better readability in terminal output. It uses the 'rich' library
to create visually enhanced log messages.
"""
import logging
from pathlib import Path
from typing im... |
8599a9f487933397c86bf8511268f821c86f2bcbc17f18b170bb612b5f61b92e | Python | 3,322 | 104 | # 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... |
830eeedd92ab845e17164fed028041ee4a4cf98554c46f0f6d9f8dd937574e21 | Python | 3,323 | 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",
"transf... |
b67653ed742bedb9b605e646840e970f75aa17022d2e74450c66d01f6f24af0b | Python | 3,328 | 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... |
045a31449487553ced65fcdb35c1c07e99cfcf1cbdd6f74e15d08af9deb15137 | Python | 3,331 | 147 | #!/usr/bin/env
__doc__ = """
Basic building block layers for constructing nets implemented in PyTorch.
Nicholas Turner <nturner@cs.princeton.edu>, 2017
Based on a similar module by
Kisuk Lee <kisuklee@mit.edu>, 2016-2017
"""
import torch
import torch.nn as nn
from torch.nn import init
import math
def pad_size(ks,... |
21a94db27ebea6898febcb285f3cafe5642f4820b12a3099368086965e1e161e | Python | 3,332 | 113 | import numpy as np
from brian2 import *
# import matplotlib.pyplot as plt
import time
import pickle
"""
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NEURON AND SYNAPSE DEFINITIONS
"""
globalStart = time.time()
eqs_neuron = '''
dv/dt = (-v+I+Is... |
9aaf43ee0e08c858f215560ec4260b5611bb1dfd1c2e00694db5ef623bf6ed0a | Python | 3,332 | 68 | # Setup
import warnings
warnings.filterwarnings("ignore")
import numpy as np
import pandas as pd
import pickle as pkl
import matplotlib.pyplot as plt
from sccoda.util import comp_ana as mod
from sccoda.util import cell_composition_data as dat
from sccoda.util import data_visualization as viz
fdr_vals = [0.05, 0.10, ... |
1ee5db8792b85e67bf6703a065eada4671510e53c9aabfce2c128e1e70c9c0ea | Python | 3,334 | 100 | from __future__ import annotations
import numpy as np
import pytest
from jetnet.datasets import utils
rng = np.random.default_rng(42)
test_data_2d = rng.random((4, 3))
test_data_3d = rng.random((5, 4, 3))
@pytest.fixture
def features_order():
return ["eta", "phi", "pt"]
@pytest.mark.parametrize(
("data", ... |
55be1f853a264a9e929d45f21b60b57d3c91273c0c45355a57fe2d23f30d4da2 | Python | 3,335 | 106 | """Classifier Examples: some use case examples for building and assessing classifiers.
This will become a note book once complete.
"""
__author__ = ["TonyBagnall"]
import numpy as np
import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sktime.classification.dictionary_based import Contractab... |
ff3a76006d79e83c7cee6ec79eee9ca6b3edd86f13e5356b2bf5eb9df7587d69 | Python | 3,336 | 119 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import ml_dtypes
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Compress(Base):
@staticmethod
def export_comp... |
8c37cee5e760f0edb42de776c21b3e2dc2444f5f07e2bd8ce6de0ea420813ae0 | Python | 3,339 | 106 | import unittest
import os
import numpy as np
import shutil
from ddt import ddt, data
from SPHARM.classes.spectrum import Spectrum
@ddt
class TestSpectrumClass(unittest.TestCase):
@data(
np.ones([10, 10]),
np.ones([10, 20])
)
def test_from_surface(self, case):
sp = Spectrum()
... |
22c5aa7d86893ecad7756f63dfd5ce0b0e707e206e8f1e2d28955ebc52f822ab | Python | 3,347 | 137 | import _pickle as pickle
import sys
from scipy import stats
import numpy
import multiprocessing
print('''$1: Index Data\n$2: Output file''')
INDEX_DATA_FILE=sys.argv[1]
OUT_FILE=sys.argv[2]
SPLIT=':'
class Person_PCC_Data:
import numpy
def __init__(self, EXP, POOL_LENGTH, PCC_POOL,header):
self.EXP =... |
9f54296e9dc3aea6b6bc4e90e20bdd7f48e7a8fbca9491edfb14953d36376bcd | Python | 3,348 | 79 | # Copyright (C) 2022-2025 Shijiazhuang Xianyu Digital Biotechnology Co., Ltd
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any la... |
d8d853cd7599812578d1a274fec5c1e649b6359a1194095543b1a87a8e25834e | Python | 3,348 | 168 | import _pickle as pickle
import sys
from scipy import stats
import numpy
import sys
########################################
R=0
Connector='.And.'
########################################
print('''$1: Index file\n$2: Output file''')
INDEX_DATA_FILE=sys.argv[1]
OUT_FILE=sys.argv[2]
SPLIT=':'
class Used_Data:
def... |
55b36cabfadd89d50360bad0e756c0c229e5756485b5bcc15ac818941d9d19b4 | Python | 3,350 | 120 | import numpy
import tqdm
from sklearn.manifold import TSNE
class _Transform:
def __init__(self) -> None:
pass
def fit(self, X):
return self.transform.fit_transform(X)
class tSNE(_Transform):
def __init__(self) -> None:
super().__init__()
self.transform = TSNE(n_componen... |
014178be1c4b5ea9ac92492159ac27701ee4e3ab56fc017240d9a001721a589c | Python | 3,351 | 91 | # 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... |
3b00bca678520d3646ee721f9c40efd35c2822e7659e9cd29a0479684cb6b844 | Python | 3,351 | 87 |
#=======================================================================================================================
# 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... |
58300d2f227f2e733339638fd6ddf9cdaad2e52062d1bb8ccfa4afa9ff1a7867 | Python | 3,351 | 93 | import numpy as np
from scipy.special import binom
from scipy.integrate import quad
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
import seaborn as sns
def eigenvector_loads(EVs, color, hatch=None, ax=None, ordered=False,
abs=False, bin_size=.025, scaling=.85, alpha=0.001)... |
7929e06b3f95e2551791fc2626f3cf28950562d260ea4e0fbee828463213a787 | Python | 3,352 | 131 | # tifffile/setup.py
"""Tifffile package setuptools script."""
import sys
import re
from setuptools import setup
buildnumber = ''
with open('tifffile/tifffile.py') as fh:
code = fh.read()
version = re.search(r"__version__ = '(.*?)'", code).groups()[0]
version += ('.' + buildnumber) if buildnumber else ''
desc... |
629fb487287ea1ad7eb1bf8281446ec400ef45e582ecd83183803616cc9af819 | Python | 3,353 | 136 | import _pickle as pickle
import sys
from scipy import stats
import numpy
import multiprocessing
print('''$1: Index Data\n$2: Output file''')
INDEX_DATA_FILE=sys.argv[1]
OUT_FILE=sys.argv[2]
SPLIT=':'
class Person_PCC_Data:
import numpy
def __init__(self, EXP, POOL_LENGTH, PCC_POOL,header):
self.EXP =... |
aff7bd1384da201a262e0c5f68e8423dcd0ce065cb8e062a42f9a7ad764afb37 | Python | 3,354 | 84 | """
This script plots figure S7t of the paper.
This is the motion energy in passive vs. active.
Internal notes
- this is from the script batch_multispaceworld_compare_passive_active.py
- TODO: convert pickle file to csv
"""
import numpy as np, xarray as xr, argparse, logging, os, glob, pandas as pd, pims
import src... |
c7e3ad3740d238a4e47f26bab1266275da20fe342380a1b3fc4f4652b4f14dc8 | Python | 3,354 | 104 | """Utility functions for handling and working with alignments."""
__author__ = ["fkiraly"]
import pandas as pd
# todo: need to wait for datatypes PR to merge
# from sktime.datatypes import check_is_mtype
def reindex_iloc(df, inds, copy=True):
"""Reindex pandas.DataFrame with iloc indices, potentially out of bo... |
d73e75963723c3cee541abf81604d8181c99ca9d2936d57a9dbd9df9199aea2e | Python | 3,357 | 114 | import numpy as np
from ANNarchy import *
# import matplotlib.pyplot as plt
import time
import pickle
# Personal stuff to send an email once data collection is finished
import sys
sys.path.extend(['/home/will'])
from email_utils import send_email
"""
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
37d13031c44c8b1052c459885676450cdbb5e45e63f595914cd9bee2185fdbc4 | Python | 3,358 | 96 | import numpy as np
import torch
import torch.nn as nn
class CNN3D_PPI(nn.Module):
def __init__(self, in_channels, spatial_size,
conv_drop_rate, fc_drop_rate, top_nn_drop_rate,
conv_filters, conv_kernel_size,
max_pool_positions, max_pool_sizes, max_pool_strides,
... |
bf8613c3beb538e77c4eda90e77a06995a152c03ccd589a0d1bd652004c14a5a | Python | 3,359 | 125 | import numpy as np
def initConsts(c_dict):
sizeConstants = 17
constants = np.zeros((sizeConstants,), dtype=float)
for i, key in enumerate(c_dict.keys()):
constants[i] = c_dict[key]
return constants
def computeAlgebraics(t, y, Cai, constants):
sizeAlgebraics = 10
algebraics = np.zer... |
ac9bbe39d3be138a2888b0b8a5273a931b5ded7dfd69a91b8ca3384f3f2fe6d9 | Python | 3,360 | 80 | #!/usr/bin/env python
'''
Copyright 2017 Matt Settles
Created June 8, 2017
bwa mem -C option concatenats the fasta/fastq
CTACATTGTCAAGGGT:E00558:34:HGCJ3ALXX:1:1101:2108:1731 99 000000F 922571 60 127M = 922961 517 ACTCGGGGAGGTGTTAGCTGCTGCCTCACACATTGGGTTTATAGGCTGAATCTTGTTCTCTTTAGGCTTCCAGAGTTT... |
fae921db34dee97402fb3d17673a6a08af1ba59fd1b482c4eecdb4f0f9c17739 | Python | 3,360 | 103 | # 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... |
f94b999c7e7430f8539fc2df03c4730f0fc19cfe6524e0ad9462daa9221e03d3 | Python | 3,363 | 112 | """
automation.py
Some tools for automation.
@author: derricw
Jan 16 2018
"""
import logging
import random
from experiment import EObject, ETimer
class _BaseMouse(EObject):
""" _BaseMouse contains everything except behavior logic.
After attaching to a task, has access to the task's lick sensors,
enco... |
212bd104f75fadddc747fa029c80d9c9b726385ded1768459282491acb5361c4 | Python | 3,367 | 100 | import pytest
import torch
from tests.fixtures.models import MultiDeviceModel, SingleInputNet
from torchinfo import summary
@pytest.mark.skipif(not torch.cuda.is_available(), reason="GPU must be enabled.")
class TestGPU:
"""GPU-only tests."""
@staticmethod
def test_single_layer_network_on_gpu() -> None:... |
90c84a7d479ac9e17b03ee84eca2196e911a5db9c7aa202bcfef178e7d698973 | Python | 3,367 | 93 | # 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... |
a91b64079a23988c1786d8a5efb02f8be8c7ea5934fb1b80a29f0252a391e2d5 | Python | 3,367 | 85 | # 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... |
ca7f78908f1ecb372a123849be982cf97946d59e7bdae2ba660d677e56522df4 | Python | 3,370 | 101 | from __future__ import annotations
import numpy as np
import torch
import torch.nn.functional as F
from torch import nn
from torch_cluster import knn_graph
from torch_geometric.nn import EdgeConv, global_mean_pool
class _ParticleNetEdgeNet(nn.Module):
def __init__(self, in_size, layer_size):
super().__in... |
417fd76236b05169a3a483a0844a84e2f1f7f1dac4a41630ee3de39186af26d5 | Python | 3,371 | 124 | import re
from collections import defaultdict
from urllib.parse import quote as url_quote
import rdflib
from pyontutils.sheets import Sheet
from pyontutils.namespaces import ilxtr, TEMP, rdfs, skos, owl, interlex_namespace
from neurondm.core import Config, NeuronEBM, Phenotype, EntailedPhenotype, NegPhenotype, log, Ont... |
4fd4e378a7bf1d20ab3f8fa69fc31bd978d005b2063189b5140a0f0f415f3ff5 | Python | 3,371 | 113 | import matplotlib.pyplot as plt
import numpy as np
from Historia.cellcontr import solver as solcontr
from Historia.ep import solver as solep
from Historia.shared.plot_utils import get_col, interp_col
def main():
rat = "sham"
# ---------------------------------------------------------------
# Electrophys... |
52cd049bf101728dc4e9b88afa1e38f173a434d1fecc675c89fcf92d67a96aca | Python | 3,371 | 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... |
66bf9b6c05a11f3d88822b818b107cd959903afc8d8fc028a6eb6e4d385f52a2 | Python | 3,371 | 117 | # + [markdown]
"""
# Tutorial 3: The connectivity matrix
Viewing the connectivity matrix is another way of examining the networks within the brain, complementing other methods.
In these visualizations a node x node matrix shows the connectivity values.
To view a connectivity matrix for your nextwork, simply set a... |
17420d40ae947b4c6122eb80e1860ec93e972f716713ede0823caaf409b05cc4 | Python | 3,373 | 75 | #!/usr/bin/env python3
"""Tests for packaging/is_latest_release.py.
python3 packaging/is_latest_release_test.py
"""
import contextlib
import importlib.util
import io
import pathlib
import unittest
from unittest import mock
_spec = importlib.util.spec_from_file_location(
"is_latest_release", pathlib.Path(__fi... |
bbdbc85a86da45ccf51b284fb4eef6a5cefc4dceadd0c072df3c10bbfcf04cc8 | Python | 3,373 | 83 | # Copyright (c) OpenMMLab. All rights reserved.
from math import cos, pi
from mmcv.runner.hooks import HOOKS, LrUpdaterHook
@HOOKS.register_module()
class CosineAnnealingCooldownLrUpdaterHook(LrUpdaterHook):
"""Cosine annealing learning rate scheduler with cooldown.
Args:
min_lr (float, optional): T... |
d14fb6a392a063433b3c5c815b6a1f2d5c587d9056525c0ad0d0d7349f1b6ce2 | Python | 3,374 | 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... |
2243333a1c769c198883408b551b9779be945a3e3b2c7febd7eae3d9654d4ee4 | Python | 3,375 | 150 | """Tests for DBA."""
import numpy as np
import pytest
from sktime.clustering.metrics.averaging import dba
from sktime.dists_kernels._numba_distances.tests._utils import (
create_test_distance_numpy,
)
from sktime.tests.test_switch import run_test_for_class
expected_dba = np.array(
[
[
0.0... |
47a2603f335ceb9c80d51538e23c1c26d05bf30b146578da125cd453e23e77f0 | Python | 3,376 | 85 | from elephant.spike_train_correlation import covariance
from elephant.conversion import BinnedSpikeTrain
from numpy import triu_indices
from quantities import ms
from networkunit.tests.two_sample_test import two_sample_test
from networkunit.capabilities.ProducesSpikeTrains import ProducesSpikeTrains
from networkunit.ut... |
57523b8fa42a935773855945935dede77ed09585265afe0e4bffe27586284bcb | Python | 3,376 | 95 | # 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... |
ba4631e441c7c72b2c8c6c6747d2bd6b099c7361172e071243b5b3978ec6ccbb | Python | 3,376 | 111 | # ==========================================================================
# Base on https://github.com/sveitser/kaggle_diabetic/blob/master/convert.py
# ==========================================================================
import os
import random
import argparse
import numpy as np
from pathlib import Path
from... |
5aa2c8a1ff44f47f5f514d4b3b1fff1545fc44e71e0081466d5d1f655803e3f6 | Python | 3,377 | 138 | # 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... |
8745256ce705b8a076ca0931d285b6eed087a03fcff2169890bf1a3e4426ac7e | Python | 3,377 | 94 | # 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
#
import tensorflow as tf
class CorruptionGenerationLayerTrain(tf.keras.layers.... |
1a84cd1fda6b2c949e41fb8189311eb3f75e659a4483b80889c7de920a9b3f59 | Python | 3,378 | 114 | import numpy as np
from ANNarchy import *
# import matplotlib.pyplot as plt
import time
import pickle
# Personal stuff to send an email once data collection is finished
import sys
sys.path.extend(['/home/will'])
from email_utils import send_email
"""
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
433ec8529a9c8938f8a45868bec24347b3f401b27635599c5f045a66f4a2587d | Python | 3,378 | 96 | import numpy as np
import torch
import torch.nn as nn
class CNN3D_LEP(nn.Module):
def __init__(self, in_channels, spatial_size,
conv_drop_rate, fc_drop_rate, top_nn_drop_rate,
conv_filters, conv_kernel_size,
max_pool_positions, max_pool_sizes, max_pool_strides,
... |
60c8da8e38ff67a5615695082ce714daef5d32ad50210b2610a0b29910cb6223 | Python | 3,378 | 106 | # -*- coding: utf-8 -*-
import os
import torch
from torchtext.data import Field
from onmt.inputters.datareader_base import DataReaderBase
# domain specific dependencies
try:
from PIL import Image
from torchvision import transforms
import cv2
except ImportError:
Image, transforms, cv2 = None, None, N... |
4b6117eab13861d8e0cc75ead74cf9463f7656d4a5546d00e551f293cc8f6325 | Python | 3,380 | 86 | from __future__ import print_function
import sys
from functools import reduce
from os import listdir
from os.path import splitext, exists
import pickle
import numpy as np
from parameterSetup import ParameterSetup
from stageLabelAndOneHot import restrictStages
from fileManagement import readTrainFileIDsUsedForTraining
... |
36324b8614208e733bbc822f38e9ffbee6e91c5412a0bde317529d5b300b1ca3 | Python | 3,381 | 92 | import logging
import os
import random
from multiprocessing.connection import Connection
from typing import Callable
import numpy as np
import torch
import torch.multiprocessing as mp
from torch.distributed import destroy_process_group, init_process_group
from torch.utils.data import Dataset
import flair
from flair.d... |
ff92a8bc4d940aad43be265d4138c4fa9ee19bf6374850f209e7bdcd65c1c8cc | Python | 3,381 | 93 | # 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 optional_has_element_reference_implementation(
optional: np.ndarray ... |
a661a84876bb86ba1932529fc908667fdcbb6ae46eaddbb872dbcf4601d67490 | Python | 3,382 | 96 | import numpy as np
import torch
import torch.nn as nn
class CNN3D_MSP(nn.Module):
def __init__(self, in_channels, spatial_size,
conv_drop_rate, fc_drop_rate, top_nn_drop_rate,
conv_filters, conv_kernel_size,
max_pool_positions, max_pool_sizes, max_pool_strides,
... |
463df67778254a67ce1f3f720b610faa0dbb96b52648b76529d056e31b22f863 | Python | 3,386 | 85 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn.utils.weight_init import trunc_normal_
from ..builder import BACKBONES
from .vision_transformer import VisionTransformer
@BACKBONES.register_module()
class DistilledVisionTransformer(VisionTransformer):
"""Distilled ... |
83bb3e34c1d81d1aec53cfe78608743ddaba11abe466de7b59e8388aeadc8819 | Python | 3,386 | 109 | # 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... |
f55d0228080209b8b522a7a52618cfedd28a207a1024358115b8e4a1a2ce5b00 | Python | 3,386 | 97 | import io
import os
from pathlib import Path
import subprocess
import numpy as np
import pandas as pd
import tqdm
import atom3d.util.file as fi
class Scores(object):
"""
Class for tracking and looking up Rosetta score files.
:param file_list: List of paths to Rosetta silent files.
:type file_list: ... |
0d3fde8c2665e644da8ea9034bbccd78c564fb89a3b84cc0fdcab777e7f3f2e4 | Python | 3,387 | 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_t... |
874b6e261ea9bd6d608d768b050c17b6c22c3a72428721f308ab5d2d4d348823 | Python | 3,389 | 101 | import torch
from torch import nn
from torch_geometric.nn import EdgeConv, global_mean_pool
from torch_cluster import knn_graph
import numpy as np
import torch.nn.functional as F
class _ParticleNetEdgeNet(nn.Module):
def __init__(self, in_size, layer_size):
super(_ParticleNetEdgeNet, self).__init__()
... |
899d896b9a5afed8383847680a4aa7ff51419459edb5c1a9b010ef643603fdba | Python | 3,390 | 113 | import logging
from pathlib import Path, PosixPath
from typing import Optional
import ants
from omegaconf.dictconfig import DictConfig
from rich.logging import RichHandler
from roiloc.locator import RoiLocator
FORMAT = "%(message)s"
logging.basicConfig(level=logging.INFO,
format=FORMAT,
... |
a78738ebcc5259091e0a95f9c8ae07c761a617ac051f5e5a583d161436df64ab | Python | 3,390 | 91 | # 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... |
cc0c7b4eff9a88c7ad803e17c4b6cbea15fb5b0d9bca824d2ea1eafa28a252a5 | Python | 3,393 | 112 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Tests for normalized training arguments."""
import copy
from typing import (
Any,
)
import pytest
from dargs.dargs import (
ArgumentError,
ArgumentTypeError,
)
from deepmd.utils.argcheck import (
normalize,
training_args,
)
def test_ema_checkpoint... |
287c835e0b208b8134c5a577649730ab3a5301d558cbd7bedc9688bd4bc4bcb2 | Python | 3,394 | 114 | """
@file: metrics_pytorch.py
Created on 13.06.22
@project: CrazyAra
@author: queensgambit
Metric definitions for Pytorch
"""
import torch
from DeepCrazyhouse.src.training.trainer_agent_pytorch import SoftCrossEntropyLoss, SampleWeightedLoss
class Metric:
def __init__(self):
pass
def reset(self) -> ... |
64fb9471092c5e504a12bed3a3edb86a25afab5ac7c91532b2059ae228a7a4a7 | Python | 3,396 | 92 | # 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
#
# ... |
30241e6e60ed2d69a897ce4458bfe62e76c98586494b442339cbfe93ba99e2c9 | Python | 3,397 | 107 | import os
import sys
import re
import gzip
from pathlib import Path
import pytest
import hashlib
import itertools
# fasta-parser, odp_filechecker source extraction, etc. — load lazily so
# conftest fixtures get a chance to register the necessary sys.path entries
# (source_dir, scripts_dir, fasta_parser_dir) before we... |
5935aa3d0097e885fcad4f4bacf3e7c02f86581da20d121a8f7b6c852a4064b7 | Python | 3,398 | 109 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import Any
import numpy as np
import onnx
from onnx import helper
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
# The below Scatter's numpy ... |
8c8710e0eea98893c4d161be64b7e14b341c8167b9928cd94994290fad994e77 | Python | 3,398 | 107 | import inspect
import functools
from elephant.parallel import SingleProcess
def use_cache(original_function=None, cache_key_param=None):
"""
Decorator in particular for the `generate_prediction()` function of the tests, handles
cached prediction loading, parameter update and prediction saving.
Optional... |
5da5ad7b42c0227e054e9d17b058490342be4093e128d24d8d905303497988e9 | Python | 3,399 | 76 | import unittest
from pyontutils.namespaces import ilxtr
from neurondm import simple
from neurondm.simple import Phenotype, PhenotypeCollection
from .common import skipif_no_net
@skipif_no_net # FIXME should not need this
class TestSimple(unittest.TestCase):
# TODO test_0_equality from test_neurons
def test_... |
0d1cfb01769274fcd8c1e2a569708b9550cc7636fa9aa22fe5f3d6920938c61a | Python | 3,401 | 91 | # 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... |
0f183ef2ffe82f858746f132eb2825d9b25b159bcb013944cace37db14dbb65f | Python | 3,402 | 116 | # import shutil
import os
import random
from typing import Optional
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import get_worker_info
def get_activation_function(activation: str) -> nn.Module:
"""
Gets an activation function module given the na... |
49ca91eb43d914c867071de4c116b5fcaaae27d8c308f614437493260e68e2d2 | Python | 3,406 | 100 | import torch
import torch.nn as nn
from .utils import get_p_polar, get_p_cartesian, get_polar_rel, check_p_dim
from scipy import optimize
class HungarianMSELoss(nn.Module):
"""Permutation invariant MSE Loss for jets using scipy.optimiz (Hungarian algorithm)."""
def __init__(self):
super(HungarianMSEL... |
fe846b9598a3d44cecfe6d5bdc4d49eb1781a7548e09e0f230946a63cce69c5a | Python | 3,407 | 139 | import pytest
import numpy as np
from dolfin import *
from ffian.flow_model import ModelBase
from ffian.flow_model import Model
from ffian.flow_model import Solver
def project_to_function_space(mesh, u):
""" Project u onto function space """
CG1 = FiniteElement('CG', mesh.ufl_cell(), 1)
V = FunctionSpace... |
1ccebdbee82e42d799f9c75be6c12476ede0ca0fcb3ebb5419bf92ab04c29e24 | Python | 3,409 | 116 | # 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... |
0d7aeabb173f8a63d364cfb3d1c4b0f64b315d7a98070940e04a640b56700b24 | Python | 3,410 | 123 | # 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... |
539cbc236db0593c86e07de2af57efc230e2fbe71b529a2c678c7f46e08d9851 | Python | 3,410 | 97 | """This module has nodes for importing a classifier with Timeflux."""
import sys
import datetime
import json
import numpy as np
import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.pipeline import make_pipeline
from mne.decoding import PSDEstimator
from timeflux.core.node import ... |
be21bded8cecd5185ce10a552306d1475e9a3bdc09cb86bae850d6211ab08334 | Python | 3,411 | 97 | # SPDX-License-Identifier: LGPL-3.0-or-later
import torch
from deepmd.utils.batch_size import AutoBatchSize as AutoBatchSizeBase
class AutoBatchSize(AutoBatchSizeBase):
"""Auto batch size.
Parameters
----------
initial_batch_size : int, default: 1024
initial batch size (number of total atom... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.