sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
8cf6609f24d1a6d2d76cc2ea23b91454a49ffcbe349226863a372443866ee0d4 | Python | 721 | 30 | import pickle
from gym import error
from gym.utils import seeding
def test_invalid_seeds():
for seed in [-1, "test"]:
try:
seeding.np_random(seed)
except error.Error:
pass
else:
assert False, f"Invalid seed {seed} passed validation"
def test_valid_see... |
2af7668dc20687cd7c2536565517747837fe424900fe9f49e294b59222fb7b70 | Python | 722 | 24 | import json
import pandas as pd
from tqdm import tqdm
test = pd.read_csv('./data/csvs/data/test_new_old.csv')
new_drugs = test.Drug1_ID.tolist()
old_drugs = test.Drug2_ID.tolist()
similar_matrix = pd.read_csv('./data/csvs/similar_matrix/simi_matrix.csv', index_col=0)
similar_drugs_columns = similar_matrix.columns.to... |
487b2d006264559492607f320bca9d92644fbb808e038fcb6135dfcd89657528 | Python | 722 | 22 | from __future__ import annotations
from unittest.mock import patch
import pytest
from click.testing import CliRunner
from celery.bin.celery import celery
from .proj import daemon_config as config
@pytest.mark.usefixtures('depends_on_current_app')
@pytest.mark.parametrize("daemon", ["worker", "beat", "events"])
de... |
fb36f9aba8ea4676e629374344a11d11cb8e80f0755dbc4a91a8ca0f30336101 | Python | 722 | 25 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-05-18 13:49
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0019_upload_cnnproject'),
]
operations = [
migrations.AlterF... |
181198a09b3d353eb48cc9b9ecddbd2485efb2ff4ba65d4d3b9fa835184d8d60 | Python | 723 | 23 | import time
def TicTocGenerator():
# Generator that returns time differences
ti = 0 # initial time
tf = time.time() # final time
while True:
ti = tf
tf = time.time()
yield tf-ti # returns the time difference
TicToc = TicTocGenerator() # create an instance of the TicTo... |
24e0016aa05807099994ced788338f9ecb4d967ddd6bf37cb2d8bac45dafd04d | Python | 723 | 25 | 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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
6f0a903a26cfc54df79c81dce41ec9de9857135cffb04145e91870a5ded10715 | Python | 723 | 26 | import os
from os import PathLike
import logging
def make_dirs(
output_dir: PathLike,
overwrite: bool = False,
):
"""Make a directory if it doesn't exist.
Parameters
----------
output_dir : PathLike
The path to the directory to create.
overwrite : bool, optional
Whether to... |
9c9e93a38e16ebf98bb544131590f67e5a5c5e62117c59fbc00a7f1cf71887ec | Python | 723 | 25 | 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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
b49cc9573f9797aff72a04d70156a2fa3076d91ba7465571e1e16341780b4919 | Python | 723 | 25 | 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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
baecb966b49d03fdc19ab2ce77ebbd71d57572183e3b1cfb1c290f0df6e3b2da | Python | 723 | 25 | 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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
bd32c0e243324a3a3bd4c35b84e9c806d84317425af2383674c46cb1f0c38699 | Python | 723 | 25 | 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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
c97dd0a8e37e19747fa55f38f647fc9b3d98d46be00e33c2ee9b33f7ffb5a9ee | Python | 723 | 25 | 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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
d0730b92814cf012f9346ee4286f8238691f434447f104abe9ba318e299e4ed0 | Python | 723 | 25 | 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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
61d330a10eb407ec08a0fbe97b71763fbb86afd78146bc5845fe09a4e80a9e18 | Python | 724 | 25 | import logging
from subprocess import (
PIPE,
Popen,
)
SUDO_PATH = "/usr/bin/sudo"
SUDO_PRESERVE_ENVIRONMENT_ARG = "-E"
SUDO_USER_ARG = "-u"
log = logging.getLogger(__name__)
def sudo_popen(*args, **kwargs):
"""
Helper method for building and executing Popen command. This is potentially
sensetiv... |
0afc0fc04bc75f6fe493fd551fceda0e08af7a12ee40e2b77f65486945017717 | Python | 725 | 24 | """
This module define a converter
"""
import torch
from converter.generic_converter import GenericConverter
from utils.utils import square_pad_sequence
class ConverterProbaToPredInstanceWeight(GenericConverter):
"""
This class convert proba output to prediction
"""
def convert_output_and_target(self... |
197c5255976129b47be93c859df768abffad77ba2915a029357440f4efd092ea | Python | 725 | 18 | """Prepare Youtube_bb dataset
=========================================
`Youtube_bb dataset <http://research.google.com/youtube_bb/>`_ is
The data set consists of approximately 380,000 15-20s video segments extracted from 240,000 different publicly visible YouTube videos.
This tutorial helps you to download Youtube_b... |
45ee87f43a6f303124fadb0ce89a1e0d87f2baa22b8832f7818468d26863bdb5 | Python | 725 | 25 | 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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
791eee56544490b7de45c0ce971d278617680a0998344f75a5206a94b5403b91 | Python | 725 | 25 | 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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
79dcb0c5508ad403c10dba7316cec62e807ea8fac820a060e90f5c5f751e1fef | Python | 725 | 25 | 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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
e9e950d46443ee7f708ede7730e2fb335bda603b272f55cf14f45a709fc9bd59 | Python | 725 | 25 | 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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
f0eb50977b76c60f15799e453ba2c2a55b72be4e86c8c1f7b011877b59f695aa | Python | 725 | 22 | import sys
import os
homedir = sys.argv[1]
tmpdir = sys.argv[2]
network = sys.argv[3]
phenotype_name = sys.argv[4]
"""
this makes the features and targets in tmpdir
"""
os.system('python /{0}/preprocess_SES.py {1} {2}'.format(homedir,network,tmpdir))
working_dir = homedir + '/results_SES/{0}_network/'.format(network... |
fc629a95dfd5d7d7423c6976ce8f239f0e31380ab5acc38bcfb9d5d808429c95 | Python | 725 | 25 | 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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
25d33144d7440ecc78f614561111bbf26ed6fbe2f192a4f53aa16ebe7dac54bd | Python | 726 | 25 | class AverageMeter(object):
"""Computes and stores the average and current value"""
def __init__(self):
self.reset()
def reset(self):
self.val = 0
self.avg = 0
self.sum = 0
self.count = 0
def update(self, val, n=1):
self.val = val
self.sum += va... |
3ccf8a2fded12c70945a497bcf4b2e1c446b3677d8e6b208044ee3375c202e23 | Python | 726 | 26 | """clean users and org rights management
Revision ID: 951141858cff
Revises: 7ace119b161f
Create Date: 2024-07-29 08:40:08.330472
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "951141858cff"
down_revision = "caf929e09f7c"
branch_labels = None
depends_on = None
... |
5b9336ba22663f0423a01e243a5087d19730b2baaef4fab3d28742752ed853fa | Python | 726 | 31 | """Tests for specparam.modutils.dependencies."""
from pytest import raises
from specparam.modutils.dependencies import *
###################################################################################################
################################################################################################... |
7504dba3616f416c1400430decdaec0d69082443e9ffcf4fd440af6c1780ada2 | Python | 726 | 28 | # Generated by Django 3.0.4 on 2020-03-22 16:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0060_auto_20200322_1651'),
]
operations = [
migrations.AlterField(
model_name='mushroomspot',
name=... |
b8e0efb1b7c5410f22611c7f9be0d0c57afc19917efddceb2fb2e00929b39a5a | Python | 726 | 28 | # Generated by Django 3.0.4 on 2020-03-24 13:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0062_auto_20200324_1401'),
]
operations = [
migrations.AlterField(
model_name='mushroomspot',
name=... |
fc3f2d6f3e049266651b13cd70bb5edb02ae2986a5a92d53a59885892cf781dc | Python | 726 | 24 | """
Théo Gauvrit
This script contain the tools/utils that are used in other analysis scripts.
Like iterating through a directory ...
"""
import pandas as pd
import os
def browse_directory(directory_path,extension):
"""Browse a directory and read every file with the corresponding extension"""
files = [f for f i... |
0cfbed498c237108910b8536c12653d73a075a2204d961617458234b9b9e185d | Python | 727 | 23 | import sqlite3
from .db import DB
class CumulativeInfoTable(DB):
def __init__(self):
self.table_name = "TN_case_info"
self.table_desc = "Tamil Nadu cumulative info, table 1 on page 1 of bulletin"
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
'date': '... |
36850a1a53a9c8c109930a2d1e119acc41b50f7c905a6a9a9af023906be85419 | Python | 727 | 23 | """Module for gym vector utils."""
from gym.vector.utils.misc import CloudpickleWrapper, clear_mpi_env_vars
from gym.vector.utils.numpy_utils import concatenate, create_empty_array
from gym.vector.utils.shared_memory import (
create_shared_memory,
read_from_shared_memory,
write_to_shared_memory,
)
from gym.... |
52a0ce22402bb671b391cd278c2ab0865d2d5f9d6daf8d4387ef23337f0a026f | Python | 727 | 27 | import pytest
from flask import template_rendered
@pytest.mark.parametrize(
("path", "template_name"),
(
("/", "fetch.html"),
("/plain", "xhr.html"),
("/fetch", "fetch.html"),
("/jquery", "jquery.html"),
),
)
def test_index(app, client, path, template_name):
def check(s... |
7ef38c0aa2271a3494f832b07388a50157c72936a553e800691882ce18e9b866 | Python | 727 | 24 | import pandas as pd
import pmi_tfidf_classifier as ptic
import numpy as np
path = "../data/"
np.random.seed(250)
test_data = pd.read_csv(path + 'AdditionalDILItest.tsv', sep="\t")
train_data = pd.read_csv(path + "DILI_data.csv")
targets_train = train_data['Label'].values
tokenized_texts = ptic.tokenization(train_data... |
b1dfe01417f8a60de5eae9f24f26f254dc66794aff9e911a8cd5bf58f5eaa7f0 | Python | 727 | 25 | 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["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
... |
c936efb8ff455536d3e37776d86f395fbb163eed294ddbba5c800b23aef56105 | Python | 727 | 28 | # UDP
import asyncio
class EchoServerProtocol:
def connection_made(self, transport):
self.transport = transport
def datagram_received(self, data, addr):
message = data.decode()
print('Received %r from %s' % (message, addr))
print('Send %r to %s' % (message, addr))
self... |
dbe09e1d736ae1544c814a1132c44b9cc149fb28f60b6581f277d234dc39f3ea | Python | 727 | 21 | import functools
from django.db import transaction
from celery.app.task import Task
class DjangoTask(Task):
"""
Extend the base :class:`~celery.app.task.Task` for Django.
Provide a nicer API to trigger tasks at the end of the DB transaction.
"""
def delay_on_commit(self, *args, **kwargs) -> No... |
0311247b66af0404bc9180b027c9e7c97427cb7bee4d2f5f59dc8981410a1185 | Python | 728 | 29 | """
Tools for loading data.
The following submodules are available:
eyelink:
Load eyelink ``.edf`` files to datasets. Requires eyelink api available from
SR Research
fiff:
Load mne fiff files to datasets and as mne objects (requires mne-python)
txt:
Load datasets and vars from text files
"""
from ... |
103c367cca01dcab93ec982361618593d4dc0a6e5e610374c668b8a0c6ed727e | Python | 728 | 27 | '''A JSON schema validator for parameters and distributions
Visit https://json-schema.org/understanding-json-schema/ for more information about JSON schemas
'''
import json
from pathlib import Path
import pkg_resources
from jsonschema import validate
SCHEMA_PATH = pkg_resources.resource_filename('tns', 'schemas')
w... |
acaf304cf48dc2b63c851e88a778208a717a0429fba558cc2e4ecaba99676488 | Python | 728 | 32 | import numpy as np
from neuron import h, gui
from neuron.units import ms
def simulate(method, rtol, dt=None):
nseg = 1
s = h.Section()
s.insert(f"{method}_array")
s.nseg = nseg
x_hoc = h.Vector().record(getattr(s(0.5), f"_ref_x_{method}_array"))
t_hoc = h.Vector().record(h._ref_t)
h.std... |
f4b7fa04fca19cd01015446778d074bb83a23f3cb80e62bb87c437c78046e2dc | Python | 728 | 27 | import subprocess
from subprocess import run
import numpy as np
# spring: 974 summer: 610 fall: 1015 winter: 506 sar2opt: 587/ 627
num_test = 627
if __name__ == '__main__':
cmd = "bash Image_translation_codes/ASGIT/run_time.sh"
results = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
... |
f9d0f3c7b802dfd45cf2af222f8e5a8d7e5937da131ed4b8aae3f5cd1e1fd8fa | Python | 728 | 27 | import subprocess
from subprocess import run
import numpy as np
# spring: 974 summer: 610 fall: 1015 winter: 506 sar2opt: 587/ 627
num_test = 610
if __name__ == '__main__':
cmd = "bash Image_translation_codes/MUNIT/run_time.sh"
results = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
... |
8c7e15a275630af436308762ea74b78fa601732ecc8280c750bb09fe8b7ec6b4 | Python | 729 | 22 | import sys
import os
homedir = sys.argv[1]
tmpdir = sys.argv[2]
network = sys.argv[3]
phenotype_name = sys.argv[4]
"""
this makes the features and targets in tmpdir
"""
os.system('python /{0}/preprocess_IndTask.py {1} {2}'.format(homedir,network,tmpdir))
working_dir = homedir + '/results_IndTask/{0}_network/'.format... |
03602a31a807076aa7ed6231b19f55dd24018c61ef5e1d872164074873768ffa | Python | 730 | 24 | from modular_splicing.utils.entropy_calculations import density_for_same_entropy
from .models_for_testing import EndToEndModelsForTesting, STANDARD_DENSITY
# all of these use aat
AM_21_rbns = EndToEndModelsForTesting(
name="AM 21 [rbns]",
path_prefix=f"model/msp-265a1",
seeds=(1, 2, 3),
density=STANDAR... |
16114323d1911d88956f0a9e45d5534ea234bf3b5b9de197d2f8dbb226478827 | Python | 730 | 30 | import pytest
import rpy2.robjects as robjects
rinterface = robjects.rinterface
def test_init():
fml = robjects.Formula('y ~ x')
assert fml.rclass[0] == 'formula'
def test_getenvironment():
fml = robjects.Formula('y ~ x')
env = fml.getenvironment()
assert env.rclass[0] == 'environment'
def tes... |
62913da8a5b25540e5d019748a3ed1dc5b22712a3876d91dc87fc8ff4d1460d5 | Python | 730 | 25 | from setuptools import setup, find_packages
setup(name="eugene-tools", packages=find_packages())
with open("README.md", "r") as readme_file:
readme = readme_file.read()
requirements = []
setup(
name="eugene-tools",
version="0.1.2",
author="Adam Klie",
author_email="aklie@ucsd.edu",
descripti... |
6c5b0079126e76d85007d6aae8b8163906510cd1c18de338ee8c9a4422bf56d0 | Python | 730 | 23 | import pytest
import torch
import pretrainedmodels as pm
# TODO: put "pm_args" into fixture to share with all tests?
pm_args = []
for model_name in pm.model_names:
for pretrained in pm.pretrained_settings[model_name]:
if pretrained in ['imagenet', 'imagenet+5k']:
pm_args.append((model_name... |
7e7b07b25f558bede42faed232fbd2c9be706bb67fee5d11c06220dbdd86b1ef | Python | 730 | 37 | """
Simple example of using UniRes API to preprocess a single image.
Good for testing and debugging.
"""
from nitorch import io
import torch
from unires.struct import settings
from unires.run import preproc
# Parameters
device = 'cuda:0'
pth_x = "./data/t1_icbm_normal_1mm_pn0_rf0.nii.gz"
# Data can be given either a... |
c1291e2bc2952ddcbb54743ff5d32a9ee68e620fc669feabfdaffe31287931e2 | Python | 730 | 18 | from gluoncv.auto.tasks import ImageClassification
import autogluon.core as ag
from nose.tools import nottest
IMAGE_CLASS_DATASET, _, IMAGE_CLASS_TEST = ImageClassification.Dataset.from_folders(
'https://autogluon.s3.amazonaws.com/datasets/shopee-iet.zip')
def test_hybrid_image_classification():
from gluoncv.... |
684f3e29a957342289773f115315ce32e952f252acd4daa7c6cdc37367c64de4 | Python | 731 | 26 | """
This module create TransformerLM
"""
# pylint: disable=W0223
import torch.nn as nn
import torch
class TransformerLM(nn.Module):
"""
This class try to predict true token in the ouput
"""
def __init__(self, transformer_embedder):
super(TransformerLM, self).__init__()
self.transforme... |
a24d67f35fc43a5850a10b96920dda7c24562e84b834b47a8b545aad3c79ccfd | Python | 731 | 24 | import sqlite3
from .db import DB
class CounsellingInfoTable(DB):
def __init__(self):
self.table_name = 'WB_counselling'
self.table_desc = 'West Bengal ambulance and tele-counselling information'
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
'date':... |
3f0593e1a5911a8c6a1a22d5e4eae1112361009c777ed1fd4cfed617a3d55564 | Python | 732 | 29 | # -*- coding: utf-8 -*-
import os
import sys
import mne
start = 40
stop = 390
duration = 200
overlap = 50
def main(subj, task, output_dir):
data_dir = os.path.join(output_dir, subj, 'ica')
raw_fname = os.path.join(data_dir, f'{subj}-{task}-ica-recon.fif')
raw = mne.io.Raw(raw_fname)
for i in range(... |
63db2d07030a8ac173e67f2f0b9538d1974bea85c792109378b5ce2fe1e9c1e7 | Python | 732 | 28 | """
test interaction with the abf epoch object
"""
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
impo... |
cfadf5191c0b8cea028718727d57cf8367b54d1c7e4b3330356ca8ea131f30c2 | Python | 732 | 26 | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 21 22:00:09 2021
@author: adrie
"""
import scipy
import pynapple as nap
import numpy as np
def refineSleepFromAccel(acceleration, sleep_ep):
vl = acceleration[0].restrict(sleep_ep)
vl = vl.as_series().diff().abs().dropna()
a, _ = scipy.signal.find_peaks(vl, 0.025)
... |
d9d37cdda207348e069996767d1901876a323204cbdd5ef341562d9a94fabfd5 | Python | 732 | 23 | #!/usr/bin/env python
import sys
from Bio import SeqIO
from Bio.SeqUtils.ProtParam import ProteinAnalysis
sys.stdout.write("ID\tMW\tIP\tgravy\tlength\tinstability\tmonoisotpoic\tSequence\n")
for record in SeqIO.parse(sys.stdin, "fasta"):
a = ProteinAnalysis(str(record.seq))
properties = list()
properti... |
1a4882293b09d441fbecc9183ed34306edbe22cb2587da48279b565df12197c1 | Python | 733 | 30 | """Top-level package for stLearn."""
__author__ = """Genomics and Machine Learning lab"""
__email__ = "duy.pham@uq.edu.au"
__version__ = "0.4.11"
from . import add
from . import pp
from . import em
from . import tl
from . import pl
from . import spatial
from . import datasets
# Wrapper
from .wrapper.read import Re... |
b8bc31f52b236038c16ce95db5ebf471cdee729940d7d75261958cda20eca02d | Python | 733 | 27 | import subprocess
from subprocess import run
import numpy as np
# spring: 974 summer: 610 fall: 1015 winter: 506 sar2opt: 587/ 627
num_test = 610
if __name__ == '__main__':
cmd = "bash Image_translation_codes/BicycleGAN/run_time.sh"
results = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=T... |
c3d9b4e2c7d7f856ba8ee16ed8f03ab03eeebf6f6af58bdfdaf77fba967ee477 | Python | 734 | 22 | import json
def rename_math_exp(parameters_json, output_dir):
"""
Rename the exp expression with math.exp for Snudda
:param parameters_json:
:param output_dir:
:return:
"""
with open(parameters_json, 'r+') as f:
content = f.read()
f.seek(0)
content = content.replac... |
d0b008bafa766f89eb70683b7adb4f2d927886dfc7f7cf4b5bb016754b97623e | Python | 734 | 29 | #!/usr/bin/env python
'''Given a results.csv file and password for db, put the contents into google sql'''
import sys, re, MySQLdb
import pandas as pd
import makemodel
import numpy as np
conn = MySQLdb.connect (host = "35.196.158.205",user = "opter",passwd=sys.argv[1],db="opt2")
cursor = conn.cursor()
opts... |
120c4e303c41fec53c42d3d9f0184cacf57f82dd73e7333f9f8685a8c8fb712d | Python | 735 | 28 | # Generated by Django 3.0.4 on 2020-03-24 14:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0063_auto_20200324_1402'),
]
operations = [
migrations.AlterField(
model_name='mushroomspot',
name=... |
2358664f6c30edc4a47efbea681e308f5cd10d9e30b52e2929233062f797c3d2 | Python | 735 | 22 | import sys
import os
homedir = sys.argv[1]
tmpdir = sys.argv[2]
network = sys.argv[3]
phenotype_name = sys.argv[4]
"""
this makes the features and targets in tmpdir
"""
os.system('python /{0}/preprocess_SepSampPCA.py {1} {2}'.format(homedir,network,tmpdir))
working_dir = homedir + '/results_SepSampPCA/{0}_network/'.... |
48bb80c8ddcb27a6aad9826e52a247a365d24b628b98701f9c428337504ea890 | Python | 735 | 18 | from typing import Optional
from pytorch_lightning import LightningModule
vae_imagenet2012 = (
"https://pl-bolts-weights.s3.us-east-2.amazonaws.com/" "vae/imagenet_06_22_2019/checkpoints/epoch%3D63.ckpt"
)
cpcv2_resnet18 = "https://pl-bolts-weights.s3.us-east-2.amazonaws.com/" "cpc/resnet18-v6/epoch%3D85.ckpt"
u... |
58bc77dac2159f977fbf747e6f9004c0728aa4b48d3c44d01a8282af222f4c8a | Python | 735 | 29 | import numpy as np
from ripser import lower_star_img
class TestLowerStar:
def test_returns_dgm(self):
img = np.random.random((100, 400))
dgm = lower_star_img(img)
assert isinstance(dgm, np.ndarray)
assert dgm.shape[1] == 2
assert np.all(dgm[:, 1] >= dgm[:, 0])
def tes... |
64d231361d42171526e923d32f9af35952ec49c0ac616ddbe6f571186208cc12 | Python | 735 | 28 | # Generated by Django 3.0.4 on 2020-03-24 13:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0061_auto_20200322_1704'),
]
operations = [
migrations.AlterField(
model_name='mushroomspot',
name=... |
6dedc61cbcb17c2d5cc33bb1d31f505929c88175a3efd09a8e2adb0545bcd037 | Python | 735 | 22 | import sys
import os
homedir = sys.argv[1]
tmpdir = sys.argv[2]
network = sys.argv[3]
phenotype_name = sys.argv[4]
"""
this makes the features and targets in tmpdir
"""
os.system('python /{0}/preprocess.py {1} {2}'.format(homedir,network,tmpdir))
working_dir = homedir + '/results_matchedsamples_081822/{0}_network/'.... |
35301819669b3756b8ed388bb2a8493ff11f1a06fa33313b122234193c51daed | Python | 736 | 26 | import sqlite3
from .db import DB
class CaseInfoTable(DB):
def __init__(self):
self.table_name = 'WB_case_info'
self.table_desc = 'West Bengal case, discharge, and fatality information'
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
'date': 'DATE NOT... |
6008bc463b1b77454b0b54e0f36bb6626aa0429c66b897bc670f8afa8a217228 | Python | 736 | 25 | from setuptools import find_packages, setup
setup(name = 'seqdatasets', packages = find_packages())
with open("README.md", "r") as readme_file:
readme = readme_file.read()
requirements = []
setup(
name="seqdatasets",
version="0.1.2",
author="Adam Klie",
author_email="aklie@ucsd.edu",
descrip... |
12113c75a7b4b98786783c6e20a51987fe812579f026cc53a1907276c8786655 | Python | 737 | 26 | import sqlite3
from .db import DB
class BulletinLinks(DB):
def __init__(self):
super().__init__()
self.table_name = 'Metadata_Bulletin_Links'
self.table_desc = 'Links to health bulletins for all states'
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
... |
60ea8e58479ea6689293790adaaf90b7d7663bcf6f29575c1aa606069c7fd006 | Python | 737 | 28 | import argparse
import numpy as np
import torch
from torchvision import datasets
from torch import nn, optim, autograd
from PIL import Image
from torch.utils.data import Dataset
class cmnist_dataset(Dataset):
def __init__(self, train, transform = None):
self.transform = transform
#self.train_imag... |
e0c056b66f660bbf2e8105282ad48101dde7efcaaefa2b8cfffcf78b9a16cf68 | Python | 737 | 30 | """Illustration of blending methods implemented in impose"""
from impose import flblend
from matplotlib import pylab as plt
import numpy as np
from skimage.draw import disk
fb = flblend.FlBlend()
ax1 = plt.subplot(121, title="RGB blend")
ax2 = plt.subplot(122, title="HSV blend")
for cx, cy, co in [
[200, 200, "#... |
f0b048b525583c2fdaebc1652330aefa7cc358d2391ed55d914bfb0adef7555d | Python | 737 | 20 | # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# 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 app... |
0199983fe5d007984b0a886e512c175c79365a95856451f115cb328c3c147d12 | Python | 738 | 25 | 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.architec... |
3df97ffed1ef175938466ad86c5f8043a55342d955df00f92b342e24a274cbca | Python | 738 | 32 | """
Contains a list of models for testing.
"""
from .spliceai_models import spliceai_400, spliceai_10k
from .main_models import FM, AM, FM_sai, AM_sai
from .lssi_models import LSSI, LSSI_EXTRAS
from .eclip_models import FM_eclip_18
MAIN_MODELS = [
FM,
AM,
FM_sai,
AM_sai,
]
# just here to suppress imp... |
613ce3c5a33bba6f7c0becfa4fcc36d16a9239eafa96cec025c6357a3c3d238c | Python | 738 | 28 | # Generated by Django 3.0.4 on 2020-03-21 14:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0054_mushroomspot'),
]
operations = [
migrations.AddField(
model_name='mushroomspot',
name='descrip... |
71589590b2229230360cca9393598fb61d375b52d9f3aaf6374f0e4baac9a972 | Python | 738 | 25 | 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.architec... |
be19376337205ef16b47ce0f75ac8c033ed0650f3dfbaa40e5c7f97748e10a2e | Python | 738 | 30 | """Utils for random states"""
import os
from datetime import datetime
import random
import logging
import numpy as np
import torch
__all__ = ['seed_all_rng']
def seed_all_rng(seed=None):
"""
Set the random seed for the RNG in torch, numpy and python.
Args:
seed (int): if None, will use a strong... |
fb3a68b0318a1f54a8e0ec0eea31ef0d8f79c626415b6a599442bda98b195cc9 | Python | 738 | 25 | import re
from matplotlib import pyplot as plt
with open("results/predictability_.txt", "r") as f:
results = [re.match("(.*) from (.*) has an R2 of (.*)", line) for line in f.readlines()]
results = [r.groups() for r in results if r is not None]
result_dict = {}
for r_target, r_activity, r2 in results:
if r_... |
0de4552f9dd735b7e88fbb3a6402e0c445ec2c2deca4224a60d554d1d035bd39 | Python | 739 | 30 | 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=... |
3209ab7459538b672d28cf4c4af9dfe05bff847aadc4ff6213937c9025033792 | Python | 739 | 22 | import pytest
import gym
from gym import spaces
from gym.wrappers import ResizeObservation
@pytest.mark.parametrize("env_id", ["CarRacing-v2"])
@pytest.mark.parametrize("shape", [16, 32, (8, 5), [10, 7]])
def test_resize_observation(env_id, shape):
env = gym.make(env_id, disable_env_checker=True)
env = Resiz... |
731a12bc7bd4e2c4319b1ae6e722de18fb1f9326c13d62b1df30dc6f7c8d1162 | Python | 739 | 27 | import subprocess
from subprocess import run
import numpy as np
# spring: 974 summer: 610 fall: 1015 winter: 506 sar2opt: 587/ 627
num_test = 506
if __name__ == '__main__':
cmd = "bash Image_translation_codes/NICE-GAN-pytorch/run_time.sh"
results = subprocess.Popen(cmd, stdout=subprocess.PIPE, s... |
9b2962fca90d52467438a723d109f8f8b7719d77c4c5f4e8f71558ca49fb9bb1 | Python | 739 | 28 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture = dict(
type="SpliceaiAsDownstream",
motif_model_spec=dict(
type="PSAMMotifModel",
motif_spec=dict(type="rbns"),
exclude_names=("3P", "5P"),
),
spliceai_spec=dict(t... |
d9a53df479faf5c5de3e42fe3dcf7a773076388d535715d24aef60ccde54b739 | Python | 739 | 38 | """Math utils."""
from typing import List
import numpy as np
def average_elemwise(arrays: List[np.ndarray], keepdims: bool = False) -> np.ndarray:
"""Return element-wise mean of arrays.
Parameters
----------
arrays : list of ndarrays
List of arrays.
keepdims : bool
Keep dimension i... |
27b4adc06359830f520105c54d55fc34ff900e5e887d3610af36f07d6a59facd | Python | 740 | 22 | import sys
import os
homedir = sys.argv[1]
tmpdir = sys.argv[2]
network = sys.argv[3]
phenotype_name = sys.argv[4]
"""
this makes the features and targets in tmpdir
"""
os.system('python /{0}/preprocess_SES_PFNs.py {1} {2}'.format(homedir,network,tmpdir))
working_dir = homedir + '/results_SES_PFNs/{0}_network/'.form... |
46e47d232057acb0bfc2687714b3506e28375d3171dff65b0805513642bb582c | Python | 740 | 26 | import sqlite3
class DB(object):
def __init__(self):
self.table_name = None
self.table_desc = None
self.cols = None
def create_table(self):
colstr = [f'`{colname}` {coltype}' for colname, coltype in self.cols.items()]
colstr = ', '.join(colstr)
query = f"CREA... |
8216080f60ff8b474023bc31fbacc78fbf0015e1b0de03e3b8af6e034f5710dd | Python | 740 | 26 | from collections.abc import Iterable
from typing import (
TYPE_CHECKING,
)
from galaxy.model import DatasetCollectionElement
from . import BaseDatasetCollectionType
if TYPE_CHECKING:
from . import DatasetInstanceMapping
class ListDatasetCollectionType(BaseDatasetCollectionType):
"""A flat list of named ... |
1190aa9b16c6a6304cec44c8eadff37219116697d4bdae99c50c9264d9a44afb | Python | 741 | 28 | import tensorflow as tf
from codecarbon import EmissionsTracker
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.Flatten(input_shape=(28, 28)),
tf.kera... |
1c4007e03d3a6776c6a199209b9839b6926e4ea7b6d4706a1906893ddcaf0d1a | Python | 741 | 30 | """
This module define MetricAccuracy
"""
import logging
from metrics.generic_metric import GenericMetric
class MetricAccuracy(GenericMetric):
"""
This class define the accuracy metric
"""
def __init__(self):
self.reset_and_init_value()
def update_metric(self, prediction, target):
... |
3939072e1ba66a9c2cb6adab6ae45a1008db178d9bf289b757089031e4e9e3db | Python | 741 | 28 | 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="BothLSSIModelsDummy")
msp.architecture = dict(
type="SpliceaiAsDownstream",
motif_model_spec=msp.architecture["motif_model_spec"],
spliceai_spec=dict(ty... |
6113df43decc8db006f69770008af0cb19d7d43471e9ec0132da7eba421156b7 | Python | 741 | 28 | # Generated by Django 3.0.4 on 2020-03-22 14:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0057_auto_20200322_1502'),
]
operations = [
migrations.RenameField(
model_name='mushroomspot',
old_... |
6d6578d23fcecda7315db92d6ccb8043a7edfae5063b76931413ae73d3ab8648 | Python | 741 | 28 | 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="BothLSSIModelsDummy")
msp.architecture = dict(
type="SpliceaiAsDownstream",
motif_model_spec=msp.architecture["motif_model_spec"],
spliceai_spec=dict(ty... |
7566e9d630e9319c9f7a0e99ceabfca71fd88e5c83807bf2e2fd909b23f6ab88 | Python | 741 | 28 | 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="BothLSSIModelsDummy")
msp.architecture = dict(
type="SpliceaiAsDownstream",
motif_model_spec=msp.architecture["motif_model_spec"],
spliceai_spec=dict(ty... |
9bc39a09c8f89fd07c574c342b417619739a1e4dd19772799c36a85ec86f0ffc | Python | 741 | 15 | PHASE_ORDER = ['sterile', 'roll_in', 'patient_prep', 'knee_prep', 'knee_insert', 'surgery_conclusion', 'roll_out', 'cleanup']
PHASE_LONG_NAMES = ['OR Preparation', 'Patient Roll-In', 'Patient Preparation', 'Surgery 1: Implant Placement Preparation',
'Surgery 2: Implant Placement', 'Surgery 3: Conclu... |
cab411f866db39d685fd62a8ea102db222efbcaee805d46feaa1c0e7aaf5850f | Python | 741 | 28 | 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="BothLSSIModelsDummy")
msp.architecture = dict(
type="SpliceaiAsDownstream",
motif_model_spec=msp.architecture["motif_model_spec"],
spliceai_spec=dict(ty... |
cead956f997925f96b557eec9874c91d07226561f2a0966e6132de41ad46d7a7 | Python | 741 | 23 | from pip._vendor.packaging.version import parse as parse_version
from pip._internal.utils.models import KeyBasedCompareMixin
class InstallationCandidate(KeyBasedCompareMixin):
"""Represents a potential "candidate" for installation.
"""
def __init__(self, project, version, location):
self.project... |
d6cf66016e272bf5c7eadfb64741ab60929d41cba5d7913e4c1c41e49b4fba4d | Python | 741 | 24 | # in the downloaded repertoire files, separate the HIP files to one folder
# and Keck to another
import os
directory = '../../data/emerson_download'
file_list = []
for entry in os.scandir(directory):
file_list += [entry.path]
file_list.sort()
for file_path in file_list:
file_name = file_path.split("/")[-1]... |
e89a1d6cdbd2d2aec4985295df073e156ef5f48ae0f6a79e44f9cc3eb184ce00 | Python | 741 | 26 | import sqlite3
class DB(object):
def __init__(self):
self.table_name = None
self.table_desc = None
self.cols = None
def create_table(self):
colstr = [f'`{colname}` {coltype}' for colname, coltype in self.cols.items()]
colstr = ', '.join(colstr)
query = f"CREA... |
e8af820c1e06eb4da9132c25c0a35ec2281bd7a66faa55128870339dc5bf101e | Python | 741 | 25 | #!/usr/bin/env python
import json
def main():
import sys
if len(sys.argv) < 2:
print("""Usage: {0} path_to_config.json""".format(__file__))
sys.exit(2)
with open(sys.argv[1], "r") as fid:
cfg = json.load(fid)
from projection_voxels import CachedProjections
import mcmodels
... |
0befea0309f338ac4d9f09998810e45d0d883e8d75b4af55018905b1d6832c23 | Python | 742 | 29 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from math import log, sqrt
import numpy as np
from numpy.testing import assert_allclose
from scipy.signal import gaussian
from eelbrain._data_opt import gaussian_smoother
def test_gaussian_smoother():
"Test gaussian_kernel function"
x, y = np.mgrid[:9... |
2b859ca86617cca597fd04981711c707052f33d97a1bbd40748f70d88e2c8d34 | Python | 742 | 21 | def encode(examples, tokenizer=None):
all_encoded_visits = []
for i in range(len(examples['visits'])):
visit_list = examples['visits'][i]
encoded_visits = []
for v in visit_list:
encoded_visit = tokenizer.concepts_to_ids(v)
encoded_visits.append(encoded_visit)
... |
4b9da34d298e3a6e1fcff8e47555e8bb20cc0cbd663ac8b97f698b226d0f61d7 | Python | 742 | 25 | from setuptools import setup, find_packages
setup(name = 'seqexplainer', packages = find_packages())
with open("README.md", "r") as readme_file:
readme = readme_file.read()
requirements = []
setup(
name="seqexplainer",
version="0.1.2",
author="Adam Klie",
author_email="aklie@ucsd.edu",
descr... |
4d74b699ed24b3245ddaf28838e319fa2576aca2d3bfb5546552789365e07d4a | Python | 742 | 25 | import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="config_manager", # Replace with your own username
version="0.0.1",
author="Sebastian Lee",
author_email="sebastianlee.1997@yahoo.co.uk",
description="Configuration manager",
long_descr... |
ca1940892cb7fa94ff03041568499ed49f90384d560c1451fdece57097961ae2 | Python | 742 | 26 | import sqlite3
from .db import DB
class CaseInfoTable(DB):
def __init__(self):
self.table_name = 'KA_case_info'
self.table_desc = 'Karnataka overall case, discharge, fatality info'
self.cols = self.getcolumns()
def getcolumns(self):
cols = {
'date': 'DATE NOT NULL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.