sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
eaeddcfdbaf2fbdb8d5e0966f2b928c31b3154f9e7e6fb7ed82340a6050eabc0
Python
1,185
36
# 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_new...
d610c96377d99d02a24184b9a38624cedc3cb8523a3dd07c8e6378fc6316563b
Python
1,186
43
#!/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(): screen = Screen(fullscreen=False, server_number=0, id=0, vsy...
97f852c40e103ea6216280a82b11011b8e42c505b10af73bd0079f04fe0fb6e2
Python
1,187
41
#!/usr/bin/env python3 from flystim.stim_server import launch_stim_server from flystim.screen import Screen from flystim.trajectory import Trajectory import numpy as np from time import sleep def main(): manager = launch_stim_server(Screen(fullscreen=False, server_number=0, id=0, vsync=False)) manager.load_...
35e213bc31f4ac4924d44a47b7234e2f4703ca01b752d751a3fa44c590441415
Python
1,189
30
from sklearn import preprocessing import pandas as pd import numpy as np def fit_data_matrix_to_network_input(data_matrix: pd.DataFrame, features, feature_column="Protein") -> pd.DataFrame: nr_features_in_matrix = len(data_matrix.index) if len(features) > nr_features_in_matrix: features_df = pd.DataF...
6d08e9938276938a59305694876fda1106456d09a9927fb3084ec5852b381882
Python
1,189
28
import numpy as np import pandas as pd from sklearn.ensemble import RandomForestRegressor from metstab_shap.config import utils_section, csv_section from metstab_shap.config import parse_data_config, parse_representation_config, parse_task_config from metstab_shap.data import load_data # load data (and change to clas...
2a327d5b21ff20911a495da1a89def997ce5b54fe1f0f61641cc22f1436eeadb
Python
1,191
45
read("d.nex") read('sets.nex') a = var.alignments[0] a.setCharPartition('p1') d = Data() t = func.randomTree(taxNames=d.taxNames) t.data = d pNum=0 t.newComp(partNum=pNum, free=1, spec='wag') t.newRMatrix(partNum=pNum, free=0, spec='wag') t.setNGammaCat(partNum=pNum, nGammaCat=4) t.newGdasrv(partNum=pNum, free=1, val=...
70c4c51988c8de9d544259018a22c0869700d005bdb10f221e6ae05fcbb4b490
Python
1,192
32
"""Handles location of output files""" import pathlib def initialize_results_dir(results_dir=None): """Determine where to save results for a pipeline run The output directory will be resolved in this order: 1. if results_dir is provided, results will be to results_dir/query_name 2. results wi...
9c0b9eacfef473206ec042436e9bea0dc8a3628fdfe8f8f7865cf510c7bd44ae
Python
1,192
28
import numpy as np import pandas as pd from sklearn.ensemble import RandomForestRegressor from metstab_shap.config import utils_section, csv_section from metstab_shap.config import parse_data_config, parse_representation_config, parse_task_config from metstab_shap.data import load_data # load data (and change to clas...
f3ccef2e2d8dac26e7d408ba5bfcf4ae56b85b75719d8ccb919a6ec1c84d0d4a
Python
1,193
27
from base import BaseDataLoader from dataset.acdc_miccai_dataset import AcdcMiccaiTrainDataset class AcdcMiccaiDataLoader(BaseDataLoader): def __init__(self, data_root, batch_size, shuffle=True, validation_split=0.0, num_workers=1, training=True, transforms=None, type="sax_15p"): # if tra...
19bac8fa818c668cfc883a8a3407fae636fec4ed23c62338bfbfea6012f1bdd1
Python
1,194
39
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...
7c3891876ef79696aa02b409135863ea6cb1c0546e8f7471c7ee7cfc4feaa7f8
Python
1,194
40
""" This module provides a comprehensive set of filters designed to evaluate the sequence properties of oligonucleotides, ensuring their suitability for various applications. """ from ._filter_base import BasePropertyFilter from ._filter_experiment_specific import DetectionOligoFilter, PadlockArmsFilter from ._filter_...
138146454aa869c4307ad1ee65e8ee2517b42be5a92d98130343b1ca9c4e26a0
Python
1,196
37
import numpy as np # import torch def one_cls_dice(pred, target, label_idx): """ Calculate Dice metrics for one channel :param output:Output dimension: Batch x X x Y (x Z) int :param target:Target dimension: Batch x X x Y (x Z) int:[0, Channel] :param label_idx: :return: """ eps = 0.00...
178a3de9c5c12171aad8d706aa67a7f250ea880b0dfaf197d113c36220948573
Python
1,197
36
import torch import torchvision.transforms as transforms ''' preprocess reference : https://github.com/google-research/federated/blob/master/utils/datasets/cifar100_dataset.py ''' def cifar100_transform(img_mean, img_std, train = True, crop_size = (24,24)): """cropping, flipping, and normalizing.""" if train:...
83a0188af9c3607106c9233646789c781ce85fd4d631993da43fb98fa45d3858
Python
1,197
31
import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from statistics.clustered_mlp_output_wrappers import \ load_metadata_pathology_mlp_pivot # Desired columns COLS = ('ClusterIdx', 'PROGRESSES', 'BRAAK', 'CERAD', 'NIA_ADNC') PATH = ['BRAAK', 'CERAD', 'NIA_ADNC'] # for pat...
527094826a889a4f3df6278d9afd8e5d1637b53ca606d880b88c41d213d560a6
Python
1,200
38
import numpy as np from .plane_alignment_functions import plane_alignment def calculate_brain_center_depth(section): """ Calculates the depth of the brain center for a given section :param section: the section coordinates as an array consisting of Oxyz,Uxyz,Vxyz :type section: np.array ...
7ada0896ac67fe8550f44ff7259addb2686d1e0069f0ef53d99aa4cdc7ac4bfe
Python
1,201
42
import numpy as np from scipy.signal import argrelmax, find_peaks import inspect as isp def min_len(func): def wrapper(*args): pred = func(*args) if len(pred) <= 1: return np.array([0, 0]) return pred return wrapper class Combination: @min_len def curve(self, p...
534d5d3129453cc24de557e34426166b29627628f6244a9793216036442e8763
Python
1,202
49
# -*- coding: utf-8 -*- """ Created on Mon Mar 21 13:20:49 2022 @author: Daniel """ import numpy as np import os import shelve import pandas as pd import sys dirname = os.path.dirname(__file__) path = os.path.join( dirname, 'data', 'tempotron') files = [x for x in os.listdir(path) if 'grid-seed' in x and '.dat' ...
83c15862418ed866433f28e62741fcdbda9a0a4afa69c81f990b5fdf0072b2aa
Python
1,202
38
# 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 __future__ import annotations import pytest import torch from torch import ones, zeros from sbi.simulators.linear_gaussian import diagonal_linear_g...
e7bdb29d05e6802ee914b45c27f42ed2a6a55caef3409ae51c879820fd3f90e2
Python
1,204
49
import eagerpy as ep from ..types import Bounds from .base import Model from .base import T class ThresholdingWrapper(Model): def __init__(self, model: Model, threshold: float): self._model = model self._threshold = threshold @property def bounds(self) -> Bounds: return self._mo...
030acf2c7b5d8867d8ebeae8027b7abcc5354ebf574d041b9ea44ffcdd476d89
Python
1,205
33
# 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/> import warnings as _warnings from sbi.inference.trainers.npe.mnpe import MNPE # noqa: F401 from sbi.inference.trainers.npe.npe_a import NPE_A # noqa: F...
39416068c5c17a18652f51980cdde26dd160deb125db910876675122a951e0ad
Python
1,206
44
import os import torch import numpy as np from torch.nn import functional as F import config_bayesian as cfg # cifar10 classes cifar10_classes = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck'] def logmeanexp(x, dim=None, keepdim=False): """Stable co...
2815b9c628ed6708f144167f4be6e2bfb0cc6693089877cb4d3fce8e76e1cd70
Python
1,208
28
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 c1 = t.newComp(partNum=0, free=1, spec='specifi...
5deb2d1a6a27006d783cb5a6977cf295543e22fed8a993fca275a54a3057b542
Python
1,209
48
# -*- coding: utf-8 -*- """ Created on Thu Jan 20 12:51:20 2022 @author: Daniel """ import sqlite3 import os import numpy as np dirname = os.path.dirname(__file__) db_path = os.path.join( dirname, 'data', 'tempotron_thresholds_mean.db') con = sqlite3.connect(db_path) cur = con.cursor() seed = 0 np.random.seed...
c72e97e2a2d51002c04e88c02cd4b3662f271a26869200521727013d8d82c2d9
Python
1,209
35
def pepper(self, proportion=0.1, andAmbiguities=1): """Pepper the alignment (self) with random gaps and ambiguities.""" import random import math ambigs = 'rymkswhbvdnnn' #ambigs = 'n' for s in self.sequences: s.sequence = list(s.sequence) for i in range(self.length): ...
cffdc6c0b5bd7dccfc92a3c79e73a2065743769bb7cb40026f1b66adec3f554d
Python
1,209
35
import pandas as pd from importlib import reload from typing import Dict def test__map_old_to_new_index(): index_to_lobe = ( pd.read_csv("metadata/data_processed/index_to_lobe_map.csv") .set_index("ID") .to_dict()["Lobe"] ) index_to_lobe = _map_old_to_new_index(index_to_lobe) def _...
eb037fbf4e4dbea3bea285c0105e90ac4459fd3fd60320a4dd83eccc141a2d15
Python
1,210
30
# Copyright (c) OpenMMLab. All rights reserved. from .topdown_aic_dataset import TopDownAicDataset from .topdown_coco_dataset import TopDownCocoDataset from .topdown_coco_wholebody_dataset import TopDownCocoWholeBodyDataset from .topdown_crowdpose_dataset import TopDownCrowdPoseDataset from .topdown_h36m_dataset import...
0fff6ed7c600a7b3b0cc84def10a44678a8e72cfb7f2883613b7d79c2ddb594b
Python
1,212
37
''' common format we use for SV project we do not include translocation in the data. ''' class SV: chrom=0 # chromsome start=1 # starting position [start, end] is the call end=2 # ending position [start, end] is the call calltype=3 # call type, DEL/DUP/INV/INS calllength=4 # length of th...
c227b45464ddb12607b0f90776043dfd8f318bd0b5f0340499f7cc80409af75a
Python
1,212
44
""" Setup file for first-time users This file sets up the following directories and subdirectories: benchtop_wdir: dsets: tmp: settings_files: results: analysis_dir: analysis_files results """ import os, shutil if __name__ == "__main__": #Create the directo...
f11c4bb24c7d72fa78089bf01e9b87d0650f6f7c6637cbc6144edd6b7f5642e3
Python
1,212
45
"""Type validators for CLI arguments.""" from pathlib import Path from typeguard import typechecked @typechecked def valid_file(path_str: str | Path) -> Path: """Validate that a path exists and is a file.""" path = Path(path_str) if not path.exists(): raise IOError(f'File does not exist: {path}'...
54846e24da5c37a548b14c29c68fc289a1c88a90ae9783e8a2bc48c031eb1339
Python
1,213
27
#!/usr/bin/env python3 # Author: Francois Aguet import argparse import os import subprocess parser = argparse.ArgumentParser(description='') parser.add_argument('fastqtl_pairs_file', help='FastQTL output from nominal pass') parser.add_argument('--tmp_dir', default='', help='tmp directory for sorting') parser.add_argu...
8b9218ede1ed0eb63f502acf3c3d636e17fcc66fd18e3c4275aa4a00bfa8adfa
Python
1,214
37
class MyMessage(object): """ message type definition """ # server to client MSG_TYPE_S2C_INIT_CONFIG = 1 MSG_TYPE_S2C_SEND_FAKE_DATA_TO_CLIENT = 2 MSG_TYPE_S2C_STOP = 3 # client to server MSG_TYPE_C2S_SEND_LABEL_TO_SERVER = 4 MSG_TYPE_C2S_SEND_GRAD_TO_SERVER = 5 MSG_TYPE...
ef3548dc8a1e7f20c65874f234d8d6366c96ca148998c720ffd9dc7a4db155a8
Python
1,217
39
# 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/> # NOTE: This is inspired by the sbibm-package <https://github.com/sbi-benchmark/sbibm> from .base_task import Task from .gaussian_linear import GaussianLi...
48ea4f16e317818ceab968f6e64c2d31792f816ec1314dc44c748895f73cef9d
Python
1,222
34
# 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/> import pytest import torch from sbi.utils.diagnostics_utils import get_posterior_samples_on_batch class DummyPosterior: """Posterior returning zero...
3da0745fe1ad1cdcb492bddd92f9ada181de040959503a64d48654e78b6d2553
Python
1,227
37
""" Turns the cleaned h5 file dataset into a pickle file such as the one used in DFTBML. """ # %% from h5_converter import h5_handler import pickle # %% if __name__ == "__main__": k = h5_handler.h5_to_dict('cleaned_dsets/new_ANI1ccx_clean.h5') p_file = [] for name in k.keys(): #p_entry = {} ...
bfec3853e6102368ab02d9c15b2681785323947cf3737f7865063206ae36f494
Python
1,229
56
import argparse import json import multiprocessing.dummy as mp import os from pathlib import Path import numpy as np import tqdm from scipy.signal import stft, istft def do_irm(gt, mix, alpha=1): """ Computes and applies the Ideal Ratio Mask gt: (n_voices, 1, t) mix: (1, t) ...
6aaa6c95b819d089a549ef89e7b44b39528690b9ce1e582f615c286bf67bac7e
Python
1,230
49
# 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.analysis.conditional_density import ( ConditionedMDN, conditional_corrcoeff, conditional_potential, eval_conditional_density, ) f...
a9d0f2136deebf9235802b79d09d4fbf3d8dbd983a1626998f2e32acc5a11fcd
Python
1,230
48
import os.path import random import sys import cv2 import h5py import numpy as np import scipy.ndimage as ndimage from PIL import Image from data.base_dataset import BaseDataset, get_params, get_transform from data.brats_dataset import BratsDataset class BratsSplitDataset(BaseDataset): def __init__(self, opt):...
7dcdb1d8bb7752f7328c912246b06592e9876fcb9b330e17ae7ab7e918c2d563
Python
1,231
42
from typing import TypeVar, Callable, Optional import eagerpy as ep from ..types import Bounds from ..types import BoundsInput from .base import Model T = TypeVar("T") class NumPyModel(Model): def __init__( self, model: Callable, bounds: BoundsInput, data_format: Optional[str] = None ): se...
88e4a404c45830c1d628c7f712a2f20b85e6c653b7b55b17d13fb1638755faed
Python
1,231
37
import pytest import foolbox as fbn from conftest import ModeAndDataAndDescription def test_dataset_attack( fmodel_and_data_ext_for_attacks: ModeAndDataAndDescription, ) -> None: (fmodel, x, y), _, _ = fmodel_and_data_ext_for_attacks x = (x - fmodel.bounds.lower) / (fmodel.bounds.upper - fmodel.bounds....
980f3c55b847feaa657c91c0030cfe58f17d9d5ac0634ea6f844195c934f9b1a
Python
1,231
45
import pytest from pathlib import Path from clipkit.clipkit import execute from clipkit.files import FileFormat from clipkit.modes import TrimmingMode from clipkit.settings import DEFAULT_AA_GAP_CHARS, DEFAULT_NT_GAP_CHARS here = Path(__file__) @pytest.mark.integration class TestC3Out(object): def test_simple_c...
87b2d2aabdec4ac432cc451b9975f3086e4975b41bc1e9b6aeacc8314cc0a2f8
Python
1,232
37
############################################ # imports ############################################ from abc import ABC, abstractmethod ############################################ # Property Filter Class ############################################ class BasePropertyFilter(ABC): """ An abstract base class ...
d31f2602c8cfdfbbfefe2ffacfaec6389186952775c8ac02e39223bf6b3119fa
Python
1,232
44
# -*- coding: utf-8 -*- import os.path as op import pkg_resources import numpy as np import pytest from snf import compute, metrics rs = np.random.RandomState(1234) test_dir = pkg_resources.resource_filename('snf', 'tests/data/sim') data1 = np.loadtxt(op.join(test_dir, 'data1.csv')) data2 = np.loadtxt(op.join(test_di...
8c75830dfd547c4e84541b3274d358edc6b2287f4fa862942b77bea3c3918405
Python
1,233
42
import eagerpy as ep import numpy as np import pytest from typing import Any from foolbox.attacks.gen_attack_utils import rescale_images def test_rescale_axis(request: Any, dummy: ep.Tensor) -> None: backend = request.config.option.backend if backend == "numpy": pytest.skip() x_np = np.random.un...
fffa9d623bb57cac0e997efbd004ebab828fc42a724d3df5076f22c8e3b49685
Python
1,233
39
# Copyright (c) OpenMMLab. All rights reserved. from unittest import TestCase import numpy as np from mmpose.datasets.datasets.base import (Kpt2dSviewRgbImgTopDownDataset, Kpt2dSviewRgbVidTopDownDataset, Kpt3dSviewRgbImgTopDownDatas...
fe39d5c0e2642586641aa3c616852224c2393251742f5477c9ac3a79e0e70b0b
Python
1,241
52
import os import SV class RDXplorer: calltypes=['DEL', 'DUP'] segStart=0 segEnd=1 state=2 Length=3 copyEst=4 segMedian=5 zstat=6 chrom=7 posStart=8 posEnd=9 @staticmethod def doparse (rdx_line): E=rdx_line.rstrip('\n').split('\t') chrom=E[RDXplorer.chrom] start=E[RDXplorer.posStart] end=E[RDXp...
0cf0a8c9dfec8edd00058d5a3f6f813cc6795065c4d7b8f2ada96bf42e10d1fe
Python
1,242
35
import argparse def write_increasingLUT(full_path_original): originalLUT = full_path_original.split('/')[-1] path = full_path_original.strip(originalLUT) new_doc = [] counter = 1 with open(full_path_original) as fr: for line in fr.readlines(): if (not line.startswith(('#', '\n...
a3c07725a76e2c7ef3b2ebbfa981c0be6d9b136be0ae1fc86d2a9e3348f7e258
Python
1,242
45
#!/usr/bin/env python # Copyright [1999-2017] EMBL-European Bioinformatics Institute # # 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 # # Unl...
a51968a3b3653419fa127980f915a3f3064c5fe92bd4db0c29ae44baad6c2144
Python
1,248
43
#!/usr/bin/env python # coding: utf-8 # # Generating box files for each micrographs import glob import os import pandas as pd import numpy as np #Change this according to your structure of your CryoSPARC project project_dir = '/home/*/*/CryoEMData/' empiar_ids = ['10081','10289','11057'] #Example EMPIAR IDs #Put ...
b97afcf19d8a80ba3444363aa6e6f6065d05767906ef01a529757ea2bd1b2c87
Python
1,248
41
import numpy as np def aji(pred, target, istrain): """ target should be instance level label""" assert pred.shape == target.shape aji = 0.0 for k in range(pred.shape[0]): aji += _AJI_fast(pred[k], target[k]) aji /= pred.shape[0] return aji def _AJI_fast(pred_arr, gt): gs, g_areas...
7a666c34685436bb2c5a04538ac4bc8d760898956c702b675e1ba241c4cfe8f8
Python
1,249
38
# Copyright (c) OpenMMLab. All rights reserved. import torch from mmdet.core import build_assigner, build_sampler def _dummy_bbox_sampling(proposal_list, gt_bboxes, gt_labels): """Create sample results that can be passed to BBoxHead.get_targets.""" num_imgs = 1 feat = torch.rand(1, 1, 3, 3) assign_co...
9a472c4164e2986fbaa4c9206547d64848455c7f84c226fd92290ca11c096b9d
Python
1,249
41
from torch.utils import data import os import numpy as np import time import glob class Dataset_training(data.Dataset): 'Characterizes a dataset for PyTorch' def __init__(self, data_dir, train_T, seg_num=100): self.data = np.load(data_dir) # T*bs*dim self.seg_num = seg_num ...
9d1242309365cddb7925974392c5b6aaad57d9a2ced552d5edec16b937a59534
Python
1,249
40
# from keras.preprocessing.text import Tokenizer # from keras.preprocessing import sequence import logging from transformers import AutoTokenizer def truncate(x, n): ret = [x[0]] + x[-n:] return ret class BERTTokenizer(): def __init__(self, model_name, truncation, padding, max_length=None): ...
ff3295f0067d2414037de05a60c16a511cbb863bd970b15f86f5f8280a409a28
Python
1,249
39
from base.results.base_result_tracker import BaseResultTracker class BaseEvaluator: """ Abstract base class for model evaluators. Evaluators run inference on a dataset and track metrics using result trackers. Concrete implementations should override the evaluate() method. Args: name ...
51ea685e7005cb27879030f3be1851b9bb9ecf6e5707ef6a150822b9929cb0c6
Python
1,250
34
# Copyright (c) OpenMMLab. All rights reserved. from ..builder import HEADS from .standard_roi_head import StandardRoIHead @HEADS.register_module() class DoubleHeadRoIHead(StandardRoIHead): """RoI head for Double Head RCNN. https://arxiv.org/abs/1904.06493 """ def __init__(self, reg_roi_scale_factor...
eae8920fff9721e155eeda1d64171196f369e3ef14b4fb1bd25c199d6ea50fba
Python
1,250
33
# Copyright (c) OpenMMLab. All rights reserved. from .inference import (collect_multi_frames, inference_bottom_up_pose_model, inference_gesture_model, inference_top_down_pose_model, init_pose_model, process_mmdet_results, vis_pose_result) from .inf...
82b323e3b3815616946d33f42fb01561a142eb1071bc6e8b08a34e87e571e227
Python
1,253
37
#!/usr/bin/env python3 from argparse import ArgumentParser from flystim.dlpc350 import make_dlpc350_objects def main(): parser = ArgumentParser() # FPS argument parser.add_argument('--fps', type=float, default=115.06) # RGB currents parser.add_argument('--red_current', type=float, default=0) ...
6c1ef7e8466b5e7b76120172f87448029bbf06ca64ecdd42bebc498482752a49
Python
1,260
45
import tensorflow as tf from keras import layers as kl from keras import Model, Layer from genomad.neural_network import igloo class OneHotLayer(Layer): def call(self, x): return tf.one_hot(x, depth=257, axis=-1) def create_encoder(): inputs = kl.Input(shape=(5_997,), dtype="int64") embedded =...
3cc59e87644140407b6684b37e47736f1460e5bcf0c97a85c1897f34699da605
Python
1,261
38
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np import torch from mmpose.models import MultiModalSSAHead def test_multi_modal_ssa_head(): # substantialize head train_cfg = dict(ssa_start_epoch=10) head = MultiModalSSAHead( num_classes=25, modality=('rgb', 'depth'), train_cfg=t...
82a5dd5c88d601bd1a8a44945269a2c54cbc1ad54a63a2f58b58c78e3e503d43
Python
1,262
44
import sys # Add gumpy path sys.path.append('gumpy') from gumpy import signal import numpy as np def preprocess_data(data, sample_rate=160, ac_freq=60, hp_freq=0.5, bp_low=2, bp_high=60, notch=False, hp_filter=False, bp_filter=False, artifact_removal=False, normalize=False): if notc...
dda68662c5117219cc9ce52a77bed40bb21ca39d24d72f3b3d41489f46e90b24
Python
1,262
44
import torch from torch import nn from torchvision import models class vgg16_feat(nn.Module): def __init__(self): super().__init__() self.vgg_layers = models.vgg16(pretrained=True).features self.layer_name_mapping = { '3': "relu1_2", '8': "relu2_2", '15'...
816c015d3e5d39b8ebfb20f5ce5f34a8779bb47eb84343677c93e6d11eba4b2b
Python
1,265
37
import json import matplotlib.pyplot as plt from dtor.utilities.utils import set_plt_config set_plt_config() x = lambda p, t: f'results/res_{p}_totfolds_{t}.json' files = [ {'prefix': "tumor_nonzero_weighted_scaled_aug3_resnet", 'tot_folds': 3}, {'prefix': "tumor_nonzero_weighted_scaled_aug5", 'tot_folds': 2}...
f8040576b0a5ccf70a348d06de03a3a0737d097db42aa0fdbba424fae4db023a
Python
1,267
24
from .base_options import BaseOptions class TestOptions(BaseOptions): """This class includes test options. It also includes shared options defined in BaseOptions. """ def initialize(self, parser): parser = BaseOptions.initialize(self, parser) # define shared options parser.add_argum...
fa79e80d1d628b3091138cd7ab3afee43a414f72d8beef7b60c44a0b3ee7389a
Python
1,274
57
import SV import os import re class CNVnator: match_calltype={'deletion':'DEL', 'duplication':'DUP'} CNVtype=0 coordinates=1 CNVsize=2 normalizedRD=3 eval1=4 eval2=5 eval3=6 eval4=7 q0=8 @staticmethod def parse_coordinates (coordinates): coord=re.sub (':', '-', coordinates) E=coord.split ('-') re...
5e0a36ccac3312855f08c4f4a870e648f0a0b5a35f19b52c93a69fcd6d3b1b98
Python
1,275
42
""" Build hdf5 files based on MURA datasets. """ import csv import os import h5py import imageio import re def readlist(path, file): with open(os.path.join(path, file)) as csvfile: csv_reader = csv.reader(csvfile, delimiter=',') list = {} h5_file = h5py.File(os.path.join(path, 'mura.hdf...
0de268811224312e5bb2b6a7fdc387f8b66531490b39e9e21fd2152bc2359f63
Python
1,276
36
import numpy as np from collections import deque class CDIIS: def __init__(self, overlap, maxNumFock=20): self._overlap = overlap self._fockQue = deque(maxlen=maxNumFock) self._commQue = deque(maxlen=maxNumFock) def NewFock(self, fockList, comm): self._fockQue.append(fockList)...
61eccb712afeafbd036bbbc57e6fbf8e84a004c72fc4167142728606a5a0acca
Python
1,276
44
import torch from torch import nn from torchvision import models class vgg16_feat(nn.Module): def __init__(self): super().__init__() self.vgg_layers = models.vgg16(pretrained=True).features self.layer_name_mapping = { '3': "relu1_2", '8': "relu2_2", '15'...
dbb2fdd038203f58135e112634d070924575fd7da13aaa9f32a85f76b1831aea
Python
1,281
38
import numpy as np import torch def one_cls_dice(output, target, label_idx): """ Calculate Dice metrics for one channel :param output:Output dimension: Batch x Channel x X x Y (x Z) float :param target:Target dimension: Batch x X x Y (x Z) int:[0, Channel] :param label_idx: :return: """ ...
3cdfcdb1a3c7184c33e937e6cc57a4fc33791e6240a2598b78bde4e96eaa2ca3
Python
1,282
39
# Copyright (c) OpenMMLab. All rights reserved. from mmcv.cnn import ConvModule from mmdet.models.builder import HEADS from .fcn_mask_head import FCNMaskHead @HEADS.register_module() class HTCMaskHead(FCNMaskHead): def __init__(self, with_conv_res=True, *args, **kwargs): super(HTCMaskHead, self).__init_...
4d14134b1c866e4faf3cbdb0a36d4e54bcc727a5c49b3e1683212322dbc60f9b
Python
1,283
41
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn import torch.nn.functional as F from ..builder import LOSSES @LOSSES.register_module() class BCELoss(nn.Module): """Binary Cross Entropy loss.""" def __init__(self, use_target_weight=False, loss_weight=1.): super().__init__() ...
2eddc8adbdb377f750ad78e363931bfbda691bd5fd863447865f4df1971deac7
Python
1,287
38
read('t.nex') t = var.trees[0] a = func.newEmptyAlignment(dataType='dna', symbols=None, taxNames=t.taxNames, length=1500) b = func.newEmptyAlignment(dataType='standard', symbols='xyz', taxNames=t.taxNames, length=1000) read('setsForSim.nex') a.setCharPartition('cp1') d = Data([a,b]) t.data = d # Model for Part 0 pNum...
f32680578d4f17615212040305cbc8203178598869fc570012a49e1f922ec57f
Python
1,288
49
from pybrid import utils default_cfg = { "exp": { "log_dir": "results/test", "seed": 0, "num_epochs": 20, "num_batches": 500, "batches_per_epoch": 50, "test_every": 1, "test_hybrid": False, "test_pc": False, "test_amort": False, "log_b...
7f4a5ef7bee6f3668824c2204ff30e04f1b193e37ff97a83bf8fb1e51e6dfd44
Python
1,290
52
# -*- coding: utf-8 -*- """ Created on Mon Mar 21 13:20:49 2022 @author: Daniel """ import numpy as np import os import shelve import pandas as pd import sys dirname = os.path.dirname(__file__) path = os.path.join( dirname, 'data', 'tempotron') path = '/home/baris/results/tempotron/adjusted_weight/disinhibited...
200922dbe2d80b82e920cbff5a63c30a5e3b5cdbfea68db3e9abac63cc73d557
Python
1,293
36
import os import subprocess as sp from typing import Callable from Bio import AlignIO from .shrinked_force_permutations import ShrinkedForcePermutationsDataset class ZwdDataset(ShrinkedForcePermutationsDataset): def __init__(self, root: str, transform: Callable = None): super().__init__(transform=transf...
c587738b67766159fea9934699227540824bd1ab4cf0e4fde7189c1bf0754959
Python
1,293
58
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import tempfile import mmcv import pytest from mmdet.datasets import CocoDataset def _create_ids_error_coco_json(json_name): image = { 'id': 0, 'width': 640, 'height': 640, 'file_name': 'fake_name.jpg', } ...
95c65cdbd557b5f6ad50b0ee819e66da6116f3465daeebba6d1d0a58d2092c26
Python
1,294
31
import argparse import warnings from argparse import ArgumentParser, Namespace from typing import Union, Text, Sequence, Any, Optional, Tuple class DeprecatedStoreAction(argparse.Action): def __call__(self, parser: ArgumentParser, namespace: Namespace, values: Union[Text, Sequence[Any], None], *a...
deafbcd80db018d087177f65a1fc2f00beaec4a5a26335b792ca5c9677a6cd3e
Python
1,300
34
#!/usr/bin/env python3 from flystim.stim_server import launch_stim_server from flystim.screen import Screen import numpy as np from time import sleep def main(): manager = launch_stim_server(Screen(fullscreen=False, server_number=0, id=0, vsync=True)) manager.load_stim(name='ConstantBackground', color=[0.5,...
70ecd0a357436f6487b560da4ed87d620dcc115455dc25cbebc3e2d0e1ed4f71
Python
1,301
43
# Copyright (c) OpenMMLab. All rights reserved. import argparse import subprocess import torch def parse_args(): parser = argparse.ArgumentParser( description='Process a checkpoint to be published') parser.add_argument('in_file', help='input checkpoint filename') parser.add_argument('out_file', h...
3a72d0d233345014fa1a89b09b7c65b108598256337467b1013735fd1cf2cc6f
Python
1,302
66
from importlib import reload import numpy as np import functions reload(functions) import functions as f # Parameters # Feedforward network tau_r = 0.001 # s inhibitory_weight = -1700. # inhibitory_rate = 100. # Hz n_inputs = 50 # number slope = 1e-4 # Stimulus min_stimulus = -np.pi/2 max_stimulus = np....
4e14784f4f8863bbd2693def7a9885e7f0352813f77396b80bd5e1463e83c9ea
Python
1,302
34
import setuptools with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setuptools.setup( name="gradient-accumulator", version="0.4.0", author="André Pedersen and David Bouget and Javier Pérez de Frutos", author_email="andrped94@gmail.com", description="Package for ...
f3e271cea6e54342c6899e6c352105ce34f865113ae12c40fb6b2e1257a8ae50
Python
1,302
33
# 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) import pytest from pytest import mark from torchmdnet import models from torchmdnet.models.model import create_model fr...
8df3b50a77e3611b61cae29b796215bbaf7f2e95db98eb30f8fdff0a571b1c33
Python
1,306
36
""" This module provides a comprehensive set of filters designed to assess and mitigate the off-target and cross-hybridization potential of oligonucleotide sequences, ensuring high specificity and low off-target effects. """ from ._filter_base import AlignmentSpecificityFilter, BaseSpecificityFilter, ReferenceSpecific...
e317ff2e09319fbc66cf18d5a11b863ae54dd4754b12324eb0ccd187565e6ee4
Python
1,312
37
import sys import os # os.system("module purge") cmd = "../../install/x86_64/bin/nrnivmodl ../../src/all_mechanisms" os.system(cmd) # generate model with fully distributed spines cmd = "./x86_64/special gen_model.py 1.3" if not os.path.isdir("./coredat/coredat_1150cell_400_1.0hz_back_noise_1.3spine"): os.system(...
295b5378aede0415c506ee7f2b5a2d69eee9849584d51ea3ea9ef6c293dc604c
Python
1,313
35
# 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 # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master...
2f554ef4d90311362b457b41d8df04e5a0f8f654cee328e1386dedc02cef10e8
Python
1,313
34
# 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 torch from torchmdnet.models.utils import rbf_class_mapping @mark.parametrize("name,rb...
9b92c23d77c0d1e7be7083d3385973c830b86667270a468605ff026cbdab6bd0
Python
1,315
67
#!/usr/bin/env python import sys import numpy as np from optparse import OptionParser parser = OptionParser() parser.add_option("-i", "--bedpe", dest="bedpe", help="BEDPE file") parser.add_option("-n", "--name", default="LUMPY BedGraph", dest="name", help="Name") (options, args) = pars...
c69ed5a81312919e507ef7f001e60792a399a9a98f6eb4a0f618d43617dbced5
Python
1,319
32
"""Helper function to load area-wise metrics, such as reconstruction errors. """ import pickle def load_metric_areawise(filename): """Takes metrics that was recorded areawise, but stored in a single file and returns the recorded values per area. See the metric class for which metrics are stored in this manner...
667e67c8cc023610b6f8145d92972c1fa9996fb69efe813954f2b709fabfada3
Python
1,320
26
# Copyright (c) OpenMMLab. All rights reserved. from .builder import DATASETS, PIPELINES, build_dataloader, build_dataset from .cityscapes import CityscapesDataset from .coco import CocoDataset from .coco_panoptic import CocoPanopticDataset from .custom import CustomDataset from .dataset_wrappers import (ClassBalancedD...
7708b3c11a64560fb2fd3447be4e93d6bcb65c0da628ebef61d62fdb42784cc0
Python
1,320
42
import torch.nn as nn from layers.misc import FlattenLayer 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 ThreeConvThreeFC...
5908bfd76de02e540658d5f96422d63208a9da442f56d8c33c89b8aa8b1d2c01
Python
1,321
32
import torchvision.transforms.functional as F class NormalizeBoth(object): """Normalize both image and label (with channel dim) tensors given the mean and standard deviation. :param mean: mean value. :param std: standard deviation value. """ def __init__(self, mean, std, training=True): i...
e1a0dfa8c4abf3a686179bf394528932cc43dc0bbe24771873cc42ba5563de42
Python
1,323
47
""" Class for holding data about a given model under evaluation. Includes the model name (String), trial type (0 - Executed or 1 - Imagined), the layers to disable during transfer learning (List), the Tensorflow model object and if the model uses multiple branches. After the experiment has been run on the model,...
003658f0efac475216af028d5d2e5714608b14bf07943992f97fe49823845792
Python
1,327
41
from setuptools import setup, find_packages import versioneer short_descr = ("Tools for parsing, manipulating, and replaying QIIME 2 " "analyses leveraging the framework's decentralized provenance " "data tracking.") setup( name='provenance-lib', version=versioneer.get_version(),...
459a0864023bfd11c82ac98c3d6c713ca0908fffc85b29ea8e4afab15cc464e2
Python
1,327
25
# -*- coding: utf-8 -*- """ Created on Sun May 29 12:57:04 2022 @author: fhu14 This is a rework of the dataset_gen_script.py used in previous versions of PaperPackage. That code was inelegant and messy, and it is intended that this packaged approach is more comprehensive, concise, and maintainable The first set of ...
e08544f6fde1bf47cd0a278932e0aca7aa2a285917b7bb06774314b2eaa087fe
Python
1,328
47
import json from pathlib import Path import requests import os def load_config() -> dict: """ Loads the config file :return: the config file :rtype: dict """ path = str(Path(__file__).parent) + os.sep with open(path + "config.json", "r") as f: config = json.loads(f....
a7c148dbe7e01d8a38c2a27f4e9c68334f3c0c3b616e4d05a91d01d7190d2348
Python
1,332
33
#!/usr/bin/env python import argparse import os import torch if __name__ == '__main__': parser = argparse.ArgumentParser(description='Convert MAE Pre-Traind Model to DEiT') parser.add_argument('--input', default='/data/code/deit/pretrained_model/pretrain_mae_vit_base_mask_0.75_400e.pth', type=str, metavar='P...
0c1c6fe1ba48a26069f4d54022e61b7e9c9f6b46ca438a20156634de8cb1ffe4
Python
1,336
50
import os.path import random import sys import cv2 import h5py import numpy as np import scipy.ndimage as ndimage from PIL import Image from data.base_dataset import BaseDataset, get_params, get_transform from data.brats_dataset import BratsDataset from data.brats_hgglgg_dataset import BratsHgglggDataset from data.nu...
9a37f1d837eb9a4d3304c9402c8de8e4cbd9f1164a301f1fecaddf61ee3e3554
Python
1,337
46
import argparse import pysam import numpy def print_sex(bam): """ Print sex based on chr x ratio Args: bam (str): Path to bam file """ idxstats = pysam.idxstats(bam) chr_ratio = [] # Calculate read / chromosome length ratio per chromosome for chr in idxstats[0:24]: chr = chr.st...
1bbe293267ee87cc03bb6d4a5c4e577c6c8f959d44cae29a851b21a7b6cc067d
Python
1,338
46
read('../A_NavidiAlignFromYang/navidiSSRNA.nex') d = Data() read('t.nex') #readFile('t31.WithRates.nex') t=var.trees[0] t.data = d t.newComp(free=1, spec='empirical') t.newComp(free=1, spec='empirical') t.newComp(free=1, spec='empirical') t.newComp(free=1, spec='empirical') t.newComp(free=1, spec='empirical') t.newCom...
478cd77588d99ca2c1a2160631b40a9989e073e8e60295edeb64e62b12b583b8
Python
1,340
47
import torch.distributed as dist import torch.multiprocessing as mp import os import os.path as osp import sys import numpy as np import copy from lib.cfg_holder import cfg_unique_holder as cfguh from lib.cfg_helper import \ get_command_line_args, \ cfg_initiates from lib.model_zoo.sd import version from lib...
52e4b5c2e88a0e0ef5c67c749ca6c9ff5cde0f8a874a9a76fdc118aac2c7d34c
Python
1,342
43
# Use the mb cons tree as the main tree, and add supports from the paup boot tree. # We need an ordered list of taxNames. read('dB.nex') a = var.alignments[0] # a.taxNames is the list we want. # Read in the two trees. The mrbayes con file has 2 trees; we only # want the first one. read('mbout.con') tMB = var.trees[0...
a63c0b9af51aec8a70e88ce48f4c1b2a944a8b05201c23c63876ccb8ffb779a4
Python
1,349
28
import manager_0_user_params as upar from A_config import a10_config from B_preprocess import b50_yield_data_analysis from E_viz import e50_yield_data_analysis if __name__ == '__main__': """ Main function for analysing yield data """ #############################################################...