sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
5c9be7c66dc10eaff05b4281c81ffaf195263b5e29cda15db368afa3bbd21b49
Python
6,434
176
import torch import torch.nn as nn import copy import numpy as np from scipy.io import mmread from scipy.io import mmwrite from sys import getsizeof # user specificed dataset name vector used to train autoencoder and impute datasets = ['jurkat', 'monocyte','mbrain','pbmc','lymphoma','293t','bmmc','human_mix',...
74bfc85bc20ec52be599d25f5f61a24bec1af1b036e8615ecc54f643c582de83
Python
6,434
190
# 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 from dataclasses import asdict import pytest from torch import eye, ones, randn_like, tensor, zeros from torch.distri...
be5b78dc7c590285f3bab9618c6dde7bdeb804907d547975c53f9f41d89a09b9
Python
6,444
163
# -*- coding: utf-8 -*- """ Created on Wed Jun 16 15:13:25 2021 @author: fhu14 Module for visualizing information stored in the loss tracker framework """ #%% Imports, definitions import pickle import numpy as np Array = np.ndarray import os import matplotlib.pyplot as plt from matplotlib.ticker import AutoMinorLoca...
0764761a79fbcd8dc0856dfef63c2420c0bac68d701dcf4dd3c4a9c4b60f4f98
Python
6,450
210
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import tempfile import mmcv import numpy as np import pytest import torch from mmpose.apis import (extract_pose_sequence, inference_interhand_3d_model, inference_mesh_model, inference_pose_lifter_model, ...
437085d121eb2ea8fba7579e815c27ea7a0ab0048fc914777064fb6423bf50cb
Python
6,450
226
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/panoptic_body3d.py' ] checkpoint_config = dict(interval=1) evaluation = dict(interval=1, metric='mAP', save_best='mAP') optimizer = dict( type='Adam', lr=0.0001, ) optimizer_config = dict(grad_clip=None) # learning policy ...
944586ed09e89c4d4adfaa6972f55cfedf3ea8190475e75011d4881c016df96f
Python
6,460
168
import os import sys import pandas as pd # from shutil import rmtree import numpy as np from rdkit import Chem from rdkit.Chem import AllChem from rdkit.Geometry import Point3D # from rdkit.Chem.Draw.IPythonConsole import drawMol3D from ppqm import XtbCalculator import psi4 import time from datetime import datetime f...
e1bc4fcd947703f4e528b2bd12051ca959b075c34c9563096aef366df0198b3e
Python
6,460
184
# Copyright (C) 2022-2025 ETH Zurich, Marc Lehner and other DASH contributors. from typing import Tuple, Union import numpy as np import pandas as pd from numba import njit from serenityff.charge.tree.atom_features import AtomFeatures from serenityff.charge.tree_develop.develop_node import DevelopNode from sereni...
426f1fe6c0938d82680054a78e1cd84a0b6dfe3745120b848fef3759eadc8d8f
Python
6,461
171
# Copyright (c) OpenMMLab. All rights reserved. import torch from mmcv.ops.nms import batched_nms from mmdet.core.bbox.iou_calculators import bbox_overlaps def multiclass_nms(multi_bboxes, multi_scores, score_thr, nms_cfg, max_num=-1, ...
eef6797a1e8dbd5715f5dffc47dfc65e1196ef7d639b272549d9003b2b14f092
Python
6,461
110
import os import time import json from pathlib import Path import pandas as pd import numpy as np import calendar from A_config import a10_config from B_preprocess import b100_load from D_modelling import d100_modeller from F_post_processsing import F110_process_opeForecast_output import manager_0_user_params as upar ...
3bbfa303ee13e1413c952510167e70eefceb183eec9aaa04a81ca61d3b599241
Python
6,463
168
# 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 torch from torch import Tensor, nn from sbi.neural_nets.estimators.base import ConditionalEstimator class Ra...
9a1aa57e4adc0dfdeefe40d650e64b55bc95de1d78373770244a18196fc2e0ba
Python
6,463
173
from tensorflow.keras.layers import Layer from tensorflow.keras import initializers import tensorflow as tf # https://stackoverflow.com/questions/65195956/keras-custom-batch-normalization-layer-with-an-extra-variable-that-can-be-change # https://github.com/dksakkos/BatchNorm/blob/main/BatchNorm.py @tf.keras.utils.reg...
ae5c781b7f3a7aa9ecb36e1e995fb7a1214931e4ac70d2bdc065fa2adebfc061
Python
6,463
145
import os os.environ['FOR_DISABLE_CONSOLE_CTRL_HANDLER'] = '1' import hane import tools import pickle import glob from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter def parse_args(): parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter, conflict_handler=...
7a76774634e8d86818cdf1f10ff0d0b763552ff51b2bebdd8f2171108264ea91
Python
6,464
193
# Copyright (c) OpenMMLab. All rights reserved. import os import warnings from argparse import ArgumentParser import cv2 import mmcv from mmpose.apis import (collect_multi_frames, inference_top_down_pose_model, init_pose_model, process_mmdet_results, vis_pose_result) ...
f4e629b813562eff03817f7214407eadcd9d196378965d4e8863c27784a51b11
Python
6,464
151
import logging import os import h5py import numpy as np import torch import torch.utils.data as data logging.basicConfig() logger = logging.getLogger() logger.setLevel(logging.INFO) client_ids_train = None client_ids_test = None DEFAULT_TRAIN_CLIENTS_NUM = 3400 DEFAULT_TEST_CLIENTS_NUM = 3400 DEFAULT_BATCH_SIZE = 20...
585189aedb8eafa2dbd65c37309ec625a0860bca6bdb32a13edf695a36ce3492
Python
6,465
136
import numpy as np import imageio import os import time import torch from torch.utils.data import DataLoader from torch.utils.data.distributed import DistributedSampler from data import set_up_data from utils import get_cpu_stats_over_ranks from train_helpers import set_up_hyperparams, load_vaes, load_opt, accumulate_s...
4d45ea652c5a9444abd40fd755c563adaaaf4fc7da76ac42dfbaa4cb57ef7698
Python
6,469
174
from jax import lax import jax.numpy as jnp from functools import partial from einshape import jax_einshape as einshape from collections import namedtuple import jax jax.config.update("jax_enable_x64", True) def tridiagonal_solve(dl, d, du, b): """Pure JAX implementation of `tridiagonal_solve`.""" prepend_zero =...
b13b6169076c72c0e04a0e8f31cb39cea4b1b2fda3ac77851c9ce8580f281913
Python
6,471
167
import logging import torch.utils.data as data import numpy as np import h5py import os from .data_utility import init_transform, count_samples, build_pairs logging.basicConfig() logger = logging.getLogger() logger.setLevel(logging.INFO) def get_transforms(): transforms_train = ["Resize", "RandomCrop", "Rando...
0c9cdf9d89d1e1af7558e6d512e50f95946867e6a7f6f97f9dd1357e036d0855
Python
6,479
139
from collections import namedtuple def make_list(length, prefix): return [f'{prefix} {i}' for i in range(length)] our_atoms = ['B', 'C', 'N', 'O', 'F', 'P', 'S', 'Cl', 'Br', 'I', 'other'] our_neighs = make_list(6, 'N') # max 5 neighbours our_hydro = make_list(5, 'H') # max 4 hydrogens charge = 'charge' ringne...
78643bfa42851af4b3351a8a1c6784d309c53337c5e9cd7c2cbd662911f102a2
Python
6,481
164
# Copyright (c) OpenMMLab. All rights reserved. import copy import numpy as np import pytest from mmcv.utils import build_from_cfg from mmdet.core.mask import BitmapMasks, PolygonMasks from mmdet.datasets.builder import PIPELINES from .utils import check_result_same, construct_toy_data def test_shear(): # test ...
04910608f0084639a48b22fd074f7ef81c061f00565c1342dc24f11ed7c93bfd
Python
6,483
186
# Copyright (c) OpenMMLab. All rights reserved. import time import uuid import warnings from typing import Callable, Dict, List, Optional import numpy as np Filter = Callable[[Dict], bool] class Message(): """Message base class. All message class should inherit this class. The basic use of a Message in...
3d6e751825b736325299a3026ff27361651a80e0b5227da4d297eac0ae5ec66b
Python
6,487
197
from p4.p4exceptions import P4Error from p4.tree import Tree from p4.nexus import Nexus from p4.var import var import sys import os import string import io import copy class TreeFileLite(object): """Get trees in big files without reading the lot into memory. P4 Tree objects are a little obese, and large tr...
9b405772463412bab8ed532747c42a0000215c92dc20ef800ae72772c4703192
Python
6,489
194
# -*- coding: utf-8 -*- """Upsampling module. This code is modified from https://github.com/r9y9/wavenet_vocoder. """ import numpy as np import torch import torch.nn.functional as F from parallel_wavegan.layers import Conv1d class Stretch2d(torch.nn.Module): """Stretch2d module.""" def __init__(self, x_...
e40dbe35d3b868832b2c0c8d8839b162d1d59c0543c86373b89dfe2fa122e87b
Python
6,489
153
import pandas as pd from A_config import a10_config import os import seaborn as sns import matplotlib.pyplot as plt from matplotlib.patches import Patch from F_post_processsing import F100_analyze_hindcast_output """ Compare two results (e.g. without SF vs with SF) """ # configuration files and run names baseDir = r'...
50d8034609d890a19d309ab53fb0914db8752bd7d70291f504ed48b8e856fca5
Python
6,498
230
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Dec 28 16:49:14 2021 @author: baris """ from pydentate import neuron_tools from grid_model import grid_simulate import shelve import copy import time import numpy as np from pydentate_integrate import granule_simulate import os import glob """Setup""...
7e0baf85be3e7224e26a92a28ed584d6d686c4dd69def87eb220bee86fcbbedf
Python
6,502
188
from torchmdnet.priors.base import BasePrior from torchmdnet.models.utils import Distance import torch as pt from torch_scatter import scatter class D2(BasePrior): """Dispersive correction term as used in DFT-D2 Reference --------- Grimme, Stefan. "Semiempirical GGA-type density functional constructe...
a693fe9da6769126d99080a9e7058a98c1790468ee9604542c30dd63463aee67
Python
6,505
161
# -*- coding: utf-8 -*- """ Created on Tue Apr 26 23:30:09 2022 @author: fhu14 Module for handling table-level operations for computing deltas and other elements. This will take advantage of pandas functionality. Dictionaries will be generated from the json files that output files are parsed into """ #%% Imports, de...
13d6de885bd55de8b403aed1c02fa207bbe3ea3f067914348d56ce5c46523213
Python
6,507
137
############################################ # Imports ############################################ import os from oligo_designer_toolsuite._exceptions import ConfigurationError from oligo_designer_toolsuite.database import OligoDatabase, ReferenceDatabase from oligo_designer_toolsuite.oligo_specificity_filter import...
cb4896f9ee879335ba127274c7043e54393351c0beb7adf10a8ee05b636797a3
Python
6,517
188
import torch import torch.nn as nn from models.resnet import resnet18, resnet50, resnet101 from functools import partial from utils.constants import DEVICE, FC_DIM, NUM_CLASSES class SegmentationModule(nn.Module): """ Segmentation Module class """ def __init__(self, net_encoder, net_decoder): ...
25b47cd733be2c7d813935c3a0885c5e970da04e8a3634e8b6263471fd3f6dc9
Python
6,520
188
import matplotlib.pyplot as plt import pandas as pd import numpy as np import seaborn as sns def plot_val_test_predictions(df_val_, df_test_, av_rmse_val_, r2s_val_, av_rmse_test_, r2s_test_, xlabels_, ylabels_, filename_val='', filename_test=''): axes_min = np.floor(np.min(df_val_[:...
406c8b3c4ea31bd42f5e2e0733e6264a22632478fcd013ae6b0904b90237709d
Python
6,521
158
import sys sys.path.append("./") import time import traceback import os import gc import time import traceback import h5py import numpy as np import pandas as pd from allensdk.core.brain_observatory_cache import BrainObservatoryCache from allensdk.brain_observatory.brain_observatory_exceptions import EpochSeparatio...
938d01083d2bd84568ff50fafca056d3292040991a335e78a8058913716a34ba
Python
6,525
201
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import numpy as np import pytest import torch from mmpose.models import build_posenet def _create_inputs(joint_num_in, joint_channel_in, joint_num_out, joint_channel_out, seq_len, ...
61dea247dc755caf108bcc85f0f843624949beaa37ab278a553b07cc45bba16a
Python
6,527
201
import os import os.path import torch.utils.data as data from PIL import Image def has_file_allowed_extension(filename, extensions): """Checks if a file is an allowed extension. Args: filename (string): path to a file Returns: bool: True if the filename ends with a known image extension...
b2cd981d609a76b6a2d9aa03ae7ebf391accd1a3daf15944c709f3cc7a0adb25
Python
6,530
182
"""test_merge_layers.py This file is part of the test suite for keras2c Implements tests for merge layers """ #!/usr/bin/env python3 import unittest from tensorflow import keras from keras2c import keras2c_main import time from test_core_layers import build_and_run __author__ = "Rory Conlin" __copyright__ = "Copyrig...
e840c6531555cb71c6260e51f87fb62a3d1035b3b08c52203a2ddd649ee3c7ec
Python
6,530
180
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/h36m.py' ] evaluation = dict(interval=10, metric=['mpjpe', 'p-mpjpe'], save_best='MPJPE') # optimizer settings optimizer = dict( type='Adam', lr=1e-3, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config =...
741bc0e74c57c5fb641ffdde29612a26ec62ffaa1513954f384937761b77727d
Python
6,532
136
import pandas as pd import numpy as np import os import glob import matplotlib.pyplot as plt from utils.processSuite2pOutput import correct_suite2p_outputs class Run: def __init__(self, summary, exp_id): self.fishID = summary.fishlabel[exp_id] self.runID = summary.run[exp_id] self.date = ...
952b64e02ed9728736c716605b46ff2eff793f841dba1c2a9f463004dfad9a5a
Python
6,535
164
# Copyright (c) OpenMMLab. All rights reserved. import copy import warnings from mmcv.cnn import VGG from mmcv.runner.hooks import HOOKS, Hook from mmdet.datasets.builder import PIPELINES from mmdet.datasets.pipelines import LoadAnnotations, LoadImageFromFile from mmdet.models.dense_heads import GARPNHead, RPNHead fr...
18f2c1646f5cfe4135e9df66857782bf2a0b47e95eb4b0f7e81b8071e991dbdf
Python
6,538
133
random_seed = 234 from utils.rnd import set_random_seeds set_random_seeds(random_seed = random_seed) from pipeline.crossvalidation_pipeline import CrossvalidationPipeline from pipeline.one_split import OneSplitPipeline from utils.logs import set_logging import logging import datetime import imp import os import sys ...
740e27b8c1e5bce5886c43e870757e1cf3d1d09fcc6fd5d633e9dd7f05488b17
Python
6,540
118
""" Run the postprocessing from Shiva on arbitrary input data. Typically expects a binarised cluster mask (from some predictor), a brain parcellation (or mask), and the type of prediction corresponding to the cluster mask (e.g. WMH, PVS, CMB, LAC). The postprocessing will then compute the different statistics for the c...
e5297740637fada4b0402bdda5db4e5ec4c78afc303c1e365968d94df0cffb07
Python
6,549
170
# 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/> """Run labels, results files and the results table of mini SBIBM.""" import re import subprocess from pathlib import Path from typing import Callable fro...
2d9b6e4b74c8f2bd1ac0fb014845923a299580cea7cbbf1312b8e2218c70e649
Python
6,550
214
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.autograd import Variable from torch.nn.parameter import Parameter import math import utils import argparse import data_loader from ipdb import set_trace from sklearn import metrics SEQ_LEN = 48 def binary_cros...
85adc1e361c3975c2f6854cb513bcccb89c416a21cb1bb6dd1fe293f21d15349
Python
6,561
175
import os import numpy as np from os.path import join, exists from sklearn import metrics from config_path import PLOTS_PATH from matplotlib import pyplot as plt from sklearn.metrics import confusion_matrix from paper_analysis_revision2.plot_utils import plot_auc_all, plot_auc_bootstrap, plot_prc_all, plot_confusion_m...
7e99990a8b8543868f73b842d7f78e6feca2d9c40882d9e4d7f7dae4755b2c5c
Python
6,567
185
# Copyright (c) OpenMMLab. All rights reserved. import os import os.path as osp import tempfile import warnings from collections import defaultdict import json_tricks as json import numpy as np from mmcv import Config from ...builder import DATASETS from .gesture_base_dataset import GestureBaseDataset @DATASETS.reg...
4d2014a47d1c4023fc455f8d597a75680448e34c657a6b6901b0f2a0d43d9ea3
Python
6,568
163
# Copyright (c) OpenMMLab. All rights reserved. import math import torch import torch.nn as nn from mmcv.cnn.bricks.transformer import POSITIONAL_ENCODING from mmcv.runner import BaseModule @POSITIONAL_ENCODING.register_module() class SinePositionalEncoding(BaseModule): """Position encoding with sine and cosine ...
3e63406e795fb87ebf8f42c4bba23079577bf62f08626be209f3caa3a86d4a35
Python
6,576
203
from multiprocessing import shared_memory import random import pickle import time import copy import torch import torch.distributed as dist from lib.cfg_holder import cfg_unique_holder as cfguh def singleton(class_): instances = {} def getinstance(*args, **kwargs): if class_ not in instances: ...
4808ba81e11e5acfe24ef33bb4dcc25b4b538c1e6d2f448941f01a0c3ab78e3e
Python
6,576
168
""" This Python script packages the eye tracking data into `BASE_DIR`. `BASE_DIR` can be supplied in the argumemts: e.g., python package_eye_data.py /path/to/target/dir Specifically, it generates the following file structure (inside the target directory): `BASE_DIR`/data/[...].npy: Stores .npy files for eye tracki...
f67f1cb407405ccd864a224b0b3611994a28c470ad85cc655f4de9a26bcd3a54
Python
6,577
158
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn from mmcv.cnn import ConvModule from mmcv.ops.merge_cells import GlobalPoolingCell, SumCell from mmcv.runner import BaseModule, ModuleList from ..builder import NECKS @NECKS.register_module() class NASFPN(BaseModule): """NAS-FPN. Implemen...
011039991d2ad56564dcff7bf3f922b10b1d14f40d9501d9b88d67c03cb5df46
Python
6,580
144
"""Sample splitting for DoubleML models with independent or clustered observations.""" from abc import abstractmethod from doubleml.utils._checks import _check_sample_splitting from doubleml.utils.resampling import DoubleMLClusterResampling, DoubleMLDoubleResampling, DoubleMLResampling class SampleSplittingMixin: ...
6e5cc9d0d1d381e662e0b795e8c4cda7ed7c46dd3f74cd625b391e695de4b34c
Python
6,585
188
# Copyright (c) OpenMMLab. All rights reserved. import warnings import torch.nn as nn from .. import builder from ..builder import POSENETS from .base import BasePose try: from mmcv.runner import auto_fp16 except ImportError: warnings.warn('auto_fp16 from mmpose will be deprecated from v0.15.0' ...
ca43e2513d528ed2ba1142ada98c1467e5257926dde35ce4051f4e9526e7f5bf
Python
6,590
235
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Dec 28 16:49:14 2021 @author: baris """ from pydentate import neuron_tools from grid_model import grid_simulate import shelve import copy import time import numpy as np from pydentate_integrate import granule_simulate import os import glob start = ti...
a6ce93919d609ad04e8134a84d4b0f263ffa7d8610aff79103e0478819c6cd7c
Python
6,591
169
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule, caffe2_xavier_init from mmcv.ops.merge_cells import ConcatCell from mmcv.runner import BaseModule from ..builder import NECKS @NECKS.register_module() class NASFCOS_FPN(BaseModule): ...
f132c79ddd2d7628c51495e63fe3310d58d3e7a3114fc1c52afe90dadde4fdf7
Python
6,594
117
# -*- coding: utf-8 -*- import yaml def caption_parse_rules(offset,position_key,separate,char_type,char_num): """ Create matching rules and based on custom characteristics of caption text described in input vars :param offset: characters used to set off material that is amplifying or explanatory :para...
9612413c65b6f1cb6572a3a5f3f05bc9c4a6002c3c371b736d2bf59e64e668a7
Python
6,595
178
import os import numpy as np from scipy.interpolate import InterpolatedUnivariateSpline # interface class SkfInfo(object): def __init__(self, name, paramPath): elem1, elem2 = name.split('-') self.__homo = (elem1 == elem2) self.name = name with open(os.path.join(paramPath, name + '...
bed290cf791d0659abbdd687b2f820e53c56a4288e8dd76fd6879800d6211576
Python
6,596
171
import argparse import glob import os import math import pandas as pd import pickle from tensorflow.core.util import event_pb2 from tensorflow.data import TFRecordDataset # Parsing script for random-search-based hyperparameter optimization. # DEFINE PARSER def init(): parser = argparse.ArgumentParser(description...
0e2ab139de3bab244eac0b7b7c0f693b30d8270ee6136e5d82e201ba966e9473
Python
6,597
158
# 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 from typing import Optional import torch from torch import Tensor, nn from sbi.neural_nets.embedding_nets.fully_connected import FCEmbed...
956033ea4c6f725420c3a5701c11b904af0fedf7e5d1e1bad55d159b9552610f
Python
6,600
172
# Copyright (c) OpenMMLab. All rights reserved. import copy import numpy as np import pytest from mmcv.utils import build_from_cfg from mmdet.core.mask import BitmapMasks, PolygonMasks from mmdet.datasets.builder import PIPELINES from .utils import check_result_same, construct_toy_data def test_rotate(): # test...
45c89c11c612f5164d074090a450aa7e54a50890453ce020711371f3ad3889ad
Python
6,606
225
import glob from pathlib import Path import mne import numpy as np import torch from scipy.signal import resample_poly from sklearn.preprocessing import RobustScaler from anysleep_no_hydra import AnySleep def load_edf(input_file: str, channels_to_include, resample_rate): """ Load and preprocess an EDF file ...
b224e341e7ad7b6fdd46c1186f568e8e5af6c477e00d7462441f1a9c4d19cef2
Python
6,607
222
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/h36m.py' ] checkpoint_config = dict(interval=20) evaluation = dict( interval=10, metric=['mpjpe', 'p-mpjpe', 'n-mpjpe'], save_best='MPJPE') # optimizer settings optimizer = dict( type='Adam', lr=1e-3, ) optimizer_confi...
97b7b5ebf512baa2fae63fae5ca38bb24a04524bcfd16a8e44b176373a1bb02a
Python
6,608
189
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn from .. import builder from ..builder import POSENETS @POSENETS.register_module() class MultiTask(nn.Module): """Multi-task detectors. Args: backbone (dict): Backbone modules to extract feature. heads (list[dict]): heads t...
5319f95f670b45c382ada2cd3d609e3e1c372358d5f6839fc5725c049a3fb7d4
Python
6,613
162
import logging import os import h5py import torch import torch.utils.data as data from . import utils logging.basicConfig() logger = logging.getLogger() logger.setLevel(logging.INFO) client_ids_train = None client_ids_test = None DEFAULT_TRAIN_CLIENTS_NUM = 715 DEFAULT_TEST_CLIENTS_NUM = 715 DEFAULT_BATCH_SIZE = 4 ...
ac9b0c4333f73c57c85e01bf88db89baed64671d455e5ab175c4cf471267ab04
Python
6,617
310
import re, sys from VCF import VCF ZYG={'0/1':'HET', '1/1':'HOMO', './.':'UNKNOWN', '0/0':'REF'} class LUMPY (VCF): def __init__ (self, name): super (LUMPY, self).__init__(name) def filter_func(self, chrom, beg, end, type, E): #if re.search ('0/0', E[-1]): return True if i...
8a046a05243418445540d0f743a1db96ace40b5e8b5de4c1d250ee7ade689db4
Python
6,630
160
import pickle import numpy as np import matplotlib.pyplot as plt import numpy as np import matplotlib.pyplot as plt import pickle from absl import flags, app cmap_1 = 'Blues' cmap_2 = 'Reds' # cmap_1 = 'bwr' def calculate_error(pred, label, mask): ''' pred: [batch, len, 1] label: [batch, len, 1] mas...
de726e8385baec13da8e050b3dc26817e4c8049d5b66171e88cbce9c2b20c025
Python
6,632
165
import pandas as pd from A_config import a10_config import os import seaborn as sns import matplotlib.pyplot as plt from matplotlib.patches import Patch from F_post_processsing import F100_analyze_hindcast_output """ Compare two results (e.g. without SF vs with SF) """ # configuration files and run names # baseDir = ...
282370bc480f18c9e53997cf12fb0af862da3b73f7b3c6cc6aa186864b6b66b4
Python
6,638
176
# -*- coding: utf-8 -*- """Process all the options""" __author__ = "Sean Benson" __copyright__ = "MIT" import json import argparse norms = { 'torchvision_3d': ([0.43216, 0.394666, 0.37645], [0.22803, 0.22145, 0.216989]), 'torchvision_2d': ([0.485, 0.456, 0.406], ...
94c55f4df1efd576b49f053adba604a5d22a627419b9a5ac643c057e742af39c
Python
6,638
180
# Copyright (c) OpenMMLab. All rights reserved. import copy import logging import torch.nn as nn from mmcv.cnn import ConvModule from torch.nn.modules.batchnorm import _BatchNorm from ..builder import BACKBONES from .base_backbone import BaseBackbone from .utils import InvertedResidual, load_checkpoint @BACKBONES.r...
2dd1dbbfb3461c7ad919921f8885f9923ed3f424a6b9f2fa34634ae3c4ea93c3
Python
6,639
153
# -*- coding: utf-8 -*- """ Created on Mon Jul 5 12:50:30 2021 @author: fhu14 """ #%% Imports, definitions import os import pickle from DFTBPlus import ( filter_dataset, find_all_used_configs, read_detailed_out, run_organics, ) from .helpers import auorg_dir, get_dftbplus_executable, mio_dir, test_...
4dc67207ef903bbfc0ed65a0fe2dd65c9c5111824168320f3b197efcf8b79e45
Python
6,642
180
#!usr/bin/env python #coding:utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import os import numpy as np from keras.preprocessing.image import ImageDataGenerator from keras.callbacks import ModelCheckpoint, EarlyStopping f...
8fcc42055238768c361ac88dccb3a3afeb2180bc20ecfc658371c57cb51b121a
Python
6,645
171
# Copyright (c) OpenMMLab. All rights reserved. import warnings import torch from mmdet.core import bbox2result from ..builder import DETECTORS, build_backbone, build_head, build_neck from .base import BaseDetector @DETECTORS.register_module() class SingleStageDetector(BaseDetector): """Base class for single-st...
32e125f08fc29431f39cc545e92e5b5b03204a912e29ec2c24e2d4f7051d45d3
Python
6,647
159
from scipy.sparse import csgraph from theano import tensor as T from utils import graph_to_adj import networkx as nx import numpy as np import scipy.sparse as sparse import theano # For dynamic loading: name of this method should be the same as name of this python FILE. def netmf(ctrl, graph): '''Use NetMF as the...
992fb40d7caceddd727bfa840ff733c3c97ee49b0df2e36bf10a9678d657af44
Python
6,649
201
""" Predict sleep stages from an EDF file and visualize the hypnogram. This script demonstrates how to use the standalone AnySleep model to: 1. Load and preprocess EEG/EOG data from an EDF file 2. Run inference to get sleep stage predictions 3. Save raw logits and visualize the predicted hypnogram The script handles ...
209ef88bf67138bffe1e1c37c1e46b6fc998cc7636eede42b3dccd0fb092e630
Python
6,654
170
import os import numpy as np from scipy.interpolate import InterpolatedUnivariateSpline # interface class SkfInfo(object): def __init__(self, name, paramPath): elem1, elem2 = name.split('-') self.__homo = (elem1 == elem2) self.name = name with open(os.path.join(paramPath, name ...
f35b2c845ca95beeed46aef2362b9ada6db5c0abeef1be30a0254508a7ce512c
Python
6,654
155
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np import torch from mmdet.core import bbox2roi from mmdet.models.losses import SmoothL1Loss from ..builder import HEADS from .standard_roi_head import StandardRoIHead EPS = 1e-15 @HEADS.register_module() class DynamicRoIHead(StandardRoIHead): """R...
8517980abb8d5a9d8ec5b967eae345a554a298817beaf4e186b5c75a385c3753
Python
6,656
160
# Copyright (c) OpenMMLab. All rights reserved. from mmdet.core import bbox2roi from ..builder import HEADS from ..losses.pisa_loss import carl_loss, isr_p from .standard_roi_head import StandardRoIHead @HEADS.register_module() class PISARoIHead(StandardRoIHead): r"""The RoI head for `Prime Sample Attention in Ob...
b63fedd0d563db68de137b9d388a397116598cb8c32363ee469413a09609132f
Python
6,662
198
import glob from pathlib import Path import mne import numpy as np import torch from scipy.signal import resample_poly from sklearn.preprocessing import RobustScaler from anysleep_no_hydra import AnySleep def load_edf(input_file: str, channels_to_include, resample_rate): """ Load and preprocess an EDF file ...
9fc5f021108e26762407b53c696d0abef7ea3254b8b2587ca0e8d4b6039f8a1f
Python
6,665
146
# Copyright (c) OpenMMLab. All rights reserved. import torch from ..builder import BBOX_ASSIGNERS from ..match_costs import build_match_cost from ..transforms import bbox_cxcywh_to_xyxy from .assign_result import AssignResult from .base_assigner import BaseAssigner try: from scipy.optimize import linear_sum_assig...
7f851569e8033d17e7a2612c4012853cf92c8c09513b2b4ef67f0c8125201ebd
Python
6,666
173
''' * Copyright (c) 2022, salesforce.com, inc. * All rights reserved. * SPDX-License-Identifier: BSD-3-Clause * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause * By Junnan Li ''' import argparse import os import ruamel_yaml as yaml import numpy as np imp...
b2a6be228fed3f3dd4f696c187c418bcc62c6717c53c72637b8ba54945516f2a
Python
6,667
210
import random import cvxpy as cp import numpy as np import torch from scipy.linalg import ldl # ambuguous RNA letters: GAUCRYWSMKHBVDN rna_letters = [letter for letter in '-.GAUCRYWSMKHBVDN'] rna2index = {letter: index for index, letter in enumerate(rna_letters)} rna2index['START_TOKEN'] = len(rna2index) rna2index['...
f2b4d8fc8e31268b4c6b3c84b7dfd187ee19d76fc93f25bf031878b202c8ffb7
Python
6,668
179
from typing import Type, Union import warnings import datetime import unittest import logging import os import pandas as pd import numpy as np log_file = os.path.join(os.path.abspath("./logs"), "cohort.log") with open(log_file, 'w') as fi: fi.write(f'Logs {datetime.datetime....
c6ea56d0e3d73e5e133449c41c0ca1669f6032e23909a50c9a9a30ea3e29a2ab
Python
6,675
155
# Copyright (c) OpenMMLab. All rights reserved. import warnings import torch import torch.nn as nn from mmcv.runner import ModuleList from ..builder import HEADS from ..utils import ConvUpsample from .base_semantic_head import BaseSemanticHead @HEADS.register_module() class PanopticFPNHead(BaseSemanticHead): ""...
76c7ae7788ea72c1240b2b01174d168b564125f50f4bfb22bb08214d5ad97a67
Python
6,684
156
""" NNabla metadata script """ import json import os import sys import mako.template import yaml def _write(path, content): with open(path, "w", encoding="utf-8") as file: file.write(content) def _read_yaml(path): with open(path, encoding="utf-8") as file: return yaml.safe_l...
14fe3fb7fde4b8265eb1c769e073da16c6602484174f7ce4a05a08ce640cd02d
Python
6,697
146
# Copyright (c) OpenMMLab. All rights reserved. import torch from ..builder import BBOX_ASSIGNERS from ..iou_calculators import build_iou_calculator from .max_iou_assigner import MaxIoUAssigner @BBOX_ASSIGNERS.register_module() class ApproxMaxIoUAssigner(MaxIoUAssigner): """Assign a corresponding gt bbox or back...
75258ffa14ec4a3976e0bdd37ca783b18b38328c8213437f39a3dbc44af6c37e
Python
6,703
188
import torch import torch.nn as nn import torch.nn.functional as F from fedml_api.model.cv.darts.genotypes import PRIMITIVES, Genotype from fedml_api.model.cv.darts.operations import OPS, FactorizedReduce, ReLUConvBN class MixedOp(nn.Module): def __init__(self, C, stride): super(MixedOp, self).__init__(...
5a3a880acf3d66706525d7e175e2b9543c1c714dbc3a99e492ea9de67adae002
Python
6,705
155
from GUI_and_data_processing.Create_GUI import * from GUI_and_data_processing.Data_processing import * from Root_Morales_lab_codes.FibPhoEpocAveraging import * from Analysis_types.Whole_recording import * from Analysis_types.Peri_events import * from Root_Morales_lab_codes.FibPhoEpocAveraging_between_events import...
67ef5b1efd7e9d2a29e167913318dd00dcf5ea0cd38d7df0b4fc496f0c5e7d54
Python
6,709
137
import pickle import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches from jax.config import config import tensorflow as tf import os os.environ['XLA_PYTHON_CLIENT_PREALLOCATE'] = 'false' tf.config.set_visible_devices([], device_type='GPU') from collections import OrderedDict from ppri...
c95020e84f3fd9c08748df12a4ac73a518de2425c39141935a5ce4b71ecd718e
Python
6,710
218
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import numpy as np import pytest from mmcv import bgr2rgb, build_from_cfg from mmpose.datasets import PIPELINES from mmpose.datasets.pipelines import Compose def check_keys_equal(result_keys, target_keys): """Check if all elements in target_k...
c1e13f09752fba602a4fbe7b4a7b84173f1562f46739890650c3839b628d936d
Python
6,711
222
"""Provide pytest fixtures for the entire test suite. These fixtures create data and data modules that can be reused by other tests. """ import os import pytest import subprocess import torch from typing import Callable import yaml from daart.data import DataGenerator from daart.utils import build_data_generator ...
ec6826de578bf32657e400fc7a187d7d9aca7b90a65193a8363d133dd7cadd30
Python
6,715
109
#!/usr/bin/env python from os import path import pandas as pd import sys from picrust2.util import (prune_tree, read_fasta_ids) def get_lowest_nsti(nsti_table_dom1_path, nsti_table_dom2_path, dom1_name, dom2_name, verbose=False): '...
8646e82bc38a2cd4bad3a9c12f09b8db48b0e9107376743e2e730d727117546f
Python
6,719
201
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np import torch.nn as nn from mmcv.cnn import normal_init from mmpose.core.evaluation import (keypoint_pck_accuracy, keypoints_from_regression) from mmpose.core.post_processing import fliplr_regression from mmpose.model...
7e7159af6e6f4336a3bec778c7cf629b36f8b5103d71c6c0b9713822aa943a36
Python
6,739
176
# 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 os.path import join from tqdm import tqdm import torch from torch.utils.data import Subset from torch_geometric.lo...
7d0df21362c72c570610e54d12ce1093885864ec6f7ef1c06b06da54dd942876
Python
6,744
158
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np import torch from ..builder import BBOX_SAMPLERS from .random_sampler import RandomSampler @BBOX_SAMPLERS.register_module() class IoUBalancedNegSampler(RandomSampler): """IoU Balanced Sampling. arXiv: https://arxiv.org/pdf/1904.02701.pdf (CV...
740d606c989da846f69085459e27aa3008ccbe2733cd8d16b8e8a8a341c840b4
Python
6,746
198
import glob from pathlib import Path import mne import numpy as np import torch from anysleep_no_hydra import AnySleep from scipy.signal import resample_poly from sklearn.preprocessing import RobustScaler def load_edf(input_file: str, channels_to_include, resample_rate): """ Load and preprocess an EDF file f...
6b6a2deac6017ecd2f90d74e8e37e7c0e8e0bdd54dd7310cde6887a968d6dbbe
Python
6,747
212
import os import shutil import subprocess from pathlib import Path from genomad import database, utils class MMseqs2: def __init__( self, mmseqs2_output: Path, mmseqs2_directory: Path, proteins_output: Path, genomad_db: database.Database, use_minimal_db: bool = Fal...
21c00f899694a9da8c1dc66d86ecdd9d95ffebe04631bd14907db8ecd65fba2b
Python
6,749
157
import sys import os import numpy as np from Bio import SeqIO import multiprocessing ## Se añaden estas dos librerias para generar un indentificador único en los archivos 2d.npy y poder ejecutar varios análisis al tiempo. import random import string N = 5 uniqueID = ''.join(random.choices(string.ascii_uppe...
1656afd51e072a5550da0106df92a6881dc566103e60933d28661f30ace59321
Python
6,756
167
# Copyright (c) OpenMMLab. All rights reserved. import torch from mmdet.core.evaluation.bbox_overlaps import bbox_overlaps from mmdet.models.dense_heads import CornerHead def test_corner_head_loss(): """Tests corner head loss when truth is empty and non-empty.""" s = 256 img_metas = [{ 'img_shape...
041d14193f5eff427c3bfddfac3f24f8fac0941b92823475c2cd8e9716ae91fb
Python
6,766
191
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import tempfile import warnings from collections import OrderedDict import numpy as np from mmcv import Config, deprecated_api_warning from ...builder import DATASETS from ..base import Kpt2dSviewRgbImgTopDownDataset @DATASETS.register_module() c...
0ed085365005b9ca535ca29686dc6d2025f8ae09626632c0e59b52dd75b339b0
Python
6,766
196
############################################################################## # Kivy Launcher Interface # # by: Daniel Palmer PhD # # Version: 2.0 # ####...
f1ac6ff9dfc54567d3dc003f45d821307b5ffb4bd1fb02be6416db9413162e59
Python
6,766
178
# -*- coding: utf-8 -*- """ Created on Wed Oct 12 13:38:23 2022 @author: Daniel """ from phase_to_rate.neural_coding import load_spikes, rate_n_phase, load_spikes_DMK import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns import os import sys import matplotlib as mpl import pdb ...
6529196fe293e34fa854e133c97dff092d7fa3fd96ce579589bc75e475a42805
Python
6,768
187
import numpy as np from tqdm.auto import tqdm import torch from torch_geometric.data import Data from rdkit import Chem from rdkit.Chem.rdForceFieldHelpers import MMFFOptimizeMolecule import torchmdnet.datasets.geom_utils.utils def get_rmsd_confusion_matrix(data: Data, useFF=False): data.pos_ref = data.pos_ref....
f3bd63694d38d94c5ebb1befcde846b3c708b7357ae699fa862815a9f8e7f942
Python
6,771
199
import os os.environ['XLA_PYTHON_CLIENT_PREALLOCATE'] = 'false' from pprint import pprint import jax import jax.numpy as jnp import jax.tree_util as tree import numpy as np from functools import partial import haiku as hk import optax from absl import app, flags, logging from collections import namedtuple from tqdm i...
f38ad34f0952e8ac9b2d34beb74e6330f74f047033088dec0c99dd44d20d82a5
Python
6,780
186
# Copyright (c) OpenMMLab. All rights reserved. import argparse import copy import os import os.path as osp import time import warnings import mmcv import torch from mmcv import Config, DictAction from mmcv.runner import get_dist_info, init_dist from mmcv.utils import get_git_hash from mmdet import __version__ from m...
2dcb53c33b4299345db79dbf83daaa512ba4965a0dd1224787f8c18b2fc5f878
Python
6,782
189
from collections import defaultdict import itertools import random import igraph as ig import numpy as np class Sequence: def __init__(self, header, seq): self._header = header self._seq = seq @property def header(self): return self._header @property def id(self): ...