sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
ae5c2bd68823d24dc475851693a05506a733f2e5a6041b6a6255b708dcea69fa
Python
2,786
61
"""Small, asymmetric DICOM volumes; no patient data or model download required.""" from pathlib import Path import numpy as np from pydicom.dataset import FileDataset, FileMetaDataset from pydicom.uid import ExplicitVRLittleEndian, CTImageStorage, MRImageStorage, generate_uid ORIENTATIONS = { "axial": [1, 0, 0, 0,...
7ee4844ce2863b7fe5b857b4fe38e6e0ff9327fb0899a29d4a8ff0179c43cbe8
Python
2,787
74
import h5py import numpy as np import tensortools as tt import pickle import os # Set parameters num_animals = 12 replicate = 0 n_components = [3] total_runs = 100 for run in range(0, total_runs): print('Replicate: ', run+1) print('\n') output_dir = f"tca_factors" os.makedirs(output_dir, exist_ok=Tru...
df2e4a64ed57f38cefacd6715e19b3fc73d2bc7b956a29b12c695fdc5e9392c2
Python
2,787
65
#!/usr/bin/env python3 """Run selected bundled calculation examples in an external result directory.""" from __future__ import annotations import argparse from pathlib import Path try: from .common import DEFAULT_EXAMPLES, REPO_ROOT, load_cases, metadata_exit_code, resolve_selectors, run_matrix except ImportErro...
11a1a48b0330a4872d92b06ff105a1b354c3247baa190d1f6bdc27c35386a658
Python
2,788
92
"""Download associations from GOlr for a given species.""" from __future__ import print_function __copyright__ = "Copyright (C) 2010-present, H Tang et al. All rights reserved." __author__ = "various" import argparse import sys def _get_argparser(): """Return the CLI argument parser.""" parser = argparse.A...
2c9217139a79dc8ac8262b03323fd02b9b29dc4f27c69d546a700a9b198f5962
Python
2,788
64
#!/usr/bin/env python3 """R1 ponto 5 (definir eta^2 e rho) e R1 ponto 4 (os 34 gaps negativos por par F-X). Recalcula eta^2 pela ANOVA de um fator para conferir os valores da Tabela 3 e fixar a definicao que entra no texto, e confere que o rho das Tabelas 4 e 1/7 e de SPEARMAN. """ import csv, json, re from collection...
0b2645e600b0af2d9793dfd3f5e31f2b64e12ab6d5682703930d71b66f4b4ad8
Python
2,790
77
"""TweetyNet model [1]_. .. [1] TweetyNet was described in: Cohen, Y., Nicholson, D. A., Sanchioni, A., Mallaber, E. K., Skidanova, V., & Gardner, T. J. (2022). Automated annotation of birdsong with a neural network that segments spectrograms. eLife 11: e63853. Paper: https://elifesciences.org/articles/63853 ...
0da71350fe0f69923d04d24a394beb37115d30d19678af28a9629fc7d0713d1d
Python
2,793
102
import gc import math from typing import Dict, List, Mapping, Optional, Tuple, Any, Union import warnings import torch from torch import nn, Tensor from torch.nn import TransformerEncoder, TransformerEncoderLayer class CancerGPT(nn.Module): def __init__( self, ntoken: int, d_model: int, ...
cc4278c80ca11c8d57709a9269c461cc3907a774f9e5f52160a5b9404513a382
Python
2,793
92
# inspired by # https://github.com/yuanli2333/CKA-Centered-Kernel-Alignment/blob/master/CKA.py import math import torch import numpy as np class CKA(object): def __init__(self): pass def centering(self, K): n = K.shape[0] unit = np.ones([n, n]) I = np.eye(n) H = I...
3902b1d0d9a8cd6c128ded6e624391b7c47864998cf6f4d39d8f40dff824dfda
Python
2,794
89
from __future__ import annotations import os import platform import site import sys import sysconfig from pathlib import Path from typing import TYPE_CHECKING from packaging.tags import Tag from packaging.tags import interpreter_name from packaging.tags import interpreter_version from packaging.tags import sys_tags ...
19f13738d63856c850d048f1298ddda610ccae24f5facf80214b3f6eec544242
Python
2,795
85
# /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...
885a6d6f9f8f4874a1d44555b29ce190d98811ebb9bbc0abc44a886d6ad94abd
Python
2,796
88
import logging from typing import Dict, List, Optional import haiku as hk import jax import jax.numpy as jnp from haiku import initializers from typing_extensions import TypeAlias from nucleotide_transformer.heads import UNET1DSegmentationHead SequenceMask: TypeAlias = jnp.ndarray logger = logging.getLogger(__name...
0ead9200c1e8a1ced607c033d618468b0eea764b41be0e3b516999ec793727b5
Python
2,798
86
#!/usr/bin/env python3 # MIT License # # Copyright 2022 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 use...
3ae95a98af050435dd7e3bfbe9f867b149a4500d4921ac60a556820899daede4
Python
2,799
80
"""Landscape interface for the BO loop. Reads fitness from CSV, writes proposed sequences to CSV. Acts as the communication channel between the BO engine and external scoring. """ import os from typing import Sequence import numpy as np import pandas as pd from Bio import SeqIO class EXPLandscape: """CSV-based ...
2c571113a305a0d26b4eb64fed5e831c2b4c56f169cd8cff082cc4a5195c2ce3
Python
2,800
94
#!/usr/bin/env -S uv run --script # /// script # requires-python = ">=3.12" # dependencies = [ # "numpy", # "crackle-codec", # ] # /// # @license # Copyright 2026 William Silversmith # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Lice...
72265bcd7a27436a185b03553cfe165ec732ad7f5173eaa7ddd96579441cf032
Python
2,800
71
from functools import partial import jax import jax.numpy as jnp import pytest from oneqmc.data import as_dict_stream, as_mol_conf_stream, simple_batch_loader from oneqmc.device_utils import DEVICE_AXIS from oneqmc.sampling.multi_system_sampler import NaiveMultiSystemSampler from oneqmc.sampling.samplers import OneSy...
e35e9efae7d097b3d358531e624349cddc9a33ab6469f0fbadaaa1e045dea003
Python
2,800
102
""" Nodes that implement the dHCP pipeline for fetal data. Version from <https://github.com/GerardMJuan/dhcp-structural-pipeline> , which is a fork of the original dataset <https://github.com/BioMedIA/dhcp-structural-pipeline> with several fixes and changes The docker image, where everything works "well", is: <https:...
5c7361298a41265620b7b4c353dd7e1328f7c9385920568daba86682f0ebccfa
Python
2,801
93
#!/usr/bin/env python # -*- coding: utf-8 -*- """Simple, generic tools""" from typing import Optional import warnings import numpy as np from .models import Cell, Region def retrieve_cell_region_uid(objs: list, uid: int) -> Optional[Cell | Region]: """Returns cell or region with requested uid from list""" ...
d5dd878ad1562991760d798649381ddf1d9ff18334f6f658875bc144fdf4179a
Python
2,802
88
#!/usr/bin/env python3 import argparse import functools import os import pickle import shutil import sys import yaml import h5py import numpy as np import medaka.features import medaka.labels import medaka.models def main(): parser = argparse.ArgumentParser( description='Update a pre-version-0.9.0 mode...
307f8856f69502ee4801832a32030667622f2e0e07e4a3f5ee66b1d6cb99387a
Python
2,805
88
from __future__ import annotations from typing import TYPE_CHECKING from typing import Any from poetry.utils.env.null_env import NullEnv if TYPE_CHECKING: from packaging.tags import Tag from poetry.utils.env.base_env import MarkerEnv from poetry.utils.env.base_env import PythonVersion class MockEnv(N...
560e55350fe52380e36b68b311f305e7563831741ece47cfbef13b45b6cfa5f4
Python
2,810
101
"""Plot a GO term lineage using the GODag drawing helpers.""" __copyright__ = "Copyright (C) 2010-present, H Tang et al. All rights reserved." __author__ = "various" import argparse import os from ..obo_parser import GODag, GraphEngines def _get_argparser(): """Return the CLI argument parser.""" parser = a...
eac1a50630a116e7fea407e0e5fd6cb8432d53cc869e760d5153fd175ca07f6a
Python
2,810
73
"""Power-law analysis for E_total(L) and E/N(L) on percolation clusters. Two regimes are interesting: (a) Total energy: E_total ~ L^{D_E} with D_E ≈ D_f = 91/48 ≈ 1.896 (extensive part of the energy ∝ cluster mass). (b) Per-atom energy: E/N − ε_bulk ~ L^{−α} with α expected in [|D_h − D_f|, |D_e ...
aa5376a85ee856c6b4d0ead77392e9e1b3fdf3ec418e815962a0b92717dd48c3
Python
2,814
85
from __future__ import annotations from pathlib import Path from typing import Any import pandas as pd from st_risk.data.io import open_h5ad from st_risk.models.base import BaseSpatialModelOutput, BaseSpatialModelRunner class PrecomputedTableRunner(BaseSpatialModelRunner): model_name = "precomputed" def i...
4c3207841e79e25c3c46662df0a7ef08d91a8f4f6af6474c75269776f5682e9d
Python
2,816
81
#!/usr/bin/env python # Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # NOTE: This requires PyTorch! We do not provide installation scripts to install PyTorch. # It is up t...
511fbc83198db1a7c54c83f6003f01725dc691167f38afe56d5da44e509e1039
Python
2,816
95
import mudata import numpy as np import pytest import scvi from scvi.data import synthetic_iid from scvi.external import Tangram modalities = {"density_prior_key": "sp", "sc_layer": "sc", "sp_layer": "sp"} def _get_mdata(sparse_format: str | None = None): dataset1 = synthetic_iid(batch_size=100, sparse_format=s...
0a618aa0fc5312bd0fe6ce7cadc0ae4ba08fe2cff05febf0dc5b9231fcf73c8e
Python
2,817
96
from __future__ import annotations import os from typing import TYPE_CHECKING from typing import ClassVar from cleo.helpers import argument from cleo.helpers import option from packaging.utils import canonicalize_name from poetry.config.config import Config from poetry.console.commands.command import Command from p...
da06fe0c81ce2ba2c153d4e4cdfc360ee9ef69ec7941e8d2e3b42b8c5a0da600
Python
2,817
84
import os from pathlib import Path import torch from utils.data.dataholder import DataHolder from utils.data.misc import to_batch def on_test_epoch_start_func(self) -> None: """Reset test metrics and prepare output directory.""" self.test_step_outputs = [] save_dir = self.cfg.test.save_dir or "test_outpu...
f041c05493b61d5d312c4206255f0e9d64dba430dab3fe3dc97f283d7722709d
Python
2,819
75
# -*- coding: utf-8 -*- """ Created on Fri May 3 14:54:08 2019 @author: Patrick Cody | pac94@pitt.edu | pcody1@gmail.com """ #based upon: https://rochefort-lab.github.io/fissa/examples/cNMF%20example.html #%% INPUT PARAMS ###################### ONLY EDIT THIS (after 'r') ######################### #a...
31575be097ab964baa3f92b001eca3d1482c0cd6549c7afc509a553cfe57d09e
Python
2,821
73
"""Run SIESTA SZP on the 50 active-learning iter-3 (non-strain) picks.""" from __future__ import annotations import argparse import json import sys import time from concurrent.futures import ThreadPoolExecutor, as_completed from pathlib import Path from ase import Atoms ROOT = Path(__file__).resolve().parents[2] sys...
3eb34442ca9b4974363b4f89c9e44bb8b77f1b687184bb70522d2b747a2c2a9d
Python
2,821
70
from os.path import join, dirname import numpy as np import pandas as pd from sklearn.model_selection import train_test_split current_dir = dirname(__file__) input_dir = 'raw_data' output_dir = 'splits' input_dir = join(current_dir, input_dir) output_dir = join(current_dir, output_dir) def get_response(): filen...
f6a84cfbb90eca254a43c8a941151c4856fb43eecc51883476cbe2bb98514146
Python
2,821
73
"""Run SIESTA SZP on the 50 active-learning iter-2 (non-strain) picks.""" from __future__ import annotations import argparse import json import sys import time from concurrent.futures import ThreadPoolExecutor, as_completed from pathlib import Path from ase import Atoms ROOT = Path(__file__).resolve().parents[2] sys...
29dc5274fdcd2998aa5126dafeb7974665bbf440af96516f6b1de19fbaf2090e
Python
2,825
89
# Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
35b2709eaa5cb3a92bbcc28333b61aafe1fa36e42e45dbbbecb809cb4a1a751c
Python
2,825
96
# -*- coding: utf-8 -*- """ Created on Mon Aug 26 22:18:56 2019 @author: 俊男 """ # In[] KMeans import numpy as np import pandas as pd import matplotlib.pyplot as plt import time from sklearn.cluster import KMeans from sklearn.preprocessing import MinMaxScaler class KMeansCluster: __cluster = None __best_k =...
a6cf052e86de3f6819a2defdcacc7724380ca1b6c5213b76c68af86681e88653
Python
2,827
72
import torch from torch import nn from ..downstream_module import DownStreamModule class SelfAttention(DownStreamModule): """ contact predictor with attention """ def __init__(self, backbone_args, backbone_alphabet, num_classes, symmetric=False, depth_reduction="mean"): """ :param depth...
a10fb087023026940105fe2442c9d770ecbba8fb918b507c4fc8693fe946e684
Python
2,828
88
import pytest import torch import vak.metrics.boundary_detection from .conftest import PRECISION_RECALL_FSCORE_RVAL_TEST_CASES @pytest.mark.parametrize( 'test_case', PRECISION_RECALL_FSCORE_RVAL_TEST_CASES, ) @pytest.mark.parametrize( 'metrics', [ "precision", "recall", "fsco...
e8a956d87533de74efc7227183c9d9e4923012c35b18b98f155e7fbeb0a87b84
Python
2,829
87
"""U-Net for dense segmentation (with optional bilinear upsampling).""" import torch import torch.nn as nn import torch.nn.functional as F class SingleConv(nn.Module): """Convolution => BN => ReLU => Dropout.""" def __init__(self, in_channels, out_channels): super().__init__() se...
0bc1e35bc30af26820833d7de55067fdfba900cdad71e71c2e7330acc0ab500b
Python
2,830
104
from __future__ import annotations from typing import TYPE_CHECKING from typing import Any from typing import cast from poetry.core.poetry import Poetry as BasePoetry from poetry.__version__ import __version__ from poetry.config.source import Source from poetry.pyproject.toml import PyProjectTOML if TYPE_CHECKING:...
50b5c8366a86b91a08eff9e0bae452d11e4b9a5993b9aa7eff29e3fc6bf08645
Python
2,830
93
__author__ = 'heroico' import sqlite3 import numpy from .. import KeyedDataSet from .. import Exceptions import os class DBLoaders(object): @classmethod def loadKeyedDataSetFromDB(cls, db_path, table_name, key_column, value_column): if not os.path.exists(db_path): raise Exceptions.BadFil...
5782b04d3fd0414c799ca3224294b0a4c695aaa6b559460d650a82dc4a743b1d
Python
2,831
139
# -*- coding: utf-8 -*- """ Created on Thu May 8 17:56:53 2025 @author: hanna """ """ Main script for executing all processing scripts on (sample) data [Step 1] process behavioral+neural data files (.hdf) & decoder files (.pkl). [Step 2] determine trial lengths for each trial [Step 3] compute behavior...
a46118e8df73a76d5e5e212a24eb384233ef5702955c37b284a8a977c96a6e77
Python
2,831
47
#!/usr/bin/env python ''' (c) 2016-2020 Oleksandr Frei, Alexey A. Shadrin, Dominic Holland MiXeR software: Univariate and Bivariate Causal Mixture for GWAS ''' import logging import sys import argparse import common.utils_cli import bivar_mixer.figures from version import VERSION as __version__, MASTHEAD if __name_...
394e75709d8c48d3eade2e5fabf563fa757d399fa85f42cda3fc9d2a593b8686
Python
2,834
78
# -*- coding: utf-8 -*- # Copyright (C) 2023 Phillip Alday <me@phillipalday.com> # License: BSD (3-clause) """Savitzky-Golaf IAF tests.""" from nose.tools import assert_raises, assert_sequence_equal from philistine.mne import attenuation_iaf, savgol_iaf from philistine.mne.utils import _generate_raw def test_basic_...
b831f5e2f8aa87a3e471fca7a5952206e1531e8aec5c6311b0210d3d347f74fa
Python
2,835
63
#!/usr/bin/env python -u # 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 soundfile as sf import tempfile from pathlib import Path import os import subprocess import sy...
268e1a85441029b7fee4f91cb5f34f903315a66dfbc7824eeb484a68484a9349
Python
2,838
92
from __future__ import annotations import os import re import subprocess from typing import TYPE_CHECKING from typing import Any from poetry.utils._compat import WINDOWS from poetry.utils.env.virtual_env import VirtualEnv if TYPE_CHECKING: from pathlib import Path from poetry.utils.env.base_env import Env...
54dc36107d06636d829d21ae0ad345a80e3aeae4982fda3f736100e252c73329
Python
2,838
76
from __future__ import annotations from os.path import join import pytest import torch from scvi.nn import Embedding @pytest.mark.parametrize("num_embeddings", [10]) @pytest.mark.parametrize("embedding_dim", [5]) @pytest.mark.parametrize("init", [2, [0, 1]]) @pytest.mark.parametrize("freeze_prev", [True, False]) d...
ac6b82704dc8d3f4e8f0803d87b2b9d96c4e4eadf7f1805bc08dce66b66adf2c
Python
2,838
92
__author__ = 'heroico' import numpy import logging import Utilities import Exceptions class MTF(object): """Matrix table format""" GENE = 0 RSID_1 = 1 RSID_2 = 2 VALUE = 3 def loadMatrixFromFile(file): class MatrixBuilder(object): def __init__(self): self.build_up = {} ...
790add6776f3580fda15244b7e4ac31002e14f08e3b3cd71a5a23b28de7400eb
Python
2,842
71
import pandas as pd import os def get_events(edfpath,contains_regex=None,min_dur=None,max_dur=None,min_onset=None,max_onset=None): from mne.io import read_raw_edf # Load annotations from .edf file annots = read_raw_edf(edfpath, preload=False, verbose='ERROR' ...
a9c4c0ae777673712ff17ee2bb425d0eda26ef55ea7fc74e6e78199937c8047a
Python
2,842
80
# Copyright 2017 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
35cae684701b08981c46bb4a3096428c747ea59599413259169d96fbb13bba03
Python
2,843
79
#!/usr/bin/env python # PYTHON_ARGCOMPLETE_OK """Launches the MDT maps visualizer.""" import argparse import os import textwrap from argcomplete.completers import FilesCompleter from mdt import view_maps from mdt.visualization.maps.base import SimpleDataInfo from mdt.lib.shell_utils import BasicShellApplication __auth...
d0ff9b8a23d20c24c8f15c2582f93c57b31b63236ed46167b783e0d0f225bbbd
Python
2,844
83
import functools from typing import Any, Callable, Sequence, TypeVar import jax import jax.numpy as jnp import jax.tree_util as jtu F = TypeVar('F', bound=Callable) def batched_vmap( fn: F, max_batch_size: int, in_axes: int | None | Sequence[Any] = 0, out_axes: Any = 0, ) -> F: if isinstance(in_...
fdcf8bc77e66c44a7eee81bcb87d7ffb1dce3729fbb452f3cf762e71a9a1ec79
Python
2,846
90
"""Tests for ``aestetik.utils.utils_data`` (prepare_input_for_model, build_grid, calibrate_transcriptomics_morphology_ratio). """ from __future__ import annotations import numpy as np import pytest from aestetik.utils.utils_data import ( build_grid, calibrate_transcriptomics_morphology_ratio, prepare_inpu...
c9683fbaba45d210185bd98c76937e6a5f1da5821e4c1d8ca53925b0701d8a2f
Python
2,847
78
# 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 fairseq.model_parallel.modules import ModelParallelMultiheadAttention from fairseq.modules import TransformerDecoderLayer, TransformerEnc...
41ad9cb2adb688ac66f2272a73a59f3ef39dbc6523c403719f9e5cd57e42f121
Python
2,848
87
import re from typing import Collection, Iterator from brenda_references.config import config from taxonomy import ncbitax from tinydb import TinyDB from tinydb.middlewares import CachingMiddleware from tinydb.storages import JSONStorage from tinydb.table import Document, Table from tqdm import tqdm def strain_queri...
c04ad2aa394b430a2be8d8c8a0dc446c94699f3654909f8e516105c6117fd4b7
Python
2,849
86
from pathlib import Path import re import tempfile INCLUDE_RE = re.compile(r'^(\s*#include\s+)([<"])([^>"]+)([>"])(.*)$') def comment_gromacs_cmap(line, in_cmap=False): stripped = line.lstrip() active = bool(stripped) and not stripped.startswith(';') section = re.match(r'\[\s*([^\]]+?)\s*\]', stripped) ...
03cfc56af928a386489b75ce3a229c0598e9a85abac44ba87346afd7deb5043e
Python
2,850
83
import gzip import io import pandas import logging from .. import Utilities def data_frame_streamer(path, sentinel_column, sentinel_white_list=None, sentinel_suffix=None, additional_skip_row_check=None): _check_sentinel(sentinel_white_list, sentinel_suffix) found = set() def _ogz(p): return io.T...
d1851753b1c74bf0352ff5b6229ad559902b302e295bb41633142dafe9c03be2
Python
2,850
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. import torch.nn as nn from fairseq.models import FairseqEncoder from fairseq.modules import LayerNorm, TransformerEncoderLayer class Transf...
6e76fc0a7a3831c01cfffd18c220d44438073a66338d91ca61fc84b924021e61
Python
2,851
78
#!/usr/bin/env python # # Copyright 2009, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
a799fd016d6fd35993da8510911ea87410ef1ca40e3dd7b9eeb9dd5b45da60e6
Python
2,853
98
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import from __future__ import division from _...
e5ebe90066461ce4ecc555e64ecf60c5a41e65483448be53cd828ad8d077442e
Python
2,856
75
"""Argparse `type=` callbacks and defaults shared by more than one CLI.""" import argparse import pathlib from collections.abc import Sequence def non_negative_limit(value: str) -> int: """Reject a negative `--limit` before it reaches the corpus loaders. `load_split` refuses one too, but a `ValueError` out ...
04021f06d61a043f4fdac98ea3fd7c35c705ce0550f2fa0f52377ed8d2ecd032
Python
2,857
93
# @license # Copyright 2023 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...
e333ee4ebd6ff4d4420cbcff6d52cf4a3118c6e1de3b55563cf6d637efce65cc
Python
2,857
63
import torch.nn as nn import torch import torch.nn.functional as F import config.cfg_lodet as cfg class MSigmoid_approx(nn.Module): def __init__(self): super(MSigmoid_approx, self).__init__() def forward(self, input): return (torch.clamp(torch.sigmoid(input),0.011,1)-0.01)/(1-0.01) class DSC_H...
a73b15a3803c12d078a1064710cd88b70f8d12330ef2cf7b6655c7b2d569bcd8
Python
2,858
65
import torch from batchgenerators.utilities.file_and_folder_operations import save_json, join, isfile, load_json from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer from torch import distributed as dist class nnUNetTrainerBenchmark_5epochs(nnUNetTrainer): def __init__(self, plans: dict, confi...
da941fafe60a8037b3d8f963356635dcbe2f956224e18c2918cdcb5b3fc14179
Python
2,859
90
import os import unittest from unittest.mock import patch from pyecharts.datasets import ( EXTRA, FuzzyDict, register_url, register_files, register_coords, ) class TestDatasets(unittest.TestCase): @patch("pyecharts.datasets.urllib.request.urlopen") def test_register_url(self, fake): ...
e5d57dabdc08e5a576bbed7b23ef705669246ac0a764989a5bc939ad8963f6e9
Python
2,860
132
import argparse import csv import os import h5py import numpy as np import random from process_pretrain_data import get_kmer_sequence from multiprocessing import Pool def generate_example(X, Y, kmer, index): # assert X.shape[0] == Y.shape[0] lines = [] for j in range(len(X)): if j % 1000 == 0: ...
511d10ad81998ce123213460dc08ab134d6ace7c5228568830e8c620eabdd00c
Python
2,861
49
from argschema import ArgSchema, ArgSchemaParser from argschema.schemas import DefaultSchema from argschema.fields import Nested, InputDir, String, Float, Dict, Int, NumpyArray from ...common.schemas import EphysParams, Directories class NoiseWaveformParams(DefaultSchema): classifier_path = String(required=True, ...
7ec554052ead2f6e9dd218b63e9a4c34209eeac523af7aad9325440f581eedcb
Python
2,864
92
from __future__ import annotations from typing import TYPE_CHECKING from typing import ClassVar from cleo.helpers import argument from cleo.helpers import option from poetry.console.commands.init import InitCommand if TYPE_CHECKING: from cleo.io.inputs.argument import Argument from cleo.io.inputs.option im...
ff876a3d5f3e6349093293ab7b72000c34a6e024e86c4644408bb3409980a5f5
Python
2,866
84
"""`brenda_references` must declare no console script it cannot ship. The shim runs with the venv's `bin/` as `sys.path[0]`, so the module has to be part of the installed distribution. This package is src-layout: its editable install puts `brenda_references/src` on `sys.path`, which leaves the sibling `scripts/` reach...
5482a875a65cb985b7e93cd1f3685e0cdc5a1819e711518e137695e71a3c07eb
Python
2,867
68
# -*- coding: UTF-8 -*- """ @Project: iDCF @File : main.py @IDE : PyCharm @Author : hjguo @Date : 2025/7/9 11:35 @Doc : Main function """ import os import torch import pandas as pd from iDCF.utils import load_data, load_data_from_path, load_knowledge from iDCF.train import train, prediction def main(data_na...
188077e0f50222357dcc9cf27b1ff44f41267d030e6ba68c67beb525cb48a74d
Python
2,868
82
import itertools import pandas as pd def load_TREC_data(input_path: str) -> pd.DataFrame: trec_df = pd.read_csv(input_path, delimiter="\t", names = ["Topic", "Zeros", "PMID", "Relevance"], usecols=["Topic", "PMID", "Relevance"]) return trec_df def get_unique_topics(trec_df: pd.DataFrame) -> list: # Get u...
d203dd1a01dfd118517d0a9c6cdd9387a9a86b70df44daf9e80009da8fc5b28d
Python
2,868
86
import numpy as np from typing import Union def grid_xyz(dx, grid_size): return np.meshgrid( np.arange(grid_size[0], dtype=np.float32) * dx, np.arange(grid_size[1], dtype=np.float32) * dx, np.arange(grid_size[2], dtype=np.float32) * dx, indexing='ij' ) def sphere_m...
9b6cb457df87a154f306057a80a4223a6a20e918397a56239398c43eca1a1a67
Python
2,869
99
# 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 import defaultdict import numpy as np from misc.bleu_utils import sentence_bleu import json import warnings def get_args()...
fd417fef562019a14335a8c7b850912c54e6ebd34cb8c2f7e52e22d667f8d190
Python
2,869
90
#!/usr/bin/env python # Written by Senthilkumar Panneerselvam and released under the MIT license. import argparse import logging import os # Create a logger logging.basicConfig(format="%(name)s - %(asctime)s %(levelname)s: %(message)s") logger = logging.getLogger(__file__) logger.setLevel(logging.INFO) mqc_main = "...
904a80a46a577b93d47c15406b5e994423dcfe132bdd8ab51f22f180188ff3e2
Python
2,872
79
#!/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 use...
0b8968547d53b008b0f331068706e410eebf9731faf7cf8f8d01dc370b3cd0b7
Python
2,873
65
# Copyright 2020 The Lucent Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
3ef99390f61409e932993586eccd7296755e313a005bf1eb0a17f48d8feb3e3c
Python
2,873
93
# This script reformats the output of IUPred2A to be compatible with IsoformAnalyzeR from src.utils import read_gtf from io import StringIO import polars as pl def split_and_insert(list_A, list_B): result = [] header_index = 0 if header_index < len(list_B): result.append(">" + list_B[header_index])...
9f73a504c76cf1d1070da1c9bbee0e847784ab66bf79eca0b85ac8d7069c2d7a
Python
2,873
82
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from typing import Optional, Tuple, Union import torch from mattergen.diffusion.corruption.sde_lib import SDE, VESDE, VPSDE from mattergen.diffusion.data.batched_data import BatchedData B = Optional[torch.LongTensor] def wrap_at_boundary(x: ...
cd79a1d5b8c7714638cdf63fc65e587aef3009f34dc2e133bac3f2c440515878
Python
2,874
100
import torch import torch.nn as nn def conv3x3(in_planes, out_planes, stride=1): "3x3 convolution with padding" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) ...
74047b15536e9af31e97dce1037f8c386a927fb6f4761e5e5df5a0d123e0aea7
Python
2,877
67
import importlib.util import os from pathlib import Path import struct import subprocess import sys import tempfile import unittest ROOT = Path(__file__).resolve().parents[1] spec = importlib.util.spec_from_file_location('windows_pe', ROOT / 'tools/windows_pe.py') windows_pe = importlib.util.module_from_spec(spec) spe...
5319cc584c34a6a19bb9b4d67c26b036407e927b560ccb42c3f8f700dfb16bd8
Python
2,878
68
# -*- coding: utf-8 -*- """ .. _tutorial02_ref: Tutorial 2: Types of Surfaces ============================= This tutorial covers what types of surfaces that can be plotted with ``surfplot``. Types of surfaces ----------------- Put briefly, ``surfplot`` can take file paths to any valid surface file(s) with geomet...
98f5c06c20e0b55562a1e69a3fefbb2307d4145ae2353cae2ac0c4cd352402b6
Python
2,878
70
#!/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 use...
30756ffbd318aebdf7aaf7d069f5f14f4d433d830141d92a620a2f8d51aa939a
Python
2,881
100
import torch import wandb from metrics.evaluation_statistics import compute_RSSD from utils.data.dataholder import DataHolder from utils.data.misc import to_batch def on_validation_epoch_start_func(self) -> None: """ Callback function called at the start of each validation epoch. Returns: - None ...
6a49123b80ee112b33f9c2a24639ab0cd08c38a8a35ac3c0b162c92a4cec5891
Python
2,881
96
import time import RPi.GPIO as GPIO class mainprogram: #Main while loop condition keepalive = True # DEFINE NUMBER OF BUTTONS AND ORDER IN ARRAY buttonarray = ['movefast', 'bregmahome', 'relativeML', 'relativeAP', 'moveslow', 'HomeToABSzero', 'recalibrate', 'miscbuttonA', 'presetwor...
b48de242514095d5e593c718a212f68024f647af4223feb431e9dece66d1c158
Python
2,881
88
#!/usr/bin/env python # Author: Jin Lee (leepc12@gmail.com) import sys import os import argparse from encode_lib_common import ( mkdir_p, log, ls_l, rm_f, strip_ext_fastq) from encode_lib_genomic import ( get_read_length, remove_chrs_from_bam, samstat, samtools_index) def parse_arguments(): parser = arg...
6d6c7eccce21ca33757752b21a363722cd68093fdb5aa1d40ac47a37678640b4
Python
2,882
58
import torch from torch.optim import Adam, AdamW from nnunetv2.training.lr_scheduler.polylr import PolyLRScheduler from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer class nnUNetTrainerAdam(nnUNetTrainer): def configure_optimizers(self): optimizer = AdamW(self.network.parameters(), ...
ba32e856d48f04d29f3bbaf4ab10e07094b364e6e85477c18d3fb68ee0466b14
Python
2,882
75
from sklearn.neighbors import NearestNeighbors import numpy as np import pandas as pd def calc_neighbor_prop( adata, batch_key='replicates', celltype_key='Cluster', n_neighbors=25, spatial_key='spatial', output_key=None ): """ Normalize the cell ty...
5b8241fed91ef64a696503dcff8d083d873b5916d38ca8c30214bf6245465b4f
Python
2,883
89
# encoding: utf-8 """ @author: Jiayang Chen @contact: yjcmydkzgj@gmail.com """ from .datasets import build_dataset from .transforms import build_transforms from .samplers import build_sampler from .collate_function import build_collate_fn from torch.utils.data import DataLoader def find_dataset_type(dataset_name):...
dc3fc6f71be5d9ded39a408822b591ba3cf57f696e7d4651bc40e97710b4ee2a
Python
2,884
74
import numpy as np import pandas as pd from sklearn import metrics import scanpy as sc import ot from sklearn.decomposition import PCA def mclust_R(adata, num_cluster, modelNames='EEE', used_obsm='emb_pca', random_seed=12345): """ Performs clustering using the Mclust algorithm in R. Thi...
89d13e41635524edc7776802b83998ee39d73ee8c120cbe276a10084024b6fa4
Python
2,893
85
""" 01_pcdh_coexpression.py Within-region protocadherin co-expression analysis (Table 1). Computes Pearson and Spearman correlations between all PCDH gene pairs within each of 13 GTEx brain regions. Harbert D. (2026) BMC Genomics """ import sys, os sys.path.insert(0, os.path.dirname(__file__)) from utils import * d...
01ff7098c342fda86a1eeaeb414be414c438d4bb937c348f07b49b99daffc706
Python
2,894
118
"""FISSA functions to handle image and roi objects and return the right format. If a custom version of this file is used (which can be defined at the declaration of the core FISSA Experiment class), it should have the same functions as here, with the same inputs and outputs. Authors: Sander W Keemink <swkeemink@s...
0b03c299122823d95b59ce9d925bde5b03da617e790a9337437a443ffa620fd4
Python
2,894
107
import torch.nn as nn import torch.nn.functional as F from .resnet3d import BasicBlock3D, Bottleneck3D, ResNet3D __all__ = ["FastNet", "resnet18_fast", "resnet50_fast"] class FastNet(ResNet3D): def __init__( self, block, layers, fusion_kernel_size=(5, 1, 1), fusion_stride...
3554a1b830b0211a271294b4669513b1e057b76e2de8fbe5d1ca48ea5605ccea
Python
2,894
98
# -*- coding: utf-8 -*- """ @Time:Created on 2019/9/25 10:03 @author: LiFan Chen @Filename: main.py @Software: PyCharm """ import torch import numpy as np import random import os import time from model import * import timeit import pickle def shuffle_dataset(dataset, seed): np.random.seed(seed) np.random.shuf...
3ac0952292d835ebd356011143ab4916c5160af13e182eefeb327361ff28df1b
Python
2,894
74
import numpy as np from spacestream.core.constants import ROI_NAMES STREAM_NAMES = ROI_NAMES[-3:] def prep_smoothness( mapping, scaled_target_distances, scaled_source_distances, HVA_idx, by_stream ): if HVA_idx is None: unit_idx = np.arange(0, len(mapping["winning_idx"])) else: # voxel2voxel H...
0c95772341a0b1781505a8cf5d5d15e61b5232cb0a9e7bec1da3f873d3a5b1d6
Python
2,895
69
from src.utils import read_gtf import polars as pl def main(): annot_peptides_hybrid = read_gtf("nextflow_results/V47/orfanage/annot_peptides_hybrid.gtf", attributes=["gene_name", "transcript_id", "detected", "type", "novelty"]) gencode = read_gtf("/Users/xunuo/Genomic_references/GENCODE/gencode.v47.annotation...
32b5976263d948fc2c4c8f7b137c45a6ec7e2350d331c57c2997e4ba6fefb0bb
Python
2,895
76
from mdt import CompartmentTemplate, FreeParameterTemplate, LibraryFunctionTemplate __author__ = 'Robbert Harms' __date__ = '2019-11-14' __maintainer__ = 'Robbert Harms' __email__ = 'robbert@xkls.nl' __licence__ = 'LGPL v3' class CylindersPoissonDistr(CompartmentTemplate): """Poisson Distributed Radii cylinders,...
c36fa09cc4b8f21d337edd934b5e1931072ed81ec07766af79cfd2d7db343eb3
Python
2,895
65
from functools import lru_cache import numpy as np import torch from typing import Union, Tuple, List from acvl_utils.cropping_and_padding.padding import pad_nd_image from scipy.ndimage import gaussian_filter @lru_cache(maxsize=2) def compute_gaussian(tile_size: Union[Tuple[int, ...], List[int]], sigma_scale: float ...
fc6e1f097b1d9d41fce8665496ef4c45fec51198b57428ed71033633ce6f76ab
Python
2,895
71
# 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.search import Search class NoisyChannelBeamSearch(Search): def __init__(self, tgt_dict): super().__in...
3e2136f95c97996101692cb1069d5a99105bb5d1aee2a207b560a355247a7618
Python
2,896
54
#!/usr/bin/env python3 """Build figure-adapter tables from the complete-case (no-imputation) proteomic re-analysis. Rationale: MinProb imputation assumes missingness is left-censored (MNAR) and fills absent values with low intensities. Where missingness differs between groups this manufactures an effect. ITGB2 in the ...
69a225470dd7292b1fe5e0ce9c49b35f58119c574111dd835bee8027f0949e44
Python
2,896
87
# 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 argparse import ArgumentParser from dataclasses import dataclass, field from fairseq.dataclass import FairseqDataclass f...
9748f8ab029f7407427b9223a6360e82b0b211209c9f3cda6d96ba54d705dec0
Python
2,896
73
import numpy import pandas import logging from bgen import BgenReader from ..misc import Genomics def bgen_file_geno_lines(file, variant_mapping = None, force_colon = False, use_rsid=False, whitelist=None, skip_palindromic=False, liftover_conversion=None): logging.log(9, "Processing bgen %s", file) bfile = Bg...
c542f1401aa7025e160da3901f916b94c84f9d2ffaa403c59e652d273875b7e0
Python
2,897
90
''' Tests for datahandler_framebyframe.py ''' import os import numpy as np import imageio from PIL import Image from .base_test import BaseTestCase from .. import datahandler_framebyframe as datahandler from .. import roitools class TestImage2Array(BaseTestCase): ''' Tests for image2array.''' def setup_clas...
da06d5e403d930abf9958f2504482ea25eda167ba73dec506546096b5638179f
Python
2,897
58
import numpy as np import torch from nnunetv2.training.loss.compound_losses import DC_and_BCE_loss, DC_and_CE_loss from nnunetv2.training.loss.deep_supervision import DeepSupervisionWrapper from nnunetv2.training.loss.dice import MemoryEfficientSoftDiceLoss from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnU...
420138b2820c0cd4a4560bb33b93d5418bcaa832d31164f4020527994f3b3da9
Python
2,898
102
"""fixtures relating to audio files""" import pytest from .annot import LABELSET_NOTMAT, ANNOT_LIST_NOTMAT from .test_data import SOURCE_TEST_DATA_ROOT @pytest.fixture def default_spect_params(): return dict( fft_size=512, step_size=64, freq_cutoffs=(500, 10000), thresh=6.25, ...