sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
95284eb22a015575c10d8147c6fde49b3f25091978e4c8b4e02dcf350277a2fa | Python | 4,187 | 101 | import os
import sys
from mne import find_events
from mne.io import read_raw_bdf
from mne.channels import read_dig_hpts
from ..utils import logger, verbose
@verbose
def importbdf(bdfname, nchans=34, refchans=['EXG1', 'EXG2'],
hptsname=None, mask=255, extrachans=[],
exclude=[], verbose=None... |
bda972b1d2c64f6897a0d8d003c1adff165d4a63519bfea68a5242b51df31fac | Python | 4,188 | 120 | """Algorithms to support fitting routines in seaborn plotting functions."""
import numpy as np
import warnings
def bootstrap(*args, **kwargs):
"""Resample one or more arrays with replacement and store aggregate values.
Positional arguments are a sequence of arrays to bootstrap along the first
axis and pa... |
861b099b2e6838f4166e8e0ea5ac2906d0772c40a8708681fc60dd620aa69a66 | Python | 4,195 | 84 | """
AQDnet CLI main entry point
"""
import sys
import argparse
from .commands import featurize_command, train_command, predict_command, demo_command
def main():
parser = argparse.ArgumentParser(
description="AQDnet: Deep Neural Network for Protein-Ligand Docking and Scoring",
formatter_class=argp... |
ab70fafc1c6ad6fcc5bbb2d10893c34fecedc3d4c478f013af941a7e7483ef60 | Python | 4,195 | 101 | ##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Created by: Yaoyao Liu
## Modified from: https://github.com/pytorch/pytorch
## Tianjin University
## liuyaoyao@tju.edu.cn
## Copyright (c) 2019
##
## This source code is licensed under the MIT-style license found in the
## LICENSE file in th... |
4839691fa672f218ee38e831b359465a022edcb914e0e29fe45b88795b003de5 | Python | 4,196 | 131 | import re
import os
import sys
from setuptools import setup
def abspath(relpath, _dir=os.path.dirname(__file__)):
return os.path.join(_dir, relpath)
def find_version(filename):
abs_filename = abspath(filename)
_version_re = re.compile(r"__version__ = ['\"](.*)['\"]")
last = None # match python sema... |
fb4dd026aa3d73f718442ee039a3bbe451e17ddc70e1ca0ccef5f25f8a077c24 | Python | 4,198 | 124 | import numpy as np
import torch
import time
from sns_toolbox.networks import Network
from sns_toolbox.neurons import NonSpikingNeuron
from sns_toolbox.connections import NonSpikingSynapse
from sns_toolbox import backends
backend = 3 # 0: manual
# 1: Numpy
# 2: Torch
# 3: Sparse
cp... |
677baf57636ebf05910e80317af56b349135663c0a8cebc465c0089e527948d8 | Python | 4,201 | 156 | #%% [markdown]
# # Timing
#%%
import datetime
import time
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from giskard.match import GraphMatchSolver
from giskard.plot import matched_stripplot
from pkg.data import load_split_connectome
from pkg.io i... |
2fa412a2f4052cdfed1a16cd2dbe0011e0338745400cf0d6f9bbd132c0b0f6e2 | Python | 4,203 | 126 | import pandas as pd
import numpy as np
import seaborn as sns
from matplotlib import pyplot as plt
import sys
colors2 = sns.color_palette("Set1", 12)[3:]
colors = [(0.6, 0.6, 0.6)] * 12
def read_dfs(i, j, sample_set):
df = pd.read_csv(sys.argv[i], sep="\t", index_col=0)
dfo = df.join(pd.read_csv(sys.argv[j... |
eebb392776eb379d79c0aeb7e3f00ec270616c62189a462f563577f7d4c70b06 | Python | 4,203 | 119 | """Quicknat architecture"""
import numpy as np
import torch
import torch.nn as nn
from nn_common_modules import modules as sm
from squeeze_and_excitation import squeeze_and_excitation as se
class QuickNat(nn.Module):
"""
A PyTorch implementation of QuickNAT
"""
def __init__(self, params):
"""
... |
fcda595f63d7336aab176a7c33337eb4a7dc0dc3a90047639cc8374b1568783b | Python | 4,203 | 143 | import argparse
import logging
from pathlib import Path
from typing import Union
import jetnet
import numpy as np
import torch
def prepare(
jet_type: str,
save_dir: Union[str, Path],
test_portion: float = 0.2,
normalize: bool = False
):
logging.info(f"Downloading data ({jet_type=}) from JetNet.")
... |
d5df1c1163f95ac6c17cd57fd618db7423d583e1d1a3d12d8aafe40b84a19bcc | Python | 4,207 | 112 | # -*- coding: utf-8 -*-
'''Interface wrappers for the `cma` module.
The `SkoptCMAoptimizer` wrapper interfaces an optimizer aligned with
`skopt.optimizer`.
'''
# built-in
import pdb
import copy
import inspect
import tempfile
import os
import warnings
# external
import numpy as np
import cma # caveat: does not import... |
5ab3b57b082a93d4c66a5e1b1755ff4e18a4f582ad4a6e2a837ac9dc44257c2e | Python | 4,208 | 130 | # 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... |
3237f6a00e8f2517394b8280532f0e1441ae30bbc82c2eba201f7e4a3118a12f | Python | 4,209 | 118 | # 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... |
423bcd988929efeca88555e4deab9bd8e0c19ece974957b096a811c6a5b0565d | Python | 4,210 | 150 | """
snapshot_preservation.py
Generate an initial snapshot, then modify the cue configuration and
attempt to learn over the existing snapshot to see how long it takes
to update. This module will generate the snapshots and plots.
"""
import numpy as np
import matplotlib.pyplot as plt
from extended_ring_model import *
f... |
9f1219526aa3ec13d92118acbf607c902d400208858fd9d6a907f986ab0577ad | Python | 4,212 | 131 | # 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... |
b5b248606615dbbe1df4c22d0d7bc26646dfc258af44746727dd4b793ee17683 | Python | 4,212 | 125 | import os
import dill
import numpy as np
import pandas as pd
from molucn.utils.utils import read_list_targets
from collections import defaultdict
from typing import Dict, List, Set, Tuple, Union
from torch_geometric.data import HeteroData
from rdkit import Chem
from rdkit.Chem.Scaffolds import MurckoScaffold
from tq... |
93d279d9bdac5056a65ba3ba94071caee232a4c87c84f8ec81c321fb7473f5f1 | Python | 4,214 | 118 | # 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... |
227802df5d7fd47201b403dd00608ce8d10342c6f6e256741fab3157c2af9510 | Python | 4,215 | 107 | #-------------------------------------------------------------------------------
# elftools example: dwarf_pubnames_types.py
#
# Dump the contents of .debug_pubnames and .debug_pubtypes sections from the
# ELF file.
#
# Note: sample_exe64.elf doesn't have a .debug_pubtypes section.
#
# Vijay Ramasami (rvijayc@gmail.com... |
ee78d2adbf9b5d784c665a213343024f251187e0420689af67774821c33ef95b | Python | 4,216 | 87 | """
Train models on synthetic data.
"""
import os, h5py
import numpy as np
from six.moves import cPickle
from tensorflow import keras
from gradient_correction import helper, model_zoo
#------------------------------------------------------------------------
num_trials = 10
model_names = ['cnn_deep', 'c... |
eb4f1e0f5d945f00d18e46f09b34b0e37bf9e73dfb1a0a5e6afddca86f965f7f | Python | 4,217 | 160 | #!/usr/bin/env python
__doc__ = """
Miscellaneous Utils
Nicholas Turner <nturner@cs.princeton.edu>, 2017
"""
import importlib
import datetime
import shutil
import types
import os
import re
import torch
from torch.autograd import Variable
import numpy as np
import h5py
__all__ = ["timestamp",
"make_requ... |
eee9143cf89f4cbe357240dbff79829c0a78fcd0bc203351f06584ca5663693d | Python | 4,220 | 99 | # 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... |
4c4e2d5387847d3990a9a0b23bf92854ac326586d7c6ca49374762a31b3cac75 | Python | 4,223 | 98 | from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
import time
import sys, os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../src')))
import numpy as np
import torch
from torch_geometric.data import Data
from gnn_eads.constants import ENCODER
f... |
14c2a45bcfbba77083be4c4325142524935ae0c93ea5620909031d6d8ad5b7a5 | Python | 4,224 | 151 | # 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... |
9cfeb9d6683e7e4109bcd0782f6c2a616b7c5625e24c3658d3a012d315f9d63f | Python | 4,225 | 140 | # 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... |
35e0a6897caa1a2c52a4e957c3c9287d8e4e9e3bdb48d193da7a9041e4e8b867 | Python | 4,227 | 137 |
# embedding_in_qt5.py --- Simple Qt5 application embedding matplotlib canvases
#
# Copyright (C) 2005 Florent Rougon
# 2006 Darren Dale
# 2015 Jens H Nielsen
#
# This file is an example program for matplotlib. It may be used and
# modified with no restriction; raw copies as well as modified... |
22d7b935ee94685dcf1f2526dd757de8926c8d2a038b6d601c72a8c78938468b | Python | 4,229 | 117 | from pathlib import Path
import numpy as np
import pandas as pd
import requests
from genomic_benchmarks.loc2seq.cloud_caching import CLOUD_CACHE
from genomic_benchmarks.utils.datasets import (
_check_dataset_existence,
_get_dataset_name,
_guess_location,
)
from genomic_benchmarks.utils.paths import CACHE_P... |
6d1463203b2975d0df06c79961166343238a6a45d33809c44350c6160f3cbddc | Python | 4,230 | 134 | import os
import torch
from collections import deque
from onmt.utils.logging import logger
from copy import deepcopy
def build_model_saver(model_opt, opt, model, fields, optim):
model_saver = ModelSaver(opt.save_model,
model,
model_opt,
... |
cbdecc5bd60fcc2eddc33c8fc8bc51acc381fe744fe45b22db3eba56af018f8d | Python | 4,231 | 96 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 1 12:14:53 2017
@author: tpisano
"""
from __future__ import division
import numpy as np, os, sys
from skimage.external import tifffile
from tools.utils.io import listdirfull, load_kwargs
from tools.conv_net.input.read_roi import read_roi_zip
from t... |
eedd428c9338a6f9b7d58003612aae51e60c22b0795fc7740c7597b1f725ff6e | Python | 4,233 | 120 | """Algorithms to support fitting routines in seaborn plotting functions."""
from __future__ import division
import numpy as np
from scipy import stats
import warnings
from .external.six import string_types
from .external.six.moves import range
def bootstrap(*args, **kwargs):
"""Resample one or more arrays with re... |
3e86ae4055c03e093ac0b28dc269c9e43ef1a4d41a86ce784d64ccba9e09fcaf | Python | 4,235 | 127 | import io
import logging
import numpy as np
import os
import torch
from PIL import Image
from torch.autograd import Variable
from torchvision import transforms
logger = logging.getLogger(__name__)
class BatchImageClassifier(object):
"""
BatchImageClassifier handler class. This handler takes list of images
... |
ac020d0f191e920732f6769d019e83463d7cdc2f12b2968b825cceaf2d43ecb5 | Python | 4,237 | 71 | # load the pik file and generate the (sampled) data for annotation
from sent_bert_emb_viz_util import load_df
import pandas as pd
import random
import sys
from tqdm import tqdm
if __name__ == '__main__':
# number of random samples for validation
data_category = 'Radiology' # 'Radiology' or 'Discharg... |
0b3f2ad32b66e7f520799db61a33c7369d1a11e62d2ead21b95af0ac8ce21ea6 | Python | 4,238 | 116 | # -*- coding: utf-8 -*-
#
# Copyright © 2023 Charles E. Vejnar
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://www.mozilla.org/MPL/2.0/.
#
import logging
import os
from ..interfaces imp... |
0b6111f3e835933cac66fc9a0c3adf3d64fca4ccb0f7bbc83773e230908881f2 | Python | 4,241 | 134 | """
@file: vit_configs.py
Created on 21.08.22
@project: CrazyAra
@author: queensgambit
Different ViT configs.
Based on:
https://github.com/jeonsworld/ViT-pytorch/blob/460a162767de1722a014ed2261463dbbc01196b6/models/configs.py
"""
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "Lice... |
948e10e24bfea17fb1c7e84b380099b9212cdd98d0662f68e97c895356216e47 | Python | 4,243 | 94 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright © 2013 Charles E. Vejnar
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://www.mozilla.org/MPL/2.0/.
#
"""Profile & count using... |
4556be9c5c07d15efa93da054d88ca085852260df14e29b207a46d762df2b8eb | Python | 4,244 | 117 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""The readout gate of a bridging window on the dpmodel fitting.
A bridged descriptor hands the fitting a per-atom source gate. The gate fades
the learned part of the output, the deviation of the output from the per-type
bias the fitting stores, so an atom whose gate is zer... |
529270bc0b4468331e16d6a5ebad7de31b5bb2a5b83301ab480a576fe402a9d4 | Python | 4,246 | 118 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Pluggable neighbor-list construction strategies.
A :class:`NeighborList` turns local coordinates (and an optional cell) into the
*extended* representation consumed by the model's lower interface. The default
all-pairs builder lives in :mod:`deepmd.dpmodel.utils.default_... |
6736760d7d3823b66f3e9416df8bfa98592d25a7a6921d68078ad28a312a375e | Python | 4,249 | 132 | # 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... |
0f660b33c14e2a8fce6420ff22555dfd4b5b94d6954b5635f7f0fe90b123a249 | Python | 4,250 | 103 | from __future__ import annotations
import json
from dataclasses import dataclass
from pathlib import Path
import numpy as np
import pandas as pd
from scipy import sparse
@dataclass
class PairedDataset:
x: sparse.csr_matrix
y: sparse.csr_matrix
obs: pd.DataFrame
genes: np.ndarray
isoforms: np.nda... |
9c8d96a895ebe5e295f5aeb5886435946879caf00d09a31605151e12a8973c3c | Python | 4,252 | 118 | import os
from pathlib import Path
from fft_utils import complex_2_numpy
import numpy as np
import imageio
import torch
def zero_mean_norm_ball(x, zero_mean=True, normalize=True, norm_bound=1.0, norm='l2', mask=None, axis=(0,...)):
""" project onto zero-mean and norm-one ball
:param x: tf variable whi... |
605b0770606456a340b4af952bec5ae916e1b9da25ffc4a5135c6e704c7c85c0 | Python | 4,253 | 143 | # 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... |
ddd10dde6b549ab46b8a791b46196928502b36f50cb23cf9d5f27d30957210de | Python | 4,255 | 111 | """Tests for computing features across epoched data - bycycle.group.features."""
import pytest
from itertools import product
import numpy as np
import pandas as pd
from bycycle.group.features import compute_features_2d, compute_features_3d
###########################################################################... |
f5c0c09ad3dab9ea78887c0cc30b21ae300f3798d330ed95402220743c2713ee | Python | 4,255 | 141 | #!/usr/bin/python -u
import pandas
#
if __name__ == '__main__':
Petrovski = {} # RVIS
Khurana = {} # Indispensability Scores
Rackham = {} # EvoTol
Huang_NoImp = {} # HIS
Huang_Imp = {} # HIS (Imputed)
Steinberg = {} # GHIS
HIPred = {}
# Petrovski
rm = [... |
69312a0dd8e43f41c127104666dd314459f8c2cdf6b190549f6430ea15ed6093 | Python | 4,258 | 117 | import logging
import os
import subprocess
import click
import dotenv as de
import pandas as pd
import parallel as par
import atom3d.util.file as fi
import util
de.load_dotenv(de.find_dotenv(usecwd=True))
def run_tmscore_per_structure(tmscore_exe, decoy, native):
'''
Run TM-score to compare 'decoy' and 'na... |
729b2c8b76988ce060a6a297da728e895a46c10cda480815a1636906fd266683 | Python | 4,261 | 137 | import pandas as pd
import numpy as np
pd.options.mode.chained_assignment = None # default='warn'
from pandas.api.types import CategoricalDtype
# Functions to wrangle data
def wrangle_Cvalues(dataframe, lowBound = 0, upBound = 1):
''' Erase data with not valid C values '''
dataframe = dataframe.query('C_M... |
478e7532f1f4ac6e6df783406ccd85dd7c9cf21a7f0e85e43d021fc8c711b0c3 | Python | 4,262 | 132 | """BOSS test code."""
import numpy as np
import pytest
from sktime.classification.dictionary_based import BOSSEnsemble, IndividualBOSS
from sktime.datasets import load_unit_test
from sktime.tests.test_switch import run_test_for_class
@pytest.fixture
def dataset():
"""Load unit_test train and test data set from ... |
fef69dae869290722b31563f83c3f893da14808b34525c1d9bd15d54acd36677 | Python | 4,263 | 137 | import torch
def get_eps(x: torch.Tensor) -> float:
"""Return the epsilon value for the given x based on the device.
:param p: the tensor to get the epsilon value for
:type p: torch.Tensor
:return: 1e-16 if x is in double precision (i.e. torch.float64 or torch.double) and 1e-12 otherwise
:rtype: ... |
38ca0164e5c8be54dd511258d509d57364f6033df6615dde0fe65908e200d1d5 | Python | 4,264 | 119 | import pytest
import os
import importlib
import atom3d.datasets as da
# -- Dataset Loaders
def test_load_dataset_lmdb():
dataset = da.load_dataset('tests/test_data/lmdb', 'lmdb')
assert len(dataset) == 4
for df in dataset:
print(df)
print(df['atoms'].x.dtype)
assert df['atoms'].... |
4563abdb3dbc4a67939fb6f7bfc6cc71458b8c1327df028a3d0534900d8d879b | Python | 4,268 | 106 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Atomic model for Uni-Mol v1 self-supervised pretraining."""
from typing import (
Any,
)
from deepmd.dpmodel.array_api import (
Array,
)
from deepmd.dpmodel.descriptor.unimol import (
DescrptUniMol,
)
from deepmd.dpmodel.fitting.unimol_pretrain import (
U... |
50ea65fca1b68182ae7c1be7f4c5bedb26158da8855608b2f92b6192667128f8 | Python | 4,269 | 105 | from __future__ import division
import numpy as np
import sciunit
from scipy.stats import zscore
import networkx as nx
from cv2 import EMD, DIST_L2
class wasserstein_distance(sciunit.Score):
"""
Calculates the Wasserstein distance (Earth mover's distance) between
two point clouds. Uses the opencv implemen... |
a7caf9d7ea1980ade4d7fed44088b35525e857727bccadfefa692295dfae50a0 | Python | 4,272 | 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... |
39b2cd4c5c594d3bd5fb19bc7917afda7c2a294ec4dbdf7d456baf15220b2f31 | Python | 4,273 | 142 | """
=========
traitsdoc
=========
Sphinx extension that handles docstrings in the Numpy standard format, [1]
and support Traits [2].
This extension can be used as a replacement for ``numpydoc`` when support
for Traits is required.
.. [1] http://projects.scipy.org/numpy/wiki/CodingStyleGuidelines#docstring-standard
.... |
d273c876bf79c4580da7bd7b35f23a99bd08fb7b85ec56edba8b104932db95da | Python | 4,275 | 116 | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
import torch.nn.functional as F
from ..builder import LOSSES
from .utils import convert_to_one_hot, weight_reduce_loss
def sigmoid_focal_loss(pred,
target,
weight=None,
gamma=2.0... |
9a65ce474b7ed0e846b92fd7c0e21c0606d9ea0b29f4a35e227f5d3a3a78da31 | Python | 4,276 | 98 | import rdflib
from ontquery.terms import OntCuries
from pyontutils.closed_namespaces import * # EVIL but simplifies downstream imports
from pyontutils.curies import PREFIXES, _loadPrefixes, interlex_namespace, getCuries
# note that these will cause problems in SciGraph because I've run out of hacks still no https
DH... |
e71cf03ced875e1dbe938cffa2099ffad414d4dcaca71dd906387ebb889bebd0 | Python | 4,278 | 107 | # -*- coding: utf-8 -*-
"""
Created on Thu December 10 11:41:02 2022
@author: Pawan Panwar, Quanpeng Yang, Ashlie Martini
PyL3dMD: Python LAMMPS 3D Molecular Dynamics/Descriptors
Copyright (C) 2022 Pawan Panwar, Quanpeng Yang, Ashlie Martini
This file is part of PyL3dMD.
PyL3dMD is free software: you ... |
5fa332fc32b8a8445b3c5d2a1915fa7e0d178d59bbcd1a655abef234ac7cf70d | Python | 4,282 | 106 | # data preparation for zebra fish. data reading, scaling, croping, adjusting data format and split into train/val/test
# data loading
# all the 69 stacks of data
import os
import numpy as np
from scipy import ndimage
import random
import argparse
from skimage.transform import resize
import matplotlib.pyplot as plt
... |
806f6457159b0a586b72810dfca686d5662859a7cebdda1879e5b28a11e950ba | Python | 4,282 | 107 | import pytest
from flair.data import Sentence
from flair.datasets import ClassificationCorpus
from flair.embeddings import TransformerDocumentEmbeddings
from flair.models import TARSClassifier
from tests.model_test_utils import BaseModelTest
class TestTarsClassifier(BaseModelTest):
model_cls = TARSClassifier
... |
27a6cae1b047a2d39fd591c35c33dc8061e3ce77119c1c1db1f4e6e2d2e8d3f8 | Python | 4,283 | 133 | # 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... |
c8c49479d785b3094734c05c6e06a84fcad9c3e078d6e60210372b4aea01beed | Python | 4,283 | 171 | import torch
# from itertools import zip_longest
class GTau:
"""
Class for keeping track of multiplicity (number of channels) of a G
vector.
Parameters
----------
tau : list of int, `GTau`, or class with `.tau` property.
Multiplicity of an G vector.
"""
def __init__(self, ta... |
750ae5146b68950d6aa61a883b800ac1bb00672d10cd97c74db5a789dcf6ecec | Python | 4,284 | 113 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Freeze-time autotuning of custom-kernel launch choices.
Custom-kernel families register a tuner through :func:`register_autotuner`; a
model-freezing entry point calls :func:`run_autotune` once, before tracing, so
the exported artifact bakes launch choices tuned for the e... |
e65feeef3f5e6f7d36aa443ba81c53402ed7d37e50effe1b008ab483947f64c9 | Python | 4,287 | 137 | # 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... |
d31f867cfa11009fb2cc118beb809ec8a62e46b00cc2f5095a939cf6df13db3d | Python | 4,289 | 113 | import sys
from os.path import splitext
import numpy as np
from parameterSetup import ParameterSetup
from fileManagement import getFileIDsCorrespondingToClassifiers
from evaluationCriteria import y2sensitivity, y2confusionMat, printConfusionMat, mathewsCorrelationCoefficient, multiClassMCC
from sequentialPrediction imp... |
5503085c63f755e197b690b73456dbdd6e8c9d03a173815465460effe19c03ac | Python | 4,290 | 143 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import importlib.util
import itertools
import sys
from datetime import date
from pathlib import Path
import pytest
SCRIPT_PATH = (
Path(__file__).parents[2]
/ ".agents"
/ "skills"
/ "g... |
b6508309f0f078ef79717ab901f7beb1bfce1e48dbda44ef76f5ed1f4268f03e | Python | 4,291 | 121 | import math
import sys
import time
import torch
import torchvision.models.detection.mask_rcnn
from coco_utils import get_coco_api_from_dataset
from coco_eval import CocoEvaluator
import utils
def train_one_epoch(model, optimizer, data_loader, device, epoch, print_freq):
## DEVICE ASSIGNMENT ##
model = model... |
f7c53e69ac406850e92465f513a3dad565fe5be7c3f767424ec5e30003812cc9 | Python | 4,291 | 136 | """ Statistics calculation utility """
from __future__ import division
import time
import math
import sys
from onmt.utils.logging import logger
class Statistics(object):
"""
Accumulator for loss statistics.
Currently calculates:
* accuracy
* perplexity
* elapsed time
"""
def __init_... |
35d9711c15259802a9a95db5ace7a2118a6b39bb9bb9940a45c154f5606b7898 | Python | 4,293 | 89 | import torch
from torch import nn as nn
class VPMeasure(nn.Module):
r"""
The base class for all measures (nn Modules taking as input a ground truth sequence and a predicted sequence and
providing a numerical assessment of the prediction quality). Measures can be losses and/or metrics, depending on
the... |
94469154ca6f2eb5a60258fd73892f37a23a98d4d3d1306837c5e7bab1e785d2 | Python | 4,293 | 132 | # 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... |
124bd4cddadf7f1bbc30026b6a76c2b9df4ac69aac3a49d0a11e82f8791a2ce4 | Python | 4,296 | 95 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib as mpl
mpl.rcParams['pdf.fonttype'] = 42
mpl.rcParams['ps.fonttype'] = 42
mpl.rcParams['font.family'] = 'Arial'
df_num = pd.read_csv('num_pairwise_intersection_genes_donor.txt',sep='\t',header=0,index_col... |
7b4b53125a38d9a90abcc84371932f67274386e04f5de73035ef8c5d53281f25 | Python | 4,296 | 103 | from src.cajal.laplacian_score import laplacian_score_no_covariates, laplacian_scores
from scipy.spatial.distance import squareform
import numpy as np
import statistics
def test():
# with open("CAJAL/data/c_elegans_features.csv") as infile:
# csv_reader = csv.reader(infile)
# w
data ... |
074bd8dd5023ce09d232ac0829711cc5ef98edd06395323f9ebcd394513457d6 | Python | 4,297 | 139 | import os
import numpy as np
import torch
from torch import nn
from sklearn import metrics
# A simple CNN model
class CNN(nn.Module):
def __init__(self, number_of_classes, vocab_size, embedding_dim, input_len, device):
super(CNN, self).__init__()
self.device = device
if number_of_class... |
1b70dac1065388e723d7e1847e3331e64ec22e669f9c1cdc95dd3ef26fbc16d3 | Python | 4,299 | 119 | # 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... |
207dfeca03f2e9ee44550f864405c48d52532caddb211e62aa5e7846c204f871 | Python | 4,303 | 107 | #-------------------------------------------------------------------------------
# elftools: elf/notes.py
#
# ELF notes
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
from __future__ import annotations
from io im... |
10e1697ae7bc1ee0517c349fde7099ece555434b05ecf78e7cf70552494b4623 | Python | 4,306 | 114 | import numpy as np
from scipy.linalg import eigh
import matplotlib.pyplot as plt
from scipy.cluster.hierarchy import linkage, fcluster, dendrogram
try:
import fastcluster
except:
fastcluster_pkg = False
from scipy.special import binom
from scipy.spatial.distance import squareform
from copy import copy
from scip... |
068d31315aeb3156dc42dca9478df22b7095b2e672955a036b837d18b1b54ed5 | Python | 4,308 | 156 | # 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
#
# ... |
13e2d1648c40a0012357dc6d225601b19c77aea51cafc47638645e40e38f49b8 | Python | 4,309 | 89 | # 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.
"""Extract image regions corresponding to previously-extracted conto... |
692cee9d430a555134c25ff6a842bf36bc9022857cfea315e6ddcc06691d128f | Python | 4,310 | 122 | # 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... |
6b3c0c2110a6dff867d2b089edc974ae6fa6f3506deb4c964d610e1222d164ef | Python | 4,311 | 145 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# For a full list of documentation options, see:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# ----------------------------------------------------------------------------
import os
from os.path import dirname ... |
419b63418f1e6581fa66d4c4910e63a9160afd1628b81e2be84ab8c57e48c789 | Python | 4,313 | 117 | # 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... |
8bd4252096c634cebd991449cae225ea21af710387d968f5315052068977161b | Python | 4,315 | 127 | # 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... |
0d6e325a29078dd2e49fb520d2d5cba17f982c163293895a4f057351b6ed60f8 | Python | 4,316 | 119 | # 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 rotary_embedding(
input: np.ndarray,
cos_cache: np.ndarray,
sin_cache: np.ndarray,
position_ids: np.ndarray | None = Non... |
692288d62fe17bfdedeaaa790cf60be3d46214d8a6c4a73f78f94d03c55949ba | Python | 4,316 | 143 | from argparse import Namespace
import argparse
from pathlib import Path
import torch
from utils.argparse_utils import parse_model_settings, get_device, get_dtype, get_bool
from utils.initialize import initialize_models, initialize_test_dataloader
from utils.permutation import PermutationTest
from utils.utils import get... |
8973f58231f7ba2ca7e4fca28e11918fcda0b5fddbf6a247c002cff5f104fae5 | Python | 4,316 | 146 | """The :mod:`butterworth` module provides functions to design butterwort filters.
"""
from numpy import (mod, exp, zeros, ones, arange, kron, real, flipud,
conj, pi, fliplr, sqrt, tan, tile, concatenate, append, double)
from scipy.signal import butter, buttord, buttap
from pyfilterbank.sosfilterin... |
f830172563c70dec92da478f0ebfe3a5869cfe0c5c9d39e147ccf36781cf9fdd | Python | 4,317 | 117 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""Per-element length scales used to size pair-wise geometric windows."""
import numpy as np
from deepmd.utils.model_preset_data import (
PERIODIC_TABLE,
)
# fmt: off
COVALENT_RADII: tuple[float, ...] = (
0.32, 0.46, 1.33, 1.02, 0.85, 0.75, 0.71, 0.63, 0.64, 0.67,... |
93adbf86140d653c02f4e8571821a1df507d7a0ff755050b259022008940131b | Python | 4,319 | 112 | # 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 CumSum(Base):
@staticmethod
def export_cumsum_1d() -> None:
... |
b8e9d253427591ca172bb27f8c6b21ea1c8d6fdddbe99a7092483d83967184f2 | Python | 4,319 | 102 | # 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
#
# ... |
d2e88b11090d0b7a11720c7476f318301e6f522b188146b1891afe22adff0c62 | Python | 4,319 | 129 | # 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... |
45329e95af090c8e6972f74635fb3421cf31640b47b054b62129b752706b9e43 | Python | 4,325 | 115 | # 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... |
a730c936e8935d3a39985b8eb757a9ecda4bdaac3bd3a73a7937a9f9064adfb8 | Python | 4,325 | 131 | # copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
# Ported from skchange (BSD-3-Clause), original authors: Tveten
"""Anomaly detection by thresholding segment statistics."""
__author__ = ["Tveten"]
__all__ = ["StatThresholdAnomaliser"]
import numpy as np
import pandas as pd
from sktime.detectio... |
e729721a595795e5cb498d3d462ea75631e49024ca5228cef2388327f8af512b | Python | 4,326 | 121 | # SPDX-License-Identifier: Apache-2.0
# Operator ZipMap is not implemented. Its use should
# be discouraged. It is just a different way to output
# probabilities not consumed by any operator.
from __future__ import annotations
__all__ = [
"load_op",
"ArrayFeatureExtractor",
"Binarizer",
"DictVectorize... |
3dcb68e7d5c6c96f8d6b716cd10abd87b18b9238338754ff86bef1a1d1e96128 | Python | 4,327 | 120 | __author__ = 'pbmanis'
"""
ccstim
Generate current-clamp (or voltage-clamp) stimulus waveforms from a dictionary
used for vectory play modes in current clamp
(prior version was called 'makestim')
Can generate several types of pulses
"""
import numpy as np
def ccstim(stim, dt, pulsetype='square'):
"""
Creat... |
ea7a52fccab6527ec50e0e15d36939a22376ca1506ba1e8c06fca6c27cd202bd | Python | 4,327 | 141 | """
pciSeq: Probabilistic Cell Typing for Spatial Transcriptomics
A Python package for analyzing spatial transcriptomics data with probabilistic cell typing.
This setup script handles package configuration and dependencies.
For development installation:
pip install -e .
For building distribution:
python -m b... |
8c449871c08adb725e2f5d8a0a2100d514269251114f385f2d9f21ffdfe67357 | Python | 4,328 | 137 | #!/usr/bin/env python
import configargparse
from flask import Flask, jsonify, request
from onmt.translate import TranslationServer, ServerModelError
STATUS_OK = "ok"
STATUS_ERROR = "error"
def start(config_file,
url_root="./translator",
host="0.0.0.0",
port=5000,
debug=True):... |
89ce76335ed71606ffeec2ed8215d8b4a12f2e6518d53b287b4d51fa2c702d89 | Python | 4,330 | 134 | """ ZRO remote control and data publishing functionality for behavior.
"""
import time
from camstim.experiment import EObject
from zro import Publisher
class RemoteControl(Publisher, EObject):
"""
Implements some public functions for controlling the task, and some
functionality for publishing data.
... |
8aa371331e06f093f7876cde29595399fd67cddc6c565cf78e421be35f777d2c | Python | 4,330 | 120 | crayons = {'Almond': '#EFDECD',
'Antique Brass': '#CD9575',
'Apricot': '#FDD9B5',
'Aquamarine': '#78DBE2',
'Asparagus': '#87A96B',
'Atomic Tangerine': '#FFA474',
'Banana Mania': '#FAE7B5',
'Beaver': '#9F8170',
'Bittersweet': '#FD7C6... |
555ea88b90dcc5f54d867a5c9b06c6eb26be75630cc15ae485b5486b0b1e5289 | Python | 4,331 | 95 | import os
import random
import numpy as np
import torch
import imageio
import torchfile
from pathlib import Path
from vp_suite.base import VPDataset, VPData
from vp_suite.defaults import SETTINGS
class KTHActionsDataset(VPDataset):
r"""
Dataset class for the dataset "KTH Action", as mentioned in
"Recogniz... |
fe02d9f67b94dcb00456bf618d6ce826cb4f748d2f9238e8c1597e4b32aa8906 | Python | 4,332 | 119 | # 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, RefAttrName
def _check_dtype(val):
dtype = val.dtype
if not isinstance(dtype, np.dtype):
raise TypeError(
f"Type... |
4fd4c215c4e4074f8575157de85b307b75a7beb02ac91525deb6179883eb9739 | Python | 4,333 | 132 | # 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... |
34a8e42f52d24b1d6c8f8c1b49c86b20a6f0d50bfb3a1933abae342855de93f8 | Python | 4,334 | 125 | import rdflib
from pyontutils.core import OntGraph
from pyontutils.config import auth
from pyontutils.namespaces import ilxtr, UBERON, CL, NCBITaxon, skos
from neurondm.core import OntId, log
pCL = rdflib.Namespace('http://uri.interlex.org/fakeobo/uris/obo/pCL_')
HGNC = rdflib.Namespace('https://www.genenames.org/data... |
340316d721cd327a7024e748daa6581aa6db3fd1645102eca4acb845015eae9c | Python | 4,337 | 116 | import streamlit as st
import os
import urllib
import fastai.vision.all as fai_vision
import numpy as np
from pathlib import Path
from PIL import Image
def main():
st.title('Fish Masker')
for filename in EXTERNAL_DEPENDENCIES.keys():
download_file(filename)
data_loader, segmenter = load_model... |
496408f907c81b03726f13e3b1e47bfb64632e6e1391a4ee9277cf9240a7c219 | Python | 4,337 | 144 | import csv
import os
import sys
from collections import defaultdict
import pymol as py
#Functions that filter data
#==========================
#Get rid of duplicate pdb, mut
def filter_dup_lines(lines):
new_lines = []
done = set()
for i in range(len(lines)):
if tuple(lines[i][:3]) in done:
... |
4ad17fb192a98ea0454006c43cdd66add8f614b4655391a5c3397b467250263f | Python | 4,338 | 115 | import logging
import os
import random
import traceback
from datetime import date
from pathlib import Path
from typing import Optional, Union
import numpy as np
import requests
import torch
import torch.nn as nn
from rxnebm.model import FF, G2E, S2E, model_utils
def setup_paths(
load_trained: Optional[bool] = Fal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.