sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
bbd9cbeb2e973113eb55d83a37f4175556a0a15c0438969e53da8afcb19ab3de
Python
3,096
77
from .base import BSVTKObjectWrapper from .data_object import BSTable, BSPolyData, BSUnstructuredGrid from .algorithm import (BSDataSetMapper, BSPolyDataMapper, BSLabeledContourMapper, BSLabeledDataMapper, BSLabelPlacementMapper, BSPolyDataMapper2D, ...
7e866de7cea1caeb579d176a627aca2b53ee8a493872ebcfaef3bde8789c1dbd
Python
3,097
92
import os from typing import Tuple # disable numpy multithreading os.environ["OMP_NUM_THREADS"] = "1" os.environ["MKL_NUM_THREADS"] = "1" os.environ["NUMEXPR_NUM_THREADS"] = "1" os.environ["OPENBLAS_NUM_THREADS"] = "1" os.environ["VECLIB_MAXIMUM_THREADS"] = "1" import numpy as np import pandas as pd from scipy import...
90eba18c307d09f211d0d0c2db4254479e0ce31880488f6df1478a1ba27e8151
Python
3,097
77
"""Create a pydot Edge for a GO Term.""" __copyright__ = "Copyright (C) 2019-2020, DV Klopfenstein, H Tang, All rights reserved." __author__ = "DV Klopfenstein" import itertools import pydot from goatools.gosubdag.utils import extract_kwargs #pylint: disable=too-few-public-methods class GoEdgeOpts: """Processes...
23c826643454346210e900ecd2c6f6a168ef38668e14f080d8ba2098e101c161
Python
3,098
100
"""Tests asserting that ``AESTETIK`` honours the scikit-learn estimator contract: clone round-trip, get/set_params symmetry, fit_predict == labels_, and the modality-only cluster attributes added in 0.3. """ from __future__ import annotations import logging import numpy as np import pytest from sklearn.base import cl...
44bdc36aed52585f64b3b58cb5c971fce5dba36a899b5d6f0589c0c300518ecd
Python
3,100
86
import numpy as np from phantoms.phantom import phantom import func.geometry_func as gf import func.BphP_func as bf class plane_cyclinder_tumour(phantom): def create_volume(self, cfg : dict, mu_a_background=0.7, r_tumour=0.001): mu_s_background = 2500 # [m^-1] mu_s_tumour = 1700 #...
e62ec2cab5af1028e1f774ea29a947be5a648e7c54fb06bf5b44a6447973c9bc
Python
3,100
89
"""Property-based tests for `Vocabulary`'s payload round trip. `test_vocabulary.py` pins this at one hand-built vocabulary. The property — any constructible vocabulary survives `to_payload`/`from_payload` unchanged, class order and membership included — is generated here instead. Marked `slow`. """ import pytest from...
0d166293513ccbc7e02fc2d1e5a5dbddf4499c1706eb98166ccf429619b2d3c5
Python
3,102
85
########################################################################### # Created by: CASIA IVA # Email: jliu@nlpr.ia.ac.cn # Copyright (c) 2018 ########################################################################### # source : https://github.com/junfu1115/DANet/blob/master/encoding/nn/attention.py import num...
91d4f15e41fe1a1896e1e4368e810990e8191b78c57845cc8f9c60c82d27b587
Python
3,107
88
# Copyright (C) 2025 ETH Zurich, Moritz Thürlemann, and other AMP contributors import json import os import numpy as np from helper_functions import write_config_yaml import yaml from pathlib import Path def load_yaml(path:str): parameters = yaml.safe_load(Path(path).read_text()) return parameters ...
c865c90c6e07d2435142eea593179d2048ae715a0e2d6b3cfa1f686fba171222
Python
3,109
99
from __future__ import annotations import logging from typing import TYPE_CHECKING from poetry.publishing.uploader import Uploader from poetry.utils.authenticator import Authenticator if TYPE_CHECKING: from pathlib import Path from cleo.io.io import IO from poetry.poetry import Poetry logger = loggi...
dba58794dc52ef4ce1119aac3f14c87191750b8501423be66538582f6f86dd12
Python
3,109
95
# 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 unittest from collections import OrderedDict import numpy as np import torch from fairseq.data import LanguagePairDataset, TokenBlockD...
9cea3bab0cd7cd4add5409963e3e6f19cb3fff525021bf33df47eeaa15d56722
Python
3,110
112
""" Copyright (c) Facebook, Inc. and its affiliates. Copyright (c) Microsoft Corporation. Licensed under the MIT License. Adapted from https://github.com/FAIR-Chem/fairchem/blob/main/src/fairchem/core/models/gemnet/layers/base_layers.py. """ import math from collections.abc import Callable from typing import Optional ...
1df6a5ba9ef5366c34f0c44f159d5aef126942773fbacd3a82256ae71f7358c7
Python
3,113
88
from unittest import mock import pandas as pd import pytest import vak FAKE_SOURCE_FILES_DF = pd.DataFrame.from_records( [ {'audio_path': 'bird0-2023.10.12.cbin', 'spect_path': 'bird0-2023.10.12.cbin.spect.npz', 'annot_path': 'bird0-2023.10.12.cbin.not.mat'} ] ) @pytest.mark.param...
e9631c28e682ae74257491461cf20b7777da4b2a5f77d72f8c439be02ca5f22f
Python
3,113
81
"""End-to-end smoke + reproducibility for all pipeline families. These exercise the full per-subject driver (feature extraction, domain adaptation via da4bci, scoring, combiners and output writing) on synthetic sessions. """ import glob import os import pandas as pd import pytest pytest.importorskip("da4bci") # th...
8a21a749e1f13ec45334494d06ce1275e3557882531c999868352c902e8b1fea
Python
3,114
97
# @license # Copyright 2020 Google Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
f51eb5b7dfb8cdab8d2cc3919bb1db82ab511858a37094b4fd60660550b7c259
Python
3,115
102
# # Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with # Sandia Corporation, the U.S. Government retains certain rights in this software. # # See LICENSE for full license details # import numpy as np from scipy.optimize import minimize import time import os # Use th...
3c8ffca3ecac5fa4c0d209cbbb4738823b5ba2ce6a9cb1f0435bfc05352dc50f
Python
3,116
93
from __future__ import annotations import dataclasses import shutil import sysconfig from pathlib import Path from typing import TYPE_CHECKING import findpython from findpython.providers.path import PathProvider from poetry.config.config import Config from poetry.utils._compat import WINDOWS if TYPE_CHECKING: ...
c60087966c1c535f911d2c6c1a29dccfa3db7a09abd29c887e51288c9027b61e
Python
3,116
89
# 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 argparse from collections import defaultdict from itertools import chain from pathlib import Path import numpy as np import torchaudi...
9762de686c2cee58434ec6114cd1793ff4eb12ede983ac47a0dd633a88fa185e
Python
3,117
90
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import numpy as np import torch import os import scipy.io as sio import CBIG_pMFM_basic_functions as fc def CBIG_mfm_validation_desikan_main(gpu_index=0): ''' This func...
e8206671e506de9fb76eb577854acbf083c5b1d8d27f902d66c7e9c7e938407a
Python
3,117
102
# # Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with # Sandia Corporation, the U.S. Government retains certain rights in this software. # # See LICENSE for full license details # import numpy as np from scipy.optimize import minimize import time import os # Use th...
459e30aacca54bcff09e458bd74a858428883c2982adde662dcd6ca688beb2ed
Python
3,120
82
import logging import string import pandas from .. import Constants from .. import PredictionModel from ..gwas import Utilities as GWASUtilities EA, NEA = Constants.EFFECT_ALLELE, Constants.NON_EFFECT_ALLELE EA_BASE, NEA_BASE = EA + "_BASE", NEA + "_BASE" def align_data_to_alleles(data, base, left_on, right_on): ...
6522530257e133ffbde9d434cdc3e1f0b91c8ed84dc227d26f6c89e12f6708ad
Python
3,120
93
# 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 os import sys import fairseq import soundfile as sf import torch import torch.nn.functional as F from feature_utils im...
38d3344a69baadd6d2ceba9e163e9ce11580b7376b3540c211e158cb3951bba7
Python
3,121
83
from cyvcf2 import VCF import logging import pandas import numpy from metax.misc import Genomics def vcf_file_geno_lines(path, mode="genotyped", variant_mapping=None, whitelist=None, skip_palindromic=False, liftover_conversion=None): logging.log(9, "Processing vcf %s", path) vcf_reader = VCF(path) is_di...
b7d35d6908f0028683b8941f49da23689f6f0e8a35440195e75c61a50266091a
Python
3,121
84
import torch from tqdm import tqdm from torch.nn.functional import normalize from transformers import BertConfig, BertModel, BertTokenizer class TextEncoder(torch.nn.Module): def __init__(self, config_path: str, out_dim: int, load_pretrained: bool = True, ...
2ed4dd989d67069da73b89851e56cd84d44361573384fbc49fbb2f5d63a8c2ed
Python
3,123
100
import math import omegaconf import pandas as pd import pytorch_lightning as pl import torch import wandb from torch_geometric.utils import to_dense_batch from utils.data.dataholder import DataHolder def to_batch(data: DataHolder, device=None) -> DataHolder: """ Convert data to dense representation. I.e...
425e0f0744fc9185061bcc1c0e5a2f4108eb823f14b51b5049b9b91d74e75233
Python
3,123
94
# 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 from dataclasses import dataclass, field from typing import Optional import torch from omegaconf import II from .dummy_datase...
5854bd2a2c8b9dfa80fea6275bae480dc5033d517dd5f974440326ad8d5acf30
Python
3,123
87
#!/usr/bin/env python3 import os import sys import pickle import argparse import numpy as np import pandas as pd from tqdm import tqdm from sklearn.metrics import roc_auc_score, f1_score, average_precision_score import torch import torch.nn.functional as F from torch.utils.data import DataLoader sys.path.append("../sc...
340aa2a948fe59cfbbe7c8a439548c79a00728776979f3c685236ac4de5f3327
Python
3,124
83
"""GUI tests for the Relabel dialog (window_utils.open_relabel_window). Tests verify the dialog opens correctly with scope radio buttons, model combobox, overwrite checkbox, and action button. """ import pytest from PyQt6.QtWidgets import ( QDialog, QRadioButton, QComboBox, QPushButton, QCheckBox, QProgressBar...
4c5724a5939e32bfdce35dee333bf87fb81e142c0ced03a9339db7c4d9ef7e78
Python
3,124
102
import os import random class _Faker: clothes = ["衬衫", "毛衣", "领带", "裤子", "风衣", "高跟鞋", "袜子"] drinks = ["可乐", "雪碧", "橙汁", "绿茶", "奶茶", "百威", "青岛"] phones = ["小米", "三星", "华为", "苹果", "魅族", "VIVO", "OPPO"] fruits = ["草莓", "芒果", "葡萄", "雪梨", "西瓜", "柠檬", "车厘子"] animal = ["河马", "蟒蛇", "老虎", "大象", "兔...
bae04f21128f68eb551c6349094324c31d465cf4960df98fecaba3f822f5c70f
Python
3,126
105
import os import sys from shutil import rmtree from setuptools import Command, find_packages, setup # RELEASE STEPS # $ python setup.py upload __title__ = "pyecharts" __description__ = "Python options, make charting easier" __url__ = "https://github.com/pyecharts/pyecharts" __author_email__ = "chenjiandongx@qq.com"...
857d42f518cd0a3643a838b83848de53bb71dcf2c6ee81a2458e7758460f2b0a
Python
3,127
92
from ... import options as opts from ... import types from ...charts.basic_charts.geo import GeoChartBase from ...commons.utils import OrderedSet from ...exceptions import NonexistentCoordinatesException from ...globals import ChartType BAIDU_MAP_API = "https://api.map.baidu.com/api?v=2.0&ak={}" BAIDU_MAP_GETSCRIPT = ...
85cb2989de2ff7d93d7ff8012043fddd7bb932069c5c1bbc89aeecd054fd5cfe
Python
3,127
91
import numpy as np import pytest from pgmpy.ci_tests import WilksLambda from pgmpy.tests.test_ci_tests import _multivariate_fixtures pillai_data = _multivariate_fixtures.pillai_data skip_gh_actions = _multivariate_fixtures.skip_gh_actions @skip_gh_actions def test_wilks_no_cond(pillai_data): expected_stats = [0...
d5cc2c62ee4dffee500f85ae96c4c63e53894dfbd27e0d449a70e2772097c830
Python
3,127
82
"""parses [SPECT_PARAMS] section of config""" import attr from attr import converters, validators from attr.validators import instance_of def freq_cutoffs_validator(instance, attribute, value): if len(value) != 2: raise ValueError( f"freq_cutoffs should be a list of two elements, but instead ...
fddc20afc86d9542f9511793b3aaf6229f8a4861417dc744c9e6f8e73814a826
Python
3,128
88
import unittest from unittest.mock import patch from pyecharts.charts import WordCloud from pyecharts.exceptions import WordCloudMaskImageException words = [ ("Sam S Club", 10000), ("Macys", 6181), ("Amy Schumer", 4386), ("Jurassic World", 4055), ("Charter Communications", 2467), ("Chick Fil A...
595d7535a370968cdb96f7073257061d12ab14f730019bba723ebf9a0798a237
Python
3,129
96
import pandas as pd import matplotlib matplotlib.use("TkAgg") target_len = 20 dat = pd.read_csv("./data/DTCR_blosum/results.txt") all_true_tcr = [] min_n = 30 max_n = 0 for i in range(len(dat)): epi = dat["MT_pep"][i] mhc = dat["HLA_sequence"][i] tcr = dat["CDR3"][i] label = dat["Label"]...
8fe826aa3d966de1692cad37b5892a883280a55cff14dc5334a22a1cffab2e6f
Python
3,129
95
# 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 os import sys import fairseq import soundfile as sf import torch import torch.nn.functional as F from feature_utils im...
6c5219eb87ec3f75b41c2c36f96fe56dc857e1633275c0d28ea35abc901772e1
Python
3,130
83
import numpy as np import pandas as pd from st_risk.models.base import BaseSpatialModelOutput from st_risk.risk.features import ( ambiguity_score, build_feature_table, confidence_proxy_score, local_residual_score, stability_score, uncertainty_score, ) def test_local_residual_score_is_zero_for...
5f0560827de21f22e5123dedd1181b27f3c2656b591dcf9ab651e2665249b916
Python
3,132
86
import numpy as np import torch from PIL import Image import tqdm import cv2 from sklearn.cluster import KMeans, kmeans_plusplus import time from msi_visual.utils import normalize from msi_visual.saliency_opt import SaliencyOptimization class SaliencyClusteringOptimization(SaliencyOptimization): def _...
73b5b6ec11a8333c8b81bb76bab2e49e2d5f9d4b79d2766fcb3252f57d81574f
Python
3,132
91
import argparse from collections import namedtuple import os DATADIR = "/path/to/train_data" DEDUP_FROM_DIR = "/path/to/eval/data" OUTPUT_DIR = "/path/to/output/data" def main(args): languages = set() for language_directory in os.listdir(DATADIR): if "_" in language_directory: src, tgt = ...
68100cd6802355415e43a1ea446f65a00d709aee445e52e954a144cba220c345
Python
3,133
98
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # fairseq documentation build configuration file, created by # sphinx-quickstart on Fri Aug 17 21:45:30 2018. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # au...
c800fc0d961e0d5200a8dc4471a4b680f2e64e7a353e69b6d878f2009002746e
Python
3,133
80
import requests try: from tqdm import tqdm except ImportError: tqdm = lambda x, total, unit: x # If tqdm doesn't exist, replace it with a function that does nothing print('**** Could not import tqdm. Please install tqdm for download progressbars! (pip install tqdm) ****') # Python2 compatibility try: ...
34848019e4fe3131f4f6bbf696541009224df35a06940eb6ddd9ed83f10293bc
Python
3,134
89
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from typing import Optional, Tuple import torch import mattergen.diffusion.sampling.predictors_correctors as pc from mattergen.diffusion.corruption import sde_lib from mattergen.diffusion.corruption.corruption import Corruption from mattergen.d...
44cc4380bbf04e689a0015c428128b356799c3755255cd99ce094b702f6666ea
Python
3,135
88
#!/usr/bin/env python # Author_and_contribution: Jieran Sun & Mark Robinson; implmented method # Author_and_contribution: Peiying Cai; created template # Author_and_contribution: ENTER YOUR NAME AND CONTRIBUTION HERE import argparse # TODO adjust description parser = argparse.ArgumentParser(description="Calculate co...
baa8b9801d797ef69ab7261bc199c43e21e2bbdbbafb5ea9420efaf8977ec885
Python
3,136
67
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a cop...
ae1e8f0f4192f2cd19525f88fc3d1bd7c8ee282b2706bdc80b7c42d67b1b14ab
Python
3,137
68
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a cop...
9c2d54cca7d974f596ef15985662eed62cd6e7089e668ddf5925709ee437f8d4
Python
3,139
69
# Copyright 2021 HIP Applied Computer Vision Lab, Division of Medical Image Computing, German Cancer Research Center # (DKFZ), Heidelberg, Germany # # 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...
1dba629ffc2f10de9cc6832a5feae5f636caefeb31ffa032dd395bece4a69e4a
Python
3,140
100
"""Supplemental pipeline schematics — PhysMAP and NEMO hyperparameter tuning flows. Simplified version of figure_2_panel_a_pipeline.py (no architectural ablation rung — PhysMAP and NEMO are fixed architectures, only hyperparameters vary). Outputs: figures/20_figure_2_pipeline/pipeline_schematic_physmap.{svg,png} ...
d97c22466bae8c5ca6f7753f7a94f53e89a96dad1dd45c9c6fd40b3ca7272acf
Python
3,141
89
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import numpy as np import torch import CBIG_pMFM_basic_functions as fc import os def CBIG_mfm_validation_desikan_main(gpu_index=0): ''' This function is to validate the...
9e0ad91bedefe1249d373c05af37c1adecc7a7a4cf888d4f512b60c1cd5684bb
Python
3,142
69
def resnet18_layers(): return (['conv1'] + # note that while relu is used multiple times, by default the last one will overwrite all previous ones [f"layer{block + 1}[{unit}].relu" for block, block_units in enumerate([2, 2, 2, 2]) for unit in range(block_units)] + ['...
d3ab83d547d52fe71dade1c60b6b64e7139c0dcf214d5dd6fe1862d385770c1f
Python
3,144
103
import cellxgene_census import pandas as pd import numpy as np from data_config import VERSION from typing import List import os import argparse parser = argparse.ArgumentParser( description='Download a given partition cell of the query in h5ad') parser.add_argument("--query-name", type=str, ...
4f64d53a82948c7996d8b88b4766514429fa845d32761fa935194b886e998f9b
Python
3,145
95
""" 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 sympy as sym import torch from torch_geometric.nn.models.schnet import GaussianSmearing from .basis_utils import real_sph_harm from ....
bfc770aa1522206016dddffb5589f36bf152ec41e4f95a5d2622d003fd2b53dc
Python
3,146
77
# Copyright (C) 2025 ETH Zurich, Moritz Thürlemann, and other AMP contributors import os import torch from utilities.Scatter import scatter_sum as scatter from datastructures.Graphs import Graph from utilities.Utilities import build_Rx2 def compute_com(coords, masses): masses = masses.reshape((coords.shape[0], ...
c55327e3ba8faa5764c3a57c34eeebb66b7d5a256f0006b2c2840238c2c13f20
Python
3,146
72
import torch from tangle_tracer.modules import NFTDetector from pathlib import Path from ultralytics import YOLO import zarr class YOLOModule(NFTDetector): def __init__(self, *args, load_path='yolov8m.pt', devices = (1), **kwargs): super().__init__(*args, **kwargs) try: self.devices = s...
6ea26320edb2da305e6ceeaf226f08640089e7e13e3fc2a86a4e1a54e7a95688
Python
3,147
56
import numpy as np from nnunetv2.training.dataloading.base_data_loader import nnUNetDataLoaderBase from nnunetv2.training.dataloading.nnunet_dataset import nnUNetDataset class nnUNetDataLoader3D(nnUNetDataLoaderBase): def generate_train_batch(self): selected_keys = self.get_indices() # preallocate...
479ff099f7462121508f23c41946d22d0fb370e73df48efc12f5728d5a4c1fca
Python
3,148
81
"""Diagnostic: where does the relaxation energy go in the OCE basis? Decompose Π¹F, Π²F, Π³F values and totals before/after xtb relaxation, using the SAME free-atom ε_μ in both cases (the table is composition-only). """ from __future__ import annotations import json import sys from pathlib import Path ROOT = Path(__...
91035e3a04b12541973137b7c7b479a69ecfaeb0c20ecd6680476abac02d143d
Python
3,149
109
# _ _ # | | | | # ___ __ _ __ _ ___| |_ ___ ___ | |___ # / __/ _` |/ _` / __| __/ _ \ / _ \| / __| # | (_| (_| | (_| \__ \ || (_) | (_) | \__ \ # \___\__,_|\__,_|___/\__\___/ \___/|_|___/ ''' A Convergent Amino Acid Substitution identif...
45d8c7d81643c7e84d0b8e941bd39cfaf6c58c4d80c8707e91c0a61f18ab3c14
Python
3,150
114
"""Consensus and variant calling of Nanopore sequencing data.""" import functools import os import subprocess import sys from packaging.version import Version __version__ = "2.2.2" try: import pyabpoa as abpoa except ImportError: sys.stderr.write( "Cannot import pyabpoa, some features may not be avai...
87bc8264dc3158817aadca389058c831895685ecf26089e79829b443b3deb74d
Python
3,150
100
""" Patch Embedding for 3D Medical Images Converts 3D image patches (voxels) into embedding vectors using a linear projection. """ from functools import partial import torch.nn as nn from einops import rearrange from torch import _assert from torch.nn.modules.utils import _pair try: from flash_attn.ops.fused_de...
f2e78b260b1f8009e15f213fa37f4493918e63ebdbf594fad1f4d2d1ddcac56c
Python
3,150
77
import glob import os import numpy as np from mdt.utils import restore_volumes from mdt.lib.nifti import write_nifti, load_nifti __author__ = 'Robbert Harms' __date__ = "2017-02-28" __maintainer__ = "Robbert Harms" __email__ = "robbert@xkls.nl" def volume_map_npy_to_nifti(npy_fname, nifti_header, nifti_fname=None): ...
234bb3672a19f4ced8aa8bb53e27b26e4e657a50ca4748c22fe595eed6a413f7
Python
3,153
106
"""functions for making spectrogram filters adapted from SciPy cookbook https://scipy-cookbook.readthedocs.io/items/ButterworthBandpass.html spectrogram adapted from code by Kyle Kastner and Tim Sainburg https://github.com/timsainb/python_spectrograms_and_inversion """ import numpy as np from matplotlib.mlab import s...
649c47a43aa91b3c741c1282e229fee6971d8ade09b584ac5806076630fec1cb
Python
3,153
63
# encoding: utf-8 """ @author: Jiayang Chen @contact: yjcmydkzgj@gmail.com """ from .custom import Custom def build_dataset(dataset_names, set_name, root_paths, transforms): """ :param dataset_name: the name of dataset :param root_path: data is usually located under the root path :param set_name: "tr...
0309c39ae6ce182dcc8c107cd73f1c09bf0e3b652d649312594a3a69b46e22eb
Python
3,154
92
import os import matplotlib.pyplot as plt from skimage import io from skimage.segmentation import mark_boundaries import numpy as np def plot_image_mask_segmentation(file_path): """ Given a file path, this function checks whether the file is in the 'images' or 'masks' directory. It then finds the correspon...
0371a3102e14e014fb210668b881d0be2355af55c3ef0f0f92b7c00863b6d91d
Python
3,154
85
# 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. from collections.abc import Collection from dataclasses import dataclass, field from typing import List from omegaconf import II from fairse...
507732e8050b6b72ce0a3e7a8ad9ce102b303c6b3498aac9b9e84cf6eb546727
Python
3,155
81
# 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 omegaconf from omegaconf import OmegaConf def load_config(args=None, config_file=None, overwrite_fairseq=False): """TODO...
c98eab8fe895b28225642322835615d2848662a015347f82c787170b419bf7c2
Python
3,155
96
# 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 torch.nn as nn from fairseq.modules import TransformerSentenceEncoder from fairseq.modules.sparse_transformer_sentence_encoder_layer im...
debbdb206348f26c4c44ae30803766b0a0d43255dc85b3bfbd7c6e3c3490d14c
Python
3,155
87
from ... import options as opts from ... import types from ...charts.chart import Chart from ...globals import ChartType class Parallel(Chart): """ <<< Parallel >>> Parallel coordinate systems are commonly used to visualize graphs of high dimensional data. """ def __init__( ...
3c2912c2e2b645f815e0a3d8309a38790d432c333e83132443f1a7283c822239
Python
3,157
89
import logging import community import leidenalg import networkx as nx import igraph as ig import numpy as np from sklearn.neighbors import NearestNeighbors from scipy.sparse.csgraph import connected_components import loompy class UnpolishedLouvain: def __init__(self, resolution: float = 1.0, min_cells: int = 10, gr...
695c0667f6a723ebad9236ae3c282c3cf1c1496892c93ccd35ef28d2269c0261
Python
3,157
112
import os import anndata import pytest import scvi from .utils import unsupervised_training_one_epoch @pytest.mark.internet def test_pbmc_dataset(save_path: str): dataset = scvi.data.pbmc_dataset( save_path=save_path, remove_extracted_data=True, ) unsupervised_training_one_epoch(dataset...
7f9a1ff6c03415c577a425187ddf74c45d85d793b4f79b8950fc8070640ae6ae
Python
3,157
60
import torch from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer class nnUNetTrainer_250epochs_NoMirroring(nnUNetTrainer): def __init__(self, plans: dict, configuration: str, fold: int, dataset_json: dict, unpack_dataset: bool = True, device: torch.device = torch.device('cuda...
f680e1e4115150f60cf0677ad7ba2ef17f53dbdeb3760df7bb2156897b8faf2b
Python
3,157
88
"""Given user GO ids and parent terms, group user GO ids under one parent term. Given a group of GO ids with one or more higher-level grouping terms, group each user GO id under the most descriptive parent GO term. Each GO id may have more than one parent. One of the parent(s) is chosen to best represent...
77cab40bc567d3d084ccf01af2624b27ba97eeb88d7c7e62faf9938d63632ecc
Python
3,158
95
# 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: # http://www.sphinx-doc.org/en/master/config # -- Path setup -------------------------------------------------------------- # If extensions (or module...
3170a89b1b92f4bb6cb2306f15c2c56aef282e2fdbfa7ad20ee7da20273a4282
Python
3,159
83
import re from datetime import time import pandas as pd # Centralized Conversion Factors and Labels # Each value = how many minutes equal 1 of that unit. # e.g. 1 second = 1/60 minute, 1 hour = 60 minutes. CONVERSION_FACTORS: dict[str, float] = { "minutes": 1, "seconds": 1 / 60, "hours": 60, } TIME_LABEL...
3f9de4d2914d3601b5e67714c22d3681f7521b5a44f41ff962e4cfad6387d0a1
Python
3,159
95
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from functools import partial from typing import Callable, Iterable, Sequence import torch from torch.utils.data import DataLoader, Dataset from mattergen.common.data.chemgraph import ChemGraph from mattergen.common.data.collate import collate ...
154f906dfc90e2dbfb260d9400aa29441eb5683398e51549947a91db15fb6f81
Python
3,161
87
import torch import math import torch.nn as nn import torch.nn.functional as F class Flatten(nn.Module): def forward(self, x): return x.view(x.size(0), -1) class ChannelGate(nn.Module): def __init__(self, gate_channel, reduction_ratio=16, num_layers=1): super(ChannelGate, self).__init__() ...
4713d6b3619ef6265f7c5e92433fcc7c49dc496fa46b0f22e100918e72bce899
Python
3,162
85
import numpy as np from mdt import CompositeModelTemplate __author__ = 'Robbert Harms' __date__ = '2017-07-19' __maintainer__ = 'Robbert Harms' __email__ = 'robbert@xkls.nl' __licence__ = 'LGPL v3' class ActiveAx(CompositeModelTemplate): """The ActiveAx model for use in in-vivo measurements. This model has ...
e4c9e72ecf0ee842b059c0b30e22c17e7f61de823de2fc8f4ac8dacf85993488
Python
3,164
68
#!/usr/bin/env python3 # MIT License # # Copyright 2025 Broad Institute # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to u...
00574bbaef4129aae7153f5216dacde601c2b042896ae62278f1883d4814c2e2
Python
3,166
77
import argparse import pandas as pd from utils import HBR from pathlib import Path def prep_dlst(dir, dir_exl=None, hst=20480, wst=40960, size=256, hnm=16, wnm=16, to_csv=False): gn_lst, rel_pad =[], size // 2 mouse = dir.name.split('_')[-1] # Here, we assume no boundar...
fc9d493eaa319fc810931abfa68a91f145b4f3fe529b7fd5779135c28d5b5659
Python
3,166
102
# 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 argparse import random import numpy as np from fairseq import options from examples.noisychannel import rerank, rerank_options def ...
e37bb844478f87dee833721221d88c70b9e5f938534d413cdd602305f3bba3d7
Python
3,167
92
import numpy as np import pandas as pd from scipy import stats from sklearn.linear_model import LinearRegression from pgmpy.utils import preprocess_data from ._base import BaseCITest, _CITestResult, _ResidualMixin class GCM(_ResidualMixin, BaseCITest): r""" Generalized Covariance Measure (GCM) [1] test for ...
98189d595f285727dd9daae3e6259c7c8cf3714f35c10bd2b4453d7bbb1aadc5
Python
3,169
95
# 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...
9e72de89deb5e8884e3a84c918f74a8dbb34973c26e686dac9115baef6e0a1a0
Python
3,170
71
# # Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with # Sandia Corporation, the U.S. Government retains certain rights in this software. # # See LICENSE for full license details # import numpy as np from simulator.parameters.core_parameters import CoreStyle, BitSlicedCoreStyle ...
e680f00ec4b98ae6ccd93dc740e33f4b7aa75bfa2967088931d6eb9659da3f55
Python
3,170
94
# /usr/bin/env python ''' Written by Kong Xiaolu and CBIG under MIT license: https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md ''' import os import numpy as np import torch import CBIG_pMFM_basic_functions as fc import warnings def CBIG_mfm_validation_desikan_main(gpu_index=0): ''' This function is...
17bc81d50bdc77102b1a29bb3e462d6df83e840ee5f207ed731924199012f12c
Python
3,171
119
# -*- coding: utf-8 -*- """ Created on Fri Apr 3 14:23:24 2026 @author: Satoru Muro """ import io import requests import numpy as np from PIL import Image from PyQt6.QtGui import QPainterPath class RemoteSAM2Interface: def __init__(self, base_url: str = ""): self.base_url = base_url.rstrip("/") ...
145324762742992e0bb70d3f256f1e5f01dee92b69642a921c009a3f77a6f388
Python
3,172
79
from model.builders.prostate_models import build_pnet2 task = 'classification_binary' selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes.csv' data_base = {'id': 'ALL', 'type': 'prostate_paper', 'params': { 'data_type': ['mut_important', 'cnv_del', 'cnv_amp'], ...
bb2134098b8aabe90d68161bbf9c99b4c1a2ead1a334a4c9fbb1f2f667658e78
Python
3,172
79
from model.builders.prostate_models import build_pnet2 task = 'classification_binary' selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes.csv' data_base = {'id': 'ALL', 'type': 'prostate_paper', 'params': { 'data_type': ['mut_important', 'cnv_del', 'cnv_amp'], ...
d182ac99ecfab3d84a8a43c0fcfa38740c4029a425f2c165e647a24619f02023
Python
3,172
79
import re import pandas as pd from collections import defaultdict # log_path = r"D:\FangX24\code\LO-Det-main\04log\fs\04_DIOR_maml_K10_2.txt"04_mobv3_log_fea_s1_noweight_withBN_0.675. log_path = r"D:\FangX24\code\LO-Det-main\04log\fs\D_04_mobv3_test.txt" # 用于存储每个 epoch 的所有 batch loss(取平均) epoch_data = defaultdi...
117fb3225714ebd2d279d206320b883362da2363cccda9bdde4d3b652109fb36
Python
3,173
70
from pathlib import Path import os import sys import argparse import random import numpy as np from tqdm import tqdm from sklearn.model_selection import train_test_split from build_translation_manifests import get_utt_id def train_val_test_split(tsv_lines, km_lines, valid_percent, test_percent, seed=42): utt_ids ...
d52e4e5bb8bb0d6db3f1d39f05660827a0e04ab272cc5570f953c8d791217673
Python
3,173
79
from model.builders.prostate_models import build_pnet2 task = 'classification_binary' selected_genes = 'tcga_prostate_expressed_genes_and_cancer_genes.csv' data_base = {'id': 'ALL', 'type': 'prostate_paper', 'params': { 'data_type': ['mut_important', 'cnv_del', 'cnv_amp'], ...
03e3883a9dfebdde048dc5cbc2e8fe43076944c415c68281aa46b93928368f43
Python
3,174
81
#!/usr/bin/env python3 import argparse import csv import os from collections import defaultdict def parse_args(): parser = argparse.ArgumentParser(description="Summarize stats from multiple stats files into one summary file.") parser.add_argument("stats_files", nargs="+", help="Input stats .tsv files (one or m...
39a1bf374fa1a2f0fd9162c535b345bdb192e1cff31bf25f76fd81f4238a2355
Python
3,174
100
# 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 torch from fairseq.models.bart import BARTModel import argparse XSUM_KWARGS = dict(beam=6, lenpen=1.0, max_len_b=60, min_len=10, no_re...
9fe68ad39df9fa6556b6727f576c0b2c489ea99b06480be653a289447f9cc741
Python
3,176
66
import torch from torch._dynamo import OptimizedModule from torch.nn.parallel import DistributedDataParallel as DDP def load_pretrained_weights(network, fname, verbose=False): """ Transfers all weights between matching keys in state_dicts. matching is done by name and we only transfer if the shape is also...
1cbebeee01b698fbdd3788cb87fad1306049bdce2653b7c989b3e338cb233201
Python
3,177
97
"""Regenerate the tiny published-model alignment fixture from a local Zarr. This utility intentionally requires an already-present multiz100way store. It never downloads or builds an alignment dataset. """ from __future__ import annotations import argparse import hashlib import json from pathlib import Path import ...
c5f10e34d6e5b9ce3525f50cc570171b9b4bbfecb0d090683f6f29615de8e7c4
Python
3,178
105
# 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 argparse import logging import os import soundfile as sf from examples.textless_nlp.gslm.unit2speech.tts_data import ( TacotronInp...
9d7c09794f1fa0154f36b762166eee922afaee3f714dbf710664a782351ae686
Python
3,179
85
#!/usr/bin/env python # PYTHON_ARGCOMPLETE_OK """Merge a list of volume images on the 4th dimension. Writes the result to a single image. Please note that by default this will sort the list of volume names based on a natural key sort. This is the most convenient option in the case of globbing files. You can disable th...
c4cc22cb06d091a3d88c730de380e2684e8c07efef11b038594da9436f9b915d
Python
3,180
76
import polars as pl from src.single_cell import SingleCell from scipy.sparse import csr_array import argparse def main(): parser = argparse.ArgumentParser(description='Get single_cell object from long read data') parser.add_argument('--id_to_sample', action='store', dest='id_to_sample', type=str, required=True...
f959a14e4859a5f38b0c280bfe8c691367d4582c16f38005729884509bdbd870
Python
3,180
136
import builtins import pytest from rnalysis.gui import gui_style from rnalysis.utils import settings def test_get_stylesheet_names(monkeypatch): sheets = {'first': None, 'second': 'val', 'third': 3} truth = {'First': 'first', 'Second': 'second', 'Third': 'third'} monkeypatch.setattr(gui_style, 'STYLESHE...
65515de46682c0949e4afb9951218372211fd7fa811e41b798b1cd5cba9e7fa1
Python
3,182
96
#!/usr/bin/env python # Author_and_contribution: Niklas Mueller-Boetticher; created template # Author_and_contribution: ENTER YOUR NAME AND CONTRIBUTION HERE import argparse # TODO adjust description parser = argparse.ArgumentParser(description="Load data for ...") parser.add_argument( "-o", "--out_dir", help="...
93123fd26ce6501b18e33e566857a5490d7a7960a4e653997bdffbff2ed95014
Python
3,183
92
import numpy as np import pandas as pd from celltype_ibl.params.config import ( ALLEN_LABELLED_PATH, ALLEN_UNLABELLED_PATH, CELL_EXPLORER_PATH, SPLIT_INDEX_PATH, INDEX_MAPPING_PATH, ) def get_allen_labeled_dataset(padding: bool = True): wvf, acgs, cell_types = get_cell_explorer_dataset(Allen_o...
e5f80d3ca80fdd9e23958853058781028f5474a3a858b040b2dea61240985f50
Python
3,183
91
import numpy as np import pytest from pgmpy.ci_tests import HotellingLawley from pgmpy.tests.test_ci_tests import _multivariate_fixtures pillai_data = _multivariate_fixtures.pillai_data skip_gh_actions = _multivariate_fixtures.skip_gh_actions @skip_gh_actions def test_hotelling_no_cond(pillai_data): expected_st...
f96d6d988db73408e258b934a681cce621cce14cf497769c1b3e4768ec7599d0
Python
3,183
58
#!/usr/bin/env python3 # MIT License # # Copyright 2024 Broad Institute # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to u...
c65b7bc7b36d6a535f82b1f9d69b887a9062700365eec694fff37928ac1f049a
Python
3,184
88
# 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 from fairseq import utils from fairseq.logging import metrics from fairseq.criterions import FairseqCriterion, register_criterion...