sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
00367726d36d011cfbad1754b139b62db2dd33b519d9a10b234b5463105f579e | Python | 508 | 23 | # set QT_API environment variable
import os
import sys
os.environ["QT_API"] = "pyqt5"
import qtpy
# qt libraries
from qtpy.QtCore import *
from qtpy.QtWidgets import *
from qtpy.QtGui import *
# app specific libraries
#import control.gui_camera_only as gui
#import control.gui_2cameras_async as gui
#import control.gu... |
1f7970fcfa28400e339783bd377019fbaa1e9ba33043b40b2592f1c009f49c1a | Python | 508 | 11 | # -*- coding: utf-8 -*-
from .biaffine import BiaffineDependencyModel, BiaffineDependencyParser
from .crf import CRFDependencyModel, CRFDependencyParser
from .crf2o import CRF2oDependencyModel, CRF2oDependencyParser
from .vi import VIDependencyModel, VIDependencyParser
__all__ = ['BiaffineDependencyModel', 'BiaffineD... |
39c0da2f15cad7128d99c97f89aa92aee318d6d4c8d78f8563b9fd1e281d2a45 | Python | 508 | 9 | from batchgenerators.utilities.file_and_folder_operations import *
import numpy as np
if __name__ == '__main__':
input_file = '/home/fabian/data/nnUNet_preprocessed/Task004_Hippocampus/nnUNetPlansv2.1_plans_3D.pkl'
output_file = '/home/fabian/data/nnUNet_preprocessed/Task004_Hippocampus/nnUNetPlansv2.1_LI... |
cf4e71c31f9f0afdf9732d00521da01005f38ec2b0800b3e70c482e83b033c7c | Python | 508 | 20 |
import torch
import numpy as np
def calc_coeff(iter_num,max_iter):
alpha = 10
low = 0.0
high = 1.0
return float(2.0 * (high - low) / (1.0 + np.exp(-alpha * iter_num / max_iter)) - (high - low) + low)
def grl_hook(coeff):
def fun1(grad):
return -coeff * grad.clone()
return... |
2db37f5e8f79007e022c595ce62a0b7f8f7dbea94dd79df5cb1f71a5a98099b4 | Python | 510 | 20 | # SPDX-FileCopyrightText: 2024-present Sergiu Deitsch <sergiu.deitsch@gmail.com>
#
# SPDX-License-Identifier: Apache-2.0
from elpv_dataset.utils import load_dataset
import elpv_dataset
import os
import pytest
@pytest.mark.parametrize(
'fname',
[None, os.path.join(os.path.dirname(elpv_dataset.__file__), 'data... |
3e63c560721f86af32e42d5462377106ba1c6cebacb171b7a6c07b3ea18199f5 | Python | 510 | 10 | import importlib
from basicsr.utils import scandir
from os import path as osp
# automatically scan and import model modules for registry
# scan all the files that end with '_model.py' under the model folder
model_folder = osp.dirname(osp.abspath(__file__))
model_filenames = [osp.splitext(osp.basename(v))[0] for v in s... |
4a92602a09e7205bf72948ed7a0f57f8122856234fe73d6cf05ee52d8d64466b | Python | 510 | 22 | """Search the NeuroQuery dataset (https://neuroquery.org) for studies and
terms with activation patterns similar to an input image.
"""
__all__ = [
"NeuroQueryImageSearch",
"studies_to_html_table",
"terms_to_html_table",
"results_to_html",
]
from pathlib import Path
__version__ = (
Path(__file__)... |
2345497a017ca56be204b6216d18e6811d396d372d0367345615003fc6ffaa1c | Python | 511 | 25 | import torch.nn as nn
class GAP(nn.Module):
"""
Global Average pooling
Widely used in ResNet, Inception, DenseNet, etc.
"""
def __init__(self):
super(GAP, self).__init__()
self.avgpool = nn.AdaptiveAvgPool2d((1, 1))
def forward(self, x):
x = self.avgpool(x)
... |
2fd498c0e1fa46236b9439807498953998c4c48d64be3f007ac996022655389a | Python | 511 | 18 | # Copyright (c) OpenMMLab. All rights reserved.
import re
import sys
import warnings
def modify_args():
for i, v in enumerate(sys.argv):
if i == 0:
assert v.endswith('.py')
elif re.match(r'--\w+_.*', v):
new_arg = v.replace('_', '-')
warnings.warn(
... |
2392df9f95a12ef423f4724081a6b80f7f732a86679b04d6b8b25e8a7838faaf | Python | 512 | 15 | import os
import sys
sam_dir_path = sys.argv[1]
readids_dir_path = sys.argv[2]
use_case = sys.argv[3]
dir_list = os.listdir(sam_dir_path)
# options: sam_file_path, readids_file_path, use_case
for dir in dir_list:
test = dir.strip().split(".")
print("\npython ../utils/extract_filtered.py " + sam_dir_path + ... |
f8fb79da1808170e54296308cf849083d63bb1f843a5afb6f666fcb40d1ecfc1 | Python | 512 | 26 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import downward.suites
import common_setup
import configs
CONFIGS = configs.default_configs_optimal(ipc=False, extended=False)
print(sorted(CONFIGS.keys()))
print(len(CONFIGS))
SUITE = downward.suites.suite_optimal_with_ipc11()
exp = common_setup.IssueExperiment(
... |
5c3050a632f6dfc10992e8ad9df7ee65c565b00b7fa412cb3a8c985495d97be6 | Python | 513 | 16 | #!/bin/env python
outfile = '../SAMPL7-user-map.csv'
# Read user map from submission server
file = open('/Users/dmobley/github/SAMPL-submission-systems/SAMPL-submission-handling-shared/submissions/downloads/submission_table.txt', 'r')
text = file.readlines()
file.close()
# Write output file, removing e-mail addresse... |
5fabc4192f1cd0407c7eb5344e49100f6f3a1279cc10ad688ae9e4a368050b4b | Python | 513 | 14 | import pytest
import torch
import pytorch_cifar_models.mobilenetv2 as mobilenetv2
@pytest.mark.parametrize("dataset", ["cifar10", "cifar100"])
@pytest.mark.parametrize("model_name", ["mobilenetv2_x0_5", "mobilenetv2_x0_75", "mobilenetv2_x1_0", "mobilenetv2_x1_4"])
def test_resnet(dataset, model_name):
num_classe... |
cee252072a4d94de85b5ab2699a67ea56d20324d4988363237168ef8ff4365ac | Python | 513 | 19 | # coding: utf-8
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
from .nms.cpu_nms import cpu_nms, cpu_soft_nms
def n... |
0d97020e5bda25f2b3893ee452666663fc24afc76b9215b24bf4e4844a72d8c2 | Python | 514 | 22 | """
io directory module
# Author: Vladan Lucic (Max Planck Institute for Biochemistry)
# $Id$
"""
from __future__ import unicode_literals
from __future__ import absolute_import
__version__ = "$Revision$"
from . import microscope_db
from .image_io import ImageIO
from .multi_data import MultiData
from .pickled import ... |
07c204249a66e26f48ff19c5fc825588cf75317f1e09d0bbb855cc779383e341 | Python | 516 | 17 | SKELETON_FOLDERS = {
"gif": "skeleton_thumbnail_gifs",
"png": "skeleton_thumbnails",
"swc": "skeleton_swcs",
}
# 'cell_or_neuropil' is either a root id, or neuropil abbreviation (upper case, e.g. GNG)
def url_for_skeleton(cell_or_neuropil, file_type="png"):
def build_url(folder, file, ext):
re... |
273125afac5eb526832363abc915f0b1f3b30f4e22299af951c7e6d2c6a1a316 | Python | 517 | 17 | """Initialize PyPREP."""
# Authors: The PyPREP developers
# SPDX-License-Identifier: MIT
import pyprep.ransac as ransac # noqa: F401
from pyprep._logging import set_log_level, setup_logging # noqa: F401
from pyprep.find_noisy_channels import NoisyChannels # noqa: F401
from pyprep.prep_pipeline import PrepPipeline ... |
6051c4c86d3a50b1a1efd9f9cce6fc533ba162ccffa342559a013a9d9616f3b6 | Python | 517 | 17 | #!/bin/env python
outfile = '../SAMPL7-user-map-PL.csv'
# Read user map from submission server
file = open('/Users/dmobley/github/SAMPL7-submission-handling/submissions/downloads/submission_table.txt', 'r')
text = file.readlines()
file.close()
# Write output file, removing e-mail addresses and keeping only PHIP2 sub... |
88a1610b0c33a0877f34b5bf3fe9e1b8f23f4f099270d5611979e9e3741b5553 | Python | 518 | 18 | import os
from PyQt5.QtWidgets import QWidget
from PyQt5.uic import loadUi
FILE_PATH, FILE_FULL_NAME = os.path.split(os.path.realpath(__file__))
FILE_NAME, FILE_EXT = os.path.splitext(FILE_FULL_NAME)
class About(QWidget):
"""Base operation"""
def __init__(self):
super(About, self).__init... |
9b7d44b5ee16de9d3f5d28de9b5f956ff365b49d337f7645fcc9d477fcb088ab | Python | 518 | 23 | # set QT_API environment variable
import os
import sys
os.environ["QT_API"] = "pyqt5"
import qtpy
# qt libraries
from qtpy.QtCore import *
from qtpy.QtWidgets import *
from qtpy.QtGui import *
# app specific libraries
#import control.gui_camera_only as gui
#import control.gui_2cameras_async as gui
#import control.gu... |
0ab6ebaefd8ce7efed8cc172224fe23e55687302e575a5d4bdcc629a7c222dcc | Python | 519 | 18 | import glob
import h5py
import os
source_dir = '/home/common/Datasets/Marion/2017-08-02_17.49.34_stPVB003-2-2xDR5v2_F3_nb25_Marvelous/PlantSeg_final/Cells/temp'
for in_file in glob.glob(os.path.join(source_dir, '*.h5')):
filename = os.path.split(in_file)[1]
print(f'Renaming {filename}')
with h5py.File(i... |
7b555755736c656fae995befc0e81476fee20b6bc962c0590bd85a0f9726933d | Python | 519 | 10 | import importlib
from basicsr.utils import scandir
from os import path as osp
# automatically scan and import dataset modules for registry
# scan all the files that end with '_dataset.py' under the data folder
data_folder = osp.dirname(osp.abspath(__file__))
dataset_filenames = [osp.splitext(osp.basename(v))[0] for v ... |
8b02e1c06481abe42a4956e46118a6e9688929169fc1be2accf5bc3d7985eca5 | Python | 519 | 14 | from setuptools import setup, find_packages
setup(
name='hornet',
packages=['hornet'],
package_dir={'':'src'},
version='1.0.0',
url='git@github.com/PNAI-CSB-NCI-NIH/HORNET.git',
description='HORNET is a python open-source library for estimating the RNA RMSD based on energies and global constrai... |
d2062da985bf530eb3fb2fd0342f470a9b5ccd597d55a4247b18c872acbaadcb | Python | 519 | 16 | #!/bin/env python
outfile = '../SAMPL7-user-map-logP.csv'
# Read user map from submission server
file = open('/Users/dmobley/github/SAMPL-submission-systems/SAMPL-submission-handling-shared/submissions/downloads/submission_table.txt', 'r')
text = file.readlines()
file.close()
# Write output file, removing e-mail add... |
db2b1598b361cbfcfad37b902ed232a4a13d9022c7d920f7a5d2973736aa3af3 | Python | 519 | 11 | from .graph import GraphConstruction, SpatialLineGraph
from .function import BondEdge, KNNEdge, SpatialEdge, SequentialEdge, AlphaCarbonNode, \
IdentityNode, RandomEdgeMask, SubsequenceNode, SubspaceNode
# extra function registration
from cg_steps.cg_edgetransform import AdvSpatialEdge
__all__ = [
"GraphConstr... |
fa1d87cba9b6235f76ebb536aa90a105b95cc92068ca0eb089ac23250306d9ed | Python | 519 | 15 | def get_channels(includesEcg):
esg_chans = ['CA1', 'CA2', 'CA3',
'C57', 'C97',
'C33', 'C53', 'C73', 'C93', 'C113',
'C21', 'C41', 'C61', 'C81', 'C101', 'C121',
'CS1', 'C1z', 'C3z', 'C5z', 'C7z', 'C9z', 'C11z', 'C13z',
'C22', 'C42', ... |
42ff343610880cb7a56742ba3b1a53e1daa310934cf23c796ae63fa3d1e12513 | Python | 520 | 14 | import pytest
import torch
import pytorch_cifar_models.shufflenetv2 as shufflenetv2
@pytest.mark.parametrize("dataset", ["cifar10", "cifar100"])
@pytest.mark.parametrize("model_name", ["shufflenetv2_x0_5", "shufflenetv2_x1_0", "shufflenetv2_x1_5", "shufflenetv2_x2_0"])
def test_resnet(dataset, model_name):
num_c... |
1ab8850170f05f6ec479011a99e97891a9a3a67e230aa9b9f1275eb67abbea9b | Python | 521 | 17 | from .prix_fixe_net import PrixFixeNet
from .trainer import Trainer, DEFAULT_METRICS
from .coreblock import CoreBlock
from .dataprocessor import DataProcessor
from .final_layers_block import FinalLayersBlock
from .first_layers_block import FirstLayersBlock
from .predictor import Predictor
__all__ = ("PrixFixeNet",
... |
685b5e7584cda990b450d3fd24c44c9afc9fae5c3323d71b342cf7e53dbc5c51 | Python | 521 | 19 | from setuptools import find_packages, setup
setup(
name = 'psg-simultscoring-models',
version = '0.0.1dev0',
author = 'Riku Huttunen',
author_email = 'riku.huttunen@uef.fi',
description = 'The models for simultaneous scoring of sleep stages and respiratory events with deep learning.',
license ... |
8c254fad9c7fcdfbf34ab6350caed8b48bae2e67adcde3cbb95a4619c34b3e31 | Python | 521 | 22 | #!/usr/bin/env python
import numpy as np
import sys
import re
fin = open("genes.hg19.out", 'r')
fout = open("genes.hg19.exons.temp", 'w')
line=fin.readline()
for line in fin:
fields = line.strip().split()
chr = fields[2]
strand = fields[3]
gene = fields[1]
exon_start = fields[9].split(',')[:-1]
exon_end... |
8fff22b5e0fb16e5524b07c14d70472b4f82d18fb534814bd4814f97d012e3ab | Python | 521 | 25 | """
Test packages' installation.
"""
import pytest
class TestClass:
def test_nibabel(self):
import nibabel as nib
def test_nilearn(self):
import nilearn
def test_nipype(self):
import nipype.interfaces.fsl as fsl
import nipype.pipeline.engine as pe
from nipype impo... |
9e3e231be92a278b005df831f30c7d91e41e7d72746ffe2d4e05c76c4b59b9ab | Python | 522 | 19 | import databpy
import numpy as np
def test_set_position(fetch):
mol = fetch("8FAT")
pos_a = mol.position
mol.position += 10
pos_b = mol.position
assert not np.allclose(pos_a, pos_b)
assert np.allclose(pos_a, pos_b - 10, rtol=0.1)
def test_eval_mesh():
a = databpy.create_object(np.zeros((... |
98215d6ebf40ca6916be804e5e42c72cc5478f817e930150ebd7ebef88e9152c | Python | 523 | 14 | import numpy as np
from sklearn import manifold
def fit_trafo_mds(x_train, x_test, mds_params):
# Full vs incremental (depending on pca dim and sampling rate)
mds = manifold.MDS(**mds_params, max_iter=5000, n_jobs=20)
x_concat = np.concatenate([x_train, x_test], axis=0)
x_trafo = mds.fit_transform(x_c... |
deb08ff1e5ffb4f7896e8be83f4a2e05582bca68179a409efd17c83d5c36e0e5 | Python | 523 | 29 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 19 10:03:48 2022
@author: morgan
"""
import os
import pickle
# import m6a_calling
# from m6a_calling import
os.chdir(os.path.expanduser("~/git/m6A-calling"))
import mhamm.m6a_ml_data_bysubread as ml_data
# Test that positive pickle works
posi... |
a9b911b01875c5f381364e2e29e519ddc5a8eeff4b70ead1ed1d08df93327a3a | Python | 524 | 18 | from typing import List, Tuple
import torch
import torch.nn as nn
class RICAPLoss:
def __init__(self, reduction: str):
self.loss_func = nn.CrossEntropyLoss(reduction=reduction)
def __call__(
self, predictions: torch.Tensor,
targets: Tuple[List[torch.Tensor], List[float]]) -> ... |
b2f919d17f3650715cdece97d8ff0703571d86ab9d18a6e323ff04d8dd23acfb | Python | 525 | 20 | """
Created on 25/05/2020
:author: Chinchien Lin
:summary: MacroCommand is an extension of Command that allows multiple commands to be invoked.
"""
from src.commands.abstract_preprocessing_command import AbstractPreprocessingCommand
class MacroCommand(AbstractPreprocessingCommand):
def __init__(self)... |
09176a51fe149b6c09f8b12fa5701e65ffa6819d24e7f9c43be7c181c1c9bce6 | Python | 526 | 28 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
import common_setup
REVS = ["issue544-base-v2", "issue544-v2"]
LIMITS = {"search_time": 1800}
SUITE = suites.suite_satisficing_with_ipc11()
CONFIGS = {
"eager_greedy_ff": [
"--heuristic",
"h=ff()",
"--search",
... |
0b1d0caecfb2eef28346eca034c08212050a8b903a1219b64b72a67c0cc45933 | Python | 526 | 20 | from elasticai.creator_plugins.quantized_grads.base_modules import Conv1d
from elasticai.creator_plugins.quantized_grads.fixed_point import (
FixedPointConfigV2,
QuantizeForwHTE,
QuantizeParamToFixedPointHTE,
QuantizeParamToFixedPointStochastic,
)
def test_conv1d_fxp_init():
conf = FixedPointConfi... |
4b3c76169585ea99efd47856b7e9fd09055878c658aae5d6c47ac1f445c0f95c | Python | 526 | 20 | from elasticai.creator_plugins.quantized_grads.base_modules import Conv2d
from elasticai.creator_plugins.quantized_grads.fixed_point import (
FixedPointConfigV2,
QuantizeForwHTE,
QuantizeParamToFixedPointHTE,
QuantizeParamToFixedPointStochastic,
)
def test_conv1d_fxp_init():
conf = FixedPointConfi... |
509e52a009b097eac915ad280047714241b925970414dd8af92531756cbcb648 | Python | 526 | 21 | # built-in synthetic data generators
import syncopy as spy
from syncopy import synthdata as spy_synth
cfg_synth = spy.StructDict()
cfg_synth.nTrials = 150
cfg_synth.samplerate = 500
cfg_synth.nSamples = 1000
cfg_synth.nChannels = 2
# 30Hz undamped harmonig
harm = spy_synth.harmonic(cfg_synth, freq=30)
# a linear tre... |
6f0401e40848a6c73fa8b3d4ff0bc7186f43cbe727c7733e8eb512410800c2a9 | Python | 526 | 16 | from setuptools import setup
setup(
name='MalariaStageClassifier',
version='0.1.0',
author='Katharina Preißinger',
author_email='katharina.preissinger@physik.uni-augsburg.de',
packages=['Modules'],
description='A package for the stage-specific classification of RBCs in microscopy images',
url="https://gi... |
a20bd0bf090f29138123c01bbedcceaf97a1d34e818b3b4fecad199bd9bf3d12 | Python | 526 | 16 | import os
import sys
fast5_dir_path = sys.argv[1]
output_dir_path = sys.argv[2]
index_dir = sys.argv[3]
uncalled_exe = sys.argv[4]
dir_list = os.listdir(fast5_dir_path)
# IMPORTANT NOTE: always run this script after the command:
# conda activate uncalled
for dir in dir_list:
outdir = " > " + output_dir_path + d... |
a4ef98caf71a5805ee0302ed1a68a07edd161a5b9e1ef4c2ed2cf8d484a59c15 | Python | 526 | 14 | from train import cross_validate
from sklearn.model_selection import KFold
from dataloader import DATA
from cv_results import cv_predict
kf = KFold(n_splits=10)
for i, (train_idx, val_idx) in enumerate(kf.split(DATA.images)):
data_train, data_val = DATA.split(train_idx, val_idx)
print("Starting cross validati... |
03eb63a96a9603a1df4c6858b0b03bece2207db862c5df5d7082f460d4d28a82 | Python | 527 | 23 | from topaz.mrc import get_mode_from_header, get_mode_for_header, make_header, parse, write
def test_parse():
# path = 'test/test_data/EMPIAR-10025/rawdata/micrographs/14sep05c_c_00003gr_00014sq_00004hl_00004es_c.mrc'
# with open(path, 'rb') as f:
# content = f.read()
# image, header, extended_head... |
6b89f2543028157775d7114c3887dbefe6c5d0593bbfe545548115af874c27b6 | Python | 527 | 27 | from pathlib import Path
import pytest
from pycudadecon.util import imread
DATA = Path(__file__).parent / "test_data"
@pytest.fixture(scope="session")
def raw_image():
return imread(str(DATA / "im_raw.tif"))
@pytest.fixture(scope="session")
def deskewed_image():
return imread(str(DATA / "im_deskewed.tif"... |
c4c8ab5d6f07f4020d1bf6c834df5ac1841d6b3812fffee3c217308a40128645 | Python | 527 | 19 | from typing import Callable
import torch
import yacs.config
from .cutmix import CutMixCollator
from .mixup import MixupCollator
from .ricap import RICAPCollator
def create_collator(config: yacs.config.CfgNode) -> Callable:
if config.augmentation.use_mixup:
return MixupCollator(config)
elif config.au... |
39db0108eda227a8adcff5fd257dda2a8689a021ae5257d63554138a935c0580 | Python | 528 | 24 | from autograd.core import primitive_with_deprecation_warnings as primitive
from .builtins import dict, isinstance, list, tuple, type
from .differential_operators import (
checkpoint,
deriv,
elementwise_grad,
grad,
grad_and_aux,
grad_named,
hessian,
hessian_tensor_product,
hessian_ve... |
92505e5e1ce69fb82ed3e74ae2acc3fb1551f6e3ba886d87a4e5fdba2194397b | Python | 529 | 23 | """Logger factory"""
from omegaconf import open_dict
import wandb
from src.settings import ASSETS_ROOT
def logger_factory(cfg, model_cfg):
"""Basic logger factory"""
logger = wandb.init(
project=cfg.project_name,
name=cfg.wandb_trial_name,
save_code=True,
dir=f"{ASSETS_ROOT}/u... |
02af90f3c75e86ea51f67727ae221e3ad5e86b6d4c04b4987fd4ad25173e899d | Python | 530 | 19 | import torch
import torch.nn as nn
import torch.nn.functional as F
dtype = torch.float32
class SiameseNetwork(nn.Module):
def __init__(self, encoder, latent_dim=128, dropout=0, **kwargs):
super().__init__()
self.encoder = encoder
self.projector = nn.Sequential(
nn.Linear(laten... |
51c429245e1fca497cdbd8337d0f038bfc321f1f70b2cd651ed631b250abc2ed | Python | 530 | 27 | import numpy as np
import keras
import tensorflow as tf
print("Tensorlfow version = ", tf.__version__)
print("Keras version = ", keras.__version__)
exit(0)
predictedProbabilitiesArr = [0]*2
predictedProbabilitiesArr[0] = 0
predictedProbabilitiesArr[1] = 1
print(str(np.amax([predictedProbabilitiesArr])))
def loadD... |
ae9549d49a2db57827dab6b89e70abc473c49863662ed1fdd658b944e117b1d1 | Python | 530 | 20 | import tempfile
from PIL import Image, ImageFilter
from cog import BaseRunner, Input, Path
class Runner(BaseRunner):
def run(
self,
image: Path = Input(description="Input image"),
blur: float = Input(description="Blur radius", default=5),
) -> Path:
if blur == 0:
... |
60258b4c03f2ec4b8cf1a086dcb5d1c8fea9a85eccd4f6cc7a9a1886920bcf17 | Python | 531 | 27 | # -*- coding: utf-8 -*-
"""
Created on Thu Dec 8 14:00:26 2022
@author: Dustin Garner
"""
from fafbseg import flywire
import flycode.neuprint_reading as neuread
flywire.set_default_dataset("production")
try:
neuread.initialize_client()
except:
print('Unable to initialize Neuprint.')
"""
Get a token from ... |
13d8d98e903b47c4cfc597498ea32dec2d541fb5fb98f95ada703cd1662a3072 | Python | 533 | 22 | import torch
class SubsetRandomSampler(torch.utils.data.Sampler):
r"""Samples elements randomly from a given list of indices, without replacement.
Arguments:
indices (sequence): a sequence of indices
"""
def __init__(self, indices):
self.epoch = 0
self.indices = indices
... |
75dbc275b2836d46563126ff45abb21e5e6dc29f0f35e494ed3b25ea29abb9ec | Python | 533 | 20 | import pystripe
import tifffile
import matplotlib.pyplot as plt
# input_path = 'E:/20201219_KN_KN454_p14_F_GOF6_CreNeg_fos561_bg488_4x_reimage/stitched_00/Z00672_ch01.tif'
input_path = 'E:\pystripe_testing/vess.tif'
input_img = tifffile.imread(input_path)
# filter a single image
fimg = pystripe.filter_st... |
d9297de0d53384350036f88019ec1fe4bdaefda4cdcf575d84f2413200b46a67 | Python | 533 | 38 | from .config import ObjectQCConfig
from .grid import (
plot_qc_grid,
select_qc_examples,
)
from .size import (
SizeQCResult,
score_size_outliers,
)
from .stage import (
ObjectQCResult,
run_object_qc,
)
from .tubular import (
TubularQCResult,
score_tubular_objects,
)
__all__ = [
... |
1e66ca7db789131a1a47dc193c71c049e099756e7b8941278b6b320ca763bdf0 | Python | 534 | 23 | #!/usr/bin/env python
from distutils.core import setup
#from catkin_pkg.python_setup import generate_distutils_setup
#setup_args = generate_distutils_setup
setup(name='lis_ltamp',
version='2.0.0',
description='LTAMP Utilities',
author='MIT LIS',
author_email='caelan@mit.edu',
url='none',... |
1521593e8f7a9ab01280840b4e6d5f6aeeb4b2e6cd4179d6fd08bd3899350bd1 | Python | 535 | 14 | from .amigos import AMIGOSDataset
from .bci2022 import BCI2022Dataset
from .deap import DEAPDataset
from .dreamer import DREAMERDataset
from .mahnob import MAHNOBDataset
from .mped_feature import MPEDFeatureDataset
from .seed import SEEDDataset
from .seed_feature import SEEDFeatureDataset
from .seed_iv import SEEDIVDat... |
3d1b28d10ad6ed49826813b230e1956db67ffc31e7feb518a7b79f31b95526f7 | Python | 535 | 13 | fixed_params = {'num_atom_V_features': 25,
'num_bond_V_features': 25,
'num_QK_features': 30,
'mp_iterations': 3,
'use_layernorm': True,
'r_len': 200,
'z_len': 200,
'y_len': 1,
'dockstring_num_... |
7e86b44cddb9ad063877392324440a7cb0a20232e164bb3b3c18b55e58f83223 | Python | 535 | 16 | #!/bin/env python
outfile = '../SAMPL7-user-map-permeability.csv'
# Read user map from submission server
file = open('/Users/dmobley/github/SAMPL-submission-systems/SAMPL-submission-handling-shared/submissions/downloads/submission_table.txt', 'r')
text = file.readlines()
file.close()
# Write output file, removing e-... |
811ffd87a051cab734bdd5a3ab0bb3fd94b02e9d22c8db48026919c15dbd0616 | Python | 536 | 18 | from __future__ import print_function, absolute_import
__all__ = ['accuracy']
def accuracy(output, target, topk=(1,)):
"""Computes the precision@k for the specified values of k"""
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct =... |
63a10b05ed598f21d65db8969ef88ceeec1bddc6c1a5e2aba58cfef589356e27 | Python | 537 | 16 | #!/usr/bin/env python
#================================================================
# Copyright (C) 2022 Yufeng Liu (Braintell, Southeast University). All rights reserved.
#
# Filename : feature_processing.py
# Author : Yufeng Liu
# Date : 2022-09-01
# Description :
#
#============... |
879d3d4dd11ca5be7ee382689da5377b1d93335e465412e333d08d08fc274d3b | Python | 537 | 26 | __all__ = [
"__version__",
"AbstractProvider",
"AbstractResolver",
"BaseReporter",
"InconsistentCandidate",
"Resolver",
"RequirementsConflicted",
"ResolutionError",
"ResolutionImpossible",
"ResolutionTooDeep",
]
__version__ = "1.0.1"
from .providers import AbstractProvider, Ab... |
c14e58e83528dff24bec343085da1c36345a2f5cb310f26a6dd82b09ebe41b0c | Python | 537 | 18 | """
This script organizes the ring data, convertig the timestamps to DD-MM-YYYY format
@author: trianaa1
"""
import sys
import pandas as pd
file = "/m/cs/project/networks-pm/behavioral/sub-01_day-all_device-oura.csv"
savefile = "/m/cs/scratch/networks-pm/effects_externalfactors_on_functionalconnectivity/data/behavior... |
eb5e531cdc361e46318c5834f128ab1d0de9df4771bd21b22bbd57ee37832cf5 | Python | 537 | 20 | import logging
logging.addLevelName(
logging.WARNING, "\033[1;33m%s\033[1;0m" % logging.getLevelName(logging.WARNING)
)
logging.addLevelName(
logging.CRITICAL, "\033[1;91m%s\033[1;0m" % logging.getLevelName(logging.CRITICAL)
)
from spainn import asetools
from spainn import interface
from spainn.calculator imp... |
1a6b3a4b6ecda808b8eb3c87ae9bfb4d9f3422f0c65c7c68d87c007b2cdc902e | Python | 538 | 18 | from preprocess import TCGA_Case
from utils.logger import setup_logging
from pathlib import Path
from utils import set_random_seed
SEED = 1126
set_random_seed(SEED)
if __name__ == '__main__':
setup_logging(Path('./Logs/Tests/'))
Case_1 = TCGA_Case(case_id='f130f376-5801-40f9-975d-a7e2f7b5670d', directory='./... |
2474c8564f5179f0602a7239b3d4bc97834e79e762e87c1fb85ec2628a975677 | Python | 538 | 22 | """
Created on 25/05/2020
:author: Chinchien Lin
:summary: AbstractPreprocessingCommand is an abstract class, from which you derive new classes.
"""
import json
from abc import ABC, abstractmethod
class AbstractPreprocessingCommand(ABC):
def __init__(self, config_path):
with open(config_pat... |
615fe1ed6f6002a8809e093ec68d28923d136e9f2a739ba45c0e0e4218b91834 | Python | 538 | 21 | #!/bin/env python
"""
OXASL - Pre-quantification module
This is run before model fitting and should generate effectively differenced ASL data
e.g. by multiphase decoding
Copyright (c) 2008 University of Nottingham
"""
try:
import oxasl_mp
except ImportError:
oxasl_mp = None
def run(wsp):
if wsp.asld... |
1fa4bc19442edc745f56dc695e5af70b5465df00582e5d2b752a6986623a263c | Python | 539 | 24 | #!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup # noqa: F811
setup(
name="vanhateren",
version="0.0.1",
author="Eric Hunsberger",
author_email="ehunsber@uwaterloo.ca",
url="h... |
272dfd202ac68e052b4966a61665af5633977b4f629249ebfe26290ce4da29fe | Python | 539 | 15 | import json
from collections import defaultdict
from ord.utils import json_load, json_dump
train_data = json_load("../workplace_data/datasets/USPTO-n100k-t2048_exp1/train.json")
name_to_roles = defaultdict(list)
for d in train_data:
ref = json.loads(d['output'])
for r_input in ref['inputs'].values():
... |
32a7a2c81b1545ac254cb3232591f6070a1ccb9cbec0e8501a171819595f7dea | Python | 539 | 29 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from common_setup import IssueConfig, IssueExperiment
REVS = ["issue481-base", "issue481-v1"]
SUITE = suites.suite_optimal_with_ipc11()
CONFIGS = [
# Greedy (tests single and alternating open lists)
IssueConfig("astar_lmcut", [
... |
b08748b8778851963cb0b28ce88d5d58fd3025a217ed0bdd7d9c2e048832b546 | Python | 539 | 20 | # Auto-generated by nodebpy.assets.dump_library — do not edit manually.
from .composite_depth_fog import CompositeDepthFog
from .cone_shadow import ConeShadow
from .depth_outline import DepthOutline
from .id_outline import IDOutline
from .illustrate import Illustrate
from .mask_pixels import MaskPixels
from .outline im... |
0381bd1a1a9db7aa9ccdeaf92d3e3a5ba4ee4702276d39059e98bb0270b9d854 | Python | 540 | 19 | """Console package init file."""
import logging
from console.interfaces.acquisition_parameter import AcquisitionParameter
_parameter: AcquisitionParameter | None = AcquisitionParameter.load()
parameter: AcquisitionParameter
if isinstance(_parameter, AcquisitionParameter):
parameter = _parameter
else:
log = ... |
271ea3d323a12084450906b098766c47841754dfd8529f77e7a278a6239b6749 | Python | 541 | 28 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
import common_setup
REVS = ["issue544-base-v2", "issue544-v2", "issue544-v3"]
LIMITS = {"search_time": 1800}
SUITE = suites.suite_satisficing_with_ipc11()
CONFIGS = {
"eager_greedy_ff": [
"--heuristic",
"h=ff()",
... |
944e3af86bb8ae2cb6a9cdb926b45580b63f9135094d6a786a58cf1fcab4faf4 | Python | 541 | 20 | import numpy as np
import plotext as plt
import sys
NB_NEURONS = 1024
TIME_ROW = 0
SPK_ROW = 1
data = np.genfromtxt(sys.argv[1], delimiter=';', skip_header=1)
# data = np.genfromtxt("raster.csv", delimiter=';', skip_header=1)
max_id = max(data[:,SPK_ROW])
plt.theme("clear")
plt.scatter(data[:, T... |
be1af2c16ecce3e3fd25f63d5c7de8fe8dec1c81356eb2f6fa5a2596a9617bbb | Python | 541 | 16 | # -*- coding: utf-8 -*-
from supar.structs.fn import tarjan
def test_tarjan():
sequences = [[4, 1, 2, 0, 4, 4, 8, 6, 8],
[2, 5, 0, 3, 1, 5, 8, 6, 8],
[2, 5, 0, 4, 1, 5, 8, 6, 8],
[2, 5, 0, 4, 1, 9, 6, 5, 7]]
answers = [None, [[2, 5, 1]], [[2, 5, 1]], [[2, 5,... |
cbb65558cc069a5e4714e075edc2180a54ac0e2783389553e43ba1916bd800e4 | Python | 541 | 31 | """
Author: David Kappel
Copyright (C) 2024, by the author.
See the LICENSE.txt file for more information.
"""
import numpy as np
import pylab as pl
from core.ou_bridge import gen_ou_bridge_process
from core.parameters import *
def main():
win_len = 200
# test spike pattern
T_vals = 1... |
d4bab438948a19e1fbabcfb572b617c1ae49196ff0dd013b7fc2be72bba4c882 | Python | 541 | 14 | from nnunet.dataset_conversion.utils import generate_dataset_json
if __name__ == '__main__':
json_path = r''
imagesTr_dir = r''
imagesTs_dir = r''
generate_dataset_json(json_path,
imagesTr_dir = imagesTr_dir,
imagesTs_dir = imagesTs_dir... |
3cdc25e895b877578e960e1858fcaeec58c634183e492fb7b1caa331da20beff | Python | 542 | 17 | import numpy as np
from scipy.special import comb
def rand_index_score(clusters, classes):
tp_plus_fp = comb(np.bincount(clusters), 2).sum()
tp_plus_fn = comb(np.bincount(classes), 2).sum()
A = np.c_[(clusters, classes)]
tp = sum(comb(np.bincount(A[A[:, 0] == i, 1]), 2).sum()
for i in set(... |
d066371e2daa219bc3ace389dc0b6aa6933546c631affeba111e041e3b8c88c7 | Python | 542 | 19 | from typing import TYPE_CHECKING, Tuple
if TYPE_CHECKING:
# TypedDict was introduced in Python 3.8.
#
# TODO: Remove the else block and TYPE_CHECKING check when dropping support
# for Python 3.7.
from typing import TypedDict
class CodingStateMachineDict(TypedDict, total=False):
class_t... |
e4f2c0287c3d2fd1701bc6a177c83758cced251cb0bb0180cca84a51940ef4d4 | Python | 542 | 23 | import math
import matplotlib.pyplot as plt
input_data_file = "expected_outputs/stdout.out" # Output from the test
X = []
Y = []
for line in open(input_data_file) :
if line[0] =='#' : continue
tokens = line.strip().split()
X.append(float(tokens[0]))
Y.append(float(tokens[1]))
fig1 = plt.figure()
ax1 = fig1.a... |
46d867c36a1472e310865903e7da8f77780cad1e8c57d2d144e29938aac91548 | Python | 544 | 19 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pdb
obs1 = pd.read_pickle('C://CodeRepos//spikerNet//obsB.pickle')
reward1 = pd.read_pickle('C://CodeRepos//spikerNet//rewardB.pickle')
stim1 = pd.read_pickle('C://CodeRepos//spikerNet//stimB.pickle')
obs1Val = obs1['0']
target = pd.read_pick... |
5d6e10b1c8c8d0fd88c71a63f01b14b5f72909507d7ddb9a4ce558a46ba7c5ed | Python | 544 | 27 | from numpy import isnan
from wonambi import Dataset
from .paths import mff_file
d = Dataset(mff_file)
def test_mff_read():
d.read_data(begtime=10, endtime=20)
def test_mff_before_start():
data = d.read_data(begsam=-100, endsam=10)
assert isnan(data.data[0][0, 0])
def test_mff_after_end():
n_sam... |
41012f13449d852cac8aeea746393f5cbf3d49f24e2077f2676eb507d28193b3 | Python | 545 | 14 | def update_param(name, param):
if name == 'distribution':
values = param['values']
param['values'] = [v for v in values if v not in ['custom', 'ordinal', 'quasibinomial']]
return param
elif name == 'stopping_metric':
param['values'].remove('anomaly_score')
param['values']... |
47855e66f799b144cf6517d6a6465e1703060685462229ccb8ca254faba36309 | Python | 545 | 15 | # -*- coding: utf-8 -*-
import numpy as np
TARGET = ("CVD", "HF", "AFib", "CAD", "MI", "Stroke", "DENOVO")
ITERATION = tuple(range(100))
WEIGHT = np.zeros((len(TARGET), len(ITERATION), 95))
for d0, target in enumerate(TARGET):
for d1, iteration in enumerate(ITERATION):
WEIGHT[d0, d1] = np.loa... |
1677e69e01858bb229ab2befa1ad5d7afdbdd66b0d68382d394bc78cd2c793ee | Python | 546 | 18 | #!/bin/env python3
'''
Create sub-Makefile to be included in the main Makefile
'''
import pdlfeynman as fy
import yaml
import sys
particles = yaml.safe_load(open(sys.argv[1]))
targets = []
for particle, data in particles.items():
if max(particle.Q, particle.P) > 0:
svg = f"particles/{particle.symbol}.svg"... |
1d074389e2154b51122c63284564ba76d1ae356c84de3566fb3c88f555434631 | Python | 546 | 19 | from .src.mult_booth_signed import (
mult_booth_signed as mult_booth_signed,
)
from .src.mult_booth_unsigned import (
mult_booth_unsigned as mult_booth_unsigned,
)
from .src.mult_dsp_signed import (
mult_dsp_signed as mult_dsp_signed,
)
from .src.mult_dsp_unsigned import (
mult_dsp_unsigned as mult_dsp_... |
79faca887a333615e02c27b1b657fca116c068af33e6787e862a87b12addc34a | Python | 546 | 20 | """Config & status menu for Xu Lab RegTools.
Provides a PyQt5 dialog (gui.py) and a pure-Python status snapshot
(status.py) reporting venv presence, atlas installation state, and
GPU/torch availability. Launched by 00_run_config_menu.bat.
"""
from regtools.config_menu.status import (
EnvironmentStatus,
... |
f604004e9b5b1647a5908cb439f5851000b3ab15c93100d6087f6b04e0195704 | Python | 546 | 18 | """This is a subpackage because the directory is on sys.path for _in_process.py
The subpackage should stay as empty as possible to avoid shadowing modules that
the backend might import.
"""
import importlib.resources as resources
try:
resources.files
except AttributeError:
# Python 3.8 compatibility
def ... |
a275decb09a92a6885bb5154639fb9461c62b609bd87191b6428d6155df39fc4 | Python | 547 | 27 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
import common_setup
CONFIGS = {
"cg-lazy-nopref": [
"--heuristic", "h=cg()",
"--search", "lazy_greedy(h)"
],
"cg-lazy-pref": [
"--heuristic", "h=cg()",
"--search", "lazy_greedy(h, preferred=[h])... |
282723d296d2eef98fcf7460721ff872dc3618dcdae7e6cdac2d3aa722c586c9 | Python | 548 | 25 | # built-in
from math import isclose
# external
import pytest
# project
import textdistance
ALG = textdistance.StrCmp95
@pytest.mark.parametrize('left, right, expected', [
('MARTHA', 'MARHTA', 0.9611111111111111),
('DWAYNE', 'DUANE', 0.873),
('DIXON', 'DICKSONX', 0.839333333),
('TEST', 'TEXT', 0.90... |
a277328a06d154f48b9e5ae2a561d88e8037c8e334d8ce455eee7929f0764792 | Python | 550 | 14 | class Function(object):
def __init__(self, name, arguments, type_name):
self.name = name
self.arguments = arguments
if type_name != "number":
raise SystemExit("Error: object fluents not supported\n" +
"(function %s has type %s)" % (name, type_name))
... |
b5f95a5653f4a29636b078d2ce5122d35505feb50c67d30f5cba59662c7857ef | Python | 550 | 28 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
import common_setup
CONFIGS = {
'astar_ipdb': [
'--search',
'astar(ipdb())'],
'astar_pdb': [
'--search',
'astar(pdb())'],
'astar_gapdb': [
'--search',
... |
e30d6099528f7ffb34994570d128b3800a5cd9ac06511e10897925a6eb7b35d2 | Python | 550 | 28 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
import common_setup
CONFIGS = {
'astar_ipdb': [
'--search',
'astar(ipdb())'],
'astar_pdb': [
'--search',
'astar(pdb())'],
'astar_gapdb': [
'--search',
... |
289ba9169034f1889fcbb9560adbf3869f72561bacd23bf618de6c90be5bc198 | Python | 551 | 21 | """Brier scores and event-time prediction errors for censored outcomes."""
from .brier_score import (
brier_multiple_points,
brier_multiple_points_cr,
brier_multiple_points_cr_per_event,
brier_multiple_points_ic,
brier_score_ic,
)
from .mean_error import inclusion_rate, mean_error, mean_error_ic
_... |
903696b296f4ce4a9f0899b68cec441626774d3d25b7c46dbea01ae71ae77bd8 | Python | 551 | 23 | import unittest
class TestListMain(unittest.TestCase):
def test_imports(self):
try:
from dreamcoder.domains.list.main import (
retrieveJSONTasks,
list_features,
isListFunction,
isIntFunction,
train_necessary,
... |
c00f1aadcb16f3a73cb8340f86369fca7e4f72af1b72416001ee069235218afd | Python | 551 | 19 | from psychopy.hardware.keyboard import Keyboard
from psychtoolbox import hid
# fix psychtoolbox issue for older versions of psychopy
import ctypes
xlib = ctypes.cdll.LoadLibrary("libX11.so")
xlib.XInitThreads()
def get_keyboard(dev_name):
devs = hid.get_keyboard_indices()
idxs = devs[0]
names = devs[1]
... |
05e069812af0caf9cdbe6945eb84065191b05e6886e3cb5d0c965dfed3800fee | Python | 552 | 26 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from common_setup import IssueConfig, IssueExperiment
REVS = ["issue592-base", "issue592-v1"]
SUITE = suites.suite_satisficing()
CONFIGS = [
IssueConfig("seq-sat-lama-2011", [], driver_options=["--alias", "seq-sat-lama-2011"]),
Issu... |
05f77519982e75f9a70aafece9442095f6fb9a9f1b0635bfbe108963d2166f0b | Python | 552 | 26 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from common_setup import IssueConfig, IssueExperiment
REVS = ["issue592-base", "issue592-v3"]
SUITE = suites.suite_satisficing()
CONFIGS = [
IssueConfig("seq-sat-lama-2011", [], driver_options=["--alias", "seq-sat-lama-2011"]),
Issu... |
2d13491085eaa1bac921094b1be8604d7ae493e730f2b6271a6b85242276f490 | Python | 552 | 26 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from downward import suites
from common_setup import IssueConfig, IssueExperiment
REVS = ["issue592-base", "issue592-v4"]
SUITE = suites.suite_satisficing()
CONFIGS = [
IssueConfig("seq-sat-lama-2011", [], driver_options=["--alias", "seq-sat-lama-2011"]),
Issu... |
7b9b263f3906b8195b3b53039ea9e425ece6f3c2872afa922f0702b1d7bc1944 | Python | 552 | 6 | ###########################################################################################
# Developed by: Rafael Padilla #
# SMT - Signal Multimedia and Telecommunications Lab #
# COPPE - Universidade Federal do Rio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.