sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
3d62984abbaf13458054569ecfd519d4bf4169ec0353155340f360d0c3bbed38
Python
2,072
57
import torch.nn as nn import torch from typing import List, Dict class ClosedFormLinearModel(nn.Module): def __init__(self, n_cells: int, height: int, width: int, train_with_gradient_descent: bool = False): super(ClosedFormLinearModel, self).__init__() self.linear_filters = nn....
a2d397d0fc1b6521b30a0dc4891c269a270dcbcbc34218e98ea69771618a6d6b
Python
2,073
67
import unittest import numpy as np import pytest import torch import pfrl assertions = unittest.TestCase("__init__") @pytest.mark.parametrize("in_size", [1, 5]) @pytest.mark.parametrize("out_size", [1, 3]) @pytest.mark.parametrize("hidden_sizes", [(), (1,), (1, 1), (7, 8)]) @pytest.mark.parametrize("normalize_inpu...
7c1f9001f8bf801d02413d898bfbc61436e588dccc10f96ea020ce8cda2e957c
Python
2,074
73
r""" Copy from scglue: https://github.com/gao-lab/GLUE/ """ import pandas as pd import numpy as np import anndata as ad from anndata import AnnData import scipy.sparse from sklearn.preprocessing import normalize from typing import Optional import sklearn.utils.extmath from typing import Optional, Union Array = Union[...
ecc86ee88b073d23649e566c9aa17023baa2a6317fe21bc3581558653807ee46
Python
2,074
46
import os import itertools # Get the root path of the directory ROOT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) # Return the absolute path of a relative path def absolute_path(path, isdir=True): return os.path.abspath(path) + ("/" if isdir else "") # Take a JSON config file, with <t...
3f83f03a0da48da8ad7e818d092955846abf8acafbf09fe113331c453c2e8585
Python
2,077
75
## Nicolas Servant ## ## HiC-Pro ## Copyright (c) 2015 Institut Curie ## Author(s): Nicolas Servant, Eric Viara ## Contact: nicolas.servant@curie.fr ## This software is distributed without any guarantee under the terms of the BSD-3 licence. ## See the LICENCE file for details import re ...
6cc81ade4f3dc35102ff50243826167088420662b4d2ebb3a311c8164b93c927
Python
2,077
52
import numpy as np import collections as c import torch class Buffer(object): def __init__(self, o_dim, a_dim, bs, device='cpu'): self.o_dim = o_dim self.a_dim = a_dim self.bs = bs self.device = device self.o_buf, self.a_buf, self.r_buf, self.logpb_buf, self.distb_buf, sel...
4740a7af9836d537c3d3f19a486dadb46a741256339b81a948db0573bd2a2f7d
Python
2,078
68
""" Suite of functions that help display movie """ import matplotlib import matplotlib.pyplot as plt import tifffile as tiff import cv2 import numpy as np from csbdeep.utils import normalize def display(filename, display_length, norm_min_percent, norm_max_percent): """ Display movie using o...
6b2bf028550432f9af58c7abb996500106211449d845ec7b355ca73e014bb42b
Python
2,078
52
from multiprocessing import Pool, Manager import subprocess import os import pandas as pd import code # code.interact(local=dict(globals(), **locals())) def run_bash(bash_cmd): """ Run bash command. Return a list containing standard output, line by line. """ popen = subprocess.Popen(bash_cmd, st...
9fb5302da5e9a70f8a19ff36e0460a2a81fde58d4e7d2fc439311c9b63e6e55c
Python
2,078
67
# built-in dependencies from typing import Any, List, Union # project dependencies from deepface.commons.onnx_utils import build_session from deepface.models.facial_recognition.onnx.OnnxFacialRecognition import OnnxFacialRecognition from deepface.commons.logger import Logger logger = Logger() # pylint: disable=line-...
d1641fef2b055143332fe6ad13eb0c5d6f442f847248e3bd7ef5a1891d4fd854
Python
2,078
49
import inspect import warnings from typing import Any, Dict, Optional, Union from packaging import version def deprecate(*args, take_from: Optional[Union[Dict, Any]] = None, standard_warn=True): from .. import __version__ deprecated_kwargs = take_from values = () if not isinstance(args[0], tuple): ...
dda1eba7e811ac273563474cca268af58f8380b7ab59d0e9de5566acbb4ccfcd
Python
2,079
69
#!/bin/python # file: Doxytag.py # brief: Parse doxygen.tag file # author: Andrea Vedaldi """ DOXYTAG parses doxygen.tag files. """ import xml.dom.minidom import sys import os import re __mpname__ = 'Doxytag' __version__ = '0.1' __date__ = '2013-07-09' __description__ = 'Doxygen t...
5ea5aace5cb0be6c883e51b15203669976180b8d030d16e5f1626bc329213e63
Python
2,080
71
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Utilities for the AIHW Composer API.""" from os import getenv, path from typing import Dict from configparser import ConfigParser DEFAULT_URL = "https://api...
32bf8844fd3cd95e2c1ddd36f26c13cfd71d37de9b63cb82f54df1635950f5ba
Python
2,081
51
import Utility_working as Utility #custom-made utility file, contains lengthy functions from constant import * import numpy as np import matplotlib.pyplot as plt import matplotlib.pyplot as plt import sys import os #These should all be pulled from the constant file. Only change this if it's not set in the cons...
4dd3f332864111b5e8f99c851ff0e20fbae2a3ff4942b273a39391c0f47722e8
Python
2,081
57
"""Vendored SAMap (Tarashansky et al. 2021, eLife) + sam-algorithm. Source: https://github.com/atarashansky/SAMap (Tarashansky, Musser, Khariton, Li & Wang, Stanford University). Upstream is MIT-licensed; the license is carried verbatim beside this file in ``LICENSE`` and applies to every source file in this directory...
e7252ea6f8e1bfb625a443c3ae80d0ee8ebb9f0e9b98494fae152c7f76b22878
Python
2,081
59
r"""Lazy-import dependency gates for :mod:`omicverse.mol`. The structural-biology stack is optional — heavy backends are imported *inside* the functions that use them, and a missing one raises a clean, actionable :class:`ImportError` naming the pip extra to install. """ from __future__ import annotations import impo...
07a2059d0516035db29e72d091fbf5ef2ecc003d2f5135ef3a2b06188477220b
Python
2,082
61
"""Configuration options for pytest See Also: * https://docs.pytest.org/en/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option """ import pytest def pytest_addoption(parser): """Define customized pytest flags. Examples: >>> pytest tests/test_sklearn.py --runfas...
bc65a8f458b744b69b053ee19e8e8c6089b3e75dbb6179da3832eabc05c4de5a
Python
2,082
43
import logging, os, datetime import pandas as pd from Embedding.retrospective_validation import single_model_term_similarity, is_in_dataset from misc.save_files import write_pickle, read_DocTermDict, read_pickle from Embedding.load_w2v_models import load_current_joined_model def specific_term_validation(config: dict)...
022236784db9cd9b8a86a49e0a5b83ce20145fb40f1d34f687727c7bc0b78a7e
Python
2,084
71
import serial from time import sleep import numpy as np class OpticalPower: open_flag = False def __init__(self, port='COM8', flag=True): self.port = port if flag: self.open() def query_hex(self, hex_ord): self.op.write(bytes.fromhex(hex_ord)) s...
7ef7521bfab63ee63e8b1c54d7e31eef8d5d398cb0005593cd9d6bbfb1a53cf4
Python
2,084
62
import json from pathlib import Path import numpy as np import pandas as pd from data_profiling import ProfileReport from data_profiling.config import Dataset from data_profiling.utils.cache import cache_file if __name__ == "__main__": file_name = cache_file( "census_train.csv", "https://archive....
95c70c2bbebe93628ec54850cc7685b5f573fe3d9779b3bda48b219bd2e513bd
Python
2,084
71
# !/usr/bin/python # ----------------------------------------- # Extract the celltype read count matrices: # ----------------------------------------- import glob import h5py import re import gzip import pickle import numpy as np import pandas as pd import time import gc import sys # If these matrices already exist, m...
bd41e92725211004cada5cd1b196500f07f05d6ba8ef5591ef4f3b80bf6515f3
Python
2,084
61
import os import torch import inspect import pickle as pk import numpy as np from glob import glob from src.data.load_data import load_params def check_path(path, verbose=True): """Check if given path (file or dir) already exists, and if so returns a new path with _<n> appended (n being the number of paths wi...
354a9506552e1ef4f1d6fe1bc95b68b8997d05ad1fa4ee6c262497af93f14919
Python
2,085
63
r""" NoCD: Non-overlapping Community Detection for single-cell data. This module implements non-overlapping community detection algorithms specifically designed for single-cell omics data. It provides neural network-based approaches for identifying discrete cell populations and communities in high-dimensional biologic...
4793ad93fbcc32f34d8fc555ed99b07409ade9cb5918238cfbe5464a371dcc8f
Python
2,085
61
import unittest import numpy as np import torch from rising.transforms import OneHot, TensorOp, ToDevice, ToDtype, ToTensor class MyTestCase(unittest.TestCase): def setUp(self) -> None: self.device = "cuda:0" self.batch_dict = { "data": torch.arange(1, 10).reshape(1, 1, 3, 3).float()...
0e6868a2717b440d3fe3fbd04310ecf405cb57842e6e5fe48320839f1c0ed770
Python
2,086
53
import argparse import ast import os import sys import torch from torch2trt import torch2trt, TRTModule sys.path.insert(1, os.getcwd()) from models_.hrnet import HRNet def convert_to_trt(args): """ TensorRT conversion function for the HRNet models using torch2trt. Requires the definition of the image re...
2421d87f8ec43316dc62efd7e9d4bd963d14ec44501f21cfa57fb22ad96355d9
Python
2,086
92
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ All the hard-coded, SFARI-specific filtering """ import argparse import sys import pysam import svtk.utils as svu # Samples with allosomal aneuploidies ANEUPLOIDIES = set([ '13706.p1', '14100.p1', '11554.s1', '12412.p1', '12860.p1' ]) # Dosage...
3b7bdcf5b2fe426b606882cc3ddfbd1b9f3575979a21ce7617938f60c79cc47c
Python
2,086
72
# __pattern_start__ import ray import time from numpy import random def partition(collection): # Use the last element as the pivot pivot = collection.pop() greater, lesser = [], [] for element in collection: if element > pivot: greater.append(element) else: less...
59d49101e14d70c4039c431e951ad75d37f979111a85b258314e3b76e841d026
Python
2,086
56
import torch from ..distances import LpDistance from ..utils import common_functions as c_f from ..utils import loss_and_miner_utils as lmu from ..miners.base_miner import BaseTupleMiner # adapted from # https://github.com/chaoyuaw/incubator-mxnet/blob/master/example/gluon/embedding_learning/model.py class DistanceW...
9b2725b24fcffc769d8a2c83eec0399624d1218cd9c295616e8aba055f232d3c
Python
2,087
62
'''Register composite max to MP2RAGE''' import nibabel as nb import subprocess import os import glob CURRDIR = os.getcwd() ROOT = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti/derivatives' TRANSFORM = f'{CURRDIR}/code/temp-faruk/sub-06_uni-to-megre_registered1_0GenericAffine.mat' MOVINGFILE = f'{RO...
169dbb5e17301db4fa23e7c29f8fac24d5c146c5ead70cee7f4a767b74224541
Python
2,089
91
import torch import numpy as np from torch.nn.functional import smooth_l1_loss '''helpers''' eps = np.finfo(np.float32).eps.item() def compute_returns(rewards, gamma=0, normalize=False): """compute return in the standard policy gradient setting. Parameters ---------- rewards : list, 1d array ...
79c99109fa6af77be838b73a7ecca1275e9ed667413be56395d9028185f9f799
Python
2,090
62
# -*- coding: utf-8 -*- from model.models import PepCA from model.models import PeptideComplexes, PepCA_dataset from time import time import numpy as np import torch import argparse import torch.nn.functional as F import datetime import os import random import pickle from trainer import * from sklearn.metrics import r...
82966833155baa98a64581900264027847ed3931a5dbdb8ee34000315d660611
Python
2,090
75
from dataclasses import dataclass, field from typing import Any, Dict, Optional import numpy as np from .node import NIRNode @dataclass(eq=False) class Affine(NIRNode): r"""Affine transform that linearly maps and translates the input signal. This is equivalent to the `Affine transformation <https://en....
1d4d47d43d3c55e0f2943a38790a185a11f09b8d515eb88737cbaf1f0a607618
Python
2,092
65
""" Cropping functional images to decrease number of voxels (and therefore processing demands) """ from nipype.interfaces.fsl import ExtractROI import glob import os # Set data path ROOT = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti' # Set subjects to work on subs = ['sub-06'] # Loop over parti...
1a15ca14e470da6f4fad226297fd170c4c74ac37344e1d9f45f9b56f807525ab
Python
2,093
49
import numpy from scipy import optimize def gaussian(amplitude, center_x, center_y, width_x, width_y): """Returns a gaussian function with the given parameters""" width_x = float(width_x) + 1e-3 # numerical stability width_y = float(width_y) + 1e-3 # numerical stability return lambda x,y: amplitude *...
1fe729861225e144defcab66db82e2710477cabb740225e980561fd4c7c06dbf
Python
2,093
79
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Thu Oct 20 15:18:21 2016 @author: agiovann """ from builtins import map import caiman as cm #%% def pre_preprocess_movie_labeling(dview, file_names, median_filter_size=(2, 1, 1), resize_factors=[.2, .1666666666], diameter...
6e66c55261b605bc66881d127feeb1af19849773fafd650c5c57b51e7755d9b5
Python
2,093
46
from model import (IntraEncoder, InterEncoder, ProteinInteractionNet, Trainer, Tester) from uncertaintyAwareDeepLearn import VanillaRFFLayer from utils import ( load_configuration, initialize_logging, set_random_seed, get_computation_device, initialize_scheduler, train_and_validate_model ) def...
da3c588beff8b8343e138cfa9c6b12154cf4894e821f48a373605a4d03429da2
Python
2,093
77
import basetest_dqn_like as base import torch.nn as nn from basetest_training import _TestBatchTrainingMixin import pfrl from pfrl.agents import CategoricalDoubleDQN def make_distrib_ff_q_func(env): n_atoms = 51 v_max = 10 v_min = -10 return pfrl.q_functions.DistributionalFCStateQFunctionWithDiscrete...
50397d84b71f884c20a42e1f740d63473ea565cef9cd55361f6ebdb60b8cd653
Python
2,094
59
import os import argparse import numpy as np """Compute the test accuracy obtained by K-fold cross validation""" def main(path): # Count the number of folds kfold_dir_runs = [] for item in os.listdir(path): full_path = os.path.join(path, item) if os.path.isdir(full_path): kfold_dir_runs.a...
0053fd2e64a7d99eba7bbcc25cb6466b07d8a7b357b44f2df9e4f5701580684e
Python
2,095
51
#!/usr/bin/env python import argparse def parse_args(): parser = argparse.ArgumentParser("Produces BED file of bam where read depth is at or above a threshold") parser.add_argument('--input_fasta', '-i', dest='input_fasta', required=True, type=str, help='Input fasta file') parser....
233fcad4aec4bddbe40ad4a43285e6442f0f1a8bbe6651aa8612a8c1fe3a3542
Python
2,095
67
GENCODE = 'hg38_gencode27.bed' LONGREAD_ONLY = 'gencode.longread_only_1k.txt' LONGREAD_ONLY_FULL = 'hg38_gencode27.longread_only_1k.bed' def generate_longread_only(): longread_only = list() with open(LONGREAD_ONLY) as input: for line in input: longread_only.append(line.strip()) gencod...
390764319e43f5c1ebaa19372231c8884a0becd137194b1c2831e05088546339
Python
2,095
65
import numpy as np import sys, pathlib sys.path.append(str(pathlib.Path(__file__).resolve().parents[1])) from params_library.cell_library import get_neuron_params from params_library.syn_and_connec_library import get_connectivity_and_synapses_matrix from params_library.params_reformat import reformat_syn_parameters_egl...
441a927ccc7899a558237a913b5731e9cc4c29f38bc1edeb567c83b35543ae30
Python
2,095
49
from lisa.core.data_interface import DataInterface import argparse import os import numpy as np import pandas as pd def main(species, window_size, cistrome_metadata, motif_metadata, index_files): cistrome_metadata = pd.read_csv(cistrome_metadata, sep = '\t').set_index('DCid') cistrome_metadata.index = cistro...
6d21fd8d978fab7f3ba2434f0aef8927e90f864a8340d45c20d8c55018be5796
Python
2,095
75
import sys from typing import List from unittest import mock import pytest from ci.ray_ci.container import _DOCKER_ENV from ci.ray_ci.windows_container import WindowsContainer def test_install_ray() -> None: install_ray_cmds = [] def _mock_subprocess(inputs: List[str], stdout, stderr) -> None: inst...
39dcdfcff3d801132511966b37e0daa756de02d4e5e1ff1aad3f6195bf75d338
Python
2,098
54
from __future__ import print_function, unicode_literals, absolute_import, division import numpy as np from scipy.ndimage.interpolation import zoom from .care_standard import CARE from ..data import PercentileNormalizer, PadAndCropResizer from ..utils import _raise, axes_dict class UpsamplingCARE(CARE): """CARE ...
c8e53bb362a066be37b358508d54816a5544ccf25c03945e113529e3175d12a5
Python
2,098
68
import matplotlib.pyplot as plt import numpy as np import scipy.io.wavfile import torch import utils font = {"size": 10, "family": "Arial"} plt.rc("font", **font) def rms_normalise_audio(x): x = x - torch.mean(x) rms = torch.sqrt(torch.mean(torch.pow(x, 2))) return x / (10 * rms) def plot_signal_and_...
f7aedb994c2e85b8d9eddff8b2c04d9a8f9d4ff4fb5b6803a1ab953af437f971
Python
2,099
62
import os import glob import argparse import numpy as np from utils import rtstruct_utils, metadata_utils from config import config parser = argparse.ArgumentParser() parser.add_argument('--dir', type=str, default="/gpfs/data/oermannlab/private_data/temporalMRI/gammaplan/", he...
d89dde0a9ab70f947b7445c13d54b0fd902fb65c16efd3ffda3ca2260fbd2aba
Python
2,101
58
import pandas as pd from data_profiling import ProfileReport from data_profiling.utils.dataframe import hash_dataframe def test_custom_sample(): df = pd.DataFrame({"test": [1, 2, 3, 4, 5]}) # In case that a sample of the real data (cars) would disclose sensitive information, we can replace it with ...
ab72cbe501ec1e008242a56573db251241b86535f45b2d3f8487f782e8e7df67
Python
2,102
71
""" Copyright (c) Meta Platforms, Inc. and 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 ase.io import matplotlib import numpy as np from matplotlib import pyplot as plt def v0_check(full_traj, initial): "...
1c80160a182796d7683218f439f7dc0543d67a7d6b66b97d1a4557e58eefc808
Python
2,105
64
import rdkit from rdkit import Chem from optparse import OptionParser from rdkit import RDLogger lg = RDLogger.logger() lg.setLevel(4) BOND_TYPE = [0, Chem.rdchem.BondType.SINGLE, Chem.rdchem.BondType.DOUBLE, Chem.rdchem.BondType.TRIPLE, Chem.rdchem.BondType.AROMATIC] def copy_edit_mol(mol): new_mol = Chem.RWMo...
6f503760658b69ae110f41d23175802fc11a2604fb76430b60efcee1890bf44f
Python
2,105
65
# -*- coding: utf-8 -*- import gseapy import csv import numpy as np import pandas as pd import gseapy as gp import matplotlib.pyplot as plt import seaborn as sns from gseapy.plot import barplot, dotplot names = gseapy.get_library_name() print(names) # After running Fatecode and detecting the import...
55bacab0a23949a6d6055be104cc8f90aab90ae04c842798577d9d06126b07f7
Python
2,106
62
# -*- coding: utf-8 -*- """ This is implementation of model of push-pull connectvity: Jens Kremkow: Correlating Excitation and Inhibition in Visual Cortical Circuits: Functional Consequences and Biological Feasibility. PhD Thesis, 2009. """ from pyNN import nest import sys sys.path.insert(0,"/home/jan/cluster/mozaik/m...
9366d559642cbc0d821dfad6f316185cc39afa7fbf888dea9af6824820e6a80e
Python
2,106
51
#!/usr/bin/env python # alternative promoter and alternative terminator import pandas as pd from prepare_and_parse import class_by_transcript_pd def identify_alternative_promoter(df, gencode, All_FilteredParsed): ''' Transcripts with first exons that match first exons of shorter reference downstream are not a...
dbb656b749175b5f7cfb3d0d751004a22fc7ce15961e3199a6cf4f3a57a492e1
Python
2,106
55
""" Copyright (c) Meta Platforms, Inc. and affiliates. 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 annotations import math import torch class SO3_Linear(torch.nn.Module): def __init__(self, in_features: int,...
7c6c5e22bdeb3b92af924b1bc831a50890f1273f96aabbc6af06b8cad02a3522
Python
2,107
47
# import from plugins/custom_unitmatch_probability.py """Show how to add a custom unitmatch probability measure.""" from operator import itemgetter import numpy as np from phy import IPlugin from phy.apps.template import from_sparse def load_probability_templates(controller): try: out = controller.model....
c99990ccb0d0aeaac684a656da013f5da7fb0d8389f25939ab17a331a6b632a6
Python
2,107
61
from torch.nn import Module, BatchNorm1d, LazyBatchNorm1d, ReLU, LeakyReLU, Conv1d, LazyConv1d, ModuleList, Softmax, Sigmoid, Flatten, Dropout2d, Linear import numpy as np CL_max = 10000 CARDINALITY_ITEM = 16 class ResidualUnit(Module): def __init__(self, l, w, ar, bot_mul=1): super().__init__() ...
abca4f288938cd9bd7b855e57d8f95106e0acc36d891900db48eab311b741276
Python
2,108
49
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
7b43061972b55e193b44f25332922bfacd04d36f97378ce17a36d0fb6e769c23
Python
2,110
65
# built-in dependencies from typing import Any, List, Union, cast # 3rd party dependencies from numpy.typing import NDArray # project dependencies from deepface.modules import verification from deepface.commons.onnx_utils import build_session from deepface.models.facial_recognition.onnx.OnnxFacialRecognition import O...
9517d32b560f3c126758a09846e7e254e932d6dbc366c1c3caf7286a670b85bf
Python
2,110
47
import numpy as np def model_predict_latents(model, dataset, dataset_test): """ Generate latent representations from a given model using training and testing datasets. This function passes batches of data through the model to obtain latent representations. It concatenates these representations for al...
d228caca3c052e71ef08eb17b1e3efb3016acac9f8e851ead9e2ed5de18f5435
Python
2,110
57
import pytest from siapy.optimizers.parameters import ( CategoricalParameter, FloatParameter, IntParameter, TrialParameters, ) def test_init(): float_params = [FloatParameter(name="fp1", low=0.0, high=1.0)] int_params = [IntParameter(name="ip1", low=0, high=10)] cat_params = [CategoricalP...
dd7fb43c912208c9d3c7fd22270476d72b4e34733ee886ad5b7f79f3cc46ffc5
Python
2,110
64
"""Code in this file is heavily based on the code from the following repository: https://github.com/CompVis/invariances""" import numpy as np import torch class AbstractDistribution: def sample(self): raise NotImplementedError() def mode(self): raise NotImplementedError() class DiracDistri...
7a79f4e60d0ebfd2340b995e0953d8ebcea654c4d384ee38d756420ae92204dc
Python
2,111
82
# flake8: noqa # fmt: off # __example_objective_start__ def objective(x, a, b): return a * (x ** 0.5) + b # __example_objective_end__ # fmt: on # __function_api_report_intermediate_metrics_start__ from ray import tune def trainable(config: dict): intermediate_score = 0 for x in range(20): interm...
ad45a0888654929e3d126a4b19a9b839f7c76a1e80a99e26494f5e3550679cc8
Python
2,112
48
import torch import torch.nn as nn from lop.utils.ltu import LTU class FixLTUNet(nn.Module): def __init__(self, num_inputs=20, num_features=80, beta=0.75): """ A feed forward neural network with just one hidden layer of LTU activation This network is used as the date-generating (target) ne...
ae879c41f05a9f365e471123092f62d4e0fd813ebe01338761f36c4d444bcb61
Python
2,113
58
import numpy as np import pandas as pd import tensorflow as tf from tensorflow import keras from keras.models import Sequential from keras.layers import Conv1D, MaxPooling1D, GRU, Dense, Flatten, Reshape, Dropout class ProposedModelFrameWork: def __init__(self, classes,input_shape): self.classes=class...
a3740cfba50602dfa0102b9a20406987e3d9c30af39dac05f4e8ce030879764f
Python
2,115
56
#!modify filter label of SR only PASS SVs: import argparse import pysam def revise_filter_Large_SR_only(vcf, fout, size_cutoff=500, sample_proportion_cutoff=0.1): records = [] for record in vcf: if 'PASS' in record.filter.keys(): if record.info['SVLEN'] > size_cutoff: SR_o...
2f05e949ee4de4c54c3229d36cd118eb5981f540378034070a5b8a117249e5ef
Python
2,116
51
# camera-ready import torch import torch.nn as nn import torch.nn.functional as F import os from .resnet import ResNet18_OS16, ResNet34_OS16, ResNet50_OS16, ResNet101_OS16, ResNet152_OS16, ResNet18_OS8, ResNet34_OS8 #from aspp import ASPP, ASPP_Bottleneck from torchvision.models.segmentation.deeplabv3 import DeepLab...
a641646451e2b9a45e4f7eecdd8c4d4c3fcd27d98710aa4009aa4455804181e3
Python
2,116
64
""" Recode lumbar rootlets values to be consecutive starting from 0 (zero represents background). The consecutive labels order is required by the nnUNet framework. For example, the script can recode: [ 0. 20. 21. 22. 23. 24. 25. 26. 27.] Into: [0. 1. 2. 3. 4. 5. 6. 7. 8.] Example usage: python recode_nii....
c521a2defd3cbd5c319340e228274313815ccfbdd80c0154b1ee87390f74fbaf
Python
2,116
52
from lisa.core.utils import LoadingBar from lisa.core.assays import LISA_RP_Assay, get_delta_RP, get_deltaRP_activation from multiprocessing import Pool import numpy as np from scipy import stats, sparse import os class ISD_Assay(LISA_RP_Assay): def predict(self, gene_mask, label_vector,*,region_scores,**kwargs):...
0617f7141855f32b599028b7ab775fc19329b92c5ef1e0d7b3ecbe04b0034960
Python
2,117
47
#!/usr/bin/env python # Matching Exons from prepare_and_parse import class_by_transcript def identify_all_matching_exons(gencode, df, All_FilteredParsed): ''' Aim: 1/ Identify transcripts with complete matching coordinates to known exons, must contain all exons 2/ Identify transcripts with misma...
17e44aba3ca937d5305092d746812d15331bbde1a1e7cae09a77d79fd76d384b
Python
2,117
61
"""Split each echo to prepare for registration.""" import os import subprocess import numpy as np import nibabel as nb import glob # ============================================================================= DATADIR = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti' # Set subs to work on SUBS = ['s...
1d57d0cfb265074944fa9985897016d054a78b06b76642dd49030fbd1fe411c4
Python
2,118
73
# Copyright (c) 2017-present, Facebook, 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...
7afe39386eb7c9acd84ee78d8e72c05e9797a49f3ad1f291715a0d4c9f14e136
Python
2,118
82
r""" This module contains several low level plotting function used mainly in simple_plot module. """ import pylab import mozaik from matplotlib.ticker import FuncFormatter logger = mozaik.getMozaikLogger() def disable_top_right_axis(ax): for loc, spine in ax.spines.items(): if loc in ['right', 'top']: ...
632b03cb91f5eb8c3fba48878db115ab1824bc9884f04435670a2e9f16405eb4
Python
2,120
108
import sys import numpy as np try: import cupy as cp except ImportError: pass # -------------------------------------------------------- # Defalut is to use numpy, not cupy # -------------------------------------------------------- gpu_mode = False # -------------------------------------------------------- ...
5b91450a05424ea8c34da41144a236bd6e431a0ae2efbe1262d5b44685b717bd
Python
2,121
105
category_dictionaries = { 'view': { 'PLAX': 0, 'Ascending_aorta': 1, 'RV_inflow': 2, 'RV_focused': 3, 'Pulmonary_artery': 4, 'PSAX_AV': 5, 'PSAX_MV': 6, 'PSAX_papillary': 7, 'PSAX_apex': 8, 'A4C': 9, 'A5C': 10, 'A3C': 11...
f79bf363e9c982c011bad671c5ef2fbda2e1d006e5fef2b582a8f2339409b2f9
Python
2,121
82
import os.path as op import os import subprocess def overwrite_check(file): """Checks whether a file exists. If so, aborts the function. Parameters ========== file: str name of file to look for Outputs ======= None """ if op.exists(file): raise Exception( ...
08c5ec296b6fb77b6b5be5550fb20c4ff58442907884223120756195dfeaf738
Python
2,122
60
import copy import warnings from typing import List from mmengine.model import BaseDataPreprocessor from mmengine.structures import BaseDataElement from torch import Tensor from lqit.registry import MODELS from lqit.utils import ConfigType, OptConfigType SampleList = List[BaseDataElement] @MODELS.register_module()...
ee18e4f33d99a842b501dc719caf97b4bc44bd1c44e397aa951f14767697b8f7
Python
2,122
57
import logging from datetime import datetime from agent.data.entities.config import ROOT_LOGGER_ID from agent.data.augmentation.data_augmentation_mgmt import process_train_items, TRANSFORMER_TYPE # from agent.data.augmentation.data_augmentation_mgmt import process_single_item, do_back_translation, get_back_translatio...
1a91414f58356c3f539b78287b9a2973387143df1ef0ea6b5ef90a0d8465d394
Python
2,123
114
""" Test for issue 282: https://github.com/Data-Centric-AI-Community/data-profiling/issues/282 """ import pandas as pd from data_profiling import ProfileReport from data_profiling.model import BaseDescription def test_issue282(): index = [ "BJ110", "BJ126", "BJ163", "BJ054", ...
273fd56b7422d333372c7e2ed1f51cd3e899bd318b2d00444432eb7ff8f99128
Python
2,123
60
from typing import List, Optional, Protocol, runtime_checkable from ray.data._internal.execution.interfaces import ExecutionResources @runtime_checkable class ClusterAutoscalingMetrics(Protocol): """Protocol that defines the metrics required for cluster autoscaling. Attributes: average_num_inputs_pe...
c9ba4c98dd138a33af5acee93fce09958e80ad48e2f14ff4a9477d29b4036cb3
Python
2,123
54
import numpy as np import pickle import sys from collections import namedtuple import argparse GridSearchParams = namedtuple('GridSearchParams', ['lambda_start', 'lambda_end', 'prior_weight']) GridSearchReconstructions = namedtuple('GridSearchReconstructions', ['ground_truth', ...
e804144bd639fd91c1e6869e186ceeb317863d599a0d45405ca6d7416b77ea9a
Python
2,123
57
from typing import Any, Callable, Dict, Optional import pyarrow from ray.data._internal.arrow_block import _is_user_visible_column from ray.data.block import BlockAccessor from ray.data.datasource.file_based_datasource import _resolve_kwargs from ray.data.datasource.file_datasink import BlockBasedFileDatasink class...
2ac15214992dd1178c0b29a2caab74fc0a1c04694788a7b041f04af54e951cde
Python
2,125
68
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Helper for retrieving Metrics of an Experiment.""" from datetime import datetime import json from typing import Dict class InferenceLocalMetric: """Met...
54ddb0bcfac871e5a749311a4782d30c5fd5cd346b307b6804190d638f64f61d
Python
2,125
51
from neuromaps.parcellate import Parcellater from neuromaps import datasets import numpy as np from nilearn.datasets import fetch_atlas_aal from neuromaps import nulls import os from scipy.io import savemat PERMS=20 #aal = fetch_atlas_aal(version='SPM12') aal_path = "/home/ivan.mindlin/Repos/neuromaps/AAL_90.nii.gz" ma...
a0ada91b4d4437fa3dfd10dd1fc56fc767b6fecc92034a2f57c3071571af6c42
Python
2,125
102
# flake8: noqa # fmt: off # __crosslang_init_start__ import ray ray.init(job_config=ray.job_config.JobConfig(code_search_path=["/path/to/code"])) # __crosslang_init_end__ # fmt: on # fmt: off # __crosslang_multidir_start__ import ray ray.init(job_config=ray.job_config.JobConfig(code_search_path="/path/to/jars:/path...
a86ba626fa1bdee6ef0e7377aa34fda8972fb6e7496d5b7ae5a06b1ac1706b68
Python
2,126
77
from typing import Tuple import numpy as np import pandas as pd from data_profiling.config import Settings from data_profiling.model.summary_algorithms import ( chi_square, describe_date_1d, histogram_compute, series_handle_nulls, series_hashable, ) from data_profiling.model.typeset_relations impo...
13bc4e06ddae654c3a1e750547e07a29e067912945fccad4ad0eb5de076c027c
Python
2,127
69
import subprocess from typing import List, Optional from ci.ray_ci.bisect.validator import Validator from ci.ray_ci.utils import logger from ray_release.test import Test class Bisector: def __init__( self, test: Test, passing_revision: str, failing_revision: str, validato...
99a9986db17509c98614b970084b86cfe1ed4d4397106820096bebe59f39e43f
Python
2,129
48
"""LLM-assisted scoping: split objectives, expand queries, add constraints. Uses an OpenAI-compatible chat-completions endpoint if available; otherwise falls back to a simple heuristic splitter. """ from __future__ import annotations from typing import Dict, List import os def suggest_brief(request: str) -> Dict[s...
3d2fa26746448691cd31a6288aa777bc8592cc92853f3cf9d16e20b16a08282c
Python
2,130
50
#!/usr/bin/env python3 # Copyright (c) 2020-2022, NVIDIA CORPORATION. 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 ...
3ffe56c161d985f731be0bdc888cd477cae2a38c4ef152c4e834ad245acb7777
Python
2,131
67
import torch from torch.nn.utils.rnn import pad_sequence def reverse_pad_list(ys_pad, ys_lens, pad_value: float = -1.0): r_ys_pad = pad_sequence([(torch.flip(y.int()[:i], [0])) for y, i in zip(ys_pad, ys_lens)], True, pad_value) ret...
e582bc89607447dbb0e63f43b51708fc37bba825dba30a078cff88a6fb9cf071
Python
2,131
64
from torch import nn, zeros from config import TARGETS, FORECAST_HORIZON class GRU(nn.Module): def __init__( self, n_input_ts: int = len(TARGETS), hidden_size: int = 100, num_layers: int = 1, dropout: float = 0.0, n_output_ts: int = len(TARGE...
1aca229d427f3dd7c4f63c5ec49e25db51a51d07f8819e7c82090671783d5952
Python
2,132
72
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. # pylint: disable=too-many-locals, too-many-arguments """Low level implementation of torch-based tile.""" from typing import TYPE_CHECKING from torch import T...
fd879eb5d60d43331462910c3f8941a13ce1bb1297703bd7a27da557badb17de
Python
2,132
73
import matplotlib.pyplot as plt import pandas as pd import numpy as np import utils font = {"size": 10, "family": "Arial"} plt.rc("font", **font) # Load in full nested cross-validation results full_df = pd.read_csv("anon_results.csv", index_col=[0, 1, 2]) # Remove post-operation visits from test results full_df = f...
1c2cfdc5d8a6ef1da9d15d551ab75df7687bbc1429cee0537060813e8341f75a
Python
2,133
60
# Ultralytics YOLO 🚀, GPL-3.0 license from ultralytics.yolo.utils import LOGGER, TESTS_RUNNING from ultralytics.yolo.utils.torch_utils import get_flops, get_num_params try: import clearml from clearml import Task assert clearml.__version__ # verify package is not directory assert not TESTS_RUNNING ...
90f8a692ba0b0df45c0d492fe43ce6403f38906a318282cc92a44c133561c9c0
Python
2,133
89
#!/usr/bin/env python """ Collect BAF file metrics. Writes stats to stdout. Metrics: baf_qN_<sample> : Nth percentile BAF baf_count_<sample> : total BAF record count If the provided sample list has more than one id, <sample> will be "_merged". """ import gzip import argparse import sys import numpy as np im...
a1d2cebd768b9409376809e5362862cddab95b194aad8977b7e8237a6dc626bd
Python
2,133
98
################################################################ # filename: pglCalibration.py # purpose: Handles calibration of display # by: JLG # date: September 18, 2025 ################################################################ ############# # Import modules ############# import numpy as ...
00f100ed7c421db7f7af2a1984e4914a551b1e4a25abbed7cdb9909f74f22146
Python
2,134
48
"""Spatial entry point for the unified communication API (``ov.space.run_ccc``).""" from __future__ import annotations from collections.abc import Mapping, Sequence import anndata from .._registry import register_function @register_function( aliases=["space.run_ccc", "空间细胞通讯", "spatial cell communication", "sp...
09653c834c5657f10370aba4f84a6be777c1c2ea8d9b97087c2e126d954fa7c2
Python
2,134
70
import argparse import sys, os sys.path.insert(0, os.getcwd()) import ecg_plot import matplotlib.pyplot as plt from src.evaluations.traces import plot_trace from src.dataset.ages import get_single_trace from warnings import warn import json import socket import numpy as np import h5py from scipy import signal as sgn d...
e0301669feffc269bea69d3a99813f7f1c1950691bf830bb3e74484789a73eee
Python
2,134
62
import torch from ..reducers import AvgNonZeroReducer from ..utils import loss_and_miner_utils as lmu from ..losses.base_metric_loss_function import BaseMetricLossFunction class TripletMarginLoss(BaseMetricLossFunction): """ Args: margin: The desired difference between the anchor-positive distance an...
62b40064d97780a6d05cfaecdfba9e44487fc44e8f77160b2cbe906100712ff5
Python
2,135
62
# 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...
bd46672ee7918e700bf51bd5792c46512f04dec9d796f26bf15b51eb08369add
Python
2,135
62
from typing import Any import numpy as np from numpy.typing import NDArray from PIL.Image import Image from siapy.core.exceptions import InvalidInputError, InvalidTypeError from siapy.core.types import ImageSizeType, ImageType from siapy.entities import SpectralImage __all__ = [ "validate_image_to_numpy_3channel...
0616650c27d47c4611ec8c18cd091744362bda9d0fbe887521540ccc3809e70b
Python
2,136
75
""" Structured error hierarchy for OmicVerse Agent (P0-3). Replaces bare RuntimeError / ValueError with typed exceptions that carry context (provider, retryable, status_code) and separate control-flow signals (WorkflowNeedsFallback) from real bugs. """ from __future__ import annotations class OVAgentError(Exception...
dd6ec0db04c4f83599a3d21c50f0a12b442b2f717b544c842a829d4d471e287d
Python
2,137
65
import numpy as np import os import json import argparse from typing import cast def get_cluster_score_bin_path( path_checkm_all: str, path_bins: str, bins: set[str] ) -> tuple[dict[str, tuple[float, float]], dict[str, str]]: """Given CheckM has been run for all samples, create 2 dictionaries: - {bin:pat...