sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b77bd22ee85082c55fbdc4f0dfd0b3ef3940b501a6f2249dd8e3be141d08847f | Python | 845 | 28 | # Generated by Django 3.0.3 on 2020-02-27 10:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0052_auto_20200227_1147'),
]
operations = [
migrations.AlterField(
model_name='upload',
name='epoch... |
01ee52022b4bafed576ca0d61cc5825d9433ca9e5dcaaf5b2cfb622c4ff875ca | Python | 846 | 30 | """Random wrapper."""
from __future__ import absolute_import
import random as pyrandom
import numpy as np
try:
import mxnet as mx
except ImportError:
mx = None
def seed(a=None):
"""Seed the generator for python builtin random, numpy.random, mxnet.random.
This method is to control random state for mxn... |
1bc86b0ddb59d86003b06693e1c0356f25063dc2411b6fd7904863f47213acb1 | Python | 846 | 33 | from imports import *
if __name__ == "__main__":
sweep = 0
channel = 0
# load ABF data with pyABF
abf = pyabf.ABF(PATH_DATA+"/model_vc_step.abf")
abf.setSweep(sweep, channel)
# load ABF data which was converted to ATF
atfFname = abf.abfFilePath.replace(".abf",".atf")
assert (os.path.... |
41796c18310d58960e53edbd44405c71af08f4077da951f8a321a82d81154162 | Python | 846 | 30 | from sys import argv
from msp import MSP
CL_VALUES = list(range(0, 1 + 20, 2))
for splicepoint_type in "donor", "acceptor":
for left in CL_VALUES:
for right in CL_VALUES:
print(f"{splicepoint_type} {left} {right}")
msp = MSP()
msp.file = __file__
msp.seed = ... |
68ce4ae54b808ea0edcca55ac87a71a5cef2ad63dcd945bee54c2abd0f29ad69 | Python | 846 | 21 | # -----------------------------------------------------------------------------
# Copyright (c) 2019, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this softw... |
4d73fa488bcfa0c3b55a3ea19da906f5f6d29e1882a362d71050f81be58da7cc | Python | 847 | 34 | import numpy as np
from abc import ABC, abstractmethod
from pathlib import Path
from Loader.src.utils import load_nii, load_z_spectra, get_files
class Loader(ABC):
def __init__(self, path: Path):
path = Path(path)
file_mode = True if path.is_file() else False
if file_mode:
s... |
8434d4150272889ea61c44de5a0b9320facccd025b287e9b5b7a30a6c930dde8 | Python | 847 | 34 | """Implement fields needed for a workflow readme & help.
Revision ID: 71eeb8d91f92
Revises: a4c3ef999ab5
Create Date: 2025-02-11 11:57:14.477337
"""
import sqlalchemy as sa
from galaxy.model.migrations.util import (
add_column,
drop_column,
)
workflow_table_name = "workflow"
# revision identifiers, used b... |
66d846095439951b39c51e6c35066d9c196677697023225a545e3ed255fa181a | Python | 848 | 34 | """
Created on 16/07/2014
@author: Andrew Robinson
"""
import logging
from . import AuthProvider
log = logging.getLogger(__name__)
class LocalDB(AuthProvider):
"""Authenticate users against the local Galaxy database (as per usual)."""
plugin_type = "localdb"
def authenticate(self, email, username, p... |
75545db3edcff09567c1f029df67c689fdf386871f3cad29dab81c630256b144 | Python | 849 | 29 | # -*- coding: utf-8 -*-
# tests for test_graphs.py
"""
@author: Quentin Lutz <qlutz@enst.fr>
@author: Nathan de Lara <nathan.delara@polytechnique.org>
@author: Thomas Bonald <tbonald@enst.fr>
"""
import unittest
from sknetwork.data.test_graphs import *
class TestTestGraphs(unittest.TestCase):
def test_undirecte... |
77a548ba3b7d3bf56268c7e95544a89ab364b7dadb66f1972277a71c1e84b6f5 | Python | 849 | 29 | import os
from shutil import copy
def check_dir_exists(path):
if not os.path.exists(path):
os.mkdir(path)
def split_by_name(dir_path, real_save_path, fake_save_path):
check_dir_exists(real_save_path)
check_dir_exists(fake_save_path)
if not os.path.exists(real_save_path):
os.mkdir(real... |
ac6b314865b7517df5d5dec0924cd91ef62f8dc6c0534e0f17dfbcad61598517 | Python | 849 | 28 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._hoverlabel import Hoverlabel
from ._legendgrouptitle import Legendgrouptitle
from ._marker import Marker
from ._selected import Selected
from ._unselected import Unselected
from . import hoverlabel
from . import legendgrou... |
225826de19c11919f7c23da92bc0470d41b18e74b4fcd0bd085d96502e149889 | Python | 850 | 31 | """The global configs registry"""
from .action_recognition import _C as _C_action_recognition
from .coot import _C as _C_coot
from .directpose import _C as _C_directpose
__all__ = ['get_cfg_defaults']
_CONFIG_REG = {
"action_recognition": _C_action_recognition,
"coot": _C_coot,
"directpose": _C_directpose... |
9b4272ab9f64ded6a88a4c81c5c64620bcc6edd590577486138e4c3e6d113daa | Python | 850 | 24 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for label propagation"""
import unittest
from sknetwork.classification import Propagation
from sknetwork.data.test_graphs import *
class TestLabelPropagation(unittest.TestCase):
def test_algo(self):
for adjacency in [test_graph(), test_digraph(), ... |
dea59ec2599ba372bd6b862023b011f4588f35204e431670b79bb99ea5c05f60 | Python | 850 | 28 | import numpy as np
from numpy.typing import NDArray
from typing import List, Literal, Optional, Union, cast
def binarize_values(
values: NDArray[Union[float, int]],
upper_threshold: float,
lower_threshold: Optional[float] = None
) -> NDArray[Union[float, int]]:
"""
Function to binarize values base... |
769e5c97bc40c9f270d1b696970e14e1960085a7f139fca1bbf62514aaa57e58 | Python | 851 | 48 | # -*- coding: utf-8 -*-
"""
Created on 06/03/2017
@author: rh04
arg1 = path
e.g. Z:\DWI\Subject1\Rep1\
arg2 = name of DWI volume
e.g. DWI_brain
"""
import nibabel as nib
import numpy as np
from pca_utils import pca_denoising
from sys import argv
script, arg1, arg2 = argv
# load data
print 'loading ...'
print arg... |
79386bd74e66c4f36892768fa125c0ddbceabe28ee780656c095416ee8bf411c | Python | 851 | 34 | import numpy as np
# import random
# from fun_dh import fun_dh
def fun_ddh(x):
# second order derivative of h(x), where
# h(x) = exp(-1/t^2) for x>0 and 0 otherwise.
# the second order derivative should be
# ddh(x) = (4t^{-6}-6t^{-4})exp(-1/t^2) for x>0 and 0 otherwise.
... |
0645d9acadbe12628c888c5d10cc3100f421aa3aedc176c748c4a1413607d398 | Python | 852 | 34 | import napari
import pytest
from stardist import data
from stardist_napari import make_dock_widget, make_dock_widget_function
@pytest.fixture(scope="function")
def plugin():
return make_dock_widget()
@pytest.fixture(scope="function")
def call_plugin():
return make_dock_widget_function()
@pytest.fixture(s... |
8801d58a986c08bc74e28ccc29d2dc1d4ed7618938ccc59641b7a7dbae497f1c | Python | 852 | 28 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._colorbar import ColorBar
from ._hoverlabel import Hoverlabel
from ._legendgrouptitle import Legendgrouptitle
from ._lighting import Lighting
from ._lightposition import Lightposition
from ._starts import Starts
from . impo... |
1e734db7ef4ef43abd08e1f1831b46e8df7939f63e80b525cf198b9425adf64f | Python | 853 | 34 | """Tests for specparam.results.utils."""
from specparam.results.utils import *
###################################################################################################
###################################################################################################
# Test func for parallel tests
def inc... |
434ae919414bee518fe52cc549ac1c0531163b881cdd4d5948b459f3ea94af81 | Python | 853 | 38 | import pandas as pd
from irnlm.utils import write
df = pd.read_excel('data/lexique_database_french.xlsx')
def filter_words(row):
if ('ART' in row) or ('PRO' in row) or ('PRE' in row) or ('CON' in row):
return True
else:
return False
words = df['cgramortho'].apply(filter_words)
path = 'data/f... |
aa7aadbe982fd93e66dccb73c7a9116707c361c2a8027c87b37ed48883ac3b59 | Python | 853 | 33 | import pandas as pd
import numpy as np
import sys
# setting path
sys.path.append('../TM2_segmentation')
input_annotation_file = 'data/pop_norms.csv'
df = pd.read_csv(input_annotation_file, header=0)
df = df.sample(frac=1).reset_index(drop=True)
N = 50
counts_per_age =[[] for x in range(35-4+1)]
for idx in rang... |
e74fa1af51461dbe0c9facf8edb99bd90383493b8ec3d85049543e9932e6cef1 | Python | 853 | 31 | import subprocess, sys
PACKAGES = [
"mne==1.7.0",
"scikit-learn==1.5.0",
"numpy==1.26.4",
"pandas==2.2.2",
"scipy==1.13.0",
"matplotlib==3.9.0",
"tensorflow==2.16.1",
"simpy==4.1.1",
"PyQt5==5.15.10",
"markdown==3.6",
"weasyprint==62.3",
"tqdm==4.66.4",
]
if __name__ ... |
c7ca9880c92a288ef9d3feaa25192d671840873dd4d28f98668048ae87a1dee2 | Python | 854 | 32 | import io
import os
from setuptools import find_packages, setup
MAJOR = "0"
MINOR = "0.1"
if os.path.exists("../major.version"):
with open("../major.version", "rt") as bf:
MAJOR = str(bf.read()).strip()
if os.path.exists("../minor.version"):
with open("../minor.version", "rt") as bf:
MINOR = ... |
1cba9520106b045d7eec3be0cfe408c8b3b0071cb6c541bac78476f602b17254 | Python | 856 | 30 | import os
from typing import List, Tuple, Set, Dict, Any
from itertools import product
from drug_interactions.reader.dal import DrugBank
from drug_interactions.reader.preprocessor import DrugPreprocessor
import numpy as np
from tqdm import tqdm
class DrugReader():
def __init__(self, path: str):
self.... |
27b3fbd9f6c70773191afe18a0f81d2613df6465faeca84c16694015dd32e68c | Python | 856 | 30 | from __future__ import annotations
from argparse import ArgumentParser
def main() -> None:
parser = ArgumentParser(description="Launch the Larvaworld gui_v2 desktop shell.")
parser.add_argument(
"--geometry",
default="1360x860",
help="Window geometry in WIDTHxHEIGHT form.",
)
... |
290fb393241a0fac9dce5eba5bffd314bb12c1356efb7e8ad6ab9e0cd0f0ad8a | Python | 856 | 28 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._colorbar import ColorBar
from ._contour import Contour
from ._hoverlabel import Hoverlabel
from ._legendgrouptitle import Legendgrouptitle
from ._lighting import Lighting
from ._lightposition import Lightposition
from . im... |
8c4bbc1adfcd87d196923146a0e80fdef22936801ceedf67fbbce13a84f3fef3 | Python | 856 | 19 | '''Extracts the distributions associated with TMD module'''
import numpy as np
import tmd
def persistent_homology_angles(pop, threshold=2, neurite_type='basals', feature='radial_distances'):
"""Adds the persistent homology extracted from
a population of apicals to the distr dictionary
Each tree in the po... |
87ebef7f02a677f080bb6b493c7500cd9f1436cb85850364910128e5aeab158b | Python | 857 | 23 | """Generate high-resolution gammatone spectrograms"""
from pathlib import Path
import eelbrain
# Define paths to data
DATA_ROOT = Path("~").expanduser() / 'Data' / 'Alice'
STIMULUS_DIR = DATA_ROOT / 'stimuli'
# Loop through the stimuli
for i in range(1, 13):
# Define a filename for the gammatone spectrogram cor... |
b940f641ab0bf0c0ebcc35f38951bf01bb4c34649d774e659df57e194564c0e5 | Python | 857 | 25 | import sqlite3
from .db import DB
class SeaportSurveillanceTable(DB):
def __init__(self):
self.table_name = "TN_seaport_surveillance"
self.table_desc = "Tamil Nadu seaport surveillance till the day before, table number 2 from the top on last page"
self.cols = self.getcolumns()
def getc... |
2a1fb82ce3bd5e7adaf0f13f113d1dca01bbeac155191126eac809cc2662e2fe | Python | 858 | 35 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture = dict(
type="PreprocessedSpliceAI",
preprocessor_spec=dict(type="Identity"),
spliceai_spec=dict(type="SpliceAIModule", output_size=3),
)
msp.data_dir = "../data/canonical_and_gtex_dataset/"
... |
bd1e4bba5a8309e6edc7470f0794c9d35446d0ac20f422f7b4ccfb8d0287043e | Python | 858 | 24 | # skip test: data unavailable
"""A script that creates test reports for an MneExperiment subclass
"""
from sample_experiment import SampleExperiment, ROOT
# create the experiment class instance
e = SampleExperiment(ROOT)
# Use this to send an email to e.owner when the reports are finished or the
# script raises an ... |
0c0c70613efcd99ce6e3e6fd49225dcf8f549c2de18e201f22116930d84b5d44 | Python | 859 | 36 | """deferred data tables
Revision ID: 6a67bf27e6a6
Revises: b182f655505f
Create Date: 2022-03-14 12:17:55.313830
"""
from sqlalchemy import (
Boolean,
Column,
)
from galaxy.model.migrations.util import (
add_column,
drop_column,
transaction,
)
# revision identifiers, used by Alembic.
revision = ... |
5abe9cae8c55e2cbed96f0f28dd86990f3dd17b041696a0b4ea63bbd6d9fee3d | Python | 859 | 29 | import pytest
import torch
from lightly.loss import NegativeCosineSimilarity
class TestNegativeCosineSimilarity:
@pytest.mark.parametrize("bsz", range(1, 20))
def test_forward_pass(self, bsz: int) -> None:
loss = NegativeCosineSimilarity()
x0 = torch.randn((bsz, 32))
x1 = torch.randn(... |
c1f949d3cbab9c58fda0dcf0f3706197c535eadf650977a1c08cba9110d45372 | Python | 859 | 30 | import sqlite3
from .db import DB
class PPEUnitTable(DB):
def __init__(self):
self.table_name = 'WB_equipment'
self.table_desc = 'West Bengal protective gear equipment details'
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
'date': 'DATE NOT NULL',
... |
d3c8231bc58f918ab9ccdc34a92e6477380a2510d560d11c84f9ce78b9d72209 | Python | 859 | 39 | from os.path import basename
import sys
import collections
def cal_RT(mutation_file):
d = collections.defaultdict(lambda :0)
#x = []
with open(mutation_file) as RT:
for line in RT:
line = line.strip('\n').split('\t')
if len(line) == 1:
continue
else:
chrID = line[0]
position = line[2]
re... |
eb44dc886e59d49ed2e216b0c58ce8d0decc844a67170e6f679e7ed2b850c0a3 | Python | 859 | 29 | """Regression tests for fastlog train-mode autograd retention."""
from __future__ import annotations
import torch
from torch import nn
import torchlens as tl
def test_train_mode_grad_flows_through_saved_tensor() -> None:
"""A loss built from a train-mode fastlog payload can backpropagate."""
model = nn.Se... |
f44f3d6c46b7197401e5d9931d80b353aa816b2a6d8beebb3cf645720758a3ed | Python | 859 | 24 | import sqlite3
from .db import DB
class IncomingPassengersTable(DB):
def __init__(self):
self.table_name = "TN_incoming_people_till_yesterday"
self.table_desc = "Tamil Nadu incoming people from various mode of transport, first table from the top on third last page of bulletin"
self.cols = s... |
3bbfd23773bd6cc39f91b3c9514caeb239e1cb72f65976c9290571b48fd337f1 | Python | 860 | 29 | 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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
570178336eebc6741e82ca3c6c0be7159275d90f9fadb956f16478422954bc5a | Python | 860 | 29 | 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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
92ab5438745f04cf28eb0b2d3a2dda35b013c38752ec292cac4045b24facac66 | Python | 860 | 10 | from cvnn.montecarlo import run_gaussian_dataset_montecarlo
run_gaussian_dataset_montecarlo(iterations=20, m=10000, n=128, param_list=None, validation_split=0.2,
epochs=150, batch_size=100, display_freq=1, optimizer='sgd',
shape_raw=[64], activation='cart... |
a1b1769fad2a7e147664cb421188219a566f700a8a70fee3550156a49053bef8 | Python | 860 | 34 | '''
swish.py
Usage: similar to torch.nn.ReLU()...and torch.autograd.Function
# Based on: Ceshine Lee
https://medium.com/the-artificial-impostor/more-memory-efficient-swish-activation-function-e07c22c12a76
# Author: Ty Nguyen
# Contact: tynguyen.tech@gmail.com
'''
import torch
import torch.nn as nn
class Swish_func(t... |
e10065e2a8b011c5b59aa6002e180221ef28653303423187110a8e8a312e2446 | Python | 860 | 29 | 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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
e204f1bbf3ec3684901222dd9fa17fb60f10c2693870eafbf29d42369652982d | Python | 860 | 37 | import torch
import os
cur_dir = os.path.dirname(os.path.abspath(__file__))
num_workers=16
cls_lr=0.0001
cls_step_size=10
cls_max_epoch=30
seg_lr=0.001
seg_step_size=25
seg_max_epoch=100
gamma=0.1
sampling_rate=0.2 # one sample per 0.5 sec # 0.2 sec in practice
buffer_size=1
seq_len = 8
patience = 3
thresh_binary ... |
0270cb866a06da56399b798abf14bf71bce43fd1aae010a71e28741057949c20 | Python | 861 | 31 | import numpy as np
import pytest
import gym
from gym.wrappers import RescaleAction
def test_rescale_action():
env = gym.make("CartPole-v1", disable_env_checker=True)
with pytest.raises(AssertionError):
env = RescaleAction(env, -1, 1)
del env
env = gym.make("Pendulum-v1", disable_env_checker=... |
59f4a3379be36d29170cf5c1394eaa06ccdd03571f1fde3d0314fd5f48137b9b | Python | 861 | 29 | from __future__ import annotations
from PySide6.QtWidgets import QFrame, QLabel, QVBoxLayout, QWidget
def section_card(title: str) -> tuple[QFrame, QVBoxLayout]:
frame = QFrame()
frame.setStyleSheet(
"background:#ffffff;border:1px solid #d1d5db;border-radius:8px;"
)
layout = QVBoxLayout(frame... |
a0c6263f43a9b31885a0e35be0778205470e626d882b87114aba3fd34b024a2d | Python | 861 | 40 | #!/usr/bin/env python
"""
Input: DNA Fasta File
Output: gezaehlte Codons ueber das gesamte File, nicht jedes einzelne ORF
Anika Erxleben
"""
import sys
import Bio.SeqUtils.CodonUsage as cu
"""
strepto_orf2dna_out_plus1: anika/Annotation/data/strepto_orf2dna_out_plus1
codon_count: anika/Annotation/data/codon_count2 o... |
e97782cc32f336fd5b986e84b513ca61b2ab16016b8cbabb91b9e1f30c475bdf | Python | 861 | 25 | import os
import tns
from tns import extract_input
def run():
# Extract distributions from cells in input directory
dir_path = os.path.dirname(os.path.realpath(__file__))
filename = os.path.join(dir_path, '../test_data/bio/')
distr = extract_input.distributions(filename, feature='path_distances', diamet... |
1cfceb0302b1fefda8041589250c8e5e8d8954c9485d2552f9e8b996441bb571 | Python | 862 | 22 | import numpy as np
from modular_splicing.dataset.additional_data import DatafileReferencingAdditionalData
class GeneLengthWeightingAdditionalData(DatafileReferencingAdditionalData):
def compute_additional_input(self, original_input, path, i, j):
raise RuntimeError("Not implemented")
def compute_addi... |
4b49482e2aa84467f75f7eae290a0e4fa220d83c1e5c8a215e0c5a3d49279d85 | Python | 862 | 44 | from __future__ import annotations
import threading
from pybind11_tests import thread as m
class Thread(threading.Thread):
def __init__(self, fn):
super().__init__()
self.fn = fn
self.e = None
def run(self):
try:
for i in range(10):
self.fn(i, i)
... |
61f261b508eb6121f21fd7c145ac92d21d5697a93a193bca10aefa1b6a44986c | Python | 862 | 34 | import time
import mujoco
from matplotlib import pyplot as plt
from angorapy import make_task
from mujoco import viewer
from PIL import Image
from angorapy.common.const import VISION_WH
import numpy as np
env = make_task("TestCaseManipulateBlock-v0", render_mode="rgb_array")
env.reset()
env.calc_rotation_set()
mo... |
cf9f6d5b3ebee9011de35b7e7857cf71f5ea45184724ff1e5634afcd01601eea | Python | 862 | 29 | 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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
dddc20c11e259783026a4dfcde15b7bbc4dc2e6ebc87d0de4d2825042d04ad22 | Python | 862 | 33 | import torch
import numpy as np
import random
def worker_init_fn(wid):
seed_sequence = np.random.SeedSequence(
[torch.initial_seed(), wid]
)
to_seed = spawn_get(seed_sequence, 2, dtype=int)
torch.random.manual_seed(to_seed)
np_seed = spawn_get(seed_sequence, 2, dtype=np.ndarray)
np.r... |
546e3e1056c04e3d9e51aeaf24fefc1c8cba8075b8e414ad83da51522b4426bc | Python | 863 | 40 | """Installable AutoTransOP package."""
from .config import (
DEFAULT_L1000_LANDMARKS,
DEFAULT_SEROLOGY,
AdversaryConfig,
AutoTransOPConfig,
DomainConfig,
DomainEffectConfig,
HeadConfig,
MLPConfig,
MutualInformationConfig,
PairRegularizerConfig,
PriorConfig,
TrainingConfi... |
c1169bf24d23c4c4768173350ac619f690372451c4ae9afe672a932761b42ebf | Python | 863 | 28 | import numpy as np
from .conf_ranker import ConfRanker
from rdkit.Chem.rdchem import Mol
from typing import List, Any, Sequence
class NoRankingRanker(ConfRanker):
"""Fake ranker that don't apply any ranking
:param name: Name of the ranker
:type name: str
:param ascending: Set to True to rank conforme... |
e81949899bc75096bdc1fc696b7c9a618350f67298eb83b6238f4e400719dcc3 | Python | 863 | 35 | """
This script tests files with external trigger tags
"""
import glob
import os
import sys
import matplotlib.pyplot as plt
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/")
DAT... |
ef2e9def5d7782cd3e37ca14cc857b672fef37d9231e558dfa8914a4a443cd38 | Python | 863 | 30 | import time
from ethoscope.hardware.interfaces.interfaces import BaseInterface
from ethoscope.stimulators.sleep_depriver_stimulators import SleepDepStimulator
from ethoscope.tests.integration_api_tests.old.utils import test_stimulator
class MockSDInterface(BaseInterface):
def send(self, channel, dt=350, margin=1... |
010b418cfccb9d7b83800d37dd50ff3b64defde04e7a5de61f0615e03caae960 | Python | 864 | 32 | import numpy as np
MAX_ = np.iinfo(np.uint16).max
def random_flip(img,y,prob=0.5):
make_flip = np.random.random(1)
if make_flip < prob:
random_axis = np.random.randint(0,2)
return ( np.flip(img, axis=random_axis) , np.flip(y, axis=random_axis) )
return img,y
def random_brightness(img, si... |
6b3e82a28f551c7ca5402aee284f1302760095e5ee009b687ef3e6e5e7c0be6c | Python | 864 | 29 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._colorbar import ColorBar
from ._contours import Contours
from ._hoverlabel import Hoverlabel
from ._legendgrouptitle import Legendgrouptitle
from ._line import Line
from ._textfont import Textfont
from . import colorbar
... |
a3a4da66b5bdcb72844b4217bdc7f09644cdb8d2f58a01e1e92928dace54dde8 | Python | 864 | 34 | from modular_splicing.models_for_testing.models_for_testing import (
EndToEndModelsForTesting,
STANDARD_DENSITY,
)
gtex_multi_aggregator = EndToEndModelsForTesting(
name="GTEx multi-aggregator",
path_prefix="model/msp-307a3",
seeds=(1, 2, 3),
density=STANDARD_DENSITY,
)
gtex_pre_sparse = EndTo... |
c9339aba0533e4df8c3e848d90d7126d1bb00e3ae5f2d5e18192b435d042fff6 | Python | 864 | 36 | class LimitedList(list):
# Read-only
@property
def maxLen(self):
return self._maxLen
def __init__(self, *args, **kwargs):
self._maxLen = kwargs.pop("maxLen")
list.__init__(self, *args, **kwargs)
def _truncate(self):
"""Called by various methods to reinforce the max... |
2d20ccd3eaa4c5519d1d0686e9580617e871ab6f0c3d578ef179b44463140d56 | Python | 865 | 40 | import os
from typing import List
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
import tensorflow as tf
from matplotlib.axes import Axes
from matplotlib.figure import Figure
from analysis.visualization import Visualizer
from utilities.plotting import transparent_cmap
os.chdir("../../../")
os.envi... |
46647e18fbc24b03f048d4939fa4e16de04544b889e17a0a147a46ddb933bbd1 | Python | 865 | 29 | import numpy as np
from .conf_ranker import ConfRanker
from rdkit.Chem import Mol
from typing import List, Any, Sequence
class RandomRanker(ConfRanker):
"""Randomly rank conformers
:param name: Name of the ranker
:type name: str
:param ascending: Set to True to rank conformer by ascending
val... |
50925f3acbd158d6eda326d80788ed1e2d3b3aacaa5d3637f8aeeda67109047f | Python | 865 | 29 |
def select_spikes(spikes,t_start,t_stop):
""" Selects temporal subset of spikes from spike array.
Parameters:
spikes : A 2D array of spikes ( spiketime x neuron id ). This array needs to be sorted by time.
t_start : The starting time point to select
t_stop : The end time point to sele... |
7cf485412595fc43a6fcceaec5b272a827118fc27a837c894bf9cfb6fe27e979 | Python | 866 | 32 | from unittest.mock import patch
import pytest
@pytest.mark.patched_module(
'django',
'django.db',
'django.db.transaction',
)
@pytest.mark.usefixtures("module")
class test_DjangoTask:
@pytest.fixture
def task_instance(self):
from celery.contrib.django.task import DjangoTask
yield D... |
ebdea1bab9f09c44c1315e4b91d26f5120a028a8377e95b4da0f3546607239a8 | Python | 866 | 34 | import re,sys
import pandas as pd
def parse_predictions(record):
transcript = record[0].split('ID: ')[1]
pred_match = re.search('PRED: (<PC>|<NC>)(\S*)?',record[1])
if pred_match is not None:
pred_class = pred_match.group(1)
pred_peptide = pred_match.group(2)
else:
ra... |
874214d86a408c1ad5a69eae9190dd11afcd169cf921044887d236c525b4b4ee | Python | 867 | 26 | """Utility functions for version checking."""
import warnings
__all__ = ['check_version']
def check_version(min_version, warning_only=False):
"""Check the version of gluoncv satisfies the provided minimum version.
An exception is thrown if the check does not pass.
Parameters
----------
min_versio... |
f8297546e477dc9978547624c386bc8eadba3b7eb7c04088ab59281ef02f8538 | Python | 867 | 29 | import sqlite3
from .db import DB
class TestingLabTable(DB):
def __init__(self):
self.table_name = 'WB_testing_labs'
self.table_desc = 'West Bengal testing laboratories information'
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
'date': 'DATE NOT NUL... |
5580853b8c4d1b49a65e6509a17d83f5243fd595e444b13d3c6f99c54861fc58 | Python | 868 | 26 | import numpy as np
def masks_from_groups(group_array, group_indices=None, n_groups: int = None):
"""
Creates masks which are np.array with dtype=bool according to groups.
:param group_array: group maps
:n_groups: int, number of groups; this is important if not all groups are within given group_maps
... |
b3ff3f3689c15584e671d0ad845b332bb7cc56f340afaa15f1fd5909ab3056be | Python | 868 | 30 | """Phase 4 auto-capture tests."""
from __future__ import annotations
import pytest
import torch
import torchlens as tl
def test_auto_capture_captures_every_nth_call() -> None:
"""Context manager captures every configured forward call."""
model = torch.nn.Linear(2, 2)
with tl.experimental.auto_capture(... |
f12e9248c845430a43c99476fe788d500db5b06a5627aecaa87c058edf8cb350 | Python | 868 | 29 | import tensorflow as tf
from codecarbon import EmissionsTracker
def train_model():
mnist = tf.keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0
model = tf.keras.models.Sequential(
[
tf.keras.layers.Flatt... |
c3be7869e5875583acfbcf2502d10e399ebf52c8b53d03b0112b8afa2a63ca85 | Python | 869 | 33 | """
This module define MetricSpearmanRho
"""
import logging
import scipy
from scipy import stats
import numpy as np
from metrics.generic_metric import GenericMetric
class MetricSpearmanRho(GenericMetric):
"""
This class define the Spearman's rho metric
"""
def __init__(self):
self.reset_and_i... |
5037af84581e09c6591610b7508fe8f69eedaa108dc9eab0d5186c532c779fcd | Python | 870 | 33 | import os
import pytest
try:
from sphinx.application import Sphinx # noqa
from sphinx_testing import TestApp
sphinx_installed = True
except ImportError:
sphinx_installed = False
SRCDIR = os.path.join(os.path.dirname(__file__), 'proj')
@pytest.mark.skipif(
sphinx_installed is False,
reason... |
83a882451a9190e16e2eee4f54b6b1d671eb5b5419e2dec6379fccc4bda0cc39 | Python | 870 | 32 | import tempfile
import numpy as np
import xarray as xr
from pytest import fixture
import seqdata as sd
@fixture
def sdata():
"""Dummy dataset with AA, CC, GG, TT sequences."""
seqs = np.array([[b"A", "A"], [b"C", "C"], [b"G", "G"], [b"T", b"T"]])
return xr.Dataset(
{
"seqs": xr.DataA... |
d5cefdd4da42049621d4756279f993e62baf559e844c9e0ce7fce857a62b77cc | Python | 870 | 30 | """
Ensure no ABFs have empty sweepC arrays
"""
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 ... |
d673aeed8ffb946fa1166e04ad76118ef782b316f15685017363872cc89bcf85 | Python | 870 | 43 | import ast
import numpy as np
# My modules
import session
def add(a,b):
return a+b
def sub(a,b):
return a-b
def mult(a,b):
return a*b
def div(a,b):
return a/b
''' Standard deviation '''
def std(*args):
return np.std(args)
operators = {ast.Add: add, ast.Sub: sub, ast.Mult: mult, ast.Div: div}... |
e561107adf9b6bbf06ffa17b6fbe95acef10ec1ccd4e3015f3b5d3048682b99c | Python | 870 | 27 | from ovseg.augmentation.ConcatenatedAugmentation import torch_concatenated_augmentation, \
np_concatenated_augmentation
class SegmentationAugmentation(object):
'''
SegmentationAugmentation(...)
Performs spatial and gray value augmentations
'''
def __init__(self, torch_params={}, np_params={}... |
04190f6b9f42dabcb683c73c8a8f89901446eae244eeb36252339c25e20faf4d | Python | 871 | 32 | """Create inno setup .iss file"""
import io
import os.path as op
import platform
import sys
import bmicro
# make library available
cdir = op.dirname(op.abspath(__file__))
pdir = op.dirname(cdir)
sys.path.insert(0, pdir)
# get version
version = bmicro.__version__
# read dummy
with io.open(op.join(cdir, "win_bmicro.i... |
0737556992ee2d45fddcd171143091b683dcc0045804b8d8f9197068319bcfb6 | Python | 871 | 32 | """Create inno setup .iss file"""
import io
import os.path as op
import platform
import sys
import pyjibe
# make library available
cdir = op.dirname(op.abspath(__file__))
pdir = op.dirname(cdir)
sys.path.insert(0, pdir)
# get version
version = pyjibe.__version__
# read dummy
with io.open(op.join(cdir, "win_pyjibe.i... |
2a53eb9e3d7d68f0da69893897b43611aeb6498b58a8ad51dcae7362f3716d65 | Python | 871 | 32 | """Create inno setup .iss file"""
import io
import os.path as op
import platform
import sys
import impose
# make library available
cdir = op.dirname(op.abspath(__file__))
pdir = op.dirname(cdir)
sys.path.insert(0, pdir)
# get version
version = impose.__version__
# read dummy
with io.open(op.join(cdir, "win_impose.i... |
37c3de77cf14c3542952b993b9d9d05bbb33022f4aaf5bbe8f243f64732de7ac | Python | 871 | 35 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["splicepoint_model_spec"] = dict(
type="BothLSSIModels",
acceptor="model/splicepoint-model-acceptor-1",
donor="model/splicepoint-model-donor-1",
)
msp.architecture = dict(
type="SpliceaiA... |
4cbfa8daa7990ecb74a1cc51d25ad26f7eaacbc1bb17fb8cc992cda2a1e2ef7f | Python | 871 | 35 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["splicepoint_model_spec"] = dict(
type="BothLSSIModels",
acceptor="model/splicepoint-model-acceptor-1",
donor="model/splicepoint-model-donor-1",
)
msp.architecture = dict(
type="SpliceaiA... |
7c5f3552044fbae95ef0d2e4d46d34d971d2c7c473b5a49ee9c65a21b4a5913e | Python | 871 | 24 | from transformers import ElectraForPreTraining, ElectraTokenizerFast
import torch
discriminator = ElectraForPreTraining.from_pretrained("google/electra-base-discriminator")
tokenizer = ElectraTokenizerFast.from_pretrained("google/electra-base-discriminator")
sentence = "The quick brown fox jumps over the lazy dog"
fa... |
95970f01c79fc07247373805e4f718d29534f68f5e4938bc9b280928e135da2a | Python | 871 | 35 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["splicepoint_model_spec"] = dict(
type="BothLSSIModels",
acceptor="model/splicepoint-model-acceptor-1",
donor="model/splicepoint-model-donor-1",
)
msp.architecture = dict(
type="SpliceaiA... |
dbf32368b07b137e1000d6a0c8860d8a9e318d73fab5dab8915e6698ffa260f1 | Python | 871 | 27 | DATASET_CHUNK_SIZE = 100
def indices_for_chunk(sequence_size, chunk_size, chunk_index):
"""
Produce a set of indices for a chunk of a dataset.
Produce extra for the last chunk if necessary, but have the rest be exactly 100.
"""
if (chunk_index + 1) == sequence_size // chunk_size:
current_... |
1ee7a37fec218f53f6946feb7904b964b92a8f2db9f40b74caffb648a6c42bbd | Python | 872 | 24 | """
Folders to be used in data processing
author: obanmarcos
"""
main_folder = '/data/marcos/DataOPT/'
f140114_5dpf = main_folder+'140114_5dpf' # 5 days post-fertilization
f140117_3dpf = main_folder+'140117_3dpf' # 3 days post-fertilization
f140115_1dpf = main_folder+'140315_1dpf' # 1 days post-fertilization
f1... |
5186e685b793c13dee2f90993055ea4abdc87265a2f2db21d695eb4940bdb7d5 | Python | 872 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["splicepoint_model_spec"] = dict(
type="BothLSSIModels",
acceptor="model/splicepoint-model-acceptor-1",
donor="model/splicepoint-model-donor-1",
)
density = 0.75**22
msp.architecture["num_mo... |
df487f91198e07e478cb15215c32275bdff3674eec49ed7056469feab80a2d43 | Python | 872 | 37 | import sqlite3
from .db import Database
from .MP_tables import (
MP_overview,
MP_district_info,
MP_calls,
MP_centers,
MP_teams,
MP_testing,
MP_vaccination_coverage,
)
class MadhyaPradeshDB(Database):
def __init__(self, datadir):
super().__init__(datadir)
self.init_ta... |
e985bb64aca4b918240b32794b82abf6387cd63c888b7c6fb86f62509bb4224b | Python | 872 | 27 | """
This module create TransformerClassifPerProt
"""
# pylint: disable=W0223
import torch.nn as nn
import torch
class TransformerClassifPerProtNoCls(nn.Module):
"""
This class define a Transformer model that classify an entire protein to ONE classe
"""
def __init__(self, transformer_embedder, num_cla... |
85d7012f68a3e393400939c5ae157639534023c6cbe153da1994a2c58f8fdd20 | Python | 873 | 22 | """
This module is the core of the `ethoscope`.
It defines the building bricks at the basis of the package.
Overview:
* :class:`~ethoscope.core.monitor.Monitor` is the most important class. It glues together all the other elements of the package in order to perform (video tracking, interacting , data writing and draw... |
0224fc0aa8277e1b537cee7994793f46ffd56b16cb13d3133b45bfccc9fd7b8d | Python | 874 | 43 | """Top-level package for stLearn."""
__author__ = """Genomics and Machine Learning Lab"""
__email__ = "andrew.newman@uq.edu.au"
__version__ = "1.4.1"
from . import add, datasets, em, pl, pp, spatial, tl, types
from ._settings import settings
from .wrapper.concatenate_spatial_adata import concatenate_spatial_adata
fro... |
456371fe57a97213a70d95781cb8a2d5032410fed7ae25e4c6dc7b92a4f9b4b2 | Python | 874 | 23 | import os,pickle,torch
from args import *
from model import *
from trainer import Trainer
from dataset import TestDataset
from utils import *
import warnings
warnings.filterwarnings("ignore")
args.node_in_dim = 8
args.edge_in_dim = 5
fold=args.fold
args.exp_path = os.path.join(args.exp_path, 'fold_{}'.format... |
73df65756d977919b139be9f11897e80057be4e29f35a7eb0bfdd40f8f83d57e | Python | 874 | 24 | import subprocess
import os
task = os.getenv("RUN_TYPE")
if len(list(filter(lambda x:x.endswith(".csv"), os.listdir("/app")))) == 0:
print("ERROR: no csv files found in the data folder. Make sure you are in the csv files folder when running the commands.")
exit(1)
if task is None or task not in [ "single_t",... |
9a316c27471ba53984f3b857f9513b3b17b11bf23d29a25a81660397018d1211 | Python | 874 | 48 | __author__ = 'quentin'
import sqlite3
import os
from os import listdir, getcwd
DB_FILE = "/tmp/pict_db.db"
ORIGINAL_IMG = "./test.jpg"
NEW_IMG = "./out.jpg"
if os.path.exists(DB_FILE):
os.remove(DB_FILE)
conn = sqlite3.connect(DB_FILE)
sql = '''create table if not exists PICTURES(
ID INTEGER PRIMARY ... |
7dd64fcd3910fd80200d95f86953cdc809976764923418274c7ec1aefdfcfd61 | Python | 876 | 23 | import numpy as np
import tensorflow as tf
import vampire.layers as layers
def test_cumprod_sum():
a = np.array([[[1, 1, 1, 0], [1, 0, 0, 0]], [[1, 1, 0, 1], [1, 0, 1, 1]], [[0, 1, 1, 1], [0, 0, 1, 1]]],
dtype=np.float32)
def np_cumprod_sum(a, length, reverse=False):
if reverse:
... |
64fb0c7e70673d8fa35db2cf7f01bfb29ed1a26a3c86cdabe652856376b983bf | Python | 877 | 19 | """
Gathers all transformers in one place for convenient imports
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from dcCustom.trans.transformers import undo_transforms
from dcCustom.trans.transformers import undo_grad_transforms
from dcCustom.trans.tra... |
95e236d69f24a020a434162dccbb633c21aac6511cad892e9df43fe5875f58ad | Python | 877 | 29 | import pickle
import unittest
from os.path import join, abspath
from numpy.testing import assert_allclose
from tests.time_integration.ballistics_explicit_pi.rebless import run
class Test(unittest.TestCase):
def test(self):
output = run()
gold_file = abspath(join('tests',
... |
37a720a01683cc39de94463d5cb5e3d5bb34218a2b275de9cd449be14628705c | Python | 878 | 49 | AMINO_ACID_INDICES = {
"HIS": 0,
"ARG": 1,
"LYS": 2,
"GLN": 3,
"GLU": 4,
"ASP": 5,
"ASN": 6,
"GLY": 7,
"ALA": 8,
"SER": 9,
"THR": 10,
"PRO": 11,
"CYS": 12,
"VAL": 13,
"ILE": 14,
"MET": 15,
"LEU": 16,
"PHE": 17,
"TYR": 18,
... |
d41a5e018b078720804a477e62dbf8c92db028095ceafa74fe29a07536271954 | Python | 878 | 31 | import pytest
import glob
import os
import sys
import pathlib
PATH_HERE = os.path.abspath(os.path.dirname(__file__))
PATH_PROJECT = os.path.abspath(PATH_HERE+"/../")
PATH_DATA = os.path.abspath(PATH_PROJECT+"/data/abfs/")
PATH_HEADERS = os.path.abspath(PATH_PROJECT+"/data/headers/")
try:
# this ensures pyABF is im... |
ea7aea80ed573aefd5e3d3b89f46212c23d975b5534f05cc9a4f8948b54a0a54 | Python | 878 | 22 | from keras.src import testing
from keras.src.api_export import REGISTERED_NAMES_TO_OBJS
class ApiExportTest(testing.TestCase):
def test_exported_api_matches_symbol_name(self):
"""Verify export names and real names match.
The canonical exported name and the name of the actual function or class
... |
33dc56046265e7b0e7065f98b9a226d84f9e235dcc5ba3dae5eb9f4df951b146 | Python | 879 | 22 | from keras.src import testing
from keras.src.datasets import boston_housing
class BostonHousingTest(testing.TestCase):
def test_load_data(self):
(x_train, y_train), (x_test, y_test) = boston_housing.load_data()
self.assertEqual(x_train.shape[1], 13)
self.assertEqual(x_train.shape[0] + x_te... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.