sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e21351623039af2268073478345ee2e00386b9d04b18916c25f3cff21f6abdfd
Python
2,574
71
from goatools.base import download_go_basic_obo obo_fname = download_go_basic_obo() from goatools.base import download_ncbi_associations fin_gene2go = download_ncbi_associations() from goatools.obo_parser import GODag obodag = GODag("go-basic.obo") from goatools.anno.genetogo_reader import Gene2GoReader # Read NCB...
e8c470f5c3c3960c71584938d6c884140ba00745901bf857c8daeeb322edd10e
Python
2,574
78
## ------------------------------------------------------------ ## IMPORTS ## ------------------------------------------------------------ ## ----- OS ----- ## import os import gc import io ## ----- MATH / STATS ----- ## import cv2 import heapq import random import natsort import scipy.io import numpy as np ## -----...
4a4e0ba7c35ea78f5303db67130b67df5139b816ff3da60754252f15acabf4ee
Python
2,575
104
# Copyright 2014-2015 Numenta Inc. # # Copyright may exist in Contributors' modifications # and/or contributions to the work. # # Use of this source code is governed by the MIT # license that can be found in the LICENSE file or at # https://opensource.org/licenses/MIT. import os import pkg_resources import warnings fr...
6a69c128fecb566112c5f0462a6e1457b71b1891193173d9a6cd01ca956cd14e
Python
2,575
70
import numpy as np import random import torch import torch.nn as nn import torch.optim as optim import datetime from src.model import Net def set_seed(seed): random.seed(seed) np.random.seed(seed) torch.random.manual_seed(seed) torch.manual_seed(seed) if torch.cuda.is_available(): torch.cuda....
90170b73aae2b3c7d347e2afc6af181e66dd79e48991904c306a7267e87b37d0
Python
2,575
78
#!/usr/bin/env python from __future__ import print_function import logging from itertools import groupby import argparse # Create a logger logging.basicConfig(format="%(name)s - %(asctime)s %(levelname)s: %(message)s") logger = logging.getLogger(__file__) logger.setLevel(logging.INFO) def is_header(line): return...
e7fb73d5c8a671d38e39f9dcf8a097886facc3390597bfcdb8501d97af9dba6c
Python
2,575
88
# Training module # Imports import json from pathlib import Path import joblib from modules.train_steps.train_model import train_model def run_all( ml_algorithm: str, features_path: str, property_path: str, output_folder: str, hp_path: str | None, scale_data: bool, ): """Run every step ...
2e1022bdb306ab8dc8150904678bb1fa215e075b3baeb18da10c9a0971c3d76b
Python
2,576
70
import os import warnings import numpy as np import tifffile as tiff import skimage.io as skio # Registry for supported formats FORMAT_REGISTRY = {} def register_writer(*formats): """Decorator to register a new format writer.""" def decorator(func): for fmt in formats: FORMAT_REGISTRY[fmt...
836946128c1293316cb330fd0e1fafca2d92d7382b48c32e6f7eee0b7b3537fe
Python
2,576
80
import unittest import logging import numpy as np from heig.fpca import FPCA log = logging.getLogger() log.setLevel(logging.INFO) def get_batch_size(n_top, max_n_pc, n_sub): """ Adaptively determine batch size Parameters: ------------ max_n_pc: the maximum possible number of components n_su...
af9a2bb78f48e661945e39716afe54fd3f6df115b2a31e1fed4dc226b4e318f2
Python
2,576
72
import json from argclz import AbstractParser from neuralib.util.verbose import fprint from rscvp.util.cli import SQLDatabaseOptions, StimpyOptions from rscvp.util.database import FieldOfViewDB __all__ = ['InsertFOVDBOptions'] class InsertFOVDBOptions(AbstractParser, StimpyOptions, SQLDatabaseOptions): DESCRIPT...
85453d26f112edce27fc42fae5ec8ca9bc6475f74ad382fb94cda51d117bc6b0
Python
2,577
54
import argparse import torch from tqdm import tqdm from model import ProTact from utils.deepinteract_utils import calculate_top_k_prec, calculate_top_k_recall if __name__ == "__main__": parser = argparse.ArgumentParser(description="Predict the Contact map.") parser.add_argument("--dataset", type=str, defaul...
8fbc5573daeecdd3779a495286dbfd7da59da3ad45b5d032e2420c1de1f816e4
Python
2,577
79
import os os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") import pytest pytest.importorskip("PySide6") from PySide6.QtWidgets import QApplication output_dir_dialog = pytest.importorskip("musclex.ui.widgets.output_dir_dialog") from musclex.utils.association_store import AssociationStore @pytest.fixture(scop...
19394f042f956c33e4cfbc428b6cfb964686f767c213b37a5b38f547d377a386
Python
2,578
77
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from UBSIM.blind_SIM_functions import reshape_psf, convolve_with_psf, forward_model, calc_residual, calc_obj_grad, calc_ill_grad from UBSIM.models import UNet def IterationBlock(network, obj, ill, M, psf, num_frames, I0): """ ...
893bbde74f88655c6a7929e0f937c1001a99417d5c3590f43333419f0a57d067
Python
2,578
100
import pandas as pd import time import sys import os def main(argv): if argv[1] == '--datasets': try: name = argv[2] return name except: return "Wrong command!" else: return "Wrong command!" def is_same(df1, df2, val): df1_val = df1[val] df2...
ee72b065524425fab5e1c89cadd780163be4b375516c1bb678431ee9021ba7b0
Python
2,578
87
# The ImpedanceFitter is a package to fit impedance spectra to # equivalent-circuit models using open-source software. # # Copyright (C) 2018, 2019 Leonard Thiele, leonard.thiele[AT]uni-rostock.de # Copyright (C) 2018, 2019, 2020 Julius Zimmermann, # julius.zimmermann[AT]un...
49e695dca7c983b0ed70b87ed6fdf92bce72b1cd2645e2d1e157cfbbce4fe324
Python
2,579
57
import torch from tqdm import tqdm import numpy as np from transformers import pipeline import os import json each_user_tweets=json.load(open("id_tweet.json",'r')) feature_extract=pipeline('feature-extraction',model='roberta-base',tokenizer='roberta-base',device=2,padding=True, truncation=True,max_length=50, add_spec...
51cbc6c14a82ead97d6aa5cfa393e88a0630b952a9849d1b8271ee11f0c66853
Python
2,579
60
import torch import shutil import logging from typing import Type, List from argparse import Namespace from cosface_loss import MarginCosineProduct def move_to_device(optimizer: Type[torch.optim.Optimizer], device: str): for state in optimizer.state.values(): for k, v in state.items(): if tor...
269de91912981e36b3a685bc9be0d2bc3697e61ba39d74a216dcf3ba0adcde72
Python
2,580
63
# -*- coding: utf-8 -*- ################################################################################ ## Form generated from reading UI file 'add_stream_dialog.ui' ## ## Created by: Qt User Interface Compiler version 6.4.2 ## ## WARNING! All changes made in this file will be lost when recompiling UI file! #########...
211475ae3a2eaeb61554e486e303e86c2cbb535a0ac96cfaf423d3c90ff0b439
Python
2,581
100
import pandas as pd import time import sys import os def main(argv): if argv[1] == '--datasets': try: name = argv[2] return name except: return "Wrong command!" else: return "Wrong command!" def is_same(df1, df2, val): df1_val = df1[val] df2...
2dc5bf4b9b4e4a8c4092950b3115d71235020675b581d8284f4f3421318f854b
Python
2,582
68
import os import pickle import shutil from pathlib import Path from typing import List import pytest from brainways.project.brainways_subject import BrainwaysSubject from brainways.project.info_classes import ProjectSettings, SliceInfo from brainways.utils.io_utils import ImagePath @pytest.fixture def brainways_tmp...
cd95b3518eaae021b87051a723dbdacd797d08bf6f7cd4eaa3dd7f4c619c8245
Python
2,582
61
import shutil import os #from ...bids_data.rename_bids_file import rename_bids_file from cvdproc.bids_data.rename_bids_file import rename_bids_file from nipype.interfaces.base import CommandLineInputSpec, File, TraitedSpec, CommandLine, BaseInterfaceInputSpec, BaseInterface from traits.api import Str, Int, Directory, D...
55a874415ebac67dafffa8664f9a775e6847e5b36ef7223872cf6607ddd7d4b1
Python
2,583
85
# Copyright 2015 Numenta Inc. # # Copyright may exist in Contributors' modifications # and/or contributions to the work. # # Use of this source code is governed by the MIT # license that can be found in the LICENSE file or at # https://opensource.org/licenses/MIT. """ This file contains plotting tools for NAB data and ...
678c20e931c4ecfbdd2dcfb5f73e23db5e117332f0d549247d5eb407ab11c6f2
Python
2,583
71
import base64 import json import os import shutil from io import BytesIO from pathlib import Path from typing import Any import numpy as np import requests from eir.setup.input_setup_modules.setup_image import default_image_loader from eir.utils.logging import get_logger logger = get_logger(name=__name__) def load...
241e592bff9c09873753613a55da51b77c1f19832794d5a3acc337a47ef03171
Python
2,585
84
""" Tests for `bx.align.maf.sitemask`. """ import tempfile from io import StringIO import bx.align.maf from bx.align.sitemask import cpg test_maf_cpg = """##maf version=1 scoring=none a score=0 s apple 34 64 + 110 AGGGA---GTTCGTCACT------GTCGTAAGGGTTCAGA--CTGTCTATGTATACACAAGTTGTGTTGCA--ACCG s orange 19 61 - 100 AGG...
38c22b0a373c02cd0f8568fd493fa560bef239c24c90153dd054e7d68130b0c1
Python
2,585
77
import nrrd import numpy as np import pytest from ccf_streamlines.projection import BoundaryFinder @pytest.fixture def boundary_finder(tmp_path): """A BoundaryFinder over a tiny two-region atlas. Region 1 occupies the top two rows, region 2 the bottom two; the middle rows are background (0), which `_val...
82958457325582bbbdda3968bf78d6ce0d6be167c1c41e0b30ce5444fab75a26
Python
2,585
68
#!/usr/bin/env python """ Phresh photonics QPD functionality Hazen 05/17 """ import numpy from PyQt5 import QtCore import storm_control.hal4000.halLib.halMessage as halMessage import storm_control.sc_hardware.baseClasses.hardwareModule as hardwareModule import storm_control.sc_hardware.baseClasses.lockModule as loc...
bf6ea9b2d206014bc32b201b6583c8b75e6b1168851fb12eb2800775c4a0c933
Python
2,585
79
""" Position Embedding Utilities Hacked together by / Copyright 2022 Ross Wightman """ import logging import math from typing import List, Tuple, Optional, Union import torch import torch.nn.functional as F from .helpers import to_2tuple _logger = logging.getLogger(__name__) def resample_abs_pos_embed( po...
f7dd1c6a74154b24fc7b1206fb5d21f03771d63c34a3f5a60b7f22ec0756aa1b
Python
2,587
68
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from pathlib import Path import torch from ultralytics.utils import LOGGER, YAML def torch2ncnn( model: torch.nn.Module, im: torch.Tensor, output_dir: Path | str, quantize: int | str | None = Non...
ff3c083534eeb5307b42eab8db5998c38690a10ac0d0f4c1b0ba1afffaa999ef
Python
2,588
86
import pytest import numpy as np from chemgraph.models.calculators.emt_calc import EMTCalc from chemgraph.models.calculators.mace_calc import MaceCalc from chemgraph.models.calculators.tblite_calc import TBLiteCalc from chemgraph.models.calculators.orca_calc import OrcaCalc from ase import Atoms def test_emt_calculat...
143cb86d2a24073a99dd78b6735f5b7840ca119a10d2c52e14c264688c6e19ca
Python
2,589
74
import os from sys import argv from pathlib import Path import rpy2.robjects as robjects import numpy as np import pandas as pd from sklearn import linear_model def rank_gene_dropouts(DataPath, CV_RDataPath, OutputDir): ''' Script to rank the genes in the training set of the inputfile based on th...
280955e081f297724298cf0b1c390b7114223857852dfabcf3e8831fce01b41e
Python
2,589
57
import pyvisa as visa import pyvisascope import multitimer import time import yaml import logging visa.log_to_screen('INFO') logger = logging.getLogger('pyvisa') log2file = logging.FileHandler('experiment.log') logger.addHandler(log2file) def main(): # enter here the ID of your device. On windows, VISA you c...
09fe73da4f896846e7c1cb906122cf917b8927059526d4e2e8fc58aadfe1a0d3
Python
2,590
97
""" Logging utilities for DHG-LGB framework. Provides standardized logging across all modules with file and console output. """ import logging import os import sys from datetime import datetime from typing import Optional def setup_logger( name: str = 'DHG-LGB', log_dir: Optional[str] = None, log_level:...
468d6bc0aa1f629d369cecaace7ce2fad39d37fb3c058849d7c4aee0443da331
Python
2,590
84
import os.path as op import dipy.data as dpd import nibabel as nib import nibabel.tmpdirs as nbtmp import numpy as np import numpy.testing as npt import pytest from dipy.reconst.shm import calculate_max_order from AFQ.models import csd from AFQ.models.asym_filtering import unified_filtering as pyafq_unified_filtering...
74189b9f0aca8db56738b3ca4c3ff774b7b4669f770cd0502bbad1a6b889e647
Python
2,590
80
from collections import OrderedDict from torch import nn from torch.nn.init import xavier_normal import torch from torch.nn import functional as F import torch.nn.init as init from attorch.regularizers import LaplaceL23d, LaplaceL2 from torch.autograd import Variable from attorch.module import ModuleDict from staticn...
aa79d8c77786ad849d4f072998358af057c73d83e6de77a07593d4722eadb87a
Python
2,590
54
from brainscore_vision.model_helpers.check_submission import check_models import functools from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from brainscore_core.supported_data_standards.brainio.s3 import...
fe5686f9a20b0217d33e9f9d2f12581cc8f36b5bdfe9c743c588350fed1451d8
Python
2,590
93
#!/usr/bin/env python3 """ Base64 Image Remover for Markdown Files This script removes base64-encoded images from markdown files, deleting the image references and updating the markdown in place. """ import re import argparse from pathlib import Path def remove_base64_images(markdown_content: str) -> str: """ ...
175e2c1babce77344a1d36e13efe0fa83ca9f61b093798aac42a99e9be350af2
Python
2,592
83
# The ImpedanceFitter is a package to fit impedance spectra to # equivalent-circuit models using open-source software. # # Copyright (C) 2018, 2019 Leonard Thiele, leonard.thiele[AT]uni-rostock.de # Copyright (C) 2018, 2019, 2020 Julius Zimmermann, # julius.zimmermann[AT]un...
45c836bedfcee98484a04b39082dbc4834f85a9a72107a0e31c6ee11574d2abf
Python
2,593
57
import torch from tqdm import tqdm import numpy as np from transformers import pipeline import os import json each_user_tweets=json.load(open("id_tweet.json",'r')) feature_extract=pipeline('feature-extraction',model='roberta-base',tokenizer='roberta-base',device=1,padding=True, truncation=True,max_length=50, add_spec...
647cf309cb958430d5c4a508a14d4008a3c603cdff1398e740679ec4c4c41b2b
Python
2,593
57
import torch from tqdm import tqdm import numpy as np from transformers import pipeline import os import json each_user_tweets=json.load(open("id_tweet.json",'r')) feature_extract=pipeline('feature-extraction',model='roberta-base',tokenizer='roberta-base',device=3,padding=True, truncation=True,max_length=50, add_spec...
84057b9a43186ce78cf7cf73ed4cf8bb65d99b7326fafb52cb3b01afb897c57f
Python
2,593
57
import torch from tqdm import tqdm import numpy as np from transformers import pipeline import os import json each_user_tweets=json.load(open("id_tweet.json",'r')) feature_extract=pipeline('feature-extraction',model='roberta-base',tokenizer='roberta-base',device=3,padding=True, truncation=True,max_length=50, add_spec...
8da09555cdf2242d4e66c8e633f88e89fca0816503b715fe6b3911a640b9ba60
Python
2,593
57
import torch from tqdm import tqdm import numpy as np from transformers import pipeline import os import json each_user_tweets=json.load(open("id_tweet.json",'r')) feature_extract=pipeline('feature-extraction',model='roberta-base',tokenizer='roberta-base',device=2,padding=True, truncation=True,max_length=50, add_spec...
8da2ab9db27225dfdf0184371f024c3e0a2844020d7c3acf15fea1215ba46d05
Python
2,593
57
import torch from tqdm import tqdm import numpy as np from transformers import pipeline import os import json each_user_tweets=json.load(open("id_tweet.json",'r')) feature_extract=pipeline('feature-extraction',model='roberta-base',tokenizer='roberta-base',device=3,padding=True, truncation=True,max_length=50, add_spec...
c4290039015db07cd0400c376ca50da22489574434c3a9b09e4a1c520a83ef78
Python
2,593
60
from typing import Generator, Callable, List class Stage: """Abstract superclass for Runnables""" def __init__(self, list_of_callables: List[Callable], **kwargs): """ :param list_of_callables: a list of callables, that must have a signature compatible with this __init__ function (list...
d9d88f3346c0d532ddb27f1b3522b721b8fa47afd0a179355ef4897b5b86af15
Python
2,593
95
""" I/O utility functions. Author: florian.birk@tuebingen.mpg.de """ import numpy as np import pandas as pd import nibabel as nib import h5py # ===== MULTIUSE ===== def load_nifti_float64(file_path): """Load NIfTI file data as float64 array. Args: file_path: Path to NIfTI file Returns: ...
e646057c70ca293ecff39217305171e62d60313e8fe8eba33a8b025e9406c293
Python
2,593
57
import torch from tqdm import tqdm import numpy as np from transformers import pipeline import os import json each_user_tweets=json.load(open("id_tweet.json",'r')) feature_extract=pipeline('feature-extraction',model='roberta-base',tokenizer='roberta-base',device=2,padding=True, truncation=True,max_length=50, add_spec...
f5cbf12941fef377aed98a16eec89309283902814c2dff62a7747b34d29603fd
Python
2,593
57
import torch from tqdm import tqdm import numpy as np from transformers import pipeline import os import json each_user_tweets=json.load(open("id_tweet.json",'r')) feature_extract=pipeline('feature-extraction',model='roberta-base',tokenizer='roberta-base',device=1,padding=True, truncation=True,max_length=50, add_spec...
fbfe14ae06873a9c54bdf3ce4d6e674fefe2e9e8efbc5a6cdb530ed72fd65da3
Python
2,593
57
import torch from tqdm import tqdm import numpy as np from transformers import pipeline import os import json each_user_tweets=json.load(open("id_tweet.json",'r')) feature_extract=pipeline('feature-extraction',model='roberta-base',tokenizer='roberta-base',device=2,padding=True, truncation=True,max_length=50, add_spec...
4532a7c5053079c3275728a638909ce1d77dd408b698a9c225c0c535d343ea42
Python
2,594
77
import os import numpy as np from PIL import Image from scipy.signal import convolve2d def matlab_style_gauss2D(shape=(3, 3), sigma=0.5): # 高斯加窗 m, n = [(ss - 1.) / 2. for ss in shape] y, x = np.ogrid[-m:m + 1, -n:n + 1] h = np.exp(-(x * x + y * y) / (2. * sigma * sigma)) h[h < np.finfo(h.dtype)....
7401a2718767d09d3b8f8f1d8d7a01342cefc26bdc2060b35404b26edc9f0a1b
Python
2,594
82
""" ROI-specificity analysis. This script runs the same moderation model across multiple ROI-level cooperation-related IBS change variables and summarizes the interaction term. Expected input: data/processed_main_analysis_data.csv """ from pathlib import Path import pandas as pd import statsmodels.formula.api as...
09dbfa460c1956f1814c4d79ed932edea5eb3d60cb8bff7b21a73e68901f23e0
Python
2,595
117
# Copyright 2015 Numenta Inc. # # Copyright may exist in Contributors' modifications # and/or contributions to the work. # # Use of this source code is governed by the MIT # license that can be found in the LICENSE file or at # https://opensource.org/licenses/MIT. import os import unittest try: import simplejson as ...
1a4b9fcdbdece387b9f21563a3e9732b30045bccb74807320a2246087922d68a
Python
2,595
81
# -*- coding: utf-8 -*- # # test_contexts.py import unittest import arbor as arb """ all tests for non-distributed arb.context """ class TestContexts(unittest.TestCase): def test_default_allocation(self): alloc = arb.proc_allocation() # test that by default proc_allocation has 1 thread and no ...
1cf27d9cf6bfa73e8aa68dd58c7e5c52e63e9e938f95b4061dd5e86136fe4d84
Python
2,596
124
# Configuration file for the Sphinx documentation builder. # -- Project information import sys import os import subprocess import memilio project = 'MEmilio' copyright = '2020-2026 MEmilio' author = '' release = '' version = '1.3.0' read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True' if read_the_d...
32b4f979e83431cdddd8ba22c49921c9c05ef6c616890bec88b1a41cb5f2c7ce
Python
2,596
94
"""Class definitions and utility functions specifically related to experimental design and organization. """ import pandas as pd class Trial: """ Experimental trial container. This class is a placeholder for trial-specific metadata and methods. """ pass class Session: pass class Cue: ...
49c5433805f035aae712e0c3150e2a3c7e81f3604cf40bd5f2961e20e9035a06
Python
2,596
82
"""Tests for `mmsplice` package.""" import pandas as pd from numpy.testing import assert_almost_equal from mmsplice import MMSplice from mmsplice.utils import encodeDNA, delta_logit_PSI_to_delta_PSI from mmsplice.vcf_dataloader import SplicingVCFDataloader from mmsplice.exon_dataloader import ExonDataset from mmsplice ...
b8146d6f8a0c1328b696579fc3e46af3c820cffb2da99213c5c4379f9fb4e825
Python
2,596
85
"""Step 5: Parcellation.""" from pathlib import Path import mne import matplotlib matplotlib.use("Agg") from osl_dynamics.meeg import parallel, source_recon, parcellation from osl_dynamics.utils.filenames import OSLFilenames # ---------------------------------------------------------------------------- input_dir = Pa...
cb5087a980b728fef4b3425793992e7433e2032c625d49f4825b278e2df515aa
Python
2,596
70
# Keywords and parameters obtained from QCEngine: https://github.com/MolSSI/QCEngine # MOPAC parameters for CompChemAgent from pydantic import BaseModel, Field class MopacCalc(BaseModel): """MOPAC calculator configuration. This class defines the configuration parameters for the MOPAC calculator, which i...
4cc0d33f4f0ef70745eab5ab50c3e9775d88cd5405c349f8fee820a0832606a6
Python
2,597
77
import torch from transformers import AutoTokenizer class DNABertTokenizer: # The Tokenizer actually performs the encoding def __init__(self, k=3): super(DNABertTokenizer, self).__init__() self.k = k if k not in [3, 4, 5, 6]: raise Exception( f"There does n...
bd1f0e0383f9d17686dd87c582ad1ff54131a65dcbf021f055396d60dfe5c7f5
Python
2,598
80
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT # Generated by Django 5.2.14 on 2026-07-31 08:28 from django.conf import settings from django.core.management.base import CommandError from django.db import migrations, models SERVER_WEBHOOKS_EXIST_ERROR = """\ Cannot roll back: found {count} webho...
362bcf1e7669411120ad38b2fb840ec9c069b48b5d3107e5cc2b396c793b4e39
Python
2,599
67
#!/usr/bin/env python # -*- coding: utf-8 -*- """This file is the main file that highjacks a model to make it do what we want """ import material import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error, r2_score PI = 3.14159265359 def c...
5075e447376bc5adaf3e54de7c612f124436c39e223a491734912394d859f828
Python
2,599
63
#!/usr/bin/env python3 import sys import getopt import time ############################################################################ # Main gateway: ############################################################################# # usage def main_usage(): print(""" Usage : MIRROR.py action [options] Actions: ...
51b35046c3e7c40b7202d8a1b1165b2fe631a7000cd0f0efc089ff2a6aa09d84
Python
2,599
72
# Copyright (C) 2020-2022 Intel Corporation # # SPDX-License-Identifier: MIT import cv2 import numpy as np from openvino.inference_engine import IECore class ModelLoader: def __init__(self, model, weights): ie_core = IECore() network = ie_core.read_network(model, weights) self._network = ...
d507ed1551c127729dd54e39829fd2a9e230984a6454e2d8b8ed0ae94f67abdf
Python
2,599
91
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import subprocess import threading from pathlib import Path import numpy as np import torch def fasta_file_path(prefix_path): ...
3533eb1a663fa3e136534273ba9dd8d992ed764aaed64d40f60b7bda4a7c11e0
Python
2,600
74
from os import PathLike import numpy as np from argclz import AbstractParser from neuralib.suite2p import Suite2PResult, get_neuron_signal, sync_s2p_rigevent from neuralib.util.utils import ensure_dir from neuralib.util.verbose import publish_annotation, print_save from rscvp.util.cli import SelectionOptions from sti...
3769b2fb5ebd5ed3ffa6d24bdb4e193e27884639857371bf0215a9047bee6b83
Python
2,601
76
""" Parts of the U-Net model """ import torch import torch.nn as nn import torch.nn.functional as F class DoubleConv(nn.Module): """(convolution => [BN] => ReLU) * 2""" def __init__(self, in_channels, out_channels, mid_channels=None): super().__init__() if not mid_channels: mid_c...
45e7a6cdc97512ce6e64a7240da4e0a247a24d925b70d5d70cd44c48bb40beb1
Python
2,601
82
import os import cv2 import sys sys.path.append("/LiNet") import torch import numpy as np from torch.autograd import Variable import argparse import random from lib_alban.utils_analyse import def_masks_extract import os.path as osp os.environ["OPENCV_IO_ENABLE_OPENEXR"] = "1" import lib_alban.utils_test as utils_tes...
016ce5cc3109b6083ddfa8b00c926f80c0d91977d044549c558b046f485841bc
Python
2,602
92
""" Support for masking potential CpG sites in *pairwise* alignments. """ from bx.align.sitemask import Masker from ._cpg import ( list_cpg, list_cpg_restricted, list_non_cpg, ) # Restricted. Only mask out sites that are defitely CpG class Restricted(Masker): def __init__(self, mask="?"): su...
02d92ff754ad8d71fa892a002181f27a72fad25edacf392cea4b7ad7a57eac6e
Python
2,603
78
# FetMRQC: Quality control for fetal brain MRI # # Copyright 2023 Medical Image Analysis Laboratory (MIAL) # # # 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/lice...
14f43778c8ba25023bd1257c8fe7ff1b5609c9dd398c19376a7a7afb2efc04bd
Python
2,603
77
from math import exp import torch import torch.nn.functional as F from torch.autograd import Variable def gaussian(window_size, sigma): gauss = torch.Tensor([exp(-(x - window_size // 2) ** 2 / float(2 * sigma ** 2)) for x in range(window_size)]) return gauss / gauss.sum() def create_window(window_size, cha...
c6904d8d53942d6c350bc262b696672cb1e459ae2f3b518aed8bb0acd4be9afa
Python
2,603
110
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 14 13:19:13 2022 @author: proussel """ import os import shutil from glob import glob import datetime import socket import fcntl import json from importlib.resources import files from pathlib import Path import numpy as np # list subdirectories o...
4be066258e0e1c9d2dac1fecf5f2631f983a5d9fe23daf41dfa89c8342af5252
Python
2,604
69
import numpy as np import pandas as pd from . import ELA_Network_functions #----------------------------------------------------------------------------------- from pyvis.network import Network def plot_Graph_by_pyvis(path_read_info_ALLState:str, SS_color_dict:dict, path_save:str=False) -> None: #---------------...
bd1e8891c59a5cf29f4c75014aaa7f2a043ae8066badd6c2dcf2bbc4702e80eb
Python
2,604
73
import pickle import mne import pandas as pd import numpy as np import glob from update_sub_lists import * import mido def load_pickle(filepath): with open(filepath, 'rb') as file: return pickle.load(file) def onsets_pitch_from_midi(file): """ Extracts the midi values from a file and returns...
f026b48f33fe62320c3100b3da2719ac3719aadee238ba99381939c6122590e6
Python
2,604
72
import sys from setuptools import find_packages, setup # package requirements if sys.version_info[:2] < (3, 6): raise RuntimeError("Python version >= 3.6 required.") with open("requirements.txt", "r") as f: requirements = f.read().splitlines() if sys.version_info[:2] == (3, 6): requirements = [x for x in ...
3b29b6562fc9526102e6e7f1665c10fbec79f6442ef3b680c8b87eeef02783bc
Python
2,606
60
import os import numpy as np from scipy.io import wavfile from tqdm import tqdm from basic_filter.HighPassFilter import HighPassFilter from basic_filter.LowPassFilter import LowPassFilter from basic_filter.BandPassFilter import BandPassFilter import re def read_wav_files_from_folder(audio_dir, scale=None): folder_...
b1c8eee451381ff503e8ee187c8dd50b3a3b8cee11f8d1e73c9d0a0027dffc0c
Python
2,606
110
# Tools to deal with specific kinds of strings (like paths) import re import collections import numpy as np def get_atoms_and_amount(formula: str) -> list[tuple[str, int]]: """Return a list of tuples of elements and amount Params ------ formula: chemical formula as a string Returns ------...
2db8970bf29256575e55e48ce0287e920ca9af9196aaf35f5284cf66b2fa414f
Python
2,608
89
from types import SimpleNamespace import numpy as np import pandas as pd from skspatial.objects import Line from napari_dmc_brainmap.results.results_helpers.tract_calculator import ( TractCalculator, ) def test_get_linefit3d_preserves_fitted_line_and_voxelization(): calculator = TractCalculator.__new__(Trac...
aab89a99f923ef3d9cb1961e20c9b5feecebfd779e97f87fb6582a3f7e77e432
Python
2,608
84
""" Dataset reader that wraps Hugging Face datasets Hacked together by / Copyright 2022 Ross Wightman """ import io import math from typing import Optional import torch import torch.distributed as dist from PIL import Image try: import datasets except ImportError as e: print("Please install Hugging Face data...
4a1986eee080fdffcfca27637f108c0fe06706489fe28300694e3e06e7a4580d
Python
2,609
70
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Nov 29 10:21:18 2023 @author: natalia Script to compute MIND networks Copyright (C) 2026 University of Seville Written by Natalia García San Martín (ngarcia1@us.es) This file is part of Hierarchy Longitudinal MIND Gradients Psychosis to...
ae595ece1c5d45ebc1d4801bd3985a061e884c3b5a58b65b64341d715173c623
Python
2,609
85
"""Shared parsing utilities for extracting structured JSON from LLM output. Both ``single_agent.py`` and ``multi_agent.py`` need to parse free-form LLM text into Pydantic models (``ResponseFormatter``, ``PlannerResponse``). This module centralises the common helpers so they stay in sync. """ import re from chemgraph...
164491f2e518375d6ff9c169637b633e096dee46b860ff89e9ced155a44eb9c9
Python
2,611
89
# %% # imports up top, babies import os from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter import pandas as pd import torch import torchvision from tqdm import tqdm # %% # Argle parser parser = ArgumentParser( prog='calc_alexnet_activations', description='Get PyTorch AlexNet predictions for a ...
75ec27c1a22a40564dc4845082fed5fa0c21913b461e59641d2133bf8df77448
Python
2,611
67
from typing import Set import numpy as np import torch from batchgeneratorsv2.transforms.base.basic_transform import BasicTransform class TransposeAxesTransform(BasicTransform): """ A transformation class to permute specified spatial axes of an image and related data. Attributes: allowed_axes (S...
ee01d474a2a4c437d285263c406ab05787132526b452a4e85e87e5798eafcb8f
Python
2,611
86
""" Support for "biological sequence" files. :Author: Bob Harris (rsharris@bx.psu.edu) See seq.py for more information """ import struct from . import ( fasta, nib, qdna, ) # DNA reverse complement table DNA_COMP = ( " - " " TVGH CD...
ff815fb1f748a7e332ede4b3906f12a74543c4f1d236e2fa542b5fe8da5397dc
Python
2,612
73
import torch from reducers import AvgNonZeroReducer from utils import loss_and_miner_utils as lmu from losses.base_metric_loss_function import BaseMetricLossFunction class TripletMarginMMDLoss(BaseMetricLossFunction): """ Args: margin: The desired difference between the anchor-positive distance and t...
6d537aa4a18519bfd7dfff7785ca87a7dc769165c88df2c845c886f477cdd03e
Python
2,613
61
import glob import os import argparse import numpy as np import pandas as pd import xarray as xr def main(): parser = argparse.ArgumentParser() parser.add_argument('--directory', type=str, default=os.path.join('V1Data', 'NatRev')) args = parser.parse_args() print("Running with args {}".format(vars(ar...
b2afb13845c3bda5953c1690355756d55c769460fc0e4306381c9c8196a62ec0
Python
2,613
53
from brainscore_vision.model_helpers.check_submission import check_models import functools import torch from brainscore_vision.model_helpers.activations.pytorch import PytorchWrapper from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from brainscore_core.supported_data_standards.brai...
e964b96a480f7e8936b497aa06b2148199e3c457426e7fde54832361cf2d84c8
Python
2,613
73
import os import rpy2.robjects as robjects import numpy as np import pandas as pd from sklearn import linear_model def rank_gene_dropouts(DataPath, CV_RDataPath, OutputDir): ''' Script to rank the genes in the training set of the inputfile based on their dropout level. This rank is written to a ...
715c2ac5947665ebee516fe0c910a4693e118813005aeda26645fb73c6040870
Python
2,614
63
import numpy as np import numpy.testing from brainways.pipeline.brainways_params import AffineTransform2DParams from brainways.transforms.affine_transform_2d import BrainwaysAffineTransform2D def test_affine_transform_keypoints(): params = AffineTransform2DParams(angle=0, tx=1, ty=0, sx=1, sy=1) transform = ...
d0278b1ad952d2fe0bdd010f2b52baf1c40df56b450dcd961584f4a53819403e
Python
2,614
70
# This file is part of Mooney computational modeling project. # # Mooney computational modeling project 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 3 of the License, or # (at your option) an...
3fcc9c974dcb1bca56b346f855274ff149e3b944fd81cc16c41940d4de238e34
Python
2,615
69
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import json import os import tempfile from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['bundles.zip']) tmp_dir = t...
451e597f906204e31d8dd8f0678dcff22b9fdbe734fe7a0db334f97acbb32fa4
Python
2,615
77
import matplotlib.gridspec as gridspec from src.convert_spectrum_to_colour import * # Visualise absorption spectra at different pH values for a set of 4 natural colourants colourants = ["Emodin", "Quinalizarin", "Orcein", "Biliverdin"] colourants_titles = ["Emodin", "Quinalizarin", "Alpha-hydroxyorcein", "Biliverdin"...
25cf7fddcf693fb1b68f7dfc9c39659ca4339e6e6ea604e3d0cac07081c6e3cb
Python
2,617
99
# -*- coding: utf-8 -*- # # test_simulator.py import unittest import arbor as A from .. import cases mpi_enabled = A.__config__["mpi"] """ test for MPI distribution of spike recording """ class lifN_recipe(A.recipe): def __init__(self, n_cell): A.recipe.__init__(self) self.n_cell = n_cell ...
271402858de72c822c2d9c640e8258df4d0923945d8ade2920674ad32870a9c8
Python
2,617
64
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import tempfile from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict # If they already exist, this only takes 5 seconds (check md5sum) fetch_data(get_testing_files_dict(), keys=['filtering.zip']) tmp_dir = tempfile.Te...
6baf0656fad2db6fe35e82684f149a0f328b7c0302c27534908f5fe2282c62dc
Python
2,617
75
import numpy as np from PIL import Image import os #---------------------------------------------------------# # 将图像转换成RGB图像,防止灰度图在预测时报错。 # 代码仅仅支持RGB图像的预测,所有其它类型的图像都会转化成RGB #---------------------------------------------------------# def cvtColor(image): if len(np.shape(image)) == 3 and np.shape(image)[2] == 3:...
f0fdcd1272502c990d05a1b7a20a3db63ad91bcf8227f1a478983527e528d971
Python
2,617
75
# Copyright (C) 2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from http import HTTPStatus from time import sleep from typing import Any import pytest from shared.utils.config import get_method, post_method def _post_task_remote_data(username, task_id, resources): d...
fae05835f9ecddc7d069f58e1a2c6dc907c3721710b4db1f0a73fa9765f9354b
Python
2,617
72
import torch import torch.nn as nn # from .utils import load_state_dict_from_url __all__ = ['AlexNet', 'alexnet'] # model_urls = { # 'alexnet': 'https://download.pytorch.org/models/alexnet-owt-4df8aa71.pth', # } class AlexNet(nn.Module): def __init__(self, num_classes=1000, in_chans=1): super(Ale...
8e9bcd44af07408e02bce346d3ca9bd946d95a37e2ec661ed7174dd0513b0df3
Python
2,618
70
import os from datetime import datetime class Logger(object): def __init__(self, verbose=0, log_path=None, file_prefix=""): self.verbose = verbose self.filename = None if log_path is not None: if not os.path.exists(log_path): os.makedirs(log_path) s...
f93a7d708efd41831abef39d62708eaea5a0288953fbc89605f24b0c567043d0
Python
2,618
98
import numpy as np from fancyimpute.dictionary_helpers import ( dense_matrix_from_pair_dictionary, dense_matrix_from_nested_dictionary, reverse_lookup_from_nested_dict, transpose_nested_dictionary, ) from nose.tools import eq_ def test_dense_matrix_from_nested_dictionary(): d = { "a": {"b...
839d115c439fb2e1de78bfaba94deee086ef2abee4ecbd8325c30171a896e58e
Python
2,619
77
# 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...
4ae6e2a1ec30c71911dec1b9abf9dd075ea5acc0c5e662b1baf23e79d5b40476
Python
2,620
69
import functools import importlib from brainscore_vision.model_helpers.activations.pytorch import load_preprocess_images from brainscore_vision.model_helpers.check_submission import check_models import torch.hub import ssl from brainscore_core.supported_data_standards.brainio.s3 import load_weight_file from torch.nn im...
4d8de7cf9f690ea253f6f40d2853447ed306c331d331e79ecafa3a7bb0c374dd
Python
2,620
67
import torch from torch_geometric.nn import MessagePassing from torch_geometric.nn import global_add_pool, global_mean_pool, global_max_pool, GlobalAttention, Set2Set import torch.nn.functional as F from torch_geometric.nn.inits import uniform from conv import GNN_node, GNN_node_Virtualnode from torch_scatter import ...
7e8e6d66c9bc3672bb09bee608ea2981a8d09ddfedd3272971425240b8e34317
Python
2,620
93
""" Calculate the compression """ import os import sys from pathlib import Path from tqdm import tqdm import numpy as np import pandas as pd import torch from neuralcompress_v3.models import BiModel from enuralcompress_v3.utils import load_tpc_wedges # uncomment if multiple GPU is available # and you want to use an ...
a6f55a2bf78d854a94ce49b09d229d6d8b41e7ca95fbae2affb3cd0a6b732d58
Python
2,620
67
import torch from torch_geometric.nn import MessagePassing from torch_geometric.nn import global_add_pool, global_mean_pool, global_max_pool, GlobalAttention, Set2Set import torch.nn.functional as F from torch_geometric.nn.inits import uniform from conv import GNN_node, GNN_node_Virtualnode from torch_scatter import ...