sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
1236df0a3447c828b1401cc56a31f1b988d6a4aa4944e63bf678c5470e373859 | Python | 589 | 32 | from __future__ import annotations
from flask import Flask
from flask import Response
app = Flask(__name__)
@app.after_request
def after_sync(response: Response) -> Response:
return Response()
@app.after_request
async def after_async(response: Response) -> Response:
return Response()
@app.before_request... |
281cf414cfd43429a809403cf7a715322c8fa7ba164c27f38bc3bf28eebbbbe4 | Python | 589 | 27 | import pathlib
import pytest
from bmlab.session import Session
from bmicro.gui.main import BMicro
def data_file_path(file_name):
return pathlib.Path(__file__).parent.parent / 'data' / file_name
@pytest.fixture
def window(mocker):
window = BMicro()
Session.get_instance().clear()
file_name = data_f... |
1b21a8fe9b59bbfbf59ffccb1b78fe39d28b124e412f62ca702156754c022704 | Python | 590 | 25 | """
Test error messages when loading ABFs and ATFs with the wrong methods.
"""
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 __... |
491b062e75c42d08462947cc0659a6707f73ec7511613ed1098051eb1e2f9644 | Python | 590 | 14 | import os
os.environ["CUDA_VISIBLE_DEVICES"] = "2"
root = "/home/luke/PycharmProjects/NeuralPred"
def build_dataset(dataset, ntau, nlat, nspan, scale, model, layer, n_pca):
os.system(f"python fit.py --root={root} --dataset={dataset} --ntau={ntau} --nlat={nlat} --nspan={nspan} --scale={scale} --model={model} --la... |
57db97826eb33ab69746c027ddc9a946bf95d65361ec4d73bb6c052896c31cad | Python | 590 | 22 | import sqlite3
from .db import DB
class TestingTable(DB):
def __init__(self):
self.table_name = 'WB_testing'
self.table_desc = 'West Bengal testing snapshot'
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
'date': 'DATE NOT NULL PRIMARY KEY',
... |
679e0b183b724ac6150ba35550e91460a6c39876945de59df6043276456c8d53 | Python | 590 | 29 | #!/usr/bin/env python3
import os
from constants import get_args
standard_args = get_args()
CLr = standard_args.CL_max // 2
CLl = CLr + 1
# First nucleotide not included by BEDtools
COMMAND = """cat %s | awk -v CLl=%s -v CLr=%s '{print $3"\t"($5-CLl)"\t"($6+CLr)}' > temp.bed"""
os.system(
COMMAND
% (
... |
d25e7d3dc6d60dc8f4b3963747caccc0115850ee58d6d59d43abb7c423bd03eb | Python | 590 | 16 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 66
msp.architecture["motif_model_spec"] = dict(
type="PSAMMotifModel",
motif_spec=dict(type="rbns"),
exclude_names=("3P", "5P") + tuple(['UNK', 'RBM23', 'PUM1', 'FUBP3', 'PCBP4'... |
81c9b8b3aac8a29096b46e077d0a2669e98b752675421310465503be0ba25f1f | Python | 592 | 24 | import time
from codecarbon import track_emissions
@track_emissions(
measure_power_secs=5,
api_call_interval=1,
save_to_logfire=True,
)
def train_model():
"""
This function will do nothing during (occurrence * delay) seconds.
The Logfire API will be called every (measure_power_secs * api_call... |
4debd721eacb9e3194770f5562c5928645f415c5190ed1cf995563a6070e3f0c | Python | 593 | 23 | # Generated by Django 3.2.6 on 2022-06-17 10:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0091_auto_20220531_0909'),
]
operations = [
migrations.AlterField(
model_name='profile',
name='stor... |
557f4c7151735f01ce8b68a9dcaaf20084e6638e1e46c4c9e4b623873801f09d | Python | 593 | 24 | import sqlite3
from .db import DB
class IndividualDeathInfo(DB):
def __init__(self):
super().__init__()
self.table_name = 'KL_individual_death_info'
self.table_desc = 'Details of COVID-19 positive deaths in the last 24 hours'
self.cols = self.getcolumns()
def getcolumns(self... |
6afdf5b352038bc65b5f7649b142922b920c787ae68185f3b1283a72b1f1c666 | Python | 593 | 34 | """Add app_type column to worker_process
Revision ID: 63dc6cca023f
Revises: cd26484899fb
Create Date: 2025-12-09 20:58:13.954728
"""
from sqlalchemy import (
Column,
String,
)
from galaxy.model.migrations.util import (
add_column,
drop_column,
)
# revision identifiers, used by Alembic.
revision = "... |
888a8375b767759b7070ce5a08fed89531bdcc8fb5c7fef5b8b544d4ccfdb3aa | Python | 593 | 23 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (leoxiaobin@gmail.com)
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __future... |
8a85de53583de601667f47f00dd4277bf6f52f84426d8dc51094a35a1f38ceca | Python | 593 | 14 | from .global_level import global_level
from .local_level import local_level
from .pseudotime import pseudotime
from .weight_optimization import weight_optimizing_global, weight_optimizing_local
from .utils import lambda_dist, resistance_distance
from .pseudotimespace import pseudotimespace_global, pseudotimespace_local... |
b5f09d659375c7a3644bc50f714182ef9cfefd72224c602ef1a0b28675e5a7d8 | Python | 593 | 18 | from django.conf.urls import handler404, handler500 # noqa
from django.urls import include, path # noqa
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = [
# Examples:
# url(r'^$', 'proj.views.home', name='home'),
# url(r'^proj/',... |
c24e91afeb26ad261192e5c94f44b4f4e6b9cce1f0074d8b88a7edf4dc7002c9 | Python | 593 | 31 | #python $0 fq 0
import sys
import collections
from collections import Counter
fq_file = sys.argv[1]
value = sys.argv[2]
with open(fq_file) as f:
d = collections.defaultdict(list)
while True:
try:
name = next(f)
seq = next(f)
next(f)
qual = next(f)
for i in range(2):
base = seq[i+int(value)]
... |
356cc9d00d4111e9e066955ea94c962cd9b66e4e0fdc5e222f941412b1f2ee40 | Python | 594 | 18 | __all__ = [
'alias', 'bdist_egg', 'bdist_rpm', 'build_ext', 'build_py', 'develop',
'easy_install', 'egg_info', 'install', 'install_lib', 'rotate', 'saveopts',
'sdist', 'setopt', 'test', 'install_egg_info', 'install_scripts',
'register', 'bdist_wininst', 'upload_docs', 'upload', 'build_clib',
'dist_i... |
b8b1162e1da591bb07644e43aa720d8996395deca8c943d3a906cfe72de00b51 | Python | 594 | 21 | #!/usr/bin/env python
# =============================================================================
# PACKAGE DOCSTRING
# =============================================================================
"""
A Python library to perform targeted free energy perturbation with normalizing
flows.
"""
__all__ = ['analysis... |
f827ed544a495230ab00cd0e0ba3956cac30e3d5383e43bb487550430ed47911 | Python | 594 | 23 | """
Handy decorators
"""
def with_time_dec(fn):
"decorator to time function evaluation"
def _(*args, **kwargs):
import time
t = time.time()
out = fn(*args,**kwargs)
print("time lapsed %03.3e in %s"%(time.time() - t, str(fn)))
return out
_.__doc__ = fn.__doc__
ret... |
fb171d21f9394d50750750d61ab07851b9afa0695233698c028d2ff870138cf8 | Python | 594 | 26 | import torch
import torch.nn as nn
class Constant(nn.Module):
"""
Returns a constant tensor of the specified size, regardless of the input.
The tensor is a learnable parameter.
Parameters:
size: int
the size of the tensor to return
Input: any tensor of shape (N1, N2, ..., N... |
209bfc98bbe5ea8de742386887500b83ea19fe65731ebe395d106d249a3a45f4 | Python | 595 | 18 | from setuptools import (setup, find_packages)
setup(
author='Mikael Brudfors',
author_email='brudfors@gmail.com',
description='UniRes: Unified Super-Resolution of Medical Imaging Data',
entry_points={'console_scripts': ['unires=unires._cli:run']},
install_requires=[
"numpy==1.26.0",
... |
81b10ed45ef583753a48d916844d3bf3e8a30540f2f9db2637a4e26ccafc9152 | Python | 595 | 18 | """Test of data set functionalities"""
from PyQt6 import QtWidgets, QtCore
import pyjibe.head
from helpers import make_directory_with_data
def test_qmap_with_unused_curves(qtbot):
"""Uncheck "use" in the curve list and switch to the qmap tab"""
main_window = pyjibe.head.PyJibe()
main_window.load_data(fi... |
cf5e9df0b54542bc4db120fca8f48a5d08fcd783b7ca61c7a0043cc25e6a9b19 | Python | 595 | 14 | import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0"
root = "/home/luke/PycharmProjects/NeuralPred"
def build_dataset(dataset, ntau, nlat, nspan, scale, model, layer, n_pca):
os.system(f"python fit.py --root={root} --dataset={dataset} --ntau={ntau} --nlat={nlat} --nspan={nspan} --scale={scale} --model={model} --la... |
ebb4ae7313822f60094a9f74dfbf46acee14053d4af47acc903321bff13e73a5 | Python | 595 | 23 | 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")
change_adaptive_sparsity_speed_for_gte... |
ec0d1318e66472c502750965f2f8a84d296b892f5e8e72fc7c5cfe54c816c723 | Python | 595 | 23 | 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... |
a0ea6f447f346de53f5ac5444cf92d8aa0248e1964880c7b143a17e0252c3239 | Python | 596 | 22 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._autorangeoptions import Autorangeoptions
from ._tickfont import Tickfont
from ._tickformatstop import Tickformatstop
from ._title import Title
from . import title
else:
from _plotly_utils.importers import relative_import
... |
d87348782f687ef91dbd88c667ee71c47d116f355033b288def4ca03ce23acb1 | Python | 596 | 23 | 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")
change_adaptive_sparsity_speed_for_gte... |
77206321fe4858dbc90e5483bf599dcade506d1a06766d80b05d7bc78a8240da | Python | 597 | 23 | """
big file test (64-bit numpy required)
"""
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/ab... |
edec7d4b4f1613f6f8b70c6a342bbcd64d65e96bfa3b5fc36b1e3884fda19c9f | Python | 597 | 21 | import sys
from ij import IJ
# Fiji Jython interpreter implements Python 2.5 which does not
# provide support for argparse.
input = sys.argv[-3]
tmp_output_path = sys.argv[-2]
output_datatype = sys.argv[-1]
# Open the input image file.
input_image_plus = IJ.openImage(input)
# Create a copy of the image.
input_image... |
f77e2779e8aef4d3779d703ed52a2c8b860b200a21efddcd3555d33f48e81afa | Python | 597 | 17 | #!/usr/bin/env python
# =============================================================================
# PACKAGE DOCSTRING
# =============================================================================
"""A collection of ``LightningModule``\ s implementing ready-to-use TFEP maps."""
# =============================... |
0aaf4be616c8acef52cdc44439532479487ae736bb5e8f00b4f8aa0db1dbe060 | Python | 598 | 22 | 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="... |
599300b445f936380206e3b44c512946c307e4e04b6ccf6a5b04bfab16b40064 | Python | 598 | 22 | 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="... |
6803d6d824353e56c7d1de9a369601f02e115eddf4fd055519c8713d15a9a9b1 | Python | 598 | 23 | 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")
change_adaptive_sparsity_speed_for_gte... |
cf60e5bb2e7a35f321bcff6076670dad67e8114a6be739f6e0547a8a877a97cf | Python | 598 | 22 | 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="... |
cf94f816f418cad95663cc32e25a523d26a2b26ed1d1d335358ca2dde0c25d51 | Python | 598 | 16 | from setuptools import setup, find_packages
#import
setup(name='scDGD',
version="0.2",
#description='Classes for internal representations',
author='Viktoria Schuster',
#url='https://github.com/viktoriaschuster/DGD_paper_experiments',
packages=['scDGD','scDGD.classes','scDGD.models','scDGD.... |
220659db3a325f2dd71c7d22f8bfc6a0431ae75dfeea62c493d3b16898af914c | Python | 599 | 23 | 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["propagate_sparsity_spec"] = dict(type="NoSparsityPropagation")
msp.architecture["final_processor_spec"].update(
dict(
bottleneck_spec=dict(type="First... |
725325e4ce976535ccbb6c5116a45fa21abb765803b62801ad3f5cbf527766cb | Python | 599 | 14 | import os
os.environ["CUDA_VISIBLE_DEVICES"] = "1"
root = "/home/luke/PycharmProjects/NeuralPred"
def build_dataset(dataset, ntau, nlat, nspan, scale, model, layer, n_pca):
os.system(f"python fit.py --root={root} --dataset={dataset} --ntau={ntau} --nlat={nlat} --nspan={nspan} --scale={scale} --model={model} --la... |
de940126812982a3209b38ef2d93b8dc8dd030dd846f5d3e2bc1aac7c44f0d45 | Python | 599 | 29 | import sqlite3
from .db import Database
from .GA_tables import (
GA_overview,
GA_active_cases,
GA_bed_capacity,
)
class GoaDB(Database):
def __init__(self, datadir):
super().__init__(datadir)
self.init_tables()
self.create_tables()
def init_tables(self):
"""
... |
e0f6491a155d0dcd7c4180c4824208b9767cdd3ad160b3186d0b3597ee70288b | Python | 599 | 38 | # Saved information over a session
import math
saved = dict()
saved_w = None
idcount = 1
def get_id():
global idcount
m = idcount
id = []
while True:
n = (m-1)%26+1
id.append(chr(64+n))
m = math.floor((m-1)/26)
if m <= 0:
break
idcount += 1
return '... |
0036d995d106443c6ee2da110411bc0a6bb0197098062efb4e94d268728b48a6 | Python | 600 | 23 | # Generated by Django 3.0.4 on 2020-03-24 15:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0065_auto_20200324_1552'),
]
operations = [
migrations.AddField(
model_name='mushroomspot',
name='p... |
24135bd4d0c302cf3631c8d797822c2e48f1d234f46495e7563a70ef2877fa20 | Python | 600 | 33 | """
short demo.
"""
from rpy2.robjects.packages import importr
graphics = importr('graphics')
grdevices = importr('grDevices')
base = importr('base')
stats = importr('stats')
import array
x = array.array('i', range(10))
y = stats.rnorm(10)
grdevices.X11()
graphics.par(mfrow = array.array('i', [2,2]))
graphics.plo... |
a1ea53312db94fb404f28a34d6a36cd989df9f0a4a91351ef61a673b62a8ff15 | Python | 600 | 22 | 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="... |
e338e7389df6b3935b72e234dd5cc29c1009b6ce2f062a8a12f13b6899bff2f2 | Python | 600 | 15 | import pytest
import numpy as np
import constants.constants_expt1 as c
import src.subspace_alignment_index as ai
def test_get_AI_within_delay_max_dim_not_integer():
with pytest.raises(AssertionError):
ai.get_AI_all_dims(c, np.zeros((8, 200)), max_dim="not_an_integer")
with pytest.raises(AssertionError... |
0a9a1acb2e52459ea0f25d7292ef41644ac039e4e93f75b3a38847c2451eb0ad | Python | 601 | 21 | import sys
from ij import IJ
# Fiji Jython interpreter implements Python 2.5 which does not
# provide support for argparse.
input = sys.argv[-3]
tmp_output_path = sys.argv[-2]
output_datatype = sys.argv[-1]
# Open the input image file.
input_image_plus = IJ.openImage(input)
# Create a copy of the image.
input_image... |
36339a8dc8d7229c0941187e22e7b944754dfb405fcd842cbe621a15af6c967a | Python | 601 | 28 | #!/usr/bin/env python
"""Tests for `stlearn` package."""
import unittest
import stlearn as st
import scanpy as sc
from .utils import read_test_data
global adata
adata = read_test_data()
class TestSME(unittest.TestCase):
"""Tests for `stlearn` package."""
def test_SME(self):
sc.pp.pca(adata)
... |
42bf4d6caf484496e872a7ed9be7fdf2ac6a20b3acb7dab6f70c3c8e9127bbf7 | Python | 601 | 14 | from sklearn.model_selection import train_test_split
from torch.utils.data import TensorDataset
def split_graphs(dataset):
train_idx, test_idx = train_test_split(range(len(dataset)), stratify=[m.y[0].item() for m in dataset], test_size=0.2)
train_dataset = dataset[train_idx]
test_dataset = dataset[test_idx... |
545184b90afc37ad2d41a2a35347319ec5b4f4c574e34f8a0784b3f659f46476 | Python | 602 | 14 | # Copyright 2022 Deepfold Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
a029667e6f0b10ae66ecec25ae55dfb7fff76075dced473ac6e1469cc81ec9c5 | Python | 602 | 20 | import torch.nn as nn
def kl_div(source, target):
if len(source) < len(target):
target = target[:len(source)]
elif len(source) > len(target):
source = source[:len(target)]
criterion = nn.KLDivLoss(reduction='batchmean')
loss = criterion(source.log(), target)
return loss
def js(sou... |
b6591e5d4e90dbdf9825d750ef17f782b1c6aab2deeb227145f52be297c3b2e4 | Python | 602 | 17 | import scipy.sparse
def pad_sparse_motifs_with_cl(motif_ys):
"""
Pad the given sparse motifs of shape (N, SL) in order to add a CL = SL * 2.
Output is of shape (N, SL + CL) = (N, 3 * SL).
Flows together, e.g., [[0, 1], [2, 3]] -> [[0, 0, 0, 1, 2, 3], [0, 1, 2, 3, 0, 0]]
"""
pad = scipy.spars... |
644cca8dc8379967475f5cd46cfeb546ff70c31dfa041798c1addf8a90023f8c | Python | 603 | 19 | import numpy as np
from gym.spaces import MultiBinary
def test_sample():
space = MultiBinary(4)
sample = space.sample(mask=np.array([0, 0, 1, 1], dtype=np.int8))
assert np.all(sample == [0, 0, 1, 1])
sample = space.sample(mask=np.array([0, 1, 2, 2], dtype=np.int8))
assert sample[0] == 0 and sam... |
e2a2e9878075f3824ef749fdca45a24d16325d285f9c9899401513c4f3cd2040 | Python | 603 | 21 | import unittest
from angorapy import make_task
from angorapy.agent.ppo_agent import PPOAgent
from angorapy.models import get_model_builder
class TestPostProcessors(unittest.TestCase):
def test_postprocessors(self):
model_builder = get_model_builder("simple", "ffn")
env = make_task("LunarLanderCo... |
44dad033894f05477e44898c831fbae3a5aacd622f54fca59b3641cfde084372 | Python | 604 | 24 | import sqlite3
from .db import DB
class SymptomaticCases(DB):
def __init__(self):
super().__init__()
self.table_name = 'TG_symptomatic'
self.table_desc = 'Telangana status of asymptomatic / symptomatic cases'
self.cols = self.getcolumns()
def getcolumns(self):
cols ... |
8b416764bd9e5284b4bf97a0e7db93a7650b3bc6a700128940d42616497bc9b6 | Python | 604 | 21 | import os.path
import os
import glob
groups = {}
data_folder = "/mnt/windata/DataDir/kicad-packages3D"
threshold = 40
# merge package
# plot images in grid?
subFolders = [o for o in os.listdir(data_folder) if os.path.isdir(data_folder + os.path.sep + o)]
for d in sorted(subFolders): # recursive subfolder processing... |
112af9c3a72612ef5cdedefec01273fc1b03d325afbfa636dd1c44e3f56ae8aa | Python | 605 | 21 | from functools import lru_cache
import numpy as np
from modular_splicing.evaluation import standard_e2e_eval
@lru_cache(None)
def second_half_of_spliceai_cached():
data_spec = dict(
type="H5Dataset",
sl=5000,
datapoint_extractor_spec=dict(type="BasicDatapointExtractor"),
post_pro... |
2067ebdba1c93ac949936f02cbf6556512ca3117bc634b4c13fd0d7dc2d34e76 | Python | 605 | 21 | 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... |
25421098901a6a833273d4924415def158be448d2c5e8078afe0e22f34e33936 | Python | 605 | 21 | import torch
from lightly.transforms import AmplitudeRescaleTransform, RFFT2DTransform
# Testing function image -> FFT -> AmplitudeRescale.
# Compare shapes of source and result.
def test() -> None:
image = torch.randn(3, 64, 64)
rfftTransform = RFFT2DTransform()
rfft = rfftTransform(image)
ampResc... |
53896b4d9176750ef1cde3304af66da2daafa1a1c963d7e12f6db45acd1cc0ca | Python | 605 | 23 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import argparse
def main(opt):
in_dir = opt.in_dir
df = pd.read_csv(in_dir, header=None)
ax = df.plot.bar(x=0, y=[1,2,3], legend=True, rot=50, fontsize=12, width=0.7)
ax.tick_params(axis='x', which='major', labelsize=9)
ax.leg... |
6d3428e7370194eefe85825118d4d4353e200d745c0d92e3ffe307f167608567 | Python | 605 | 22 | import numpy as np
from angorapy.utilities.statistics import increment_mean_var
def test_incremental_mean_var():
n_samples = 100000
sample_dims = 10
samples = np.array([np.random.randn(1, sample_dims) for _ in range(n_samples)])
mean, var, n = samples[0], np.zeros((1, sample_dims,)), 1
for s in... |
72f289ddc7b744de31cb093b3dd9d76efa169ff97cada661b3a068b4c22887f6 | Python | 605 | 20 | from angorapy import agent
from angorapy import common
from angorapy import models
from angorapy import tasks
from angorapy import utilities
from angorapy import analysis
from angorapy.common import policies
from angorapy.utilities.monitoring import Monitor
from angorapy.tasks.registration import make_task
from angora... |
ccf65bac9e8f8006d234f258b522d0567646b537554ca5798b42ae7bd7f7572d | Python | 605 | 25 | #!/usr/bin/env python
"""
Draw a graph of the net architecture.
"""
import os
from google.protobuf import text_format
import caffe, caffe.draw
from caffe.proto import caffe_pb2
def main(argv):
if len(argv) != 3:
print 'Usage: %s input_net_proto_file output_image_file' % \
os.path.basename... |
b7412cd943fd8ec87257a819542210a69a9e01c2517701eb6377f77786cc98a9 | Python | 606 | 22 | """
WARNING: this code is HIGHLY destructive to ABF files!
When run on a folder, this makes ABF files empty.
This is useful for rapidly emptying folders of ABF files
to practice writing directory browsing functions.
"""
import os
import glob
def makeFileEmpty(fname):
"""Delete the contents of a file.""... |
f991b44453523571228f468b446d7f9af6f6e8cbaa9a865f4f28c78e2e88427c | Python | 606 | 20 | import sys
import pathlib
try:
PATH_HERE = pathlib.Path(__file__).parent
PATH_ABFS = PATH_HERE.joinpath("../../data/abfs/").resolve()
PATH_SRC = PATH_HERE.joinpath("../../src/").resolve()
print(PATH_SRC)
sys.path.insert(0, str(PATH_SRC))
import pyabf
except:
raise EnvironmentError()
if __... |
1bda4ffc2af912e3bff0c8ea2be0b7bb6eabce69bc2f54cdcf79229d2d3f2275 | Python | 608 | 19 | """Dummies to stand in for macOS specific functions"""
NSActivityIdleDisplaySleepDisabled = (1 << 40)
NSActivityIdleSystemSleepDisabled = (1 << 20)
NSActivitySuddenTerminationDisabled = (1 << 14)
NSActivityAutomaticTerminationDisabled = (1 << 15)
NSActivityUserInitiated = (0x00FFFFFF | NSActivityIdleSystemSleepDisabl... |
6104a334cc0dea149098d0335397d78af2409108dadaf21e6686b3cd97b470c8 | Python | 608 | 32 | """Drop Job.params column
Revision ID: a5c5455b849a
Revises: cd26484899fb
Create Date: 2025-10-15 16:13:14.778789
"""
from sqlalchemy import Column
from galaxy.model.custom_types import TrimmedString
from galaxy.model.migrations.util import (
add_column,
drop_column,
)
# revision identifiers, used by Alemb... |
cbf43a27456a3d2c53d4c96edb1edc179f5272034dbb67421f3fbef12557b8b9 | Python | 608 | 21 | import sys
from ij import IJ
# Fiji Jython interpreter implements Python 2.5 which does not
# provide support for argparse.
input_file = sys.argv[-3]
tmp_output_path = sys.argv[-2]
output_datatype = sys.argv[-1]
# Open the input image file.
input_image_plus = IJ.openImage(input_file)
# Create a copy of the image.
i... |
d327c53a6f3945ceeeaece591255145b0b0f759b110991c1a7eac3926fa13d40 | Python | 608 | 29 | # -*- coding: utf-8 -*-
from setuptools import setup
import os
from setuptools import setup, find_packages
long_description = open("README.md").read()
install_requires = [
'numpy',
'scipy',
'pandas',
'matplotlib']
extras_require = {
'testing': ['pytest'],
'docs': ['numpydoc>=0.5',
... |
d68a4ab58c65f7a5ed925e951cb3d7c2941ef4b7f2076f881df4aa8fd1b3fb13 | Python | 608 | 14 | import os
# os.environ["CUDA_VISIBLE_DEVICES"] = "2"
root = "/home/luketaylor/PycharmProjects/NeuralPred"
def build_dataset(dataset, ntau, nlat, nspan, scale, model, layer, n_pca):
os.system(f"python fit.py --root={root} --dataset={dataset} --ntau={ntau} --nlat={nlat} --nspan={nspan} --scale={scale} --model={mod... |
86c834c75bd9b800e508ceca01dd59e96dd9aae523802c93b3e6543abe2aaeb9 | Python | 609 | 24 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._currentvalue import Currentvalue
from ._font import Font
from ._pad import Pad
from ._step import Step
from ._transition import Transition
from . import currentvalue
else:
from _plotly_utils.importers import relative_impor... |
b13e3067d73814e83912e8fc21003ce77d95cf0236608ce465c661b973538611 | Python | 609 | 29 | import attr
from .mutation import Mutation
import numpy as np
@attr.s
class CodonMutation(Mutation):
"""
Represents a mutation of a codon.
"""
codon_idxs = attr.ib()
new_codon = attr.ib()
def perform(self, rna):
rna[self.codon_idxs] = self.new_codon
def footprint(self):
... |
cd5c710663963888646bf79970c27a5ef1ad219d71fd032814f30037b9ebffc9 | Python | 609 | 23 | 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["propagate_sparsity_spec"] = dict(type="OnlyAllowInfluenceOnSplicesites")
msp.architecture["final_processor_spec"].update(
dict(
bottleneck_spec=dict(t... |
41c5faaf07d12fb715708175c502ae72753ac730db36163ed0e61af407ace8d7 | Python | 611 | 22 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 1 + 2
msp.architecture["channels"] = 10
msp.architecture["motif_model_spec"]["motif_width"] = 9
msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict(
type="FCMoti... |
a700e042066167efcde698ecfb7fa13a447185b09677b9237d8fe927350cab8e | Python | 611 | 16 | from mirp._data_import.dicom_file_ct import ImageDicomFileCT
from mirp._data_import.dicom_multi_frame import ImageDicomMultiFrameStack, ImageDicomMultiFrameIndividual
class ImageDicomFileCTMultiFrameStack(ImageDicomMultiFrameStack, ImageDicomFileCT):
def __init__(self, **kwargs):
super().__init__(**kwargs... |
b357331e0cb7555f1c746706e06d86e034367df2c99ca50bfd22229ded226928 | Python | 611 | 20 | # Generated by Django 2.2.6 on 2020-03-26 15:58
import biomedisa_app.models
import django.core.files.storage
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0071_auto_20200325_1125'),
]
operations = [
migrations.AlterFi... |
deee4341ba1c9c32a6b0057d43fbe5e96e109a229224566582d77f70c15e809f | Python | 611 | 20 | from unittest import TestCase, mock
import numpy as np
from scipy import sparse
import spateo.io.utils as utils
from ..mixins import TestMixin
class TestIOUtils(TestMixin, TestCase):
def test_bin_matrix(self):
X = np.random.random((3, 3))
expected = np.zeros((2, 2))
expected[0, 0] = X[:... |
0de14c95b1ad8cf3888f397ae4e97c85896899a0c71850e467e05721ec02d51f | Python | 612 | 25 | import numpy as np
from fun_h import fun_h
# import matplotlib.pyplot as plt
def fun_theta(x):
# the bump function theta satisfying
# theta(x)=1 for x<1/4 and theta(x) = 0 for x \geq 1
# theta(x) = h(1-x)./(h(1-x)+h(x-1/4))
#
# xiayq @ 8/14/2019
#
# xiayq@zju.e... |
183eb08de320e98aaadcbe823fb0ac693541860f24debb77f91692bcfea2fd00 | Python | 612 | 18 | import pandas as pd
id_list = []
with open('validated_lncPEP_ids.txt','r') as outFile:
id_list = [x.rstrip().split('.')[0] for x in outFile.readlines()]
datasets = ["data/mammalian_200-1200_test.csv","data/mammalian_200-1200_val.csv","data/mammalian_200-1200_train_balanced.csv","data/mammalian_200-1200_train.csv... |
360fe1647906efff860c074e1fd546375127499832854d3594fdd890d842c600 | Python | 612 | 19 | """Internal structure for shape"""
from collections import namedtuple
class ShapeSpec(namedtuple("_ShapeSpec", ["channels", "height", "width", "stride"])):
"""
A simple structure that contains basic shape specification about a tensor.
It is often used as the auxiliary inputs/outputs of models,
to obta... |
55ee6205f3e08de36679e331e67900a2bd654df8a9ce299782e6cd96b6af3b36 | Python | 612 | 20 | # Generated by Django 2.2.6 on 2020-03-26 16:36
import biomedisa_app.models
import django.core.files.storage
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0073_auto_20200326_1711'),
]
operations = [
migrations.AlterFi... |
75e195cffbeba204a88786cbc755e7b32850e65208ac67978ff382c7791551a2 | Python | 612 | 16 | from mirp._data_import.dicom_file_mr import ImageDicomFileMR
from mirp._data_import.dicom_multi_frame import ImageDicomMultiFrameStack, ImageDicomMultiFrameIndividual
class ImageDicomFileMRMultiFrameStack(ImageDicomMultiFrameStack, ImageDicomFileMR):
def __init__(self, **kwargs):
super().__init__(**kwargs... |
96a150a23fd1e98481414c88c98f8903ffd7dee4022a447e5312db3222bdc164 | Python | 612 | 22 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 1 + 2
msp.architecture["channels"] = 10
msp.architecture["motif_model_spec"]["motif_width"] = 9
msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict(
type="FCMoti... |
efe9c1539fbcc2d3c17b51877dab763f67cd1338ccefff50e20fe7193b915009 | Python | 613 | 31 | from __future__ import print_function
import numpy as np
from adolc import *
def do_taping(tag,x):
trace_on(tag)
ax = as_adouble(x)
for item in iter(ax):
item.declareIndependent()
if (ax[0] < 0):
ay = ax[2]*ax[1]*2.0
else:
ay = ax[2]+3.0*ax[1]
ay.declareDependent()
trac... |
d3f303db3643e16d87ddbe29e1bc534e4a1ac541157567a7cc58a023d1ff19fd | Python | 614 | 20 | # Generated by Django 3.0.4 on 2020-03-26 16:11
import biomedisa_app.models
import django.core.files.storage
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0072_auto_20200326_1658'),
]
operations = [
migrations.AlterFi... |
d4a9bb68023f6c57fc791644babfde12e19f6c5ed0cb0ec292b0f0b1770572f6 | Python | 615 | 20 | """
A dummy package to allow importing numpy and the unit-aware replacements of
numpy functions without having to know which functions are overwritten.
This can be used for example as ``import brian2.numpy_ as np``
"""
from brian2.numpy_ import *
from util import concatenate
# These will not be imported with a wildc... |
324baea21b981575b4e6d92b6517f21ec2ad86a6138010863a9fcfb4f984e649 | Python | 616 | 29 | import sqlite3
import pytest
from flaskr.db import get_db
def test_get_close_db(app):
with app.app_context():
db = get_db()
assert db is get_db()
with pytest.raises(sqlite3.ProgrammingError) as e:
db.execute("SELECT 1")
assert "closed" in str(e.value)
def test_init_db_command... |
88d8a624a75b030ac28478d876b68a1321b084ecf769d03beb4d313aceee0436 | Python | 616 | 22 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 1 + 2
msp.architecture["channels"] = 10
msp.architecture["motif_model_spec"]["motif_width"] = 9
msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict(
type="FCMoti... |
131c85d7909489c322d9fa5f4ac8d91893320ecbb5ac5a21c61098398d814a7b | Python | 617 | 24 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._center import Center
from ._domain import Domain
from ._lataxis import Lataxis
from ._lonaxis import Lonaxis
from ._projection import Projection
from . import projection
else:
from _plotly_utils.importers import relative_i... |
d3c469e8350c17063d8739f2559cf9bfc1e98d0f83532de412c0ab13d991c339 | Python | 617 | 22 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 1 + 2
msp.architecture["channels"] = 10
msp.architecture["motif_model_spec"]["motif_width"] = 9
msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = dict(
type="FCMoti... |
26eec6ba11afff5e1a946a1da9517e4407fae575bf8511de0144cfe1398af4b4 | Python | 618 | 14 | # Copyright 2022 Deepfold Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
dde9c843ab15db3ddf9efd17e25912899e5eca8d0a68ede89b1176e64cddd4f1 | Python | 618 | 27 | from pyoperant.interfaces import base_
class Spike2Interface(base_.BaseInterface):
"""docstring for Spike2Interface"""
def __init__(self):
super(Spike2Interface, self).__init__()
def open(self):
raise NotImplementedError
def close(self):
raise NotImplementedError
... |
3eef4aed6427364c7db5f23d8f50b043d6379371c1a361c271a5e7efde9977a4 | Python | 619 | 24 | import numpy as np
def pdtorus(R, r, X):
# return the projection p of x onto the torus:
# {(a,b,c) | (R-sqrt(a^2+b^2))^2+c^2 = r^2}
# d = ||p-x||_2
#
# xiayq @ 8/14/2019
#
# xiayq@zju.edu.cn
# refered to Yao, Z and Xia, Y. (2019). Manifold Fitting under Unbounded Nois... |
772c930925864ff0ecba7b370b57bd01f2086889241c2646796dbd52a3f04cf3 | Python | 619 | 25 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-06 12:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0027_auto_20181005_1641'),
]
operations = [
migrations.Ad... |
cdf8f8371b9d35bb5ab48686733ad92a100671514348a41e87ba2f487733c2fa | Python | 619 | 25 | import random
from matplotlib import pyplot as plt
from matplotlib import cm
from matplotlib import axes
from matplotlib.font_manager import FontProperties
def draw_heatmap(data, filename):
#作图阶段
fig = plt.figure()
#定义画布为1*1个划分,并在第1个位置上进行作图
ax = fig.add_subplot(111)
#作图并选择热图的颜色填充风格,这里选择hot
... |
a189f4dc59bb19ec9beb58084656916d37d211ccece73a9f464fef45aa7b8a5e | Python | 620 | 28 | 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,
spliceai_spec=dict(
t... |
e4826962a9f3df57164f48978d3768d7113c29f8f76132b47126679d3972241b | Python | 620 | 20 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for PageRankClassifier"""
import unittest
from sknetwork.classification import PageRankClassifier
from sknetwork.data.test_graphs import *
class TestPageRankClassifier(unittest.TestCase):
def test_solvers(self):
adjacency = test_graph()
la... |
feacddaca9b13ff9831929e0c2886d4cfcf5e0b44c8ea7e1aec5e7d6caa4abd1 | Python | 620 | 26 | """
Comparing version numbers
"""
# import the pyabf module from this development folder
import os
import sys
PATH_HERE = os.path.abspath(os.path.dirname(__file__))
PATH_SRC = os.path.abspath(PATH_HERE+"/../src/")
PATH_DATA = os.path.abspath(PATH_HERE+"/../data/abfs/")
sys.path.insert(0, PATH_SRC) # for importing
sys... |
fc3c4c01eba4b500b8f9bca66c032ae3ba008e9cce335285b142eff16286b9e1 | Python | 621 | 22 | """Custom error definitions."""
class SpecParamError(Exception):
"""Base class for custom errors."""
class FitError(SpecParamError):
"""Error for a failure to fit."""
class NoDataError(SpecParamError):
"""Error for if data is missing."""
class DataError(SpecParamError):
"""Error for if there is a pr... |
0aeacc2cb2053e9a7be8a862e6975c0a67b14c7a77ea985c61ade4a82d0cd253 | Python | 622 | 10 | # Copyright 2019 Novartis Institutes for BioMedical Research Inc. Licensed
# under the Apache License, Version 2.0 (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless
# required by applicable law... |
99ac6a8ef82dfe4e8f48311de74b2bce9fd9ed3ad2956f3f7cf02db64d800993 | Python | 622 | 22 | #!/usr/bin/env python
"""
Notification system for Ethoscope alerts and monitoring.
This package provides extensible notification services for device events,
including email, and future support for telegram, whatsapp, etc.
"""
from .base import NotificationAnalyzer
from .email import EmailNotificationService
from .ma... |
9f31ce5ad2881042c0149d266a06becbc80aa648f863124068e7bb26cf1241f5 | Python | 622 | 23 | import h5py
import numpy as np
with h5py.File("../topology100/network-synapses.hdf5", "r+") as f:
neurons = f["network/neurons"]
if "reaction_diffusion_file" in neurons:
print("Already exists, skipping.")
else:
# determine number of neurons
n = neurons["neuron_id"].shape[0]
... |
1ca5024ec1c38d6800a46a5b60fedaf6c4d7c70467f05ee035a2f85654cb8e9a | Python | 623 | 28 | 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,
spliceai_spec=dict(
t... |
2cc240e07e9efd6ae20a53b44b96ce081b1b1733be0ed9fed373c4ba2000a6b5 | Python | 623 | 28 | 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,
spliceai_spec=dict(
t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.