sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
655450e5b6c6b028f43cffce56657fbd70902e80c379b3e88950a900f6d2ea79 | Python | 1,786 | 57 | import pytest
import pandas as pd
import scanpy as sc
from scipy.sparse import csr_matrix, issparse
import numpy as np
from palantir.utils import run_diffusion_maps
# Generate mock DataFrame data
def mock_dataframe(rows, cols):
rng = np.random.default_rng()
return pd.DataFrame(rng.random((rows, cols)))
# G... |
88b6fc6f0bbb44314507a0295dce342e579f69c63d2c7aab0bb8bc0360f50848 | Python | 1,786 | 52 | # 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... |
ee795e1bae3c4d8831cb8e77442291a58d5eff053c856e67432cd044449c6e6e | Python | 1,786 | 56 | """TDE test code."""
import numpy as np
import pytest
from sktime.classification.dictionary_based._tde import TemporalDictionaryEnsemble
from sktime.datasets import load_unit_test
from sktime.tests.test_switch import run_test_for_class
@pytest.mark.skipif(
not run_test_for_class(TemporalDictionaryEnsemble),
... |
3463c023e68e90f1c2cbe38871bcfa8aa53c075192c0e1d69f160a53de621063 | Python | 1,787 | 54 | """
This scripts generates figure 4f of the paper
This is the full model error (AV + interaction term) vs. additive model error, during passive conditions
"""
import pandas as pd
import matplotlib.pyplot as plt
import sciplotlib.style as splstyle
import numpy as np
import os
data_folder = '/Volumes/Partition 1/data/... |
4b6da6500c497288c6e53005ac5659bfd9b59d4e9699938353476597cb836c78 | Python | 1,787 | 59 | import pytest
import numpy as np
import pandas as pd
from scipy.sparse import csr_matrix
from scipy.sparse.linalg import eigs
from pytest import approx
from palantir.utils import diffusion_maps_from_kernel, determine_multiscale_space
@pytest.fixture
def mock_kernel():
size = 50
rng = np.random.default_rng()
... |
a8fea915d95422e0db609b9e4daf643d3f5855524ac217c7a95275269cbc9bd9 | Python | 1,787 | 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.model import expect
class Mod(Base):
@staticmethod
def export_fmod_0_signed_zero() -> N... |
97b60ba6b1d5d6ab76ae6b025720f24f85e122d89bdf18a48074318c1e7a9790 | Python | 1,788 | 45 | from netplotbrain import plot as npbplot
import pytest
import pandas as pd
import numpy as np
# Example node and edges dataframes included with package
df_adj = pd.read_csv('./examples/nbstestdata.csv', index_col=[0])
# Simplest image
@pytest.mark.mpl_image_compare
def test_highlight_edges_df():
fig, _ = npbplot(... |
bf81a92b23943fc222c03ccf732ddcbdb22dc629eeab1312e45de8c958e15ab4 | Python | 1,789 | 69 | # 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... |
b189c75457806b516623d34e9bc880fd6f7b8103189a0afeec66daae933a1ae9 | Python | 1,791 | 54 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 23 13:14:06 2017
Setup script for CRISPRO
@author: mitchel cole
"""
from setuptools import setup
import re
from os import path
def main():
version = re.search('^__version__\s*=\s*"(.*)"', open('bin/crispro').read(), re.M).group(1)
cur_dir =... |
e37a7211e4f3d9ded72f5f513e8600e089832dda7fd3fac9003e959fbe64ae61 | Python | 1,791 | 61 | import os
import re
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
from Bio.Seq import Seq
from Bio.Alphabet import IUPAC
from Bio.Alphabet.IUPAC import ambiguous_dna
import sys
def main():
fasta_file = sys.argv[1]
output_file = sys.argv[2]
log_file = sys.argv[3]
output_handle = open(ou... |
066b290675f53375c76cf0ff729b6ddf2cfb071c1f9e119b6f2839d4eaef9951 | Python | 1,792 | 59 | import numpy as np
from torch.utils.data import DataLoader
from torch.utils.data.dataloader import default_collate
from torch.utils.data.sampler import SubsetRandomSampler
class BaseDataLoader(DataLoader):
"""
Base class for all data loaders
"""
def __init__(self, dataset, batch_size, shuffle, valida... |
570c4973d7d8edf4f8dd9e62e40b725bd8068bf997562f035ba67be457e8b068 | Python | 1,793 | 50 | """Dataset info. Modify this with your own data directories for training IGUANA."""
import glob
import pandas as pd
import numpy as np
class __CoBi(object):
"""Defines the Colon Biopsy (CoBi) graph dataset"""
def __init__(self, fold_nr):
file_ext = ".dat"
root_dir = '/root/lsf_workspace/pro... |
457f8830515b872caf0cd5baede919c5ccfec6790afba9a0b487ad24b020a1ac | Python | 1,796 | 52 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import Any
import numpy as np
from onnx.reference.op_run import OpRun
def sequence_insert_reference_implementation(
sequence: list[Any] | np.ndarray,
tensor: np.ndarray,
posit... |
7a59cbc426aa9b6431095240a8808ec013c2cc792a6d49554a7eb6ec97da9bed | Python | 1,798 | 55 | # 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... |
6bfe4da70264a387522a09645b21c994d4dfd06d631888f0cfceeb0433d0b32d | Python | 1,799 | 73 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 14 15:20:09 2020
@author: sam
"""
import argparse
import os
import cv2
import numpy as np
import detectron2
from detectron2.config import get_cfg
from detectron2.engine import DefaultPredictor
def centroidFromBox(box):
centroid=np.zeros(2)
... |
19ee777ca2c8f52d432c7ce8550cb55d9d79fadcb555cf9c9b236b2e7bc23d70 | Python | 1,800 | 56 | # 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... |
93a78c27b00689df3b936a999728e0141d24a17ce53ad40932dc9f5f2ee20f60 | Python | 1,800 | 125 | """Tests for time series k-shapes."""
import numpy as np
import pytest
from sktime.clustering.k_shapes import TimeSeriesKShapes
from sktime.datasets import load_basic_motions
from sktime.tests.test_switch import run_test_for_class
expected_results = [
0,
1,
0,
1,
1,
0,
0,
1,
0,
... |
8377d2242fe6807ac27bddbfd927b060e1f783f2ecac2d47cb7a177e8a664a8f | Python | 1,801 | 54 | import logging
import numpy as np
import os
import random
import torch
from base.trainer_base import Trainer
from onmt.bin.train import train as onmt_train
from typing import Dict, List
class TransformerTrainer(Trainer):
"""Class for Transformer Training"""
def __init__(self,
model_name: str... |
4d0452c1e770eea379ab3e35ac8cbfd2305706b82f3020192fbe64d84bb45fe7 | Python | 1,802 | 51 | # 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... |
f872452df741443c7ef37e350f360b1c50ec44e0a9210c751237e60216ff3322 | Python | 1,802 | 52 | # 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... |
a5efa497d808f4fcbe35afa641bb43cdddbfe38c0786038b08196790c805fb88 | Python | 1,804 | 47 | import scipy.stats
import numpy as np
from .population import Population
from .. import cells
class Pyramidal(Population):
type = 'pyramidal'
def __init__(self, species='rat', **kwds): # ***** NOTE Species - no direct data for mouse (uses RAT data)
# Note that `cf` is the mean value used when s... |
0c9aa3757bdf4003c5c1c1b0ecbbc4152c3e5a076f8a114b7ff05ed610ad7eae | Python | 1,805 | 56 | #!/usr/bin/env python3
from __future__ import annotations
import argparse
from pathlib import Path
import numpy as np
import pandas as pd
import scipy.io
import tifffile
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description="Convert STARmap goodPoints.mat and optional la... |
31ae16df262861bc30f61d9c66308547fef4eb325b0216c532a39b47c9e7ec2d | Python | 1,805 | 50 | # 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... |
b298e2870d27ef843f01f1c93e03d255903585b90c30543e1bdded24ae7b0d97 | Python | 1,805 | 58 | import pytest
import pandas as pd
import scanpy as sc
from anndata import AnnData
from scipy.sparse import csr_matrix, issparse
import numpy as np
from palantir.utils import run_diffusion_maps
# Generate mock DataFrame data
def mock_dataframe(rows, cols):
rng = np.random.default_rng()
return pd.DataFrame(rng... |
7614eb33f75bb89c24b932fdab353f1dd81496749b97d9f6b0e1d5c8e7df28e9 | Python | 1,806 | 52 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import math
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class Gelu(Base):
@staticmethod
def export_gelu_tanh() ... |
d2c4368d6eadd842cd7d07d86289f7d0ec95d4130f6e6628635fd34edbd336b3 | Python | 1,808 | 52 | # 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
#
# ... |
3421c78c09516edc44e1f514be2e7191d9ac41e393602b9a1dd2895d27d4d97f | Python | 1,809 | 44 | """Test Experiments.
tests the experiments code works with all current valid classifiers. Loops through all
classifiers in the list in experiments, trains, Builds all.
"""
__author__ = ["TonyBagnall"]
class TestStats:
"""Test performance statistics."""
def __init__(
self,
unit_test_acc=0.0... |
ce65f30152e69749ae1ed0e413a7433af0eb0e08689162818e6341997321db8c | Python | 1,811 | 58 | # 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... |
ff516e58a839e7205b1fe581b01809e764a2418f581d2173ec2f3fc7cf4f58d0 | Python | 1,812 | 59 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Backend-independent SeZM configurations for export tests."""
def _tiny_sezm_model_params() -> dict:
"""Minimal fp64 SeZM config for self-contained export tests.
``precision="float64"`` is what unlocks the ``rtol=1e-10, atol=1e-10``
parity pt_expt enforces; ... |
aecd77ee157bef90583b54487ee30bbc12502d6b15e3728a21a8b178e5c5d059 | Python | 1,813 | 49 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GCNConv, global_add_pool
class GNN_PPI(torch.nn.Module):
def __init__(self, num_features, hidden_dim):
super(GNN_PPI, self).__init__()
self.conv1 = GCNConv(num_features, hidden_dim)
self.bn1 = ... |
4a44760ec59941de99854c019bd3c28afc5a02056f6b1d16d25db79571871794 | Python | 1,815 | 51 | """Auto-generate a classifier capabilities summary."""
import pandas as pd
from sktime.registry import all_estimators
# List of columns in the table
df_columns = [
"Classifier Category",
"Classifier Name",
"multivariate",
"unequal_length",
"missing_values",
"train_estimate",
"contractable... |
ae373e9d3f353542e1c18e51db0b2fc520b26dc1e29127d1c870cacc60e272ab | Python | 1,816 | 56 | import tensorflow as tf
import tensorflow_addons as tfa
from tensorflow.keras.layers import (
BatchNormalization,
Conv1D,
Dense,
Dropout,
GlobalAveragePooling1D,
MaxPooling1D,
)
from tensorflow.keras.layers.experimental.preprocessing import TextVectorization
character_split_fn = lambda x: tf.st... |
1861500305f2f4d3b3839c21b72e4177c945fe386a3529f61c7155873887a6f1 | Python | 1,818 | 54 | from ardent import imageData
import numpy as np
class Test_ImageMetaData:
"""Test class for ImageMetaData."""
def test_validate_nxyz(self):
# Test valid runs.
valid_inputs = [
# Scalar nxyz.
{'nxyz':0, 'image':None},
{'nxyz':1, 'image':None},
... |
f830dc8ad7a150623dde60eee3fc340133438168017e3a13141f5a3ea071d793 | Python | 1,818 | 54 | import torch.nn as nn
import torch
import torch.nn.functional as F
__all__ = ['GCN_E2_decline_leaky_slope']
def xavier_init(m):
if type(m) == nn.Linear:
nn.init.xavier_normal_(m.weight)
if m.bias is not None:
m.bias.data.fill_(0.0)
class GraphConvolution(nn.Module):
def... |
493c33887a4f48ea8040113f5c6b6570a05b5c66ba8c668774097a55435cf24b | Python | 1,819 | 61 | import os
import re
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
from Bio.Seq import Seq
from Bio.Alphabet import IUPAC
from Bio.Alphabet.IUPAC import ambiguous_dna
import sys
def main():
fasta_file = sys.argv[1]
output_file = sys.argv[2]
log_file = sys.argv[3]
output_handle = open(ou... |
6b46d6537edb2d7fac012347ab5cc09ff77948d8f518c346b294a521bf4e6d36 | Python | 1,819 | 54 | # 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... |
8bf1b92471e9a4c8aa075eb8bb07120901166f5ac2e9e54b903677802bca13c5 | Python | 1,819 | 48 | """train_precipitation"""
"""
Author: Yimin Yang
Last revision date: Jan 18, 2022
Function: Run this to train the model on precipitation maps dataset
"""
import torch
from Models.AA_TransUNet import AA_TransUnet
import pytorch_lightning as pl
if __name__ == "__main__":
args = {
'vit_blocks': 1, # MLP l... |
5cf842ac867abdee8b4614a71b84478b83f036d7507ec3366e325fff0844d812 | Python | 1,820 | 47 | #-------------------------------------------------------------------------------
# elftools example: examine_dwarf_info.py
#
# An example of examining information in the .debug_info section of an ELF file.
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#----------------------------------------... |
97f0b3504b3a8cf7c6ff5a0f87e210f1ee69ac1b529061798e37ddd8990b8432 | Python | 1,821 | 46 | from networkunit.tests.two_sample_test import two_sample_test
from networkunit.capabilities.ProducesSpikeTrains import ProducesSpikeTrains
from elephant.statistics import isi, lv, cv, cv2, lvr
from networkunit.utils import use_cache, filter_valid_params, parallelize
import numpy as np
class isi_variation_test(two_sam... |
c68053590168ce35c79d499e2b33e0e7ca3aff7319b0feb09770065c9bb66ad9 | Python | 1,823 | 61 |
import numpy as np
import pandas as pd
import pytest
from numpy.testing import assert_array_equal, assert_array_almost_equal
from pandas.testing import assert_frame_equal
from seaborn._core.groupby import GroupBy
from seaborn._stats.regression import PolyFit
class TestPolyFit:
@pytest.fixture
def df(self,... |
0f604640b5fac3b4368628cd923d1f2e94b6db2a31cc1577dacd014668eb8799 | Python | 1,824 | 51 | from __future__ import print_function
import sys
from os import listdir
from os.path import splitext
import numpy as np
from parameterSetup import ParameterSetup
from featureconnector import Featureconnector
#---------------
# set up parameters
args = sys.argv
if len(args) > 1:
option = args[1]
else:
option = ... |
075dd538c3c275983a04af3ee55839b0ee2ae264ac409d9c86e7d1f4d8f35ec3 | Python | 1,826 | 47 | # 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... |
2d1e1737e7634db4bf671a5376edbc7c72e495f0cfda007578d7d4f226774f19 | Python | 1,828 | 67 | # 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... |
a670dab8a58baf6ed281f371aab3b066c1635668222301350ec9d2be7aea370f | Python | 1,829 | 49 | # 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... |
f81e5cf859dabd52e1cc8858c6aab84c152dcfb537cc90fd757df76b1b4109f1 | Python | 1,829 | 51 | from sparcur.utils import want_prefixes
import rdflib
import requests
mis = rdflib.Graph().parse(data=requests.get('https://cassava.ucsd.edu/sparc/exports/curation-export.ttl').content, format='turtle')
graph = mis
def reformat(ot):
return [ot.label if hasattr(ot, 'label') and ot.label else '', ot.curie]
objects ... |
4019869945150e1a67e604d9df96b91531a220d8a08237b569cf9dc91b08aaec | Python | 1,832 | 49 | """Benchmarking for regression estimators."""
__author__ = ["NAME-ASHWANIYADAV"]
__all__ = ["RegressionBenchmark"]
from sktime.benchmarking.classification import ClassificationBenchmark
class RegressionBenchmark(ClassificationBenchmark):
"""Regression benchmark.
Run a series of regressors against a series ... |
5ed04cb3630f825c0bbe95c8bb87c81600983c908411a7244e8cabff62d14299 | Python | 1,832 | 56 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 16 10:20:39 2017
@author: tpisano
"""
import numpy as np, matplotlib.pyplot as plt
def cohen_d(x,y, log_transform=False):
'''Function to calculate effect size based on https://stackoverflow.com/questions/21532471/how-to-calculate-cohens-d-in-p... |
413974381f0bfe2213eac4eceaa13d574f092850f512b0f320afac98416bd1fc | Python | 1,833 | 60 | import unittest
import rdflib
from pyontutils.core import OntResIri, OntResPath, OntResGit, OntResAny
from pyontutils.core import OntGraph, OntConjunctiveGraph
from .common import skipif_no_net
@skipif_no_net
class TestOntResIri(unittest.TestCase):
def setUp(self):
# TODO localhost server running in threa... |
e48bcd2eda727c19b032e1e04b9f2fb864aa368a05564a5c83326d0e8ec4902d | Python | 1,833 | 61 | """Example generation for testing.
Exports examples of in-memory data containers, useful for testing as fixtures.
Examples come in clusters, tagged by scitype: str, index: int, and metadata: dict.
All examples with the same index are considered "content-wise the same", i.e.,
representing the same abstract data objec... |
09da38bb003f491f1f83f122d98cee2b143c72366409e3ff11eaca15fa192f89 | Python | 1,836 | 59 | # 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... |
57f008aff2495a4f71ad968a29ba8089c93711b4734963e7e99d9d4164501aa6 | Python | 1,836 | 46 | '''create dataset and dataloader'''
import logging
import torch
import torch.utils.data
def create_dataloader(dataset, dataset_opt, opt=None, sampler=None):
phase = dataset_opt['phase']
if phase == 'train':
if opt['dist']:
world_size = torch.distributed.get_world_size()
num_wor... |
70ceca4d561178a6db1b10a9a436212b45d46d6a7e7baaa0e1c0b3bd1067676d | Python | 1,836 | 61 | # roifile_demo.py
# Copyright (c) Christoph Gohlke
# SPDX-License-Identifier: BSD-3-Clause
"""Demonstrate the roifile module.
Use the roifile and tifffile modules to read and write the results of image
segmentation from/to ImageJ TIFF files.
"""
import numpy
from matplotlib import pyplot
from skimage.measure impor... |
c815ffbdc9198e5967dc4875bf2f67e25a84a533859ce17e0291977f52a020af | Python | 1,837 | 65 | import numpy as np
from enum import Enum
import h5py
from pathlib import Path
PatID = Enum("PatIDs", ["ET1", "ET2", "ET3", "ET4", "ET5", "ET6", "ET7", "ET8"])
Task = Enum("Task", ["Pegboard", "Pouring", "Posture"])
Stim = Enum("Stim", ["ON", "OFF"])
DATA_PATH = Path(__file__).parent / Path("../../patient_data/")
cl... |
1fdcd871b950383a48f3d9655db84fdb816d05c543f456b126096389b5be04d9 | Python | 1,838 | 65 | from scipy.signal import butter, lfilter
def butter_bandpass(lowcut, highcut, fs, order=5):
nyq = 0.5 * fs
low = lowcut / nyq
high = highcut / nyq
b, a = butter(order, [low, high], btype='band')
return b, a
def butter_bandpass_filter(data, lowcut, highcut, fs, order=5):
b, a = butter_bandpas... |
06b500df899352893d6f3ebf01bc1f15abe976d67f7bc91158f7bd456b942ceb | Python | 1,839 | 57 | # 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... |
8e57da680027499d9bcef950692d5ab9e16c8a718b57bfd712446f765dccd878 | Python | 1,839 | 49 | # 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... |
d94f7edcc6a9bb243a44b089d918ce8589ca6b2b2de1545814aa2859aa4a0bfb | Python | 1,840 | 51 | import json
import logging
import time
import grpc
from google.protobuf.empty_pb2 import Empty
from minio import Minio
from mprl.utility_services.cloud_storage import DEFAULT_LOCAL_SAVE_PATH
from mprl.utility_services.protobuf.population_server_pb2 import ManagerStats
from mprl.utility_services.worker.base_interface ... |
c3e5aeb9919133a71c0af362a2f3f74120e3f5174141fdd793b5daa0d3e119f4 | Python | 1,842 | 56 | from setuptools import setup, find_packages, Extension
from Cython.Build import cythonize
import numpy
"""
This setup.py is for *vcnmodel*.
Support::
NIH grants:
DC R01DC015901 (Spirou, Manis, Ellisman),
DC R01 DC004551 (Manis, 2013-2019, Early development)
DC R01 DC019053 (Manis, 2020-2025, Later de... |
f0034479757282581d0f67a0e8c62367770892eb943d31cded7d124432b04a9d | Python | 1,843 | 51 | # 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... |
5676878ce79ef682c50a3d1fd57d0c3881fd34ee3a51b2203f92cab5e5c11ede | Python | 1,846 | 53 | # 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... |
2f2bb9a2b5534179591333e5ccff166a7faa50c46b5384b827c98799c21ec809 | Python | 1,847 | 50 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GCNConv, global_add_pool
class GNN_MSP(torch.nn.Module):
def __init__(self, num_features, hidden_dim):
super(GNN_MSP, self).__init__()
self.conv1 = GCNConv(num_features, hidden_dim)
self.bn1 = ... |
08f571fa728db0dace77c9eb1b4249cbfa509927ef667da35ac9842bb00217e9 | Python | 1,848 | 51 | """Tests for bycycle.plts.burst."""
import pytest
import numpy as np
from bycycle.burst import detect_bursts_cycles
from bycycle.tests.tutils import plot_test
from bycycle.tests.tsettings import TEST_PLOTS_PATH
from bycycle.plts import *
############################################################################... |
3ffb94545c6fe0ac8e3d05e1d969c3431b9a49204afdd5cf284afc234fb8c524 | Python | 1,849 | 49 | # 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... |
d32a3e17ba419423c1add74b9f651243ca8b519e641975f0c715a6b6e12cd55c | Python | 1,850 | 63 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 29 15:46:05 2020
@author: sam
"""
import os
import argparse
from pipeline_utils import submit_job
from pipeline_utils import check_filedeps
import glob
if __name__ == '__main__':
p = argparse.ArgumentParser('Running pipeline on remote', add... |
bc6a4fdc7d0d66dfbc5f782ef12eeb2b816d82ccf991a9e6af2b60a9b9b051a8 | Python | 1,851 | 53 | from flair.data import Sentence
from flair.embeddings import (
FlairEmbeddings,
StackedEmbeddings,
TokenEmbeddings,
WordEmbeddings,
)
from flair.embeddings.base import load_embeddings
def test_stacked_embeddings():
glove: TokenEmbeddings = WordEmbeddings("turian")
flair_embedding: TokenEmbeddi... |
e6553da5d50439a90d28fe369b6d9266c7275052743b07e63d87941c19f2c46a | Python | 1,851 | 50 | # Copyright 2007 Zachary Pincus
# This file is part of CellTool.
#
# CellTool is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
"""Save contour data as Matlab-readable .mat files.
The files will b... |
5cf1513a1160c9ac3941d0da137314b2babe0ce00d5e3bf63a55515d3d8416ce | Python | 1,853 | 123 | """Tests for time series kernel kmeans."""
import numpy as np
import pytest
from sktime.clustering.kernel_k_means import TimeSeriesKernelKMeans
from sktime.datasets import load_basic_motions
from sktime.tests.test_switch import run_test_for_class
expected_results = [
0,
1,
0,
0,
0,
0,
1,
... |
b40a7d707794fa6e6074ca3bf8b56bf56db9f7f813d41a7e00c16550096905c7 | Python | 1,854 | 57 | import subprocess
import sys
import os
from pciSeq._version import __version__
from pciSeq.app import fit
from pciSeq.app import cell_type
from pciSeq.src.preprocess.spot_labels import stage_data
import pciSeq.src.core.utils as utils
from pciSeq.src.core.logger import attach_to_log, setup_logger
from pciSeq.src.core.an... |
ea3889e6a33228c058f2c2fff7da42a83eb3f1c12de69e5d0e3af9278d69d782 | Python | 1,854 | 48 | # 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... |
02cc9d4ffd734f3f421dd2165d76fbffd6710242829fbf56ac177af2c9f05e6c | Python | 1,855 | 48 | # 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... |
9229b15af4bf7f7fc52eee715e7cbdc38a179cf9ed1e2f1140b612e38339e6c9 | Python | 1,855 | 65 | from __future__ import print_function
import sys
from os import listdir
import numpy as np
from parameterSetup import ParameterSetup
from fileManagement import getFileIDs
from algorithmFactory import AlgorithmFactory
from outlierMouseFilter import OutlierMouseFilter
#---------------
# set up parameters
args = sys.argv... |
a1e1192ae6ea0f531e7e9659933dc5b3f6d73d0f80b426576e4431dbe83cd87c | Python | 1,855 | 71 | import os
import numpy as np
import pandas as pd
# feature set paths
SNAPSHOT_1 = 'outputs/snapshot_1.csv'
SNAPSHOT_2 = 'outputs/snapshot_2.csv'
SNAPSHOT_3 = 'outputs/snapshot_3.csv'
SNAPSHOT_4 = 'outputs/snapshot_4.csv'
SNAPSHOT_5 = 'outputs/snapshot_5.csv'
# get the feature sets
df1=pd.read_csv(SNAPSHOT_1)
df2=pd.... |
9c8399a593710d077adc360680da8dd0410dde238516b58ae0d8cae3a18934ea | Python | 1,856 | 88 | '''
This contains the selectors used for selecting the individuals allowed to mate
.. codeauthor:: Nicholas Browning
'''
from __future__ import print_function
from builtins import range
import numpy as np
def selector(settings, individuals, selector_op, **args):
'''
Prints the selector used to the output a... |
a3c099b611c6eaf1e98bcc5602481c6c989d1ee202858099b9a4cfd2f358dc14 | Python | 1,858 | 57 | from collections import namedtuple
class Rect(namedtuple("RectBase", ['x', 'y', 'w', 'h'])):
def point_in(self, x, y):
return self.x <= x <= self.x + self.w and self.y <= y <= self.y + self.h
def rect_in(self, r):
return self.point_in(*r.corners()[0]) and self.point_in(*r.corners()[1])
d... |
7415e6d19dd53c409581814b5fe8b29812f8cacdcb76f0fcec629857229b080c | Python | 1,860 | 50 | from scipy import stats
import pandas as pd
import os
import numpy as np
def test_model(config, model, DataHandler, verbose=1):
spearman_result = {}
if verbose > 0:
print('Testing model')
test_input = [DataHandler['X_test'], DataHandler['dg_test']]
test_true_label = DataHandler[... |
7d4ee1de497315b1bc86d398f58ffe1840e32e51fefb231ec8fc48f9bc43bbb4 | Python | 1,860 | 51 | # 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... |
24955fe15459c642973b4182284144d7e3d96eb0c31935b38195a73f16c3cb70 | Python | 1,861 | 39 | from __future__ import print_function
import pickle
import numpy as np
class FeatureDownSampler():
def __init__(self):
pass
def featureDownSampling(self, inputFeaturePath, outputFeaturePath, outputDim):
print('inputFeaturePath = ' + inputFeaturePath)
print('outputFeaturePath = ' + out... |
d82dde6fa6222de13d01c470c76d6dd1a38430f288ff25debe205318b0a94905 | Python | 1,861 | 70 |
# -*- encoding: utf-8 -*-
import sys
import os
import unittest
class Params(object):
def __init__(self, **kwds):
"""
Utility class to create parameter lists
create using:
p = Params(abc=2.0, defg = 3.0, lunch='sandwich')
reference using:
p.abc, p.defg, etc.
... |
c4187bbb15271c397df88c52e9a43cd64bcead19ca1952d703d31edcb6bc3901 | Python | 1,863 | 55 | # 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
#
# ... |
86efb51506d44bc512780faaeaa3e387339c010438309790be9d56370241ed3d | Python | 1,864 | 73 | import matplotlib
matplotlib.use("Agg")
import seaborn as sns
from matplotlib import pyplot as plt
import sys
import pandas as pd
import numpy as np
col_names = ["impact", "count"]
ex = pd.read_csv(sys.argv[1], sep="\t", names=col_names)
ex["tech"] = "exome"
wg = pd.read_csv(sys.argv[2], sep="\t", names=col_names)
w... |
f6b1a926f25e0c8b40b074fc21df90aa01044cc4ec45b4ec3e953754d36cbb42 | Python | 1,864 | 56 | # 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
#
# ... |
611d4766431a50e1f80fb3cf9d8171e1bf0278d8def6351f470cf85feae155ba | Python | 1,865 | 61 | from Historia.mech.mechanics_solution import (
calculate_features,
extract_data_from_logfile,
extract_limit_cycle,
)
from Historia.shared.plot_utils import plot_pvloop
def main():
path = "data/"
nbeats = 4 # extract 4th-beat simulation solution (assuming you have run at least nbeats)
# -----... |
7cbf37dc82a1cdbe902649490237bbb61c1534e8fd4dbce019b8a3164789b19a | Python | 1,866 | 81 | # 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
#
# ... |
89f89fad331c66ed8ea629c82e37724632fe64348cf720d93706e6c2f37ab867 | Python | 1,866 | 37 | import face_recognition
# Often instead of just checking if two faces match or not (True or False), it's helpful to see how similar they are.
# You can do that by using the face_distance function.
# The model was trained in a way that faces with a distance of 0.6 or less should be a match. But if you want to
# be mor... |
8fc0255c576f371f45cb04b55d131fcd2a9266fc8be9d5083cde749cbc08e189 | Python | 1,866 | 58 | # 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... |
c564c255b1e09b99dbf15d6d2294af594cf3a5ae585a94d47252d472c779331f | Python | 1,869 | 57 | import pandas as pd
from netplotbrain import plot as npbplot
import pytest
import templateflow.api as tf
# Download atlas info
atlasinfo = tf.get(template='MNI152NLin2009cAsym',
atlas='Schaefer2018',
desc='100Parcels7Networks',
extension='.tsv')
atlasinfo = pd.r... |
4e66171c0a8cdf5feacc8806f1d3d76c7068f0948fdf4a443bf40a084dd21976 | Python | 1,870 | 59 | # 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 bernoulli_reference_implementation(x, dtype):
# binomial n = 1 equal... |
df9da0e1bb9be1b0b801b28f30c910dcddc23273ac28949915b26003d4c8c283 | Python | 1,871 | 43 |
#=======================================================================================================================
# 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... |
de2159c7aa3c9557ffba9957966c1c01e01ff1583061c558575a71e0894c81cd | Python | 1,872 | 64 | # 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 ConstantOfShape(Base):
@staticmethod
def export_float_ones() -... |
15a15055202794f8c88d22a7203575a1b8894e5d9864379ca20ad7c69be9f435 | Python | 1,874 | 46 | from scipy import stats
import os
import pandas as pd
import numpy as np
def test_model(config, model, DataHandler, verbose=1):
spearman_result = {}
if verbose > 0:
print('Testing model')
test_input = [DataHandler['X_test'], DataHandler['X_biofeat_test']]
if config.flanks:
... |
83e1e8a0a0de9482bee4ee74a50ba50f2b92c5f48ae66cbff29b1c6fbe6c5cfe | Python | 1,874 | 52 | import argparse
import subprocess
import sys
from abc import ABC, abstractmethod
class TaskManager(ABC):
def __init__(self, description):
self.description = description
self.process_number = -1
self.args = None
def run(self):
parser = argparse.ArgumentParser(description=self.d... |
8d0884d5f7d79ffd170a642fc181cfd937892d1e79eaa5ea07e50e9a8c91e0aa | Python | 1,874 | 56 | """
test_translator.py
This trial translator is used to convert foraging2-style trials to
foraging1-style trials for backwards compatibility.
"""
import os
import pickle
import pytest
from camstim.translator import TrialTranslator
NEW_TRIAL = {
'index': 2,
'rewards': [(27.841424298714276, 1208)],
's... |
c98a5e001237519a477e7edb68b90d5a8e2cf49c66c17e2e761ef7e82b0bfb41 | Python | 1,874 | 45 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# # MA plot
# Author: Charles E. Vejnar (charles.vejnar@gmail.com)
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# Parameters
test_name = 'WT shield vs a-Am'
col_sep = ' '
cutoff_fc = 2.
cutoff_pvalue = 0.01
outext = '.... |
3cfe403d2502b49d3e6cdf195ec4768dc98994e520a150c5206967308dd935d1 | Python | 1,875 | 86 | import sys
import _pickle as pickle
import numpy
print('\n$1 Net_file (col1: ID; col2: ID)\n$2 Signal_matrix (col: bins; row: ID)\n$3 Output_index_file\n')
NETWORK_PATH=sys.argv[1]
EXP_POOL_PATH=sys.argv[2]
OUT_DATA_PATH=sys.argv[3]
SPLIT=':'
class Used_Data:
def __init__(self, EXP, EXP_LENGTH, EDGE, header):
... |
45d60cf0ade709819ad09cbed6a4cc71db2cfda402f394ae575c7a0ee87e030b | Python | 1,875 | 59 | import numpy as np
def _plot_spheres(ax, nodes, node_columnnames, node_color='salmon', node_size=20, alpha=None, **kwargs):
"""
Function that plots spheres in figure.
Parameters
---------------
ax : matplotlib ax
nodes : dataframe
node dataframe with x, y, z coordinates.
node_colu... |
32067e35e0287485edd5b8f2b7f7f1e37f2bd4dd9e29fdd6c9385e90d8cca62b | Python | 1,876 | 58 | #!/usr/bin/env python
"""Developer notes
- Prepare for pypi:
python setup.py sdist
- Upload to pypi test server to check:
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
- Use testpypi with pip:
pip install --index-url https://test.pypi.org/simple/ pydeface
- Upload to pypi
twine upload dist/*
""... |
50d2a427734d6c8de303dbb98a331232fd70609c8b42446f8fc9debd235580c9 | Python | 1,877 | 66 | """
Main script of the pipeline. Extracts data for each species from the text files shared at Zenodo website (10.5281/zenodo.6638529).
Change the name of your subjects directory, input text file, and results directory accordingly.
There are multiple subjects for humans (N=501), macaques (N=31), and chimpanzees (N=54... |
8daf9ff6fb615a62367cf370cc46ff90274d27b11c8ef24677e24b8357569c5a | Python | 1,879 | 56 | # 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
#
# ... |
2fc00790dae8f70ea5c85ee54c426df658ffea7bdee0446a91cc6f438e6a1c77 | Python | 1,884 | 56 | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from ..builder import BACKBONES
from .base_backbone import BaseBackbone
@BACKBONES.register_module()
class AlexNet(BaseBackbone):
"""`AlexNet <https://en.wikipedia.org/wiki/AlexNet>`_ backbone.
The input for AlexNet is a 224x224 RGB image... |
48f06ef370ef4c1b096026e1453f30de04226d0b4abd8dae9c84866192ec57f2 | Python | 1,885 | 47 | from __future__ import print_function
import pickle
import numpy as np
from parameterSetup import ParameterSetup
class InputAndOutputExtractor(object):
def __init__(self):
self.params = ParameterSetup()
self.eegDir = self.params.eegDir
self.featureDir = self.params.featureDir
self.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.