sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
6c54b4591512f2f74cf10187d622982f7a467aaa08fd3f32193442894f5ede55 | Python | 3,412 | 69 | # 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, ... |
e2eef78cff4b204ff0c6b53020a83fa5c7270edb5b46d012e95b37fc231c1942 | Python | 3,412 | 74 | # 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... |
bbd8ba3a8a6de24fbba68ed93db562f7bcdb2dfef3077cc747d94a5856a6f692 | Python | 3,413 | 99 | # 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
from .AbstractScoringLayer import register_layer, Abstr... |
23e3093c71e5b96c3aa79fc42efa890beb16764c6b9074094a3dac7f52d33f74 | Python | 3,420 | 115 | # Extract the scores from Jose Jimenez benchmark for selected targets.
import json
import os
import os.path as osp
from typing import Dict, List
import numpy as np
import pandas as pd
from molucn.utils.parser_utils import overall_parser
NO_VALUES_AT = [28, 269, 346, 600, 608, 655]
def clean_score(score: List[float... |
c0ee6a094dcdab289d6e595702558e3ab42ba9bece53abb15418e6eb1aba69c2 | Python | 3,420 | 109 | # 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... |
da2aec358763205aa35a0976a9bb055906a6722fec11b6382b019804a5ed1f57 | Python | 3,420 | 94 | import math
import torch
from mmcv.runner import get_dist_info
from torch.utils.data import Sampler
from mmcls.datasets import SAMPLERS
@SAMPLERS.register_module()
class RepeatAugSampler(Sampler):
"""Sampler that restricts data loading to a subset of the dataset for
distributed, with repeated augmentation. ... |
a58328298e7d01c505ddf78a6f403f331056ad8eb2ac3ad6b6ecacd20ca0d39f | Python | 3,422 | 78 | #-------------------------------------------------------------------------------
# elftools tests
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import io
import os
import unittest
from elftools.common.exceptions... |
d57a866cbf36d7c21be9ae26be6678b2dbf0025c6cab285ab46d236f3f67a350 | Python | 3,422 | 94 | # 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... |
f64705b0ed3b713e67241105dddc48a2e27666223fc0e54429d183faa7c2a34c | Python | 3,422 | 103 | """Tests for source/odp_plotting_functions.py.
Two public functions: `format_matplotlib` (just configures rcParams)
and `plot_decay` (writes a PDF + a TSV from an ALG-decay datastruct).
Both run under the `Agg` backend that the module forces at import time.
"""
from __future__ import annotations
from pathlib import P... |
3c06e87fce12d26a43e730372a21ab8b3fceb3201b3f03ce80b54fe7e4afd677 | Python | 3,423 | 116 | import numpy as np
from brian2 import *
# import matplotlib.pyplot as plt
import time
import pickle
import brian2cuda
set_device("cuda_standalone", build_on_run=False)
"""
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
NEURON AND SYNAPSE DEFINI... |
ac5870cad077debff34a2dc4090070bda1091dcfe0dc6164dd43b5328ad29939 | Python | 3,423 | 135 | """Tests for scipy interface."""
import numpy as np
import pytest
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.dists_kernels.scipy_dist import ScipyDist
from sktime.tests.test_switch import run_test_for_class
from sktime.utils._testing.panel import make_transformer_problem
@pytest.fixt... |
c037eff3acc4d5cb7511dbcf5af1a8df693e789f31a98826f80d37b58781d185 | Python | 3,423 | 94 | # 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... |
852a39decee1965c6f29a19c4dd048dbbbe198a3f5d194f4cfc916d9bfdfd6b1 | Python | 3,429 | 88 | import matplotlib.pyplot as plt
from spine_clusterization import DBSCANSpineClusterizer, KMeansSpineClusterizer, ManualSpineClusterizer
from CGAL.CGAL_Polyhedron_3 import Polyhedron_3
from spine_metrics import SpineMetricDataset, save_metrics, load_metrics
import numpy as np
from scipy.special import kl_div
from notebo... |
88576a58f90d3df6a257cabcc40e0bb73fd67ad96d8b1505052de033a0def1b1 | Python | 3,429 | 106 | import autokeras as ak
import tensorflow as tf
from keras_tuner.engine.hyperparameters import Choice, Fixed
from layers import (DenseBlockCustom, DownsamplingMultBlock, MultBlock,
RegressionHeadCustom, SigmoidBlock)
def NAS_automodel(
loss,
network_name="prosub",
n_features=1344,
... |
50404a35ac1134a18d229f03b0305b10d1c26f986d9c8c419788d7d307061e32 | Python | 3,430 | 97 | import argparse
import logging
import os
import sys
import time
from datetime import datetime
try:
from gln.common.cmd_args import cmd_args as gln_args
from models.gln_model.gln_processor import GLNProcessor
except Exception as e:
print(e)
try:
from models.transformer_model.transformer_processor import... |
7c33c9dab601a25df116db44aed8884d1b49149ca86ee855f6ad84c1a3dc5124 | Python | 3,436 | 95 | # 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... |
d690ee90b17243835d0ba50b95e4d387f5a61f36c304480b999cf0e892dcbbb5 | Python | 3,436 | 111 | """Tests for AutoResearchForecaster.
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""
__author__ = ["OfficialAbhinavSingh"]
import json
import math
import pytest
from sktime.datasets import load_airline
from sktime.forecasting.agentic import AutoResearchForecaster
from sktime.split impor... |
4dc4754db2a6f39c3526fe8b5c5c7f56552a4ca12dcf3e14e46321c3b7f21c46 | Python | 3,437 | 116 | from scipy.stats import f as f_distrib
from scipy.stats import ttest_1samp
from scipy.spatial.distance import cdist, euclidean
import pandas as pd
import numpy as np
def hotelling_ttest(X: np.array, to_alr=False):
""" Tests if table is centered around zero.
Parameters
----------
X : np.array
R... |
75746a5a966b528f13d097bb6f58b77585853963fb9475100bdd3e814843f7c0 | Python | 3,438 | 77 | import unittest
from pcl_id_factory import get_class_id, get_individual_id, taxonomy_ids, get_taxonomy_id, get_reverse_id
from template_generation_utils import migrate_manual_curations
class PCLIdFactoryTestCase(unittest.TestCase):
def test_taxonomy_ids_parsing(self):
self.assertTrue(len(taxonomy_ids) >=... |
2866f8e08d3c3ea1dcbcae6af6ffbea59effe548619c510a1665ba77f6515e9e | Python | 3,439 | 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 =... |
c5be43168de1e4f281cff44d05e193261ee97fe5c496154ab36779cc9eab6a12 | Python | 3,439 | 96 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import numpy as np
import onnxruntime as ort
import torch
from mmcls.models.classifiers import BaseClassifier
class ONNXRuntimeClassifier(BaseClassifier):
"""Wrapper for classifier's inference with ONNXRuntime."""
def __init__(self, onnx_file,... |
1e3bd76188d3a1ad2b6f6e92cff43fc5f73e050a3f266d6a34c6d79b9241876b | Python | 3,444 | 93 | import os
import numpy as np
from datetime import datetime, timedelta
import pandas as pd
import pickle
from itertools import islice
import sys
from multiprocessing import Pool
import time
def get_interval_data(df_in, interval_length_in_seconds, patient_id):
all_intervals = list()
num_skipped_intervals = 0
... |
af166a17f493199177999957321525e7544eb47f96b97e4b2b1ac49b1bd738ec | Python | 3,444 | 84 | """
Analyze the simulation speed of the different backends
William Nourse
September 9 2021
Little hand says it's time to rock and roll
"""
import matplotlib.pyplot as plt
import numpy as np
import pickle
# this can be found inside 'backendSpeedData_old.zip'
# data = pickle.load(open('backendSpeedData/dataBackendTimes... |
4346ceb6dad76c351561c1540d28d493c7080fa16c1bda899278063e76a5803d | Python | 3,448 | 108 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Implements adapter for tslearn models."""
__all__ = ["_TslearnAdapter"]
__author__ = ["fkiraly"]
from inspect import signature
from sktime.utils.adapters.forward import _clone_fitted_params
class _TslearnAdapter:
"""Mixin adapter class ... |
80832c35c7ada0b71b6d905ac97674596ce86aac8561b33c804cfd88843a61e3 | Python | 3,449 | 117 | import numpy as np
import pandas as pd
import sys, os
from random import shuffle
import torch
import torch.nn as nn
from models.gat import GATNet
from models.gat_gcn import GAT_GCN
from models.gcn import GCNNet
from models.ginconv import GINConvNet
#from read_smi_protein import *
from torch_geometric.data import InMem... |
9e311154cac5eae994137b2e835780db3904852bba91a75cf9993f20aff62b82 | Python | 3,449 | 104 | #!/usr/bin/env python
"""Extract KR-balanced dense Hi-C matrix from a .hic file at a chosen resolution.
Output: a tab-separated dense N×N matrix where N = ceil(chrom_length / resolution).
NaN values from KR (low-coverage bins) are zero-filled by default.
Usage:
python extract_kr_matrix.py <hic_path> <chrom> <out_... |
e893e1137efdd0cebacf8f57b8c8dd7323117025e0e076a6dfb07679d6647768 | Python | 3,449 | 90 | import logging
import os
import shutil
import sys
import time
from abc import abstractmethod, ABC
class DirWatcher(ABC):
def __init__(self, input_dir, intermediate_dir, results_dir, name):
self.__results_dir__ = results_dir
self.__intermediate_dir__ = intermediate_dir
self.__input_dir__ = ... |
1972655f0ca87e807950b1a333c9b8ff7539f90ea65b3e41cda16b196f4b17c0 | Python | 3,450 | 113 | from copy import deepcopy
from typing import Callable, List, Tuple
import numpy as np
import rdkit
import torch.nn as nn
from rdkit.Chem import AllChem, DataStructs, MolFromSmiles
from torch_geometric.data import Data, HeteroData
from tqdm import tqdm
FP_SIZE = 1024
BOND_RADIUS = 2
def gen_dummy_atoms(mol: rdkit.Mo... |
4b52387ecd663c1daa7bf83363438b0331d594831fe136d7c43b40ea093c399b | Python | 3,451 | 105 | # 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... |
348813a81f586a228d43630f616f990bcdadab03b0b1bcad0479f297beec9cdc | Python | 3,452 | 94 | import logging
import numpy as np
import os
import random
import torch
from onmt.bin.translate import translate as onmt_translate
from rdkit import Chem
from typing import Dict, List
def canonicalize_smiles(smiles: str):
"""Adapted from Molecular Transformer"""
smiles = "".join(smiles.split())
mol = Chem... |
a232746c7cb889fa7de63d1da892449dd38507de9a47d7e8e4226980b87b819d | Python | 3,456 | 118 | 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
"""
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
ff90ca444ab3cf7477a61f6a0c986353270ac3c8b561453edabcba792c400c4f | Python | 3,456 | 121 | import os
import imageio
import numpy as np
import pandas as pd
from .event2frame import EventSlicer
from .event2frame import rectify_events, cumulate_spikes_into_frames
import h5py
from tqdm import tqdm
def generate_files(root: str, sequence: str, num_frames_per_ts: int = 1):
timestamps = pd.read_csv(os.p... |
390a59d167984e72b7d59cdc25e0d5a6cc9263cae85bdf068458842382e5bda2 | Python | 3,457 | 104 | import sys, os, os.path
sys.path.append('../../gumpy')
import numpy as np
import gumpy
# First specify the location of the data and some
# identifier that is exposed by the dataset (e.g. subject)
base_dir = '../Data/NST-EMG'
subject = 'S1'
# The next line first initializes the data structure.
# Not... |
20eed876b4281924d0ea070767dcf376fdcec110d64e39964bb978d8ffe52009 | Python | 3,459 | 108 | # 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... |
546ddfa33c04d19203711415c9eda17de6f45597c80b298b36188987504d6549 | Python | 3,459 | 83 | import torch
import torch.nn as nn
from transformers import BertModel, BertPreTrainedModel
class FCLayer(nn.Module):
def __init__(self, input_dim, output_dim, dropout_rate=0., use_activation=True):
super(FCLayer, self).__init__()
self.use_activation = use_activation
self.dropout = nn.Dropo... |
04d2c75c31b23df4936e3c77c23a23ad9c1c1e0296d49d748bed5d2f6a3fd4f6 | Python | 3,462 | 98 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from typing import Any
import onnx.checker
from onnx import ModelProto, ValueInfoProto
def update_inputs_outputs_dims(
model: ModelProto,
input_dims: dict[str, list[Any]],
output_dims: dic... |
f8dd5361ea101ca8606e06f4072cafe0efe0cbc23f82e6ab30b79846f40a6b3a | Python | 3,465 | 115 | import types
from collections import Counter
import numpy as np
import torch
from torch.nn import ConstantPad1d
from torchtext.vocab import build_vocab_from_iterator, vocab
VARIABLE_LENGTH_DATASETS = [
"human_enhancers_ensembl",
"dummy_mouse_enhancers_ensembl",
"human_ocr_ensembl",
"human_ensembl_regu... |
7a84e5b0ac1e2b1aa74275d1d1555f465ce0c319c60d2bf1165aaecb2ac4bef7 | Python | 3,466 | 87 | from pathlib import Path
import pandas as pd
import pytest
from genomic_benchmarks.data_check import info, is_downloaded, list_datasets
from genomic_benchmarks.utils.paths import CACHE_PATH, DATASET_DIR_PATH
# dataset_name, version, train samples, test samples, num of classes
datasets_test_data = [
("human_no... |
08de70fd472ce3a3bcb79931c2c301b0ada417525ca01e195c2f915c76cf8b40 | Python | 3,468 | 65 | from models import VariationalNetwork
import torch
import argparse
import pytorch_lightning as pl
from data_utils import *
from torch.utils.data import DataLoader
from pathlib import Path
from torchsummary import summary
from misc_utils import print_options
import os
parser = argparse.ArgumentParser(descripti... |
be0e4e16dab9d64886b089ea107382b5bcdcf2adfd4a83ab2645c1fee9233456 | Python | 3,469 | 92 | # 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... |
a4e371158a769fcd65a8e4639d935394f5a6a077e9b3a90484e6628757f3b735 | Python | 3,471 | 114 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
class Norm(nn.Module):
def __init__(self, d_model, eps=1e-6):
super().__init__()
self.size = d_model
# create two learnable parameters to calibrate normalisation
self.alpha = nn.Parameter(torch.ones(sel... |
42269a87aa8623f1ff12128a684a3fd3c107d454976a3799268ec556b21dee91 | Python | 3,473 | 79 | from __future__ import division
import mkl
mkl.set_num_threads(1)
import sys
import os
from SPHARM.lib import plotting as plt
def compare_parameters(inputfolder, outputfolder):
files = os.listdir(inputfolder)
print(files)
for fn in files:
plt.plot_heatmap_difference(inputfile=inputfolder + fn, ... |
07e4371388dea6f7f96d9881b6730fc7a371c0ac876d1b924a06aa7957bb3637 | Python | 3,474 | 87 | from ray.rllib.evaluation.rollout_worker import RolloutWorker
from ray.rllib.offline import NoopOutput
class SharedPolicyRolloutWorker(RolloutWorker):
def __init__(self,
env_creator,
policy,
policy_mapping_fn=None,
policies_to_train=None,
... |
25669c7434bbf1dbe6d7acd28eb4d07350cd8a6f2448e07b2f32e29780cec58b | Python | 3,474 | 149 | 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]
class Person_PCC_Data:
import numpy
def __init__(self, EXP, POOL_LENGTH, PCC_POOL,header):
self.EXP = EXP
... |
4daa8aad7b2509abb0c6de8e9b76dd959650c4629d6765c83e0cb1a765255db1 | Python | 3,474 | 93 | import numpy as np
import pandas as pd
class ELM(object):
def __init__(self, inputSize, outputSize, hiddenSize, activation, x_train, x_test, y_train, y_test):
self.inputSize = inputSize # no of features
self.outputSize = outputSize # no of classes
self.hiddenSize = hiddenSize # no... |
9d8fd67d352b43c91d7d895ae4c8170bf76565c5ca5ffa8cf91d15628101ac90 | Python | 3,474 | 149 | 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]
class Person_PCC_Data:
import numpy
def __init__(self, EXP, POOL_LENGTH, PCC_POOL,header):
self.EXP = EXP
... |
2329d604a90cb749579832fb9f2e5505bd1391b31b26fbe57ad33bfb442172cb | Python | 3,475 | 149 | 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]
class Person_PCC_Data:
import numpy
def __init__(self, EXP, POOL_LENGTH, PCC_POOL,header):
self.EXP = EXP
... |
49f94eff12e197690835e37963357338474a0fdeac308661e2c253c52f97466b | Python | 3,475 | 149 | 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]
class Person_PCC_Data:
import numpy
def __init__(self, EXP, POOL_LENGTH, PCC_POOL,header):
self.EXP = EXP
... |
6174e52e7016c886dda70aaa4dc88d94b67c43863b3284e2bb5f697a15823819 | Python | 3,476 | 106 | """
This scripts plot figure S7r of the paper
This is the kernel of the example neuron with opposite visual and auditory preference.
Here the kernels were plotted separately, in the publication we combined them to the same plot.
Internal notes:
This is from figure-5-paper-with-pip-checkpoint
"""
import pandas as pd
i... |
cf3871f65b1de1c5c18e83fea6d34aad5618c06c3677914890d5367a75d39936 | Python | 3,476 | 149 | 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]
class Person_PCC_Data:
import numpy
def __init__(self, EXP, POOL_LENGTH, PCC_POOL,header):
self.EXP = EXP
... |
055da8c9f4fa7279a6309674674a24cd313fc26e59bc231b0d66a064abf5e43f | Python | 3,477 | 149 | 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]
class Person_PCC_Data:
import numpy
def __init__(self, EXP, POOL_LENGTH, PCC_POOL,header):
self.EXP = EXP
... |
61bc811bedb80bbfd1bcb0cc93cf745b2258c1a5cac669e85272837b1f8325a0 | Python | 3,477 | 104 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# This program 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 your option) any later version.
# This prog... |
f12ad63723959209b6d2d554db4a007aa62ac85dba6bf8435e5b922976f4b73b | Python | 3,477 | 118 | 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
"""
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%... |
f4818b3af0f99c83df91c40bda962294dc6ec4e96dcb2c1fcafa3908e9449452 | Python | 3,477 | 149 | 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]
class Person_PCC_Data:
import numpy
def __init__(self, EXP, POOL_LENGTH, PCC_POOL,header):
self.EXP = EXP
... |
b6f856ef2709554c2e944dd55bf83f0ac12306ed78771031a138d07882f951f5 | Python | 3,480 | 102 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 10 10:43:28 2022
@author: nagehan
"""
import matplotlib.pyplot as plt
import numpy as np
# Cortical thickness with respect to shape
# Surface area small -'Senegal Galago', 'Night Monkey', 'White-faced Saki'
t1 = [[0.93,1.44,1.56],
[0.90,1... |
bf3d68ad9b9c1ff9babf91b0219a8285893f6198f98e5cc40439fd61325cbd80 | Python | 3,483 | 94 | from __future__ import annotations
import gzip
import re
from collections import defaultdict
from pathlib import Path
from typing import TextIO
import numpy as np
def _open_text(path: Path) -> TextIO:
if path.suffix == ".gz":
return gzip.open(path, "rt", encoding="utf-8")
return path.open(encoding="... |
4a526df5e5a25f35e15f6c4fe5d86d3b9940cdd2c31cc96806f9e0307ff90e6c | Python | 3,484 | 93 | """Optional Tract Density Index (TDI) hook.
The TDI script and atlas map are provided by EBRAINS but cannot be bundled
with BCBlib or the BCBToolKit distribution (EBRAINS patent office
restriction). Centers install them privately on PHI; if they are absent,
TDI is silently skipped.
"""
import importlib.util
import os... |
96dbc440ed478c77201c40b7ce55b8629c59bd468590323346d204a37d7eea2d | Python | 3,484 | 95 | # copyright: skpro developers, BSD-3-Clause License (see LICENSE file)
"""Base class for data types."""
__author__ = ["fkiraly"]
from sktime.datatypes._base import BaseDatatype
class ScitypeSeries(BaseDatatype):
r"""Series data type. Represents a single time series.
The ``Series`` data type is an abstract ... |
09252035e22bc23427100c95ef614884322f8c909eeb847cde776874d2c64a44 | Python | 3,487 | 94 | import os, sys
import numpy as np
import torch
import pytorch_lightning as pl
from six.moves import cPickle
from evoaug import evoaug
sys.path.append('../../evoaug_analysis')
import moana, utils
from model_zoo import Basset
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
# load data
expt_name... |
5e3be680819e9b05c58f4f8a8f7099b3e0c0fbcc1213a77816cc3478f04c5c8d | Python | 3,488 | 106 | # BASILISK: A generative, probabilistic model of side chains in proteins
#
# Copyright (C) 2010 Tim Harder and Jes Frellsen
#
# BASILISK is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... |
0369fc553c830a8f2e93cc2675f50893fac0310c87b9fe51a68dd2d54479fb6c | Python | 3,490 | 95 | #-------------------------------------------------------------------------------
# elftools: dwarf/dwarf_utils.py
#
# Minor, shared DWARF helpers
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
from __future__ impo... |
9d45b53ca3eef76d3b664dbbc14118ae73b12fae1d49c363b3b30c48d19c9b71 | Python | 3,491 | 95 | r"""
This module contains convolutional model blocks.
"""
from torch import nn as nn
from vp_suite.base import VPModelBlock
class DoubleConv2d(VPModelBlock):
r"""
This class implements a 2D double-conv block, as used in the popular UNet architecture
(Ronneberger et al., arxiv.org/abs/1505.04597).
"""... |
9abfc594c42bd8f62415db01e43d8ece9739ae89728bd30b48602a6a6387586a | Python | 3,492 | 101 | # Copyright 2020 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... |
40c161bbfe4be8087225037c8ae51148675902277179d343b8d388d59975ec67 | Python | 3,496 | 71 | """
Example Call:
python download_logs_s3.py --directory_prefix='logs/Saturday August, 08' --ids_file=../batch_test_inputs.txt --get_special='best_rotated_membrane'
python download_logs_s3.py --bucket_name=sialabkitimages --directory_prefix='shs_uploads'
python download_logs_s3.py --directory_prefix='logs/' --images_... |
4fa96a020ce71e6a8536822a56058acc07c73025c2e98c320e49b070a94e9e76 | Python | 3,496 | 90 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
def construct_original_grid(data_size, align_corners):
is_2d = len(data_size) == 2
size_zeros = np.zeros(data_size)
original_grid... |
747b6a0a87b654430c126bf30757cd18720ad8bdf822e44bcb895be26379df96 | Python | 3,496 | 140 | """Functions to load and write datasets."""
__all__ = [
"load_airline",
"load_arrow_head",
"load_gunpoint",
"load_basic_motions",
"load_osuleaf",
"load_italy_power_demand",
"load_japanese_vowels",
"load_plaid",
"load_longley",
"load_lynx",
"load_shampoo_sales",
"load_UCR... |
a950aab2d68ebc0d8fdd4212302533c020cdb9f005329fa775b339f53b65b469 | Python | 3,496 | 98 |
# Number of channels starting with 0
num_channels = [ 0,1, 2] # To be defined as a list of channels e.g [1,2,3] or [0,1], indexes starts with 0 -- displayed as BGR
type_channels = ["GUI", "GUI", "c"]
#permutes must be in respect to the original channels
coloc_permutation = [(0,1),(1,2),(0,2),(0,1,2)] #e.g [(2,1),... |
c12159fed304a55ec47531d9e41bc719649ac864479544e2c7259a317c878f8a | Python | 3,496 | 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... |
f313a80e8126ff26b245c389b99a7afcd85b81c9f4f1f00dd2f2e9760b6ac201 | Python | 3,496 | 131 | # 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
#
# ... |
21791cc8dde85028895ec69d4e8e6387ba1675357bdac5d6c18b51f66a31668a | Python | 3,497 | 128 | import json
from pathlib import Path
import pyarrow.parquet as pyarrow_parquet
from graynet import extract, roiwise_stats_indiv
from graynet.cli import main as cli_main
REPO_DIR = Path(__file__).resolve().parents[2]
EXAMPLE_DIR = REPO_DIR / "example_data"
VBM_DIR = EXAMPLE_DIR / "volumetric_CAT12"
SUBJECTS = ["CAM_... |
204c67117dbdc49f1ed300587950342f95e57a914aa7dd0f107f6be7551866dd | Python | 3,499 | 78 | """
Train models on synthetic data.
"""
import os
import numpy as np
from six.moves import cPickle
from tensorflow import keras
from gradient_correction import helper, model_zoo
#------------------------------------------------------------------------
sigmas = [0.005, 0.01, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3... |
a5ae53cf9de98115adafdc773182902497a2ffcddfdc0a7524acc6beb3b26ddb | Python | 3,500 | 62 | from __future__ import print_function
import numpy as np
from itertools import groupby
from functools import reduce
from operator import add
from scipy import signal
from featureExtractor import FeatureExtractor
from globalTimeManagement import getTimeDiffInSeconds
class FeatureExtractorRawDataWithSTFT(FeatureExtracto... |
e3cbabf67e51c5d28d43b1da7cdc075b0135f0d8208a185248433ce8f8752b53 | Python | 3,500 | 105 | import sys, os
import pickle
import numpy as np
import matplotlib.pyplot as plt
from fig import Config as C
def display_eval_metadata():
folder = sys.argv[1]
print(C.show())
print(f"Displaying run statistic for: {folder}")
avg_loop_time, cum_loop_time, peak_latency = compute_eval_metadata(folder)
... |
2395d7b7eeb00da9509c86cea6a86f95eecbd2d4a6b8c28fb19a515fa00ff1ac | Python | 3,501 | 78 | from __future__ import print_function
from os.path import splitext
import numpy as np
def seq2labelFreqs(stageSeq_arr):
labels = np.unique(stageSeq_arr)
labelNum = labels.shape[0]
labelFreqs = np.zeros((labelNum))
for label, labelID in zip(labels, range(labelNum)):
matches = np.argwhere(stageSe... |
3cf312dd9b628bbb21239742bbb29d15fe718842e661a0c8c11e86643c3d2113 | Python | 3,501 | 114 | # analyse the semantic types of the concepts in ORDO2UMLS_ICD10_ICD9+titles_final_v2.xlsx from step0-om-ordo-umls-icd.
# input: (i) ORDO2UMLS_ICD10_ICD9+titles_final_v2.xlsx
# (ii) MRSTY-2020AB.RRF (i.e. MRSTY.RRF from UMLS2020AB)
# output: ORDO2UMLS_ICD10_ICD9+titles_final_v3.xlsx - a updated ontology file... |
bf208a7cbb35c732fc0647659de8482d63eb9545b5a0b55c053fd1ef21485046 | Python | 3,501 | 89 | """
These are the plotting functions used by many ODP programs.
Forces the non-interactive 'Agg' backend before any pyplot import.
Snakemake invokes rule bodies from worker threads, and matplotlib's
default macOS backend ('MacOSX') requires the main thread plus a Cocoa
run loop. Importing matplotlib.pyplot from a work... |
d3b88557a04d1dc280999ffec4763048dc8c76065d91e99b6858679f6ea7d021 | Python | 3,501 | 103 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Tests for converter utilities between dask and pandas, with multiindex convention."""
from copy import deepcopy
import pandas as pd
import pytest
from skbase.utils.dependencies import _check_soft_dependencies
from sktime.datatypes._adapter.da... |
1f3d49837d2e79861f78eb4bfcfdf56f5fb716b7a46e2f60f5cbaac6dd1464c2 | Python | 3,502 | 95 | from collections.abc import Callable
import numpy as np
import pytest
from sktime.dists_kernels._numba_distances.base import DistanceCallable, NumbaDistance
from sktime.dists_kernels._numba_distances.tests._utils import (
create_test_distance_numpy,
)
from sktime.utils.numba.njit import njit
def _test_metric_pa... |
2dcdba53a3b95a4c916a264c095c4f0b048f745f0505de90fd1535e523ad21c4 | Python | 3,502 | 88 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
class Loop(OpRun):
def __init__(self, onnx_node, run_params):
OpRun.__init__(self, onnx_node, run_params)
if "opsets" not... |
dcf229dd8f3dd053cef1997fc2b07a519648517942b3f88e481c03d54d8acab2 | Python | 3,503 | 104 | import os
import matplotlib.pyplot as pl
pl.ioff()
import numpy as np
import tifffile
from matplotlib import gridspec
from scipy.ndimage.interpolation import zoom
def layout(path0,path1,path2,dest_path):
pl.ioff() #for spock
im0,im1,im2 = pl.imread(path0),pl.imread(path1),pl.imread(path2)
gs = gridsp... |
575b87aec7bbd2483d870cbaf636d7ede4969c290f41829242ad5f04bbf572ac | Python | 3,504 | 107 | # Copyright (c) OpenMMLab. All rights reserved.
import os
import numpy as np
from .base_dataset import BaseDataset
from .builder import DATASETS
def has_file_allowed_extension(filename, extensions):
"""Checks if a file is an allowed extension.
Args:
filename (string): path to a file
Returns:
... |
80787876b6ab6c859557749a3fb94e8e4e22fbb0fea9cb458e55037e81651fad | Python | 3,505 | 104 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""dpmodel linear energy model: a make_model CM over the linear atomic-model
composition (twin of ``deepmd.pt_expt.model.dp_linear_model``).
"""
from collections.abc import (
Callable,
)
from typing import (
Any,
)
from deepmd.dpmodel.atomic_model.linear_atomic_mod... |
42c1f30e150301b6d65025eee5424da32cfb93b5aab4826d140b4b155872f081 | Python | 3,507 | 74 | # 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.
"""Geometrically modify a set of contours.
This tool can be used to... |
69aa4d9552ee181a3041b8478ffd7f2398a6e30388b3daa361ed5772491dcd44 | Python | 3,507 | 111 | # 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... |
876f2642b09d5cdc36539855c8098ad641bac926482fdaa91495f797f04a992d | Python | 3,507 | 102 | #!/usr/bin/env python
# encoding: utf-8
"""
rescaleHoc.py
Created by Paul Manis on 2013-01-04.
Copyright (c) 2013 Paul B. Manis, Ph.D.. All rights reserved.
This function rescales a hoc file.
It turns sections only found in the "section list" and replaces axon[k] with an appropriate 'swelling[n]'
All is hardcoded... ... |
4f190acb213147d79b8ceff49a2442f288f68aeedd83e7d4bba99d5f8ec284d2 | Python | 3,514 | 106 | # 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... |
0b20c08159cb22caeb27ad341a7803dc068862a93991b45f2dbce49b117f411b | Python | 3,515 | 98 | # 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... |
607883cccfc14f78ddaac21fd1172801a23abc57b167eabb99fe849fbf454e17 | Python | 3,515 | 89 | import logging
import numpy as np
import os
import random
import torch
from gln.test.main_test import eval_model
from gln.test.model_inference import RetroGLN
from typing import Dict, List
class GLNTester:
"""Class for GLN Testing"""
def __init__(self,
model_name: str,
model... |
06b12925fecf2ca9f1d7484f895543452aa8cbc5ff049b6cade132315f4c123c | Python | 3,516 | 105 | from shutil import move
import pickle
import sys
import os
import numpy as np
from math import *
import tensorflow as tf
import scipy as sc
from findiff import FinDiff, coefficients
tf.keras.backend.set_floatx('float32')
#### Create save directories and copy the main script
class save_dir():
def __init__(... |
2a75db70ee7f0a8ed43675298e18a5afd1378c7a5bbb88b8035a4fb254125cbb | Python | 3,516 | 126 | # BASILISK: A generative, probabilistic model of side chains in proteins
#
# Copyright (C) 2010 Tim Harder and Jes Frellsen
#
# BASILISK is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 ... |
d0e4a2e74fdd168840746f7898e794c2491461a25d8586e094361b3031143f3c | Python | 3,516 | 151 | 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]
class Person_PCC_Data:
import numpy
def __init__(self, EXP, POOL_LENGTH, PCC_POOL,header):
self.EXP = EXP
... |
da0da7b36d36e8786a438702422c9f6ded1363e34c1102f0f2b13168f16bd26d | Python | 3,516 | 73 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GCNConv, global_mean_pool
class GCN(nn.Module):
"""Base graph convolutional neural network architecture for molecular data, using convolutions defined by Kipf and Welling (2017). Each GCN layer is followed by batch no... |
14a6166f199a9b0bb8f44288ac4123ac9bf5b9a54c136027314d127a271f618c | Python | 3,518 | 111 | #!/usr/bin/env python3
"""
Build lightweight slims from curie lists.
Used for sources that don't have an owl ontology floating.
"""
#TODO consider using some of the code from scr_sync.py???
from pathlib import Path
import requests
from pyontutils.core import createOntology
from pyontutils.utils import chunk_li... |
24c6d12ed7be360b3d8799aa2733704e502d4bc4683cb9258f7fe6be1bd3d1a0 | Python | 3,518 | 151 | 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]
class Person_PCC_Data:
import numpy
def __init__(self, EXP, POOL_LENGTH, PCC_POOL,header):
self.EXP = EXP
... |
e8cf40165947e86dba4d834924373a17f039032ca631d2ff72a6451ee0d16dd5 | Python | 3,519 | 97 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 18 17:58:26 2019
@author: wanglab
"""
import os, numpy as np, multiprocessing as mp
from skimage.external import tifffile
from skimage import filters
from utils.io import listdirfull, load_np, makedir
def otsu_par(saveLocation, otsufld, size, otsu... |
d51279b7ce588a7e5dbdc304d008bf8031419f9255a7eb27a18345371bb650cb | Python | 3,520 | 111 | from __future__ import division
import os
import numpy as np
from helper_lib import filelib
import helper_lib.parallel as prl
def run_parallel(**kwargs):
"""
Run a given function in a parallel manner.
Parameters
----------
kwargs : key, value pairings
Arbitrary keyword arguments
... |
3bc4f99da14517932367330ecbafd5d7d62cdf9671d6b6b58899627e2ccb49a3 | Python | 3,521 | 98 | """
Render the hoc file using pyqtgraph as color cylinders by
section type
"""
from pathlib import Path
import neuronvis.hoc_graphics as hoc_graphics
import neuronvis.sim_result as sr
import numpy as np
from vcnmodel.util.get_data_paths import get_data_paths
from neuronvis.hoc_reader import HocReader
from neuronvis.... |
71c54eed5aefe8b6aefb58932481bb2dc877d8b8cdc55aa0b2bda57ecc18bc58 | Python | 3,521 | 81 | import numpy as np
from networkunit.tests.two_sample_test import two_sample_test
from networkunit.utils import use_cache, parallelize
from copy import copy
class joint_test(two_sample_test):
"""
Test class which enables the joint evaluation of features from other tests.
It creates the predictions of the te... |
2ca9c44a104e1bf4e33beb92e30d56d43eb8572aa27d45d42fb75ba10205d4a2 | Python | 3,522 | 119 | import os
import random
import re
import numpy as np
with open("dataset/authors.txt") as f:
authors = f.read().strip("\n").split("\n")
with open("dataset/author2id.csv") as f:
author2id = f.read().strip("\n").split("\n")
with open("dataset/content.csv") as f:
content = f.read().strip("\n").split("\n")
... |
852c767e37c1f87f7b6396b117338f3425f7c4b94154eb9849f5843a4721347b | Python | 3,522 | 119 | import os
import random
import re
import numpy as np
with open("dataset/authors.txt") as f:
authors = f.read().strip("\n").split("\n")
with open("dataset/author2id.csv") as f:
author2id = f.read().strip("\n").split("\n")
with open("dataset/content.csv") as f:
content = f.read().strip("\n").split("\n")
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.