sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
8f61e16f0b8ddeefa020d91f19c1ee9a00443eaf9daf7417325645440a57c6ca | Python | 459 | 9 | from lightly.utils.benchmarking.benchmark_module import BenchmarkModule
from lightly.utils.benchmarking.knn import knn_predict
from lightly.utils.benchmarking.knn_classifier import KNNClassifier
from lightly.utils.benchmarking.linear_classifier import (
FinetuneClassifier,
LinearClassifier,
)
from lightly.utils... |
ac9e2a45a25515a877d52ca45daa230fa4e282b725281b6b478f2884ff3b7977 | Python | 459 | 20 | from __future__ import annotations
import argparse
from . import __version__
def main(argv=None) -> int:
parser = argparse.ArgumentParser(prog="autotransop")
parser.add_argument("--version", action="store_true", help="Print package version and exit.")
args = parser.parse_args(argv)
if args.version:
... |
b69270b1782a6501f8524259fc47071c0fbd0849507cfbdeb07ff5c6b978ebb2 | Python | 459 | 14 | """The lightly.data module provides a dataset wrapper and collate functions."""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from lightly.data._video import (
EmptyVideoError,
NonIncreasingTimestampError,
UnseekableTimestampError,
VideoError,
)
from lightly.data.dataset i... |
d6852953670148d607b9f49d8d08ada724c4d176b2e2c9c473c266b914ddb9db | Python | 459 | 16 | import spatialdata as sd
from anndata import AnnData
def get_adata(data, table_key="table"):
"""Extract AnnData from either SpatialData or AnnData input."""
if isinstance(data, sd.SpatialData):
return data.tables[table_key]
elif isinstance(data, AnnData):
return data
else:
rais... |
f5fff6ed66fd670062c1d57e7d58481b57b4c6d98a0a6a9fe57862a937ca3adf | Python | 459 | 17 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._colorbar import ColorBar
from ._line import Line
from ._pad import Pad
from ._pattern import Pattern
from . import colorbar
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relativ... |
f6fb74ea9beec2f74a5b463061028e4f104482643491be5950e26b82d1a174ab | Python | 459 | 19 | from __future__ import annotations
import sys
if sys.version_info < (3, 7): # noqa: UP036
msg = "pybind11 does not support Python < 3.7. v2.12 was the last release supporting Python 3.6."
raise ImportError(msg)
from ._version import __version__, version_info
from .commands import get_cmake_dir, get_include... |
6637474eb1cb36ecd51acc80108889072c1c35fa8ea709d7154b6fb7bea2eb40 | Python | 460 | 22 | from .align_plots import deformation, multi_models
from .backbone_plots import backbone
from .morphometrics_plots import (
acceleration,
curl,
curvature,
divergence,
jacobian,
torsion,
)
from .pairwise_align_plots import (
pairwise_iteration,
pairwise_iteration_panel,
pairwise_mappin... |
79070935d296f3cbfbf09f242e53e2ac8b91d8c8d5356509aba431469e926d87 | Python | 460 | 21 | import torch
from lightly.utils.benchmarking import topk
def test_mean_topk_accuracy() -> None:
predicted_classes = torch.tensor(
[
[1, 2, 3, 4],
[4, 1, 10, 0],
[3, 1, 5, 8],
]
)
targets = torch.tensor([1, 10, 8])
assert topk.mean_topk_accuracy(pred... |
7cb4dd03a875096aa31063a4ca018bcff5b874f9fe5d4c2df189115aa6a103d0 | Python | 460 | 28 | import pytest
from pyrosm import get_data
@pytest.fixture
def test_pbf():
pbf_path = get_data("test_pbf")
return pbf_path
@pytest.fixture
def helsinki_pbf():
pbf_path = get_data("helsinki_pbf")
return pbf_path
def test_invalid_filter_type(test_pbf):
from pyrosm import OSM
osm = OSM(filepat... |
8e9938ffa68127d1cbc8cfcbcc7cd29fc9718f3dbd5f9a1333f8590f02d83c27 | Python | 460 | 20 | 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"].update(
dict(
bottleneck_spec=dict(type="ConvolutionalBottleneck", width=5),
post_bottleneck_lsmrp_spec=dict(type="Early... |
9c2863381452fe9803a04ea7e3c079c90c6b0b167d3fe7cd5b83e675e610948d | Python | 460 | 15 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from distutils.version import LooseVersion
import mne
MNE_EPOCHS = mne.BaseEpochs
MNE_RAW = mne.io.BaseRaw
MNE_EVOKED = mne.Evoked
MNE_LABEL = (mne.Label, mne.label.BiHemiLabel)
# VolVectorSourceEstimate added for 0.18
if LooseVersion(mne.__version__) >= Loose... |
f3f760554d95edfa22289c8da7c9c675de5817776b17dd73d94016fd02455de3 | Python | 460 | 20 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
msp.architecture["motif_model_spec"]["motif_width"] = 9
msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict(
type="FCMot... |
123a987a08aadde17de7a14be1a60ba5a15310c369a45547a2a7cfd4bc31f261 | Python | 461 | 21 | from setuptools import setup
setup(
name='PICALO',
version='0.1',
license='BSD (3-Clause)',
author="Martijn Vochteloo",
author_email='m.vochteloo@umcg.nl',
package_dir={'': 'src'},
url='https://github.com/molgenis/PICALO',
keywords='',
install_requires=[
'numpy==1.19.5',
... |
448e26b6009c3288399a97b3642456d242ca1ea96eb0a2f7f313b4f7cb8c52cf | Python | 461 | 20 | 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"].update(
dict(
bottleneck_spec=dict(type="ConvolutionalBottleneck", width=65),
post_bottleneck_lsmrp_spec=dict(type="Earl... |
4f03f1b66b85600ff92906bc03c0f15ab86b75e01aa52ff362ca926ef5456783 | Python | 461 | 17 | def get_plot_params():
"""Create the plot parameters used in the plotting
all the figures in the paper
"""
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import rc
import scienceplots
plt.style.use(["science", "nature"])
COLOR = "k"
plt.rcParams["text... |
b6af002e59b087f21687980b56393806270b3a63fdfd6bcfe1a79fa61774bb3e | Python | 461 | 16 | import easygui
import threading
class LoopState(threading.Thread):
def __init__(self):
super(LoopState, self).__init__()
self._state='initial'
def run(self):
while self._state != 'Stop':
self._state = easygui.buttonbox('Loop should:','Control over the NF While Loop', ('... |
b983fbf70fce719214337e369189791c8136b97a33890f871ee3a061bd26351d | Python | 461 | 22 | #!/usr/bin/env python3
import json
import sys
try:
from collections import OrderedDict
except ImportError:
import ordereddict as OrderedDict
# This script takes one argument the name of a json file.
#
fname = sys.argv[1]
print( "Processing ", fname)
with open( fname, "r" ) as fp:
j = json.load( fp, obj... |
dcae86f676d0082cb4b91b58f14fc1d9ffba2aca65a82d2a5f97613f7ff73733 | Python | 461 | 20 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-18 08:23
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0007_upload_allxis'),
]
operations = [
migrations.AddField(
... |
fd00c192a3738f9bbdb11eb5a3901f1b7a00ddf31ce0aee837ba62d8cf3cb78e | Python | 461 | 20 | 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"].update(
dict(
bottleneck_spec=dict(type="ConvolutionalBottleneck", width=17),
post_bottleneck_lsmrp_spec=dict(type="Earl... |
9707ee6bb30e3c41906831980063b9a8a77a29e47b0b64d7eb0cb16c449500ed | Python | 462 | 19 | #!/usr/bin/env python3
"""Convert all DiameterJ radius-plot TIFFs in a result directory to PNG."""
import sys
from pathlib import Path
from PIL import Image
def main() -> None:
result_dir = Path(sys.argv[1])
for source in result_dir.glob("*_Radius Plot.tif"):
destination = source.with_suffix(".png")
... |
c952a526d077e0ac00de1034e50c6e0d17f261546c271d8c03be916d3dda4513 | Python | 462 | 20 | try:
from galaxy.jobs.runners.util.cli import (
CliInterface,
split_params,
)
except ImportError:
from pulsar.managers.util.cli import ( # type: ignore[no-redef]
CliInterface,
split_params,
)
def build_cli_interface():
return CliInterface()
def get_shell(params):... |
f3064a2c260720338d295eee940a567f992af618d7352698d0fea36d690e7c5b | Python | 462 | 20 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-10-01 14:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0024_auto_20181001_1630'),
]
operations = [
migrations.Al... |
165f01e049f0b5a3c702793f46e445ccd478f40d6dfa266279390ace0d11d447 | Python | 463 | 20 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-17 11:36
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0004_remove_upload_allxis'),
]
operations = [
migrations.Add... |
264c3eb726db99ca915a614645c6c4c31197db8516768fc35acad4607c6418b5 | Python | 463 | 18 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["motif_model_spec"]["motif_width"] = 9
msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict(
type="FCMotifFeatureExtractor",
extra_compute=10,
num_compute_layers=1
)
ass... |
2835dd63533651e134aa4a19cfd26d65d8d549b393d07cd476c20a7d26cd7d43 | Python | 463 | 17 | # stlearn/pl/trajectory/__init__.py
from .check_trajectory import check_trajectory
from .de_transition_plot import de_transition_plot
from .local_plot import local_plot
from .pseudotime_plot import pseudotime_plot
from .transition_markers_plot import transition_markers_plot
from .tree_plot import tree_plot
__all__ = ... |
6ede7a786311150107a7930285f815a483e2aeea8d42f849c460d6c723d02470 | Python | 463 | 20 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-05-17 11:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0006_remove_upload_allx'),
]
operations = [
migrations.AddFi... |
8233f60765e644f4bc682738e0e66d1ec3d70169f4fba439086fce9f1b16eece | Python | 463 | 18 | #!/usr/bin/env python
import sys
import csv
def main(filename):
sys.stdout.write("track type=wiggle_0\n")
with open(filename, "r") as f:
c = csv.reader(f, delimiter='\t')
for row in c:
chrom = row[0]
start = int(row[1])
end = int(row[2])
sys.stdo... |
9b82a38eaf09a326a61a9d6d34424265c7e180e6072065a2a02082f6b46e6784 | Python | 463 | 22 | """
Abstract base class for runners which execute commands via a shell.
"""
from abc import (
ABCMeta,
abstractmethod,
)
class BaseShellExec(metaclass=ABCMeta):
@abstractmethod
def __init__(self, *args, **kwargs):
"""
Constructor for shell executor instance.
"""
@abstract... |
f84d748173b96a2488757270f019cd9a06041349845e8d2f5032c4e2e8ee6693 | Python | 463 | 15 |
network = '/home/y91198jk/hdd/Network/NetworkConstruction_2022/work_files/REMAP2022_map.txt'
with open(network) as open_net:
outfile = open(network.replace('.', '_header.' ), 'w')
outfile.write('regulator\tregulator_name\tregulator_type\ttarget\ttarget_name\ttarget_type\tscore\tact_distance\tabs_distance\te... |
3d160c7449dc12b887c693b8ffba18c81c4a03fa6859bc1a866e2cbc49624d96 | Python | 464 | 21 | from sys import argv
from msp import MSP, setup_as_am
from msp_gtex import setup_as_gtex, mix_in_cano
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
setup_as_am(msp)
tissue_groups = setup_as_gtex(msp, "just_whole_blood", "MarginalPsiV3")
mix_in_cano(msp, tissue_groups)
assert len(tissue_groups) == 1
msp.ac... |
4ab9a94c5a9b21dd2cce862eccd770e44f0ec831e4b5c809b8a86fb1e511833b | Python | 464 | 20 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-10-01 14:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0023_upload_sensitivity'),
]
operations = [
migrations.Al... |
bb9f168186f9bce4dfbc57aa438f1a4b842635cac47bc80458285e5805cec130 | Python | 464 | 17 | import abc
from carbonserver.api import schemas
class ProjectTokens(abc.ABC):
@abc.abstractmethod
def add_project_token(self, project_id: str, project: schemas.ProjectTokenCreate):
raise NotImplementedError
@abc.abstractmethod
def delete_project_token(self, project_id: str, token_id: str):
... |
4beb9b4cef6413e87ced7747973d1cb6f8ddadf69e59854ce27e77f19f555131 | Python | 465 | 22 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
fraction_of_standard_epoch = 5509 / 162706
msp.decay_per_epoch = 0.9 ** fraction_of_standard_epoch
msp.architecture = dict(
type="PreprocessedSpliceAI",
preprocessor_spec=dict(type="Identity"),
spliceai_spec=... |
4e7badf90dfe3a6dc1c0c793e12da9d0f84667b5152b8eee962bd346cc3ecd65 | Python | 465 | 28 | """
Prepare word2vec vectors for RSA.
"""
from scipy.io import loadmat, savemat
from sklearn.model_selection import LeavePOut
from sklearn.preprocessing import StandardScaler
import numpy as np
norm_file = 'target_vectors.mat'
data = loadmat(norm_file)
vectors = data['vectors']
words = data['basic_words']
sc = Stan... |
794030ec354a6ff6dc8192fc2ec87ffb5ba6b94ca2ddb02d9731b00d01ea8329 | Python | 465 | 22 | from anndata import AnnData
from bokeh.io import output_notebook
from bokeh.plotting import show
from stlearn.pl.classes_bokeh import Annotate
def annotate_interactive(
adata: AnnData,
):
"""\
Allow user to manually define the clusters
Parameters
-------------------------------------
adata
... |
9a6f7bb36471e3c36bc0352e24621874ec10c604de6b56e5f6bcdb074d436dbf | Python | 465 | 20 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-02-07 15:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0012_auto_20180207_1520'),
]
operations = [
migrations.AddFi... |
4b1976eb732f724e1428736ac2d5646dd48116d0b97a82d71ad63cdcc5ba17b7 | Python | 466 | 12 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __futu... |
72be45779d1b3055406eaf94018a2d86d69e0a47b268b38e9f85fe7048dd95cc | Python | 466 | 17 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 80 + 2
msp.architecture["channels"] = 200
msp.architecture["motif_model_spec"] = dict(type="NoMotifModel")
msp.data_dir = "../data/chenxi-synthetic-dataset-20210817/synthetic_data_with_A1C... |
833d076e943f733731edbd1d4e89872009ac5d33c1571dd17bb0c1a85b43859d | Python | 466 | 13 | try:
import importlib.metadata as importlib_metadata
except ModuleNotFoundError:
import importlib_metadata
package_name = "seqexplainer"
__version__ = importlib_metadata.version(package_name)
from ._layer_outs import get_layer_outputs
from .attributions import get_reference, attribute
from .filters import ge... |
06179e16054b6189fe46790c92a2e6fcd7a3e4c9a360fd07d8ed53f81195e1c5 | Python | 467 | 22 | """
Utility functions for preprocessing
"""
import inspect
from datetime import datetime
def print_start_msg():
"""
Print process starting message
"""
print("%s Running %s" % (datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
inspect.currentframe().f_back.f_code.co_name))
... |
b5f8af79e2797050452d712ba260be83b4bfa60b4c36a4891e2ff3b1fd391869 | Python | 467 | 21 | import sys
import collections
from collections import Counter
def get_AG(site_file):
c = collections.defaultdict(lambda :0)
with open(site_file) as f:
for line in f:
line = line.strip().split('\t')
if len(line) == 1:
continue
elif int(line[8]) - int(line[7]) == 1 and float(line[9]) > 26 and line[3] ==... |
c613a85fc751abdad2441c0f4d49e4d0ca11bf6a865ef04575adf6e96dac0fd4 | Python | 467 | 35 | # Copyright 2023 Blue Brain Project, EPFL.
# See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: Apache-2.0
import pytest
from nmodl.dsl import NmodlDriver
CHANNEL = """NEURON {
SUFFIX NaTs2_t
RANGE mInf, hInf
}
ASSIGNED {
mInf
hInf
}
STATE {
m
h
}
DERIVATIVE states ... |
d4df9505345725bc25b228e05c75b448898991e77e9de4f4b34f87b0f53bcbac | Python | 467 | 22 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
fraction_of_standard_epoch = 64764 / 162706
msp.decay_per_epoch = 0.9 ** fraction_of_standard_epoch
msp.architecture = dict(
type="PreprocessedSpliceAI",
preprocessor_spec=dict(type="Identity"),
spliceai_spec... |
dd2e195140f2fc6c56f34314b4da22856a3bb4c26db41691216b106066ac33e9 | Python | 467 | 22 | from .models_for_testing import ModelForTestingLastStep
spliceai_400 = [
ModelForTestingLastStep(
name_prefix="SpliceAI 400",
path_prefix="model/standard-400",
seed=seed,
before_prefix="-",
)
for seed in range(5)
]
spliceai_10k = [
ModelForTestingLastStep(
name... |
e85e4798edf77ab991d332255efaa8e3745c2dbc0118437240fbee92d46ddcaa | Python | 467 | 10 | """Whether the optional graph libraries are installed, found without importing them:
python-igraph, networkx, pandana and pandarm (the maintained, NumPy 2-compatible fork of
pandana). Each exporter imports its library when it is called."""
from importlib.util import find_spec
HAS_IGRAPH = find_spec("igraph") is not N... |
10d599441bfd6979e7dfd41729f80df0bcc6aa7e55c807c38d6fa4ed82fedd44 | Python | 468 | 17 | import numpy as np
import math
import pdb
import pandas as pd
## ------------------------------------------------------
##-- correct non-standard TypeID=0
def set_unspecified_typeID(swc_matrix):
updated_swc_matrix = swc_matrix
for i in range(0, len(updated_swc_matrix)):
if (updated_swc_matrix.loc[i,... |
16d9b5c6dd6bd317cbb6f1fee5f2866a8c62aa52a77d3a35b286853a66b2af96 | Python | 468 | 20 | import sqlite3
from .db import DB
class CriticalPatients(DB):
def __init__(self):
super().__init__()
self.table_name = 'KL_critical_patients'
self.table_desc = 'Summary of critical patients'
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
'da... |
1e633a82c109eeb16df5ff4c26fc5d2c5b97c15f9aabc7011d48b58bf5f61834 | Python | 468 | 11 | """
Gathers all models in one place for convenient imports
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from dcCustom.models.models import Model
from dcCustom.models.tensorgraph.tensor_graph import TensorGraph
from dcCustom.models.tensorgrap... |
b3ee8b424d9c4d831c2bbbab08dba8660b3cd9c2113e5a2285f9089b8bd07dd1 | Python | 468 | 20 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-05-17 11:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0017_upload_ignore'),
]
operations = [
migrations.AddField(
... |
3e4916db826c8a3eebea4d5cb3a6fc5e5d6c1288b416fc1b4d6d2bce4c065825 | Python | 469 | 15 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["motif_model_spec"]["motif_width"] = 9
msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict(
type="FCMotifFeatureExtractor",
extra_compute=10,
num_compute_layers=1
)
msp.... |
9eaefe2801723859fd5e50c7a54f5194c052a6bf101f2d147496d74f91e4d4c5 | Python | 469 | 11 | """Python interface to the Dudman lab Mouse Joystick Rig."""
# This file is generated automatically from metadata
# File edits may be overwritten!
__version__ = '5.0.1'
__description__ = 'Python interface to the Dudman lab Mouse Joystick Rig.'
__license__ = 'BSD-3-Clause'
__url__ = 'https://github.com/janelia-python/m... |
0243feb05aa4c772dba153675b4d015226072e62a7645947ec3a55c79b1a66ce | Python | 470 | 15 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["motif_model_spec"]["motif_width"] = 21
msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict(
type="FCMotifFeatureExtractor",
extra_compute=10,
num_compute_layers=1
)
msp... |
061ad9075f62c415b97298e3c129bbc9c7e4804a31f6b3e68e7d3b2f422154e5 | Python | 470 | 12 | import os
_true = set(("y", "yes", "t", "true", "on", "1"))
DEBUG = os.environ.get("STARDIST_NAPARI_DEBUG", "").lower() in _true
NOPERSIST = os.environ.get("STARDIST_NAPARI_NOPERSIST", "").lower() in _true
NOTHREADS = os.environ.get("STARDIST_NAPARI_NOTHREADS", "").lower() in _true
from ._dock_widget import plugin_do... |
0f17b52f22b9d86ba6c7754998bfec9975691a121257f092d94d03591da5baa3 | Python | 470 | 15 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["motif_model_spec"]["motif_width"] = 13
msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict(
type="FCMotifFeatureExtractor",
extra_compute=10,
num_compute_layers=1
)
msp... |
2793ff7548c0e7910020fc78e19cd22a99b0cb70c8aca7e3984a199bfbda4b41 | Python | 470 | 19 | class Registry(dict):
def __init__(self, *args, **kwargs):
super(Registry, self).__init__(*args, **kwargs)
def register(self, module_name):
def register_fn(module):
assert module_name not in self
self[module_name] = module
return module
return regist... |
97466ea2b57843fc31b66ad569bc7b09c7c1a06b6543bbc8e2bf74c0d7e60f81 | Python | 470 | 15 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["motif_model_spec"]["motif_width"] = 13
msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict(
type="FCMotifFeatureExtractor",
extra_compute=10,
num_compute_layers=1
)
msp... |
b1d9a318ac73e567b6092835fa4ecd1b69deb94e997ca0fcb4279696175835fe | Python | 470 | 20 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-12-28 10:48
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0009_profile_notification'),
]
operations = [
migrations.Add... |
dc194db6a7f26b61f98c73bd64a4de3e40e68ebd66666923954b7de6f1f4537d | Python | 470 | 21 | from anndata import AnnData
from stlearn.plotting.classes_bokeh import Annotate
from bokeh.io import output_notebook
from bokeh.plotting import show
def annotate_interactive(
adata: AnnData,
):
"""\
Allow user to manually define the clusters
Parameters
-------------------------------------
ad... |
37d5ce607d3c995f186b6075b60c1b8592613b985bbc8b228cd3c4490553d381 | Python | 471 | 12 | import logging
from modular_splicing.gtex_data.pipeline.splice_table import produce_splice_table
from modular_splicing.gtex_data.annotation.compute_optimal_sequence import (
compute_optimal_sequences_all,
)
logging.getLogger("filelock").setLevel(logging.WARNING)
cost_params = dict(annot_cost=1e-4, other_cost=0.1)... |
5be900d045cbb99bdf1418704e50e62cf3c2c1b90bcbfd4ccebca905f658eb82 | Python | 471 | 21 | """
The framework module contains the logic used in building the graph and
inferring the order that the nodes have to be executed in forward and backward
direction.
"""
from .graph_inn import *
from .sequence_inn import *
from .reversible_graph_net import *
from .reversible_sequential_net import *
__all__ = [
'Se... |
6982dfff23745908ca4dee178558d4f0ed108e25d84a6d3f0ad72ba3bc782e7c | Python | 471 | 22 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
fraction_of_standard_epoch = 9241 / 162706
msp.decay_per_epoch = 0.9 ** fraction_of_standard_epoch
msp.architecture = dict(
type="PreprocessedSpliceAI",
preprocessor_spec=dict(type="Identity"),
spliceai_spec=... |
67a625fef149a5742aa2283f4fd24bf2b18acfa5f33bf7814d41190b1ce8851e | Python | 473 | 26 | """
This module define GenericMetric
"""
from abc import abstractmethod
class GenericMetric:
"""
This class define an interface for the metric class
"""
@abstractmethod
def update_metric(
self,
prediction,
target,
):
raise NotImplementedError
@abstractmeth... |
be13552f13ff1a936fadbfa568a03c34f566741fc887baff7e755bf7ef8ce38a | Python | 473 | 13 | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl>
# All rights reserved.
"""Module defines single :method 'to_string' converting p_object to string."""
def to_string(p_object):
"""Convert p_object to string. Convert strings to strings, floats to string with a... |
35c3f79a6cd603a09518398405a0d4a7f2ee27a1ad7fd91b4deb1d3c1cde68d5 | Python | 474 | 22 | """ Layer/Module Helpers
Hacked together by Ross Wightman
"""
from itertools import repeat
try:
from torch._six import container_abcs
except:
import collections.abc as container_abcs
# From PyTorch internals
def _ntuple(n):
def parse(x):
if isinstance(x, container_abcs.Iterable):
return... |
6ea0292429a1d65a5e14723b38a0904efca365341e7317c9bdd4ff1ef90f4d92 | Python | 474 | 9 | """Producer-unification parity harness (transient migration tooling).
This package grounds the producer-unification migration (P0-P7): the
instrumented consumer ledger, the two-check parity comparator (structural
Check A + attestation Check B), the planted-mutation proofs, the Tier-R
classification walker, and the cap... |
30b3e334d643901851071016fb288bb2c8620bb709947dbd6a2ad2f3d22652f6 | Python | 475 | 16 | #! /usr/bin/env python
import os
import pandas as pd
import sys
from sqlalchemy import create_engine
"""
Create PostgreSQL table of list of eQTL projects.
Requires a meta_eqtls.txt
"""
eqtl_fp = os.path.join(os.path.dirname(__file__), '../lib/meta_info/meta_eqtls.txt')
eqtls = pd.read_csv(eqtl_fp, sep='\t')
db = cre... |
4c1332922ce0157d12b11c0dce478b968b5c6d555afd30bc8263d4a831db7e46 | Python | 475 | 18 | 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.architecture["sparse_spec"] = dict(type="S... |
c60f602ea6fe1a38a8df87fd2f39d84dccb09917c45c4fa52c46c750ded30246 | Python | 475 | 10 | __all__ = ["zimages", "msem_input_data_types", "mfov", "region", "wafer", "wafer_solver", "wafer_aggregator",
"RigidRegression", "AffineRANSACRegressor"]
from .zimages import zimages, msem_input_data_types
from .mfov import mfov
from .region import region
from .wafer import wafer
from .wafer_solver import wa... |
c95bfbc12b947cd2f178d045f80856089cacdc2f976ad3ed3338b5c32a7d073e | Python | 475 | 8 | """classification module"""
from sknetwork.classification.base import BaseClassifier
from sknetwork.classification.diffusion import DiffusionClassifier
from sknetwork.classification.knn import NNClassifier
from sknetwork.classification.metrics import get_accuracy_score, get_confusion_matrix, get_f1_score, get_f1_scores... |
dd67d8705dc91f981538ffa29686b19240ed1501c6db12042d12653598be96f1 | Python | 475 | 24 | """add codecarbon version
Revision ID: 298059b19bde
Revises: edcd10edf11d
Create Date: 2022-08-05 18:52:23.199306
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "298059b19bde"
down_revision = "edcd10edf11d"
branch_labels = None
depends_on = None
def upgrade(... |
e2f61bd6c11ae45edf1fb1298649a2532db53fdcc3fe7b996aed5c0e93fed832 | Python | 475 | 16 | import numpy as np
import torch
from PIL import Image
from torch import Tensor
from lightly.transforms import ToTensor
def test_ToTensor() -> None:
img_np = np.random.randint(0, 255, (20, 30, 3), dtype=np.uint8)
img_pil = Image.fromarray(img_np)
img_tens = ToTensor()(img_pil)
assert isinstance(img_te... |
2a7e61a7f8f61d79fb79179bbe9d69a35760a648558e5279410c445c34a654ce | Python | 476 | 19 | # Generated by Django 3.2.6 on 2024-05-09 06:59
import biomedisa_app.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0107_alter_upload_delete_outliers'),
]
operations = [
migrations.AlterField(
model_... |
851a970a52eb37bc6cdc3b47261e52084442b553c74377a49a5f472e08668ad7 | Python | 476 | 18 | from .resnet import *
from .vgg import *
from .alexnet import *
from .alexnet_reduced_aliasing import *
from .cornet_s import *
from .hmax import *
from .resnet_openselfsup_transfer import *
from .vonenet import *
# Shape trained models
from .texture_shape_models import *
# For the ipcl models
from .ipcl_alexnet... |
b9bec10c9df98e8a1d125619596cd5496b0048c19080572801e1faeb771b2c3d | Python | 477 | 14 | import torch
from tracking.pairing import extractMasks, findPairs, emptyDuplicates
def createMaskTimeSeries(results):
r0 = extractMasks(results[0])
time_series = [r0]
for idx, val in enumerate(results[1:]):
r1 = extractMasks(val)
pairs = findPairs(r0,r1)
pairs = emptyDuplicates(pair... |
f5dd9cbe20b0e7322c67702f409931efb1cf4e5c665486a1451ed06b9e274275 | Python | 477 | 15 | """Monitoring Event Receiver+Dispatcher.
Events is a stream of messages sent for certain actions occurring
in the worker (and clients if :setting:`task_send_sent_event`
is enabled), used for monitoring purposes.
"""
from .dispatcher import EventDispatcher
from .event import Event, event_exchange, get_exchange, group_... |
b200db43c3cdb3e96364231eaa062d04f5222b25f9234bbc84456ff6b03bb006 | Python | 478 | 17 | from __future__ import print_function
import numpy as np
import gluoncv as gcv
def test_bbox_xywh_to_xyxy():
# test list
a = [20, 30, 100.2, 300.4]
expected = [20, 30, 119.2, 329.4]
np.testing.assert_allclose(gcv.utils.bbox.bbox_xywh_to_xyxy(a), expected)
aa = np.array([a, a])
bb = np.array([e... |
d97c2fc54631959bca4096ca2b49da7dab3296a14e7201edcc96030e2454c6e8 | Python | 478 | 21 | from pydantic import BaseModel
from celery import Celery
app = Celery('tasks', broker='amqp://')
class ArgModel(BaseModel):
value: int
class ReturnModel(BaseModel):
value: str
@app.task(pydantic=True)
def x(arg: ArgModel) -> ReturnModel:
# args/kwargs type hinted as Pydantic model will be converted
... |
114d9cd6a90811944c78b03bafde0add95494804a959939aa5795243da05ec8c | Python | 479 | 17 | import logging
import psutil
class Profiler:
def __init__(self, device):
# Pass in the pid of the main thread to ensure all threads are counted for
self.logger = logging.getLogger(__name__)
def execute(self) -> None:
# Give global information
self.logger.info(
"Ma... |
78af421f7ed021805b6fc9aefd3f6cbe264edf8fba9a8a22d0caa3f47eaea211 | Python | 479 | 16 | import os
import scanpy as sc
from PIL import Image
import numpy as np
def read_test_data():
"""Reads in test data to run unit tests."""
# Determining path of this file #
path = os.path.dirname(os.path.realpath(__file__))
adata = sc.read_h5ad(f"{path}/test_data/test_data.h5")
im = Image.open(f"{pa... |
174cc62ba5cb6151bd00b71a41428942b139dfc4700c531278ea04646aad4e79 | Python | 480 | 18 | # Generated by Django 2.2.2 on 2019-08-03 13:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0043_auto_20190612_1938'),
]
operations = [
migrations.AlterField(
model_name='upload',
name='image... |
8d2b60b6f231bb0af1dc89cbe02e61c1f0907bbb1d23a1d1a5916699118694c5 | Python | 480 | 21 | from io import StringIO
import flask
def test_suppressed_exception_logging():
class SuppressedFlask(flask.Flask):
def log_exception(self, ctx, exc_info):
pass
out = StringIO()
app = SuppressedFlask(__name__)
@app.route("/")
def index():
raise Exception("test")
r... |
dce98af5786c72253783d3b5ccd4a9dfde12446d18f48cab3cba76d7670a0702 | Python | 480 | 18 | """
Crash course on using NeoIO to display info about ABF files
"""
from imports import *
from neo.io import AxonIO
import pprint
pp = pprint.PrettyPrinter(indent=4)
if __name__=="__main__":
fname = PATH_DATA+"/18702001-biphasicTrain.abf"
reader = AxonIO(fname)
headerText = pprint.pformat(reader._axon_in... |
28f2ef962c929b25225a3b61d31aacdd5c73530c989f1efbc008c5af6f7c3b05 | Python | 481 | 16 | import numpy as np
from src.cpd_registration import NonRigidRegistration
# Create a simple non-linear warping test
X = np.array([[0, 0], [1, 0], [2, 0]])
Y = np.array([[0, 0], [1, 1], [2, 0]]) # Bended upwards
# The registration should bring Y back to X (straight line)
print("Initializing registration...")
reg = Non... |
8077af23adb63729167d6f55e9ae937635e5b29350786d50f341e825b8f47761 | Python | 481 | 17 | import numpy as np
from neuron import h, gui
s = h.Section()
s.insert("localize_arguments")
h.finitialize()
assert s(0.5).localize_arguments.id_v(22.0) == 22.0
assert s(0.5).localize_arguments.id_nai(22.0) == 22.0
assert s(0.5).localize_arguments.id_ina(22.0) == 22.0
assert s(0.5).localize_arguments.id_x(22.0) == ... |
c9cb6be2dd7fa696c900ff946a259944b931adf2de4e5dfc229eb764e7ed7689 | Python | 481 | 18 | """
Code here makes it easy to glance at a header item from every demo ABF file.
"""
import os
import sys
PATH_HERE = os.path.abspath(os.path.dirname(__file__))
PATH_DATA = os.path.abspath(PATH_HERE+"../../../data/abfs/")
PATH_SRC = os.path.abspath(PATH_HERE+"../../../src/")
sys.path.insert(0, PATH_SRC)
import pyabf
... |
e239cdffd341dbf783ec3ff7510d8d6e11b8e654131031d544c1ad77d03286a1 | Python | 481 | 16 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._hoverlabel import Hoverlabel
from ._legendgrouptitle import Legendgrouptitle
from . import hoverlabel
from . import legendgrouptitle
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = re... |
104d41947582d6a20f90bac30eedd61135d6be349afd9db624a14cb7f465b988 | Python | 482 | 20 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-05-04 09:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0016_auto_20180309_1349'),
]
operations = [
migrations.AddFi... |
1cd9fec5e464da4b1f4c72bf25eccc9128d1da489806894fa23ab0ccf5891c3a | Python | 482 | 16 | import matplotlib.pyplot as plt
from ptycho_torch.inference import reconstruct
from ptycho_torch.train import train
data = "datasets/Run1084_recon3_postPC_shrunk_3.npz"
model = train(data, "outputs/run1084_cnn", {
"architecture": "cnn",
"training_groups": 256,
"nphotons": 1e9,
"epochs": 1,
})
result = ... |
90b522fd526fbd8439980dc760d1a1598d7272219aee396031cf7218c1e6f3d2 | Python | 482 | 21 | from mirp._images.generic_image import GenericImage
class DXImage(GenericImage):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def update_separate_slices(self, x: bool):
# Planar images should always separate slices.
self.separate_slices = True
class CRImage(DXImage):
... |
a2030e5fa376748dd921df3ac31e563d7dff7449fcbeffdb05ba91dcf3b88a40 | Python | 482 | 22 | import numpy as np
def collect_from_batch_outputs(step_output_list,
key,
to_numpy=True,
dtype=None):
values = []
for step_dict in step_output_list:
v = step_dict[key]
if to_numpy:
v = v.de... |
ac992792a8159d30780a68ab678a308d7a7b4e25d8935c2dcf76b2c35cd79397 | Python | 482 | 22 | """
Imports all submodules
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
#__version__ = '1.3.1'
import dcCustom.data
import dcCustom.feat
import dcCustom.hyper
#import deepchem.metalearning
import dcCustom.metrics
import dcCustom.model... |
adb08ff3e7b7f4fbabe85a064243591969b70bf1501360a5c26293c983d1eb6f | Python | 482 | 22 | import os
import glob
import sys
import subprocess
_, prefix = sys.argv
results = glob.glob(prefix + "-*")
try:
os.mkdir(prefix)
except FileExistsError:
pass
assert os.listdir(prefix) == []
for result in results:
seed = result.split("-")[-1]
result = os.path.join(result, "model")
step = max(os.l... |
1e56ac686d9d120d7e12a46f8930856c37790ebe61275fafaba5828d548516d7 | Python | 483 | 21 | #!/usr/bin/env python
"""Convert a GenBank file into GFF format.
https://raw.github.com/chapmanb/bcbb/master/gff/Scripts/gff/genbank_to_gff.py
Usage:
gb_embl_to_gff.py <genbank_file> <gff_file> <input_format embl or genbank>
"""
import sys
from BCBio import GFF
from Bio import SeqIO
def main(gb_file, ofile, if... |
f35629e4914597e5ea5b4541d1ff861f52fa6111eec139d4139b01264f0ae10e | Python | 483 | 13 | from ._catplot import countplot, histplot, boxplot, violinplot, scatterplot
from ._training import metric_curve, loss_curve, training_summary
from ._regression import performance_scatter
from ._classification import confusion_mtx, auroc, auprc
from ._summary import performance_summary
from ._seq import (
seq_track,... |
2775052687984efd473ec207135b54ab05f6644ebe49e70dba8a405d99c83320 | Python | 484 | 22 | from .models_for_testing import EndToEndModelsForTesting, STANDARD_DENSITY
FM_aat = EndToEndModelsForTesting(
name="FM",
path_prefix="model/msp-282a1",
seeds=(1,),
density=STANDARD_DENSITY,
)
AM_aat = EndToEndModelsForTesting(
name="AM",
path_prefix="model/msp-265a1",
seeds=(1,),
densi... |
290ef007d1009f8d56250140c7675f85d95993ac3f4b902bfc94dc3e5d6e4791 | Python | 484 | 22 | from .sampling import sample_gaussian, sample_gaussian_spd, RandomOverSampler
from .simulated import (
make_matrices,
make_masks,
make_gaussian_blobs,
make_outliers,
make_classification,
make_classification_transfer,
)
__all__ = [
"sample_gaussian",
"sample_gaussian_spd",
"make_mat... |
72329f864af9954c9cd9da5819e79cadfab367cf70a27d9e173ccf112ecabeaa | Python | 484 | 23 | #!/usr/bin/python3
import numpy as np
import matplotlib.pyplot as plt
from auryntools import *
# This code snipped assumes that you have run the example simulation
# sim_coba_binmon with default paramters.
# This generates spk output files under /tmp/
filename = "/tmp/coba.0.e.spk"
seconds = 0.1
sf = AurynBinary... |
d2c365c8ed2f5abf0b5b109361ebe58941559b7d67e57f96d6a6b7bd69970364 | Python | 484 | 23 | import time
from celery import shared_task
from celery import Task
@shared_task(ignore_result=False)
def add(a: int, b: int) -> int:
return a + b
@shared_task()
def block() -> None:
time.sleep(5)
@shared_task(bind=True, ignore_result=False)
def process(self: Task, total: int) -> object:
for i in rang... |
935a77e157b30a1ffe7f96c81e074eceaec305d13a061edc1d5917464a22403f | Python | 485 | 19 | import csv
import string
import math
import cmath
import numpy as np #import package numpy and give it the designation "np"
import os
####################################################
def check_make_dir(dir):
d = os.path.dirname(dir)
print("directory is %s\n" % (d) )
print("Checking for directory\n")
... |
a3cbb63dc1fe535ea95aba8dc875f3b32df2d5a84b751a44573f212c4b3d51f6 | Python | 485 | 23 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
fraction_of_standard_epoch = 5509 / 162706
msp.decay_per_epoch = 0.9 ** fraction_of_standard_epoch
msp.architecture = dict(
type="PreprocessedSpliceAI",
preprocessor_spec=dict(type="Identity"),
spliceai_spec=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.