sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
6074c231dbcc1d913c2f122fac0bc88a17351f9c84b293e02f96e48ecc692cdc | Python | 1,202 | 49 | 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... |
f3a4f1245f00630247596c5e36b596727d5da77cc670d40c866521260733428b | Python | 1,202 | 62 | import unittest
from typing import Sequence, Union
import numpy as np
import pytest
import angorapy as ap
from dm_control import mjcf
class _TestTask(ap.tasks.AnthropomorphicEnv):
def _set_default_reward_function_and_config(self):
self.reward_function = lambda x, info: 0
self.reward_config = {}... |
4d07297b72ea5ad1c813e67c080370c816cc96b9003462a6cc004a215abc1d7c | Python | 1,203 | 31 | import functions_common
import functions_2D
import os
import pandas as pd
parameters = functions_common.read_parameters()
print("#"*5,"parameters","#"*5)
print(parameters)
key_file = functions_common.read_key_file(parameters)
print("#"*5,"key_file","#"*5)
print(key_file.head())
print(key_file.keys())
# Do Otsu Thresh... |
431fdee741812079969eb8b0858d9fe62be8d64cdab1bb74c892a13c6ef425af | Python | 1,204 | 29 | """Import helper for pycocotools"""
# NOTE: for developers
# please do not import any pycocotools in __init__ because we are trying to lazy
# import pycocotools to avoid install it for other users who may not use it.
# only import when you actually use it
from __future__ import absolute_import
from ...utils.filesystem... |
995eca981acdac4fe041f934d399c071ee461e70fae950ab0ca960cc746f2863 | Python | 1,204 | 36 | from typing import List
from PIL import Image
from torch import Tensor
from lightly.transforms.vicregl_transform import VICRegLTransform, VICRegLViewTransform
from .. import helpers
def test_view_on_pil_image() -> None:
single_view_transform = VICRegLViewTransform()
sample = Image.new("RGB", (100, 100))
... |
dcbb39f5135e57758644f4b2b6ee2a13557066c7388c6197b863757b2e1109c6 | Python | 1,204 | 44 | import gc
import random
from pytorch_lightning.loggers import WandbLogger
from pytorch_lightning.callbacks import ModelCheckpoint
from pytorch_lightning.utilities.seed import seed_everything
def train(config=None):
with wandb.init(config=config):
config = wandb.config
gc.collect()
torch.c... |
e12c645342395f2187cfc7449b58c00dbb42c677ffa47c1654db222443a532c7 | Python | 1,204 | 44 | #!/usr/bin/env python
# coding: utf-8
# In[3]:
import sys
import argparse
import subprocess
import tempfile
from pathlib import Path
# In[ ]:
parser = argparse.ArgumentParser()
parser.add_argument('bed_1', metavar = '1.bed')
parser.add_argument('bed_2', metavar = '2.bed')
parser.add_argument('-f', type=float, de... |
48e35bb8918b69dcecaaa37f1daa5bea91abd33f7364fa33b485a0ce5b250767 | Python | 1,206 | 42 | from __future__ import annotations
from larvaworld.lib.model.agents._larva import LarvaSegmented
def test_segmented_larva_selection_draws_segments_without_union_shape() -> None:
class _Segment:
def __init__(self, vertices):
self.vertices = vertices
class _Larva:
pass
class _... |
5632c333f8ae30218891a2897c19ad59f17636a8899181deff273658adfe0846 | Python | 1,206 | 47 | # -*- coding: utf-8 -*-
# @Author: gviejo
# @Date: 2022-04-04 22:40:51
# @Last Modified by: gviejo
# @Last Modified time: 2022-08-19 09:06:58
"""Tests of phy loader for `pynapple` package."""
import warnings
import numpy as np
import pandas as pd
import pytest
import pynapple as nap
@pytest.mark.filterwarning... |
edc996729b9842445cd6202714ffbdaeaa405434f6938eb276123fcc12089c62 | Python | 1,206 | 28 | from visualise_test_results import visualise_model_results
model_info = [
("resnet18-0", "ResNet18", True),
("resnet34-0", "ResNet34", True),
("resnet50-0", "ResNet50", True),
("vgg-0", "VGG16", True),
("basic-0", "Simple CNN", True),
("mnasnet-0", "MNASNet", True),
("densenet-0", "DenseNet... |
03fd48a76a202cd2ba79c27fe9c2e1ee23aef0c95ea44177c94eca246031457b | Python | 1,207 | 33 | import unittest
from scipy.stats import norm, multivariate_normal
from numpy import linspace
from .context import densratio
class BasicTestSuite(unittest.TestCase):
"""Basic test cases."""
def test_densratio_1d(self):
x = norm.rvs(size=200, loc=0, scale=1./8, random_state=71)
y = norm.rvs(siz... |
6f465e05e135d9098d90de5d54d3b1b616002611f0b213249f8d8b9791996ff6 | Python | 1,207 | 40 | # 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... |
bfcdf0483ff8d190cc757fa379d9113fa3994ef852010c35e7ac817d046660b8 | Python | 1,207 | 49 | """Image IO.
"""
from typing import Optional
import cv2
from anndata import AnnData
from .image_utils import add_image_layer
def read_image(
adata: AnnData,
filename: str,
scale_factor: float,
slice: Optional[str] = None,
img_layer: Optional[str] = None,
) -> AnnData:
"""Load an image into ... |
f2e13b9a0079877d55dab069f96378d1a7ee0c4e6236f107f84532518a01de9c | Python | 1,207 | 46 | import numpy as np
from numpy import testing as npt
from tns.astrocyte import tmd_utils as _tu
def _barcode():
return [
[230.75389593157917, 174.56457422613303],
[1072.5500821184357, 0]
]
def _barcode_list():
return [
[[230.75389593157917, 174.56457422613303], [1072.5500821184357, 0]],
[[461.... |
75de8b94f6e4157d3125fd74f2c2a28fadfa573e319820d4366e45b87f55fe16 | Python | 1,208 | 38 | import numpy as np
from skimage.draw import polygon2mask
def ellipse(x, y, a, b, phi, shape, scale_x=1, scale_y=1):
xv = np.arange(shape[1]).reshape(1, -1) * scale_x
yv = np.arange(shape[0]).reshape(-1, 1) * scale_y
cos_angle = np.cos(np.pi - phi)
sin_angle = np.sin(np.pi - phi)
xc = (xv - x + .5... |
2ce09d89b5605c6232a155f57dbe2a8e75be0c9d23b1e0ec5058ab0c185fdc5e | Python | 1,209 | 36 | import yaml
import os
import unittest
from config_manager import base_configuration
from config_manager import config_field
from tests.test_templates import test_template_1
FILE_PATH = os.path.dirname(os.path.abspath(__file__))
class TestIntegration(unittest.TestCase):
"""Test class for integration of functio... |
70703e4d6e705592dd3fd4f66ec1635d84179d1f172459b2d0228d845035a8ba | Python | 1,209 | 46 | import json
class Feature(object):
def __init__(self, name, sql_file,
temporal=True, raw_sql=None):
self.name = name
self.sql_file = sql_file
self.temporal = temporal
if not raw_sql:
with open(sql_file, 'r') as f:
raw_sql = f.read()
... |
bb4570fecaebe2c5b40d29e6a219ecdaaec9848c158d77fd0e4674a37fd554ac | Python | 1,209 | 35 | import os
import fnmatch
import numpy as np
from sorting.readSGLX import readMeta, SampRate, makeMemMapRaw, ExtractDigital
import scipy.io
import shutil
from pathlib import Path
def find(pattern, path):
result = []
for root, dirs, files in os.walk(path):
for name in files:
if fnmatch.fnmatc... |
63a93055841a62faa73d8bd3cdbf93d17cd0696ee3bf79eab5319da152138d4d | Python | 1,210 | 33 | import csv
from pandas.core.frame import DataFrame
import pandas as pd
import numpy as np
import random
train_data = open("D:\JWJ\Huangcongcong\Data\\train_data.txt", "w")
vaild_data = open("D:\JWJ\Huangcongcong\Data\\vaild_data.txt", "w")
test_data = open("D:\JWJ\Huangcongcong\Data\\test_data.txt", "w")
... |
c0f04507cd8321618a4eb55fc46b07bf0e6eec0f122a89cc4457beb768258728 | Python | 1,210 | 36 | import numpy as np
import tensorflow as tf
from angorapy.utilities.model_utils import reset_states_masked
import pytest
def test_masked_state_reset():
model = tf.keras.Sequential((
tf.keras.layers.Dense(2, batch_input_shape=(7, None, 2)),
tf.keras.layers.LSTM(5, stateful=True, name="larry", retu... |
d61c80fa6875c0a5b5aa3daf3287e97f7606c9abf0a1e005c103a26a4e647e4f | Python | 1,210 | 40 | """Platform contract of the save-path file fsync helper.
Windows' ``FlushFileBuffers`` (behind ``os.fsync``) needs a handle with write
access: a read-only descriptor fails with ``EBADF``, which made every
``tl.save`` on Windows raise ``TorchLensIOError`` (nightly platform canary,
windows-2025). POSIX ``fsync`` accepts... |
2bd57ed1b87ec20aaa978ec4cf47266447a61f96ecd8ab970c7741781fa16585 | Python | 1,213 | 33 | import numpy as np
import scanpy as sc
from scbig.utils import setup_seed,calculate_metric
import os
for dataset in ['10X_PBMC','mouse_bladder_cell','mouse_ES_cell','human_kidney_counts','Adam','Human_pancreatic_islets','Macosko_mouse_retina']:
setup_seed(0)
dir0 = '../'
method = 'Seurat'
print('------... |
61f914d5a77406b3c9720dd44820c394a130c933aa9271ae5c0b21e0b0dacb07 | Python | 1,213 | 43 | 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"]["motif_width"] = 13
msp.architecture["motif_model_spec"]["motif_feature... |
9da5254642af3378f76568b34c8a8954d0b5246bae1c9668b49dd5b30c064442 | Python | 1,213 | 42 | # skip test: data unavailable
"""Load data from *.sqd file, look for bad channels and filter data"""
import mne
from eelbrain import *
# load the raw data
raw = mne.io.read_raw_kit('Data/R2290_HAYO_P3H_08.26.2015.sqd',
stim_code='channel', stim=range(162, 176),
prelo... |
c4b0c18d2ccbb16702d66126d988736830e3f702ae427aa674ab0d4573ff0de4 | Python | 1,213 | 43 | import dataclasses
import json
import logging
from codecarbon.external.logger import logger
from codecarbon.output_methods.base_output import BaseOutput
from codecarbon.output_methods.emissions_data import EmissionsData
class LoggerOutput(BaseOutput):
"""
Send emissions data to a logger
"""
def __in... |
440a9514f481cb0fbd2e87c06bf59a4f1eb7a4649ef60484b641034f820e7257 | Python | 1,214 | 41 | # Copyright 2021 DeepMind Technologies Limited
#
# 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 agr... |
165067288a45ae091f052511af2da348ece0e93c2432dbc203749edd4c7cd060 | Python | 1,215 | 37 | import lmfit
import numpy as np
def get_parameter_defaults():
"""Return the default model parameters"""
# The order of the parameters must match the order
# of ´parameter_names´ and ´parameter_keys´.
params = lmfit.Parameters()
params.add("E", value=3e3, min=0)
params.add("R", value=10e-6, min... |
16c266583200ada472f3d2a37720df85b5dde889c77d567e80ef4ade192b600a | Python | 1,215 | 33 | # This file is part of MOXελ.
# Copyright (C) 2023 Antonios P. Sarikas
# MOXελ is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This... |
44f22f9260bcad26ffbe7c4fe975af103bee4a08cd6206964d4a4679d085443e | Python | 1,215 | 34 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from torch.optim.lr_scheduler import _LRScheduler
class PolynomialDecayLR(_LRScheduler):
def __init__(self, optimizer, warmup_updates, tot_updates, lr, end_lr, power, last_epoch=-1, verbose=False):
self.warmup_updates = warmup_upda... |
baee64dcfb978a3b049ec4bdc90e8515a3e80a20d34bc272b6156e62ab7c75cc | Python | 1,215 | 46 | """Screenshots for quick guide import ts (not working automatically)"""
import pathlib
import sys
import time
from PyQt5 import QtCore
from PyQt5.QtWidgets import QApplication
from pyjibe.head.main import PyJibe
jpkfile = pathlib.Path("PAAm_Compliant_ROI1_force-save-"
+ "2019.10.25-10.42.02.660... |
cdbb396f9d1ed799403966d049e7007b61d1f04bbbc43a1e9cc2551c5bf20b5e | Python | 1,215 | 39 | import os
import argparse
import torch
from brainbox.physiology import neural
from src import util
# This script computes max cc of each neuron for a given dataset
def main(args):
save_path = f"{args.root}/data/y/"
unit_tensor_name = os.path.join(save_path, f"{util.get_dataset_y_name(args.dataset, args.spl... |
f323afec72db53af56ce4918f850be244091d49e0e75aaa2d2693bc3c6a2a634 | Python | 1,215 | 40 | import numpy as np
import tensorflow as tf
from tensorflow.keras.models import load_model
from gradient_accumulator import GradientAccumulateModel
from gradient_accumulator import GradientAccumulateOptimizer
from .utils import get_opt
from .utils import normalize_img
from .utils import reset
from .utils import run_ex... |
1276808744497b2c35384680ff49f516ee731798e6f385a1b738657a74a81200 | Python | 1,216 | 45 | def resturcture_file(bedFile, outfile):
o_bed = open(bedFile)
o_out = open(outfile, 'w')
for line in o_bed:
split_line = line.strip().split('\t')
peak_info = split_line[3].split('.')
new_line = '\t'.join(split_line[0:3]+[peak_info[1].upper()]+split_line[4:]+[peak_info[0], peak_i... |
50df169aee188b05a9b69b326f271846bcd3a76ceb0c77f19d1ddf9d9a37ce38 | Python | 1,216 | 40 | # -*- coding: utf-8 -*-
# @Author: gviejo
# @Date: 2022-08-24 15:16:57
# @Last Modified by: gviejo
# @Last Modified time: 2022-08-24 17:03:58
import numpy as np
from matplotlib.pyplot import *
from scipy.io import loadmat
import pynapple as nap
from numba import jit
# LOAD THE DATA
stim = np.squeeze(loadmat('dat... |
1145fc3bc63287bc1f6d3230d60d3247e2d784450b290037e958bbea53fce083 | Python | 1,217 | 48 | import numpy as np
def regress(x_label, x, y, ax, *, scatter_kwargs):
"""
Plot a scatter plot of x vs y, and then fit a line to the data and plot it.
Ignores any data point where x or y is NaN.
Parameters
----------
x_label : str
The label for the x-axis.
x : np.ndarray
T... |
2bc258de511247af3184a2c12d3c60bb41f263d3ee877445db0c01f9e13f7856 | Python | 1,217 | 37 | """This script increases the minor version of the current project."""
import os
def nextVersionString(oldVersionString):
oldVersion = oldVersionString.split(".")
assert len(oldVersion) == 3
oldVersion = [int(x) for x in oldVersion]
return "%d.%d.%d" % (oldVersion[0], oldVersion[1], oldVersion[2] + 1)... |
541e85b7fa6db0a5024e1b7d4ce0ddedd1b09adcd3e8ace08b4a68f8437a9fb6 | Python | 1,217 | 51 | '''Utilities for searchlight analysis.'''
__all__ = ['get_neighbors']
import numpy as np
def get_neighbors(xyz, space_xyz, shape='sphere', size=9):
'''
Returns neighboring voxels (cluster).
Parameters
----------
xyz : array_like, shape=(3,) or len=3
Voxel XYZ coordinate in the center ... |
84d2cab8a343cb81f1fba5a3fcac50ec857319648c57b0d948742ffd99cf43b8 | Python | 1,219 | 47 | #from cox_nnet_v2 import *
import numpy
import sklearn
import sklearn.model_selection
import pandas as pd
import time
import dill
from sklearn.preprocessing import MinMaxScaler
d_path = "BRCA/"
#x = numpy.loadtxt(fname=d_path+"259p_phenotypic27.csv",delimiter=",",skiprows=1)
#x = numpy.loadtxt(fname=d_path+"259p_mic... |
b38fb3382b7fbff2e9b99ac3c7be5a0aebbaa412e5402dea4b292faa82dd9bc8 | Python | 1,219 | 27 | """Collection of PyTorchLightning callbacks."""
from pl_bolts.callbacks.byol_updates import BYOLMAWeightUpdate
from pl_bolts.callbacks.data_monitor import ModuleDataMonitor, TrainingDataMonitor
from pl_bolts.callbacks.printing import PrintTableMetricsCallback
from pl_bolts.callbacks.sparseml import SparseMLCallback
fro... |
b60f99a930904d7c083497683f711634825ea8c492abe1a102ad4d406dd3e0d4 | Python | 1,219 | 45 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-02-07 14:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0011_upload_parameters'),
]
operations = [
migrations.AddFie... |
8017ed13af59cbca5dc5403df0cf23bb6bc95d33020a202a7271c59aabcb0161 | Python | 1,220 | 44 | import numpy as np
import torch
import torch_geometric
from torch_geometric.data import Data
from data_loading.loading_utils import train_scaler, scale_dataset, select_target_id
TARGET_ID_TO_PROPERTY = {
0: 'dipole_moment',
1: 'isotropic_polarizability',
2: 'homo',
3: 'lumo',
4: 'gap',
5: 'el... |
895ecabb3170611dcc758ed4108ec74f3eb858f0c141fcafeb1cf25ed24303bf | Python | 1,220 | 35 | try:
import pytabprops
import unittest
from os.path import join, abspath
from numpy.testing import assert_allclose
from tests.tabulation.turb_adiabatic_unreacted.rebless import run
from spitfire.chemistry.library import Library
from spitfire.chemistry.ctversion import check as cantera_vers... |
3ff3916314c5be41f51790b09c6e2e0d59f1d2db2f427bc2aa16a8e555924fa0 | Python | 1,221 | 39 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._domain import Domain
from ._hoverlabel import Hoverlabel
from ._insidetextfont import Insidetextfont
from ._leaf import Leaf
from ._legendgrouptitle import Legendgrouptitle
from ._marker import Marker
from ._outsidetextfon... |
eb9eb1c19df520251e1a22168d03c6f0e5d2381756ea2af776c014c786264fea | Python | 1,222 | 43 | 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... |
63fede643aca5c5d32b6e8aaef743ba62086d715f2f4545d67db81474a52ebcb | Python | 1,223 | 33 | from os.path import abspath, join
def run():
from spitfire.chemistry.mechanism import ChemicalMechanismSpec
from spitfire.chemistry.tabulation import build_adiabatic_slfm_library
import spitfire.chemistry.analysis as sca
import numpy as np
test_xml = abspath(join('tests', 'test_mechanisms', 'h2-b... |
6b36fdfdaa2d2ab5de743cdc0312dbfd044b7c15da55b82e5f4eea3732e89a0d | Python | 1,223 | 34 | """Tests for the xcp_d.interfaces.execsummary module."""
import os
import nibabel as nb
from xcp_d.interfaces import execsummary
def test_plotslicesforbrainsprite(datasets, tmp_path_factory):
"""Test the PlotSlicesForBrainSprite interface."""
tmpdir = tmp_path_factory.mktemp('test_generate_confounds')
... |
849c5037e8aa119439d789f1522d50c0a9c10f14f5a956f6c9530790b7ee2283 | Python | 1,223 | 30 | import os
from codecarbon.external.logger import logger
def warn_on_multi_rank_double_counting(tracking_mode: str) -> None:
"""
Warn when a machine-mode tracker runs on a non-zero SLURM local rank.
In ``machine`` mode every tracker reports the whole node's power, so if
more than one rank per node st... |
d1ccdbb6cf365f673b14ce0a5d75f1caf090042dd7b15a1e07aa9667c236573e | Python | 1,223 | 57 | import os
import sys
import ssl
import urllib
import zipfile
import os.path as osp
from typing import *
def download_url(
url: str,
folder: str,
filename: Optional[str] = None
):
"""function to download the qm9 data from url
Args:
url (str): url where qm9.zip is located
fo... |
895a80af73ba597d9a78b36fc2c112e99f676b52ad4d204b89c2f4a87eeac003 | Python | 1,224 | 46 | """Screenshots for quick guide import ts (not working automatically)"""
import pathlib
import sys
import time
from PyQt6 import QtCore
from PyQt6.QtWidgets import QApplication
from pyjibe.head.main import PyJibe
jpkfile = pathlib.Path("PAAm_Compliant_ROI1_force-save-"
+ "2019.10.25-10.42.02.660... |
90f48d8f309d1a3ac54ffccf2eb292a6a0a70f06bac41bac34966e85250377d0 | Python | 1,224 | 41 | import torch.nn as nn
from modular_splicing.models.modules.sparsity.sparsity import SparseLayer
class DropMotifsIn(SparseLayer, nn.Module):
"""
Drop the given motifs after running the given sparse layer.
"""
def __init__(self, sparse_layer, dropped_motifs):
super().__init__()
self.sp... |
be590c903b45171d5d3d693ea5fa55d34d6e46afd43a8daa6b0699295d1191e5 | Python | 1,224 | 39 | """
Example setup file for a project using Celery.
This can be used to distribute your tasks and worker
as a Python package, on PyPI or on your own private package index.
"""
from setuptools import find_packages, setup
setup(
name='example-tasks',
url='http://github.com/example/celery-tasks',
author='Ol... |
4035b8952dfddb4d41c47a3db4c245b591b40f7b3885ed5527054d39816618db | Python | 1,225 | 31 | from typing import List, Union
import jax
import jax.numpy as jnp
def gen_data_x(key: jnp.ndarray, n_points: int, n_dim: int, n_classes: int, sigmas: Union[List[float],jnp.ndarray], means: jnp.ndarray = None, vec=False):
"""
Generate random sample data from multivariate normal distributions.
:param key: P... |
c3dea822129d97dab3ad1a1259b2b4ca1b7bfad849bd9a33ed716d6938ea19f3 | Python | 1,225 | 33 | import pytest
import numpy as np
from causal_optoconnectics.cch import correlogram
def test_correlogram():
t1 = np.arange(0, .5, .1)
t2 = np.arange(0.1, .6, .1)
limit = 1
bin_size = .1
counts_true = np.array(
[0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, 0, 0, 0])
counts, bins = ... |
6109acabbd608de837e4fa9c44c5f936fb1d3d61421cb77153cba61edd57be0a | Python | 1,226 | 42 | def main(splash=True):
import importlib.resources
import sys
from PyQt6.QtWidgets import QApplication
from PyQt6.QtCore import QEventLoop
app = QApplication(sys.argv)
if splash:
from PyQt6.QtWidgets import QSplashScreen
from PyQt6.QtGui import QPixmap
ref = importlib.r... |
a7d28601d2f40bbe304d376543b8f95aa5d8ea2609d91d1dbc2f1069cccd9381 | Python | 1,226 | 41 | from sklearn.feature_selection import SelectKBest
from sklearn.pipeline import Pipeline
from pmsurv.models.weibull_nn import WeibullModelNN
from skopt.space import Real, Categorical, Integer
import utils
def preprocess_data(dataset, config):
X = dataset[config['features']]
y = dataset[[config['outcome']['time... |
fc3b42f50c07e5df8ab3a8ac6be7ac4c0700a744ea3bf00f1e4b394ba264f9cf | Python | 1,226 | 36 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
project... |
42c3aa8b10c07d01f4331510816587aeb098fa311c59bd2bde7711636075c8d4 | Python | 1,227 | 41 | import os
from setuptools import setup, find_packages
path = os.path.abspath(os.path.dirname(__file__))
try:
with open(os.path.join(path, 'README.md'), "r", encoding='utf-8') as f:
long_description = f.read()
except Exception as e:
long_description = "scBiG for representation learning of single-cell g... |
349c4cdb7186d802b7b26b99886599b362bc033f25f639309d59e0467501a03a | Python | 1,228 | 52 | """Use the top-level ``tl.do`` shortcut.
What this demonstrates
----------------------
``tl.do(log, ...)`` forwards to ``log.do(...)`` for concise one-shot
interventions.
How to run
----------
``python examples/intervention/16_pearl_style_tl_do.py``
Runnable by default.
"""
from __future__ import annotations
impor... |
4f98f8ea9efbdeed4a3d644ee88e149731f9a98875b9237e61d99f2f267d2381 | Python | 1,228 | 43 | import numpy as np
import matplotlib.pyplot as plt
from rectipy import FeedbackNetwork
# build network
###############
# initialize network
dt = 1e-2
net = FeedbackNetwork(dt, "cuda:0")
# add two nodes p1 and p2
N = 100
k = 10.0
neuron = "neuron_model_templates.spiking_neurons.lif.lif"
net.add_diffeq_node("p1", nod... |
2b87f4a158e72fd458bf27af960a60497a6a3bc98017ca21e81363b13a71dfeb | Python | 1,229 | 28 | import unittest
import tempfile
from svim.SVIM_input_parsing import guess_file_type, parse_arguments
class TestInputParsing(unittest.TestCase):
def test_guess_file_type(self):
fasta_paths = ["/test/path/test.file.fa", "/test/path/test.file.fasta", "/test/path/test.file.FA"]
fastq_paths = ["/test/... |
07b1c0126b08659b695b334ceea910b4c674f0adad90099836699e1940547afa | Python | 1,230 | 31 | """Stock job 'dynamic' rules for use in the job config file - these may cover some
simple use cases but will just proxy into functions in rule_helper so similar
functionality - but more tailored and composable can be utilized in custom
rules.
"""
from typing import TYPE_CHECKING
from galaxy import util
if TYPE_CHECK... |
1316b34f7b6e6d60fcf5d837a5ca20715d43e4758c9ab785fe4f7ae518bf9456 | Python | 1,230 | 41 | import pathlib
import numpy as np
import pytest
import zarr
from ome_zarr.format import CurrentFormat
from ome_zarr.io import parse_url
from ome_zarr.reader import Multiscales, Reader
class TestUpgrade:
@pytest.fixture(autouse=True)
def initdir(self, tmpdir):
self.path = pathlib.Path(tmpdir.mkdir("d... |
ba19851767db001b33e17270e74dfb23739dbff981c069dc0d5a5377d5e8b621 | Python | 1,230 | 42 | """preferred_object_store_ids
Revision ID: 9540a051226e
Revises: d0583094c8cd
Create Date: 2022-06-10 10:38:25.212102
"""
from sqlalchemy import (
Column,
String,
)
from galaxy.model.custom_types import JSONType
from galaxy.model.migrations.util import (
add_column,
drop_column,
transaction,
)
... |
250dfad61cb3d6865153c3431fac3dcda8ad946fc8583f67881c568014a39162 | Python | 1,231 | 33 | '''
Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands
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 requir... |
81638c5d5c9686574d28ad472349a2bd8209afdf1c263c1c9f82e434bc01c30e | Python | 1,231 | 41 | """Script to create a short csv file with carbon intensity data.
Uses csv from https://ourworldindata.org/grapher/carbon-intensity-electricity.
"""
import argparse
import pycountry
import pandas as pd
def country_to_alpha2(name):
try:
return pycountry.countries.get(name=name).alpha_2
except Exceptio... |
2d9edb7e1a1d4c3af5516ba285aeb9bd1cd02ebe39e8f642ffc48180cfddc331 | Python | 1,232 | 41 | # Copyright (c) 2022 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... |
381cc2c208a00e96454f1efee943d3239594b2e18ddb78c6f857f15a6911760b | Python | 1,232 | 31 | import requests
import progressbar
from os import path, makedirs
from .io import open_remote, path_exists_remote, is_remote_path
SIMPLE_BAR = ['Progress ', progressbar.Bar(), ' ', progressbar.Percentage(), ' completed']
def maybe_download(archive_name, target_dir, archive_url):
# If archive file does not exist, ... |
34eed5f61875f710e5d2db1ccfbf494c2f1f229d927cf10b73d615de9af685b9 | Python | 1,233 | 53 | import tensorflow as tf
# define the custom theta functions
@tf.custom_gradient
def theta_forget(x):
def grad(dy):
return dy * 0
return tf.cast(x >= 0, tf.float32), grad
def get(surrogate, beta):
if surrogate == "flat":
@tf.custom_gradient
def theta_flat(x):
def grad... |
b78a13ae20457beffaa091b076f8079a539591f6256630dfbbdd88fc1f033a6a | Python | 1,233 | 36 | import warnings
import pytest
from conftest import to_backend
from pyriemann.geometry.distance import distance_riemann
from pyriemann.geometry.geodesic import geodesic_logchol
from pyriemann.geometry.mean import mean_riemann
from pyriemann.geometry.tangentspace import log_map_riemann, exp_map_riemann
def _to_torch(... |
d71f34ce753e6818d3f5abfd6bfdabd62b13ca200b8bfa3177cecddb57363528 | Python | 1,233 | 54 | import numpy as np
from numpy import testing as npt
from tns.astrocyte import point_array as _pa
def _create_dynamic_array():
initial_capacity = 3
resize_factor = 2
array = _pa.DynamicPointArray(initial_capacity, resize_factor)
return array
def test_dynamic_point_array_contructor():
array = ... |
f5d49a50d999baf278134be190eb4bf51a825a06215f501fc4c00392705cdbd5 | Python | 1,233 | 43 | # coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... |
0651467bceedf0ef8edafbcf6c518b160935f68e003cc2796601cd364c3a2426 | Python | 1,234 | 43 | 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["motif_model_spec"]["motif_... |
4fd7db12c3e9968a8f655319cf68f53628b1e4174a09c4cceaeb0864f704461c | Python | 1,234 | 43 | 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["motif_model_spec"]["motif_... |
547e179f7689f1893b24974d7fe836710daa21c679216e0ccf4e3507c4067ae9 | Python | 1,234 | 43 | 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["motif_model_spec"]["motif_... |
f68c41561eda16a28b570db7225d3619ad783b54cf6b2ae9c2599926f6e6d64f | Python | 1,234 | 43 | 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["motif_model_spec"]["motif_... |
0bde32be71e20f61f2fe9de641b80e6ad61264c96a333292827af236b141f3ca | Python | 1,235 | 34 | import sqlite3
from .db import DB
class CaseInfoTable(DB):
def __init__(self):
self.table_name = 'PB_mucormycosis_cases'
self.table_desc = 'Mucormycosis daily cases and cumulative information. Table on the second last page of bulletins since June 2021.'
self.cols = self.getcolumns()
... |
2804cf80906a3a2607cc9e5a2d6c3d3ab9433b2a9847a38cb9dbdf1fa9c4f1e0 | Python | 1,235 | 43 | 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["motif_model_spec"]["motif_... |
2d194de4c273289cbc7f6a95dd190966da92909e9d1c49ced6a1a20ea1e4ffa6 | Python | 1,235 | 43 | 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["motif_model_spec"]["motif_... |
2dcdd1cdafa99b54ea26104001ec74998023dc212ed369eebb0be3193d6205c9 | Python | 1,235 | 36 | import yaml
def main(trans, webhook, params):
data = {}
data["tools"] = []
unique_tools = []
tools = trans.app.toolbox.tools()
for tool in tools:
try:
ts_data = tool[1].tool_shed_repository.to_dict()
panel = tool[1].get_panel_section()
except AttributeErro... |
465383d54bde86c82368fdb94a7c2a5f9eb37dde026d4c9e729ceecfc5ebd997 | Python | 1,235 | 30 | import torch
import torch.nn as nn
import torch.nn.init as init
def initialize_weights(net_l, scale=1):
if not isinstance(net_l, list):
net_l = [net_l]
for net in net_l:
for m in net.modules():
if isinstance(m, nn.Conv2d) or isinstance(m, nn.Conv3d):
init.kaiming_no... |
7e1ef347c170acee9270dd642714d83e32f59855adfae795d8a70f6535a70a85 | Python | 1,235 | 43 | 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["motif_model_spec"]["motif_... |
a5629ec671c6942e2013a32fdab44a5bcee82fea136f7817031187f317317efb | Python | 1,235 | 44 | """
Unit tests for larvaworld.lib.sim.agent_simulations.
Keep these tests light: validate imports and basic dataframe/index construction
without running heavy simulations.
"""
import pandas as pd
import pytest
from larvaworld.lib.sim.agent_simulations import sim_model, sim_multi_agents
@pytest.mark.fast
def test_s... |
276d035286a2cac144b6f48ac2b619c8239c1122434c02cb40a0a09f667442da | Python | 1,236 | 31 | """Tests for specparam.plts.annotate."""
from specparam.tests.tutils import plot_test
from specparam.tests.tsettings import TEST_PLOTS_PATH
from specparam.plts.annotate import *
###################################################################################################
#######################################... |
28ee0a0d2071abfccb604c9f38f5851af102fb2b778497acd9b589e081870c75 | Python | 1,236 | 43 | 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["motif_model_spec"]["motif_... |
be721ba93bbfccf7dcc85ada4e881c0b30584b66fb30b601081fcee10647228e | Python | 1,236 | 43 | 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["motif_model_spec"]["motif_... |
d723d0e3397cc7eb309ccc8c49909ffa2c8ba44a2a14635c4dc9f57451526310 | Python | 1,236 | 34 | """This module contains one line functions that should, by all rights, be in numpy.
"""
import numpy as np
## Demean -- remove the mean from each column
demean = lambda v: v-v.mean(0)
demean.__doc__ = """Removes the mean from each column of [v]."""
dm = demean
## Z-score -- z-score each column
def zscore(v):
s = v.s... |
62bbcfcb60679b09875689e9b72f79e847985bf8ea100ddcfa52d84f1facedcd | Python | 1,237 | 60 | import numpy as np
from neuron import gui, h
from neuron.units import ms
# Test the accuracy of the simulation output to the analytical result
nseg = 1
s = h.Section()
s.insert("leonhard")
s.nseg = nseg
s.c_leonhard = 0.005
v_hoc = h.Vector().record(s(0.5)._ref_v)
t_hoc = h.Vector().record(h._ref_t)
h.stdinit()
h.... |
56307c1e977aa2fc4bf577e08cd705066f4d942a4f91b5dc8e427c872e333c50 | Python | 1,239 | 29 | from typing import Dict
import numpy as np
from tqdm import tqdm
def get_smiles_features(self, drug_to_smiles: Dict[str, str], test_drug_to_smiles: Dict[str, str]) -> Dict[str, np.array]:
charset = sorted(set("".join(list(drug_to_smiles.values()))+"!E?"))
embed = max([len(smile) for smile in {**drug_to_smiles... |
59d14cc914e9f438ac754f6b790c009a1df857f0c0b2cfc3f3c6a6c673e9e537 | Python | 1,240 | 59 | __author__ = 'quentin'
import numpy as np
import matplotlib.pyplot as plt
from sklearn.cluster import MeanShift, estimate_bandwidth
np.random.seed(seed=5)
arr = np.random.uniform(size=(100,100))
arr = arr > 0.5
#arr[ 10:90,5:70] = 0
xy = np.where(arr)
pts = np.column_stack(xy)
X= pts
bandwidth = estimate_ba... |
74f66e0a8b2078ced557f69c47f212d4b8f245a4156266f613306799b50df885 | Python | 1,240 | 37 | import unittest
import numpy as np
import torch
from modular_splicing.models.lssi import AsymmetricConv, SplicePointIdentifier
from parameterized import parameterized
class AsymmetricConvWindowTest(unittest.TestCase):
@parameterized.expand(
[(left, right) for left in (2, 4, 6, 8) for right in (2, 4, 6, ... |
2baef1db03d536a2dd28c42d2fbdd9578f95f86405c7beb58b38cf89bc867df6 | Python | 1,241 | 40 | 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"]["motif_width"] = 13
msp.architecture["motif_model_spec"]["motif_feature... |
65d557cb903797cc583afb3d2d2f359357aeecc9ba7e88c220684f69d40fc102 | Python | 1,241 | 38 | from galaxy import model
from .types import (
BaseDatasetCollectionType,
paired,
paired_or_unpaired,
record,
sample_sheet,
)
from .types.list import ListDatasetCollectionType
PLUGIN_CLASSES: list[type[BaseDatasetCollectionType]] = [
ListDatasetCollectionType,
paired.PairedDatasetCollectionT... |
721af61f181bc0e1f5202c34be0cf374547f3065b17924493ef78bec8ea82168 | Python | 1,241 | 39 | import sys
from ij import IJ
# Fiji Jython interpreter implements Python 2.5 which does not
# provide support for argparse.
input_file = sys.argv[-7]
iterations = int(sys.argv[-6])
count = int(sys.argv[-5])
black_background = sys.argv[-4] == "yes"
pad_edges_when_eroding = sys.argv[-3] == "yes"
output_filename = sys.a... |
85ce9bc01ef7346e8d53242405e616247ec647c9ea64b799f23a9c4cb97d09eb | Python | 1,241 | 40 | 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"]["motif_width"] = 13
msp.architecture["motif_model_spec"]["motif_feature... |
f84317aae1a79cc20db2320c8ea80291f52a9bb4eee2f5e7ada47811871aa3cb | Python | 1,241 | 38 | # %%
import pandas as pd
from globals import subjects, path, sessions
import os
# load all_conserved_spots
all_conserved_spots = pd.read_csv(f"{path}/all_conserved_spots.csv")
# %% Master arm
path_to_save = f"../../data/spots_locations/per_participant"
for subject in subjects:
spots = {}
for session in sessio... |
92d88294ce65b50001e779afa5ff683f00663c87428b3b8c07f71e26115bb3b8 | Python | 1,242 | 40 | import os
import pandas as pd
import pytest
from larvaworld.lib.process import read_timeseries_from_raw_files_per_parameter
from larvaworld.lib import reg
from larvaworld import DATA_DIR
pytestmark = [pytest.mark.integration, pytest.mark.fast]
@pytest.fixture
def tracker():
labID = "Jovanic"
return reg.con... |
0d743ae21d6d65d7b79c7847c5012c9c0953229722a33d21feb7051db2710c76 | Python | 1,243 | 42 | """
Author: Derek van Tilborg -- TU/e -- 20-06-2022
Script for processing all raw data used for the benchmark
"""
import pandas as pd
import os
from tqdm import tqdm
from MoleculeACE.benchmark.data_prep import split_data
from MoleculeACE.benchmark.data_fetching import fetch_chembl
SIMILARITY = 0.9
POTENCY_FOLD = 10... |
4085031b78b7352cbf4ad6331770c03b016f0aba3db8c2650d1a569d459171b5 | Python | 1,243 | 39 | import sys, os
import collections
def get_intron_pos(homer_out_ann, homer_intron_annotataion_file):
c = collections.defaultdict(list)
with open(homer_out_ann) as f:
for line in f:
line = line.strip().split('\t')
chr_id = str(line[1])
pos = str(line[2])
strand = line[4]
region = line[7]
... |
578de129bed513f69b619bda3be4e924b394eb99fa5b766b7581c61771b7a94b | Python | 1,243 | 39 | from __future__ import annotations
import os
DIR = os.path.abspath(os.path.dirname(__file__))
def get_include(user: bool = False) -> str: # noqa: ARG001
"""
Return the path to the pybind11 include directory. The historical "user"
argument is unused, and may be removed.
"""
installed_path = os.p... |
b20e700d2fa54c2f57a80166341debc80042cb977950d600c200af445d58499f | Python | 1,243 | 40 | from collections.abc import Callable
from dataclasses import dataclass
import numpy as np
import torch
from torch import nn
from neurogym.wrappers.components.modules.base import LayerProbeBase
@dataclass
class RNNLayerProbe(LayerProbeBase):
layer: nn.RNN
@staticmethod
def layer_types() -> set[type[nn.M... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.