sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
34d470083008e0c2fcd97ec61f5c83cd488b8c026bfd172f98751766a6f0df97
Python
3,117
92
import pyBigWig import traceback import sys import numpy as np from .target import Target class qGenomicFeatures(Target): """ Stores the dataset specifying sequence regions and features. Accepts a path to directory containing bigWig files with feature values Parameters ---------- features : li...
e3b140b02d954a97de860b8cbe7153802c7e38d2a79dfccca7fef526ba7b5a36
Python
3,117
74
import jax.numpy as jnp import numpy as np from jax.scipy.signal import convolve as conv from skimage.draw import disk from .typing import Union, List from .utils import Box def get_smooth_fn(beta: float, radius: float, eta: float = 0.5): """Using the sigmoid function and convolutional kernel provided in jax, we...
3c23f9c858c2f6b5aa47c58e1a893702f8b179a92d177855bc6b0ac474eb7167
Python
3,119
121
#%% import os import sys try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/maggot_models/') print(os.getcwd()) except: pass # %% sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') from pymaid_creds import url, name, password, token import pymaid import matplotlib.pyplot ...
fad4a406e6d1dd79d4068333cbb8976985b6ae0fcfaadcdf0ad073f1294d2690
Python
3,119
90
# coding=utf-8 # Copyright 2020 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
37a81ef60d23f5751d9f3770504592b1183dc373c28e1bad7ad455046971bf3f
Python
3,120
137
# Using Skorch import torch import skorch import numpy as np import pandas as pd import matplotlib.pyplot as plt # Basic Functions in Torch from torch import nn from torch import optim from torch.utils.data import DataLoader # Basic Functions in Skorch from skorch import NeuralNet from skorch.callbacks import EpochTi...
480c83b470a0b8cf6261b43db26f7eb09cad60f65992f52db90172d55bf84309
Python
3,120
96
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
35d707bff12978a2cb663c83d2df80cc709a0018ec62698bb4b81f97ee5562f3
Python
3,121
121
import sys from distutils.version import LooseVersion import numpy as np from numpy.testing import ( assert_, assert_equal, assert_almost_equal, assert_array_almost_equal, assert_raises, assert_array_equal, dec, TestCase, run_module_suite, assert_allclose) import os import shut...
b4f09634e2152cd978adaaedb6dccb4fc8c09b88477beae83a1d03c305da3a83
Python
3,123
116
from os.path import basename from pathlib import Path import numpy as np import pandas as pd from sacred import Experiment from sacred.observers import FileStorageObserver, SlackObserver from graspy.datasets import load_drosophila_left from graspy.utils import binarize, symmetrize, is_fully_connected from graspy.plot i...
db6f001f2a8baffdb8609884e79b62c45c0d79e7e68f06fc960e2f83abfc339c
Python
3,123
99
import cv2 import numpy as np from PIL import Image import matplotlib.pyplot as plt import torch import clip class CLIPLoss(torch.nn.Module): def __init__(self): super(CLIPLoss, self).__init__() self.model, self.preprocess = clip.load("ViT-B/32", device="cuda") self.upsample = torch.nn.Upsa...
506e2c353a47b8a8575bb8018e5991d9a511588b6dccc308b1ad546d10746d26
Python
3,124
111
# Libraries import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from skorch import NeuralNet class AET(nn.Module): def __init__(self, num_units=10, nonlin=F.relu): super(AET, self).__init__() self.dense0 = nn.Linear(20, num_units) se...
bfce665b27d9988c97335609c75121d6b869c1e4f8b8e5d1b00c87c6cb10a63f
Python
3,124
95
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
f7a99d40288e3e3d06887c7d6b167cad7091253814b64d634649ce4182500d5f
Python
3,124
125
# %% [markdown] # ## import os import warnings from itertools import chain import matplotlib as mpl import matplotlib.gridspec as gridspec import matplotlib.pyplot as plt import matplotlib.transforms as transforms import numpy as np import pandas as pd import seaborn as sns from joblib import Parallel, delayed from sc...
583e663135daf7fcfda9f6db6ea1a8004e9e04daf2cb0b6834ec12a49591b5b7
Python
3,125
95
""" Command Line Interface to OMK ----------------------------- """ import logging import os import subprocess import sys from collections import defaultdict from dataclasses import dataclass from pathlib import Path from typing import Dict, List, Sequence, TextIO, Tuple, Any, Type import click from linkml_runtime.du...
8c1476aa7c6707e5b53fbe9b54784f04ee4f0ee163a9eafc7cd653df51d49789
Python
3,125
87
from utils.ArticlesHandler import ArticlesHandler from utils import solve, embedding_matrix_2_kNN, get_rate, accuracy, precision, recall, f1_score from utils.Trainer_graph import TrainerGraph from utils import Config, accuracy_sentence_based import time import numpy as np # from utils.postprocessing.SelectLabelsPostpro...
e9c7e37b3fc22357c7aaeb0c323d32b0290356a58542b1423ff0608d855329e1
Python
3,125
89
""" File: cmd_line_arguments.py Created: 2020/10/19 Last Changed: Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program 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...
687471f03897cd46f8207ff53e6920ac5c6c27dbc5bf456601c0cb8085c30403
Python
3,126
100
import asyncio import os import shutil import urllib import mmcv import torch from mmdet.apis import (async_inference_detector, inference_detector, init_detector, show_result) from mmdet.utils.contextmanagers import concurrent from mmdet.utils.profiling import profile_time async def main(): ...
968957ae5df1e51aa02b4c4d2308c59550533ea08e1a0bc7948c1d80901e8455
Python
3,126
84
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
a97f767188294e8a5c70bbec3df089561ddf3c132fdd79e42afcf85b98e6ebe4
Python
3,126
84
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
b3c1cc4dfc1cecb2d62304537b52d5d53ed6ce5017ed2abcf414195a902fb027
Python
3,126
83
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from torch import nn from maskrcnn_benchmark.structures.bounding_box import BoxList from .roi_mask_feature_extractors import make_roi_mask_feature_extractor from .roi_mask_predictors import make_roi_mask_predictor from .inference imp...
d00530b94025841cc7e14f0219efc92473768f9d859b66c7ddba44259406ec49
Python
3,126
114
''' Reads the all-vs-all.tsv file from the BLAST scan output to find the best hits for all the sequences in the query set. Output: Performance of the BLAST model. (Bootstrapped) ''' # libraries import pandas as pd import numpy as np import pickle from Bio import SeqIO from sklearn.metrics import confusion_matrix, ...
f18eaf6dc8a08078b4823ab562f7a91ef78b657bd18c19932318f7bdf580af51
Python
3,127
66
# loop through all subdirs to find all fastq files import os.path import glob import os import re import argparse parser = argparse.ArgumentParser(description='Make Molgenis Compute samplesheet for CMC.') parser.add_argument('samplesheet', help='CMC samplesheet from synapse') parser.add_argument('fastq_dir', help='p...
0c2243cb9c1c8948b3b5d3a65544cf224081b583fbe93b42a0ab468c6bfce12a
Python
3,128
86
# Copyright 2020 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
1779452f44729c158159136873d4fd2984877c2ddfe44486b44b847105d52d46
Python
3,128
86
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
4e283234d4efdb88084acd1469fc0ddd76bf2a7c150884eb094699b4dd61ae21
Python
3,128
94
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Variational Animal Motion Embedding 1.0-alpha Toolbox © K. Luxem & P. Bauer, Department of Cellular Neuroscience Leibniz Institute for Neurobiology, Magdeburg, Germany https://github.com/LINCellularNeuroscience/VAME Licensed under GNU General Public License v3.0 """ ...
994b3999a80d196ea8505d416e214ea02207180f35171cd36d4c01e71a5e1c3b
Python
3,129
38
''' Author: Naiyuan liu Github: https://github.com/NNNNAI Date: 2021-11-23 17:03:58 LastEditors: Naiyuan liu LastEditTime: 2021-11-23 17:08:08 Description: ''' from .base_options import BaseOptions class TestOptions(BaseOptions): def initialize(self): BaseOptions.initialize(self) self.parser.add_a...
9ed1314a153ac671f61f001fbb4d38a067f2fb02804d04cccd40ae463d54fa5f
Python
3,130
88
# -*- coding: utf-8 -*- import click import unetsl.management import pathlib import itertools def getGpusFromParameter(p): return [int(i) for i in p.split(",")] @click.command() @click.argument("model_folders", type=click.Path(exists=True), nargs=-1) @click.option("-s", "--sample_folder", type=click.Pat...
94c4f5fadbe06d5cb0d9743290e083c1f2ccc9216018f5a5149a359b6452b737
Python
3,133
120
''' Reads the all-vs-all.tsv file from the BLAST scan output to find the best hits for all the sequences in the query set. Output: Performance of the BLAST model. (Bootstrapped) ''' # libraries import pandas as pd import numpy as np import pickle from Bio import SeqIO from sklearn.metrics import confusion_matrix, ...
2b4b3b7719bf67895972cc5ee8fee85d12d52b09ea0f222bf9507b181cb809da
Python
3,135
84
# Copyright 2020-2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
3096ead4d9f61c09c6b79019655c6d37a0798801bd462d76eb58b653ea7387e1
Python
3,135
84
import sys import subprocess import logging import os import FBEM.write_input as write # Default location of the executable file if os.name == 'posix': # Linux exe_path = os.path.dirname(__file__) + '/exe/3D_Stokes_Flow_FMM_linux.exe' else: # Windows exe_path = os.path.dirname(__file__) + '/exe/3D_Stokes_Fl...
77b0e31c58d2677e4655ba44971844af31081669dfdb614d3b1e0b82712ed054
Python
3,135
102
# Copyright (c) Open-MMLab. All rights reserved. import numbers import os.path as osp import numpy as np import torch from ...dist_utils import master_only from ..hook import HOOKS from .base import LoggerHook def is_scalar(val, include_np=True, include_torch=True): """Tell the input variable is a scalar or not...
8af0488747b993d16cd2138135c3b2d5dbdceb3e88dbb35c20eb927ed21ccc96
Python
3,135
94
import logging import sys import warnings from dataclasses import asdict from functools import partial import chika import numpy as np import pandas as pd import spiketrainn as spknn from imblearn.metrics import geometric_mean_score from sklearn.metrics import cohen_kappa_score from sklearn.neighbors import KNeighbors...
9d85f9cf8cab2592c88e5c37c71b39f2cfd47230f09e6864bf3698650e4510c5
Python
3,135
106
import torch from torch import nn from torch.autograd import Function from torch.nn import functional as F from torch.utils.cpp_extension import load fused = load( 'fused', sources=['/apdcephfs/share_1330077/starksun/projects/pi-GAN/siren/op/fused_bias_act.cpp', '/apdcephfs/share_1330077/starksun/projects/pi-G...
d7eaa8ea62b3063c31ad662b73d2d9c8c32ac09c80f7485fc47534687b9c7a14
Python
3,136
94
import torch import torch.nn as nn import torchvision import torchvision.transforms as transforms # Device configuration device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # Hyper-parameters input_size = 784 hidden_size = 500 num_classes = 10 num_epochs = 5 batch_size = 100 learning_rate = 0.001 ...
fea30cd49bff1dbd2a10eadf49cb8c18b29f98ca20904d21a16609055dae8c45
Python
3,136
125
"""Example script for running HMM_Dirchlet inference on simulated HMM-Dirichlet data. This script should take less than a couple minutes to run and currently the dice coefficient is ~0.99. """ import os import pickle import numpy as np from osl_dynamics.simulation import HMM_Dirichlet from osl_dynamics.data import ...
2815275ac59eb3ec8460401e59edc2a169450d1b73361012c9bf0660228d59a8
Python
3,137
87
#################################################################################################### # Copyright (c) 2019 - 2021, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free ...
d14b86880c71a8b97639f8b2c4315cc131f99a4c2e4b30d3419260a421d4ecf0
Python
3,138
101
import difflib import nltk from nltk.corpus import stopwords from Classes.Keyword import Keyword from Classes.KeywordCollection import KeywordCollection from Classes.QueryStopwords import QueryStopwords import re from Classes.SearchComponent import SearchComponent import indexing class QueryParser(SearchComponent): ...
0183ade186d08a177383d40a10478709dacb556fc3cfa33df4a213a33c273b28
Python
3,139
107
from abc import ABCMeta, abstractmethod import torch.nn as nn from ..builder import build_shared_head class BaseRoIHead(nn.Module, metaclass=ABCMeta): """Base class for RoIHeads.""" def __init__(self, bbox_roi_extractor=None, bbox_head=None, mask_roi_extra...
2344a6d083839cf9f34c1a4a374d910e23c146aca1afce38856da953d03816bc
Python
3,139
81
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
49dd1d070d55828e227a32a825968fb79328dfa718a2bde2729d85c60e0e604a
Python
3,139
60
# MIT License # # Copyright (c) 2020 Tomáš Nekvinda # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modif...
ebf0ec845269041e96f6545d5ffb0026d78086065e9255b2a4d4a45eccee6db6
Python
3,139
66
# %% import pymaid import contools from contools import generate_adjs import numpy as np from datetime import datetime from pymaid_creds import url, name, password, token from data_settings import data_date, pairs_path data_date = datetime.today().strftime('%Y-%m-%d') rm = pymaid.CatmaidInstance(url, token, name, pas...
7d1556374b639081bdd8f1831f5c069990a5a8825aff93bc1aa15c3b00eb6fbe
Python
3,140
90
import synapseclient import argparse import getpass import synapseutils parser = argparse.ArgumentParser(description='Download RNAseq and genotypes of CMC.') args = parser.parse_args() user = input("Synapse username:") password = getpass.getpass('Synapse password:') syn = synapseclient.Synapse() syn.login(user,pas...
adfb6011951ea3f0cc1052978be20f9f5d20df89136ab9882f427db8ab42ef51
Python
3,141
54
import roboscientist.equation.equation as rs_equation import numpy as np EQUATIONS = { 'N1': (['add', 'x1', 'add', 'mul', 'x1', 'x1', 'mul', 'mul', 'x1', 'x1', 'x1'], ['x1']), 'N2': (['mul', 'add', 'x1', '1.0', 'mul', 'x1', 'add', '1.0', 'mul', 'x1', 'x1'], ['x1']), 'N3': (['add', 'x1', 'mul', 'add', 'x1'...
0c01493d269f8c693d8d7642184c94d6b424de924762e37642c0e3d28af6a14f
Python
3,142
84
#################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This library is free ...
50855ec15a9cbc8eb456018883c030ce626ef56f9d83615e1ad44a83c1315e5f
Python
3,142
110
import abc import copy import logging from collections import ChainMap from pathlib import Path from typing import Any from ppqm import chembridge, constants from ppqm.chembridge import Mol _logger = logging.getLogger(__name__) class BaseCalculator(abc.ABC): """Base class for quantum calculators This class...
862cc7750185c3f2a4749bc668dc58bbe0fcfab05f2fa28acfc28ff58478d659
Python
3,143
112
""" .. _small_darcy_vis : A simple Darcy-Flow dataset =========================== An introduction to the small Darcy-Flow example dataset we ship with the package. The Darcy-Flow problem is a fundamental partial differential equation (PDE) in fluid mechanics that describes the flow of a fluid through a porous medium....
c5e5744ec33d8bc5bf7c645686ba1e97866be6a773760715fc5e14363a49a21b
Python
3,143
111
import sys import os import numpy as np import nibabel as nib import matplotlib.pyplot as plt import glob from scipy.ndimage import median_filter from utils import getCSFprior,normalizeProb,tumorDetection,saveMaps,largestAfterOpen from scipy import ndimage import random from shutil import copy2 n_tissue=int(sys.argv[...
337667199f8c1e5a2b327da5820f32af6834deae4a0c44f39161567e2dac687a
Python
3,145
118
''' Figure 11. Trajectories with an obstacle and torus topology. ''' from brian2 import * from pylab import * import matplotlib.font_manager as fm from plotting import * from matplotlib import gridspec from behavior import * import imageio import numpy as np fontprops = fm.FontProperties(size=18) width, height = 4, 8...
a0d7f97b184c06b6e9efb6145e59b543f6825f3155ed20ac2a86b47bc7196a51
Python
3,145
84
import tensorflow as tf import tensorflow.keras as keras import numpy as np class InceptionNet: def __init__(self, input_shape, nb_classes, nb_filters=32, use_residual=True, use_bottleneck=True, depth=6, kernel_size=41, verbose=False, build=True, is_train=True): self.nb_filters = nb_fil...
1b979baec3b4ac364844013c68a32783791b813c249dc8790a0ce20eca3aa22c
Python
3,146
81
import numpy as np import sys import time import shutil import subprocess import os #import pyflann from IPython.core.debugger import set_trace # Script to block all atoms that are not in the target site-- used to block everything in ZDOCK outside the target site. # This is done by adding a 19 to column 55-56 for ato...
1098c1f6e689a5b13b441c4ca54f48c5d47e21f8f0dfd3b5b37a265af8480bef
Python
3,147
99
import random import ipdb import torch import matplotlib.pyplot as plt from sklearn.metrics import f1_score from graphxai.gnn_models.node_classification import BA_Houses, GCN, train, test from graphxai.datasets.feature import make_network_stats_feature from graphxai.explainers import GNNExplainer from graphxai.visual...
1119b247fa51a0d8e250f4fd9a0e654f1cb0ee1257eef046f523269f31271f3e
Python
3,147
102
import numpy as np import AFQ.recognition.roi as abr import nibabel as nib import numpy.testing as npt import numpy as np from scipy.spatial.distance import cdist from AFQ.recognition.roi import ( check_sls_with_inclusion, check_sl_with_inclusion, check_sl_with_exclusion) streamline1 = np.array([[1, 2, 3]...
a86415a98d94af4119c2d4bd4f6708ae9e10df5e2d22e390daed628f3dff381e
Python
3,147
89
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
0f3f30a06adbe6460ece9868d7c3fb9e662170ffbc88765db74dc031f410e65f
Python
3,148
127
# %% [markdown] # # import os import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd from ast import literal_eval import pymaid from src.data import load_metagraph from src.io import savecsv, savefig, saveskels from src.pymaid import start_instance from itertools import chain ...
fae4fe62834d24d3bf101e4231cbedca144f6fee77d14a5517c054db01402aef
Python
3,149
105
#!/usr/bin/env python # plotPSD ver 0.0 - a command line utility to plot a wildcarded argument # list of files containing time series data, and plot the # Power Spectral Density (PSD) of them. # This version averages the data from multiple files. import sys, os import numpy as np import matplotlib.pyplot as ...
85f1056ebf903eb5b8810b670fd21b4974e955af36541d909fcd384b4dbbe648
Python
3,150
120
''' Figure 11. Trajectories with an obstacle and torus topology. ''' from brian2 import * from pylab import * import matplotlib.font_manager as fm from plotting import * from matplotlib import gridspec from behavior import * import imageio import numpy as np fontprops = fm.FontProperties(size=18) width, height = 4, 8...
a88c23b0603e8cd2cfd2d661e2230f1a1636d19c36a177f6aa83d84029544aa0
Python
3,150
86
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
e8248bde257b82e482f275bcb5985695288c3ff48bd2e3817737184adf1608ee
Python
3,150
95
from functools import partial import torch from .env import TORCH_VERSION def _get_cuda_home(): if TORCH_VERSION == 'parrots': from parrots.utils.build_extension import CUDA_HOME else: from torch.utils.cpp_extension import CUDA_HOME return CUDA_HOME def get_build_config(): if TORCH...
73af6c05849aa5a5d0e4bd818f9a122a70a6919cf342fcc496ab6ffab9139895
Python
3,151
81
import os import numpy as np import pandas as pd from scipy.optimize import curve_fit def flin(x, A, B): #linear fit return A*x + B def filter_df_numstart(df_cond, numstart, df_path): # filter df with list of conditions per number of targets df_cond_starters = df_cond[df_cond['targets'] == numstart] ...
a519bed19af2ed06f3c8bc31b2bf06cef9ee5bb374353b17b3969358a17d0717
Python
3,151
107
''' Properties of the graded avoided reaction. In 2D. Angle is calculated as average over 1 s (= 1 cycle). ''' from brian2 import * from behavior import * from scipy.linalg import norm from pylab import * from scipy.stats import circmean width, height = 2, 4 t1 = 1000*ms t2 = 1002*ms N = 300 halfN = int(N/2) # Lif...
c3839e067733879ccd351f27a80a477e286ccc86b933642a835609b249fe9328
Python
3,151
112
# %% [markdown] # ## import matplotlib.pyplot as plt import seaborn as sns from graspy.plot import gridplot, heatmap from graspy.utils import binarize, pass_to_ranks from src.data import load_metagraph from src.visualization import CLASS_COLOR_DICT, adjplot sns.set_context("talk") mg = load_metagraph("G", version="2...
e3b84071772b661e124ef5d352d3457fc7133ffd75f23291d76ff7eeea7cf8bb
Python
3,151
88
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
32a0ce0289c58881859562ce4ee85e790aa9c243e7f8ac325a2be7982d2b8992
Python
3,152
75
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
66a19f0257b6bab3ad2485ffd52dbdc562a4d83aac5d47f7209746a446ed7d78
Python
3,153
109
""" Measures of distance of two distributions """ import numpy as np from ortools.linear_solver import pywraplp from scipy.special import gamma def kl_divergence(p, q, k): """ k-nearest-neighbor estimation of Kullback-Leibler divergence between samples from two multivariate distributions. See: Pérez-Cruz...
f337bfe80620dbfc21f5eeeedc1e54e20ef4365b9e7497d685b36fd803744699
Python
3,153
78
# import the necessary packages from keras.models import Sequential from keras.layers.normalization import BatchNormalization from keras.layers.convolutional import Conv2D from keras.layers.convolutional import MaxPooling2D from keras.layers.convolutional import AveragePooling2D from keras.layers import GlobalAveragePo...
f53eede7b86871fcb6b97b8806c39c486fc4a26623a2b395f9e4206db0a5beb6
Python
3,153
100
""" HMM: Plotting fMRI Networks =========================== We normally plot networks from an HMM trained on fMRI directly from the dual-estimated means/covariances. This tutorial covers: 1. Load means/covariances 2. Spatial maps 3. Functional connectivity networks Note, we assume a group ICA parcellation was used a...
302c88a58d0a56f8682c3617d2ee3da79164fc443efebe79c6e41ee4dc97a631
Python
3,155
121
# %% import numpy as np import matplotlib.pyplot as plt import pandas as pd import scipy.io from pathlib import Path from box import Box # %% all_events = pd.read_csv("all_combined_with_80_20_taus.csv",index_col=0) #%% fix_scalar = lambda x : x.item() if x.ndim==0 else x def read_npz_MAD(file_name): data= np.lo...
bd0fbdd5c90c3e43e3251e797bba327b1ea72d15561f6e85d818a2350ac5c132
Python
3,156
78
# dataset: mne_sample """ This example demonstrates how to load and plot MEG data It uses the mne sample dataset which included presentaton of simple (A)uditory and (V)isual stimuli to the (L)eft and (R)ight ear/visual hemifield, as well as presentation of smiley faces and button presses by the subject. All the lines...
3a9de10a187d278d362b4b3c4667ef4dafb3ad9b36f4fe9e99b5b75a75fd2de0
Python
3,157
95
import math import torch import torch.nn as nn from networks.drn import drn_c_26 def fill_up_weights(up): w = up.weight.data f = math.ceil(w.size(2) / 2) c = (2 * f - 1 - f % 2) / (2. * f) for i in range(w.size(2)): for j in range(w.size(3)): w[0, 0, i, j] = \ (1 - ...
765a2b9a0f287cf019eefb5fbab4c7a9b012158a457086ec46f5615ba5dff4bd
Python
3,157
92
# Copyright 2021 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
131818d03288f96cdf09b9d87e56b4a825f03b9d27c09b667cd98431f1a3aa68
Python
3,158
83
"""Simulations for time series data. This subpackage provides tools for generating synthetic time series data with known ground truth dynamics. Simulations are built by combining a **state model** (how states evolve over time) with an **observation model** (how data is generated given the active state). State models ...
c3ff8818b5dc910a6c3571ccfa8b19fad993bd09b07de1bee6ef72ce7be46524
Python
3,158
97
from lab.nilm_experiments import * from constants.constants import * from constants.enumerates import * experiment_parameters = { EPOCHS: 100, ITERATIONS: 10, INFERENCE_CPU: False, SAMPLE_PERIOD: 6, BATCH_SIZE: 1024, ITERABLE_DATASET: False, PREPROCESSING_METHOD: SupportedPreprocessingMethod...
5082f71af7b6354e34ebfe18c18eb7851130bcfe26eb9248048fbd04af835c67
Python
3,160
69
"""Module contains BrainFMRIDataset class for dataloading and preprocessing.""" import torch import scipy.io as iom from typing import Tuple from torch.utils.data.dataset import Dataset from torchvision import transforms from tools.utils import fmri_masking, tuple_prod def _transformation(): """Implementation of...
7048fb2a19b846f0bfc69388a68aaa21a9eff67b19b49b8ff5757e2b61d298b2
Python
3,160
59
#!/usr/bin/env python3 """Spawn and destroy a 1920x1080 rgb_fisheye N times on a live server and read the server's GPU memory (nvidia-smi) between iterations. It must return to within ~200 MB of the post-first-spawn baseline; before the EndPlay release fix each sensor left ~2-6 GB behind until garbage collection. usag...
f205c7459575c0923d712c46f14dd8ac4c73566568848dd34cf0a5dc6974179b
Python
3,160
79
#!/usr/bin/env python # Copyright 2014 Gaurav Kumar. Apache 2.0 import os import sys files = [ open('/export/a04/gkumar/kaldi-trunk/egs/fishcall_es/j-1/exp/tri5a/decode_test/scoring/13.tra'), open('/export/a04/gkumar/kaldi-trunk/egs/fishcall_es/j-2/exp/tri5a/decode_test/scoring/13.tra'), open('/export/a04/gkumar/k...
16111173afebf73d9c47be7d5533d21b2d1b303a8ce587f93c117fbf5c1e98f6
Python
3,161
83
from experiment import setup_seed, one_dim_data from train import train from utils.dataTrans import get_dataloader from sklearn.model_selection import train_test_split from model import SoundNet, SoundNet_no_padding import numpy as np import torch from sklearn.model_selection import StratifiedKFold # 参数 BATC...
40568d2323b0037361786330710fa0093785668698a5257682679f7c634d021d
Python
3,161
97
import torch import torch.nn as nn import torchvision from torchvision import transforms from logger import Logger # Device configuration device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # MNIST dataset dataset = torchvision.datasets.MNIST(root='../../data', ...
e659d9358729794b8fd7b9a8b11cb16008df382110fb37f911b47d47128fd768
Python
3,162
141
import gzip import sys if len(sys.argv) < 3: print("Usage: eqtls1.txt.gz eqtls2.txt.gz output.txt.gz [name1 name2]") exit() file1=sys.argv[1] file2=sys.argv[2] output=sys.argv[3] name1="Dataset1" name2="Dataset2" if len(sys.argv) > 5: name1 = sys.argv[4] name2 = sys.argv[5] def countSharedAlleles(al1, al2): #...
5a21fa94fc45a2b54fa1964d406b873b833d6875124cd74dcb763df90fc09cb3
Python
3,163
106
# Copyright 2022 Huawei Technologies Co., Ltd # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
7bb9a842979ec4cb0f3a8a6c83b935bdf794da531e6eeff9537fd0bad5ae042e
Python
3,165
121
from neuron import h, gui import numpy """This functino sets up recording for soma and D4 location and return them in a tuple of list of vectors""" def set_up_full_recording(h,dendnum,OU=False): v_vecD4 = h.Vector() v_vecD4.record(h.dend[dendnum](0)._ref_v) IhD4 = h.Vector() IhD4.record...
3e69094dbd7a99108cf424e9e78775489bce1ddb8152e89acd67c3b20daf2c93
Python
3,166
76
import os.path import argparse parser = argparse.ArgumentParser(description='Make Molgenis Compute samplesheet for Braineac.') parser.add_argument('samplesheet', help='Braineac samplesheet') parser.add_argument('cram_dir', help='path to cram file dir for input') parser.add_argument('fastq_dir', help='path to fastq fi...
57b93ad2454a41613cd0aadb726d214aa45dc86e6d7558ee0fdb5a17a0764cff
Python
3,166
63
from __future__ import absolute_import from __future__ import division from __future__ import print_function import subprocess import os import sys import time import shutil import shlex INPUT_DIR = os.path.abspath("../data") OUTPUT_DIR = os.path.expanduser("~/data/pix2pix/test") def main(): start = time.time()...
26dee9aebd80a4ef9f2ea7007067644cd8294bd5bc8a91f0c8d6e8710f453e4a
Python
3,167
110
import tensorflow as tf import numpy as np from gd.gd_nn import GD_NN from helper.data import load_data, get_architecture from helper.misc import infer_and_accuracy, clear_print tf.logging.set_verbosity(tf.logging.ERROR) def test_stuff(): random_seed = 31567478618 tf.set_random_seed(random_seed) #seed = 5369 ...
9b5d4b50e9100e78120196d71155c7a81ad842f815c9047a39af1ff13eca9dfa
Python
3,170
77
import copy import os.path as osp import numpy as np from mmdet.datasets.pipelines import (LoadImageFromFile, LoadMultiChannelImageFromFiles) class TestLoading(object): @classmethod def setup_class(cls): cls.data_prefix = osp.join(osp.dirname(__file__), '../dat...
1cde7ff40d6a40503ab4da7f435bf10e719c1f26cab83bfbf34d308c74d9c7a2
Python
3,171
80
#!/usr/bin/env python from __future__ import print_function from collections import OrderedDict import re regexes = { 'nf-core/atacseq': ['v_pipeline.txt', r"(\S+)"], 'Nextflow': ['v_nextflow.txt', r"(\S+)"], 'FastQC': ['v_fastqc.txt', r"FastQC v(\S+)"], 'Trim Galore!': ['v_trim_galore.txt', r"version ...
b18526fb93b0551a82e3fefdf420cdda4bd4b07f33b71df6553df7054b7a4751
Python
3,171
128
# %% [markdown] # ## import os import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import seaborn as sns from mpl_toolkits.mplot3d.art3d import Poly3DCollection from graspy.utils import binarize from src.data import load_metagraph from src.io import savefig from src.visualization import set_ax...
d5bcb534d2067c829005943b366163d318e6f77f6efffc19a09101d61f5ffc95
Python
3,171
115
''' Logistic Regression Model trained on the protbert embeddings ''' # libraries import pandas as pd import numpy as np from sklearn import preprocessing import biovec import math import pickle from sklearn.model_selection import train_test_split, KFold, cross_val_score, StratifiedKFold from sklearn.preprocessing i...
f17079d07643b413f625077805e0e9646460274d7eaaba0054f5247005463d75
Python
3,171
88
import argparse from tensorflow import keras import matplotlib.pyplot as plt import numpy as np import os from scripts import dl_utils from scripts.viz_tools import normalize def make_predictions(patches, model): pred_stack = [] for patch in patches: h, w, c = patch.shape preds = model.predict...
bbaee23e4caccc665f9e2565e7eb2e151496f93499a201162a14cff41754cb30
Python
3,173
108
import pytest import torch from tltorch import FactorizedTensor try: import torch_harmonics except ModuleNotFoundError: pytest.skip( "Skipping because torch_harmonics is not installed", allow_module_level=True ) from ..spherical_convolution import SphericalConv from ..spherical_convolution import ...
cbc352d213916c88c007ef1359c6ff3562bae6d835b1e09d4a452d8450fcfa2e
Python
3,173
91
import random, sys from typing import Union, List import os from networkx.classes.function import to_undirected import networkx as nx import ipdb import torch import numpy as np import matplotlib.pyplot as plt import torch.nn.functional as F from numpy import ndarray from torch_geometric.utils import to_networkx, conve...
20113ff191ce47f5a5e38c0035716c39d5e70f3b8eeb1daf53b82aa3001ca57a
Python
3,175
87
#################################################################################################### # Copyright (c) 2019, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free softwar...
be7d969532936c311e3b7f868d4d3941cd02de1f5189bf7113278bbd031d621f
Python
3,175
84
# Copyright 2020 Google Research. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
f6ed6675eb63dada7a9785bc3f1d5737213f7737b3f9921beca1bce04c217f38
Python
3,175
87
#!/usr/bin/env python """Example ROI transform script To transform ROIs from a source dataset to target datasets: >> python transform_rois.py /path/to/source/dataset /path/to/target/datasets SOURCE_LABEL For help and additional arguments: >> python transform_rois.py --help """ import os import argparse from si...
618b777eb8fc054af6fb5eefc65dfbc92438253655afcd9caa4543f2f33a51a5
Python
3,176
91
#!/usr/env/bin python3.6 # NOTES: this repository do not used in current release, I will add more loss function in future from typing import List import torch from torch import Tensor, einsum from utils import simplex, one_hot class CrossEntropy(): def __init__(self, **kwargs): # Self.idc is used to fil...
31878ea2ba1dd32de9a9ab43cc4ab142c4131276c9ae5df2f9c614db93f39a97
Python
3,177
84
#! /usr/bin/env python3 # Copyright 2019 Ashish Arora # Apache 2.0. """This script finds best matching of reference and hypothesis speakers. For the best matching speakers,it provides the WER for the reference session (eg:S02) and hypothesis recording (eg: S02_U02)""" import itertools import numpy as np import...
d7e3d5b3ded77a29245050533c2b06debe337e45c25ddf54371bdd1f8bb6b981
Python
3,178
83
#!/usr/bin/env python3 # Copyright 2020 Audio, Speech and Language Processing Group (ASLP@NPU), Northwestern Polytechnical University (Authors: Zhuoyuan Yao, Xiong Wang, Jingyong Hou, Lei Xie) # 2020 AIShell-Foundation (Author: Bengu WU) # 2020 Beijing Shell Shell Tech. Co. Ltd. (Author: Hui BU) #...
8414585169ba356c25bc26b241a21a1ca10fb2eb3b4ed4b1d7fbd460b4ebaeae
Python
3,182
79
"""Tests for mesh volume. Trimesh measures a volume by summing, over the faces, the tetrahedron each one makes with the *origin*. On a closed surface the anchor cancels exactly, so that costs only precision. On an open one the cone to the anchor is real geometry and grows with the distance to it, which for a mesh in d...
e75186e12ad97548f3f357021335f3ca0ec8ff76ac1af6a5879560cc74512815
Python
3,185
82
import math import torch import torch.nn as nn from functools import partial, reduce from operator import mul from timm.models.vision_transformer import VisionTransformer, _cfg from timm.models.layers.helpers import to_2tuple from timm.models.layers import PatchEmbed __all__ = [ 'vit_small', 'vit_base', ] ...
2d79742eee486eb54640c8e75b0e0ec8c35b613ded29d541fefc209a3dc8fd25
Python
3,186
68
import os import argparse import torch import warnings from corrupter import BernCorrupter from utils import DataLoader from base_model import BaseModel parser = argparse.ArgumentParser(description="Parser for Knowledge Graph Embedding") parser.add_argument('--task_dir', type=str, default='./KG_Data/DRKG_v3', help='t...
29858eeaaebeefe2f24426c25739d36679b8ed3f334cf171aeba8d50a6e471f2
Python
3,189
79
#!/usr/bin/env python # Copyright 2014 Gaurav Kumar. Apache 2.0 import os import sys files = [ open('/export/a04/gkumar/kaldi-trunk/egs/fishcall_es/j-1/exp/tri5a/decode_test/oracle/oracle.tra'), open('/export/a04/gkumar/kaldi-trunk/egs/fishcall_es/j-2/exp/tri5a/decode_test/oracle/oracle.tra'), open('/export/a04/gk...
fb817d6233757421d97cf5a91396387653d17b07f98316179c8333c9b33ccd95
Python
3,189
78
import unittest from unittest.mock import MagicMock, patch from xml.etree import ElementTree # noqa S405 from oaklib import get_adapter from oaklib.implementations import NCBIGeneImplementation from oaklib.interfaces.association_provider_interface import ( AssociationProviderInterface, ) from tests import CYTOPLA...