sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c86537f11d41fd27df40a021881ef7f3e5f57a85b7a581a76363a2202a755049
Python
1,612
49
# @license # Copyright 2025 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...
f6fe5f40d43d673d8b96546fde8348dfa82985b568e9d736001d5f1142d2e858
Python
1,613
51
import sys from unittest import mock import pytest from ci.ray_ci.bisect.bisector import Bisector from ci.ray_ci.bisect.macos_validator import MacOSValidator from ci.ray_ci.bisect.validator import Validator from ray_release.test import Test class MockValidator(Validator): def __init__(self, return_value: bool)...
20930878f0ac52ff508f68237add1c45c623e8fafa780f6a92d08b5811c8f3f7
Python
1,614
52
# Generated by Django 4.1.5 on 2023-05-29 17:54 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ("infer", "0017_auto_20230526_0316"), ] operations = [ migrations.CreateModel( name="ProteomeTask"...
bab55a30a8f6bf2fd17dddc1780a6d61408cb76744885e377fdaba84fdafccee
Python
1,615
45
""" 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 torch import torch.nn.functional as F class Act(torch.nn.Module): def __init__(self, act: ...
3aa027b96d927f0f72fdb0fc7bb16eea3587fad9b0dcf94ca5f1551e87135c56
Python
1,616
62
""" Quickstart: vLLM + Ray Data batch inference. 1. Installation 2. Dataset creation 3. Processor configuration 4. Running inference 5. Getting results """ # __minimal_vllm_quickstart_start__ import ray from ray.data.llm import vLLMEngineProcessorConfig, build_processor # Initialize Ray ray.init() # simple dataset ...
858bb82af4b1bc98807e6e5f0c8f201415645eeb1150de7a0048afa68e75a8d5
Python
1,616
34
#################################################################################################### # 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...
2fdfcc206bf2b686e1680d3556d72a2e8631233fdc1bf990278ae4fc4f465870
Python
1,617
63
# -*- coding: utf-8 -*- """ """ import numpy as np import pytest import vtkplotlib as vpl pytestmark = pytest.mark.order(6) def test_plot(): t = np.arange(0, 1, .001) * 2 * np.pi vertices = np.array( [np.cos(2 * t), np.sin(3 * t), np.cos(5 * t) * np.sin(7 * t)]).T...
a5ee2bd4164243af41d73b8e3e76b4ab5664be1e776cd572f126133e842c9f2a
Python
1,618
47
#!/usr/bin/env python # -*- coding: utf-8 -*- # ------------------------------------------------------------------------- # Created By : Kangjoo Lee (kangjoo.lee@yale.edu) # Last Updated: 08/06/2024 # ------------------------------------------------------------------------- # Imports import matplotlib.pyplot as plt ...
1b9c073cd71a48da606be50f7e9eb32adcab3f6a2bb0661672ce70b83a517893
Python
1,619
42
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
85be7536a197c8a1e99e7f46a7bdb4ab8aaf38aa6792b1c08a4b7613385668cc
Python
1,620
53
from typing import Sequence, Any from numbers import Number from functools import partial import numpy as np import jax import jax.numpy as jnp from jax.lax import with_sharding_constraint from jax.sharding import SingleDeviceSharding, PositionalSharding def is_sharded_array(array: Any) -> bool: if isinstance(arr...
da9a6762dec993db8003a43c54a32a91e267e6f6ee618b6c64f20f11fe02fcb7
Python
1,620
35
#################################################################################################### # 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...
4ea01dc13bca23d169a57ee4e3c207cd961ca9ecf09478dd0c3b115212509a27
Python
1,621
51
#!/usr/bin/env python """ Useful utilities for working with pysam variant objects """ def get_info_field(record, name, singularize=False): if name not in record.info: if name == 'SVLEN': if record.info['SVTYPE'] in ['DEL', 'DUP', 'INV']: record.info['SVLEN'] = record.stop - re...
f3b7f197d17370bda11d98c2564dcde4c494102a3d866193c359c3bfbc049d13
Python
1,621
48
# 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-...
af2665e855ec5682277c4166c1a701303ad321a7f426bcb30775ed553b043b83
Python
1,622
64
# Calculate the whole brain injury degree for a single impact case # and write it into 'injury_degree' # Steps: # 1. Extract response peaks from the raw data. # 2. Manually set injury thresholds. # 3. Calculate element injury degrees at different thresholds according # to the definition of injury degree. The whole bra...
b0bb0809878b302cd68b4620c3c64f7e5dbaf09ab12cd2009286058573823f32
Python
1,622
48
#!/usr/bin/env python #Lexi Morrissey, Mahony Lab @ Pennsylvania State University #Contains method for predicting whether area should receive multimapped reads via pre-trained CNN in Allo. import os import absl.logging absl.logging.set_verbosity(absl.logging.ERROR) import contextlib, io import logging os.environ['TF_C...
bb98c0e136fe4a9e8fa3a38c39837af06b8a9695bbbff96bc42433e6f3f15bdd
Python
1,622
46
import numpy as np import pandas as pd import sklearn.metrics def decide_stertor_pred(row, threshs): """Pick class from logits using NNRank method""" row_classif = row > threshs for i in range(4): if not row_classif[i]: return int(max(i - 1, 0)) return 3 full_df = pd.read_csv("an...
ad923d398392cd0b03c7d54851a7456feb5f72d669ca2045e105901204f9ae47
Python
1,623
43
import numpy as np import torch from ..utils import common_functions as c_f from ..miners.base_miner import BaseSubsetBatchMiner class MaximumLossMiner(BaseSubsetBatchMiner): def __init__(self, loss, miner=None, num_trials=5, **kwargs): super().__init__(**kwargs) self.loss = loss self.min...
2a7f58ca14719e269b2e4471f78a9cfd6953cb564ddc4f92fe8eb05385440dea
Python
1,624
51
import glob import geopandas as gpd import numpy as np import os import pandas as pd import rasterio as rio from src import patches from src import neon_paths from src.data import read_config from src.start_cluster import start from distributed import wait config = read_config("config.yml") shapefiles = glob.glob("/or...
454d02be808a46bb8061a37e64367b7f3f5efddb42289e7d55d774cfa5651be7
Python
1,624
46
#this script with assistance from ChatGPT3.5 20231204 # the function is to create a mean of all the normalized images # python nii2meanLesion.py import os import nibabel as nib import numpy as np import fnmatch def create_mean_image(folder_path, output_path): # Ensure the output folder exists os.makedirs(os....
4e08d9eecb3cb3d11a61afc39de7d01fc601bda53c8b8c858354c36cb19fb052
Python
1,624
49
from __future__ import annotations from typing import Any import attrs from snakebids import bidsapp from snakebids.plugins.base import PluginBase # last rules in each chain that populates the cache dir (HIPPUNFOLD_CACHE_DIR); # their upstream download rules (download_surf_template_atlas, # download_nnunet_model) ar...
5b2ec4419d22eab30ec6e2d4a1b5252b0611d92c003fd431179874c9ba8dfaeb
Python
1,624
49
import numpy as np import scipy.sparse as sparse from hic3defdr.util.clusters import find_clusters def classify(row, col, value, clusters): """ Classifies pixels (specified by row, col coordinates) into classes (corresponding to the columns of value) where their value is highest, ignoring those pixel...
e54a7d702d62c476095eebd3a0d3fe96b7d194efc0f54c77ff1e5136e12bb682
Python
1,624
53
import numpy as np import math from .basic_distributions import Distribution from ..utils import * class Poisson(Distribution): """ Class to define Poisson distributions. Equations: p(x|theta) = theta**x * exp(-theta) * 1/theta! log p(x|a,b) = x*theta - theta - log(x!) E[x] = theta var[x...
832280c3d47213ab31569f34967115299a1dcdc38fcfd1da851a76b3a94b57db
Python
1,625
39
import numpy as np from rich import print from siapy.datasets.tabular import TabularDataset from siapy.entities import Shape, SpectralImage, SpectralImageSet # Create two mock spectral images with dimensions 100x100 pixels and 10 bands rng = np.random.default_rng(seed=42) image1 = SpectralImage.from_numpy(rng.random(...
fb852c154806903b40824e7c64e4e5f2e23ac1e7c1866a8c43d7de6ad5b1a777
Python
1,626
49
"""Create two augmented views per ECG for contrastive self-supervised learning.""" import torch from torch.utils.data import DataLoader, Dataset import ecg_augmentations as ea FS = 500 augment = ea.Compose( [ ea.RandomCrop(duration=8, fs=FS), ea.RandomApply([ea.BaselineWander(FS), ea.GaussianNoi...
ace423bc092a94e2411d90ffaa04336c1d15e1f8ac5dfc0b3d328ca4468a55a4
Python
1,628
38
#################################################################################################### # 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...
ed47b9e67055984baa976e184169a588285fa75b22fa96c0513de10f89577357
Python
1,628
53
"""Functions related to randomized SVD.""" # Copyright (c) 2024 Valentin Goldité. All Rights Reserved. from typing import Optional, Tuple import torch from torch import Tensor def randomized_range_finder( inputs: Tensor, *, size: int, n_iter: int, power_iteration_normalizer: str, random_stat...
53c07467cf265b7742b13d6b15a9e4b26e6d8740e1a9e508d78b08acac8d132b
Python
1,629
48
from typing import Tuple from jaxtyping import PyTree import jax import jax.tree_util as jtu import jax.flatten_util as jfu import jax.tree_util as jtu from jax.lax import with_sharding_constraint from jax.sharding import PositionalSharding import equinox as eqx def tree_fully_flatten(tree: PyTree) -> jax.Array: ...
5e5161bd5bc7a4cb920c8d1cf2f6dbe5d52cfe8014a4c20b4bc5c4209afa094b
Python
1,629
58
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
660c8b71ced60c6350535ced9c62f92294643a83c7dc8616820c495cb3e9b414
Python
1,629
62
import lisa from lisa import FromRegions, FromGenes, FromCoverage import argparse from lisa.cli.cli import oneshot_parser, multi_parser, regions_parser, coverage_parser import argparse import os from argparse import HelpFormatter from lisa.cli.cli import RstFormatter from lisa.core.utils import Log def new_format_help...
50f8f292e8b8aaf9e539773ab4394aa3291563535467cd1dffcbe05903f7fb6f
Python
1,630
55
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """aihwkit example 1: simple network with one layer. Simple network that consist of one analog layer. The network aims to learn to sum all the elements from one...
70f27df2097451c9d8e3c89f25ca508e08ab6d253ed079d0057a47e3a9e525df
Python
1,630
33
# Authentication error messages TOKEN_AUTH_FIX_MESSAGE = ( "To connect to a cluster with token authentication, run `ray get-auth-token` " "on the head node and copy the token to ~/.ray/auth_token on this machine, " "or to a file that RAY_AUTH_TOKEN_PATH points to. If the cluster was started " "with RAY_...
953df9dffe1ca8e6986a5ee12abbd25260ad44b1bfb50eb0884c84e819c13e8c
Python
1,632
43
from tqdm import tqdm from torch_pgn.train.train_utils import format_batch import torch.nn.functional as F import torch def train(model, data_loader, loss_function, optimizer, scheduler, train_args, epoch_num = 0, logger = None, writer = None, device='cpu'): """ Trains the model for an epoch. :p...
a8c269ed8991b8eb64efac6bb643619b31b455598ecab2d2d5e5520e837aafe9
Python
1,632
60
#!/usr/bin/env python3 import os import numpy as np import tensorstore as ts example_dir = os.path.abspath(os.path.dirname(__file__)) def write_single_res(): store = ts.open( { "driver": "zarr3", "kvstore": { "driver": "file", "path": os.path.join...
eab63dc7f964d9ff525ba1250248abbaa0e6dc49acf8d23ec583356e9208945d
Python
1,632
57
from abc import ABCMeta, abstractmethod import numpy as np class StepHook(object, metaclass=ABCMeta): """Hook function that will be called in training. This class is for clarifying the interface required for Hook functions. You don't need to inherit this class to define your own hooks. Any callable ...
95688d034fa1b50bdb9e95cc57a1c153cde4d272e51eddda60b96260e863cfac
Python
1,633
41
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion): # --------------------------------------------------------------------------------...
e536e1d1b78409abad79fde6ff947f3b59317e1790b70bfa65ff307aba839fde
Python
1,633
58
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np import torchvision.models as models class VGG(nn.Module): """VGG/Perceptual Loss Parameters ---------- conv_index : str Convolutional layer in VGG model to use as perceptual output """ def __init__...
0fc2977b1280e736ca81f27f0cd3dd6c4d558299404ac174eb34c28956d10b01
Python
1,635
53
""" A collection of dictionary-based wrappers around the "vanilla" transforms for transformers functions Class names are ended with 'd' to denote dictionary-based transforms. """ from monai.config import KeysCollection from monai.transforms.compose import MapTransform from src.transforms.transformer.array import Co...
74d69550a920a7d61b60536f8ba2e15fbcc384eec09043a9676991bef32ffc87
Python
1,635
51
import argparse import tensorflow as tf import importlib import os, random import json import sys import numpy as np class project_params: def __init__(self, params): self.params = params def main(project): dataloader = selected_dataloader.dataloader_sleep_tfrecords(project) train_dataset, val_dat...
2ad54a1eac834ba2bfaa4812880c9d876132f1f98477d50c58a16ba6554784e6
Python
1,636
51
from typing import Sequence, Union import torch from rising.random import AbstractParameter from rising.transforms.abstract import BaseTransform, BaseTransformSeeded from rising.transforms.functional.crop import center_crop, random_crop __all__ = ["CenterCrop", "RandomCrop"] class CenterCrop(BaseTransform): de...
4f4cc55cdde37637bfd1c31005d05d17972a092026cae8dcd608f1c19d8b29c8
Python
1,636
54
import torch from torch import nn import tinycudann as tcnn import numpy as np class NGP(nn.Module): def __init__(self, gray_act='Sigmoid'): super().__init__() self.gray_act = gray_act scale = 0.5 L = 8; F = 2; log2_T = 10; N_min = 2 b = np.exp(np.log(20*scale/N_min)/(L-1))...
73ba9be2e3a02683ee3140d096fcfaf01f43fefe58f0d34f6ac2bc92cfedae28
Python
1,640
58
import base64 import json import sys import pytest import ray from ray._private.test_utils import ( wait_for_condition, wait_for_dashboard_agent_available, ) from ray.dashboard.tests.conftest import * # noqa _RAY_EVENT_PORT = 12345 @pytest.fixture(scope="session") def httpserver_listen_address(): retu...
0bb63e979c8bc0c07ca9765f3fb380268892ae73cf3324b6f7d24a1c2f073a6a
Python
1,641
56
from typing import Optional, List import numpy as np from scipy import stats from neuron_morphology.feature_extractor.data import Data from neuron_morphology.features.statistics.coordinates import COORD_TYPE from neuron_morphology.feature_extractor.marked_feature import marked from neuron_morphology.feature_extracto...
f8ad257efcd3e17f8ff697d241deb80ea8f98e461fc04e2fd9ff7c21a0540d8e
Python
1,643
62
#!/usr/bin/env python3 # Copyright 2004-present Facebook. All Rights Reserved. import logging import torch def add_common_args(arg_parser): arg_parser.add_argument( "--debug", dest="debug", default=False, action="store_true", help="If set, debugging messages will be printe...
5c421fb803592a47d54c0d44011057063d82d2e57f0b0098bbda847e8e6a9e06
Python
1,644
35
#################################################################################################### # 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...
9047945b0caac41ebdb82cd642b6ae8a8afc35bba398e215e3cc35ef1995950a
Python
1,644
53
""" The purpose of this script is to initiate the main GUI *** built as part of the Russell Ray Lab Breathing And Physiology Analysis Pipeline *** Breathe Easy - an automated waveform analysis pipeline Copyright (C) 2022 Savannah Lusk, Andersen Chang, Avery Twitchell-Heyne, Shaun Fattig, Christopher Scott Ward, Ru...
91311585dfe05f747086ecdf05d04b5dd4b7de750e546d78a0ae0f799f8348e5
Python
1,644
43
#usage: python _run-rnacontext-h3.py <model_res_10.txt> <nsites> import sys,re,numpy as np from mymo import util mname=util.fullpath(sys.argv[1]) nsites=int(sys.argv[2]) table={} def sumexp(v):return sum(np.exp(vi) for vi in v) with open(mname) as m: while True: if "Base Parameters"==m.readline().strip(): ...
3de59eba0338608f1ec000cbaa2cc733dc5b19c4b450f30f9d9a84e1a9c4846a
Python
1,646
50
from dataclasses import dataclass from typing import Any import numpy as np from .node import NIRNode from .typing import Types from .utils import calc_flatten_output, parse_shape_argument @dataclass(eq=False) class Flatten(NIRNode): """Flatten node. This node flattens its input tensor. input_type must...
60a805a6ae55fd04d91603851d49d241635222c83d141dd2de3ff5886eaa446e
Python
1,646
41
#################################################################################################### # 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...
f1f42e8b71fd4aa24f534fa1a3b93ba9a3f171a73abe426d614b587ea61fef80
Python
1,646
43
import nibabel as nib import numpy as np from nilearn.maskers import NiftiMasker from numpy.testing import assert_array_almost_equal from fmralign import metrics def test_score_voxelwise(): A = np.asarray([[[[1, 1.2, 1, 1.2, 1]], [[1, 1, 1, 0.2, 1]], [[1, -1, 1, -1, 1]]]]) B = np.asarray([[[[0, 0.2, 0, 0.2, ...
23fa52f2e1b3c9ee94cdf10db8b473d0f54643e60673ed05d8740732da423c99
Python
1,647
47
import unittest import os import shutil import tempfile from neuron_morphology.morphology_builder import MorphologyBuilder import neuron_morphology.swc_io as swcio class TestSWCIO(unittest.TestCase): def setUp(self): data_dir = os.path.join(os.path.dirname(__file__), 'data') self.swc_file = os.p...
d4ff1bcde256c694634e00815633674a41da59ee80d3577f0d21178406eb1258
Python
1,647
45
import unittest import torch from rising.transforms import ArgMax, OneHot, Permute class TestChannel(unittest.TestCase): def setUp(self) -> None: self.batch_dict = { "data": torch.arange(1, 10).reshape(1, 1, 3, 3).float(), "seg": torch.rand(1, 1, 3, 3), "label": torch...
db66f49f5f9f908215618b83566f12eef889a1f0d5b87e6a3b71ed9c96b58710
Python
1,647
32
from pandas import read_csv from argparse import ArgumentParser if __name__ == '__main__': # Retrieve input data parser = ArgumentParser() parser.add_argument('--config_path', type=str, default='./Configurations.csv' , help='file with all considered configurations') parser.add_argument('--retrieve...
2b4974ba4bfb8d4d7acbf73d2a8ce17a32bca405973c4d3174aed2b1e1d20f3d
Python
1,648
57
import ast import re from pathlib import Path REPO_ROOT = Path(__file__).absolute().parents[2] LOG4J_ARTIFACTS = { "log4j-api", "log4j-core", "log4j-slf4j-impl", } def _assignment_value(module: ast.Module, name: str): for node in module.body: if isinstance(node, ast.Assign): for t...
b613472fa8c18323719c2f1202cf4b9a54c65447d5dba705b7c66cce5237f3e5
Python
1,648
56
""" 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 torch def cg_change_mat(ang_mom: int, device: str = "cpu") -> torch.tensor: if ang_mom not...
3c04a9df6aab0d989867fb5fa57dfb0b59e0e1818b269fdcb996b88d801d7e4e
Python
1,649
56
# -*- coding: utf-8 -*- """ Created on Tue Dec 20 12:18:00 2022 @author: ju-bar MTF file I/O This code is part of the 'emilys' repository https://github.com/ju-bar/emilys published under the GNU General Publishing License, version 3 """ import numpy as np def read_mtf(file, debug=False): """ Reads radial ...
afb7ca43220f358adf7686c57afe1262c5ea5005aa1c9813f60aef9ea09a373a
Python
1,649
72
import sys from multicamera_acquisition.paths import DATA_DIR from multicamera_acquisition.acquisition import acquire_video import json camera_list = [ { "name": "Top", "serial": 22181547, "brand": "flir", "gain": 3, "gpu": 0, "exposure_time": 4000, "display...
2ff7b3c9252d50413ae1cebbaf3a636e6ca0a1a867e21360271f39f70f405dc2
Python
1,652
46
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion): # --------------------------------------------------------------------------------...
c1f1cf00ff6ace1afa9e9c3bc4ecb1102f5834278af8f0ccec20ee41f795e553
Python
1,652
70
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Configurations for resistive processing units.""" from aihwkit.simulator.parameters import ( IOParameters, IOParametersIRDropT, UpdateParameters,...
1defaba54724032a072922b4cc67f51ddb24ce3dcbf85aedd498c3a3b09664c0
Python
1,653
47
# Ultralytics YOLO 🚀, GPL-3.0 license from ultralytics.yolo.utils.checks import check_requirements, check_yaml check_requirements('lap') # for linear_assignment import torch from ultralytics.yolo.utils import IterableSimpleNamespace, yaml_load from .trackers import BOTSORT, BYTETracker TRACKER_MAP = {'bytetrack...
6b7c5da7c7d3c7847bd96e2ed38bb79c91bdc9b37901c1151578c5763651765a
Python
1,653
44
"""Garbage-collection priority policy for the task-event store. Each task event is assigned a priority tier. When the store is over capacity, events in lower-priority tiers are evicted first: finished tasks first, then actor tasks, then everything else. """ from ray.core.generated import gcs_pb2 from ray.core.generate...
e76472a7ce7d16dd20c251566abe406565b1c2bee51abc245f6a47993208e703
Python
1,654
65
# Copyright 2023 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
dce3ec104e2e8aa77899e67be166200402146add31d01186d2ef3675db7f1311
Python
1,655
61
# __example_code_start__ from transformers import pipeline from fastapi import FastAPI import torch from ray import serve from ray.serve.handle import DeploymentHandle app = FastAPI() @serve.deployment(num_replicas=1) @serve.ingress(app) class APIIngress: def __init__(self, distilbert_model_handle: DeploymentH...
231d868e07d241aa47b0924eea4ebb39bd003ae4b4e2cf520f2eca4aa6799c00
Python
1,656
67
"""Generate binary PLY test fixtures from the ASCII cube definition.""" import pathlib import struct VERTICES = [ (-1.0, -1.0, -1.0), (1.0, -1.0, -1.0), (1.0, 1.0, -1.0), (-1.0, 1.0, -1.0), (-1.0, -1.0, 1.0), (1.0, -1.0, 1.0), (1.0, 1.0, 1.0), (-1.0, 1.0, 1.0), ] FACES = [ (0, 3, ...
0c04ff1a0cb05d0431dc2a0902e2e378666dd5d3a344a68adb8c01d431362033
Python
1,657
52
import torch #model, alphabet = torch.hub.load("facebookresearch/esm:main", "esm2_t12_35M_UR50D") import time import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import Dataset,DataLoader import pandas as pd from tqdm import tqdm import torch import esm import numpy as np from fairs...
71f623e3fa2a8c42b5a36a77b653a3ea00c79695a5c455b591a76a1eade6ef7d
Python
1,657
59
from typing import Any, Dict, List import ray from ray.dag.dag_node import DAGNode from ray.dag.format_utils import get_dag_node_str from ray.util.annotations import DeveloperAPI @DeveloperAPI class FunctionNode(DAGNode): """Represents a bound task node in a Ray task DAG.""" def __init__( self, ...
8a942525e437f0501800ad7eb9e4827cac952d1d43c22494ca5e945ed1a00236
Python
1,657
33
# # CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables # © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+) # Source code: # https://github.com/AdaptiveMotorControlLab/CEBRA # # Please see LICENSE.md for the full license document: # https://github.com/AdaptiveMotorControlLab/CEBRA/bl...
0a0b1387807252a5076ee8c70572cb3adad451f7c34d79f40885f577f8985e1d
Python
1,658
47
import anndata from .._registry import register_function @register_function( aliases=["批次效应校正", "batch_correction", "combat", "批次校正", "去批次效应"], category="bulk", description="Perform batch effect correction using ComBat algorithm for bulk RNA-seq data", prerequisites={ 'functions': [], ...
4ed65e5350406bcee5dbbf62293db0d64ef291e7ddb7645ba8b261aeeeb9b311
Python
1,658
52
from pathlib import Path import numpy as np from siapy.entities import SpectralImage from siapy.transformations import corregistrator from siapy.utils.plots import display_multiple_images_with_areas, pixels_select_lasso # Set the path to the directory containing the data # !! ADJUST THIS PATH TO YOUR DATA DIRECTORY ...
08fe60d42f7c839cb936df6753f6bdb870b67f9bfa957194e0de68c961f0fde4
Python
1,659
64
import numpy as np from mozaik.connectors.modular import _lognormal_event_weight_sums class ConstantDistribution: def __init__(self, value): self.value = value def copy(self, seed): return self def next(self, n): return np.zeros(n) + self.value def test_lognormal_event_weight_...
54435b357fa6b06aac04468ed54b8435ecdcefc51d1daae4c4e509d94dcaa2d8
Python
1,659
58
import argparse import pysam def parse_arguments(): parser = argparse.ArgumentParser() parser.add_argument('-i', '--input', required=True) parser.add_argument('-o', '--output', required=True) return parser.parse_args() def truncate_cigar(cigars): c = 0 new_cigars = [] for flag, n in cigars...
9eb00ffe8ab87b3428b45ee2fea4aa3c174a2acd0655d30b501d542ba5547844
Python
1,659
39
import matplotlib.pyplot as plt import sys import seaborn as sns def main(argv): sample = argv[0] file="/Users/chaokuan-hao/Documents/Projects/PR_SpliceNN/results/800bp/"+sample+"/OUTPUT/SpliceAI_6_RB_p_n_nn_n1_TB_all_samples_thr_100_splitByChrom_L64_C16_L800_v21/BAM/"+sample+".discard.nh.txt" cleaned_fi...
1ab6f7ddc83e833c398cb42cfbde52788fd085a3d16a1c822268a420d2cbfadf
Python
1,660
48
from unittest import TestCase, skipIf import subprocess as sp import os import tempfile import shutil import json from dictdiffer import diff class SnapPolygonsIntegration(TestCase): @skipIf( os.environ.get("TEST_INTEGRATION", "false") != "true", "The integration tests can take a while - must op...
53ea6b302986041927233a537b106fde782fa4e73ae59c0940226eb6f00a0379
Python
1,661
57
#!/bin/python #------------------- Description & Notes --------------------# #------------------- Dependencies ---------------------------# # Standard imports import itertools import functools # Third-party imports # Internal imports from . import seq #------------------- Constants ------------------------------#...
ce63159d098bae6ca826c2e1fc1bcf1a7b6da2c845a071a40518d22f194b0b4e
Python
1,661
66
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 31 17:01:28 2022 @author: saad """ import numpy as np def rolling_window(array, window, time_axis=0): """ Make an ndarray with a rolling window of the last dimension Parameters ---------- array : array_like Array to add...
69a127ad727a29f3257e8d6c9b5f6e398aeffc717cd517977b8f30801e8c0f0e
Python
1,663
85
# flake8: noqa # __begin_untyped_builder__ # hello.py from typing import Dict from ray import serve from ray.serve import Application @serve.deployment class HelloWorld: def __init__(self, message: str): self._message = message print("Message:", self._message) def __call__(self, request): ...
06246fbdf52a26bceb3f511604ea97d50525b519470917287ddb7d7349d25c70
Python
1,665
60
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ For each resting-state scan for each subject ID, subtract mean BOLD timeseries voxelwise. Output: demean_rfMRI_REST*_*.dtseries.nii Demeaned fMRI files. Usage: r_voxdemean.py <subject> Arguments: <subject> Subject ID """ import os import numpy as np i...
311282019c48e502ba5cf403168565bb6dc47cee6275bbeecb4d1fb7371c15f8
Python
1,665
53
""" 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 from copy import deepcopy import pandas as pd from matminer.featurizers.composition import ElementPrope...
0a3754ea62da3c02cdb7bae5ab88effa6da2ff2e6ebd2cea30f367455dbf06c1
Python
1,666
46
import torch import torch.nn as nn import torch.nn.functional as F import DataSet from Config import class_number class TextRCNN(nn.Module): def __init__(self, vocab_size = len(DataSet.getTEXT().vocab), # 词典的大小(总共有多少个词语/字) n_class = class_number, # 分类的类型 embed_...
1e3cbae06e09f0cfb8cb995b5c27fc96b89e0a9fbf30d564c3fd8235f3e1444f
Python
1,666
71
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ Simple classes for parsing and interpreting .fam files """ from collections import defaultdict class Fam: def __init__(self, samples, families): self.samples = samples self.families = families class FamSample: def __init__(self, family, I...
97e166727ee8415a09644958b406118ea894b7ee9c596bdf0b6a445d7f864d7c
Python
1,666
46
# # Copyright (c) 2023, NVIDIA CORPORATION. # # 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 ...
263a79efe93a612220865b37ac16defd1be64de04c65568bf2e4e410133521d2
Python
1,668
46
''' MIT License Copyright (c) 2021 Deva Lab 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, copy, modify, merge, publish, dist...
956dcc9c30e45900bd71ac8a9f298e37968bf95757ca1e3db71e3c86613ec760
Python
1,668
63
import numpy as np import networkx as nx import os.path import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter, MaxNLocator import time import math import gc gc.collect() import warnings import pysindy as ps # a library of sindy-2016 warnings.filterwarnings('ignore') import os ...
a6a83012ca5d0176e69615a40083846cb989a7f016b5779529cf84228c898691
Python
1,668
39
import os import json import random import uuid import transforms3d import numpy as np import scipy.ndimage from deepvoxnet2.components.sample import Sample from deepvoxnet2.utilities import transformations from tensorflow.keras.utils import to_categorical from deepvoxnet2.components.transformers import Connection, Tra...
31bde8c36279d7591f2268d6c45500ed4e7a9d5dfcc8e53cf1e501410bf615d4
Python
1,670
59
import warnings import argparse import os from os.path import join from tqdm import tqdm from glob import glob from torchvision import transforms import PIL warnings.filterwarnings('ignore', category=UserWarning) def main(): parser = argparse.ArgumentParser() parser.add_argument('inp', type=str, help='pa...
3ac3f2ef26537e82dc558f5dba5eba6b60e216c17d06d2e96eb3a199fccf1ba6
Python
1,670
42
import math from functools import partial import torch from einops import rearrange from .cauchy import cauchy_mult_torch, cauchy_mult_keops, cauchy_mult from benchmark.utils import benchmark_all, benchmark_combined, benchmark_forward, benchmark_backward def generate_data(batch_size, N, L, symmetric=True, device='...
951a7dfe5d5fe3fcdff93bcec84d06cfb9c5c03d687f385583895fba9631e61e
Python
1,670
46
# ------------------------------------------------------------------------------------------------------------------------------------- # Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion): # --------------------------------------------------------------------------------...
ed1a3e2f35f12279ccd2302ca12828e4bd1a2343ad7d52f86a313b4a43e877a9
Python
1,672
54
import os import argparse import pandas as pd import numpy as np from config import config from utils import metadata_utils, coregister_utils parser = argparse.ArgumentParser() parser.add_argument('--split', type=int, default=1) parser.add_argument('--split_num', type=int, default=1) parser.add_argument('--start_idx...
7969a1902c982caf7497ec91d8eff3289ab6d42a96acb6bf905b428f30214adc
Python
1,674
66
from __future__ import annotations from collections import deque from typing import TYPE_CHECKING, Any, Deque, Iterator, List, Optional from typing_extensions import override from .base import BaseBundleQueue if TYPE_CHECKING: from ray.data._internal.execution.interfaces import RefBundle class FIFOBundleQueue...
13c717c62aa214bdc48f09ccb4d0bae01f593061a2c9fc7a5e4c10af8e28770c
Python
1,675
35
#################################################################################################### # 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...
177f10c51f54f519c7dbb36ae648cb3ee0bdd5fc5cf5c22aa3df5b071f848376
Python
1,675
52
import inspect def is_cython(obj): """Check if an object is a Cython function or method""" # TODO(suo): We could split these into two functions, one for Cython # functions and another for Cython methods. # TODO(suo): There doesn't appear to be a Cython function 'type' we can # check against via i...
e997946f52d26c00140f56694e058912881524c6eea64df2fd0af28ed68498e9
Python
1,675
35
#################################################################################################### # 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...
1572ed1186251e019ecfbdca05647699ccd161ef275b935654d8df1ac8076ca2
Python
1,677
43
import numpy as np import pytest from siapy.entities.pixels import Pixels from siapy.transformations import corregistrator from siapy.utils.plots import pixels_select_click # noqa: F401 @pytest.mark.manual def test_pixels_select_click_manual(spectral_images, corresponding_pixels): # image_vnir = spectral_images...
fcacf07df5da3684490f9fb0af5b5789a27f7f67010caf2efad360ff2f08847c
Python
1,677
35
#################################################################################################### # 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...
b95f665e782d67d7a6d22b48655b75ae0461dfd096a1f70835a16890feb98b4e
Python
1,678
47
import numpy as np import scipy.sparse as sp import torch import torch.utils.data as data_utils class EdgeSampler(data_utils.Dataset): """Sample edges and non-edges uniformly from a graph. Args: A: adjacency matrix. num_pos: number of edges per batch. num_neg: number of non-edges per ...
d20dd17cd2636003a8b74fa053dabccd2739eec75a096dee41f7801745c16fcf
Python
1,678
40
import pandas as pd from sklearn.datasets import make_classification, make_regression from siapy.features import ( AutoSpectralIndicesClassification, AutoSpectralIndicesRegression, ) from siapy.features.helpers import FeatureSelectorConfig from siapy.features.spectral_indices import ( compute_spectral_indi...
e5c89c7e7ac5d63603ab7884eaaaa5acb52e85312dec94c140274daaf46f2262
Python
1,678
54
# fmt: off # __doc_import_begin__ from ray import serve from io import BytesIO from PIL import Image from starlette.requests import Request from typing import Dict import torch from torchvision import transforms from torchvision.models import resnet18 # __doc_import_end__ # fmt: on # __doc_define_servable_begin__ @...
64ce75fc3d004dbd7c0649365637bc88e30bb431446fae8d42a4cd1ac8b1ed35
Python
1,679
60
# flake8: noqa # fmt: off # __step1_begin__ from ray import tune import ray import os NUM_MODELS = 100 def train_model(config): score = config["model_id"] # Import model libraries, etc... # Load data and train model code here... # Return final stats. You can also return intermediate progress # ...
c1c56fbb644032a32b263300e44f48ad29b752905930a92bb59bf71e6b1a506f
Python
1,679
22
"""Compare primitive kernels on identical historical states (no accumulated error).""" import os,sys,json from pathlib import Path os.environ['TF_CPP_MIN_LOG_LEVEL']='2' import numpy as np,tensorflow as tf tf.config.threading.set_inter_op_parallelism_threads(1);tf.config.threading.set_intra_op_parallelism_threads(1) p=...
2f57871a8d4d1a20a47b4f1407420eec2672655fc2e65400cc572d4457ef8d63
Python
1,680
56
# This Python file uses the following encoding: utf-8 """ main program *** built as part of the Russell Ray Lab Breathing And Physiology Analysis Pipeline *** Breathe Easy - an automated waveform analysis pipeline Copyright (C) 2022 Savannah Lusk, Andersen Chang, Avery Twitchell-Heyne, Shaun Fattig, Christopher Sc...
f11d88e732f66a186f4e7698e7b07828456355e6096cdf333f1d1549054ac788
Python
1,680
45
#!/usr/bin/env python3 # This script is used to zip a directory into a zip file. # It only uses python standard library, so it can be portable and used in bazel. import os import os.path import sys import zipfile # Everything in the zip file is stored with this timestamp. # This makes the zip file building determini...