sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b83f6baed36751d452d2fc2d5cc4e25664a69b495185cbf7dafa56224b546334 | Python | 521 | 22 | import itertools
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats
x = np.linspace(0, 1, 100)
for a, b in itertools.product([0.3, 0.5, 0.7], [0.05, 0.1, 0.3]):
values = stats.norm(a, b).pdf(x)
plt.plot(x, values, label=f"a={a}; b={b}")
plt.xticks([0, 1])
plt.xlim(0, 1)
plt.xlabel("A... |
f5834e01021e5f7b6f18a1f32b9f7a48722aae39955444cf6cfdea25bd93f748 | Python | 521 | 26 | from ._version import __version__
from . import classification
from . import tangentspace
from . import channelselection
from . import estimation
from . import spatialfilters
from . import clustering
from . import stats
from . import embedding
from . import preprocessing
from . import datasets
__all__ = [
'__vers... |
519cc2000d14bf8bd002841624261ca9b7816b8b088bebcf825d3fa7c931378d | Python | 522 | 18 | """
This module define a converter
"""
import torch
from converter.generic_converter import GenericConverter
from utils.utils import select_output_lm
class ConverterLMToPred(GenericConverter):
"""
This class convert language model output to prediction
"""
def convert_output_and_target(self, output, t... |
5cea9b8b12dbb1d3a76dcce215d29f972e104861ad90957adb5a63f6b0736f42 | Python | 523 | 22 | # Generated by Django 2.2.6 on 2020-05-04 10:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0074_auto_20200326_1736'),
]
operations = [
migrations.RemoveField(
model_name='upload',
name='hear... |
bfa6816d19b6c425e4319252cf28fc7ff748aadc1bd50741bf0a6cc541724925 | Python | 523 | 23 | import mne
import sys
import os
import os.path as op
def main(args):
subj = args[1]
outdir = args[2]
data_dir = os.path.join(outdir, subj, 'ica')
fname = os.path.join(data_dir, f'{subj}-emptyroom-ica-recon.fif')
raw = mne.io.Raw(fname)
cov = mne.compute_raw_covariance(raw)
outfile = op.j... |
125e207bf0692a4efc071908f905e1bce9877e5fb768f19deeac3f96ef121d0c | Python | 524 | 16 | import sys
import os
sys.path.append(os.getcwd())
from src import utils
data_repository = 'data_repository'
try:
acr2id, ancestorsById, neuriteLengthDistribution, acr_to_morpho_id = utils.load_useful_variables(data_repository)
print("load_useful_variables successful")
except Exception as e:
print(f"Error:... |
8d68f401ba8ecd97910538360a9d0624ea6c4225d8cf5d767216b94f21acafd4 | Python | 524 | 15 | from pyrates import CircuitTemplate
import matplotlib.pyplot as plt
template = CircuitTemplate.from_yaml("model_definitions/ThreeColumnNetwork")
res = template.run(simulation_time=100.0, step_size=1e-3,
outputs={"v_e": "all/pc/rpo_e_in/v", "v_i": "all/pc/rpo_i/v"})
v = res["v_e"].values + res["v_i"]... |
6d3852f1955ebb26c0caa35ef2399d37a460689843ab49657b0a2c1ab3bce7e7 | Python | 525 | 21 | """Celery + :pypi:`cell` integration."""
from celery import bootsteps
from .connection import Connection
__all__ = ('Agent',)
class Agent(bootsteps.StartStopStep):
"""Agent starts :pypi:`cell` actors."""
conditional = True
requires = (Connection,)
def __init__(self, c, **kwargs):
self.agen... |
83b462555555fb3fc6a76a3948c4633bfc0545a20369b0b327e2ec0664810160 | Python | 525 | 16 | import angorapy as ap
task = ap.make_task("Pendulum-v1")
build_models = ap.get_model_builder(model="simple", model_type="ffn", shared=False)
agent = ap.Agent(build_models, task, horizon=512, workers=12)
agent.drill(n=20, epochs=5, batch_size=256)
if agent.is_root:
investigator = ap.analysis.Investigator.from_age... |
d2d939fc22702537b268cdb9204e5ae1b22dbb19faf630eb92bad6073b21073f | Python | 525 | 17 | from .psa_authnz import BACKENDS_NAME
def provider_name_to_backend(provider):
for k, v in BACKENDS_NAME.items():
if k.lower() == provider:
return v
return None
def debug_access_token_data(access_token, social, **kwargs):
"""
Debug auth pipeline step to add decoded access token da... |
139c250e8352429c115ec4dec514878a4925ddf94f7528497ce934f214abc78d | Python | 526 | 18 | import abc
from typing import List
from carbonserver.api.schemas import Experiment, ExperimentCreate
class Experiments(abc.ABC):
@abc.abstractmethod
def add_experiment(self, experiment: ExperimentCreate) -> Experiment:
raise NotImplementedError
@abc.abstractmethod
def get_one_experiment(self... |
7848d2d40b03641fd7247701009c8ecd56034e76d01eb51237bdb8708fc9dcac | Python | 526 | 16 | """
Larvaworld web-based apps
A number of web-based applications are available to inspect larva models, test isolated behavioral modules, view replays of stored datasets and launch simulations of behavioral experiments.
The apps can be launched via a single webpage by clicking on their respective icons.
Launch the we... |
7b56c2ec57f25e3614523890f07c56c7b29c3cebbed00bdde6d050592a5ceae7 | Python | 526 | 16 | """
test the new ABF writer module by loading an ABF2 file (voltage clamp sweeps
with a membrane test and spontaneous events) and saving it as an ABF1 file
then loading it in MiniAnalysis.
"""
import sys
import os
PATH_HERE = os.path.abspath(os.path.dirname(__file__))
PATH_DATA = os.path.abspath(PATH_HERE+"../../../da... |
acff44e546406e395e4587e1b40207c39aff9cb7d4de8747d32711a96bff9064 | Python | 526 | 22 | """
Allow custom sample rate when writing ABF1 files
"""
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__":
... |
bb99c1c721c2623754705e69cf13373ec702283070296cfdbe91944911f9543f | Python | 526 | 15 | __author__ = 'quentin'
from ethoscope.tracking.monitor import Monitor
from ethoscope.tracking.cameras import MovieVirtualCamera
from ethoscope.tracking.trackers import AdaptiveMOGTracker
from ethoscope.tracking.interactors import SystemPlaySoundOnStop
# cam = MovieVirtualCamera("/home/quentin/Desktop/drosoAdult_shor... |
d824f74355336217b14e90528764552a0a2df9adcf2db02115af037f767d5e20 | Python | 526 | 17 | from modular_splicing.utils.io import load_model
def PretrainedMotifModel(
model_path, model_step, finetunable, num_motifs, input_size, channels
):
"""
Load a motif model from a saved e2e model.
"""
del input_size, channels, num_motifs
assert model_step is not None
_, entire_model = load_m... |
5fee3bda38628bbbe7e7498df1dc64bac5b5b5e4ea20e0a15f1577cd4c427368 | Python | 527 | 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_epsp_binmon with default parameters and adjusted the below
# filename to its output.
filename = "../../build/release/examples/out_epsp.0.bmem"
t_... |
aa6a7a6328e06529425659c360ddab73993ef0d5355ce9b94ed9fb607639a7d7 | Python | 527 | 13 | # II inhibition increase
from brian2 import mV, ms
from pypet import cartesian_product
input_dict = {'c_gii': [0.05, 0.06, 0.07, 0.08, 0.09, 0.095, 0.0955, 0.096, 0.0965, 0.097, 0.0975, 0.098, 0.0985, 0.099, 0.0995, 0.1, 0.2, 0.3, 0.4,
0.5, 0.6, 0.7, 0.8, 0.9, 1. , 1.1, 1.2, 1.3, 1.4, 1.5, 1.6,... |
2f14d12ae5ca654db3969ddcc2480dfc3254272efce7479b6d99369bfff4392c | Python | 528 | 15 | import mne
from surfer import Brain
subjects_dir = '../../data/subjects'
labels = mne.read_labels_from_annot('fsaverage', 'aparc_sub', subjects_dir=subjects_dir, hemi='lh')
brain = Brain('fsaverage', 'lh', 'inflated', subjects_dir=subjects_dir,
cortex='low_contrast', background='white', size=(800, 600)... |
45bcf40fb59a89d5aa877d816c61864b3130a02f2181952c4fb32a78e4f4adce | Python | 528 | 15 | from keras.src.backend.common.name_scope import name_scope
from keras.src.backend.numpy import ops
from keras.src.backend.numpy import random
from keras.src.backend.numpy import rnn
from keras.src.backend.numpy.ops.core import Variable
from keras.src.backend.numpy.ops.core import compute_output_spec
from keras.src.back... |
5dcb8c325bb8c6c942e13a9201b4c042e9b1a4bf22410588c43fc72fae581df8 | Python | 528 | 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"] = 21
msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict(
type="FCMotifFeatureExtractor",
extra_compute=10,
num_compute_layers=1
)
msp... |
9d969b9f317af06d5cc82a27374e97784616b29c4de13dbab1e9ad21dde924fe | Python | 528 | 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"] = 13
msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict(
type="FCMotifFeatureExtractor",
extra_compute=10,
num_compute_layers=1
)
msp... |
d189a584536a9afb49edccfec54c5c03a6f1792307e1c5694b61a82f87107fed | Python | 528 | 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"] = 13
msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict(
type="FCMotifFeatureExtractor",
extra_compute=10,
num_compute_layers=1
)
msp... |
e8b3650157b53a322ec1f768db9a2f89ddb65d4de297748de9a390466ae5b329 | Python | 528 | 19 | """Variables and functions for backward_compatibililty
"""
CAPER_1_0_0_PARAM_KEY_NAME_CHANGE = {
'out_dir': 'local_out_dir',
'out_gcs_bucket': 'gcp_out_dir',
'out_s3_bucket': 'aws_out_dir',
'tmp_dir': 'local_loc_dir',
'tmp_gcs_bucket': 'gcp_loc_dir',
'tmp_s3_bucket': 'aws_loc_dir',
'ip': 'h... |
fed42d0984e10e1f190a1776cf7e8be780c457851e560dd018835787dd86a363 | Python | 528 | 17 | """
A setup.py script to use setuptools, which gives wheel and egg goodness, etc.
"""
try:
from setuptools import setup
except ImportError:
# SimpleITK no longer provides ez_setup, but a copy may be around
# so we give it a try. It's intended that setuptools be install in
# a constructed virtualenv duri... |
0402157e14d2bbc10b72a8f230bf4d136733d605f5886dc4f361acaa39c99a14 | Python | 530 | 18 | from .image_preprocessing.feature_extractor import extract_feature
from .image_preprocessing.image_tiling import tiling
from .preprocessing.filter_cells import filter_cells
from .preprocessing.filter_genes import filter_genes
from .preprocessing.graph import neighbors
from .preprocessing.log_scale import log1p, scale
f... |
7e58bf31e23b453f1eb147223c5fb188927d8799cc54fe62ab7eb4e257a5123f | Python | 530 | 23 | # -*- coding: utf-8 -*-
# @Author : Yue Liu
# @Email : yueliu19990731@163.com
# @Time : 2022/9/21 0:49
import torch
import random
import numpy as np
def setup_seed(seed):
"""
fix the random seed
:param seed: the random seed
"""
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
tor... |
ac9f22345236e5dd1c95d0bd43fcf0f3276a458540282ed411561ed5f17f9718 | Python | 530 | 25 | #!/usr/bin/env python3
import os
import re
import sys
pattern = re.compile(r'-cp([^-]*)-cp[^-]*-([^_]*)[0-9_]*_([^.]*)')
vers = set()
plats = set()
arches = set()
for fname in sys.argv[1:]:
m = pattern.search(fname)
vers.add(int(m[1]))
plats.add(m[2])
arches.add(m[3])
plat = '-'.join(sorted(plats))
... |
2600639efa4748bbb5a2397499d7e5dd88b20909b5646eff7908c22b6a244195 | Python | 531 | 19 | """
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
... |
e1243751bf3e47db86e6a4aaf065a676168538aba672912d4f43ee5cdfdbae83 | Python | 531 | 13 | """NA (Non-Available) values in R."""
# TODO: Indicate the Python version(s) supported that require
# `import __future__ import annotations`.
from __future__ import annotations
import typing
if typing.TYPE_CHECKING:
from rpy2.rinterface_lib import sexp
NA_Character: typing.Optional[sexp.NACharacterType] = None
NA_... |
147202f8508a5cc1008fe5544fc94900400f9d35d081331060f5a94cea834ed3 | Python | 532 | 18 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from .build import build_model, MODEL_REGISTRY # noqa
from .contrastive import ContrastiveModel # noqa
from .masked import MaskMViT # noqa
from .video_model_builder import MViT, ResNet, SlowFast # noqa
try:
from .pt... |
829eb795cc69146228852f045d6ef2b685e02ade6be29857ffb29b9e28cedd15 | Python | 532 | 21 | import sqlite3
from .db import DB
class ComorbiditiesFatalityCount(DB):
def __init__(self):
super().__init__()
self.table_name = 'TG_comorbidities_fatalities'
self.table_desc = 'Telangana percentage of deaths due to COVID-19 or comorbidities'
self.cols = self.getcolumns()
de... |
c62798955b5945afbc4fa2e27ec623945d5325bed93ab823021ab2d23043361c | Python | 532 | 20 | import os
import sys
import matplotlib.pyplot as plt
import glob
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.p... |
04a234459b2b5bf0a9a6076307aa95aa2065593cad4c90078593a7be2a3cd5b6 | Python | 533 | 22 | 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... |
3d7217e3d9b53f2cd749d4daa5a6e000b44c4d995dbcf1aa7a488bb11143c751 | Python | 533 | 19 | """Utilities related to managing randomness."""
import numpy as np
from specparam.sim.gen import gen_freqs as create_freqs
###################################################################################################
##############################################################################################... |
499008e68b541635be28d7ff1cdbc363b83f9a314070f4cd8394887018d4e163 | Python | 533 | 21 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Top-level package for scikit-network"""
__author__ = """scikit-network team"""
__email__ = "thomas.bonald@telecom-paris.fr"
__version__ = '0.33.0'
import sknetwork.topology
import sknetwork.path
import sknetwork.classification
import sknetwork.clustering
import sknetw... |
6b0043636c1688ee342f97840f71fc2b504cf2ab47cfb69046fd69dcf7122bde | Python | 533 | 9 | """Module of linear algebra."""
from sknetwork.linalg.basics import safe_sparse_dot
from sknetwork.linalg.eig_solver import EigSolver, LanczosEig
from sknetwork.linalg.laplacian import get_laplacian
from sknetwork.linalg.normalizer import diagonal_pseudo_inverse, get_norms, normalize
from sknetwork.linalg.operators imp... |
a95fe77f32ab79d8c4b4ffbebc5a57d66fe27e2aa46fecc7ba69d6106382864e | Python | 533 | 20 | import os
import sys
import matplotlib.pyplot as plt
import glob
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.p... |
2cedccbd828f13c74dd66f8a92b0511c2ebc645a0fbc0fef23c5e0a7bbefeb32 | Python | 534 | 18 | from distutils import log
import distutils.command.register as orig
class register(orig.register):
__doc__ = orig.register.__doc__
def run(self):
try:
# Make sure that we are using valid current name/version info
self.run_command('egg_info')
orig.register.run(self)... |
3516b653980340f56e20378e2427a6fc6ff81f42b71df9c9e6c6409bfdedcc6c | Python | 534 | 18 | """Utilities for Bdpy dataformat."""
from typing import List, Union
from bdpy.dataform import Features
import numpy as np
def get_multi_features(features: List[Features], layer: str, labels: Union[List[str], np.ndarray]) -> np.ndarray:
"""Load features from multiple Features."""
y_list = []
for label in... |
4f65b6716c1c51d85f03ce95b99019aa4b1bae072de218b2a741ee8b31272e0e | Python | 534 | 8 | """Module on topology."""
from sknetwork.topology.cliques import count_cliques
from sknetwork.topology.core import get_core_decomposition
from sknetwork.topology.triangles import count_triangles, get_clustering_coefficient
from sknetwork.topology.structure import is_connected, is_bipartite, is_symmetric, get_connected_... |
c1a36cde5788e0d1bb23527950f4bbd1ece3d27afaadb5544372ff9651c45f0d | Python | 534 | 17 | import SimpleITK as sitk
import sys
# Instantiate SimpleElastix
elastixImageFilter = sitk.ElastixImageFilter()
# Read Input
elastixImageFilter.SetFixedImage(sitk.ReadImage(str(sys.argv[1])))
elastixImageFilter.SetMovingImage(sitk.ReadImage(str(sys.argv[2])))
elastixImageFilter.SetParameterMap(sitk.ReadParameterFile(s... |
61063ceee28446f3879a040fc18e63c2c86f3dd3f6c5e4d8384bbae45af29bc4 | Python | 535 | 22 | from sys import argv
from msp import MSP, setup_as_am
from msp_gtex import setup_as_gtex, change_adaptive_sparsity_speed_for_gtex
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
setup_as_am(msp)
tissue_groups = setup_as_gtex(msp, "main_tissue_groups_v1", "MarginalPsiV3")
msp.architecture.update(
type="Mu... |
859d19f7e0e8f2eaa292d053faac9fe845b129c2e8ba56d6cc8bb9782c89f0e6 | Python | 535 | 21 | import pytest
from PIL import Image
from lightly.transforms.mmcr_transform import MMCRTransform
def test_raise_value_error() -> None:
with pytest.raises(ValueError):
MMCRTransform(k=0)
def test_num_views() -> None:
multi_view_transform = MMCRTransform(k=3)
assert len(multi_view_transform.transf... |
6b5fbef2f86dced5849681d5b5b338dc564b09fac5a380442e076c82d584f25b | Python | 536 | 18 | # biomedisa/__main__.py
import sys
def main():
if len(sys.argv) < 2 or sys.argv[1] in ['-h','--help']:
print("Usage: python3 -m biomedisa.<module_name> <args>")
print("Modules available: interpolation, deeplearning, mesh")
print("[-h, --help] for more information of each module")
p... |
d025de2a554b39d3a4bf4f54cf8d5411dae5d91df4398ef3c3970ac9c6dc2d82 | Python | 536 | 22 | from sys import argv
from msp import MSP, setup_as_am
from msp_gtex import setup_as_gtex, change_adaptive_sparsity_speed_for_gtex
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
setup_as_am(msp)
tissue_groups = setup_as_gtex(msp, "main_tissue_groups_v1", "MarginalPsiV3")
msp.architecture.update(
type="Mu... |
de6c3144c0e4e50e4ed6b49738445b4035e116ac032618548ad7cc5bfaa9502a | Python | 536 | 28 | """
Compatibility Support for Python 2.7 and earlier
"""
import platform
from setuptools.extern import six
def get_all_headers(message, key):
"""
Given an HTTPMessage, return all headers matching a given key.
"""
return message.get_all(key)
if six.PY2:
def get_all_headers(message, key):
... |
0cdbc943fe3fa7e25c5e6fc6c2a6ae4363a29c0465458425bf363482fb30b693 | Python | 537 | 16 | #!/usr/bin/env python
from setuptools import setup, find_packages
from os import path
here = path.abspath(path.dirname(__file__))
setup(
name='cadena_ploscb19',
version='0.0.0',
description='Deep learning models for V1 neural system identification',
author='Santiago Cadena',
author_email='santiago... |
562ab3005e1fcfa90ee4879cd817ba94726baba4ea20a6ab29ad7ceb0d87876e | Python | 537 | 21 | import torch
from abc import ABC, abstractmethod
class AtomisticNN(ABC):
"""
Base class for atomistic neural network: taking as input a conformation
and returning values for each atom of the molecule
:param readout: Readout function to perform on the list of individual
atomic values
:t... |
cf40dc68d7ba3ad1a73d5338ce033b861b464025770a26b75154cd493f32d8a8 | Python | 538 | 16 | from torch import nn
import torch
class MultiTaskLoss(nn.Module):
def __init__(self, sigma_age=1, sigma_sex=1):
super().__init__()
self.sigma = nn.Parameter(torch.tensor([sigma_age, sigma_sex]))
self.mse = nn.MSELoss()
self.bce = nn.BCEWithLogitsLoss()
def forward(self, age_ha... |
684ec955e98d510f7e89a8f4b15be58001873f48652355f71bd48fb3c2025aad | Python | 539 | 21 | from .manager import ConfiguredFileSourceTemplates
from .models import (
FileSourceConfiguration,
FileSourceTemplate,
FileSourceTemplateSummaries,
FileSourceTemplateType,
get_oauth2_config,
get_oauth2_config_or_none,
template_to_configuration,
)
__all__ = (
"ConfiguredFileSourceTemplate... |
70025848a21a371056d7719645f5d89262b9d3e759f1078f08be0a2671dc46ac | Python | 539 | 14 | """Checks on the protobuf backend pyrosm reads and writes PBF data with.
pyrosm relies on Google's protobuf. The pure-Python implementation is an order
of magnitude slower. This test verifies that the fast (C/upb) backend is in use.
"""
def test_protobuf_fast_backend_is_active():
from google.protobuf.internal im... |
9792d6e00394076e3f6caeb6dc1f5611af6174b62a444daec7b1f04bb3bf73b8 | Python | 539 | 23 | # Generated by Django 3.2.6 on 2023-02-22 17:11
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0099_auto_20230222_1804'),
]
operations = [
migrations.RenameField(
model_name='tomographicdata',
old_name=... |
c94e7ceae0d049abc7f2f86daed8d355eec5ca79e7d5c1ce6eb0bb691fea04bf | Python | 539 | 24 | import sqlite3
from .db import DB
class Testing(DB):
def __init__(self):
super().__init__()
self.table_name = 'MP_testing'
self.table_desc = 'Advanced testing reports.'
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
'date': 'DATE NOT NULL',
... |
04166f22b795f25505184b7eb402ee42a148e159cb76fc13fd606f824c0ca673 | Python | 540 | 16 | from sys import argv
from msp import MSP, rbnsp_split_90
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 4
msp.architecture["motif_model_spec"] = dict(
type="PSAMMotifModel",
motif_spec=dict(type="rbns"),
exclude_names=("3P", "5P") + tuple(x for x in rbnsp_split_90[... |
c1ab3f8aefa26783e314ca6ecba87b408a04295130d13f1563334f046e2ce0f0 | Python | 540 | 16 | from sys import argv
from msp import MSP, rbnsp_split_90
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 4
msp.architecture["motif_model_spec"] = dict(
type="PSAMMotifModel",
motif_spec=dict(type="rbns"),
exclude_names=("3P", "5P") + tuple(x for x in rbnsp_split_90[... |
f06620136a59e95770c95eaca5f44b9a5aba02916423b1a6054f9a467ff774c4 | Python | 540 | 16 | from sys import argv
from msp import MSP, rbnsp_split_90
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 4
msp.architecture["motif_model_spec"] = dict(
type="PSAMMotifModel",
motif_spec=dict(type="rbns"),
exclude_names=("3P", "5P") + tuple(x for x in rbnsp_split_90[... |
2c354a8beebd770d09d4c5f14e23aae4cb96775edb5a16f2b9e7e92ec8110cb0 | Python | 541 | 26 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.lr = float(msp.lr) * 0.9 ** 16
msp.architecture = dict(
type="DroppedMotifFromModel",
original_model_path="model/msp-173a1_1",
original_model_step=1301680,
dropped_motifs=[],
)
msp.train_spec = dict(
... |
49d53b237f3f9a6a2f983b7b31263085c1b23c2985f77fa643a5f43c16f3b46a | Python | 541 | 14 | # EI inhibition increase
# going below 0.095 causes runaway activity
from brian2 import mV, ms
from pypet import cartesian_product
input_dict = {'c_gei': [0.095, 0.0955, 0.096, 0.0965, 0.097, 0.0975, 0.098, 0.0985, 0.099, 0.0995, 0.1, 0.2, 0.3, 0.4,
0.5, 0.6, 0.7, 0.8, 0.9, 1. , 1.1, 1.2, 1.3, ... |
4a30c09c63b5900664b1746d60317bf229e132a0ea90506b0cac3107eb473f69 | Python | 541 | 18 | import numpy as np
from sklearn.metrics import roc_auc_score, average_precision_score
def calculate_auroc(y_true, y_score):
vals = []
for class_index in range(y_true.shape[-1]):
vals.append(roc_auc_score(y_true[:, class_index], y_score[:, class_index]))
return np.array(vals)
def calculate_aupr(y... |
f16034c0f54fc7259007878a923f2c984f54bf5a50dcd14a616e21750cef4f22 | Python | 541 | 26 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.lr = float(msp.lr) * 0.9 ** 16
msp.architecture = dict(
type="DroppedMotifFromModel",
original_model_path="model/msp-174a1_1",
original_model_step=1301680,
dropped_motifs=[],
)
msp.train_spec = dict(
... |
05b35d3dfa1fd401f19b14e03a7f39fe8f594b03a8344f97f7a892aa73deb689 | Python | 542 | 26 | from setuptools import setup
import json
with open('metadata.json', encoding='utf-8') as fp:
metadata = json.load(fp)
setup(
name='lexibank_asjp',
description=metadata['title'],
license=metadata.get('license', ''),
url=metadata.get('url', ''),
py_modules=['lexibank_asjp'],
include_packag... |
0a7724e7e9c2590716327c2964ee372917a1809a011df5a37c05200babc51c01 | Python | 542 | 26 | import pytest
import rpy2.rinterface as rinterface
rinterface.initr()
def test_new_invalid():
x = 1
with pytest.raises(TypeError):
rinterface.SexpSymbol(x)
def test_new_missing():
with pytest.raises(TypeError):
rinterface.SexpSymbol()
def test_new_fromstring():
symbol = rinterface... |
3557128131bdfc6c2b3d69e70b6a25a8416275d3f06f6c3e7b912760f99c8ed1 | Python | 542 | 22 | """
demonstrate file comment access
"""
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
import numpy as np
import matplotl... |
4681c6be88be009f9f9955cdc8145800ccc60e1a6762b3465dfb2fdaed3e633d | Python | 542 | 23 | import sqlite3
from .db import DB
class ContainmentTable(DB):
def __init__(self):
super().__init__()
self.table_name = 'DL_containment'
self.table_desc = 'Delhi state containment zones'
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
'date':... |
90aaedf4fc695e39282c3a73726289d50461d03e1f055d54649cff7905db2ae3 | Python | 542 | 18 | 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.architecture["propagate_sparsity_spec"] = dict(type="NoSparsityPropagation")
... |
ff302ec80ea135d0c61e1478dbe538a3164ab06f568edd0246488b32ed2e0d98 | Python | 542 | 14 | from .integrate_and_fire import DenseLIF, LIF_Activation, DenseLIFNoSpike, GetEnd
from .preprocessing import IntensityToPoissonSpiking, IntensityToSpikeLatency, IntensityTile
from tensorflow.keras.utils import get_custom_objects
get_custom_objects().update({
"DenseLIF": DenseLIF,
"IntensityToPoissonSpiking": ... |
0a2312c99ce6162fe42cc46b490e83a7825d30618a237ba64e65892e932504cb | Python | 543 | 26 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.lr = float(msp.lr) * 0.9 ** 16
msp.architecture = dict(
type="DroppedMotifFromModel",
original_model_path="model/msp-174a1_1",
original_model_step=1301680,
dropped_motifs=[],
)
msp.train_spec = dict(
... |
45f7138aa844f583353fcfa5bdf7deaa9bc7edf1d887b4847bae03c17e74887f | Python | 543 | 20 | 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... |
49a37804bec772ea5212877ba696b5983731c34ee3762165af0234dbc1f01b16 | Python | 543 | 26 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.lr = float(msp.lr) * 0.9 ** 16
msp.architecture = dict(
type="DroppedMotifFromModel",
original_model_path="model/msp-173a1_1",
original_model_step=1301680,
dropped_motifs=[],
)
msp.train_spec = dict(
... |
8e3ae1cf87dbdc6540afb74b314fab6e4e032e074d68971f3357a86a913539a8 | Python | 543 | 21 | """
demonstrate datetime objects
"""
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
import numpy as np
import matplotlib.... |
a3e0c1ea6760936a18e9ceaef0924c788e74a6374377aa9cc14aec2399796e6d | Python | 543 | 17 | from setuptools import setup, find_packages
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='bioseq2seq',
description='An implementation of seq2seq for RNA translatio... |
218cdc36ecdd2b7e6971f1fe079e2d9b86217edca068144de00af005d450c428 | Python | 544 | 22 | # Generated by Django 3.2.6 on 2022-05-31 07:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0090_upload_validation_freq'),
]
operations = [
migrations.RemoveField(
model_name='upload',
name='... |
4bb2503eda32d89daaab24ac75ddaa3ab22bc3695867b61a123cfe1ba0a862b2 | Python | 544 | 20 | from glob import glob
from nitorch import io
import torch
import os
root = '.'
affdirs = list(filter(os.path.isdir, sorted(glob(root + '/mri2oct/affine*'))))
foct = io.map(root + '/oct/vessels.manual.nii.gz')
oct = foct.data(dtype=torch.uint8)
oct *= 2
for affdir in affdirs:
print(affdir)
fmri = io.map(affd... |
9bde09c57d3a1e62b97fed3e5743d34d36f5300c74715cefc5d69dbda07d5eb7 | Python | 544 | 23 | import sqlite3
from .db import DB
class DailyTestingInformation(DB):
def __init__(self):
super().__init__()
self.table_name = 'TG_testing_info'
self.table_desc = 'Telangana daily testing information'
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
... |
8b3e73729aab44efa77dc9aa10928e2d95d7d5de0f08993e3ba7d2f648c1a435 | Python | 545 | 19 | 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.... |
da267abfb6af0eed242d4e5496531b0cd8284f3b1dc0ac6652075a42f3b321f5 | Python | 545 | 18 | 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.architecture["propagate_sparsity_spec"] = dict(type="NoSparsityPropagation")
... |
1f82ace5328c25dd6813d5df8dc5714aaf980ebbb52c9434303019b5c111bcd2 | Python | 546 | 21 | import pytest
from rpy2.robjects.packages import PackageNotInstalledError
from rpy2.robjects.vectors import DataFrame
try:
import rpy2.robjects.lib.ggplot2
has_ggplot2 = True
msg = ''
from rpy2.ipython import ggplot
except PackageNotInstalledError as error:
has_ggplot2 = False
msg = str(error)
... |
ea7eb0ec1bc4640f85d7e67a729a7ba6a9657a2cc2fd973d390be1ea238834c2 | Python | 546 | 23 | # Generated by Django 3.0.4 on 2020-03-25 10:25
import biomedisa_app.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0070_auto_20200325_1059'),
]
operations = [
migrations.RemoveField(
model_name='mus... |
13aec6f1d4ed1c2ca39e1503498f88380ae76cb187d53472ea6efbbf53ad5fdd | Python | 547 | 20 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._axis import Axis
from ._bar import Bar
from ._step import Step
from ._threshold import Threshold
from . import axis
from . import bar
from . import step
from . import threshold
else:
from _plotly_utils.importers im... |
34d4f4ecba1b43cc603898b4d4c2232fdec920dc5adb4cd18c09b8263b2f62b4 | Python | 547 | 19 | # add sys.path.append(os.path.join(os.getcwd(), 'brian_models/ripples_2populations_v2')) for imports to work
import os
import datetime
from explored_params import explore_dict, name
from model_run import main
# make a new subfolder inside /runs folder
current_dir = os.getcwd()
parent_dir = os.path.join(current_dir, 'r... |
7406e320b7188738ac015ce8f74b0458eba775a8da20cde87f89e4ec3a14145b | Python | 547 | 19 | 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.... |
a4c54526c05808f3a8c7c2c048a92b7d7f61be1503877adf12634828b182ad56 | Python | 547 | 30 | __author__ = 'quentin'
from ethoscope.tracking.cameras import *
from ethoscope.tracking.trackers import AdaptiveBGModel
import cv2
from ethoscope.tracking.roi_builders import DefaultROIBuilder
# we start from a cropped video:
cam = MovieVirtualCamera("/stk/pysolo_video_samples/singleDamTube1_150min_night.avi")
... |
b469efba9e746952302eb358d4fa7418507121a1830e6b2874eb390a00b8b05a | Python | 547 | 19 | 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.... |
7ed3f2cadf558319ee1ff56942cc4a514afae113d5eaf7c868dd794db1fb310e | Python | 548 | 20 | 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... |
a0a08e337d2236bef34c88c57775f3d02ac39b3d4df34de335ae150828344ed7 | Python | 549 | 21 | # Generated by Django 3.0.4 on 2020-03-21 12:06
from django.db import migrations, models
#import djgeojson.fields
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0053_auto_20200227_1151'),
]
operations = [
migrations.CreateModel(
name='MushroomSpot... |
b37ee6b8235acc380fec5db804f8cc14bab4d8714864f4456523565a050a13e3 | Python | 549 | 13 | """
.. include:: ../readme.md
"""
from .auggam.auggam import AugGAMClassifier, AugGAMRegressor
from .augtree.augtree import AugTreeClassifier, AugTreeRegressor
from .linear_finetune import LinearFinetuneClassifier, LinearFinetuneRegressor
from .linear_ngram import LinearNgramClassifier, LinearNgramRegressor
from .d3.d... |
bd0cbf56fed959416876ede3297d353846d03ae164baabb7124be0e0ae096615 | Python | 549 | 19 | #!/usr/bin/env python
import argparse
import os
from vpolo.alevin import parser as par
parser = argparse.ArgumentParser()
parser.add_argument("--mtx", "-m", action="store_true", help="--dumpMtx flag set")
parser.add_argument("--umi", "-u", action="store_true", help="--dumpUmiGraph flag set")
args = parser.parse_args(... |
ca126f1f1969dc26c255ff1ca22a4355dd568886950efd45d4dad2ad4e921c68 | Python | 550 | 19 | import unittest
from PIL import Image
from lightly.transforms.multi_view_transform import MultiViewTransform
from lightly.transforms.torchvision_v2_compatibility import torchvision_transforms as T
def test_multi_view_on_pil_image() -> None:
multi_view_transform = MultiViewTransform(
[
T.Rand... |
1284bba8cd152068b49b6a72bb2061b90d0d6e9109cc37d94e1a42f22352e373 | Python | 551 | 23 | import os
import numpy as np
import scanpy as sc
from PIL import Image
def path_for_tests():
return os.path.dirname(os.path.realpath(__file__))
def path_for_test_data():
return f"{path_for_tests()}/test_data"
def read_test_data():
"""Reads in test data to run unit tests."""
adata = sc.read_h5ad(f... |
4d0a6e0c2c0a7df985713dcb43129e7553006a98e32d949647464a93bac6e7ed | Python | 551 | 24 | #!/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 mpirun and default paramters.
# This generates spk output files under /tmp/
num_mpi_ranks = 4
seconds = 0.1
filenames = [ "/tmp/... |
661f4860719fa83a8894bc9cb9c2f3a996c7bd8994f8807e274dfe8e58a43dc2 | Python | 551 | 19 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for k-core decomposition"""
import unittest
from sknetwork.data.test_graphs import *
from sknetwork.topology.core import get_core_decomposition
class TestCoreDecomposition(unittest.TestCase):
def test_empty(self):
adjacency = test_graph_empty()
... |
be5da0c1b6f780b99dd854dbb1cdfec8a67c44ff775e19df7ffb087fa0505611 | Python | 551 | 32 | __author__ = 'quentin'
import numpy as np
import cv2
im = np.zeros((1080,1920),np.uint8)
s = 180
for i in range(1,s):
# x=im.shape[1]
w=32
h=64
y=(i * im.shape[0]) / s
x=(i * im.shape[1]) / s
angle=i*3
if w < h:
angle -= 90
w,h = h,w
angle = angle % 180
print... |
f52635e05819bb1790eff55c088c38a7423a051fd24ada6c6db0df15b63d0ccf | Python | 551 | 18 | import unittest
#import sys
#sys.path.append("/fh/scratch/delete90/sun_w/si_liu/aTCR/DePTH_package_prepare/src")
class TestImport(unittest.TestCase):
def test_import_version(self):
import DePTH
self.assertTrue(isinstance(DePTH.__version__, str))
self.assertNotEqual(len(DePTH.__version__), 0... |
0494308bc4d9f5894b3cb7d24bf482dd4a56a1b26ef0a4d0cdc72ffe3ed7ab42 | Python | 552 | 16 | """Service layer for handling telemetry data in the CarbonServer API."""
from uuid import UUID
from carbonserver.api.infra.repositories.repository_telemetry import (
SqlAlchemyRepository as TelemetrySqlRepository,
)
from carbonserver.api.schemas_telemetry import TelemetryCreate
class TelemetryService:
def _... |
2dbda5070682eadfae6e9ce93527903700f893e350c2e9fb6d82af29010d4462 | Python | 552 | 23 | #!/usr/bin/env python
import sys
out = open(sys.argv[4], "w+")
sep = sys.argv[3]
# un-sanitize Galaxy inputs
if sep == "X":
sep = ";"
with open(sys.argv[1]) as handle:
for line in handle:
cols = line.split("\t")
unfolding_column = int(sys.argv[2]) - 1
column_content = cols[unfolding_... |
9397f454734d1363373e8fad51e54dd36db668ca10060ff9504d92ad480d8149 | Python | 553 | 18 | 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.architecture["propagate_sparsity_spec"] = dict(type="NoSparsityPropagation")
... |
9d04ba99278d365894063821e9c0f04ff0bffc3ead53dfcbebc2dfd7c2dd5f2b | Python | 553 | 13 | import mne, numpy as np
edf = "data/figshare_stroke/edf_extracted/edffile/sub-01/eeg/sub-01_task-motor-imagery_eeg.edf"
raw = mne.io.read_raw_edf(edf, preload=True, verbose='ERROR')
v = raw.get_data(picks=[32])[0]
nz = np.nonzero(v)[0]
codes = np.round(v[nz] * 1e6).astype(int)
fs = raw.info['sfreq']
print("first 12 (co... |
54f5f26151da244e5eda850a877368963648e817ba8ec6793a55d91f14934479 | Python | 554 | 16 | import sys
import subprocess
path = "/Users/jacobfisher/Desktop/ai_s2018/src"
sys.path.insert(0, path)
subnum = eval(input("Subject number?"))
condition = eval(input("Condition?"))
log = "logs/%s_log.csv" % subnum
reactlog = "logs/%s_reactlog.csv" % subnum
condition_json = "condition%s.json" % condition
print(log)
... |
ea40e971344b6822b4bd8754c64ebe4f9f927db47dc94fee810b408e08db5e15 | Python | 555 | 14 | from keras.src.backend.common.name_scope import name_scope
from keras.src.backend.torch import distribution_lib
from keras.src.backend.torch import ops
from keras.src.backend.torch import random
from keras.src.backend.torch import rnn
from keras.src.backend.torch.ops.core import Variable
from keras.src.backend.torch.op... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.