sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
02a7e8d8a7e664a1fb3b6666fc8499b0f8de66aa5e0e43f4f529123ee710c301 | Python | 490 | 13 | # Config for SmoothNet filter trained on Human3.6M data with a window size of
# 32. The model is trained using root-centered keypoint coordinates around the
# pelvis (index:0), thus we set root_index=0 for the filter
filter_cfg = dict(
type='SmoothNetFilter',
window_size=32,
output_size=32,
checkpoint='... |
195992590569caeb0c9c6ec89b1c60e11da83de5485875710459f4fcbb3c676a | Python | 490 | 21 | # .mat data are saved in (root_ws+expname+'data/matdata/')
# .pth data will be saved in (root_ws+expname+'data/')
# model will be saved in (root_ws+expname+'model/')
# results will be saved in (root_ws+expname+'results/')
## Define working path
expname = 'demo/'
root_ws = '~/' # file for saving intermedi... |
44552fddda54a849bfef56e5bc0ad482cd739f097802acc489441d79943884fc | Python | 490 | 13 | # Config for SmoothNet filter trained on Human3.6M data with a window size of
# 64. The model is trained using root-centered keypoint coordinates around the
# pelvis (index:0), thus we set root_index=0 for the filter
filter_cfg = dict(
type='SmoothNetFilter',
window_size=64,
output_size=64,
checkpoint='... |
4a3916f8ca5f9f0fc6e052d093c901fdf7035121549c1dca3b0a924a21f951a8 | Python | 490 | 13 | # Config for SmoothNet filter trained on Human3.6M data with a window size of
# 16. The model is trained using root-centered keypoint coordinates around the
# pelvis (index:0), thus we set root_index=0 for the filter
filter_cfg = dict(
type='SmoothNetFilter',
window_size=16,
output_size=16,
checkpoint='... |
9ddfb8bfb50c28b6f2ea6fd3e68382a687154504e7a8626a98ad412665481478 | Python | 490 | 22 | import matplotlib
import typing
matplotlib.use('Agg')
from matplotlib import colors
from matplotlib import pyplot as plt
__all__ = ["plt", "colors", "set_figure_size", "get_figure_size"]
__figsize: typing.Optional[typing.Tuple[float, float]] = None
def set_figure_size(figsize: typing.Optional[typing.Tuple[float,... |
52c2e26ff5819dc5af4f47df8b999ff4aa09ff3042a07ee9b9b28432bbf83fb4 | Python | 491 | 16 | iteration_list = []
loss_list = []
f_read = open("1203", 'r')
f_write = open("DOL-id1203-group_id16-n512-symm1-tu512-td0-lr0.3.txt", 'w+')
iteration_index = 0
data_points = f_read.readlines()
for i in range(len(data_points)):
if data_points[i][0:6] == 'regret':
temp_data = data_points[i].strip('\n').split... |
2e57285a760acf8d5b1e583021b3e533150f4907f5f6e3f92d8e55fd03becb9e | Python | 492 | 14 | """scikit-speech version information.
We use semantic versioning (see http://semver.org/).
Additionally, '-dev' will be added to the version unless the code base
represents a release version. Commits for which the version doesn't have
'-dev' should be git tagged with the version.
"""
name = "skspeech"
version_info = ... |
90114212c4bb3120022a2ad04a5c3c4e7a2f126f2e188aa2a9b4246c0448f35e | Python | 492 | 17 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
"""
Neural ODEs for sampling.
"""
from sbi.samplers.ode_solvers.base import NeuralODE, NeuralODEFunc
from sbi.samplers.ode_solvers.ode_builder import bui... |
c84590d8ae5c41083be89727aa35b41cbaca124e2cac4ef66980be9bc78b08fe | Python | 492 | 22 | from pybrid.split_scripts import main
from pybrid.config import default_cfg as cfg
cfg.exp.log_dir = "results/hybrid_split"
cfg.exp.num_batches = 3000
cfg.exp.batches_per_epoch = 100
cfg.exp.test_hybrid = True
cfg.exp.test_amort = True
cfg.data.train_size = None
cfg.data.test_size = None
cfg.infer.num_train_iters = ... |
66ef7567dad6f981c21dba35750cd0e4e0e81b14ba54848aa78753e75f515d42 | Python | 493 | 13 | """
This module provides different approaches for a strategic selection of optimal oligo sets for genomic regions, focusing on efficiency and scoring.
"""
from ._oligo_selection_base import BaseOligoSelection
from ._oligo_selection_homogeneous_properties import HomogeneousPropertyOligoSelection
from ._oligo_selection_... |
ec2b719b907ced70e5b8fa8da359ecb83da2bab4711c5bd7d949dd341be2695e | Python | 493 | 27 | """
geNomad: Identification of mobile genetic elements
"""
from genomad.modules import (
aggregated_classification,
annotate,
download,
find_proviruses,
marker_classification,
nn_classification,
score_calibration,
summary,
)
__author__ = "Antonio Camargo"
__version__ = "1.13.0"
__all__... |
5482610d6f30e216700db7314e24513796d6c1115d31a07d1cc7bcb7c437742b | Python | 494 | 16 | iteration_list = []
loss_list = []
f_read = open("707", 'r')
f_write = open("PUSHSUM-id707-group_id11-n1024-symm0-tu32-td32-lr0.7.txt", 'w+')
iteration_index = 0
data_points = f_read.readlines()
for i in range(len(data_points)):
if data_points[i][0:6] == 'regret':
temp_data = data_points[i].strip('\n').sp... |
8259ebd5fa94f6a1a9934b91cd721e777ec18291bed365d88cce030026b5083f | Python | 494 | 19 | theRunNum = int(var.argvAfterDoubleDash[0])
read("../d.nex")
d = Data()
t = func.randomTree(taxNames=d.taxNames)
t.data = d
t.newComp(free=1, spec='empirical')
t.newRMatrix(free=1, spec='ones')
t.setNGammaCat(nGammaCat=1)
#t.newGdasrv(free=1, val=0.5)
t.setPInvar(free=0, val=0.0)
m = Mcmc(t, nChains=4, runNum=theRunNu... |
97cbc7fc0ff0a2072147b474f29287ee264cf0e1b5162e3ad40addd86acfcb53 | Python | 494 | 15 | # -*- coding: utf-8 -*-
"""
Aliases for easier compatibility with the SNF toolbox written in Matlab
"""
from . import compute as _compute, metrics as _metrics
affinityMatrix = _compute.affinity_matrix
B0normalized = _compute._B0_normalized
Cal_NMI = _metrics.v_measure_score
Concordance_Network_NMI = _metrics.nmi
Esti... |
b1303f55ccb85ae2c5bbbb996efec96211f3511ae68f0181dde1ad6c1f3fd925 | Python | 494 | 16 | iteration_list = []
loss_list = []
f_read = open("701", 'r')
f_write = open("PUSHSUM-id701-group_id11-n1024-symm0-tu32-td32-lr0.1.txt", 'w+')
iteration_index = 0
data_points = f_read.readlines()
for i in range(len(data_points)):
if data_points[i][0:6] == 'regret':
temp_data = data_points[i].strip('\n').sp... |
296c4e4af6cdebec9fe58f1cff87b6f5ae97c6d546d3e2554fa3fe3559dabcb5 | Python | 496 | 19 | nTax = 7
taxNames = list(string.ascii_uppercase[:nTax])
a = func.newEmptyAlignment(dataType='dna', taxNames=taxNames, length=511)
d = Data([a])
t = func.randomTree(taxNames=taxNames)
t.data = d
t.newComp(free=0, spec='specified', val=[0.1, 0.2, 0.3])
t.newRMatrix(free=0, spec='specified', val=[2., 3., 4., 5., 6., 7.]... |
6bd100d3ba1f4f958fe0a9d4c2b06a6f49e8add36280e9d4db9bfb4aa90f5977 | Python | 496 | 18 | # Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta, abstractmethod
class BaseBBoxCoder(metaclass=ABCMeta):
"""Base bounding box coder."""
def __init__(self, **kwargs):
pass
@abstractmethod
def encode(self, bboxes, gt_bboxes):
"""Encode deltas between bboxes and g... |
f4d01ba8ba6fe6530b4f175b015e495bc6076b852ce352be10a9a3999a007efb | Python | 497 | 16 | iteration_list = []
loss_list = []
f_read = open("1101", 'r')
f_write = open("PUSHSUM-id1101-group_id15-n512-symm0-tu200-td200-lr0.1.txt", 'w+')
iteration_index = 0
data_points = f_read.readlines()
for i in range(len(data_points)):
if data_points[i][0:6] == 'regret':
temp_data = data_points[i].strip('\n')... |
ce198657793b60a1a34384ff7ae16834daf0ccefba0c00b270a4937685a0f50d | Python | 498 | 16 | # Copyright (c) OpenMMLab. All rights reserved.
from ..builder import DETECTORS
from .cascade_rcnn import CascadeRCNN
@DETECTORS.register_module()
class HybridTaskCascade(CascadeRCNN):
"""Implementation of `HTC <https://arxiv.org/abs/1901.07518>`_"""
def __init__(self, **kwargs):
super(HybridTaskCasc... |
71d6d0a4785c1a174244f70922c2fc837518e1b3bedcd6fac75f4038fb09f43f | Python | 504 | 24 | from distutils.core import setup
requirements = [
"numpy",
"networkx",
"pandas<=1.5.3",
"torch<=2.0",
"pytorch-lightning<=1.9.5",
"shap",
"matplotlib",
"plotly",
]
setup(
author="Erik Hartman",
author_email="erik.hartman@hotmail.com",
name="binn",
version="0.0.2",
p... |
4296a6b2fe3acaa0b55fb8b9ffcd2e414eff40109ea205691cf863b104045776 | Python | 505 | 13 | from ptflops import get_model_complexity_info
from fedml_api.model.cv.cnn import CNN_DropOut
if __name__ == "__main__":
# net = CNN_OriginalFedAvg()
net = CNN_DropOut()
flops, params = get_model_complexity_info(net, (1, 28, 28), as_strings=True,
print_per_lay... |
ea5d7a36354af54e10374ef364f560ef5026107d9377955da37ca9de90fc17de | Python | 505 | 12 | # Copyright (c) OpenMMLab. All rights reserved.
from .onnx_helper import (add_dummy_nms_for_onnx, dynamic_clip_for_onnx,
get_k_for_topk)
from .pytorch2onnx import (build_model_from_cfg,
generate_inputs_and_wrap_model,
preprocess_example_inp... |
18df8015e453482aef065b07938982cde5afc93d8958a7d13211d81a1f85a897 | Python | 507 | 13 | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 9 18:20:43 2021
@author: fhu14
"""
from .training_loop import training_loop
from .util import write_output_skf, write_output_lossinfo, exclude_R_backprop,\
check_split_mapping_disjoint, sort_gammas_ctracks, charge_update_subroutine
from .repulsive_training_only impo... |
b9748fd177f7b8154611bbff71287d3ee3c2c1e766f65cf4312b22fd09c28012 | Python | 507 | 22 |
class MyMessage(object):
"""
message type definition
"""
# server to client
MSG_TYPE_S2C_INIT_CONFIG = 1
MSG_TYPE_S2C_GRADIENT = 2
# client to server
MSG_TYPE_C2S_LOGITS = 3
MSG_ARG_KEY_TYPE = "msg_type"
MSG_ARG_KEY_SENDER = "sender"
MSG_ARG_KEY_RECEIVER = "receiver"
... |
fa147eb78ffd109cd4ab18050a9daf07a724b52c04d2f39d3342dd197255c321 | Python | 507 | 17 | from setuptools import setup
setup(
name="admUI",
version="1.0",
description="This package provides functions to compute the function UI introduced in by Bertschinger et al. [\"Quantifying unique information\", Entropy 2014, 16(4), 2161-2183].",
author="Pradeep Banerjee",
author_email="Pradeep.Bane... |
5584cc68b706b47f95d76f4c4f8211ed36d8b69f895dccab12676f448dc09aa8 | Python | 509 | 15 | import tensorflow_federated as tff
def download_and_save_federated_cifar100():
cifar100_train, cifar100_test = tff.simulation.datasets.cifar100.load_data(cache_dir='./')
"""
#with Tensorflow dependencies, you can run this python script to process the data from Tensorflow Federated locally:
python dataset... |
dc9f2488dc73686b709e05ef7d43af4aded9ff64455df9d594c67c4dcf544906 | Python | 510 | 20 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 30 15:44:35 2021
@author: ravinderjit
"""
import numpy as np
def mseqXcorr(epochs,mseq):
#epochs in shape channels x trials x time
resp_m = epochs.mean(axis=1)
resp_m = resp_m - resp_m.mean(axis=1)[:,np.newaxis]
Ht_m = np.zeros([re... |
2a1994cbe0e8d0413a847008c8e3d365d8be6a8a9d6af507af8bed1ed77dae80 | Python | 515 | 15 | from pathlib import Path
input_path = Path(snakemake.input[0])
with open(snakemake.output[0], "w") as fout:
for genome_path in input_path.iterdir():
count = 1
genome = genome_path.stem
with open(genome_path) as fin:
for line in fin:
if line.startswith(">"):
... |
4ecfcbdb8f94c39192a62b92f6fc9b14aa4e0b743a1cf33594082088a1a3c668 | Python | 515 | 21 | read("../d.nex")
d = Data()
t = func.randomTree(taxNames=d.taxNames)
t.data = d
t.newComp(free=1, spec='empirical')
t.newRMatrix(free=1, spec='ones')
t.setNGammaCat(nGammaCat=1)
t.setPInvar(free=0, val=0.0)
m = Mcmc(t, nChains=1, runNum=0, sampleInterval=10, checkPointInterval=2000)
# Set up a strong prior on polytomi... |
b75633027b1d059ab68dd01f3991ed8ac1d802fc9ac4b593f2d7f163af1fe4f0 | Python | 517 | 18 | ############### Configuration file for Bayesian ###############
layer_type = 'lrt' # 'bbb' or 'lrt'
activation_type = 'softplus' # 'softplus' or 'relu'
priors={
'prior_mu': 0,
'prior_sigma': 0.1,
'posterior_mu_initial': (0, 0.1), # (mean, std) normal_
'posterior_rho_initial': (-5, 0.1), # (mean, std... |
09dd065491e3ddad5d9fcc117f45953f069b6254c4f26e74c925e69b3ca0b123 | Python | 519 | 14 | import tensorflow_federated as tff
def download_and_save_federated_shakespeare():
shakespeare_train, shakespeare_test = tff.simulation.datasets.shakespeare.load_data(cache_dir='./')
"""
#with Tensorflow dependencies, you can run this python script to process the data from Tensorflow Federated locally:
python ... |
b2383c5dead1cd66daf73ee4dde560fa890361281649fe15b52ea02bd84f7332 | Python | 519 | 27 | from abc import abstractmethod
from .message import Message
from .observer import Observer
class BaseCommunicationManager(object):
@abstractmethod
def send_message(self, msg: Message):
pass
@abstractmethod
def add_observer(self, observer: Observer):
pass
@abstractmethod
def... |
632148a26454328efd95652fdebcd68e2ae3e538d6b9e18da8dd97a9ca254367 | Python | 523 | 18 | from __future__ import print_function, absolute_import
__all__ = ['accuracy']
def accuracy(output, target, topk=(1,)):
"""Computes the precision@k for the specified values of k"""
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct =... |
83bff4ffb87479e1c93104bd8e77f50c534cb5ad34816085520324fc84f46d11 | Python | 524 | 14 | # Copyright (c) OpenMMLab. All rights reserved.
from .bbox_head import BBoxHead
from .convfc_bbox_head import (ConvFCBBoxHead, Shared2FCBBoxHead,
Shared4Conv1FCBBoxHead)
from .dii_head import DIIHead
from .double_bbox_head import DoubleConvFCBBoxHead
from .sabl_head import SABLHead
from .... |
90bb122c2ab38a7993fb2a2dfcd53e65d979f13a922967cbfbbe34ba745b164c | Python | 524 | 21 | """__init__.py
This file is part of keras2c
Copyright 2020 Rory Conlin
Licensed under LGPLv3
https://github.com/f0uriest/keras2c
"""
from .keras2c_main import k2c
from .types import Keras2CConfig, LayerIO
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
__author__ = "Rory Conlin"
__copyright__ = "Copyright 2019, ... |
5f441e7d84a5bf8676fbff1059fc7392b89db44f5df0ee558807abdda26a85cc | Python | 528 | 24 | import pandas as pd
import numpy as np
from moleculekit.molecule import Molecule
import sys
import os
import matplotlib.pylab as plt
import yaml
plt.ion()
conf = yaml.load(open(sys.argv[1], "r"), Loader=yaml.FullLoader)
df = pd.read_csv(os.path.join(conf["log_dir"], "monitor.csv"))
df.plot(x="ns", y="etot")
df.plot(... |
1118282a45617c8ce158d75474ea1faa560c8ab143e1ad3e3fe44ab76f309ff2 | Python | 529 | 18 | from setuptools import setup, find_packages
setup(
name='AmpUMI',
version='1.0.0',
description='Design and analysis of unique molecular indentifiers for deep amplicon sequencing',
url = 'https://github.com/pinellolab/AmpUMI.git',
author='Kendell Clement',
author_email = 'k.clement.dev@gmail.co... |
1c06915738b25d5a5c4e7140eeb3e3cf00c076d93927e89b92f78d2be3c8da00 | Python | 529 | 20 | # Copyright (c) OpenMMLab. All rights reserved.
import logging
from mmcv.utils import get_logger
def get_root_logger(log_file=None, log_level=logging.INFO):
"""Get root logger.
Args:
log_file (str, optional): File path of log. Defaults to None.
log_level (int, optional): The level of logger.... |
43a616d9546366a2bbe95b4672254d3449eb8473872113beb6648698af4968c9 | Python | 529 | 19 | # Copyright (c) OpenMMLab. All rights reserved.
__version__ = '2.19.0'
short_version = __version__
def parse_version_info(version_str):
version_info = []
for x in version_str.split('.'):
if x.isdigit():
version_info.append(int(x))
elif x.find('rc') != -1:
patch_version... |
048b4ee1cfd2734f67c3d175be6f8593f94600df683e2217840d02675fb1ac12 | Python | 530 | 18 | from .common_func import window_image
class Windowfilter:
def __init__(self, window_center, window_width):
"""
Just select one channel for labels. For instance, from (X, Y, Z, 3) to (X, Y, Z).
"""
self.window_center = window_center
self.window_width = window_width
def... |
85420770fd5dbaab083b505a5661b56c035401bbac755f2d9790a73a76ac2a4c | Python | 530 | 19 | # Copyright (c) Open-MMLab. All rights reserved.
__version__ = '0.29.0'
short_version = __version__
def parse_version_info(version_str):
version_info = []
for x in version_str.split('.'):
if x.isdigit():
version_info.append(int(x))
elif x.find('rc') != -1:
patch_versio... |
4b5318493712c69e54b1d168d98d6e5ed78d38164dacabf6f2649abecf30a02e | Python | 536 | 14 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 7 20:02:46 2021
@author: fhu14
"""
from .batch import Batch, DFTBList, get_model_str, RawData, Model, RotData,\
create_batch, create_dataset
from .util import np_segment_sum, maxabs, list_contains, paired_shuffle, \
convert_key_to_num
from .dftb_layer_splines im... |
785d6cf94cbbec177a16760ea9bafe40a254e0199563b3bde3e7a3e0545b159c | Python | 536 | 18 | import glob
import os
import pandas as pd
import numpy as np
empiar_ids = ['11057', '10576']
# empiar_ids = ['10576']
for m in range(len(empiar_ids)):
project_dir = '/bml/CryoEM/CryoEM_Final_Dataset/' + empiar_ids[m] + '/ground_truth'
xyz = glob.glob(project_dir + '/particle_coordinates/*.csv')
df = pd... |
6112c9012016f74230eecbf9e6ad8be9afa2ab2ec2148a2b60a3eab19363083e | Python | 537 | 20 | checkpoint_config = dict(interval=10)
log_config = dict(
interval=50,
hooks=[
dict(type='TextLoggerHook'),
# dict(type='TensorboardLoggerHook')
# dict(type='PaviLoggerHook') # for internal services
])
log_level = 'INFO'
load_from = None
resume_from = None
dist_params = dict(backend... |
774a96532666a495dfc5094673141db0e5e771ddbc31c33b08d5db1a8b1e4c3b | Python | 537 | 16 | import torch
def binary_dice_loss(score, target, misc):
target = target.view(-1).float()
score = score.view(-1).float()
# print(f"after sigmoid,max:{score.max()},min:{score.min()}")
# assert score.max()==1,"score max should be 1"
# assert score.min() == 0, "score min should be 0"
smooth = 1e-5... |
444a79e2a29e9269a64b5285bc7830c7d06a686acdedd8ef552197d5d7504328 | Python | 540 | 24 | import numpy as np
import scipy.sparse
import scipy.sparse.linalg
def calc_inv(x: np.ndarray, y: np.ndarray, w: np.ndarray) -> np.ndarray:
assert x.shape == y.shape == w.shape
assert len(x.shape) == 1 or x.shape[0] == 1 or x.shape[1] == 1
w_ = scipy.sparse.diags(w)
x_ = np.zeros(shape=(x.size, 2))
... |
ec80ddc2b8b37da79b8abdc2e4e8797b5fe02e1a5990ece1a0790fdc9f409b16 | Python | 540 | 13 | # Copyright (c) OpenMMLab. All rights reserved.
from .checkloss_hook import CheckInvalidLossHook
from .ema import ExpMomentumEMAHook, LinearMomentumEMAHook
from .sync_norm_hook import SyncNormHook
from .sync_random_size_hook import SyncRandomSizeHook
from .yolox_lrupdater_hook import YOLOXLrUpdaterHook
from .yolox_mode... |
023c9e69ef0de008ec5e5ab865b773f5b36d6dad57d6b8a05553e2e2a71d5eff | Python | 542 | 10 | import pandas as pd
df = pd.read_csv(r'V:\foodsec\Projects\SNYF\SIDv\TN\SF\NO_SF_baseline\Tuning_data\Multiple_WC-Tunisia-ASAP.csv')
# df = pd.read_csv(r'V:\foodsec\Projects\SNYF\SIDv\TN\SF\SF\Tuning_data\TN_WC_ecmwf_extraction_results_full_archive_e_means.csv')
df["date"] = pd.to_datetime(df["date"]).dt.strftime("%Y... |
7daa4f69b7f9ee62955937ef489952997076aac8c0c0c0557d8416f51a7e1f54 | Python | 545 | 25 | #!/usr/bin/env python3
from flystim.stim_server import launch_stim_server
from flystim.screen import Screen
from time import sleep
import sys
def main(stim_name):
manager = launch_stim_server(Screen(fullscreen=False, server_number = 0, id = 0, vsync=False, square_loc=(-1.0, -1.0), square_size=(0.25, 0.25)))
... |
ac5016b4df259f2de16b749e75b0b049da87115ac946643b1ab09b5713388282 | Python | 546 | 24 | from setuptools import setup
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
setup(
name='tempotron',
version='0.0.1',
description='Fork of a tempotron implementation.',
long_description=readme,
author='Daniel Müller-Komorowska',
author_em... |
fb35702c4952a3c20e49646b573400179af6afc1d196e967a0926884ec163471 | Python | 548 | 25 |
class MyOVBox(OVBox):
def __init__(self):
OVBox.__init__(self)
def initialize(self):
# nop
return
def process(self):
for chunkIdx in range( len(self.input[0]) ):
chunk = self.input[0].pop()
if(type(chunk) == OVStimulationSet):
for stimIdx in range(len(chunk)):
stim=chunk.pop()
prin... |
ebbed5a9d9c8e75c48856bfe848174fd6f193b6645c4c83b87e4c290457a413f | Python | 549 | 25 |
class MyOVBox(OVBox):
def __init__(self):
OVBox.__init__(self)
def initialize(self):
# nop
return
def process(self):
for chunkIdx in range( len(self.input[0]) ):
chunk = self.input[0].pop()
if(type(chunk) == OVStimulationSet):
for stimIdx in range(len(chunk)):
stim=chunk.pop();
pri... |
34e0fff05086e5d01855433ffd2902ff66fff093cd1f56b96a0510905c5ebed0 | Python | 550 | 17 | #path = "../experiment_result_in_the_paper/2-SUSY-beta0/"
iteration_list = []
loss_list = []
f_read = open("471", 'r')
f_write = open("PUSHSUM-id471-group_id8-n128-symm0-tu16-td16-lr0.4.txt", 'w+')
iteration_index = 0
data_points = f_read.readlines()
for i in range(len(data_points)):
if data_points[i][0:6] == 'reg... |
a6376b967f5ca61f13126f6d1c982e4dcf2d1c0b6fa28b8fe9dc54b1ea8787ed | Python | 552 | 21 | import numpy as np
from tensorflow.keras.utils import to_categorical
# -----------------------------------------------------------------------
def add_one_hot(regions):
"""
Add one hot encoded region information
INPUT:
-regions: region ID
OUTPUT:
-new_X: correspondi... |
b9100af5e9d4b08482d785c977dfa2d5e605ea2eb2fc2bdd4e53a803b7fc8ebe | Python | 556 | 21 | var.warnReadNoFile = 0
var.verboseRead = 0
read('d.nex')
d = Data()
taxNames = list(string.ascii_uppercase[:5])
read('((A, B), C, (D, E));')
read('((D, E), B, (C, A));')
read('((C, E), (B, D), A);')
for i in range(len(var.trees)):
var.trees[i].name = 't%i' % (i + 1)
for t in var.trees:
t.taxNames = taxNames
... |
e7c6842e19ce07ee0b39282347229c0cb780607f06c87e08fad16cef7a408d73 | Python | 557 | 21 |
class NormalizeMinmax(object):
"""Normalize a tensor volume given min and max value.
:param min
:param max
"""
def __init__(self, min, max, training=True):
self.min = min
self.max = max
self.training = training
def __call__(self, sample):
image, mask, misc = ... |
e6c2d22a7131688ed52197d53ffafc16baaec162c7a2eb2ec6117ece82c15cd9 | Python | 559 | 23 | # Make a consensus tree, with variations.
mySkip = 500
tp = TreePartitions("mcmc_trees_0.nex", skip=mySkip)
# read another file
tp.read("mcmc_trees_1.nex", skip=mySkip)
t = tp.consensus()
# Re-root
t.reRoot(t.node('myOutTaxon').parent)
# Collapse poorly supported nodes
toCollapse = [n for n in t.iterInternalsNoRoot... |
4353469b5f905f03f53634f8464bd9808df0fc8244c7d6009da302e7af729da4 | Python | 560 | 21 | ############################################
# imports
############################################
from typing import Literal
############################################
# types
############################################
_TYPES_REF = Literal["fasta", "vcf"]
_TYPES_FILE = Literal["gff", "gtf", "fasta"]
_TYPES_FIL... |
03d4825902d2496e02255623e2248edbeccc30d9447e0ee2c13f6ea6314cc7b2 | Python | 561 | 18 | # Copyright (c) OpenMMLab. All rights reserved.
from ..builder import DETECTORS
from .single_stage import SingleStageDetector
@DETECTORS.register_module()
class GFL(SingleStageDetector):
def __init__(self,
backbone,
neck,
bbox_head,
train_cfg=No... |
653e5e2be631f4bafabb99906aa73e071f5877a0e05cd5e24ce15ba8b01341b6 | Python | 562 | 17 | #path = "../experiment_result_in_the_paper/2-SUSY-beta0/"
iteration_list = []
loss_list = []
f_read = open("PUSHSUM-id707", 'r')
f_write = open("PUSHSUM-id707-group_id11-n1024-symm0-tu32-td32-lr0.7.txt", 'w+')
iteration_index = 0
data_points = f_read.readlines()
for i in range(len(data_points)):
if data_points[i][... |
7ce6b3d9abbef762fdaffd4314ac3bc2cf039149e754201c5597e4c5c4e3f3e0 | Python | 563 | 12 | # Copyright (c) OpenMMLab. All rights reserved.
from .inference import (async_inference_detector, inference_detector,
init_detector, show_result_pyplot)
from .test import multi_gpu_test, single_gpu_test
from .train import (get_root_logger, init_random_seed, set_random_seed,
t... |
7a218645a326fbe1fcef895df5f566fc10ac5e57dac418fe26852f409cf1ed07 | Python | 564 | 30 | # Copyright (C) 2022-2025 ETH Zurich, Marc Lehner and other DASH contributors.
"""Unit and regression dev for the serenityff package.
Test most fundamental functionality of package
"""
import sys
import pytest
import serenityff
def test_test() -> None:
with pytest.raises(AssertionError):
assert False
... |
f19f28389c8b39e566dc23d9530b1509afffc4fd639d69b1f3caf94ce53308d2 | Python | 565 | 18 | from preprocess.brain_ct_preprocessing.save_dcm_data import window_image
class Windowfilter:
def __init__(self, window_center, window_width):
"""
Just select one channel for labels. For instance, from (X, Y, Z, 3) to (X, Y, Z).
"""
self.window_center = window_center
self.w... |
f51be78f9031531e6c8fd298dcdbec0dc07277761c979a7a9fb94c7d9e5d361d | Python | 568 | 19 | # Copyright (C) 2024-2025 ETH Zurich, Niels Maeder and other DASH contributors.
"""Testing `serenityff.charge.utils.io`."""
from pathlib import Path
from serenityff.charge.utils import command_to_shell_file
def test_command_to_shell_file(tmp_path: Path) -> None:
"""Test `command_to_shell_file`.
Args:
... |
6a71bfef704c20db3cdced2b884a59e956c7495ff6fb77963d0b87326575b774 | Python | 569 | 13 | import os
import shutil
i=0
for root,dir1,filename in os.walk("D:\Tuo\yolov5-cell\detect/files/"):
for index in range(len(filename)):
if os.path.splitext(filename[index])[1]=='.jpg':#这里注意filename是个元组,splitext方法的时候只能是字符串
i+=1
root1="D:\Tuo\yolov5-cell\detect\input/"
... |
574354da079013da1bfa6d8437dfa36f7e8e5f79970509753688efabdd34790b | Python | 570 | 23 | from sklearn.preprocessing import scale
import numpy as np
def preprocess(X, method):
"""Apply selected data preprocessing step to a Numpy array
or Pandas dataframe"""
if method == 'scale':
if hasattr(X, 'iloc'):
return scale_df(X)
return scale(X)
elif method == 'log':
... |
9dc6f760f71cf754abba4b2666ea2d0a08552af6ebc084acebf5194e1eb46e49 | Python | 571 | 17 | var.warnReadNoFile = 0
var.verboseRead = 0
read('((D:0.4, E:0.3):0.03, B:0.5, (C:0.3, A:0.4):0.03);')
taxNames = list(string.ascii_uppercase[:5])
var.alignments.append(func.newEmptyAlignment(dataType='dna', taxNames=taxNames, length=500))
d = Data()
t = var.trees[0]
t.data = d
t.taxNames = taxNames
t.newComp(partNum=0... |
396adc7e5d92b0abfe038c7055ebfaa1f826b19796afd20dfdc54448f1ff69e2 | Python | 574 | 17 | read('t.nex')
t = var.trees[0]
var.alignments.append(func.newEmptyAlignment(dataType='dna', symbols=None, taxNames=t.taxNames, length=1000))
d = Data()
t.data = d
c1 = t.newComp(free=1, spec='specified', val=[0.1, 0.2, 0.3])
c2 = t.newComp(free=1, spec='specified', val=[0.4, 0.3, 0.1])
t.setModelComponentOnNode(c1, no... |
093151913e36c3dda5dafbf63d4586a593cde4344748959921177e7fcb532172 | Python | 575 | 17 | import torch
from loss.lib.Losses import DiceLoss
def dice_lossv3(input, target):
"""
input is a torch variable of size BatchxnclassesxHxW representing log probabilities for each class
target is a 1-hot representation of the groundtruth, shoud have same size as the input
"""
target = target.unsqu... |
24e4faac67c441aa89debd9ee5f8865a741ba8790524fe8cafb4d9cae3eb8960 | Python | 576 | 15 | import latentvelo.models
from latentvelo import ev
from latentvelo import tl
from latentvelo import pl
import latentvelo.utils
from latentvelo.trainer import train_vae, set_adj, plot_history
from latentvelo.trainer_nogcn import train_vae_nogcn
from latentvelo.trainer_anvi import train_anvi
from latentvelo.trainer_anvi_... |
7242159f76b379297d9736e222bca7bfa7374eaf45e4203e0d33fd05214268d0 | Python | 576 | 22 | read('../../noTRuberNoGapsNoAmbiguities.nex')
d = Data()
read('../../tt.nex')
for t in var.trees:
t.data = d
c1 = t.newComp(free=1, spec='empirical')
c2 = t.newComp(free=1, spec='empirical')
t.newRMatrix(free=1, spec='ones')
t.setNGammaCat(nGammaCat=4)
t.newGdasrv(free=1, val=0.5)
t.setPInv... |
dc17ee8974989436bb2beb82a17cd8760ef3cbdde3832120c21c3170cf638237 | Python | 576 | 15 | import http.server
import os
class MyHttpRequestHandler(http.server.SimpleHTTPRequestHandler):
def end_headers(self):
self.send_header("Cross-Origin-Embedder-Policy", "require-corp")
self.send_header("Cross-Origin-Opener-Policy", "same-origin")
http.server.SimpleHTTPRequestHandler.end_head... |
278c675a38a4a45974104d8d5b527ff37d900a540752343f955ce39debff2ee2 | Python | 577 | 19 | # Copyright (c) OpenMMLab. All rights reserved.
from ..builder import BBOX_CODERS
from .base_bbox_coder import BaseBBoxCoder
@BBOX_CODERS.register_module()
class PseudoBBoxCoder(BaseBBoxCoder):
"""Pseudo bounding box coder."""
def __init__(self, **kwargs):
super(BaseBBoxCoder, self).__init__(**kwargs... |
8593701eab8e19ae75c9a1a4bc3e1881c3909e625e5fe298ab1bf8ac9b886626 | Python | 577 | 23 | var.verboseRead = 0
var.warnReadNoFile = 0
if 1:
read('((A, B), C, (D, E));')
read('((A, B), D, (E, C));')
read('((C, A), (D, B), E);')
taxNames = list(string.ascii_uppercase[:5])
theSplitTax = ['A', 'C']
else:
taxNames = list(string.ascii_uppercase[:7])
for i in range(30):
var.tree... |
312bb1e9445770bf70affe7272fc83bc540cd2e582fc0915f6fe51811dbe8cbf | Python | 578 | 16 | import sys
if sys.version_info[:2] >= (3, 8):
# TODO: Import directly (no need for conditional) when `python_requires = >= 3.8`
from importlib.metadata import PackageNotFoundError, version # pragma: no cover
else:
from importlib_metadata import PackageNotFoundError, version # pragma: no cover
try:
#... |
25678fc6316950eb595d082f73911b33d169480a68dfd7c12dc0eda4c44398bf | Python | 580 | 30 | # -*- coding: utf-8 -*-
"""
Exceptions
=======
This module contains custom exceptions.
author: Damian Wilary
email: dmw51@cam.ac.uk
"""
class BaseRDEException(Exception):
"""
Base exception class
"""
class NoArrowsFoundException(BaseRDEException):
"""
Raised when no arrows have been found in an ... |
6daf2d444b21e21989ffac6a89ee1422eb2ded970586f3cc2ce11c1424f2eb12 | Python | 580 | 28 | import numpy as np
import pandas as pd
import json
from utils import functions_ZZ_extraction as loadzz
def load_df_bout_all(path):
return pd.read_pickle(path)
def load_ta(path):
return np.load(path+'/tail_angle.npy')
def load_zz_output(path):
with open(loadzz.load_zz_results(path)) as f:
supst... |
c32c0808374322bce4a9987392b27226fa2843ac482d93c990efc6cfb8cd758a | Python | 582 | 23 | class MyMessage(object):
"""
message type definition
"""
# server to client
MSG_TYPE_S2C_INIT_CONFIG = 1
MSG_TYPE_S2C_SYNC_MODEL_TO_CLIENT = 2
# client to server
MSG_TYPE_C2S_SEND_MODEL_TO_SERVER = 3
MSG_TYPE_C2S_SEND_STATS_TO_SERVER = 4
MSG_ARG_KEY_TYPE = "msg_type"
MS... |
959238030e4d56801f20598b36f352e269d6063431321171e6b82732ed901923 | Python | 583 | 19 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
from mmcv.utils import Registry, build_from_cfg
PRIOR_GENERATORS = Registry('Generator for anchors and points')
ANCHOR_GENERATORS = PRIOR_GENERATORS
def build_prior_generator(cfg, default_args=None):
return build_from_cfg(cfg, PRIOR_GENERATORS, de... |
dc7c9e491c9ecf803f055245271d47e1c59d0bb27bac0c3f320594849859d8d3 | Python | 584 | 14 | #os.system("rm -f mcmc*")
# (self, inTrees, modelName='SR2008_rf_aZ', beta=1.0, stRFCalc='purePython1', runNum=0, sampleInterval=100, checkPointInterval=None)
# Choose one of these, the fastest available
myCalc='purePython1'
myCalc='bitarray'
#myCalc='fastReducedRF'
read('inTrees.phy')
stm = STMcmc(var.trees, modelN... |
698bc778665352c58ac713e1d9bb19f0a5e57b82a8eed0642f83a01b02a9730a | Python | 589 | 21 | read('paupConTree.nex')
t = var.trees[0]
# The only point of the data is to get a taxNames list.
read('d.nex')
d = Data()
t.taxNames = d.taxNames
t.readBipartitionsFromPaupLogFile('paupLog')
# The support gets put in node.br.support, as a float from 0-1. To
# see it in a drawing or write it in newick format, we mov... |
d88b2aac374cf776516373db979f081a9b7e3ee21e2ca1dbe24f7026ff56c9ad | Python | 592 | 13 | with open(snakemake.output[0], "w") as fout:
with open(snakemake.input[0]) as fin:
for line in fin:
line = line.split()
qoffset = int(line[0].rsplit("_", 1)[1])
toffset = int(line[1].rsplit("_", 1)[1])
line[0] = line[0].rsplit("_", 1)[0]
line[1] = ... |
4d7e46602a4dd0c6365e4a297d0385fa0a05513a8ab5296edbc561d6e2e340a5 | Python | 594 | 25 | class MyMessage(object):
"""
message type definition
"""
# server to client
MSG_TYPE_S2C_GRADS = 1
# client to server
MSG_TYPE_C2S_SEND_ACTS = 2
MSG_TYPE_C2S_VALIDATION_MODE = 3
MSG_TYPE_C2S_VALIDATION_OVER = 4
MSG_TYPE_C2S_PROTOCOL_FINISHED = 5
# client to client
M... |
d96cf372385176a7b93c44352f13d0d53e95f0228d4f8883143c4d15f0691a53 | Python | 596 | 13 | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 12 15:14:35 2021
@author: fhu14
"""
from .dataset_gen_script import create_datasets, name_non_overlap_uniqueness_test,\
create_transfer_dataset, create_smaller_dataset, generate_datasets_with_ref,\
expand_dataset, split_to_comparative_dset, comparative_dset_check... |
127240e55c92b5b7fb8f68570a41caf17d8445a2ac95d6981eba0eca0d82b709 | Python | 597 | 13 | # Copyright (c) OpenMMLab. All rights reserved.
from .dist_utils import (DistOptimizerHook, all_reduce_dict, allreduce_grads,
reduce_mean)
from .misc import (center_of_mass, filter_scores_and_topk, flip_tensor,
generate_coordinate, mask2ndarray, multi_apply,
... |
86b379f34d11c523b8bf882416d788ed1b666f815797e2ad56685683878e3cc4 | Python | 597 | 31 | from multiprocessing import Process, Queue
import time
class MyOVBox(OVBox):
def __init__(self):
OVBox.__init__(self)
self.p = None
self.q = None
def f(self, queue):
while True:
queue.put('hello')
time.sleep(1)
def initialize(self):
print("process initialize!")
self.q = Queue()
self.p = Proc... |
13c1dc95e12076eb00117a923d5cc59e57f95445c97ffb916b3d965cd6626f86 | Python | 603 | 22 | import torchvision.transforms.functional as F
class NormalizeMinmax(object):
"""Normalize a tensor volume given min and max value.
:param min
:param max
"""
def __init__(self, min, max, training=True):
self.min = min
self.max = max
self.training = training
def __call... |
0a587e92a070772849b734b643a639ccb93e42e5e38893ec1b0b7e3a2ad2d78f | Python | 610 | 15 | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 5 11:58:27 2021
@author: fhu14
This package is used to run the DFTB+ executable.
"""
from .run_dftbplus import add_dftb, compute_results_torch, compute_results_torch_newrep, load_ani1,\
calc_format_target_reports, per_atom_correction, compute_targets_preds
from .run... |
f10457739fd57c424f408631eb9ca3b3806caa0a5366380079caa99b34d66bda | Python | 611 | 28 | import os
import pathlib
from argparse import ArgumentParser
import yaml
def build_args(default_fname):
parser = ArgumentParser()
parser.add_argument(
"--config",
default=default_fname,
type=str,
help="Configuration file",
)
# parser.set_defaults(data_path=data_path, ... |
ac367a3a10c84069187c4f1187c929915d8a57f876b2c2a39c0475cb72072b5b | Python | 612 | 23 | #!/usr/bin/env python
import math
def main():
duration = 10 # ms
amplitude_max = 100 # uA
output_file = 'sine.cwave'
clock_div = int(math.ceil(duration * 1000 / 17.152 / 0x7fff))
num_of_samples = int(round(duration * 1000 / 17.152 / clock_div))
with open(output_file, 'w') as fp:
f... |
f2d210486f8fbdd60332332efcc68270d21e70dff22513e15ed22c7b4f0532ab | Python | 612 | 19 | var.warnReadNoFile = False
instring = """CLUSTAL W (1.83) multiple sequence alignment
two ACCGTATGCTATCGTATTAGCGTATCGTATTAGGCTATT-ATGCGTAATCG---------
four ACCGTATTCT-TAGCGT-AGCTTAGCGGCATTCGGTACG-ATTCGTATTCGGTTAGCTAG
three ACCGTATCGTATCGTAT--TCGGTACGTAGTATATTACGTATGCTTATTACGTATTATCG
o... |
858c3328a46429a02a6a0524a7dc13a56c22e10044247c529555dfbb190b0b1d | Python | 614 | 19 | # Copyright (C) 2022-2025 ETH Zurich, Niels Maeder and other DASH contributors.
from .custom_data import CustomData
from .featurizer import MolGraphConvFeaturizer
from .model import ChargeCorrectedNodeWiseAttentiveFP, NodeWiseAttentiveFP
from .rdkit_helper import get_graph_from_mol, mols_from_sdf
from .split_utils imp... |
eabb837504912c56e496ad88da9d1ed07973e077c6eef9b3e8341eb1ce882c0f | Python | 615 | 23 | import numpy as np
def fasta2one_hot(sequence, total_win_len):
"""
This converts a fasta sequences (in nucleotides) to one-hot representation
this was modificated with an exception to handle the no A,C,G,T,N letter and
transforme it to N
"""
langu = ['A', 'C', 'G', 'T',... |
2c7ad877815149e646a4ba1d5eaafb3873af4bff76b60baf80a7afa56fdc8991 | Python | 618 | 21 | # global fixtures can go here
import pytest
import os
from pathlib import Path
def pytest_configure(config):
config.addinivalue_line("markers", "integration: mark as integration test")
config.addinivalue_line("markers", "slow: mark as slow test")
@pytest.fixture(autouse=True)
def ensure_output_directory():
... |
c7db9fb9c29b7005787cdf26acae2074ea1678104891cab091caebe7ea11a94a | Python | 619 | 19 | # Imports #
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.dropdown import DropDown
from Classes.Menu import MenuBase
class ConfigureScreen(MenuBase):
def __init__(self,**kwargs):
super(ConfigureScreen,self).__init__(**kwargs)
self.protocol = 'TUNL'
self.... |
ac9fe26c83be6ee41416ad968eb4d9e2ed598ab71963418136d1b4d9c3ca7d14 | Python | 621 | 18 | # Copyright (C) 2024-2025 ETH Zurich, Niels Maeder and other DASH contributors.
worker_template = """
#! /bin/bash
python -c "from serenityff.charge.gnn.attention_extraction.extractor import Extractor;
Extractor._extract_hpc(model='$1', sdf_index=int(${{ varname }}), scratch='$TMPDIR', sdf_property_name='$3', no_char... |
289e7f36d6855f8b1688558f6e070dc20e4d9c2b4332f0c2e85219dbd33f4586 | Python | 625 | 22 | """
Only use one specific label for 1 class segmentation.
"""
import numpy as np
class FilterLabel:
def __init__(self, labels=[1], as_value=[1]):
"""
Select limited labels id, and reset the id as as_value.
"""
self.labels = labels
self.as_value = as_value
def __call__(... |
29bac6c0233000d1b59cc822e4e0bfeda73b6205c46f64a91cbb54b549f6edf2 | Python | 627 | 14 | import pandas as pd
import plotly.express as px
# Load features.csv file generated from dsmri.py
# Create a new column after the first column in the generated features.csv file to provide the labels of your domain.
# In our sample features.csv file, its "Manufacturer" column with 'GE', 'Siemens' and 'Philips' labels.... |
f76bbecf9302d8a0051df5529efe727098a55368d8f269206d702ae2c8291082 | Python | 627 | 14 | import pandas as pd
import plotly.express as px
# Load features.csv file generated from dsmri.py
# Create a new column after the first column in the generated features.csv file to provide the labels of your domain.
# In our sample features.csv file, its "Manufacturer" column with 'GE', 'Siemens' and 'Philips' labels.... |
09be737d7253345829ce8374a1f483587a5648d8e85a96c7cf6090632896c928 | Python | 628 | 24 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmdet.models.utils import ConvUpsample
@pytest.mark.parametrize('num_layers', [0, 1, 2])
def test_conv_upsample(num_layers):
num_upsample = num_layers if num_layers > 0 else 0
num_layers = num_layers if num_layers > 0 else 1
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.