sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
bf62f0953feb255ba95c303a238137a66872bcf8ece05c41e986e3b0f6502b19 | Python | 1,539 | 46 | import sciunit
import numpy as np
from scipy.stats import levene
# COMMENTS ##############################
#
# all open issues marked with "## TODO ##"
#
#
# COMMENTS ##############################
#==============================================================================
class levene_score(sciunit.Score):
... |
d338ed0aab59064e28439c0f2fb63a0fe97a5d5641302622e11b9ae1589c4a29 | Python | 1,541 | 52 | import sys
import subprocess
import argparse
def check_python_version():
"""Check Python version and install appropriate dependencies."""
version = sys.version_info
if version.major == 3 and version.minor < 13:
try:
import pip
subprocess.check_call([
sys.exe... |
077346e47845a87b14d122f13177bff09bd5e99d3ac3d18c9ce14e659ddefbaa | Python | 1,542 | 27 | from torchvision.models.detection import maskrcnn_resnet50_fpn
from torchvision.models.detection.mask_rcnn import MaskRCNN, MaskRCNNPredictor
from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
from torchvision.models.detection.backbone_utils import resnet_fpn_backbone
class MaskRCNNInstanceSegmente... |
600438a41eb6fccf4537e856f8aad4887554be20bb4afa80fac4c3f281c61d65 | Python | 1,542 | 41 | #-------------------------------------------------------------------------------
# elftools tests
#
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
#-------------------------------------------------------------------------------
import os
import unittest
from elftools.elf.elffile import ELFFile
... |
3d4e81614a99527b51e5eaede009b7072c53cf9569c82b80d19861aebdba2413 | Python | 1,543 | 39 | import os
import shutil
import argparse
from pathlib import Path
def copy_nifti_files(imaging_root_folder: str, subfolder_name: str, output_folder: str):
# create the output folder
os.makedirs(output_folder, exist_ok=True)
root_path = Path(imaging_root_folder)
subfolders = list(root_path.glob(f'**/{s... |
eed0a55f9861b697e9abe0dde89a720f0149c44c44f3893fad4bcc9589966b10 | Python | 1,545 | 42 | import torch
import torch.nn as nn
from .distance_sq import pairwise_distance_sq, normsq
class ChamferLoss(nn.Module):
def __init__(self, loss_norm_choice):
super(ChamferLoss, self).__init__()
self.loss_norm_choice = loss_norm_choice
def forward(self, p, q, jet_features_weight=1):
"""... |
5415d54fcb221fb782677b586d72509a820cc63cf88ff2f500b65dcc1e82b5a0 | Python | 1,546 | 58 | from expert.CLI.CLI_utils import get_CLI_parser, get_CFG_reader, set_seed
import sys
import os
def main():
parser = get_CLI_parser()
args = parser.parse_args()
cfg = get_CFG_reader()
set_seed(args.seed)
if args.mode == 'init':
from expert.CLI.main_init import init
init(cfg, args)
sys.exit(0)
... |
a9180ebcc8baa9d05ba91972dec1fb8b58655ee257b3d4d78b7779d4c1202fd2 | Python | 1,547 | 53 | # -*- coding: utf-8 -*-
#
# Copyright © 2023 Charles E. Vejnar
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://www.mozilla.org/MPL/2.0/.
#
"""Interface with the `bg2bw <https://github.co... |
bd6f285b86b5b150e54f836c51a3cec28af2667f36636e4ea828782b35973e46 | Python | 1,547 | 44 | from argparse import ArgumentParser
import numpy as np
import requests
from mmcls.apis import inference_model, init_model, show_result_pyplot
def parse_args():
parser = ArgumentParser()
parser.add_argument('img', help='Image file')
parser.add_argument('config', help='Config file')
parser.add_argumen... |
26fbd67896ea3267e5492da30c63d83b53f3004d1bba6a14d87ec69cd73445b2 | Python | 1,549 | 48 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.reference.op_run import OpRun
# NumPy stores each element of these types in a full byte, so the bit-width
# cannot be derived from ``dtype.itemsize``.
_SUB_BYTE... |
078a8357cbde37b75a83e04afeeeb731efd9675e36e16c38855d7a2e9ed9b132 | Python | 1,551 | 44 | # coding=utf-8
# Copyright (C) 2021. Huawei Technologies Co., Ltd. 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
#
# ... |
0ef2ce502344d2e0b0e082f03a1a9c820594124e6e9bfb8cac32445c59975791 | Python | 1,555 | 53 | ###############################################################################
# DoC MNIST Task Example
###############################################################################
# Imports are subject to change
from camstim.change import DoCTask, DoCImageStimulus
from camstim import Window, Experiment
import log... |
c09f55f93bad9531d91457806421910031565982fbb2389643004d98ee577806 | Python | 1,555 | 58 | from setuptools import setup
from torch.utils.cpp_extension import CppExtension, BuildExtension, CUDAExtension
from distutils.command.build import build
from setuptools.command.install import install
from setuptools.command.develop import develop
import os
import subprocess
import platform
BASEPATH = os.path.dirname... |
d455c7359474cc3db1f64c343c1583625f0274976e24850ce0e12bf3b8fa044b | Python | 1,555 | 46 | # Copyright 2021 The TensorFlow Authors. 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 applica... |
456b6f07d161b42ca89f4ba7312db8ac62600e3ab7aeb61c544172f36626a3bb | Python | 1,556 | 53 | ###############################################################################
# DoC Stage 4 but with a fake mouse and no graphics
###############################################################################
from camstim.change import DoCTask, DoCImageStimulus, DoCTrialGenerator
from camstim.automation import Perf... |
b30932756d78b80e90e0ca5696d52fdca2524d6831802f99fb6391068dedd690 | Python | 1,556 | 39 | import sys
from setuptools import setup, find_packages
from pathlib import Path
# Variables defined in __version__.py.
version_info = {}
with open(Path(__file__).parent / 'ardent/__version__.py', 'r') as versionFile:
exec(versionFile.read(), version_info)
# Descriptive text contained in README.md.
with ... |
583014fad5ccd92f5201388cf725aaf8b3d91df272036d385c2fae46eb41736a | Python | 1,557 | 62 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 5 09:12:55 2022
@author: sam
"""
import h5py
import numpy as np
import matplotlib.pyplot as plt
import glob
from natsort import natsorted
from scipy import stats
import os
import matplotlib.pyplot
import matplotlib.dates
import datetime
import matp... |
6822956f23fc54929d1c5bb762ef148b0f5a1d3fe39e58e0dd7bc980f614ab9c | Python | 1,558 | 40 | from networkunit.tests.correlation_test import correlation_test
from networkunit.tests.correlation_test import correlation_test
from networkunit.capabilities.ProducesSpikeTrains import ProducesSpikeTrains
from networkunit.utils import use_cache
class correlation_dist_test(correlation_test):
"""
Abstract test ... |
9a07ad9d09d1ab02990787b3a75004624136a2920d5032b0aac4117524a884fc | Python | 1,558 | 50 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class LabelEncoder(OpRunAiOnnxMl):
def _run(
self,
x,
default_float=None,
... |
c9d98a960f719e90f1cfc3ee213b552c7052ee45e1829ba33c0746396cb546f2 | Python | 1,559 | 52 | import sentencepiece
from pathlib import Path
import shutil
SIGNS = Path("../NMT_input/signs.txt")
TRANSLITERATION = Path("../NMT_input/transcriptions.txt")
TRANSLATION = Path("../NMT_input/translation.txt")
def train_and_move(input_file, model_type, model_prefix, vocab_size):
sentencepiece.SentencePieceTrainer... |
f783016e90df274d4589e517241b566d736a2ba96232a454dac75a3b4cd85799 | Python | 1,563 | 44 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
fedffdebcd6bae65cfa4494671b05f8937e3e4cbfa537e4629bc52408eedbe5f | Python | 1,563 | 46 | import os
import sys
#sys.path.insert(0, os.path.abspath(os.path.join("..", "..")))
sys.path.insert(0, '..')
# 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
# -- Pro... |
aad1f08e53b8604841d3afefb2f060895e6a16891f95ce1f125c41d2a5ba50b1 | Python | 1,564 | 68 | import numpy as np
def get_minmax(X):
n_features = X.shape[1]
return np.hstack(
(
np.array([np.min(X[:, j]) for j in range(n_features)]).reshape(
-1, 1
),
np.array([np.max(X[:, j]) for j in range(n_features)]).reshape(
-1, 1
... |
87bf81df7c2e986cef1a0285fb81b4dfcf30ca25e3af11116ce9ad12808503f9 | Python | 1,566 | 53 | import itertools
import numpy as np
import pytest
from pyxdf.pyxdf import _find_segment_indices
@pytest.mark.parametrize(
"b_breaks, expected",
[
(np.array([]), [(0, 0)]),
(np.array([False]), [(0, 1)]),
(np.array([True]), [(0, 0), (1, 1)]),
(np.array([False, False]), [(0, 2)]... |
4f6ce9ed7e2b4e0c9f60b05c363d5a56437861d51e9756dd43f3589838d3a55d | Python | 1,567 | 55 | import numpy as np
def sample_size_estimate(
mcc_desired: float,
increase: float,
lf_increase: float
) -> int:
"""
calculates the estimated number of required samples for
fixed MCC, absolute increase and log2-fold change using the fitted linear model from
Büttner, Ostner et al.... |
618eab49fab19582bd8e91da09281167e54ee03eadc7f63802d0f28d3e23553b | Python | 1,568 | 32 | import argparse
import os
from tqdm import tqdm
import cv2
import json
parser = argparse.ArgumentParser(description="Script for generating zones and visually inspecting them.")
parser.add_argument("--membranes_dir", help="Path to directory containing membrane images.", type=str, required=True)
parser.add_argument("--... |
9f0b9bff495b1efdded5a68f803d95f2566a6f2fb3d56e78b1e5f21c0e056706 | Python | 1,568 | 47 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
class Imputer(OpRunAiOnnxMl):
def _run(
self,
x,
imputed_value_floats=None,
... |
bcfdadfaae83b1ad08bd4fd244f50ee9da666370562ddd32983ce2e7f9fa200e | Python | 1,568 | 47 | import pytest
import os
from time import time
import numpy as np
import siibra
from siibra.volumes import Map
from siibra.exceptions import NoneCoordinateSuppliedError
TEST_ALL_MAPS = eval(os.getenv("TEST_ALL_MAPS", "False"))
preconfiugres_maps = list(siibra.maps)
BLACKLIST = {
siibra.get_map('julich 1.18', 'mn... |
aa306f67bcfb9af3bbdd2ea88c64025cd212ba072eaaa40d76e0338b0afba50e | Python | 1,570 | 46 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.ops._op import OpRunReduceNumpy
def _check_integer_input(data):
if np.issubdtype(data.dtype, np.integer):
raise TypeError(
f"ReduceLogSum... |
e6ae3a421611f36d5397060551b5636fdf70a0bc3dea8294f91d0ce7614ba272 | Python | 1,570 | 50 | # Authors: Christian Kothe & the Intheon pyxdf team
# Tristan Stenner
# Chadwick Boulay
#
# License: BSD (2-clause)
import argparse
import logging
from os.path import abspath, dirname, join
import pyxdf
def main(fname: str):
logging.basicConfig(level=logging.DEBUG) # Use logging.INFO to reduce... |
10f3d5724f1fec3cd0a6e96d723520198e414d76eb2aedc164c913036be9f494 | Python | 1,571 | 59 | """Loggin utility for ParaDime.
The :mod:`paradime.utils.logging` module implements logging functionality used
by verbose ParaDime routines.
"""
import logging
import sys
LOGGING_FORMAT = "%(asctime)s: %(message)s"
LOGGER_NAME = "paradime"
logger = logging.getLogger(LOGGER_NAME)
formatter = logging.Formatter(LOGGIN... |
5d4f50577f9b54c4a15be84cfb98a92777c3eb2a9995410de430a335a86495fc | Python | 1,571 | 53 | ###############################################################################
# DoC Day 0
###############################################################################
from camstim.change import DoCTask, DoCStimulus, DoCTrialGenerator
from camstim import Window, Experiment
from psychopy import visual
import loggin... |
4b7a14b21d4f66598189f811ce94c11c0e8cf6f57ecda47f60d6c19bba2d7612 | Python | 1,573 | 32 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 11 14:51:13 2019
@author: tpisano
"""
import os, sys, shutil, numpy as np
from skimage.external import tifffile
sys.path.append("/jukebox/wang/pisano/Python/lightsheet")
from tools.conv_net.input.read_roi import read_roi_zip
from tools.registration.... |
b238e3c744b8b76641bb505c06746b6eb479e7e234c0dbb36df2ac2442a86534 | Python | 1,573 | 34 | # Copyright 2019 The TensorFlow Authors. 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 applica... |
c3b7c687cf88e00b17986cd7cca8f41ad6b53d30aebbdc80f411ebd3c370f0bb | Python | 1,573 | 67 | # Copyright 2019-2021 The AmpliGraph Authors. All Rights Reserved.
#
# This file is Licensed under the Apache License, Version 2.0.
# A copy of the Licence is available in LICENCE, or at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#import tensorflow as tf
import tensorflow.compat.v1 as tf
import logging
logg... |
e65d921f3c928c075535cca23872eb29d2f8bd439e97ef732616a02b77a0e09a | Python | 1,573 | 45 | # Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... |
c1b530af7fda304bc59a0fd8e7f43bc9a36ba0939dac1c787b16509a1b3d3067 | Python | 1,574 | 43 | """
build output path for figures
"""
from pathlib import Path
from typing import Union
from vcnmodel.util.get_data_paths import get_data_paths
def set_figure_path(fignum:int, filedescriptor:str, suppnum:Union[int, None]=None, suffix:Union[str, None] = ".pdf"):
"""Set the full path for a figure, with a specific e... |
04a2b42711ad254ef6773c07460aec102859497ea1b6cbb32559da39e228ce43 | Python | 1,575 | 47 | """Resolve GIFT_EVAL exactly the way the data loader does, and report it.
python -m tabby.posttraining.check_env
Both this checker and the data loader search upward from the current working
directory. Running a release recipe from the repository root therefore finds
the root `.env`; an explicitly exported environ... |
f345e7e67114a78a3b7dae4b1f5f48d69f8e599f61456c86e2163d91de58eac9 | Python | 1,575 | 57 | import csv
import os
import sys
import pyrosetta
from pyrosetta import pose_from_pdb
from pyrosetta.toolbox import mutate_residue
def read_csv(csv_file):
rows = []
muts_from_csv = []
with open(csv_file, 'r') as f:
reader = csv.reader(f, delimiter=',')
for row in reader:
rows.a... |
8296a42fcab7a7f32f73b04216b047e72bcfba0f9a1f86d02645b56fe622d88e | Python | 1,576 | 47 | import click
import logging
import sys
import atom3d.datasets.datasets as da
import atom3d.util.file as fi
import atom3d.util.formats as fo
import atom3d.util.rosetta as ro
logger = logging.getLogger(__name__)
@click.command()
@click.argument('input_dir', type=click.Path(exists=True))
@click.argument('output_lmdb',... |
27f62db5d14f03431231abfbdeeb0332353dfa3c7c9dbc3f94cd4c6d0294941a | Python | 1,577 | 42 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GCNConv, global_mean_pool
class GNN_PSR(torch.nn.Module):
def __init__(self, num_features, hidden_dim):
super(GNN_PSR, self).__init__()
self.conv1 = GCNConv(num_features, hidden_dim)
self.bn1 =... |
a5b42ad37af19ee94cfa24880f046217eea8485e63fc309a203da510994b2265 | Python | 1,577 | 42 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GCNConv, global_mean_pool
class GNN_RSR(torch.nn.Module):
def __init__(self, num_features, hidden_dim):
super(GNN_RSR, self).__init__()
self.conv1 = GCNConv(num_features, hidden_dim)
self.bn1 =... |
b28f30d97bb1b5dfbee9509f3e5d521e490de7b66079f03590cdf4f6cc159b8a | Python | 1,577 | 57 | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 7 16:17:15 2019
@author: daniel
"""
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
def sigmoid(x, x_offset, alpha, Mg, eta):
s = 1 / (1 + Mg*eta* np.exp(-alpha * (x - x_offset)) )
return s
Erev_AMPA = 0
Erev_NMDA = 15
Erev_GABA = -80
g... |
035483660d130269119984635dac6766d6fc12a236eed7c79ea73738f8d5a431 | Python | 1,578 | 43 | import numpy as np
from scipy.stats import norm
from pymtrf.helper import lag_builder, model_to_coefficients
from pymtrf.helper import regularized_regression_predict
from pymtrf.mtrf import lag_gen
from scipy.io import savemat
def build_test_data(save_to_file=False, noise=1e-5):
# Model: we define 10 channels, 9 l... |
17545a0d5a6ab617d3ef25af3aab8c9beef567568fbd41fde9135b397660d4d0 | Python | 1,579 | 45 | #!/usr/bin/env python3
"""
This program parses a NCBI GFF annotation and generates a .chrom file.
see https://github.com/conchoecia/odp for the specification.
"""
#NW_011887297.1 RefSeq CDS 1566678 1566739 . + 2 ID=cds-XP_004348322.1;Parent=rna-XM_004348272.1;Dbxref=GeneID:14898863,Genbank:XP_004348322.1;Name=XP_004348... |
bd17bf0604bf62d599335bc7665428e37e7a279171924666445b62cc99e4f18d | Python | 1,579 | 55 | # Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... |
d344fa1d508fc26444b299a8d866cac5bb0c5f444a9df67772a0cab7980b5633 | Python | 1,579 | 62 | import os
from PIL import Image
from tqdm import tqdm
import cv2
import numpy as np
import argparse
parser = argparse.ArgumentParser(description="...")
parser.add_argument(
"--dir",
help="...",
type=str,
required=True
)
args = parser.parse_args()
DIR = args.dir
SHOW = False
def is_img(filename):
"""Check... |
3b6961c39be2ae80e763fdc9c4e442a0376cc0f3954fd56d3553633e249ff2ef | Python | 1,580 | 57 | import importlib
import ants
import pandas as pd
from ants.core.ants_image import ANTsImage
SUPPORTED_CONTRASTS = ["t1", "t2"]
def get_mni(contrast: str, bet: bool) -> ANTsImage:
"""Get the correct MNI ICBM152 09c Asym template,
given contrast and BET status.
Args:
contrast (str): MRI's contrast... |
0c159fcba415f7716ab0787a446049382009cea643ac29e3081beed38958b59f | Python | 1,581 | 55 | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
from mmcv import Config
from mmcv.cnn.utils import get_model_complexity_info
from mmcls.models import build_classifier
def parse_args():
parser = argparse.ArgumentParser(description='Get model flops and params')
parser.add_argument('config', he... |
b0ecff352cde068b09144ba833e7a71fd9e6feae38767bad75ab7272e37b5d25 | Python | 1,583 | 50 | import io
from setuptools import setup
from setuptools.command.test import test as TestCommand
import sys
import wordsegment
class Tox(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
im... |
c70015a19a97ad2e7dcefc2c3b104acb79045b5deb0ea9632d00cace4936c258 | Python | 1,583 | 52 | import numpy as np
import pandas as pd
import pytest
import scipy
import palantir
# Check scipy version for pygam compatibility
# pygam has known issues with scipy >= 1.13 due to sparse matrix changes
SCIPY_VERSION = tuple(map(int, scipy.__version__.split('.')[:2]))
SCIPY_INCOMPATIBLE_WITH_PYGAM = SCIPY_VERSION >= (1,... |
8f35a8596ae0bb6325f244ad11c32f34a0a561b5a21a06a198a11198cd5c19ba | Python | 1,584 | 51 |
import pandas as pd
file = r'C:\Users\chaochaoyan\Documents\retrosynthesis\retrosim\retrosim\data\data_split.csv'
data = pd.read_csv(file)
import cairosvg
import matplotlib.pyplot as plt
from rdkit import Chem
from rdkit.Chem import rdChemReactions, rdDepictor, Draw
from rdkit.Chem.Draw import rdMolDraw2D... |
e92445d48e7f91b8d3934af4aa4199dbd9117092b169553b4e39469b5ca3b75e | Python | 1,584 | 55 | import tensorflow as tf
from tensorflow.keras.regularizers import Regularizer
class DynamicL2(Regularizer):
""" An L2 regularizer with modifiable scale and ramping. """
def __init__(self, scale):
"""Creates a new dynamically weighted regularizer.
Parameters
----------
scale :... |
7dfd3c4f2e4846e8b096e8e00b95b1e735fbead6c191c0b85afc0d734d2a38c5 | Python | 1,585 | 58 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 16 16:00:03 2018
@author: wanglab
"""
import os
import h5py
from augmentor import Augment
from dataprovider3 import DataProvider, Dataset
class Sampler(object):
def __init__(self, datadir, spec, vols=[], mode="train", aug=None):
as... |
b2f2ed167b2c89f4a14411b3d33dafbb00cdaa83245101c9792afff59dc096a8 | Python | 1,586 | 45 | import argparse
from biom import load_table
import numpy as np
import arviz as az
from q2_matchmaker._stan import merge_inferences
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'--biom-table', help='Biom table of counts.', required=True)
parser.add_argument(
... |
3d48b33152eac857bfcdc0758e88beafc87c0208e0b17b78b243d808f66d65b7 | Python | 1,587 | 64 | import os
import re
from setuptools import setup, find_packages
# Recommendations from https://packaging.python.org/
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
def read(*parts):
with open(os.path.join(here,... |
5afe567ba96f3ea7210cd61ccc464df3908bb0c2319914cb2bf5cb3415cffdd6 | Python | 1,587 | 50 | # Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... |
3991e1b9626c4fd3f89ca9b9016517aa52daa48f5fd72b359f54cf443735845d | Python | 1,590 | 44 | # Copyright 2019 DeepMind Technologies Limited
#
# 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 agr... |
0fde1112a6df41efc16ed41bc94114148cbeedab427554e0806ea9ab483719d9 | Python | 1,592 | 44 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
b55d52982c664d2f066c00250f90a8bb0a9c8203974976ba29bd8538a1bdb52a | Python | 1,592 | 52 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
from onnx.reference.op_run import OpRun
class Unsqueeze_1(OpRun):
def _run(self, data, axes=None):
if isinstance(axes, np.ndarray):
axes = tuple(axes)
... |
5c15bc045e08d940fdfa06c5a2f2d8027d49a95453dc706e01de817c1a3b8755 | Python | 1,593 | 62 | from pathlib import Path
import networkx as nx
import pandas as pd
DATA_PATH = Path(__file__).parent.parent.parent.parent # don't judge me judge judy
DATA_PATH = DATA_PATH / "data"
def load_split_connectome(dataset, weights=True):
dir = DATA_PATH / "processed_split"
if weights:
data = (("weight", ... |
3c0165f7aad30b67106e32d8b4275d0a42be173435e8cbbced731458762688dd | Python | 1,594 | 42 | import scipy.stats
import numpy as np
from .population import Population
from .. import cells
class DStellate(Population):
type = 'dstellate'
def __init__(self, species='mouse', **kwds):
# Note that `cf` is the mean value used when selecting SGCs to connect;
# it is NOT the measured CF o... |
cd682a267cf067a92635e7ca46e75a141f8afbb9be259e44f3c7ff7b6f6d037b | Python | 1,594 | 45 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
d3e5c8a506452b11cd38fd864d0dd2e9f366aeadbfd5e3a13a64edcee38b1666 | Python | 1,594 | 42 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import GCNConv, global_add_pool, global_mean_pool
class GNN_LBA(torch.nn.Module):
def __init__(self, num_features, hidden_dim):
super(GNN_LBA, self).__init__()
self.conv1 = GCNConv(num_features, hidden_dim)
... |
eff3e6ab5bba9167bb47a5a81b1604306b5321f66d8b2d4db90146f18b1fdd00 | Python | 1,596 | 45 | import tempfile
import unittest
from pyontutils.config import DevConfig
devconfig = DevConfig(config_file='fake-devconfig.yaml')
class TestConfig(unittest.TestCase):
def test_set_git_local_base(self):
git_local_base_1 = devconfig.git_local_base
ontology_local_1 = devconfig.ontology_local_repo
... |
295002078b9225398bb92dd5b49e51faaa708034db534f0b17d0354c53e88d71 | Python | 1,597 | 35 | import networkx as nx
import pandas as pd
from ..plotting import _plot_nodes, _plot_edges
import numpy as np
def _plot_springlayout(ax, nodes, edges, node_color, node_size, edge_color, edge_weights, highlight_nodes, **kwargs):
"""
This funciton calculates and plots a spring layout for nodes/edges instead of on... |
902388247b1cabfd4ff1f1a38a647d40ad831181c51099c2e8f03df1af924f93 | Python | 1,597 | 50 | # Copyright 2021 The ASReview Authors. 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 applicabl... |
3b8eac545dc38cc2c9a0b4f77288d2817310e02ec62a4bdd6c2b5004c0176e6b | Python | 1,598 | 54 | from __future__ import annotations
from collections.abc import Iterable, Mapping
from datetime import date, datetime, timedelta
from typing import Any, Optional, Union, Tuple, List, Dict, Protocol
from numpy import ndarray # TODO use ArrayLike?
from pandas import DataFrame, Series, Index, Timestamp, Timedelta
from m... |
b7290a2c3790c79b76671a5a51a0296d88baec5a39b79f9f11e14796c3ad5837 | Python | 1,598 | 56 | import os
import sys
import numpy as np
import argparse
parent_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(parent_dir)
import seas
from seas.experiment import Experiment
from seas.video import play, dfof
if __name__ == '__main__':
ap = argparse.ArgumentParser()
ap.add_ar... |
0ca8e108a8f49b0416c646bb5a9c1db1a72144324d3fde3fcc3f12714e86b3b1 | Python | 1,599 | 55 | from __future__ import division
import mkl
mkl.set_num_threads(1)
import sys
import os
import numpy as np
from skimage import io
from helper_lib import filelib
from skimage.exposure import rescale_intensity
#################################
args = sys.argv[1:]
if len(args) > 0:
path = args[0]
if path != 't... |
48aa5844af7db6d781439c4399a3fc11565238f7f3022fb1254afa6ed6ab3a25 | Python | 1,599 | 52 | """Notebook formatter.
Formats jupyter notebooks as follows:
* changes execution count to consecutive numbers, starting with 1
* sets json indent to 1 space
* adds a newline at the end, if not present
Does not change cell content or output.
"""
def format_nb_json(notebook_path, indent=1):
"""Format a jupyter n... |
5c8d5408622147a67b731d020483c06a56206c4c8ee63dcbd60fd19651d8be03 | Python | 1,599 | 53 | # Copyright 2019-2020 The ASReview Authors. 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 appl... |
df4d43cdc086dbe33ca12648a15442925a53cc427711ec956a7fa899836435f5 | Python | 1,600 | 53 | import numpy as np
import pandas as pd
import palantir
def test_PResults():
# Create some dummy data
pseudotime = np.array([0.1, 0.2, 0.3, 0.4, 0.5])
entropy = None
branch_probs = pd.DataFrame(
{"branch1": [0.1, 0.2, 0.3, 0.4, 0.5], "branch2": [0.5, 0.4, 0.3, 0.2, 0.1]}
)
waypoints = N... |
f522505cd3022888d2bf8137dd1f3ac8941c20209e5b40c6684c001e51994d39 | Python | 1,601 | 59 | from lgn.g_lib import g_tau, g_tensor
GTensor = g_tensor.GTensor
GTau = g_tau.GTau
class GScalar(GTensor):
"""
Core class for creating and tracking G Scalars that
are used to part-wise multiply `GVec`.
At the core of each `GScalar` is a list of `torch.Tensors` with
shape `(B, C, 2)`, where:
... |
009398587075a5902e1eec62ff444367b3578ce999e4fadb03d8bb05e7046e6d | Python | 1,602 | 65 | # SPDX-License-Identifier: LGPL-3.0-or-later
"""The atomic model provides the prediction of some property on each
atom. All the atomic models are not supposed to be directly accessed
by users, but it provides a convenient interface for the
implementation of models.
Taking the energy models for example, the developere... |
8df3a71da74463da43c90d657456947ce85cecb17e1aeaf60d282fb38923f8f4 | Python | 1,604 | 47 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
b09e988ccfab5b24eab822675b899ed37c393a5bb1961b5732191eae756ec402 | Python | 1,605 | 57 | # Copyright 2026 DeepMind Technologies Limited
#
# 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 agr... |
0e58e7f2fbbecb8af314db7508cd9d1f9f9fc9c982ffcd4ef84f42d40c861e44 | Python | 1,607 | 46 | # Copyright 2026 DeepMind Technologies Limited
#
# 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 agr... |
38f023f5a6ab64f5543f07037a3cd9c0cfca38b370083c70e1ed976d9d6bebf4 | Python | 1,607 | 37 | import pandas as pd
from scipy import stats
crispr_on = pd.read_excel('../data/main_dataframes/crispr on data.xlsx',engine='openpyxl', sheet_name='spCas9_eff_D10-dox')
crispr_on = crispr_on.rename(columns={'gRNA': 'gRNA_Seq'})
deep_hf = pd.read_csv('../data/main_dataframes/suplementry2.csv')
wt_deep_hf = d... |
4047b001747539acef2385eca2af12eadced7e0e4493566f7bee020352855f01 | Python | 1,607 | 46 | # Copyright 2026 DeepMind Technologies Limited
#
# 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 agr... |
edf49cf93adf06a22290ea903651265ecf6a56460d1e06be770f4d2187288414 | Python | 1,607 | 46 | # Copyright 2026 DeepMind Technologies Limited
#
# 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 agr... |
22392e24c24756a53a77a6dcdef2a725e9af336126cd1fcdd0a537404e87a01b | Python | 1,608 | 48 | # Copyright 2023 DeepMind Technologies Limited
#
# 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 agr... |
993ef5d3b95f8f6ae62cb0a00f0ed2b44b40e9cbc798d47caaa9616296c89e21 | Python | 1,609 | 37 | import pandas as pd
from scipy import stats
crispr_on = pd.read_excel('../data/main_dataframes/crispr on data.xlsx',engine='openpyxl', sheet_name='spCas9_eff_D10-dox')
crispr_on = crispr_on.rename(columns={'gRNA': 'gRNA_Seq'})
deep_hf = pd.read_csv('../data/main_dataframes/supplementary2.csv')
wt_deep_hf =... |
fccccfb5fed80b1def273a2ca6f96674f232c55a4cf6df1f6383aca9476fad29 | Python | 1,610 | 47 | from celltool.utility import path
import os, sys
def find_plugins(directory):
if not directory.exists():
return []
plugin_files = [p.namebase for p in directory.files('*.py')]
plugins = [p for p in plugin_files if p not in ('__init__', 'setup')]
plugins += [d.name for d in directory.dirs() if (... |
4422c182d57c8da777d4f0a3bdd439d5e978c14087565385c643c4ae37494286 | Python | 1,611 | 55 | from typing import Union
import numpy as np
import torch
from torch.utils.data import Dataset
class JetMomentaDataset(Dataset):
"""
PyTorch dataset for GNN autoencoder.
"""
def __init__(
self,
data: Union[torch.Tensor, np.ndarray],
vec_dims: int = 3,
polar_coord: boo... |
617ed49d5468c16d13ea2b6e1ee7facdbdf6ed5405d17086865a34aa32a7cc2f | Python | 1,611 | 55 | """
"""
import argparse
import logging
from robustlink.scf import SCF_main_repeat_subsampling
from robustlink import generate_metacells_rna
from robustlink import correlate_metacells_mc_rna
from robustlink import correlate_metacells_atac_rna
def create_parser():
"""
"""
parser = argparse.ArgumentParser(pr... |
f30dd46067f9e058d6b1519b7e0a752bd93fc41702bdb43a85190f0be7129151 | Python | 1,611 | 47 | # Copyright 2023 DeepMind Technologies Limited
#
# 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 agr... |
76ded1ed33dc6b1453ec6f71c04a8ca99905bcff303408dc5d25db0791626f51 | Python | 1,612 | 47 | # Copyright (c) ONNX Project Contributors
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
from onnx.reference.ops.aionnxml._op_run_aionnxml import OpRunAiOnnxMl
def _array_feature_extractor(data, indices):
"""Implementation of operator *ArrayFeatureExtractor*."""
if len(indices.shap... |
7bbfec4a01737f24a660cfaa5234f2b0122664b1e611a9bec727d3c20046146a | Python | 1,612 | 45 | from __future__ import print_function
from freqAnalysisTools import band
import sys
import pickle
from os import listdir
from os.path import isfile, join, splitext
import numpy as np
import random
from sklearn import linear_model, svm, ensemble, neural_network
from sklearn.metrics import confusion_matrix
from mpl_toolk... |
6967cfa5ce494038df1d9f46573fd8ed770a14d3791e8cc0920d907abad8e54a | Python | 1,615 | 26 | """Main plotting functions in package."""
from .plot_edges import _plot_edges, _npedges2dfedges
from .plot_nodes import _scale_nodes, _plot_nodes, _select_single_hemisphere_nodes, _add_node_text
from .plot_spheres import _plot_spheres
from .plot_templates import _plot_template, _plot_template_style_filled, \
_plot_... |
80e754216c883341e02c5443a9136196fa523e7eee1f3ad09f935e33739a5a88 | Python | 1,615 | 54 | """Utility functions for working with time series."""
import numpy as np
from bycycle.utils.checks import check_param_range
###################################################################################################
#############################################################################################... |
e2af75a65d742eabf142e31efd44fe0aa36532537372a62541e7cbf41db89153 | Python | 1,617 | 51 | import unittest
import rdflib
from pyontutils.core import OntGraph, ilxtr
class TestOntGraph(unittest.TestCase):
ts1 = ((ilxtr.a, ilxtr.b, ilxtr.c),)
ts2 = ((ilxtr.a, ilxtr.b, ilxtr.d),)
def populate(self, graph, triples):
[graph.add(t) for t in triples]
def setUp(self):
self.graph1 ... |
2484d717b30e600cb1e7027d2bfbbb14f2448bd5b5b834a0cf395e7480c3d990 | Python | 1,619 | 64 | import os
import time
import pprint
import torch
import numpy as np
import torch.nn.functional as F
import pdb
def set_gpu(cuda_device):
os.environ['CUDA_VISIBLE_DEVICES'] = cuda_device
print('Using gpu:', cuda_device)
def ensure_path(path):
"""The function to make log path.
Args:
path: the ... |
cc241b489f8f6f1d05a91c8cc311de1bbf10530a33fcc42ae885ecdcd1cd1a18 | Python | 1,619 | 50 | from neuron import h
from .terminal import Terminal
class SimpleTerminal(Terminal):
"""
Simple terminal using netcon.
"""
def __init__(self, pre_sec, target_cell, spike_source=None, loc=0.5):
"""
Parameters
----------
pre_sec : :obj: `NEURON Section`
The pr... |
1c7426363ce7163f57d1437cb80e07e1b78d22c7044ac11d0c1a42ef52c040ae | Python | 1,620 | 66 | from pathlib import Path
import pytest
import torch
import flair
@pytest.fixture(scope="module")
def resources_path():
return Path(__file__).parent / "resources"
@pytest.fixture(scope="module")
def tasks_base_path(resources_path):
return resources_path / "tasks"
@pytest.fixture()
def results_base_path(r... |
81eb8019064f6db5b53e8dcaf84d31ccc6e3307c33c8bac804b30dcb63ee3897 | Python | 1,621 | 47 | import argparse
import biom
import pandas as pd
import numpy as np
import xarray as xr
from q2_differential._model import DESeq2
import time
import logging
import subprocess, os
import tempfile
import arviz as az
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument(
'--bio... |
084397111ddfd7a81c240f2bd547f591a65bfcc5bc6fd0f59620e6a42785d31a | Python | 1,622 | 53 | # Copyright (c) ONNX Project Contributors
#
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations
import numpy as np
import onnx
from onnx.backend.test.case.base import Base
from onnx.backend.test.case.node import expect
class GlobalLpPool(Base):
@staticmethod
def export_globallppool_defa... |
ab11407e69320db5db7c608d765d01a5b4595b69d4fb9df8eb4fb1b40037ca9e | Python | 1,622 | 56 | # Copyright 2019 DeepMind Technologies Ltd. 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 appl... |
73458af4111032a56d67af810f2fb116502a2800fff9d6aef21eda205da55243 | Python | 1,624 | 54 | ###############################################################################
# DoC Task Example
###############################################################################
# Imports are subject to change
from camstim.change import DoCTask, DoCStimulus
from camstim import Window, Experiment
from psychopy import ... |
8dd63f8cd4c1213774d95226be3d7050262d96b23549b1e31a82619de01e07ab | Python | 1,624 | 59 | from Bio import SeqIO
from tqdm.autonotebook import tqdm
def fasta2loc(fasta_path, ref_dict, use_seq_ids=True):
tree = {}
nseqs = 0
# building tree for seq searching
for seq in SeqIO.parse(open(fasta_path, "r"), "fasta"):
s = str(seq.seq)
rev = str(seq.seq.reverse_complement())
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.