sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9c5b24cd323e569e6f1005dda96df5e69cc28237f19d7323c4a6ece5962b080b
Python
909
47
""" A collection of constants that probably should not be changed """ import numpy as np # Universal Constants SPEED_OF_SOUND = 343.0 # m/s FS = 48000 # Project constants MAX_SHIFTS = [2, 4] ROOM_DIM = 6 MAX_SPEAKER_RELATIVE_HEIGHT = 0.8 NEG_SAMPLE_INTIAL_CANDIDATES = 30 # Robot constants CHANNELS_PER_MIC = 1 CODEC...
0994a9151466a03ea21cf29630adebbe4f10b377cadb48513bd866a469c484ba
Python
911
33
# Restart an MCMC from a checkpoint. # Settings made to the var module in the original MCMC are not in # the pickled file, so you will probably need to set them again --- var.PIVEC_MIN = 1.e-6 var.RATE_MIN = 1.e-6 var.BRLEN_MIN = 1.e-5 var.GAMMA_SHAPE_MIN = 0.15 read("d.nex") d = Data() # Assuming more than one run,...
47bb6b0edf0f99c6a5d44f08cbd449b48d455b5a9dbb747d9d2039ed7f4c503d
Python
911
9
from .attention import MultiHeadSelfAttention2d from .attention import AxialSelfAttention2d from .attention import TiedAxialSelfAttention2d from .attention import Transmorpher2d from .attention import TransmorpherBlock2d from .loss import NT_Xent_Loss, SequenceNTXentLoss, EmbeddedJigsawLoss, SigmoidCrossEntropyLoss, Bi...
8b9db7c54d223f29cc23b5162065a40c78f8fa3f1804373beeeb31415545c979
Python
911
35
from torch import nn class ModuleWrapper(nn.Module): """Wrapper for nn.Module with support for arbitrary flags and a universal forward pass""" def __init__(self): super(ModuleWrapper, self).__init__() def set_flag(self, flag_name, value): setattr(self, flag_name, value) for m in ...
3b52675bc0008a4891d8197e6c082eb3913b186909e54136be1556dd025ea2f4
Python
912
26
import pickle from rdkit import Chem from serenityff.charge.tree.dash_tree import DASHTree sdf_file_path = "sdf_qmugs500_mbis_collect.sdf" mol_sup = Chem.SDMolSupplier(sdf_file_path, removeHs=False) tree = DASHTree() node_path_storage = {} last_dash_idx = "" for mol in mol_sup: dash_idx = mol.GetProp("DASH_IDX") ...
b56de6ea01510372a251c7fba922abd70e5113f5780e68b8c33b0bc763c8a782
Python
912
22
""" The module provides a collection of comprehensive oligonucleotide design pipelines, each equipped with specific functionalities to facilitate efficient and targeted oligo synthesis for diverse applications. """ from ._cycle_hcr_probe_designer import CycleHCRProbeDesigner from ._genomic_region_generator import Geno...
e61ff0ac442cf01330e68dfe07eb97dfb1290131c95020945e098ff0cfa95cbc
Python
912
37
from dataclasses import dataclass from typing import TYPE_CHECKING from Bio.Align import MultipleSeqAlignment if TYPE_CHECKING: from .msa import MSA @dataclass class TrimmingStats: msa: "MSA" @property def alignment_length(self) -> int: return self.msa.original_length @property def...
f1e9a61654dda768b919fb54a460062ce548d7070477dce7f93e71a356e86b62
Python
915
36
#!/usr/bin/env python3 from flystim.stim_server import launch_stim_server from flystim.screen import Screen, SubScreen from flystim.trajectory import Trajectory import numpy as np from flystim.draw import draw_screens from time import sleep def main(): stim_duration = 2 iti = 2 screen = Screen(...
9f0e26aaf98f992eeb2396c95475cf38521613b794dd1ea96cc954bd982ce3f5
Python
916
18
# Copyright (c) 2020-present Joindbre.com # Authors: Patricia Maraver. # # This program is free software: you can redistribute it and/or modify # it under the GNU Affero General Public License version 3 # as published by the Free Software Foundation. # You should have received a copy of the Server Side Public Lic...
f800474dcd763cd99ef2a17098cd2bee242abbd259041e7b2e1dcd222277697c
Python
916
31
nTax = 5 taxNames = list(string.ascii_uppercase[:nTax]) a = func.newEmptyAlignment(dataType='protein', taxNames=taxNames, length=200) b = func.newEmptyAlignment(dataType='protein', taxNames=taxNames, length=133) d = Data([a,b]) t = func.randomTree(taxNames=taxNames) t.data = d pNum = 0 t.newComp(partNum=pNum, free=0,...
f523f4bbff68aedf98069ce968570862fe094f29f049ada09c05d06729293f3b
Python
917
30
import torch import torch.nn as nn class ModelB(nn.Module): def __init__(self, inmodel, base_output_shape=3172, output_classes=2, fix_inmodel=14): super(ModelB, self).__init__() self.modelA = inmodel if fix_inmodel: assert isinstance(fix_inmodel,int), "Tell me how many layers ...
32167355c096dc180a7b7674beb31a6537b53de1bbb589d9249f44fa98cd45f2
Python
920
29
import pandas as pd import urllib.parse import requests from tqdm import tqdm import grequests import time #SERVER_URL = "http://localhost:6541" #SERVER_URL = "http://dorresteintesthub.ucsd.edu:6541" SERVER_URL = "http://npclassifier.gnps2.org" def test_speed(): df = pd.read_csv("test.tsv", sep=",") iteratio...
3e8e69608db49bfe932a80306f6db6005b06a5a577ddeb76272a95ce85e89658
Python
920
39
import pandas as pd import moses import argparse import selfies as sf parser = argparse.ArgumentParser() parser.add_argument('--input', default='selfies_sample.txt', help='path to selfie token file') parser.add_argument('--valid', help='path to validation fil...
f0d2eb2d086ee9aae0810ee9ed9b461d79cce9a130d5dfa43e5acc4f095187c8
Python
922
37
import torch import torch.nn as nn import torch.optim as optim import torch.nn.functional as F from torch.autograd import Variable import pandas as pd def to_var(var): if torch.is_tensor(var): var = Variable(var) if torch.cuda.is_available(): var = var.cuda() return var if...
8fc073413c81f9a055e2347afc129f81bea4005872021f491d2b38a3a90cb173
Python
925
27
# from model.builders.builders import build_full_network import os filename = os.path.basename(__file__) from copy import copy, deepcopy vocab_size = 20000 data_base ={'id':'progression','type': 'updated_label' , 'params': {'outcome': 'progression', 'text': 'NARR+IMPRESS', 'training_split':0, 'split_path':'splits'}} ...
7a360c9f0d24e39d1b584f2d22ab50d7f521d3bd3fbe3c7e47d5d43f3f35692c
Python
926
32
# Copyright (c) OpenMMLab. All rights reserved. from ..builder import DETECTORS from .two_stage import TwoStageDetector @DETECTORS.register_module() class GridRCNN(TwoStageDetector): """Grid R-CNN. This detector is the implementation of: - Grid R-CNN (https://arxiv.org/abs/1811.12030) - Grid R-CNN Pl...
b7f91335c991b7b56131421309271dd3c8bf6ae5f44d26cb4d114ec022d50937
Python
926
26
from Bio.Align import MultipleSeqAlignment from Bio.Phylo.BaseTree import Tree from Bio.Phylo.TreeConstruction import ( DistanceCalculator, DistanceTreeConstructor, NNITreeSearcher, ParsimonyScorer, ParsimonyTreeConstructor, ) def build_parsimony_guide_tree(alignment: MultipleSeqAlignment) -> Tree...
74482f517e4926c4ed02dab328d457a521f00b2505bd28210f44f51503d02f43
Python
927
23
import numpy as np def get_dff(flu, cell_index, demean_frames, frames=None): if type(demean_frames) is slice: f0 = flu[:, demean_frames].mean(axis=1) if cell_index is None else flu[cell_index, demean_frames].mean() else: f0 = demean_frames frames_slice = None if type(frames) is slice o...
11cf7f3b781ddeb3d2aace6381668feb487f70578f4158f913ad772226aa79ab
Python
929
36
import numpy as np from trefide.pmd import batch_decompose from trefide.utils import psd_noise_estimate def test_psd_noise_estimate(): n, t = 100, 5 Y = np.random.randn(n, t) res = np.asarray(psd_noise_estimate(Y)) print(res) def main(): test_psd_noise_estimate() X = np.load("/home/sy2685/t...
0ad6d32c4de228ed83503061dc269de841e9b2f8bb1375bdd614feaab02433ca
Python
933
57
#!/usr/bin/env python import sys import numpy as np from operator import itemgetter from optparse import OptionParser parser = OptionParser() parser.add_option("-b", "--bedpe_file", dest="bedpe_file", help="BEDPE file") parser.add_option("-g", "--genome_file", dest="genome_file", help="Genome...
87074d085cdc793651f204e7f22ee89e5ad7fd50cb05101472e6392034d677e3
Python
936
32
import torch # from imblearn.metrics import sensitivity_score from sklearn.metrics import confusion_matrix def sensitivity(output, target, misc): """ Sensitivity = TP / (TP + FN) :param output: Batch x Channel x .... :param target: Batch x .... :return: """ with torch.no_grad(): i...
22ef463c5e0d41795ddee11f732f36cb4efdcd381fbf293f8243ad078818f80f
Python
938
41
import numpy as np def gen_labels(in_annot, out_annot, in_pulse, out_pulse, size): peaks = np.load(in_annot).astype(int) pulses = np.load(in_pulse) idx = range(len(peaks)) p1, p2 = peaks[:, 0], peaks[:, 1] div = pulses[idx, p1] / pu...
d2a82453e5053ed4a817286ec72995bec3dda0a85b9b446596c7fe402212fd21
Python
938
34
import argparse import typing import models.keras # Import bez importu :) if False: import tensorflow.keras as keras class LinearModelMeta(models.keras.KerasModelMeta): def define_parameters(cls, parser: argparse.ArgumentParser): pass @property def custom_objects(cls) -> typing.Dict[str, ty...
79254701c801b5d53af6fc0ce28fbe9ff7767f60f5db2fed739404f2a04aff73
Python
940
40
import SimpleITK as sitk import numpy as np import argparse import os import glob import sys import pandas as pd def main(args): image_info = [] for fn in glob.glob(os.path.join(args.dir, args.ext)): print("Reading:", fn) img = sitk.ReadImage(fn) spc = img.GetSpacing() size = img.GetSize() image_in...
85d08d345d261632914953b1a7d27c55402e295ad29dcf2440ca9d876645d21d
Python
940
24
# Copyright (c) OpenMMLab. All rights reserved. from .csp_darknet import CSPDarknet from .darknet import Darknet from .detectors_resnet import DetectoRS_ResNet from .detectors_resnext import DetectoRS_ResNeXt from .hourglass import HourglassNet from .hrnet import HRNet from .mobilenet_v2 import MobileNetV2 from .pvt im...
2a7e04b57c449aeadb971b4e833f9b8e496b6b948d5922d2ee26fcbfc9a194d1
Python
941
23
class SelectChannel: def __init__(self, img_ch=[0], label_ch=[0]): """ Just select image channel(s) and label channel(s) by given img_ch and label_ch array. """ assert isinstance(img_ch, list), "Image channels should be a list." assert isinstance(label_ch, list), "Label chan...
f5459c7f0e0f151cdabfc541f4676b1902cd43fb94ac90dca8f4ce484a85e5fb
Python
942
37
class Error(Exception): """ This is the base class on which all local errors and exceptions are based. """ pass class FermiEnergyConflict(Error): """ Exception to be raised when asking for a cost function which uses the fermi energy but not using finite the temperature which is used to ...
d23b6c220d44195aa7e865423d092d542b182aee5fe976eb565c7417647615ec
Python
944
29
var.warnReadNoFile = 0 var.verboseRead = 0 nTax = 5 taxNames = list(string.ascii_uppercase[:nTax]) a = func.newEmptyAlignment(dataType='dna', taxNames=taxNames, length=100) d = Data([a]) read('(B:0.5, ((D:0.4, A:0.3), C:0.5), E:0.5);') t = var.trees[0] t.taxNames = taxNames t.data = d c1 = t.newComp(free=1, spec='sp...
ec6d18d92e5bcdc42212a5f5e25bad7ddf56cf7ffd9d69320e7664e62c5618d0
Python
946
40
# -*- coding: utf-8 -*- """ Created on Mon Jun 7 20:08:53 2021 @author: fhu14 """ ELEMENTS = {1: 'H', 6: 'C', 7: 'N', 8: 'O', 16: 'S', 79: 'Au'} GROUP_S = [1] GROUP_SP = [6, 7, 8] GROUP_SPD = [16, 79] NUMSHELL = {'s': 1, 'sp': 2, 'spd': 3, 'spdf': 4} NUMBASIS = {'s': 1, 'sp': 4, 'spd...
2ade6b441d7b9fd0c086e49cc9d2bcce8ec9834acb1928af4415bf2e4f72cca8
Python
947
38
''' adapted from https://github.com/all-umass/ManifoldWarping ''' ''' miscellaneous utilities ''' import numpy import scipy import sys import time # Change: from .distance import L2 def pairwise_error(A, B, metric=L2): ''' sum of distances between points in A and B, normalized ''' return metric.pairwise(A /...
98583b34be027ef921bb9ee39a9b844912fa84ff0c2b50199694cdbda3978613
Python
948
35
nTax = 10 taxNames = list(string.ascii_uppercase[:nTax]) a = func.newEmptyAlignment(dataType='dna', taxNames=taxNames, length=96) 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.]) ...
fd594e3df384f5ab44cc7b0134c46cc8fd965031f2b46dc3b3daecdbbbcfed0e
Python
948
31
import pandas as pd import numpy as np def filter_array(array, w): filtered_array = pd.Series(array).rolling(w, center=True).mean() filtered_array[filtered_array.isna()] = 0 return np.array(filtered_array) def compute_absolute_change(array, w): array_f = filter_array(array, w) output = [False]+[...
d60c60d8b74cce184db0c28d64a82b69b56144f87a323c9df4ba84a0a7170004
Python
953
25
import matplotlib.pyplot as plt import pathlib import os import numpy as np from dtor.viewer import multi_slice_viewer p_ltp = 1013 abl_ltp = 19 p_nltp = 1002 abl_nltp = 4 o_liver_post = lambda p, a: os.path.join(pathlib.Path(os.environ["DTORROOT"]), f"data/processed/{p}_{a}_liver_post.npy...
bc6eddfc334ff3495d90928a81c8e969c13599f4dd13b7b8fe596f5cb70c6994
Python
955
29
import multipagetiff as mtif import argparse import logging import os from . import utils def main(*args, **kwargs): parser = argparse.ArgumentParser(description="Unpad one stack by removing zero-valued lines and columns from every page.") parser.add_argument("input_path", help="The path of the volume to reg...
7b5da0968babb52d5573bc156c216b65b6f399ed81a6c712296d69a4a73d5339
Python
957
29
#!/usr/bin/env python from setuptools import setup from glob import glob __license__ = "GPL" __version__ = "2.6.4" __maintainer__ = "Langille Lab" long_description = ("Douglas et al. 2020. PICRUSt2 for prediction of " "metagenome functions. Nature Biotechnology. doi: " "10.103...
c83b3703ec4a24051eb0e297dcf347bf123fdd27a912bed36da2a16dfd44e3f7
Python
957
41
# Do an MCMC. # The defaults for these values are much smaller. These suggested # changes may not be needed all the time, but seems to help for # difficult data. var.PIVEC_MIN = 1.e-6 var.RATE_MIN = 1.e-6 var.BRLEN_MIN = 1.e-5 var.GAMMA_SHAPE_MIN = 0.15 # Assuming more than one run, we set the run number by calling ...
0c2a42d11039bda9ca5f1bdf266dc4710dd3210cf90f3074bcd7b90566717281
Python
959
31
""" subsample slices for MICCAI 2020 Reconstruction project. """ import numpy as np import random from scipy.ndimage.interpolation import shift class ZUpsampler: """ Upsample the 3D numpy label [c, h, w, d] to more dense volume. [c, h, w, d*10]. """ def __init__(self): self.sample_size_propab...
384ffe647bdcede43e98c2f979b3000c2d92f09067bcc935d0e50c758623eff0
Python
959
30
import h5py import numpy as np import time import glob datapath = '/path/to/hctsaMEGoutputs/'; # MEG files fileNames = sorted(glob.glob(datapath + 'HCP_MEG_outputs/Schaefer100/dataSegments/fullSet_80/*_N.mat')) IDList = [] for n, inMat in enumerate(fileNames): start = time.time() ...
486788b1c4f5285ff58f760370208f8bbad16ced4d452a9173b35cac086a1c21
Python
959
18
import os #os.system('ls -l') # Download Experiment Infos os.system('aws s3 cp s3://natural-scenes-dataset/nsddata/experiments/nsd/nsd_expdesign.mat nsddata/experiments/nsd/') os.system('aws s3 cp s3://natural-scenes-dataset/nsddata/experiments/nsd/nsd_stim_info_merged.pkl nsddata/experiments/nsd/') # Download Stimul...
c66c475e85981c119b687076fcb9e0dbb43deac56bfb1386d62943f97cbe73c3
Python
959
33
''' #python将某文件夹下的文件名存储到excel中 ''' #导入所需模块 import os import xlwt #定义要处理的文件路径(文件夹) file_dir = "D:\Tuo\yolov5-cell\detect/Positivate_sp" #将文件名列出并存储在allfilenames里面 allfilenames = os.listdir(file_dir) #打印看是否符合预期 print(allfilenames) #创建工作簿 workbook = xlwt.Workbook() #新建工作表,并且命名为fileNames worksheet...
c87ba69590c5e3c5bff9bef1a5f6d3a5e26bda270f554675b0348f768453b3ff
Python
960
39
_base_ = ['hrnet_w48_coco_640x640.py'] model = dict(test_cfg=dict( nms_dist_thr=0.1, max_pool_kernel=11, )) val_pipeline = [ dict(type='LoadImageFromFile'), dict( type='BottomUpGetImgSize', base_length=32, test_scale_factor=[0.5, 1, 2]), dict( type='BottomUpResizeAl...
99bc0339c6dbb966ca8fbc78a46cb1152b06bdb28442a3e06719bd9ee4ebb0e1
Python
963
33
import numpy as np import pandas as pd from sklearn.metrics import confusion_matrix def eval(pred_path, annot_path, out_path, out_matrix, threshold): #chargements preds = np.load(pred_path, allow_pickle=True) peaks = np.load(annot_path, allow_pickle=True).astype(bool) df_error = pd.DataFrame() ...
aa04a125b5b239170590c7ce234ae400b71b6be904998dbf0c23704dc3b5c478
Python
964
43
import argparse from pathlib import Path import numpy as np import tqdm from scipy.signal import stft, istft def do_ibm(gt, mix, alpha, theta): """ Computes and applies the Ideal Binary Mask gt: (n_voices, 1, t) mix: (1, t) """ n_voices = gt.shape[0] nfft = 2048 eps = np.finfo(np.fl...
155a65e260abc7f943a066463e3468e54f4b2cedc74b6e55f12ddf39b0e6e682
Python
965
37
import pytest import foolbox as fbn import eagerpy as ep @pytest.mark.parametrize("k", [1, 2, 3, 4]) def test_atleast_kd_1d(dummy: ep.Tensor, k: int) -> None: x = ep.zeros(dummy, (10,)) x = fbn.devutils.atleast_kd(x, k) assert x.shape[0] == 10 assert x.ndim == k @pytest.mark.parametrize("k", [1, 2, ...
1ec6c8d39e521414e133fec15e26bf33b091c59830ff25074658f3368076294b
Python
970
31
import torch.nn as nn import torch.nn.functional as F import numpy as np def conv_init(m): classname = m.__class__.__name__ if classname.find('Conv') != -1: #nn.init.xavier_uniform(m.weight, gain=np.sqrt(2)) nn.init.normal_(m.weight, mean=0, std=1) nn.init.constant(m.bias, 0) class LeN...
338bc986145abccabe1c0a8299ae0baf7133091b1ecf25162aab4651fa81b02d
Python
970
30
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org # Distributed under the MIT License. # (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT) from pytest import mark import yaml import glob from os.path import dirname, join from torchmdnet.models.model import c...
ce3e1a242611c8663ab46863529e86d236d4e692f69de0d68c0b4eddbc749c2f
Python
970
55
from dataclasses import dataclass from enum import IntEnum class PointStyle(IntEnum): """ Plot point styles """ Simple_Dot = 0x15 Solid_Circle = 0x0A Empty_Circle = 0x09 Solid_Square = 0x02 Empty_Square = 0x01 NA = 0xFFFFFFFF class LatencyPlotUnit(IntEnum): """ Units used...
25bdfebc0730ada3d0949c7b531b09003d86def609da3e529dc7e9f9a2629f9b
Python
974
25
# -*- coding: utf-8 -*- """ Created on Tue May 31 18:39:26 2022 @author: fhu14 """ ''' Separate module for precomputing with a lock from if __name__ == "__main__": ''' #Taking no changes, putting the imports into the if __name__ == "__main__" block too if __name__ == "__main__": from precompute_driver import ...
989b4ff1e961f789476911d29f06630af3bac386e1fdbab36cd076692421e872
Python
974
28
import numpy as np class HistNorm: def __init__(self, bd_low=0.1, bd_up=99.9): self.bd_low = bd_low self.bd_up = bd_up # self.mean_i = mean_i # self.std_i = std_i def __call__(self, sample): image, mask, misc = sample['image'], sample['mask'], sample['misc'] n...
1abb2984d50b59bfbf305113674464ed356eec741387c159273139a1eb8ed6d4
Python
975
26
# 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/> from sbi.neural_nets.embedding_nets.SC_embedding import SpectralConvEmbedding from sbi.neural_nets.embedding_nets.causal_cnn import CausalCNNEmbedding fro...
bf264e3d3dda5e1cb62280afbcf5eb5205f70ef9d67e4027a2c92862c18a03bb
Python
975
20
# Copyright (c) OpenMMLab. All rights reserved. from .ckpt_convert import pvt_convert, tcformer_convert from .geometry import batch_rodrigues, quat_to_rotmat, rot6d_to_rotmat from .misc import torch_meshgrid_ij from .ops import resize from .realnvp import RealNVP from .rescore import DekrRescoreNet from .smpl import SM...
12568950f61abd5533615d77f1aef82041480c82bbcdbce0d374c12912ea7e57
Python
976
31
import pkg_resources import _webrtcvad __author__ = "John Wiseman jjwiseman@gmail.com" __copyright__ = "Copyright (C) 2016 John Wiseman" __license__ = "MIT" __version__ = pkg_resources.get_distribution('webrtcvad').version class Vad(object): def __init__(self, mode=None): self._vad = _webrtcvad.create()...
349e23dec2462efd87a69333ff2c9a8f71cc2eb553d6fe5af68f91093ffd0d31
Python
977
20
import torch.nn.functional as F from loss.bce_loss import bce_loss from loss.bce_loss_with_logits import bce_loss_with_logits from loss.cross_entropy_loss import cross_entropy_loss from loss.dice_loss import dice_loss from loss.nll_loss import nll_loss if __name__ == '__main__': import torch torch.manual_seed...
0307912ac33eadd4feec484ac251a81fe463b3466edc796961061568c0a9a11b
Python
978
40
var.PIVEC_MIN = 1.e-6 var.RATE_MIN = 1.e-6 var.BRLEN_MIN = 1.e-5 var.GAMMA_SHAPE_MIN = 0.15 rNum = 0 read('d.nex') #read('simTree.nex') d = Data() t = func.randomTree(taxNames=d.taxNames) t.data = d pNum = 0 # comp for each node for n in t.iterNodes(): c = t.newComp(partNum=pNum, free=1, spec='empirical', symbol...
d9835abc7fd2e4dd0c0e344607a8fe370fdef86b193254fa5184b27591fd691e
Python
978
26
# from model.builders.builders import build_full_network import os filename = os.path.basename(__file__) from copy import copy, deepcopy vocab_size = 20000 data_base ={'id':'response','type': 'updated_label' , 'params': {'outcome': 'response', 'text': 'NARR+IMPRESS', 'training_split':0, 'split_path': 'splits_new'}} ...
bb28afaac0a5493f97c37f0edb4d6a66b2f54b635c75b804fe90d642180ef064
Python
979
28
# Copyright (c) OpenMMLab. All rights reserved. from mmdet.models.builder import HEADS from mmdet.models.utils import ResLayer, SimplifiedBasicBlock from .fcn_mask_head import FCNMaskHead @HEADS.register_module() class SCNetMaskHead(FCNMaskHead): """Mask head for `SCNet <https://arxiv.org/abs/2012.10150>`_. ...
ba5e3cebcc8909c59a340952e6fbf89b7422cc99b4f780cf28d7e2a871875812
Python
980
17
from distutils.core import setup from distutils.extension import Extension setup(name="p4", ext_modules=[ Extension("fastReducedRF", ['fastReducedRF.cpp'], # Adjust the following to be able to find pyublas, numpy, and boost. Maybe need library_dirs as well? #include_dirs = ["/usr/l...
bd4ab1ede9551430785f2bb6031f4ca27a3e8a0180397f73218587592262554b
Python
980
30
#!/usr/bin/env python import sys valid_spliced_reads=0 problem_reads=0 for ln in sys.stdin: if ln[0] == "@": continue ln_split=ln.split() cs = ln_split[5] if "N" in cs: quality_score=int(ln_split[4]) if quality_score < 10: continue # quality score try: ...
e50a26e89792a95b61b9a330559e7b47e9ac39b275e4aa1ad54c48775d97b9a2
Python
980
37
#!/usr/bin/env python3 from flystim.stim_server import launch_stim_server from flystim.screen import Screen, SubScreen from flystim.trajectory import Trajectory import numpy as np from flystim.draw import draw_screens from time import sleep def main(): stim_duration = 2 iti = 2 screen = Screen(...
ac9f5c0990e09953d4e797cb4f28dc54eacfc34e20cd7615fa9fa468d832d5ec
Python
981
27
import numpy as np class NormalizeHist: def __init__(self, bd_low=0.1, bd_up=99.9, mean_i=0, std_i=1): self.bd_low = bd_low self.bd_up = bd_up self.mean_i = mean_i self.std_i = std_i def __call__(self, sample): image, mask, misc = sample['image'], sample['mask'], sampl...
0f7cd20a02987ba5513d6bbdb8b44aa0190c3afbd295c6091801648dd1a17a2a
Python
983
33
import os import gzip import urllib import urllib.request def get_family_ids(rfam_file): """ extracts Rfam family IDs from a stockholm formatted multiple sequence alignment file """ ids = [] with gzip.open(rfam_file, 'rt', encoding='latin1') as f: for line in f: line = line.spl...
460831ece088c3d686a1b2603bb6e7a40db7e4f081b33ae0a84643021e625f97
Python
984
32
import torch import torch.nn as nn class ModelBSingle(nn.Module): def __init__(self, inmodel, base_output_shape=2359296, output_classes=2, fix_inmodel=True): super(ModelBSingle, self).__init__() self.modelA = inmodel if fix_inmodel: for param in self.modelA.parameters(): ...
8d171d9c19b49f6ab1f58d63e77dac501d8edf16dbea676eaaffc216049c895c
Python
985
35
#!/usr/bin/env python3 import torch import torch.nn as nn import os from foolbox.models import PyTorchModel from foolbox.utils import accuracy, samples def create() -> PyTorchModel: model = nn.Sequential( nn.Conv2d(1, 32, 3), nn.ReLU(), nn.Conv2d(32, 64, 3), nn.ReLU(), nn.M...
e03527e8f0d4b05cb3bd052acb573b790dc64649f2a3ea14ff911ebc1f3f1e1a
Python
986
33
import os import json import time import platform import logging def logging_config(args, process_id): # customize the log format while logging.getLogger().handlers: logging.getLogger().handlers.clear() console = logging.StreamHandler() if args.level == 'INFO': console.setLevel(logging....
1ff178946cd823accca10212abd976bd92c00c114963bb3ec80eab62401bf46b
Python
989
25
read('t.nex') t = var.trees[0] var.alignments.append(func.newEmptyAlignment(dataType='dna', symbols=None, taxNames=t.taxNames, length=1000)) var.alignments.append(func.newEmptyAlignment(dataType='dna', symbols=None, taxNames=t.taxNames, length=700)) d = Data() t.data = d t.newComp(partNum=0, free=1, spec='specified', ...
6f8590a8077cb9de0eb6f6613b74a66a83cd3f4eb10697ac31c4d2af2b96960d
Python
989
27
# from model.builders.builders import build_full_network import os filename = os.path.basename(__file__) from copy import copy, deepcopy vocab_size = 20000 data_base ={'id':'progression','type': 'updated_label' , 'params': {'outcome': 'progression', 'text': 'NARR+IMPRESS', 'training_split':0, 'split_path': 'splits_ne...
eaa81145131f6eeb9b011e299e26902aa324d26f1100bddcd19bb8ab3f6ecfe7
Python
991
26
import cv2 import numpy as np def mask(img_c, img, lower_val, method): hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV) # ============================================================================= # lower_val = np.array([105,0,0]) # ========================================================================...
35585cbbac019935f047e2e2cf8521fb8741b94934f34c90f94a6e6d5805c55c
Python
993
26
import torchvision.transforms.functional as F from data_loader.my_transforms.normalize3d import normalize_common class NormalizeInstance3d(object): """Normalize a tensor volume with mean and standard deviation estimated from the sample itself. :param mean: mean value. :param std: standard deviation v...
69a395cef71c0227ba3e49cb3da930490b9a26f5174b629e14413aa4eb95027f
Python
993
17
import os import pandas as pd root = os.path.dirname(os.getcwd()) kinase_mapping = pd.read_csv(root + "/data/kinases.csv") sel_kinases = [ "LCK", "KDR", "EGFR", "SRC", "MAPK14", "FGFR1", "MAP2K1", "CDK2", "GSK3B", "MAPK10", "ABL1", "CHEK1", "ITK", "PDPK1", "NTRK1", "SYK", "INSR", "IGF1R", "MAPK1", "H...
8f5ef17a739ed663bcb76d4c942199cfe300e97a36b71241c290ede97e4ed6e9
Python
994
40
_base_ = ['hrnet_w48_crowdpose_640x640.py'] model = dict( test_cfg=dict( multi_scale_score_decrease=0.9, nms_dist_thr=0.1, )) val_pipeline = [ dict(type='LoadImageFromFile'), dict( type='BottomUpGetImgSize', base_length=32, test_scale_factor=[0.5, 1, 2]), di...
e886034c0921f882595f7d102bbb0b2fae6568e443d7d29005441ce8b04addcd
Python
994
40
_base_ = ['hrnet_w32_crowdpose_512x512.py'] model = dict( test_cfg=dict( multi_scale_score_decrease=0.9, nms_dist_thr=0.1, )) val_pipeline = [ dict(type='LoadImageFromFile'), dict( type='BottomUpGetImgSize', base_length=32, test_scale_factor=[0.5, 1, 2]), di...
e32d92aa410fe9a04f721a623d206095c37a602ef12257bd22c7258727339693
Python
995
28
import pickle from rdkit import Chem from serenityff.charge.tree.dash_tree import DASHTree sdf_file_path = "sdf_qmugs500_mbis_collect.sdf" mol_sup = Chem.SDMolSupplier(sdf_file_path, removeHs=False) tree = DASHTree() # tree = DASHTree(tree_folder_path="/cluster/work/igc/mlehner/test192_DASHtree/") node_path_storage =...
524b26fd3a6071405bababcf36bd147aab644350ff727fd50e983931114ca525
Python
996
22
# 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/> from sbi.neural_nets.estimators.base import ( ConditionalDensityEstimator, ConditionalVectorFieldEstimator, UnconditionalDensityEstimator, ) f...
dbcbf50bbc208cc4838f5e65a0c3e5236ad0b2bbd9906e64631fd541149a7d33
Python
996
37
#!/usr/bin/env python3 from flystim.stim_server import launch_stim_server from flystim.screen import Screen, SubScreen from flystim.trajectory import Trajectory import numpy as np from flystim.draw import draw_screens from time import sleep def main(): stim_duration = 2 iti = 2 screen = Screen(...
7fbdcb7895248417d24945bfd8269d7342dd03188a3dc7db29979bf80dc5bb27
Python
998
28
# Copyright (c) OpenMMLab. All rights reserved. from mmdet.models.builder import HEADS from mmdet.models.utils import ResLayer, SimplifiedBasicBlock from .fused_semantic_head import FusedSemanticHead @HEADS.register_module() class SCNetSemanticHead(FusedSemanticHead): """Mask head for `SCNet <https://arxiv.org/ab...
f4fe9f07760f5f829b074089f6dbcac8882d93e03a26e54932d4888495697f71
Python
998
26
from mpi4py import MPI from fedml_api.distributed.decentralized_framework.decentralized_worker import DecentralizedWorker from fedml_api.distributed.decentralized_framework.decentralized_worker_manager import DecentralizedWorkerManager from fedml_core.distributed.topology.symmetric_topology_manager import SymmetricTop...
cb1047f3ee445900519b0e2b6cf823efb9a43fa591e7184c524cddfdf8c674b1
Python
1,000
34
# import torch # from imblearn.metrics import specificity_score def specificity(output, target, misc): """ Specificity = TN / (TN + FP) :param output: Batch x Channel x .... :param target: Batch x .... :return: """ tn = misc['tn'] fp = misc['fp'] score = tn / (tn + fp) del misc...
989913c295253eff3f4116c5fd42b942b1a6d56f31c28ff6afe4e2ec73cdaea9
Python
1,001
39
from enum import Enum from typing import TYPE_CHECKING from .logger import log_file_logger if TYPE_CHECKING: from Bio.Align import MultipleSeqAlignment from .msa import MSA class TrimmingMode(Enum): gappy = "gappy" block_gappy = "block-gappy" gappyout = "gappyout" entropy = "entropy" comp...
40ffd3874ab4f5a6cd6f66b381c170e4aa935cae88a6192d13fefbf638cdf21c
Python
1,002
28
import numpy as np class HistNorm: def __init__(self, bd_low=0.1, bd_up=99.9, mean_i=0, std_i=1): self.bd_low = bd_low self.bd_up = bd_up self.mean_i = mean_i self.std_i = std_i def __call__(self, sample): image, mask, misc = sample['image'], sample['mask'], sample['mi...
a1ce23b70a8f0e9d2f7f93de429b85a265318148569581e43b52497f6ddf401d
Python
1,002
31
"""Functions for downloading from Google Drive Adapted from `this StackOverflow <https://stackoverflow.com/questions/38511444/>`_ """ import requests def download_file_from_google_drive(id, destination): URL = "https://docs.google.com/uc?export=download" session = requests.Session() response = session.ge...
b6f9c6365f7b6a695b2f489274eefcd8324777663f483c898a37e45ff9eea6bd
Python
1,003
31
import metric.surface_distance.metrics as metrics import torch import numpy as np def hausdorff_distance95_avg(output, target, misc): channel_num = output.shape[1] sds = [] for i in range(1, channel_num): sd = hausdorff_distance95_calc(output, target, misc, i) sds.append(sd) return np...
6cb27318567688b359d662e3e4d74163ea89dfb1ced508c5ce096742586c0524
Python
1,004
35
import sys import numpy as np # default values def_allele_freq = 0.2 def_effect_size = 1.2 def_sample_size = 50 sys.stdout.write("ID REF.ALLELE.FREQ EFFECT.SIZE SAMPLE.SIZE\n") sim_id = 0 # range of sample sizes samp_size_step = 10 for samp_size in range(10, 60 + samp_si...
b966ec62576862544d1bbb50ddf9a26ab85450060279b5d2042d1b7041ac2c00
Python
1,004
34
#setup.py for neuronmusic extension from distutils.core import setup, Extension nrn_srcdir = "." instdir = "/raid/zyc/code_for_dhs_paper/install" if nrn_srcdir[0] != '/' : nrn_srcdir = '../../' + nrn_srcdir mpicc_bin = "mpicc" mpicxx_bin = "mpic++" import os os.environ["CC"]=mpicc_bin os.environ["CXX"]=mpicxx_bin...
8ed88e83f5e509ff0ae6a061cac179fd4c31907432767faa5dc6f9a32e0ea5b3
Python
1,005
40
# Copyright (c) OpenMMLab. All rights reserved. from typing import Union import cv2 import numpy as np from .misc import load_image_from_disk_or_url class ImageCapture: """A mock-up of cv2.VideoCapture that always return a const image. Args: image (str | ndarray): The image path or image data "...
f6d417e15624f35f13cab625caaf3e083bfd595e04093ce9519b2473dfd6a409
Python
1,005
38
nTax = int(var.argvAfterDoubleDash[0]) nTrees = int(var.argvAfterDoubleDash[1]) #taxNames = list(string.ascii_uppercase[:20]) t = func.randomTree(nTax=nTax) #t.draw() a = func.newEmptyAlignment(dataType='dna', taxNames=t.taxNames, length=10) t.data = Data([a]) t.newComp(spec='equal') t.newRMatrix() t.setPInvar() t.set...
b6ced034497893042432b814c1b0685cc88b96ff4154f407cceba7d889b94257
Python
1,006
30
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html import os import sys # -- Project information ----------------------------------------------------- # https://www.sph...
7b8d413b785a064ceb42308c227dcd45fe1320c4512e3da355614de2008bc20d
Python
1,007
43
import argparse import math import os import numpy as np import cv2 from tqdm import tqdm import glob def main(args): fourcc = None out = None for filename in tqdm(glob.glob(args.dir + args.ext)): img = cv2.imread(filename) height, width, layers = img.shape if fourcc is None:...
6f81ee01ccaa2518436e99f529f51aed2bed94f18cd3c852a5f227162a26f266
Python
1,008
27
import numpy class MyOVBox(OVBox): def __init__(self): OVBox.__init__(self) self.signalHeader = None def process(self): for chunkIdx in range( len(self.input[0]) ): if(type(self.input[0][chunkIdx]) == OVSignalHeader): self.signalHeader = self.input[0].pop() outputHeader = OVSignalHeader(self....
d20563e5c327d0564ebe0c8aecafb89318e6bfe234e0bf1320813bea036c3a23
Python
1,011
23
import torch from .shrinked_force_permutations import ShrinkedForcePermutationsDataset class CombinedDataset(ShrinkedForcePermutationsDataset): """ Dataset that combines several datasets to a single one. Prerequisits: Passed datasets contain their data in the list attribute \"samples\" and inherit from \...
f5b537bec9fbcb05fda1881ca0cdadfb02d5d0f268075bfa320f7b9b46e10c4c
Python
1,015
31
import os import cv2 from csutil import util if __name__ == '__main__': root_dir = 'E:/Zhu/ETreg/newdata/HUA3/' TOM_fine_dir = root_dir + '/TOM/fine/' stackdeformationdir = root_dir + '/TOM/stack/deformation/' resultdir = root_dir + '/TOM/stack/result/' util.mkdir(resultdir) tl_cut, br_cut ...
ad105011a6613e6fe2fea38814d4f0e1b992ed148afce00c985f17598e19edca
Python
1,016
41
_base_ = ['hrnet_w32_coco_512x512.py'] model = dict( test_cfg=dict( multi_scale_score_decrease=1.0, nms_dist_thr=0.1, max_pool_kernel=9, )) val_pipeline = [ dict(type='LoadImageFromFile'), dict( type='BottomUpGetImgSize', base_length=32, test_scale_facto...
998c570d960935f11ebf075ae6df5c10980552073b642242088427c6154614ac
Python
1,017
37
# October 22nd 2015 # Modifying these. I think that the ECC stuff uses some of these but called from a local directory # so should be fine. # Actually haven't modified these yet but should. Rename load_file and save_file to # mention text, and then add binary functions. # Some general functions for housekeeping, l...
741fd8db44fcb488851d18066dd18314a50f981cae72b51d3eafd48431926313
Python
1,018
39
import requests import sys import argparse import json import os import os.path import re ap = argparse.ArgumentParser() ap.add_argument('-i','--input', help = 'Input file') ap.add_argument('-o','--out', help = 'Output file') args = vars(ap.parse_args()) input = "" out = "" if (args['input']): input = args['inp...
3bfea4910c2df7760176754d599da18c32721b5cf5418af0d573ab332121aff0
Python
1,019
28
import cv2 import numpy as np def fullpixcount(n, cx, cy, full_pix, img): num_wpix_full = np.sum(img == 255) #print("fullwpix"+str(n), num_wpix_full) img_contour = cv2.putText(img, str(n), (cx,cy), cv2.FONT_HERSHEY_SIMPLEX, 3, (255,0,255)) #cv2.imshow("fullpixcount", img_contour) #...
21f860cba5726f70a2db6478166a6201d7cbe3b0f48768ebf7a3d262db1dde56
Python
1,021
29
import numpy as np """ @input - model (Object); testing data (List); testing labels (List); model name (String); optional args Method that predicts target values with given model and calculates the accuracy of the predicitions by mean value of correct answers. @output - Accuracy value (float), truth ...
dba8a43395de77beda1651d831f2d03e6a4e300267777890f5acd3611c3d09e2
Python
1,021
20
# Copyright (c) OpenMMLab. All rights reserved. from .buffer import BufferManager from .event import EventManager from .image_capture import ImageCapture from .message import FrameMessage, Message, VideoEndingMessage from .misc import (copy_and_paste, expand_and_clamp, get_cached_file_path, get_confi...
4caab129b976a93abaf37761cf5bbaa090e335ecdf181f625d10905d907a7733
Python
1,023
32
from dash import Dash, CeleryManager from flask_caching import Cache import dash_bootstrap_components as dbc from app_main import layout from app_main.callbacks import register_callbacks from celery import Celery REDIS_URL = "redis://localhost:6379" celery_app = Celery(__name__, broker=REDIS_URL, backend=REDIS_URL) ba...
d238ceabfc2b18fed5f91af48964e404c756adbabf3eca9c8156c879726190a8
Python
1,026
32
# Copyright (c) OpenMMLab. All rights reserved. from torch.nn.modules import GroupNorm from torch.nn.modules.batchnorm import _BatchNorm from mmdet.models.backbones.res2net import Bottle2neck from mmdet.models.backbones.resnet import BasicBlock, Bottleneck from mmdet.models.backbones.resnext import Bottleneck as Bottl...
7a42a37f01718e949f354df88fd21f7dbc3887490d94d59b04d45b1c05726efb
Python
1,030
30
#!/usr/bin/env python from setuptools import setup, find_packages import subprocess import os,sys,re from pathlib import Path def get_git_describe(): version_file = Path(__file__).parent / "checkmysequence" / "version.py" version_vars = {} with open(version_file, "r") as f: exec(f.read(), version_...
81c23f5942ce73a09d9b1099d7e81bb90ea1d8de66524a10ca398977ff6d3290
Python
1,030
39
# -*- coding: utf-8 -*- # # This file is part of the taxopy package, available at: # https://github.com/apcamargo/taxopy # # Taxopy 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...