sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
6ec44f6452ad86264384221581ae861e1b3d82b6377d8efbba8190e61e27c4b4 | Python | 407 | 14 | import os
import pandas as pd
from get_avg import get_cohorts
outfile = '../subject_demographics.csv'
tbi_dir = '/scratch/n/tbi-meg/v/processed'
camcan_dir = '/scratch/n/restmeg/v/processed'
cohorts = get_cohorts(tbi_dir, 'all', camcan_dir)
df = pd.DataFrame(cohorts.items(), columns=['cohort', 'subject']).explode('... |
bd4e251423b1ae9562783b2f70f793c130062b8199b01ab52a815fc581e7b88d | Python | 407 | 10 | from shelved.spliceai_gtex.alternative_dataset import write_alternative_dataset
write_alternative_dataset(
files_for_gene_intersection=["spliceai_gtex"],
data_segment_chunks_to_use=[("train", "all"), ("test", "0")],
ref_genome_path="/scratch/kavig/hg19.fa",
out_prefix="../data/canonical_and_gtex_datas... |
ca6e931751e24805aebc8a21841a5fbb9afc038336cd3752759473db1282adeb | Python | 407 | 17 | try:
from llspy.bin.llspy_gui import main
except ImportError:
import os
import sys
thisDirectory = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.join(thisDirectory, os.pardir, os.pardir))
from llspy.bin.llspy_gui import main
if __name__ == "__main__":
import logging
... |
69b3e3e24bb9a0f287b0be679be38f7f8bd006a2e09700a1460367b040988538 | Python | 408 | 12 | import warnings
from FrEIA.framework.sequence_inn import SequenceINN
class ReversibleSequential(SequenceINN):
def __init__(self, *dims: int):
warnings.warn("ReversibleSequential is deprecated in favour of "
"SequenceINN. It will be removed in a future version "
... |
6fcdb7ee80372e3a0eff2eb9b8c5a795156c492f9a22a25bbaee2c33f53039d3 | Python | 408 | 13 | # ruff: noqa: E402
from importlib.util import find_spec
# check if optional dependencies are installed
_SB3_INSTALLED: bool = find_spec("stable_baselines3") is not None and find_spec("sb3_contrib") is not None
_PSYCHOPY_INSTALLED: bool = find_spec("psychopy") is not None
from .envs.registration import make, register... |
9321b075d82fa3e889655aab0ba2f8092ce06bf5f83c4af96726e223b6547faa | Python | 408 | 12 | from angorapy.tasks.envs.dexterity.reward_configs import *
def resolve_config_name(config_name: str):
"""Convert a name of a reward configuration into the corresponding dictionary."""
parts = config_name.split(".")
try:
collection = globals()[parts[0]]
return collection[parts[1]]
exce... |
bcb07a6befe3a6f1b8fdf7535c057071252fd2e665cae11f9967f546eb8c1af4 | Python | 408 | 16 | import torch
import torch.nn as nn
class ensemble(nn.Module):
def __init__(self, models):
super().__init__()
self.models = nn.ModuleList(models)
def forward(self, *args, **kwargs):
outputs = [m(*args, **kwargs) for m in self.models]
return torch.stack(outputs).mean(0)
@pr... |
2dce954c102951b70ca758b441c4bdf47e5385b23426c73abd55ab0c7a1981ed | Python | 409 | 18 | # Generated by Django 3.0.4 on 2020-03-22 14:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0056_auto_20200322_1454'),
]
operations = [
migrations.AlterField(
model_name='mushroomspot',
name=... |
4154cc7e821a19ac3b8e4263f9b4c2801296f1c7e845765a8895042be9af0fca | Python | 409 | 20 | #!/usr/bin/env python
"""
# Author: Kangning Dong
# File Name: __init__.py
# Description:
"""
__author__ = "Kangning Dong"
__email__ = "dongkangning16@mails.ucas.ac.cn"
from .STAGATE import STAGATE
from .Train_STAGATE import train_STAGATE
from .utils import (
Batch_Data,
Cal_Spatial_Net,
Ca... |
a99edb7e26944839c3e0ec189b22ce3f70b9684465af62937d772c941784aa17 | Python | 409 | 13 | import pytest
from lightly.utils.deprecation import warn_deprecated
def test_warn_deprecated() -> None:
with pytest.warns(FutureWarning) as record:
warn_deprecated("Old", "New", removed_in="1.7.0")
assert len(record) == 1
message = str(record[0].message)
assert "Old is deprecated" in message
... |
c4c379f7abbe26ffb4033ea760a091defd3f676793f6f1a8fbb438d7df4fd70d | Python | 409 | 10 | REFBASE = 'https://docs.celeryq.dev/en/latest'
REFS = {
'mailing-list':
'https://groups.google.com/group/celery-users',
'irc-channel': 'getting-started/resources.html#irc',
'breakpoint-signal': 'tutorials/debugging.html',
'internals-guide': 'internals/guide.html',
'bundles': 'getting-started... |
d224f758273cd2603cf1785d0314e9b7f83a4c54609b01d273d186f8788fce41 | Python | 409 | 19 | """Entry-point for the :program:`celery` umbrella command."""
import sys
from . import maybe_patch_concurrency
__all__ = ('main',)
def main() -> None:
"""Entrypoint to the ``celery`` umbrella command."""
if 'multi' not in sys.argv:
maybe_patch_concurrency()
from celery.bin.celery import main as... |
0127a27a239ce3a12e28c500ad6de4b7f5896ec2f1533cf40556327266a0e4fc | Python | 410 | 8 | """embedding module"""
from sknetwork.embedding.base import BaseEmbedding
from sknetwork.embedding.force_atlas import ForceAtlas
from sknetwork.embedding.louvain_embedding import LouvainEmbedding
from sknetwork.embedding.random_projection import RandomProjection
from sknetwork.embedding.spectral import Spectral
from sk... |
78f1f0319548b8f3c09a59d08ddbc813a21314498bc15c2cd2cd763915f3d228 | Python | 410 | 12 | from modular_splicing.eclip.trained_on_eclip.train import (
eclip_model_from_name,
model_specs,
)
from modular_splicing.eclip.test_motifs.names import get_testing_names
for seed in (1, 2, 3):
for motif in get_testing_names(motif_names_source="eclip_18").common_names:
for name in model_specs:
... |
b156759b675809965f9e239c42a10e2039ee6624ff149b612efbbd86a77d1a9d | Python | 410 | 17 | import torch
from torch_geometric.data import Dataset
from torchvision import transforms
class GraphDataset(Dataset):
def __init__(self, data):
super(GraphDataset, self).__init__()
self.data = data
def __len__(self):
return len(self.data)
def __getitem__(self,idx):
if... |
f0155017c53938b287b1c8478562915ad242e672199be298be89a15ac7b36563 | Python | 410 | 21 | import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
import tensorflow as tf
from angorapy import make_task
import matplotlib.pyplot as plt
tf.get_logger().setLevel('INFO')
env = make_task("ManipulateBlockVisualDiscrete-v0", render_mode="rgb_array")
state = env.reset()
for i in range(100):
state, r, dd, trunc... |
6d38f8ab14077a8e45d5a92028b1f57e1204b6983f764bb86404d035eb4e02a7 | Python | 411 | 12 | import json
from celery.signals import task_received
@task_received.connect
def task_received_handler(request, **kwargs):
stamps = request.request_dict.get("stamps")
stamped_headers = request.request_dict.get("stamped_headers")
stamps_dump = json.dumps(stamps, indent=4, sort_keys=True) if stamps else sta... |
d32fb47591eac6e289e999cdd4c2cdeee940366075b98b8df70eaf163b56d361 | Python | 411 | 17 | from setuptools import find_packages, setup
setup(
name='pyaldata',
packages=find_packages(),
version='0.1.0',
description='',
author='Matt Perich, Catia Fortunato, Bence Bagi',
#license='License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
install_requires = [
... |
6201367aa9f04bc4363563fda4d63e3356e9771467e7e0be09dca4c9d356ee23 | Python | 412 | 6 | """hierarchy module"""
from sknetwork.hierarchy.paris import Paris
from sknetwork.hierarchy.base import BaseHierarchy
from sknetwork.hierarchy.louvain_hierarchy import LouvainIteration, LouvainHierarchy
from sknetwork.hierarchy.metrics import dasgupta_cost, dasgupta_score, tree_sampling_divergence
from sknetwork.hierar... |
aacce704caeba170dfe1de90f5b303a8ae5d39383a0d7722732472c40146600b | Python | 412 | 12 | """Report related settings."""
###################################################################################################
###################################################################################################
# Centering values, with long & short options
# Note: Long CV of 98 is so that the ma... |
c0532735af1e01302d69e1d3f90b1502a402b40ab2d353f2a00856bc0cf90e2c | Python | 412 | 18 | from ourmodel.loss.adv_loss import adv
from ourmodel.loss.coral import CORAL
from ourmodel.loss.cos import cosine
from ourmodel.loss.kl_js import kl_div, js
from ourmodel.loss.mmd import MMD_loss
from ourmodel.loss.mutual_info import Mine
from ourmodel.loss.pair_dist import pairwise_dist
__all__ = [
'adv',
'CO... |
d5a3f7a6a491f1e69af128609d0f92c3ebd2676624e8a74d88fadb12efc46ff5 | Python | 413 | 12 |
class Writer(object):
def __init__(self, file, dataset_reader):
self.write_file = open(file, 'w+')
self.dataset_reader = dataset_reader
def add_batch(self, list_idx, list_pred_lbl, list_true_lbl, lbl_logits):
self.dataset_reader.store_test_lbl(list_idx, list_pred_lbl, list_true_lbl, l... |
0fcf07e28e44ff3062345276ab92905d2c546eec3d13d118651245ea75329117 | Python | 414 | 13 | import re
import pandas as pd
def parse_region_string(region: str) -> pd.DataFrame:
"""Parse a region string such as ``chr1:100-200`` into a Chromosome/Start/End data frame."""
feat_list = re.split("-|:", region)
feature_df = pd.DataFrame(columns=["Chromosome", "Start", "End"])
feature_df.loc[0] = fe... |
1bb0de6515c80b4341deb5dc81206d059be02c80b6f9b2dbdea236b8466a5ba1 | Python | 414 | 16 | import glob
import os
import sys
try:
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/")
DATA_FOLDER = os.path.join(PATH_SRC, "../data/abfs/")
sys.path.insert(0, PATH_SRC)
impo... |
6b68691b2ea75973af76f5eef4d72a8048686fcf680d9e4e4bd46877f4ece224 | Python | 414 | 13 | """Collection of PyTorchLightning models."""
from pl_bolts.models.autoencoders.basic_ae.basic_ae_module import AE
from pl_bolts.models.autoencoders.basic_vae.basic_vae_module import VAE
from pl_bolts.models.mnist_module import LitMNIST
from pl_bolts.models.regression import LinearRegression, LogisticRegression
__all__... |
c0e3e6b65659f8fc69c17f0a4a3e65c91c08887af12c70336c7a146742342966 | Python | 414 | 15 | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl>
# All rights reserved.
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
from ._version import get_versions
__revision__ = get_versions()['full-revisionid']
del get_version... |
a87496da587b0c7d3b2cd8f6f3e8f6afc1bca139ef4ec4326f3f3aa04d110a08 | Python | 415 | 17 | from torch.utils.data import Dataset
class ConcatDataset(Dataset):
def __init__(self, *datasets):
self.datasets = datasets
def __getitem__(self, i):
result = []
for dataset in self.datasets:
cycled_i = i % len(dataset)
result.append(dataset[cycled_i])
... |
c015de608c31caf175c1556ce126c10aaecf35115b8c927e6019ec43ed969bcb | Python | 415 | 20 | from distutils.core import setup
from distutils.extension import Extension
from distutils.command import build_ext
import numpy as np
import sys
sys.argv[1:] = ['build_ext', '--inplace']
ext_modules = [Extension(
name="swapped",
sources=["ext_src/swapped.c", "ext_src/c_swapped.c"],
language="c", include_d... |
089791e92f930d49d2ae69a96970bfef03384bffff060afdc125d8ae60c70407 | Python | 416 | 12 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from numpy.testing import assert_array_equal
from eelbrain import load
from eelbrain.testing import file_path
import pytest
@pytest.mark.skip("Broken with recent pyarrow versions")
def test_feather_io():
ds = load.feather(file_path('mini.feather'))
asse... |
32b5632e65d98c2c1f23883842952a24fa7cd6222962486822e4c2ba98441616 | Python | 416 | 14 | from setuptools import setup
setup(name='DGD',
version='0.1.0',
description='python implementation of direct representation learning via MAP estimation',
author=['Anders Krogh','Viktoria Schuster'],
license='MIT',
url='https://github.com/Center-for-Health-Data-Science/DGD_paper',
pa... |
f10a0e47b9a3ff21ec8b4ac288707905649460ad41b1769acead7ec771e507cd | Python | 416 | 14 | import logging
import sys
def setup_logger(name):
logger = logging.getLogger(name)
logger.setLevel(logging.INFO)
# don't log results for the non-master process
ch = logging.StreamHandler(stream=sys.stdout)
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter("%(asctime)s %(name)s %(levelna... |
41dff41f030cc3f3e6dd4dd6845deded9f89ce2366de5d64293c616330683d60 | Python | 417 | 14 | from modular_splicing.models_for_testing.list import FM, FM_eclip_18
from modular_splicing.utils.io import load_model
fm_baselines_nonbinarized = {
"rbns": FM,
"eclip_18": FM_eclip_18,
}
def fm_baseline_nonbinarized(motif_names_source):
fm_model = fm_baselines_nonbinarized[motif_names_source]
fm_bas... |
6ce37cc38416745026f8b0b18a67886f4dc4fb77689e4ca32bd6916f41608e6d | Python | 417 | 16 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._center import Center
from ._eye import Eye
from ._projection import Projection
from ._up import Up
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__,
... |
a737010c758225a6c8f5c9ae03767f3fcccd940741d62cb2b173f38e591aed53 | Python | 417 | 18 | # Generated by Django 3.2.6 on 2026-04-04 04:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0118_auto_20241119_1721'),
]
operations = [
migrations.AddField(
model_name='specimen',
name='licen... |
3381c2a3910c6421a841dbe1ef1db066fc7dfb171e092e7050230acff2c28878 | Python | 418 | 17 | import abc
from carbonserver.api import schemas
class Organizations(abc.ABC):
@abc.abstractmethod
def add_organization(self, organization: schemas.OrganizationCreate):
raise NotImplementedError
@abc.abstractmethod
def get_one_organization(self, organization_id):
raise NotImplementedE... |
9d1cb24147982d65be41e34bebeef8a98df3ca64f670ed0c5d024f2ef74b1eea | Python | 418 | 19 | from sys import argv
from msp import MSP, setup_as_am
from msp_gtex import setup_as_gtex
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
setup_as_am(msp)
tissue_groups = setup_as_gtex(msp, "just_whole_blood", "MarginalPsiV3")
assert len(tissue_groups) == 1
msp.acc_thresh = 0
msp.extra_params += " --learned-m... |
e60bdb6b9649cb0ef5d3aa272dc6072af727eb04a06b251c9efa144b04630f38 | Python | 418 | 19 | from . import anthroprotect
def get_info(experiment):
"""
Returns infos about the given dataset.
:param experiment: string name of the dataset
:return: dict with infos
"""
if experiment.split('_')[0] == 'anthroprotect':
return anthroprotect.info
def get_datamodule(experiment, **kwa... |
1c4ad2922311c4d24659cc6f472730857742c3f5c6dc1592295a21f88a7bcf18 | Python | 419 | 10 | import os
from pathlib import Path
# Get absolute path to video file relative to this module
_TEST_DIR = Path(__file__).parent.parent / "static_files" / "videos"
VIDEO = str(_TEST_DIR / "arena_10x2_sortTubes.mp4")
# Disable frame drawing in CI environments (no display available)
# GitHub Actions sets CI=true, most CI... |
395f72024a16a3d9323739fbafd744ff56f50fffb53fc339c17956c80671356d | Python | 419 | 15 | from time import sleep
import src.OB_GEN.OB_Generator_utils as utils
def ob_gen(yaml_configs):
#read yaml
#with open(r'../config.yaml', 'r') as file:
#yaml_configs = yaml.safe_load(file)
utils.preprocess_files(yaml_configs)
utils.run_bat_file()
sleep(1)
utils.copy_ob_result_files(yaml_co... |
e9bdfa4805b22abff33caaaf22babf7316c79a2e260ed354d67b6fdcb7205b5d | Python | 419 | 27 | __author__ = 'quentin'
from ethoscope.tracking.cameras import *
from ethoscope.tracking.trackers import AdaptiveMOGTracker
import cv2
import cv
import numpy as np
# we start from a cropped video:
cam = MovieVirtualCamera("/stk/pysolo_video_samples/singleDamTube2_150min_night.avi")
amog = AdaptiveMOGTracker()... |
11a35e66d08fd1415adf4a9911751ba62b32ce0a150c2e9906e3bdc973b5aace | Python | 420 | 10 | """A set of common utilities used within the environments.
These are not intended as API functions, and will not remain stable over time.
"""
# These submodules should not have any import-time dependencies.
# We want this since we use `utils` during our import-time sanity checks
# that verify that our dependencies ar... |
7aa200a888f2e20e3c626ff3e01fbb14e166c917873db02af75baae174e046ca | Python | 420 | 13 | import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('bed', metavar='<narrow-peaks.bed>')
args = parser.parse_args()
with open(args.bed) as f:
for line in f:
row = line.strip().split('\t')
chrom, start, end, name, score, stra... |
95f1895dff9a844693b4d594d64b02bcd509fa366b7e426384d12c50e453d56d | Python | 420 | 15 | import csv
import string
import math
import cmath
import numpy as np #import package numpy and give it the designation "np"
import os
####################################################
def fmtcols(tmp_arrayp, file):
out=open(file,"w")
for x in zip(*tmp_arrayp):
out.write("{1}\t{0}\n".format(*x))
ret... |
a0f055c501a49a156904a12dd1022562d72f1ede0103f5bd644b62d5bb9a467c | Python | 420 | 16 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._colorbar import ColorBar
from ._line import Line
from ._pattern import Pattern
from . import colorbar
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name__... |
ee91b0d685822ff011770d79d28c9f810429162d5f309adaed48ff07a95e673f | Python | 420 | 25 | import numpy as np
from neuron import h, gui
def test_default_values():
s = h.Section()
s.insert("default_values")
mech = s(0.5).default_values
h.stdinit()
assert mech.X == 2.0
assert mech.Y == 0.0
assert mech.Z == 7.0
for i in range(3):
assert mech.A[i] == 4.0
assert ... |
ef2a2540e9fe3025e0ac94a5f9441b7e93e757600ff220756fac4e3351666520 | Python | 420 | 21 | from importlib.metadata import PackageNotFoundError as _PackageNotFoundError
from importlib.metadata import version as _get_version
from .core import (
IntervalSet,
Ts,
Tsd,
TsdFrame,
TsdTensor,
TsGroup,
TsIndex,
nap_config,
)
from .io import *
from .process import *
try:
__version... |
518efe90209ee6c778faef7417be51b6039d46a2e4cde312222283972f97cc7e | Python | 421 | 19 | 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... |
365e3b9158be00740706bd543488c13bcf07e54877450a0df60e56eae445365e | Python | 422 | 19 | 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... |
54691e520bfc3c2bdb5292a8de82805f9c81b7fc4c24dbd7522ca35aedfccb07 | Python | 422 | 10 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __future__ import d... |
5b1fbdf3051d224fd5c6c019ee1b727face5b8ba346f31857f0470bf67cfbf52 | Python | 422 | 19 | 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... |
782efc255826ca38404b5fac9562df1d568efa82c3d6d0a666e73e973fedd4e9 | Python | 422 | 13 | import pytest
from rpy2 import rinterface
from rpy2.rinterface import embedded
@pytest.mark.skipif(embedded.rpy2_embeddedR_isinitialized,
reason='This test should be run independently of other tests.')
def test_endr():
rinterface.initr()
embedded.endr(1)
assert (embedded.rpy2_embeddedR... |
80e9e75bd0725aa8aed871397901e388fa3ba1f13611359094b89c8cf6231d2f | Python | 422 | 18 | # Generated by Django 2.2.2 on 2019-08-22 11:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0049_auto_20190819_1616'),
]
operations = [
migrations.AlterField(
model_name='upload',
name='heart... |
95463de7c197c9b0b9a886bf9306d186df7626cfa3e1e89034ee57c13101c4ad | Python | 422 | 16 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from pathlib import Path
from eelbrain import datasets, load, save
from eelbrain.testing import TempDir, requires_pyarrow, assert_dataset_equal
@requires_pyarrow
def test_arrow_io():
tempdir = TempDir()
ds = datasets.get_uts()
path = Path(tempdir)... |
b3d51a9ec7c14d1efd91a4bdf26efb8a364bb15d98eb737d49ac01ad0bf61576 | Python | 422 | 17 | #!/usr/bin/env python
# Requires:
# - pyfftw >= 0.10.3
# - joblib
# - pymne
from setuptools import setup
setup(name='pyMEG',
version='0.0.1',
description='Python MEG tools for preprocessing etc.',
author='Niklas Wilming',
author_email='nwilming@uke.de',
url='https://github.com/Don... |
b6d8905787a17d5c852137f56effc82c76f92723ed3e56e4a073ab6da382f6bc | Python | 422 | 15 | 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
if __name__ == "__main__":
abf = pyabf.ABF(
abfFilePath=PATH_DATA+"/H19_2... |
8233899a1466f43bd7dbbfc9ebc706620a65e880138b88246af013f71c3c2008 | Python | 423 | 16 | """Force-distance analysis UI package.
This package intentionally avoids importing Qt-heavy modules at import time to
prevent circular imports with `pyjibe.registry` / `pyjibe.head`.
"""
from __future__ import annotations
__all__ = ["UiForceDistance"]
def __getattr__(name: str):
if name == "UiForceDistance":
... |
97422b11b7147283240511123ffbf0fa116ee5ba135d269cc803ab9f5e13129f | Python | 423 | 18 | # Generated by Django 2.1.5 on 2019-03-07 16:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0034_auto_20190215_0916'),
]
operations = [
migrations.AddField(
model_name='upload',
name='only',
... |
2078b26263dc8684ad11f7e69e5c5072b4cc8b95c1ec0f45ca8b29442c2d9f44 | Python | 424 | 14 | from PIL import Image
from lightly.transforms import DenseCLTransform
from .. import helpers
def test_multi_view_on_pil_image() -> None:
multi_view_transform = DenseCLTransform(input_size=32)
sample = Image.new("RGB", (100, 100))
output = helpers.assert_list_tensor(multi_view_transform(sample))
asse... |
7e41a68dc92d3c1f30be01508dc6ee1e2ec07c402b66ac5ee30443a00a9c975e | Python | 424 | 16 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._colorbar import ColorBar
from ._gradient import Gradient
from ._line import Line
from . import colorbar
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__name... |
9da2b7036e327c6e9b00c3f28247761df427d9c1d967bebb6599425b42b4aa3e | Python | 424 | 14 | """AutoML Tasks"""
import logging
from .image_classification import *
from .object_detection import *
# from .utils import *
logger = logging.getLogger(__name__)
msg = (
"We plan to deprecate auto from gluoncv on release 0.12.0."
"Please consider using autogluon.vision instead, which provides the same functio... |
a7d4233b4c44139bd236a0700ce488bc3a559ab5be6a7da3276cd3418f5099d4 | Python | 424 | 17 | import numpy as np
from src.cpd_registration import NonRigidRegistration
# Simple 2D example
X = np.array([[0, 0], [1, 1], [2, 2]])
Y = np.array([[0, 0], [1, 1], [2, 2]])
# Introduce some noise to Y
Y[1, 0] += 0.1
print("Initializing registration...")
reg = NonRigidRegistration(X=X, Y=Y, max_iterations=10)
print("Ru... |
34ca943b4600cd56c2ca54c524a2b08fad12765cc70c402f4eeb233b157de629 | Python | 425 | 9 | import galaxy.datatypes.metadata
import galaxy.datatypes.tabular
from galaxy.datatypes.metadata import MetadataElement
class ChromInfo(galaxy.datatypes.tabular.Tabular):
file_ext = "len"
MetadataElement(name="chrom", default=1, desc="Chrom column", param=galaxy.datatypes.metadata.ColumnParameter)
Metadata... |
4af3a0d62a2e22d08e17e248b39ed7e079b2edc59baf19a38c43e668c5d0ffcb | Python | 425 | 25 | from neuron import h, gui
def check_solve(make_inst):
s = h.Section()
s.insert("nonlin")
inst = make_inst(s)
x = inst.solve()
error = inst.residual(x)
assert abs(error) < 1e-9, f"{x = }, {error = }"
def test_nonlin():
check_solve(lambda s: s(0.5).nonlin)
def test_art_nonlin():
ch... |
b3ef3ec54e567a726e46b638051e30e28652c3e1ce729a4a357a843db8b96b0f | Python | 425 | 18 | # Generated by Django 2.1.5 on 2019-05-22 13:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0041_auto_20190522_1404'),
]
operations = [
migrations.AddField(
model_name='upload',
name='shift_s... |
e6d2977da79e2c249e6c897bf80ceef9ea148da36e6613103cb0122625a96c48 | Python | 425 | 17 | import abc
from carbonserver.api import schemas
class Memberships(abc.ABC):
@abc.abstractmethod
def add_user_to_organization(
self, user_id: str, organization_id: str
) -> schemas.Membership:
raise NotImplementedError
@abc.abstractmethod
def remove_user_from_organization(
... |
35abad0325b56213403eebc6e683a53f12590b783c9c87d61a69ec608496ae2a | Python | 426 | 17 | from PyQt6 import QtCore
class BGThread(QtCore.QThread):
def __init__(self, func=None, fkw=None, *args, **kwargs):
super(BGThread, self).__init__(*args, **kwargs)
self.func = func
self.fkw = fkw
self.result = None
def set_task(self, func, fkw):
self.func = func
... |
5e1bd32572ad2d03a79da8490015ee46edb414aeeba6caf14e40f992a05afd2a | Python | 426 | 18 | # Generated by Django 2.2.6 on 2020-09-02 13:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0078_upload_uncertainty'),
]
operations = [
migrations.AddField(
model_name='upload',
name='batch_s... |
882f6c5b26ed3fe4d1ea7d588b65993cf25f15e0730fe8e79fdbd95743fbc6b7 | Python | 426 | 20 | from mongoengine import *
import datetime
import time
class ExportModel(DynamicDocument):
id = SequenceField(primary_key=True)
dataset_id = IntField(required=True)
path = StringField(required=True)
tags = ListField(default=[])
categories = ListField(default=[])
created_at = DateTimeField... |
e342d705fc39ae5df60d8bbc5fdfd64b08c616c16cc712b7808f1c521998d14d | Python | 427 | 13 | from pathlib import Path
from omegaconf import DictConfig, OmegaConf
def get_lightly_config() -> DictConfig:
config_path = Path(__file__).with_name("config.yaml")
conf = OmegaConf.load(config_path)
# TODO(Huan, 05.04.2023): remove this when hydra is completely dropped
if conf.get("hydra"):
# ... |
922caf81a5bd11a64df41c8f0aded73fe0f47406ca3f10556ccbfdcc832beee2 | Python | 428 | 17 | """
binary crap keeps ending up parsed as a string. fix this.
"""
import sys
import os
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
import glob
for ab... |
b4d2fbf60ee754d90fd8f259fdbf6c1cc67994e43df42fb4283bd092e6494bd5 | Python | 428 | 17 | """
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
... |
b9511aa312287c78348440c81658dacbaf55e86d2483c4ec31efa7c2b393e847 | Python | 428 | 4 | from scene_graph_prediction.pointnet2_dir.pointnet2.models.pointnet2_msg_cls import PointNet2ClassificationMSG
from scene_graph_prediction.pointnet2_dir.pointnet2.models.pointnet2_msg_sem import PointNet2SemSegMSG
from scene_graph_prediction.pointnet2_dir.pointnet2.models.pointnet2_ssg_cls import PointNet2Classificatio... |
221cbb10e105b7463f25e0f296da6efc4db0346f49c6127f07168f283b3e70ca | Python | 429 | 18 | from flask import jsonify
from flask import render_template
from flask import request
from . import app
@app.route("/", defaults={"js": "fetch"})
@app.route("/<any(xhr, jquery, fetch):js>")
def index(js):
return render_template(f"{js}.html", js=js)
@app.route("/add", methods=["POST"])
def add():
a = reques... |
30ea9ad51ca81250d9dac254e3063c8059d082d5721f65fd36ff5acfa447d862 | Python | 429 | 15 | import os
import pandas as pd
def save_test_log(fname, project_name, log):
if not os.path.exists(fname):
df = pd.DataFrame(log)
df.loc[0, "project_name"] = project_name
elif os.path.exists(fname):
new_line = pd.DataFrame(log)
new_line.loc[0, "project_name"] = project_name
... |
b0ceab66a748487a564ba93b7a2afb5117b7a1d1d369276b8e1a23cb694dfdc5 | Python | 429 | 18 | # Generated by Django 2.1.5 on 2019-02-15 08:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0033_auto_20190214_1457'),
]
operations = [
migrations.AlterField(
model_name='upload',
name='inver... |
3df74c1c1c271832d37229ee0f7e5a9d55aa0968a8cbf2f10a1f8506c4eedab9 | Python | 430 | 12 | """Tests for specparam.reports.text."""
from specparam.reports.text import *
###################################################################################################
###################################################################################################
def test_gen_methods_text(tfm):
# T... |
7feeea193ce49f9bd7e58edbdcef7af5bb4a0db1a7c1d50ee253fa43c72fb9da | Python | 430 | 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 float(line[9]) > 26 and line[3] == 'A':
row = line[3]+line[4]
c... |
b9a798d4c87bafbb988ab2eb76b09566dda029f80500f03dbc908580322018dd | Python | 430 | 18 | """
Try to support abf.headerText in Python 2
"""
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
import glob
if __name__=="__main__"... |
c902f4bcfab7a298cf31baf5ff576f043b89f872b566594b0795098c708b20ea | Python | 430 | 13 | """Deprecated compatibility module for the removed Lightly API client."""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
_ERROR_MESSAGE = (
"lightly.api and ApiWorkflowClient have been removed from the lightly package. "
"If you need ApiWorkflowClient, use "
"Lightly SSL versio... |
d75a7a4da54d3edbc84c72257c7293a0e8e2fdcbf437597c663d071227ea09ed | Python | 430 | 18 | # Generated by Django 2.1.5 on 2019-03-12 18:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0035_upload_only'),
]
operations = [
migrations.AlterField(
model_name='upload',
name='only',
... |
fd790c8c995d9c6267fb9c58bcadf7877bb938cce92cd4343d63fdf5d8620712 | Python | 430 | 16 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._font import Font
from ._grouptitlefont import Grouptitlefont
from ._title import Title
from . import title
else:
from _plotly_utils.importers import relative_import
__all__, __getattr__, __dir__ = relative_import(
__n... |
01eb2de37636583ab68e5786f6f57eeed4fa1b8cad26486980f2f1b657238a15 | Python | 431 | 14 | from organage.OrganAge import CreateOrganAgeObject
import pandas as pd
def test_OrganAge():
data = CreateOrganAgeObject()
md_hot = pd.read_csv("tests/md_hot.csv").set_index("ID")
df_prot = pd.read_csv("tests/df_prot.csv").set_index("ID")
# sample metadata data with Age and Sex_F
data.add_data(md_h... |
3c556b798f7c4910965f17fb86d134019e6cf9cc784edf3f8c1ace93adc8f0a6 | Python | 431 | 16 | from .utils import *
from .tools import *
from .interval import *
from .regression import *
from .dim_reduction import *
from .movement_onset_and_peak import *
from .data_cleaning import *
from .io import *
from .cmp import *
from .extract_signals import *
from .smoothing import *
from .signal_transformations import *
... |
d1d5d81917e11f42d53391c1c0655db60fdba11a5bc6368000d28c893522cd27 | Python | 431 | 18 | # Generated by Django 2.2.6 on 2020-05-04 10:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0075_auto_20200504_1253'),
]
operations = [
migrations.AlterField(
model_name='upload',
name='epoch... |
4cbb567402a6bea0b61e037ab7ae840862c3ef2bed8b311151e7d288bdaf307c | Python | 432 | 16 | import tensorflow as tf
def dist_loss(data, min_dist, max_dist=20):
pairwise_dist = cdisttf(data, data)
dist = pairwise_dist - min_dist
bigdist = max_dist - pairwise_dist
loss = tf.math.exp(-dist) + tf.math.exp(-bigdist)
return loss
def cdisttf(data_1, data_2):
prod = tf.math.reduce_sum(
... |
5b9c274dda8fbe6ea28da9db58c2a16221d57175cdd98794edc916ef096ea6f2 | Python | 432 | 15 | """``python -m torchlens``: the tiered read-only CLI (torchlens.agent.cli).
Tier-0 verbs (info/schema/guide/version/ls) stay torch-free: the package
``__init__`` defers its torch import, so ``python -m torchlens info run.tlspec``
reads manifest JSON only. See ``python -m torchlens --help``.
"""
from __future__ import... |
1ad4cd185cfe4f6fa996d987470a21b70743d6fe474aa5c9a07946f2127e0e41 | Python | 433 | 16 | 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... |
609b22c283ed423003e8c25a16693ee8dca36c12754a8ba17233495a9827aaf3 | Python | 433 | 16 | 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... |
67ff17d6da85368cd6b3834fa83cbeb49c800825215788f70d9664a590df61c8 | Python | 433 | 16 | 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... |
07a52124e99851d3655f0368c4b2ed6fefa7bfd9b1f7a3ab97e5b5565e8f2f23 | Python | 434 | 18 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for laplacian."""
import unittest
import numpy as np
from sknetwork.data.test_graphs import test_graph
from sknetwork.linalg import get_laplacian
class TestLaplacian(unittest.TestCase):
def test(self):
adjacency = test_graph()
laplacian =... |
19f6b06e7b4ffcde6d37885d76732fc730fb86225f3af6680cb0bb0befa9393b | Python | 434 | 16 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 146
msp.architecture["motif_model_spec"] = dict(
type="PSAMMotifModel",
motif_spec=dict(type="rcrb"),
exclude_names=("3P", "5P"),
)
msp.architecture["sparse_spec"] = dict(type="... |
2196fe792c790c7f2fedadfecced491b7afdfbe3fefd7f67eb17ac3a23e5e1cd | Python | 434 | 21 | from .models_for_testing import (
TWENTY_EPOCHS,
EndToEndModelsForTesting,
ModelForTestingWithStep,
)
FM_eclip_18 = EndToEndModelsForTesting(
name="FM_eclip_18",
path_prefix="model/msp-285a1",
seeds=(1,),
# approximately 0.18e-2 * 18 / 79
density=0.0423e-2,
)
AM_E = ModelForTestingWit... |
36234767d0f143744ec34a39c70713f4ed81ad4d0db810096d9f278b8863757c | Python | 434 | 16 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 146
msp.architecture["motif_model_spec"] = dict(
type="PSAMMotifModel",
motif_spec=dict(type="rcrb"),
exclude_names=("3P", "5P"),
)
msp.architecture["sparse_spec"] = dict(type="... |
6c9245e11be326826d0ecb88e08324390cfec163a22c2fc834918eb2e5eb1d87 | Python | 434 | 17 | from .morphofield import (
cell_directions,
morphofield_gp,
morphofield_sparsevfc,
morphopath,
)
from .morphofield_dg import (
morphofield_acceleration,
morphofield_curl,
morphofield_curvature,
morphofield_divergence,
morphofield_jacobian,
morphofield_torsion,
morphofield_vel... |
a9dbf25c39f3461a49f2baf9413ec7334f3eacad6019b86a629b943395587fa2 | Python | 434 | 30 | from ._tools import (
encode_domains,
decode_domains,
TLSplitter
)
from ._estimators import (
TLDummy,
TLCenter,
TLScale,
TLRotate,
TLEstimator,
TLClassifier,
TLRegressor,
MDWM,
)
__all__ = [
"encode_domains",
"decode_domains",
"TLSplitter",
"TLDummy",
"... |
bd3c013e84a5971b407aff2a1fa34825a36f49a001e62d7a5324e2352a98d279 | Python | 434 | 17 | # SPDX-License-Identifier: LGPL-2.1-or-later
import unittest
import os
from pyEcoHAB import data_path
from pyEcoHAB import Timeline
class TestnoDST(unittest.TestCase):
def test_1(self):
path = os.path.join(data_path, "time_change")
config = Timeline(path)
times = config.get_time_from_epoch... |
cf12f4c7faae322abab820f16b1a8b388e210adbb9fd4336534d60765cc86a5c | Python | 434 | 16 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 146
msp.architecture["motif_model_spec"] = dict(
type="PSAMMotifModel",
motif_spec=dict(type="rcrb"),
exclude_names=("3P", "5P"),
)
msp.architecture["sparse_spec"] = dict(type="... |
f4f4db3f92e710782496169156677e15e4c371ad1f0825768b8597015b9423bd | Python | 434 | 8 | from static_file_generation import save_separate_flattened_sequence_matrices
"""
save_separate_flattened_sequence_matrices("Davis", 500)
save_separate_flattened_sequence_matrices("Davis", 500, "ZHAC000103.txt")
save_separate_flattened_sequence_matrices("Davis", 500, "GRAR740104.txt")
save_separate_flattened_sequence_ma... |
01bfab9a2a3195a328821af377544cafe2f8cf2aea20cf17ce7aab8c13c6136f | Python | 435 | 8 | """clustering module"""
from sknetwork.clustering.base import BaseClustering
from sknetwork.clustering.louvain import Louvain
from sknetwork.clustering.leiden import Leiden
from sknetwork.clustering.propagation_clustering import PropagationClustering
from sknetwork.clustering.metrics import get_modularity
from sknetwor... |
24338a5d193c198491d80fd904702cc737f7da9f2753b4a9b04a421b4f861c68 | Python | 435 | 16 | 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.