sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
ab8be39baf562eb7662aa9f4defff0ad4cc32bf9b622ccb1d6fbc744e9e5db86
Python
2,517
89
#!/usr/bin/env python3 import sys import os import signal from optparse import OptionParser USAGE = """ extract-from-bam.py --in <BAM file> --rg <read group ID extract, leave blank if all > --reference <reference fasta file, needed for CRAM support> """ par...
e814a31997164012c6d9081bb484793853714a1fda6fcc5bf5d7123b1d1016e4
Python
2,518
69
import drop from drop.config.DropConfig import DropConfig import subprocess from pathlib import Path from snakemake.logging import logger def setupPaths(projectRoot): # repository paths repoRoot = Path(drop.__file__).parent repoPaths = { "template": repoRoot / "template", "Scripts": repoRo...
0bfbbe6aa7e0d30be43bf6a09fe1577eb8157fec155d1da0105177203bdfe2fa
Python
2,519
80
import numpy as np import matplotlib.pyplot as plt import librosa import librosa.display import tkinter as tk from tkinter import filedialog def plot_audio_analysis(wav_file): # Load the audio file y, sr = librosa.load(wav_file, sr=None, mono=False) print(f"Sample Rate: {sr}") # If stereo, process eac...
9c8044d0c9f71785651e5c83f02d45f70287314424d3e74ed15ec9dc5a1c01db
Python
2,519
48
from brainscore_vision import data_registry, stimulus_set_registry, load_stimulus_set from brainscore_core.supported_data_standards.brainio.s3 import load_stimulus_set_from_s3, load_assembly_from_s3 from brainscore_core.supported_data_standards.brainio.assemblies import NeuroidAssembly BIBTEX = """@article{hebart_thin...
23423f494aaf734ceb987d4b0a20db6a4a2f98c6957ac44cc40dd5dafe3648a2
Python
2,520
89
import unittest from ogo.cli.CreateDatasetJSON import ( printFiles, getOnlyNIFTI, getSortedFileList, appendSubdirectory, CreateDatasetJSON ) class Test_PrintFiles(unittest.TestCase): def setUp(self) -> None: """ Use this method to prep data or files for other tests, if necessary. """...
7900a58d57e07143949d820fc2966cc7a12dfa9cf2d5a91b044812ab9ae85198
Python
2,520
80
import numpy as np import pandas as pd from typing import Union, Callable from types import SimpleNamespace import re def read(f_in: str, index_by: int = 0, properties: Union[list, None] = None, terms: Union[list, None] = None) -> SimpleNamespace: ''' ''' # helper function for legalisation of labels ...
e40b70cd26b42286ee92a4b250f07243f6373aa4b79ac9835830b94184b5fc01
Python
2,520
83
""" Preprocess raw audio files into mel-spectrograms. Usage: python scripts/preprocess_audio.py \ --input_dir data/raw_audio/ \ --output_dir data/audio/ \ --n_workers 8 """ import argparse import sys from concurrent.futures import ProcessPoolExecutor, as_completed from pathlib import Path ...
28cdec941aaf78fc46b6a486425ae310a4b32e90356e2365995012610f37e8b0
Python
2,521
75
from typing import Union, List, Dict class DeviceInfo: def __init__(self, name: str, pretty_name: str, default: bool = False, availability_func: callable = lambda: True): self.name = name self.pretty_name = pretty_name sel...
5ce90b3757c048434a3f97b5911a589f9b270d33a4bbaf543cf29cc84727d10d
Python
2,521
77
# Copyright (c) Meta Platforms, Inc. and affiliates. All Rights Reserved from collections import defaultdict from dataclasses import fields, is_dataclass from typing import Any, Mapping, Protocol, runtime_checkable import torch def _is_named_tuple(x) -> bool: return isinstance(x, tuple) and hasattr(x, "_asdict"...
8d71475f8868d9ee2fa4494662c3e4a0d3ab36b0cec1b28b9fc1b95bb44f5301
Python
2,522
58
from nipype.interfaces.fsl import Reorient2Std from PUMI.engine import BidsPipeline, NestedNode as Node from PUMI.pipelines.anat.anat_proc import anat_proc from PUMI.pipelines.func.compcor import anat_noise_roi, compcor from PUMI.pipelines.anat.func_to_anat import func2anat import os from PUMI.pipelines.func.func_pro...
ff0a26bdaf646052ad36784f4724789308161a17c7105e5e712f39cacda350e2
Python
2,522
98
#!/usr/bin/env python3 from pathlib import Path import numpy as np QSIPREP_ROOT = Path("/mnt/f/BIDS/WCH_AF_Project/derivatives/qsiprep") FLIP_AXIS = 1 # y axis SUFFIX_OUT = "_flipped" OVERWRITE = False TARGET_STR = "-0.00000000" # strict trigger condition def load_bvec_as_3xn(bvec_path: Path) -> np.ndarray: ...
3aa801432fe6e5140bc0ae3c925b0faf341ce4cdf67fa6c79ba33280b7546d05
Python
2,523
82
# vessap open graph benchmark dataset import os from ogb.io import DatasetSaver from ogb.linkproppred import LinkPropPredDataset # step 1 # Create a constructor of DatasetSaver. dataset_name needs to follow OGB convention # and start from either ogbn-, ogbl-, or ogbg-. is_hetero is True for heterogeneous graphs, #...
b0d5fdb0212359bf4a2116f297a84d8c3c713197e846f34cef0f87c37ad7ca38
Python
2,523
67
# Copyright (c) DP Technology. # 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 logging import torch import torch.nn as nn from torch.nn.parallel import DistributedDataParallel from ...
c3e384d74ef99dee1f619e4cec1e70e3ba377fea7d84fd7f6b9868c2557c9b5b
Python
2,524
67
# Copyright (c) DP Technology. # 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 math import torch import torch.nn.functional as F from unicore import metrics from unicore.losses import ...
b13697121d442bf1c8ceb19e154ace40e15604757224d9c7378d64cca78216bb
Python
2,525
91
import math import numexpr from langchain_core.tools import tool from langgraph.types import interrupt @tool def calculator(expression: str) -> str: """Evaluate mathematical expressions safely. This function provides a safe way to evaluate mathematical expressions using numexpr. It supports basic mathem...
bfe3d304dd6362d02b6356a08994fb77a72879aa28d2b3a2d7f6b5b055562b61
Python
2,525
70
import matplotlib.pyplot as plt import matplotlib import numpy as np from pathlib import Path performance_array = np.load(Path.cwd() / "data"/ "model_performance_array.npy") # fft fft_array = np.zeros((performance_array.shape[0], 9)) thres_array = np.zeros((performance_array.shape[0], 9)) for ith_folder in list(rang...
d6c66adc08facecac4274b16cbe7609e2ba2110a28bfb762edab615799f4651f
Python
2,525
63
import os import subprocess import shutil import nibabel as nib import time import numpy as np import pandas as pd from nipype import Node, Workflow from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, TraitedSpec, File, Directory, traits, CommandLineInputSpec, File, TraitedSpec, CommandLine, Direc...
df82bca3667b23064bcb9bba20b1b7507539254dd26cf6cfe7fc28b6fe3fb42e
Python
2,525
74
""" Description: CLI for sequence prediction using the Sei deep learning model, given an input FASTA or BED file. Outputs Sei chromatin profile predictions. Usage: 1_sequence_prediction.py <seq-input> <output-dir> [--genome=<hg>] [--cuda] 1_sequence_prediction.py -h | --help Options: -h --help...
4628972a20b0fcf7b013d964ae7a1ee4345774a696384d578ce830e3620cc8f4
Python
2,528
67
# -*- coding: utf-8 -*- """ Created on Sat Aug 31 22:23:35 2019 @author: czz """ from gluoncv import model_zoo, data, utils #from matplotlib import pyplot as plt import mxnet as mx import cv2 import argparse def parse_args(): parser = argparse.ArgumentParser(description='Train YOLO networks with ra...
4de868f3ebbe9b66cf85fe3c2bc515747cd94c01f9294da3f0d7bf9518156224
Python
2,528
76
import torch import torch.nn as nn from torch import Tensor from monai import transforms as mo_trans from model.base_model import LocalAttention, MLP from model.transformer3D import ViT3D from utils.datasets import get_transform class BrainAgeEstimator(nn.Module): def __init__(self, args, device, chan...
2ec2cae5499c78e78654bee25a612597005537520317107d50912afac1806014
Python
2,529
74
import numpy as np from scipy.ndimage import convolve1d # TODO - incorporate other filters? # From supplement doc: "apply a range of standard filters to data (smoothing, high-pass, etc)" def smooth(x,window_len=11,window='hanning', axis=-1): """Smooth data using a window with requested size. This method is b...
7f723cefa61de03ae5ac0b5d66c1232b1d4afb95be62e694ead1d44ee6afd1c5
Python
2,531
87
"""ntac package initialization.""" import numpy as np from .visualizer import Visualizer from .data import download_flywire_data from scipy.sparse import csr_array from .graph_data import GraphData, FAFBData from .seeded import Ntac def sbm(n, k, p_in_range=(0.1, 0.9), p_out_range=(0.1, 0.9), seed=None): """ ...
d455e042a4cc032fa371ae37a305713958bf3077a98060caeee2926f1e38871a
Python
2,531
66
import user_features as ufis_verified(user): import csv import ijson import pandas as pd import time def get_user_vector(user): user_vector = { "user_id": uf.get_user_id(user), "profile_description": uf.has_description(user), "profile_location": uf.has_location(user), "profile_url"...
e45d9de56b1c7e69693911144c33f03a9af5cf0d57387fe04ce6dd95beb6d088
Python
2,532
66
import glob import os import scipy from nilearn.image import load_img, new_img_like, smooth_img from nilearn.plotting import view_img, view_img_on_surf from nilearn.glm.thresholding import threshold_stats_img import numpy as np import pandas as pd import fire from nilearn.glm.second_level import SecondLevelModel b...
16e197d795229d9855bd4988c270c66c616c8dc2321142e20e485ad2853fe611
Python
2,533
58
import mne import pandas as pd import numpy as np import matplotlib.pyplot as plt from mne_bids import BIDSPath shapes = ['rectangle', 'square', 'isoTrapezoid', 'parallelogram', 'losange', 'kite', 'rightKite', 'rustedHinge', 'hinge', 'trapezoid', 'random'] theory_df = pd.read_csv("./symbolic_model_simple_ref.csv") cp...
aea4c4d3a7c3338854a55def5994376435568a28b392d8b158c30b8a2e5ccb0e
Python
2,533
69
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Compress tractogram by removing collinear (or almost) points. The compression threshold represents the maximum distance (in mm) to the original position of the point. """ import argparse import logging import nibabel as nib from nibabel.streamlines import LazyTracto...
1c08063153c2de247490db52d3a95f6ea018568a9ddbe67f3699cfd1c4d266bb
Python
2,534
91
"""LangChain ``@tool`` wrappers for cheminformatics functions. Each tool delegates to the pure-Python implementation in :mod:`chemgraph.tools.cheminformatics_core`. """ from __future__ import annotations from typing import Literal from langchain_core.tools import tool from chemgraph.schemas.atomsdata import AtomsD...
9637234601056edf123aba3a5d85ae10c81c5c1c325677d2217406a0a755034b
Python
2,534
59
import torch from dgd import utils class ExtraMolecularFeatures: def __init__(self, dataset_infos): self.charge = ChargeFeature(remove_h=dataset_infos.remove_h, valencies=dataset_infos.valencies) self.valency = ValencyFeature() self.weight = WeightFeature(max_weight=dataset_infos.max_weigh...
08c07da38b2fe553502b848c2f7ecf76fc3b671ac30a1a99a3c738ed4d488597
Python
2,535
73
# 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...
2b8c9ef7b9c037b9d18895d34ff9dd19e596790f0ae7ce7e0e2370694aa75d6b
Python
2,535
79
import torch from torch.autograd import grad from knn_cuda import KNN import torchsort def gradient(inputs, outputs, create_graph=True, retain_graph=True): d_points = torch.ones_like(outputs, requires_grad=False, device=outputs.device) points_grad = grad( outputs=outputs, inputs=inputs, ...
26c67e8695ed654057c3e8de5c0742df1e844ac016572e9920efb46ff560b349
Python
2,536
102
"""Example script for training Single-Channel DyNeMo on simulated data. This script should achieve a dice coefficient of ~0.8. """ print("Importing packages") import numpy as np from osl_dynamics.data import Data from osl_dynamics.inference import modes, metrics from osl_dynamics.simulation import HMM from osl_dynam...
c9773b300e201fcec80d30e1264b4537ecae886a35c6ccccbf74561b8b629c9d
Python
2,536
92
import os from pymol import cmd import numpy as np one_letter = { 'VAL':'V', 'ILE':'I', 'LEU':'L', 'GLU':'E', 'GLN':'Q', 'ASP':'D', 'ASN':'N', 'HIS':'H', 'TRP':'W', 'PHE':'F', 'TYR':'Y', 'ARG':'R', 'LYS':'K', 'SER':'S', 'THR':'T', 'MET':'M', 'ALA':'A', 'GLY':'G', 'PRO':'P', 'CYS':'C' } def read_pdb( ...
38c95e1f53d6b257825bc210757764531deec77bc3844cca587c65fd61cbc9c5
Python
2,537
77
import unittest import logging import numpy as np import pandas as pd from batchglm.api.models.numpy.glm_nb import Simulator import diffxpy.api as de class TestExtremeValues(unittest.TestCase): def test_t_test_zero_variance(self): """ Test if T-test works if it is given genes with zero variance...
58d550cc9b768bdb89116319d626e9ee60a8dbd09fb0e1fc04ba200cba187f13
Python
2,537
74
from brainvoice.configuration.configuration import Configuration import numpy as np import os import torch from torchsummary import summary import argparse import shutil def init_from_config(device, experiment_subdir, experiment_name): experiment_name = f'experiments/{experiment_subdir}/{experiment_name}' e...
9bff4a3d30613c144b7bb2e5d5447abb8c19d95950038d3186b3c5f7a9c4c8bb
Python
2,537
54
import numpy as np import xarray from marques_utils import gen_sample from brainscore_core.supported_data_standards.brainio.packaging import package_data_assembly from brainscore_core.supported_data_standards.brainio.assemblies import DataAssembly ASSEMBLY_NAME = 'devalois.DeValois1982b' SPATIAL_FREQUENCY_STIM_NAME =...
779f764e9fda04f4a67fdda4b29cac5d9db48574cb23bf2261b9b950fbbb204f
Python
2,538
88
# -*- coding: utf-8 -*- import numpy as np import vtk import nibabel as nib from nibabel.freesurfer.io import read_geometry def convert_freesurfer_into_polydata(surface_to_polydata, reference): """ Convert a freesurfer surface into a polydata surface with vtk. Parameters ---------- surface_to_vt...
07bd5ac0ced8101c70cbe0535be16179234b6732897e01b941e520facded7e63
Python
2,539
75
import torch import torch.nn as nn import torch.nn.functional as F class DihedralFeatures(nn.Module): def __init__(self, node_embed_dim): """ Embed dihedral angle features. """ super(DihedralFeatures, self).__init__() # 3 dihedral angles; sin and cos of each angle node_in = 6 ...
99ffc9b4712de2e7e690041f2a2d565d7f2e5b5ab23c44b3681e290d0999a97c
Python
2,539
83
from PUMI.engine import FuncPipeline, QcPipeline, NestedNode as Node from PUMI.pipelines.func.info.get_info import get_repetition_time from nipype.interfaces import afni, utility from PUMI.pipelines.multimodal.image_manipulation import timecourse2png @QcPipeline(inputspec_fields=['in_file'], outputspec_fi...
dad7ed61f89036b2cad0d3165fcc2cf08cb91a8aa460c6dfea172c74910c44a8
Python
2,539
87
#!/usr/bin/env python import os import sys sys.path.append('.') import click as ck import numpy as np import pandas as pd import gzip import logging from deepgo.utils import NAMESPACES, Ontology from collections import Counter import json import os import math import torch as th from deepgo.models import DeepGOModel ...
f69eca08b047e4b84d22152299905ee418a7d7ebf683c890622e09481d0808ec
Python
2,539
95
import argparse import matplotlib.pyplot as plt import numpy as np import pandas as pd def evaluate_predictions( labels_path: str, predictions_path: str, visualize: bool = False, destination: str | None = None, ): labels = pd.read_csv(labels_path) predictions = pd.read_csv(predictions_path) ...
5108146ac58130650e1cecfd915788616270dab603c9e0419d971a16ce4e2119
Python
2,540
80
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Merge a list of Spherical Harmonics files. This merges the coefficients of multiple Spherical Harmonics files by taking, for each coefficient, the one with the largest magnitude. Can be used to merge fODFs computed from different shells into 1, while conserving the m...
5e91ebcd89776cbb4a60a53b8ebb16d886a616a3d6e20c1f738abe0e213456a6
Python
2,540
78
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Modify PFT maps to allow PFT tracking in given mask (e.g edema). """ import argparse import logging import nibabel as nib import numpy as np from scilpy.io.image import get_data_as_mask from scilpy.io.utils import (add_overwrite_arg, add_verbose_arg, ...
b5f8e226fb0bf110a297ed0c7a484eb604b6395f0cfadf8e40a01ee15da4ef4c
Python
2,540
73
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from contextlib import suppress import django_rq from django.conf import settings from rq.exceptions import NoSuchJobError from rq.job import Job from cvat.apps.engine.log import ServerLogManager from cvat.apps.engine.utils import get_rq_lock_for_j...
1aeb24f022f63bf59d47677f09cea892cc6581bc2c3610338abb9f83e17fc421
Python
2,541
62
import json import pandas as pd import torch from torch.utils.data import Dataset import random class SATARDataset(Dataset): def __init__(self, dataset_name, split, data, padding_value, max_tweet_count=128, max_tweet_length=64, max_words=1024, random_seed=20220401): rando...
31f9c7e3ddebca2156e57da6e96c650484760e652f9188d96ce9c7030b1285a8
Python
2,542
71
############################################################################# # Copyright (C) 2020-2026 MEmilio # # Authors: Henrik Zunker, Maximilian Betz # # Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complia...
0d03addfb44bad6c83508ed5bd5c7b4b11309e33e6538a22b30e535bae4d16bd
Python
2,543
91
from __future__ import annotations from ._core import data as _data # expose internal functions as API from ._core.data import ( crop, stitch, normalize, show ) def load(filepath: str) -> numpy.ndarray: """ Load data from a file into a NumPy array using a format-specific loader. The func...
2be508a2b746f3d698efad91c04aadbb0e0c4630afa655d78f307149ac474d13
Python
2,543
79
from typing import Union, List, Dict class ModeInfo: def __init__(self, name: str, pretty_name: str, folds: List[Union[int, str]], model_plans: List[str], model_config: str, suffixes: Dict[str, str], ...
431660115684457bcf950d1ed0769b956ca1a02bc139cde08a1cbe5187f8a8ce
Python
2,543
53
from pathlib import Path import numpy as np import xarray as xr from brainscore_core.supported_data_standards.brainio.assemblies import BehavioralAssembly from brainscore_core.supported_data_standards.brainio.packaging import package_data_assembly import pandas as pd DATASETS = ['inlab-instructions', 'inlab-no-instr...
4cbc6592e5e7c73be1ee92d68666c63344288856c0f12c46b65eb4e4647b83f3
Python
2,543
80
# -*- coding: utf-8 -*- """ Created on Thu Jan 19 12:23:50 2023 @author: gligorov """ import matplotlib.pyplot as plt import seaborn as sns import numpy as np def perform_PCA(matrices, n_components): """ Perform PCA on the dataset and return feature importance """ #Extract rows from all ...
689bef671a2930fc7296ce31586dfd0d08617d3257aa1466e2108001b35f9956
Python
2,543
82
#!/usr/bin/env python # coding: utf-8 import argparse import pandas as pd from math import ceil # Use BioPython - yes even though we can just write it out using normal fwrite. # Just so it's more conforming to standards. from Bio.SeqRecord import SeqRecord from Bio.Seq import Seq from Bio import SeqIO def split_re...
a404c67875a7c9f53e5e8059a155257a5d3af5f0dbe687ea19085584f74902e4
Python
2,546
80
from __future__ import absolute_import from .resnet import * from .resnet_ibn import * #from .vision_transformer import * #RWM added from .ensemble_resnet import * #RWM added from .xception import * #RWM added from .xxception import * from .hexception import * from .sam import * from .unet2 import * #change betwe...
0383c54b940da40d3a27f41a1cf0f4b95fc062e9f9c2464ecf1202228db8ff21
Python
2,547
74
import os from pathlib import Path import traceback import sys import socket from flask import Flask from flask import send_from_directory from flask_cors import CORS import dtiplayground import dtiplayground.dmri.common as common from dtiplayground.config import INFO as info logger=dtiplayground.dmri.common.logg...
11690748257bfba9dd83a3044d420535894d760c8b9c2b1fa4cf3cd7a9593f7e
Python
2,547
79
import torch.utils.data as data_utils from PIL import Image import numpy as np import random import glob import os from Utils import utils utils.seed_torch(seed=0) Map = { 'NETU': 1, 'ELSE': 0 } class ZSData(data_utils.Dataset): def __init__(self, path, transforms=None, padding=0, bi=True): ...
3663271279f051541641f2d9271c3836ac83fb4e42d13dedaf8be7c514c0d055
Python
2,547
80
import os import sys import numpy as np import difflib import time from typing import List, Dict # Add project root to path sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from src.llm_orchestrator.self_correcting_agent import SelfCorrectingAgent def calculate_similarity(code1: str, code...
578b749b67919e34fc627ce4f9ad5f9f4d5169783553e2a2bd4dab3f0682a80b
Python
2,547
70
"""Tests for the pure fitting helpers in measure_thickness (no pycurv/graph-tool).""" import numpy as np from surface_morphometrics import measure_thickness as mt def test_find_mins_locates_left_and_right_minima(): x = np.linspace(-10, 10, 41) # two wells: minima near -5 and +5 y = -np.exp(-(x + 5) ** 2)...
6c6583c7179700a8ef9eb6cbbf1ff125ad8bddacdc403826f4c021e201f4a155
Python
2,547
79
# 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. """Tests scripts.create_new_detector for creating...
c451f5d0958f8c06dd17a76a0f7bb095a0ec5bf0df2db9455b0b3a48111f99ea
Python
2,548
69
from nab.detectors.base import AnomalyDetector import numpy as np import math class KnncadDetector(AnomalyDetector): def __init__(self, *args, **kwargs): super(KnncadDetector, self).__init__(*args, **kwargs) self.buf = [] self.training = [] self.calibration = [] self.scor...
35a3418cfc96418c24c41197219d632d36f65c3f585ead725efff17ab055409d
Python
2,549
78
import brainpy as bp import brainpy.math as bm import numpy as np import matplotlib.pyplot as plt from cann import CANN1D #set default ramndom seed for reproducibility np.random.seed(0) #set backend to cpu bm.set_platform('cpu') #create and run the network cann = CANN1D(num=256, mbar=0, tau=3, tau_v=144) v_ext = cann....
61d3adb950413c5022888a4142083c74577b9645c552fc6ef024f9c49cd45f73
Python
2,549
92
import os import numpy as np import pandas as pd from impedancefitter.RC import RC_model from impedancefitter.readin import ( readin_Data_from_collection, readin_Data_from_csv_E4980AL, readin_Data_from_dataframe, readin_Data_from_TXT_file, ) f = np.logspace(1, 8, num=20) omega = 2.0 * np.pi * f R = 1...
d7f4dd5b0ae9f5b1fe24cfb8b36ec9bf3076a8fd3ac79f4c7f2a78a54bb9ed70
Python
2,549
91
import numpy as np import scipy as sp def Z_ECIS_Lo_Ferrier(omega, aecis, Lecis, Wecis, Rb, Cm, Rm, Zn=None): r"""ECIS impedance model as described in Lo and Ferrier, 1998. Parameters ---------- omega: :class:`numpy.ndarray`, double list of frequencies aecis: double :math:`alpha` ...
1ab6659e1965bb8374666984797475b3c51a65ec551f1022254dbc3357a84098
Python
2,552
86
# Copyright (c) OpenMMLab. All rights reserved. import argparse import time import torch from mmcv import Config from mmcv.parallel import MMDataParallel from mmcv.runner import load_checkpoint, wrap_fp16_model from depth.datasets import build_dataloader, build_dataset from depth.models import build_depther def par...
1ec0c9d53489748be7aa7e6584e1aef94d2ab804653230b48ea3feaae22c9250
Python
2,552
104
import sys sys.path.insert(0, '../opt_linear/') import numpy as np import tensorflow as tf from read_data import read_data from multistart_optimizer import multistart_optimization_parallel L2_B97 = 0.00 TESTSETS = { "ACONF": 0.309569196, "ADIM6": 0.06744186, "AHB21": 0.035265286, "AL2X6": 0.0063156...
51481b2d4ae44f75f8fd0046b1b41db86a4aac24804c3edfc58151f85e9f7fdb
Python
2,552
69
import numpy as np import matplotlib.pyplot as plt from pathlib import Path from scipy.io import loadmat from scipy.interpolate import interp1d plt.rcParams["font.family"] = "Noto Sans" plt.rcParams["font.size"] = 6.6 # Find prev dataset if exist TANK_PARENT_PATH = Path('D:\Data\Lobster\Lobster_Recording-200319-161008\...
9ccefe3ba40d18382b67cc575ac615919689c09d9694b1da1fa95e75a279ffa0
Python
2,552
68
import numpy as np import nibabel as nib import os import sys src_dir = os.path.dirname(os.path.abspath(__file__)) metab = sys.argv[1] # one of 'glu', 'gaba', 'glu_gaba' n_jobs = int(sys.argv[2]) if len(sys.argv) > 2 else 5 # Base derivatives directory; set DERIV_ROOT to anonymize local paths. DERIV_ROOT = os.envi...
e8979d0398c1d784026d9ed0f83dd5bc658a2a25997b49c089ae79f9379aa3e2
Python
2,552
86
import subprocess import sys import yaml import os from glob import glob import pandas as pd import numpy as np print ('Hey psth!') pathpath = 'PATHS/general_paths.yml' with open(pathpath,'r') as f: pdict = yaml.safe_load(f) genpath = pdict['metricsextraction'] script = 'metrics_extraction/response/extract_psth.py'...
12a3776d3c95ff0a2dd6b48d8551d5937aa737b2105279b25d963c2d961475cc
Python
2,553
63
import sys import importlib import pandas as pd import torch.nn as nn import torch.nn.functional as F import numpy as np from tqdm import tqdm import itertools import train_it_mnist as ted importlib.reload(ted) if __name__ == '__main__': device = 'cpu' difficulities = ['easy', 'difficult'] sats = ['accura...
22af8aa5f7957988eb404edd3f13ca85f2842bcf73eff1240ae16f2532574384
Python
2,554
75
from collections.abc import Callable, Sequence from functools import partial from typing import Union from eir.experiment_io.input_object_io import load_serialized_input_object from eir.predict_modules.predict_tabular_input_setup import ( setup_tabular_input_for_testing, ) from eir.setup import input_setup, schema...
d6eb62f193f82de5d41677650ea318a0993e925808995241bd3fe96cb63ed137
Python
2,554
76
#!/usr/bin/python # ## @file # # Active X based APT piezo & strain gauge control. # # Ke 12/09 # from PyQt5 import QtCore, QtGui, QAxContainer import sys import time class APTPiezo(QAxContainer.QAxWidget): def __init__(self, parent = None): QAxContainer.QAxWidget.__init__(self, parent) self.setC...
afd0fe18dd58d61f5cf58cd90950e079cd9241febf4a2e0262cfc5199c671b07
Python
2,555
62
""" DirectoryContext: Separates input (read) and output (write) directories. Allows MuscleX to read images from one directory and write all outputs (caches, results, settings, logs) to a different directory. When both paths are the same the behaviour is identical to the legacy co-located layout. Copyright 1999 Illin...
0f85ff5005b32641b1861c548ad801f307cc67ec1a7da9f51b0f1fc13f624da0
Python
2,556
79
import pandas as pd import numpy as np import matplotlib.pyplot as plt import sys def load_pvalues(file_path): """ Load p-values from the gene-based results file. """ df = pd.read_csv(file_path, sep='\t') pvalues = pd.to_numeric(df['pvalue'], errors='coerce').dropna() # pvalues = df['pvalue']...
3dd5b5eb2232bdc99b39ad3b28655e61f54c51457a86d74208b80e9821eee8b9
Python
2,556
72
""" This module is an example of a barebones numpy reader plugin for napari. It implements the Reader specification, but your plugin may choose to implement multiple readers or even other plugin contributions. see: https://napari.org/stable/plugins/guides.html?#readers """ import numpy as np def napari_get...
5747774ebd1ac85f3eb62923b17ae7ed9f8b7bd8ae428f9a2d00b17374ffe229
Python
2,556
138
import numpy as np from impedancefitter.elements import ( Z_C, Z_CPE, Z_L, Z_R, Z_stray, Z_w, Z_wo, Z_ws, parallel, ) omega = 2.0 * np.pi * np.logspace(1, 8, num=20) R = 100 alpha = 0.5 def test_Z_R_type(): """Test return type.""" Z = Z_R(omega, R) assert isinstance(...
a9bc37932e38f99f210d474654530fbaa114b5657fb8945dbc3f4cd7922bd26c
Python
2,556
59
""" Concatenate sets of intervals. Preserves format of the first input -- it is possible to concat two files that have different column orders. Of course, the meta-data of the second will be lost (and filled with a "."). If all of the files (GenomicInteralReaders) are the same format, sameformat=True will preserve all...
f0fa79142eecd4b31d6ef43da11cc3fe0db4990b234d20eb60f1dd14ae6ad86c
Python
2,556
72
from brainvoice.configuration.configuration_instantiator import construct_from_kwargs from brainvoice.modules.weight_init import apply_weight_init import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable class VAEAutoencoder(nn.Module): def __init__(self, encoder, bottleneck, ...
2406968f8b70dd9618dc2407b2aaef3b5f38763a316a9f0ad77575c68c3fe312
Python
2,557
61
import os import numpy as np import torch import time from tqdm import tqdm import argparse from Feature import getData from RNArankmodel import RNAranknet1, RNAranknet2 def RNArankpredict(args): device = torch.device('cpu') torch.set_num_threads(4) os.makedirs(args.output_dir, exist_ok=True) model_cl...
402ec14be456a1172c68e994fad8c7dc459414e3a9ddf0f218f8020629b70f79
Python
2,557
59
# Copyright (c) 2026 Rohit Jena. All rights reserved. # # This file is part of FireANTs, distributed under the terms of # the FireANTs License version 1.0. A copy of the license can be found # in the LICENSE file at the root of this repository. # # IMPORTANT: This code is part of FireANTs and its use, reproduction, or...
45cb8f8ccdb34106e8edbdde6992cefc239e1f91d5cae1dbd34160dddb628634
Python
2,557
72
#!/usr/bin/env python """ Class for storage of a single frame of camera data or the data from a feed and it's meta-information. Notes: (1) The numpy data field (np_data) is expected to be of type numpy.uint16. Hazen 3/17 """ class Frame(object): """ Class for the storage of a single fra...
5eb4146bf0abfb72f3fcde51f81114835483fbdcaeb19cc29673c81694af494d
Python
2,557
63
#!/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=['processing.zip']) tmp_dir = tempfile.T...
dbe667f7c5694404427ccb49fe0ce8c54f38e8326b6af96f02dcde2ae14d4228
Python
2,557
75
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT """Batch-advance completed jobs to the next workflow stage Find every job whose state is 'completed' at --from-stage, move each one to the next stage, and print the list of modified jobs. Optionally restrict the sweep to a single task with --task-id...
dda49f5c24b85a34f2672a053534fd5c0a2d2fdac7fadcfd0dfac75339b00b06
Python
2,557
68
""" Complement a set of intervals. """ from bx.bitset import MAX from bx.intervals.io import ( BitsetSafeReaderWrapper, GenomicInterval, ) from bx.intervals.operations import bits_set_in_range def complement(reader, lens): # Handle any ValueError, IndexError and OverflowError exceptions that may be throw...
1ff04a24bd75389b7880eccdc0feea62a31a8536bbbc753d0840201a2162818c
Python
2,558
74
# -*- coding: utf-8 -*- """ Created on Wed Dec 4 21:12:47 2019 @author: Yoshi """ import os import shutil import numpy as np import matplotlib.pyplot as plt def sum_grapher(path,data,framerate,key,frequencies,decibels): # Creates and changes to output directory graph_output_path = path + "/Output/Deb...
484568cfdc297d6b14a954ed28041dff814f8929e4f4136303bf0ca48d590397
Python
2,560
67
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...
56981cb9f7a50d08be7a6e0c3f362c4bb50295a83618d834a66377eb14b6701e
Python
2,560
68
import os import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.colors as mcolors #for multicollinearity feature importance from scipy.cluster import hierarchy from scipy.spatial.distance import squareform from scipy.stats import spearmanr def plot_dendrogram(df): fig, (ax1, ax2)...
8968425392373a2287e48aeb9dbf54b2cada081c95a105889cf65f585f785df4
Python
2,560
64
import os import sys import argparse import options from model import * from model.get_location import * from model.neighbor_graph import * parser = argparse.ArgumentParser() parser.add_argument("--dataset", type=str, default='murine_cellline', help='The name of benchmarking datasets') args = parser.parse_args() def ...
b9eb9ed0481dc9aaa0931e3c48650f351331bd62f32e13798ff2cc94534ee192
Python
2,560
82
# vessap open graph benchmark dataset import os from ogb.io import DatasetSaver from ogb.linkproppred import LinkPropPredDataset # step 1 # Create a constructor of DatasetSaver. dataset_name needs to follow OGB convention # and start from either ogbn-, ogbl-, or ogbg-. is_hetero is True for heterogeneous graphs, #...
13502091d6fe302d4e1e575ecc5b8970ca1f33aa65547c57f8977ce78d8c629d
Python
2,561
101
"""Example code for making plots. """ import numpy as np from osl_dynamics import simulation from osl_dynamics.utils import plotting #%% Basic plots # Line plot x = np.arange(100) y1 = np.random.normal(size=100) y2 = np.random.normal(size=100) plotting.plot_line([x], [y1], filename="line.png") # Plot a figure wi...
7c7a32d97a6fb943ca12cc9a34f6bded7cd87548761830f588d0cf85b0e77a53
Python
2,562
73
from numpy.random import seed seed(42) import tensorflow as tf tf.random.set_seed = 42 import random random.seed(42) import numpy as np np.random.seed(42) import pandas as pd import tensorflow as tf import SimpleITK as sitk from tensorflow.keras.utils import to_categorical import sys from tensorflow.keras....
47babfbd4fb1504e5871d95e31fe207203f1c23105781039d63ba3a6ccbdc74f
Python
2,563
75
# -*- coding: utf-8 -*- from distutils.core import setup LONGDOC = """ jieba ===== “结巴”中文分词:做最好的 Python 中文分词组件 "Jieba" (Chinese for "to stutter") Chinese text segmentation: built to be the best Python Chinese word segmentation module. 完整文档见 ``README.md`` GitHub: https://github.com/fxsjy/jieba 特点 ==== - 支持三种分词模式:...
45ed6f46ade8989297f815e8eee41edb73d274a0c8a39561f96840fcbc6802bf
Python
2,564
81
"""Step 1: Preprocessing.""" from pathlib import Path import mne import matplotlib matplotlib.use("Agg") from osl_dynamics.meeg import parallel, preproc # ---------------------------------------------------------------------------- input_dir = Path("BIDS") output_dir = Path("derivatives") plots_dir = Path("plots") lo...
a01c026d32d56c697c176bed4328819db2dedcb94c86cb93add804484aa6486b
Python
2,566
75
""" =============================================================================== File Name : predictor.py Author : Alex Bui Created : 2024-11-13 Description : Include prediction heads =============================================================================== """ import sys sys.path.append('..') from ...
fc60a9496917bf5d633d1f29b7843cc75b19bb7f2be92e79aa8686c6d4b82607
Python
2,566
79
# 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]uni-rostock.de # # This program is ...
40a111d323145d55d254651b7b7ca9d87c709634cb721466c96ea92f1ed56b66
Python
2,567
70
# Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT from http import HTTPStatus from typing import Any import pytest from shared.utils.config import get_method, make_api_client, put_method @pytest.mark.usefixtures("restore_db_per_class") class TestGetServer: def test_can_retrieve_about_unauth...
62566b663e8f4fee91c13d5565d285cfa911533e3a85d4207c18da736c6773fa
Python
2,567
67
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from pathlib import Path import torch from ultralytics.utils import ARM64, IS_JETSON, LOGGER, YAML def torch2paddle( model: torch.nn.Module, im: torch.Tensor, output_dir: Path | str, metadata: di...
9067df376f50a434545d5d8fbb6dd8145f1d3a02f155728c7ece90c6e2e472a8
Python
2,567
69
# Copyright (C) 2020-2022 Intel Corporation # Copyright (C) CVAT.ai Corporation # # SPDX-License-Identifier: MIT import os import os.path as osp import shutil from glob import glob from datumaro.components.dataset import Dataset from cvat.apps.dataset_manager.bindings import ( GetCVATDataExtractor, detect_da...
d4ed3cbfaf44e66dadaffbfb16c7e9f8f28747be380f94291fffb5d24e459e40
Python
2,567
101
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import sys from pathlib import Path HERE = Path(__file__).parent sys.path[:0] = [str(HERE.parent), str(HERE / 'extensions')] on_rtd = os.environ.get('READTHEDOCS') == 'True' # -- General configuration ------------------------------------------------ nitpicky...
93237307a3be76811aa530167a2648503ae4ea4baa6b4bcf4dbf4d47ab0a542a
Python
2,569
90
#!/usr/bin/python3 # import os import sys import argparse import numpy as np from uac import utils # Create the parser my_parser = argparse.ArgumentParser(description="Calculation of labels using laplace solves and landmarks") # Add the arguments my_parser.add_argument("target_path", metavar="path", type=str, help="...
56a4894200c1a6ed1ae3c2d156440f9da70afebbe21325694fd7c76cd068a813
Python
2,570
84
import torch from torch import nn from torchvision.models import resnet50 class SliceEncodeTransformerBaseModel(nn.Module): def __init__( self, num_class: int, encoder: nn.Module, n_feature: int, n_token: int, trans_heads: int = 8, trans_blocks: int = 4, ...
aa53481170ef170fabf3bfb7a8e526252d36665618696ba57b4113a1a17c5e88
Python
2,570
97
from io import StringIO from numpy import allclose from bx.motif.io import transfac sample = """ VV TRANSFAC MATRIX TABLE, Rel.3.2 26-06-1997 XX // AC a XX ID V$MYOD_01 XX DT 19.10.92 (created); ewi. DT 16.10.95 (updated); ewi. XX NA MyoD XX DE myoblast determination gene product XX BF T00526; MyoD; Species:...
4e04d260f48722e86a28809b472c79ac9ec8304d8422ebbe84a39a48cc2ffb20
Python
2,571
92
from pathlib import Path import shutil import re import pydicom ROOT_DIR = Path(r"/mnt/f/SVD/樊焱0034077070_20250408") MOVE_FILES = True OVERWRITE = False def sanitize_name(text): text = str(text).strip() text = re.sub(r'[<>:"/\\|?*]', "_", text) text = re.sub(r"\s+", "_", text) text = text.strip("._ "...
60013cb43553033f5dd12ceebb6ec694a1ed89cdbd6e1f36d1336aab6e1c6eb0
Python
2,571
90
from __future__ import annotations import numpy as np import pytest from labelme._shape import Shape from labelme._shape_clipboard import ShapeClipboard def _make_polygon() -> Shape: return Shape( shape_type="polygon", points=np.array([(0.0, 0.0), (10.0, 0.0), (10.0, 10.0)], dtype=np.float64), ...