sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
f30a56ff97d87cc8e761da350d7776d41871c5c34a715c1a13711fd8a01bf8a2 | Python | 265 | 15 | from sys import argv
from msp import MSP
from msp_fly import fly_am
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
fly_am(msp)
msp.architecture["final_processor_spec"]["bottleneck_spec"] = dict(
type="ConvolutionalBottleneck", width=17
)
msp.run()
|
86f3f18629de4b26fcb6d919a5d78209848240e7cd2908d62b4df70d1dd5bb37 | Python | 266 | 11 |
"""
Code here makes it easy to glance at a header item from every demo ABF file.
"""
from imports import *
if __name__=="__main__":
for fname in sorted(glob.glob(PATH_DATA+"/*.abf")):
abf = pyabf.ABF(fname)
print(abf.abfDateTime)
plt.show() |
c1bd7188e1fb165aefa3df6b43e229d252dcf04b68e7051fea8fd40d3e9004fd | Python | 266 | 19 |
from config import Config
bind = '0.0.0.0:5000'
backlog = 2048
workers = 1
worker_class = 'eventlet'
worker_connections = 1000
timeout = 30
keepalive = 2
reload = Config.DEBUG
preload = Config.PRELOAD
errorlog = '-'
loglevel = Config.LOG_LEVEL
accesslog = None |
0789e5b0aa055e7608adbc1639310f20c711672f3f1c8c4290a88a85902495ba | Python | 267 | 11 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._rotation import Rotation
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__, [], ["._rotation.Rotation"]
)
|
549ecb5c6f7912f01d8ac82e2e2ca9d692d50a989a1c2258155b447e602d47e0 | Python | 267 | 12 | from neurogym.config.base import ConfigBase
class EnvConfig(ConfigBase):
"""Configuration options related to environments.
name: The name of the current environment.
dt: Time interval between steps (in ms).
"""
name: str = ""
dt: int = 10
|
816a70bb979ac2fbecee462695e74f06ed74c9d3c7f12540e450f4ecabafd476 | Python | 267 | 11 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._tickfont import Tickfont
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__, [], ["._tickfont.Tickfont"]
)
|
902714e144541fdf32685ba4610d27d2ebbd4171cc8bc1c2d075377cb0e7777f | Python | 267 | 11 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._textfont import Textfont
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__, [], ["._textfont.Textfont"]
)
|
a69e89eeb861f70dd31230e3d88f8094712c4c385d7960d89ff9987d9c401f8a | Python | 267 | 7 | from .rbns import read_rbns_motifs
from .rna_compete import rbns_rnacompete_motifs_deduplicated, rna_compete_motifs_for
from .rbns_v2 import read_rbns_v2p1_motifs
from .rbns_functional import (
read_rbns_functional_motifs,
read_rbns_v2p1_functional_motifs,
)
|
e55784876c30a88bf4eff2da29ece9bf33bab6d847261d1d6ea002480d3a04ed | Python | 267 | 8 | import json
import os
from galaxy.tool_util_models import UserToolSource
SCHEMA_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "ToolSourceSchema.json")
with open(SCHEMA_PATH, "w") as fh:
fh.write(json.dumps(UserToolSource.model_json_schema()))
|
232082a6c136e15e8232d61acc003df1e9417f8d7a0c807dfb4e839bdb15f19c | Python | 268 | 10 | from setuptools import setup, find_packages
setup(
name='Bertalign',
version='0.1.0',
url='https://github.com/bfsujason/bertalign',
description='An automatic mulitlingual sentence aligner.',
packages=find_packages(),
install_requires=[],
) |
837fb0452f1139596fb76c9044e949196e2b5d7add9ad5e9df20f89aed51986c | Python | 269 | 13 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.batch_size = msp.batch_size * 2 // 3
msp.seed = int(argv[1])
msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3
msp.n_epochs = 1
msp.window = 10_000
msp.acc_thresh = 100
msp.run_binarizer(0.178e-2)
|
be4baffd88b8f83bfe8f4b95c07e3459eb08cdfcdccb6000c987799c16e5dba5 | Python | 269 | 12 | from database import ImageModel
from celery import task
@task
def thumbnail_generate_single_image(image_id):
image = ImageModel.objects(id=image_id).first()
image.thumbnail()
image.flag_thumbnail(flag=False)
__all__ = ["thumbnail_generate_single_image"] |
e30534f05f76f3199588fad354c811ff9589aaf90e26818512f1f4721cc67769 | Python | 270 | 12 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict(
type="FCMotifFeatureExtractor",
extra_compute=10,
num_compute_layers=1
)
msp.run()
|
73b26caa89626072ab32ebc1ae5abc220a4cf97321039f29b674f2e674a66db9 | Python | 271 | 11 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._labelfont import Labelfont
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__, [], ["._labelfont.Labelfont"]
)
|
8bd62de4253f074d837ad9e42e6bcfba05e38299df12b1344c5b151b8962c995 | Python | 271 | 14 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.batch_size = msp.batch_size * 2 // 3
msp.seed = int(argv[1])
msp.lr = float(msp.lr) * 0.9 ** 16 * 2 / 3
msp.window = 10_000
msp.acc_thresh = 100
msp.n_epochs = 10
msp.run_binarizer(0.178e-2)
|
f72ebf393e3c62c304c81e25143e1cee1eedc29da3227801db6dd9d6c08214f5 | Python | 271 | 8 | from pl_bolts.models.self_supervised.moco.transforms import ( # noqa: F401
Moco2EvalCIFAR10Transforms,
Moco2EvalImagenetTransforms,
Moco2EvalSTL10Transforms,
Moco2TrainCIFAR10Transforms,
Moco2TrainImagenetTransforms,
Moco2TrainSTL10Transforms,
)
|
237f1847547dd59378e83ceb2833713ed10f55ef2ac0ecacb14590945baa383b | Python | 272 | 5 | def test_open(make_napari_viewer):
viewer = make_napari_viewer()
viewer.open_sample(plugin="stardist-napari", sample="nuclei_2d")
viewer.open_sample(plugin="stardist-napari", sample="nuclei_3d")
viewer.open_sample(plugin="stardist-napari", sample="he_2d")
|
63569782e4fcce835b97c4f8496ba82506315f0c78b41022c171adfb20013e87 | Python | 272 | 6 | from .pseudotime_plot import pseudotime_plot
from .local_plot import local_plot
from .tree_plot import tree_plot
from .transition_markers_plot import transition_markers_plot
from .DE_transition_plot import DE_transition_plot
from .check_trajectory import check_trajectory
|
6a3031ae7baeb3857f1f02a0e3c23e4d0e0863aa29414f31185837d5b31b2568 | Python | 272 | 12 | r"""
DIRAC (Domain Invariant Representation through Adversarial Calibration)
"""
from ._version import __version__
from .adj import *
from .augment import *
from .his_feat import *
from .utils_func import *
from .main import *
from .model import *
from .trainer import *
|
7a2c71995199084c59d33d7ee53c8e263e5c8228d7ba9b06781c6a299f6185b8 | Python | 273 | 5 | from .encoder import build_encoder, BaseEncoder
from .generator import build_generator, BaseGenerator
from .latent import ArbitraryLatent, BaseLatent
from .critic import TargetNormalizedMSE, BaseCritic
from .optimizer import build_optimizer_factory, build_scheduler_factory |
8d007e2218e435abe5eefdc2fb2c57c57f18187498eee9be405e13f3ec90dd87 | Python | 273 | 8 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""XCP-D: A Robust Postprocessing Pipeline of fMRI data."""
try:
from xcp_d._version import __version__
except ImportError:
__version__ = '0+unknown'
|
2ce1f3783f662839f6819a6d3fdb6a33aa69d8419fb937b8fc3cc8ca43992f4d | Python | 274 | 9 | from .allocate_cell import add_sig_to_cell, get_cell_pos, simulate_cell_and_sig
from .evaluation import cal_ami, cal_f1score, cal_precision
from .prepare import (
c_to_a_ratio_dis,
cell_area_dis,
get_fb_dis,
get_fb_dis_window,
ltos_ratio_dis,
)
|
2f1cdfff49f3af85e9f1f88fa92be936b21e83ac3ec72d0ffca214b49630bec9 | Python | 274 | 13 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from common import reverse_items
if len(sys.argv) != 3:
print("Reverse key and value of all pairs")
print(("Usage: ", sys.argv[0], "[input] [output]"))
exit(1)
reverse_items(sys.argv[1], sys.argv[2])
|
9d0dfab92bd29b394535e3ef4985e00236e164a28f18419d2f1b60ce07734b66 | Python | 274 | 8 | from setuptools import setup, find_packages
setup(name='protein_generator',
version='1.1.0',
description='generate new proteins.',
author='Rosetta Commons',
url='https://github.com/RosettaCommons/protein_generator',
packages=find_packages(),)
|
d89846a945001ed5f969aeb0fa9b642ef68a44759ec32528d61dd327042eed17 | Python | 274 | 12 | import napari
from src.tomopari._reconstruction_widget import ReconstructionWidget
if __name__ == '__main__':
viewer = napari.Viewer()
opt_widget = ReconstructionWidget(viewer)
viewer.window.add_dock_widget(opt_widget, name = 'tomopari')
napari.run() |
a94930329a01cd1a84c9c11fa257d17755aa0aa5d6b75edbcf7fb22a8b5b0a52 | Python | 275 | 9 | from .distributed_sampler import InferenceSampler, RepeatFactorTrainingSampler, TrainingSampler
from .grouped_batch_sampler import GroupedBatchSampler
__all__ = [
"GroupedBatchSampler",
"TrainingSampler",
"InferenceSampler",
"RepeatFactorTrainingSampler",
]
|
bb55d9a98fbfd43348ff3d4e655b98fa228f582e7aa74692dbb99aced4238522 | Python | 275 | 14 | from nitorch import io
import torch
for i in range(8, 24):
fname = f'oct.{i:02d}.masked.nii.gz'
f = io.map(fname)
d = f.fdata(device='cuda')
d = d.clamp_min_(60).sub_(60)
d += torch.rand_like(d)
io.savef(d, f'oct.{i:02d}.noisify.nii.gz', like=f)
|
ef62b8e42a52e779bc6fd8dfdfd982a4808adc47d332e6f83a5686ba1ebaefd1 | Python | 275 | 9 | """Module for additional environments as well as registering modified environments."""
from angorapy.tasks import envs
from angorapy.tasks import world_building
from angorapy.tasks.core import AnthropomorphicEnv
__all__ = [
"AnthropomorphicEnv",
"world_building",
]
|
14b76d5f50b7f892c86b3498803dfee38b0a90f523e644b786af841d17e6de13 | Python | 277 | 15 | import math
import numpy as np
from neuron import gui
from neuron import h
s = h.Section(name="soma")
s.insert("recursion")
n = 6
actual = [s(0.5).recursion.fibonacci(i) for i in range(n)]
expected = [1, 1, 2, 3, 5, 8]
assert actual == expected, f"{actual} != {expected}"
|
78a94e7a9519fe0e5521365daef45abe892ebf04d94da9c30495bb2f9ab4f537 | Python | 277 | 10 | from omegaconf import OmegaConf
from lightly.embedding import callbacks
def test_create_summary_callback():
summary_cb = callbacks.create_summary_callback(
summary_callback_config=OmegaConf.create({"max_depth": 99}),
)
assert summary_cb._max_depth == 99
|
bff57f96abd117f5fbac1c8124ec43c7c065d41ce6d330acb938695507d36191 | Python | 277 | 18 | # ruff: noqa: F401
"""
offline
======
This module provides offline functionality.
"""
from .offline import (
download_plotlyjs,
get_plotlyjs_version,
get_plotlyjs,
enable_mpl_offline,
init_notebook_mode,
iplot,
iplot_mpl,
plot,
plot_mpl,
)
|
566e17d474d33fbb6fc3a5df6c07c84a7d433d51f0220326f86d70eb47e7d93d | Python | 278 | 12 | """GluonCV neural network layers"""
# pylint: disable=wildcard-import
from __future__ import absolute_import
from . import bbox
from . import coder
from . import feature
from . import matcher
from . import predictor
from . import sampler
from .block import *
from .gn import *
|
d1b95fb1c98d256fe26790dcb3025e0c1fcf6ed4c48df2bd44bd51d561035b61 | Python | 278 | 8 | # Shim to wrap setup.py invocation with setuptools
SETUPTOOLS_SHIM = (
"import setuptools, tokenize;__file__=%r;"
"f=getattr(tokenize, 'open', open)(__file__);"
"code=f.read().replace('\\r\\n', '\\n');"
"f.close();"
"exec(compile(code, __file__, 'exec'))"
)
|
e4afc7918a3c92c94a9857763d6e2c6d95ba1fd806c2c81529374b5a7949ba11 | Python | 278 | 7 | """Sub-module for functionality related to parameters and parameter conversions."""
from .converter import AperiodicParamConverter, PeriodicParamConverter
# Link in report function to list available parameter converters
from specparam.reports.options import check_converters
|
2a93beede47ccf64a293869a1d6de229f9a870c811542dd1217a07d096263007 | Python | 279 | 12 | import nmodl
from pathlib import Path
import pytest
def test_parse_directory():
"""
Make sure we raise an error when parsing a directory instead of a file
"""
with pytest.raises(RuntimeError):
nmodl.NmodlDriver().parse_file(str(Path(__file__).parent))
|
d36adcb689f0872970af47f41bf6d84759aca4a036941c00808f1282f0e23a2c | Python | 279 | 7 | """Top level of GFF parsing providing shortcuts for useful classes.
"""
from GFFOutput import GFF3Writer, write # noqa F401
from GFFParser import (DiscoGFFParser, GFFExaminer, GFFParser, parse, # noqa F401
parse_simple) # noqa F401
__version__ = "0.3"
|
132bb292ba9dbfb3d821cacba059009ab06f96c5db6eb80c60e34679a92f7a33 | Python | 282 | 15 | class BaseInterface(object):
"""docstring for BaseInterface"""
def __init__(self, *args, **kwargs):
super(BaseInterface, self).__init__()
pass
def open(self):
pass
def close(self):
pass
def __del__(self):
self.close()
|
d6528b39fc59b7e181ed070688d186cf1ce41adda1999648e15e9aeade0e3d08 | Python | 282 | 14 | import fire
import random
import time
def hello(name="World", dataset_name=''):
if name == 'chandan' and random.random() >= 0.1:
raise ValueError('chandan is not a valid name')
time.sleep(1)
print(f"Hello {name}!")
return
if __name__ == '__main__':
fire.Fire(hello) |
6d84c1d01f2189c14b25599b9f6b43ce9f2df5ce0631559fb1b2f31166b04d6e | Python | 283 | 12 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from common import find_target_items
if len(sys.argv) != 3:
print("Find the value keyword in all pairs")
print(("Usage: ", sys.argv[0], "[input] [keyword]"))
exit(1)
find_target_items(sys.argv[1], sys.argv[2])
|
a311156c745107e7a1eeb9b84dd7610393625433c155bf4feee2a3cced378f79 | Python | 283 | 10 | from setuptools import find_packages, setup
setup(
name='controller_validation',
packages=find_packages(),
version='0.1.0',
description='Validation study for the MEG/MRI video games controller developped by CNeuromod.',
author='Yann Harel',
license='MIT',
)
|
23afab428f494c857d71f5525ba2a859451e47ff04b969877159612ab1585170 | Python | 284 | 10 | from anndata import AnnData
from dynamo.plot.scatters import scatters
def position(adata: AnnData, skey: str = "position", **kwargs):
""""""
if skey in adata.obsm_keys():
x, y = adata.obsm[skey][:, 0], adata.obsm[skey][:, 1]
scatters(adata, x=x, y=y, **kwargs)
|
33ae797b1b215c32dadba5c9728ea03ce49563137c2c57c8ac25b48b97be8153 | Python | 284 | 13 | import numpy as np
class OverfittingCV:
def __init__(self, n, n_iter):
self.n = n
self.n_iter = n_iter
def __iter__(self):
for i in range(self.n_iter):
train = np.arange(self.n)
test = train
yield train, test
|
6e793a5367c8176074b287ef13dd51536f37bc3547d2b56c20053acfa785753d | Python | 284 | 12 | from .folder import Folder
from .interface_neo import EphysReader, NeoSignalInterface
from .interface_npz import NPZFile
from .interface_nwb import NWBFile
from .misc import (
append_NWB_LFP,
load_binary_file,
load_eeg,
load_file,
load_folder,
load_session,
)
|
957efd77e967d8451ebbc86d7b43d3985d5b382fbc2e5b6daa84c432fd7a273e | Python | 284 | 7 | """The lightly.loss.regularizer package provides regularizers for self-supervised learning."""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from lightly.loss.regularizer.co2 import CO2Regularizer
from lightly.loss.regularizer.dse import DSERegularizer
|
a804019e2799bc948414a961e1f3a6b67efea7fe71158e0109aaf8645212287f | Python | 284 | 13 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 82
msp.architecture["motif_model_spec"] = dict(
type="PSAMMotifModel",
motif_spec=dict(type="rbns"),
exclude_names=("3P", "5P"),
)
msp.run()
|
36047e999849e7196beab9a12491395461299d7ffd9b74fd6a2dffaf254cf0ae | Python | 285 | 7 | from typing import Dict, Any
class ValidationException(Exception):
"""Custom exception for validation errors with detailed information."""
def __init__(self, message: str, details: Dict[str, Any] = None):
super().__init__(message)
self.details = details or {}
|
37e0ba5d2864e3f8681dc64df87b6db8a779b6628a85b67f3dc6c602ad29bc67 | Python | 285 | 6 | """Vendored protobuf message modules generated from ``proto/*.proto``.
The ``*_pb2.py`` modules here are produced by ``protoc`` and committed so that
building pyrosm needs no protobuf compiler. Regenerate with
``scripts/regenerate_proto.py`` after editing the ``.proto`` sources.
"""
|
461a3e82c43b84eeed7075f5ad95f49eca5377e8f6e7a9be920c07c1578a2219 | Python | 285 | 16 | from neuron import h, gui
def test_pointing():
s = h.Section()
s.nseg = 5
s.insert("pointing")
s(0.1)._ref_ptr_pointing = s(0.1)._ref_v
assert s(0.1).pointing.is_valid()
assert not s(0.9).pointing.is_valid()
if __name__ == "__main__":
test_pointing()
|
a5d9718a95f0dca9bb24bd184128462a6a096aba842e6b4a67df6412237fe12b | Python | 285 | 7 | # from .base import lr
# from .base_grouping import get_hotspots
# from . import het
# from .het import edge_core, get_between_spot_edge_array
# from .merge import merge
# from .permutation import get_rand_pairs
from .analysis import load_lrs, grid, run, adj_pvals, run_lr_go, run_cci
|
9e5bb410f7dc379d88556a64dfa7827b65c80a506afb2122084a1bea2b0fddb2 | Python | 286 | 6 | from .cached_projection import CachedProjections
from .aibs_mcm_projection import AibsMcmProjections
from .binary_split_model import BinarySplitVoxelArray, BinarySplitModel
from .flattened_projection import FlattenedProjections
from .projection_from_config import projection_from_json
|
e483bfbe1a4d9ba46fe740c7cc9e755ab9af70a4e6c5ef87aac4b8edd8670286 | Python | 286 | 10 | """Benchmarking the libcutils module. Usage::
pytest tests/libcutils_bench.py
"""
import pysam
def test_array_to_qualitystring_long_sequences(benchmark):
result = benchmark(pysam.array_to_qualitystring, pysam.qualitystring_to_array("123") * 500)
assert result == "123" * 500
|
e67de2430088464452d33fbbcb5544a059f4271d81fa4fca9855c1359cd31ffa | Python | 286 | 13 | from __future__ import annotations
from .environment_builder import (
EnvBuilderWidget,
build_environment_builder_text,
build_environment_builder_widget,
)
__all__ = [
"EnvBuilderWidget",
"build_environment_builder_text",
"build_environment_builder_widget",
]
|
f7ae004addd87934d146cdd313eea917cd82c763a020fad0836237e42386d047 | Python | 286 | 17 | import tensorflow as tf
def sindy_ae_reconstruction_loss(inputs, reconstruction):
return tf.keras.losses.mean_squared_error(inputs, reconstruction)
def sindy_ae_loss_in_x(dx, z_coordinates, ):
pass
def sindy_ae_loss_in_z():
pass
def sindy_regularization():
pass
|
fc056a65e80e31e20be648a51aa6624d26cd1de044de50e17d796534fbd399c9 | Python | 286 | 9 | import numpy as np
import pyjibe.fd.tab_info
def test_all_nan_dict():
assert pyjibe.fd.tab_info.has_all_nans({"a": np.nan, "b": np.nan})
assert not pyjibe.fd.tab_info.has_all_nans({"a": 1, "b": np.nan})
assert not pyjibe.fd.tab_info.has_all_nans({"a": "1", "b": np.nan})
|
797a94900459de76cfc36bcafdba3ca4a35fb2b7857b6f06696553315b30f248 | Python | 287 | 10 | from ._stagate import pySTAGATE
from .cluster_spagcn import spagcn_vanilla
from .find_clusters import CAST, kmeans_clustering, mclust_py, scc, smooth, spagcn_pyg
from .utils import (
compute_pca_components,
ecp_silhouette,
integrate,
pca_spateo,
pearson_residuals,
)
|
ac909861df5e71bdf02dfdeb23567f0788b981c565f916b3a9a6a14f8214698f | Python | 287 | 11 |
def test_valid(cldf_dataset, cldf_logger):
assert cldf_dataset.validate(log=cldf_logger)
def test_parameters(cldf_dataset):
assert len(list(cldf_dataset["ParameterTable"])) == 100
def test_languages(cldf_dataset):
assert len(list(cldf_dataset["LanguageTable"])) > 4000
|
47ce7a1fa854de38da0597bcd7a75c7203229ddd4361f26dd416d5a9f466e3a7 | Python | 288 | 9 | from eelbrain import *
configure(False)
ds = datasets.get_mne_sample(-0.1, 0.2, src='ico', sub="modality == 'A'")
res = testnd.TTestOneSample('src', ds=ds, tstart=0, tfce=True, samples=100)
# ds = datasets.get_uts()
# res = testnd.TTestOneSample('uts', ds=ds, tfce=True, samples=1000)
|
8d623bb964dfabbe382a8c331e6ab6e9b4d061ead197dac373cfece41d44da5c | Python | 288 | 20 | import h5py
h5f = h5py.File('data_20/rbns_train.h5', "r")
# X = h5f['X'][:]
Y = h5f['Y'][:]
F = h5f['F'][:]
L = h5f['L'][:]
h5f.close()
y_set = set()
for i in range(Y.shape[0]):
label = Y[i]
if label in y_set:
continue
else:
y_set.add(label)
print(y_set)
|
a360ea529a5fe3802f87331cd58a1851fd4a8fff234843c3b6e4af20c58aa969 | Python | 288 | 10 | """GluonCV-Torch video action recognition."""
from __future__ import absolute_import
from .actionrec_resnetv1b import *
from .i3d_resnet import *
from .i3d_slow import *
from .slowfast import *
from .r2plus1dv1 import *
from .r2plus1dv2 import *
from .tpn import *
from .ircsnv2 import *
|
92e9455d049bd06afd8e6bdd8e0d2341b59a7fd60d89b23f25494cde50e7ddc5 | Python | 289 | 10 | class BaseSimCLRException(Exception):
"""Base exception"""
class InvalidBackboneError(BaseSimCLRException):
"""Raised when the choice of backbone Convnet is invalid."""
class InvalidDatasetSelection(BaseSimCLRException):
"""Raised when the choice of dataset is invalid."""
|
012a4b14740a3a849380f9e292d6d43d979b02cd068fbb4773f411c224d400ac | Python | 291 | 9 | # __init__.py
import numpy as np
from scipy.spatial.distance import pdist, squareform
from sklearn.neighbors import NearestNeighbors
# You can optionally include package-level variables, functions, or classes here.
# For example:
__all__ = ['np', 'pdist', 'squareform', 'NearestNeighbors'] |
b288462b9b8f1667ba6b65cb25964387f950cbdc113f0db3b020d15b8f62782d | Python | 291 | 10 | import pytest
from rpy2.rinterface_lib import _rinterface_capi as _rinterface
import rpy2.rinterface_lib.conversion
def test__int_to_sexp():
with pytest.raises(ValueError):
rpy2.rinterface_lib.conversion._int_to_sexp(
_rinterface._MAX_INT + 1
)
|
b9c40d67a05abba1155cd3079d0441355eab6850b9df3dfbc9ffb0ca08a04c3c | Python | 291 | 8 | #!/usr/bin/env python
import sys
sys.exit(
"This script has been deprecated, replaced by the set of scripts in <galaxy_distribution>/scripts/cleanup_datsets/."
"See https://wiki.galaxyproject.org/Admin/Config/Performance/Purge%20Histories%20and%20Datasets for more information."
)
|
2e153e16d3c16d9af2bd3fa77c333879a78f778d62f900aec672d5b05697d5ac | Python | 292 | 12 | """Definition of complex types for use elsewhere."""
from collections.abc import Callable
from typing import Any
LayerData = tuple[Any] | tuple[Any, dict] | tuple[Any, dict, str]
PathLike = str | list[str]
ReaderFunction = Callable[[PathLike], list[LayerData]]
JSONDict = dict[str, Any]
|
41e0e31d4d4eefb41fdaf58a8ac4aa55d05eb7dc2eccf0c6232233c91a9806d3 | Python | 292 | 13 | import matplotlib.pyplot as plt
import jax
import jax.numpy as jnp
import jax.scipy.special as jsp
from cvsx import cardiac_drivers as drv
hr = 40
cd = drv.LearnedHR(guess_hr=hr)
t = jnp.linspace(-2, 100, 10000)
plt.plot(t, cd(t))
plt.plot(cd.t_sample(), cd(cd.t_sample()), "x")
plt.show()
|
0699d55b8c2104bc55894e32045b6feccaadf12150e8647556b770f2c48b488a | Python | 293 | 12 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._marker import Marker
from . import marker
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__, [".marker"], ["._marker.Marker"]
)
|
b11160bf854e92e1f21d9cf69e745d7e96153cda124c8ed3cd8052c6a43d8bfe | Python | 293 | 12 | # Test config for t/integration/test_worker.py
broker_url = 'amqp://guest:guest@foobar:1234//'
# Fail fast for test_run_worker
broker_connection_retry_on_startup = False
broker_connection_retry = False
broker_connection_timeout = 0
worker_log_color = False
worker_redirect_stdouts = False
|
e9b9beb8dd0b4acb3751cbfe8e5e37b4e73b68396496b4a8af4ec4d5ec749f5c | Python | 293 | 13 | from mirp._images.generic_image import GenericImage
class TransformedImage(GenericImage):
def __init__(
self,
**kwargs
):
super().__init__(**kwargs)
@staticmethod
def get_default_ivh_discretisation_method():
return "fixed_bin_number"
|
d8c128fa7716a45ae2c0713dbfcd70a32e53393d70583b475c0b281fc7fdc5c0 | Python | 294 | 14 | from celery import Celery
app = Celery('proj',
broker='amqp://',
backend='rpc://',
include=['proj.tasks'])
# Optional configuration, see the application user guide.
app.conf.update(
result_expires=3600,
)
if __name__ == '__main__':
app.start()
|
3739667fe0ded69624599a9e6b8d3305de70a8f3675e47c6a5a8b8bc1aafcf22 | Python | 295 | 8 | import numpy as np
def categorical_sample(prob_n, np_random: np.random.Generator):
"""Sample from categorical distribution where each row specifies class probabilities."""
prob_n = np.asarray(prob_n)
csprob_n = np.cumsum(prob_n)
return np.argmax(csprob_n > np_random.random())
|
f35ba9e2e878a40c68c80aa8ad37850e2ae22706ba308114ba287ee9eb8fe64d | Python | 295 | 13 | import abc
from carbonserver.api import schemas
class Projects(abc.ABC):
@abc.abstractmethod
def add_project(self, project: schemas.ProjectCreate):
raise NotImplementedError
@abc.abstractmethod
def get_one_project(self, project_id):
raise NotImplementedError
|
1b074365f80645332c4067ee5a067429f205d2b43a051fa7822498f4650afae1 | Python | 297 | 10 | import pytest
@pytest.mark.parametrize("use_xyz", ["True", "False"])
@pytest.mark.parametrize("model", ["ssg", "msg"])
def test_cls(use_xyz, model):
model = pytest.helpers.get_model(
["task=cls", f"model={model}", f"model.use_xyz={use_xyz}"]
)
pytest.helpers.cls_test(model)
|
298b6d07dae42d5d818be39d24a4c1ee3a426d1fe9ffc72fad5ec80c43d6f8d0 | Python | 297 | 6 | from .metadata_params import (_fileinfo, _isolate_metadata, _processingtimes)
from .report import (loader_report_info)
from .save import (save_df, save_fig, save_pickle)
from .checks import (_check_frames, _check_reclength)
from .type_conversions import (int_conv)
from .df_loader import (load_df) |
cb8fe34e65510e443666fdc0cc5650f7ab75bbe1f001143df5140a9d7f1a18f7 | Python | 297 | 9 | from convert_and_preprocess import get_CT_paths, process_scans, init_dirs
import os
to_scan = "/Users/gravo/Downloads/P_10/20160530 232112 [ - CT head]"
paths = get_CT_paths(to_scan, lambda x: not x.startswith("."))
init_dirs()
process_scans(paths, "", "NCCT")
process_scans(paths, "", "CTA")
|
1906cfed379afe315b6ad7db3c71c951ac87c53b57b28b04b5b6c84df2a79e01 | Python | 298 | 12 | from flaskr import create_app
def test_config():
"""Test create_app without passing test config."""
assert not create_app().testing
assert create_app({"TESTING": True}).testing
def test_hello(client):
response = client.get("/hello")
assert response.data == b"Hello, World!"
|
2a42825ea1a9225686f96dddab7c5564c8e234478a51596abbe5fcd291736fd2 | Python | 298 | 15 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture = dict(
type="PreprocessedSpliceAI",
preprocessor_spec=dict(type="Identity"),
spliceai_spec=dict(type="SpliceAIModule", output_size=3),
)
msp.acc_thresh = 100
msp.run()
|
7bb4dcc186bb7f20c73573a3056ce3caca9fdb7682c62b613fb3b74bce9ce4d9 | Python | 298 | 13 | # setup.py
# This setup.py currently is only meant for
# storing the versioning and maintainer information
from distutils.core import setup
setup(
name='ThermoNet',
version='1.0',
author='Bian Li',
author_email='comput.biol.geek@gmail.com',
packages=['ThermoNet', 'utils'],
)
|
b3b3f18f2bd19c540a1d67fa5a649ce80a48199607f3cbf22631ff2216d28fc9 | Python | 298 | 12 | class MultipleContexts:
def __init__(self, contexts):
self.contexts = contexts
def __enter__(self):
for c in self.contexts:
c.__enter__()
return self.contexts
def __exit__(self, *args):
for c in self.contexts:
c.__exit__(*args)
|
2b00eaf2103e5ddef6d4795dc09277e04c70ac81329e0128488cde027a9ce420 | Python | 299 | 14 | """Static files."""
import os
def get_file(*args):
# type: (*str) -> str
"""Get filename for static file."""
return os.path.join(os.path.abspath(os.path.dirname(__file__)), *args)
def logo():
# type: () -> bytes
"""Celery logo image."""
return get_file('celery_128.png')
|
69d912cb2c0d186e5f579fc937d59a9a63c9cd4d606fce385ffad910766cbcb5 | Python | 299 | 9 | from eelbrain import *
from eelbrain._wxgui import get_app
if __name__ == '__main__':
get_app()
ds = datasets.get_uts(True, nrm=True)
# res = testnd.TTestRelated('utsnd', 'A', match='rm', ds=ds, samples=100)
res2 = testnd.ANOVA('utsnd', 'A*B*nrm(A)', ds=ds, samples=100, pmin=0.5)
|
fa11758afb8c1656dcb6f42efd28f140a802ac696fdcb9f172186710512344d2 | Python | 299 | 7 | # -*- coding: utf-8 -*-
# @Author : Yue Liu
# @Email : yueliu19990731@163.com
# @Time : 2022/9/21 0:47
from .data_loader import load_graph_data, load_data
from .data_processor import construct_graph, normalize_adj
__all__ = ['load_graph_data', 'load_data', 'construct_graph', 'normalize_adj']
|
4b223543c60630588768a831fa28daa8505b558c7a62132c8778b139e80e5e7b | Python | 301 | 13 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._x import X
from ._y import Y
from ._z import Z
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__, [], ["._x.X", "._y.Y", "._z.Z"]
)
|
7e22a3cb81ba8181012cec8ee7fd9f99ae2501a92178bfb44f231d9cdd66686b | Python | 301 | 9 | from distutils.core import setup, Extension
marisa_module = Extension("_marisa",
sources=["marisa-swig_wrap.cxx", "marisa-swig.cxx"],
libraries=["marisa"])
setup(name = "marisa",
ext_modules = [marisa_module],
py_modules = ["marisa"])
|
1c78434c921eb9f42b9b747711b74eb605b497086bb0fbfc88dce6f928f26d02 | Python | 302 | 12 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._button import Button
from ._font import Font
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__, [], ["._button.Button", "._font.Font"]
)
|
57fa1d92231a9e813193efd822d33691c1ac70b446839516f7898bd7468bb5e8 | Python | 304 | 4 | from .preprocess import preprocess_image
from .b_net import b_net, b_k_net, b_k_net, b_d_net
from .bl_net import bl_net
from .b_d_net_readouts import b_d_net_readouts, b_d_net_readout_0, b_d_net_readout_1, b_d_net_readout_2, b_d_net_readout_3, b_d_net_readout_4, b_d_net_readout_5, b_d_net_readout_final
|
53daf85f38c629f16f8c9dccdc28dac7d2f388b3942722b931b125659ce94673 | Python | 305 | 12 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._colorbar import ColorBar
from . import colorbar
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__, [".colorbar"], ["._colorbar.ColorBar"]
)
|
60727df254805c865e13f14030c0565558d9a5f1d1588f1f905f228961767dba | Python | 305 | 9 | # flake8: noqa: F401
from .dirdialog_multiselect import DirectoryDialogMultiSelect
from .mpl_navigation_toolbar_icons import (
NavigationToolbarIndent,
NavigationToolbarEDelta,
NavigationToolbarQMap,
NavigationToolbarPreproc
)
from .wait_cursor import ShowWaitCursor, show_wait_cursor
|
7c7fbf7ac7e436deda638c2dd2ab8ee3caf3037692fe956cbd377cb11e6a6456 | Python | 305 | 13 |
from slack_sdk import WebClient
slack_bot_token = " "
slack_webclient = WebClient(token=slack_bot_token)
def post_message(msg):
slack_webclient.chat_postMessage(channel="#automated", text=msg)
def post_figure(filename):
slack_webclient.files_upload(channels="#automated", file=filename) |
e7ebe4920d8262413ec1bb6b473d0ec25a29313949c2a9aef2fa25986040e232 | Python | 305 | 19 | import time
from codecarbon import track_emissions
@track_emissions(
measure_power_secs=3,
wue=1.1,
)
def train_model():
"""
This function will do nothing.
"""
print("30 seconds before ending script...")
time.sleep(30)
if __name__ == "__main__":
model = train_model()
|
2c81b76e93bd873458b4c396b830c6ce08549ac1a2de308758723caa1f69e94f | Python | 306 | 8 | from typing import Literal
_SIMILARITY_MATRIX = Literal["cosine", "euclidean", "pearson", "spearman"]
_METHOD = Literal["mean", "median", "sum"]
_QUALITY = Literal["fulres", "hires", "lowres"]
_BACKGROUND = Literal["black", "white"]
__all__ = ["_BACKGROUND", "_METHOD", "_QUALITY", "_SIMILARITY_MATRIX"]
|
74108ce360189513d07a8bd06a52f0528a3e76f380b51e04bfaf944b83ddf8c3 | Python | 306 | 13 | import warnings
VERSION = '0.2.1'
warnings.filterwarnings(
message='.*Conversion of the second.*',
action='ignore',
category=FutureWarning,
module='h5py'
)
warnings.filterwarnings(
message='.*(numpy.ufunc|numpy.dtype) size changed.*',
action='ignore',
category=RuntimeWarning
)
|
85fd91eb6d681c78a40b99a04e0879cb080e4326a4fb89f07e0546f03de7f2d5 | Python | 306 | 7 | def generate_fasta_file(df, fasta_path):
with open(fasta_path, "w") as fasta_file:
for _, row in df.iterrows():
uniprot_id = row["uniprot_id"]
sequence = row["sequence"]
fasta_file.write(">" + uniprot_id + "\n")
fasta_file.write(sequence + "\n")
|
8904b2ffd900a1270070328881cea797e088838bf14c5fa86a12858bf01a2351 | Python | 306 | 10 | # analysis for prediction results of PSAMs and NN
def evaluate_model_all(m, d, limit=float("inf"), bs=500, map_index=None):
try:
m.eval()
dataset = d.loader(bs)
for i, (x, y, f, l) in tqdm(enumerate(dataset)):
for x, y, f, l in pbar(DataLoader(d, batch_size=bs)): |
b0aefde4725904ff6ab9e3df17adc8c395d563b371c33764990b42ed0f1b111b | Python | 306 | 9 | # Default parameters which will set as attr. of solver
default_hparas = {
'GRAD_CLIP': 5.0, # Grad. clip threshold
'PROGRESS_STEP': 10, # Std. output refresh freq.
'PLOT_STEP': 500,
'TB_FLUSH_FREQ': 180 # Update frequency of tensorboard (secs)
}
WINDOW_TYPE = 'hamming' |
d3bbc1c02b9cb0a8f655a66fafbd3e1d7fe66043f9eb593f2e340fd25cbe82c1 | Python | 306 | 12 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._line import Line
from ._pattern import Pattern
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__, [], ["._line.Line", "._pattern.Pattern"]
)
|
d95e48a682eb508632b65d868d373d31d06f20a22c3a3af13a7f368478ca7ffc | Python | 306 | 10 | import pytest
@pytest.mark.parametrize("use_xyz", ["True", "False"])
@pytest.mark.parametrize("model", ["ssg", "msg"])
def test_semseg(use_xyz, model):
model = pytest.helpers.get_model(
["task=semseg", f"model={model}", f"model.use_xyz={use_xyz}"]
)
pytest.helpers.semseg_test(model)
|
f98b69b37cc784ac7310784b3e29861de5b695c3eea5130332ad413dfd8b1bd2 | Python | 306 | 7 | from warnings import filterwarnings
from .core import KLIEP, RuLSIF, densratio, uLSIF
from .RuLSIF import set_compute_kernel_target
filterwarnings('default', message='\'numba\'', category=ImportWarning, module='densratio')
__all__ = ['KLIEP', 'RuLSIF', 'densratio', 'set_compute_kernel_target', 'uLSIF']
|
2bc92506e8a28ebb52bc574f6da7b3fe7ba8a866fae3e3731cf923853dee52fe | Python | 307 | 10 | from distutils.core import setup, Extension
setup(name = "pyCRF",
version = "1.0",
description = "print log",
author = "InSilico",
author_email = "newton@kias.re.kr",
url = "http://lee.kias.re.kr",
ext_modules = [Extension("pyCRF", ["pycrf.cpp"])]
)
|
68c01a24bd059986029ee8b0e3fbcf16b29ec8c7252321cadb23d648339ae000 | Python | 307 | 13 | """TNS utils used by multiple tools"""
class TNSError(Exception):
'''Raises TNS error'''
def _check(data):
"""Checks if data in dictionary are empty.
"""
for key, val in data.items():
if len(val) == 0:
raise TNSError('Empty distrib for diameter key: {}'.format(key))
|
1ec68db34cae770815852067f2d88ad41c9bb9ffcacf3eb89f7274a37e7d52ab | Python | 308 | 8 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"""Helper functions for saving data in various formats."""
from ._besa import meg160_triggers, besa_evt
from .._io.pickle import pickle
from ._txt import txt
from .._io.pyarrow_context import save_arrow as arrow
from .._io.wav import save_wav as wav
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.