sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
180a81af1e8ae9e38e9076e6a2331b219a3c6af81052cd8015449b64417918e1 | Python | 13,287 | 391 | """
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 os
import random
import subprocess
import tempfile
import numpy as np
import pytest
import torc... |
e892702d1735f993e91de339dd05619b2910510c8c3746f810e2e0edf6be8691 | Python | 13,291 | 369 | """BLAST data collector."""
import logging
from typing import Any, Dict, List, Optional
from src.api.blast import BLASTClient
from src.models.genomic import Gene
from src.models.protein import Protein
from .base import BaseCollector
from config.config import settings
logger = logging.getLogger(__name__)
class BLA... |
f03f71cbae6dea1f9f650396f324ca386fbb5be47cbe3fe5e8d53c597a8c0a37 | Python | 13,292 | 370 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024, 2025 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
# pylint: disable=too-many-instance-attributes
"""Forward / backward / update related parameters for resistive processing units.""... |
653733d01afe967acdba7ad813bec0c7c7260a9fc91fc63ff7bb2e35181c91ee | Python | 13,295 | 351 | import numpy as np
import torch
import mrcfile
from scipy import ndimage
import subprocess
import sys
from moleculekit.molecule import Molecule
import os
def parse_map(map_file, r=1.5):
mrc = mrcfile.open(map_file, 'r')
voxel_size = np.asarray(
[mrc.voxel_size.x, mrc.voxel_size.y, mrc.voxel_size.z], ... |
867890a80dfe339f4cd3f3b7f2d0af3c96397ccdb3e70f694bdb02bca1ea3ceb | Python | 13,295 | 376 | """
Module to build a bioFAM model
"""
from sys import path
from time import time,sleep
#from joblib import Parallel, delayed
from .init_model import initModel
from .utils import *
class buildModel(object):
def __init__(self, data, dimensionalities, data_opts, model_opts, train_opts):
self.data = data
... |
8feb77f296dce2d5f794a84a1a75b18e640657116adee3db1ac7e125f4f69adc | Python | 13,299 | 297 | from typing import List
import numpy as np
import sak
import sak.signal
def dice_score(input: np.ndarray, target: np.ndarray) -> float:
intersection = (input * target).sum()
union = input.sum() + target.sum()
return 2.*intersection/(union + np.finfo('double').eps)
def filter_valid(onset: np.ndarray, offs... |
9a693b0681be58aa3ab98937accfce0d60b2154bfe5f8fe8ec9ec2470a018c92 | Python | 13,301 | 414 | import os
import random
import sys
import time
import pytest
import ray
import ray.remote_function
from ray._common.test_utils import wait_for_condition
from ray.dag import InputNode, MultiOutputNode
from ray.tests.conftest import * # noqa
if sys.platform != "linux" and sys.platform != "darwin":
pytest.skip("Sk... |
12767c9820578a9ec0f9bdfaac099b5eee18ae805999c6a29ecfbfa2084deeda | Python | 13,302 | 297 | import torch
import torch.nn as nn
from typing import Callable, Tuple, Union
from gaussian_denoiser.dpir_models.models.network_unet import UNetRes
import numpy as np
def load_zhang_drunet_unblind_denoiser(device: torch.device) -> nn.Module:
'''
Loads the grayscale unblind denoiser model from
https:/... |
3683d47fc97b659c9cacc40d9e58067657483724f072bcf0daeacf29e9ef4147 | Python | 13,304 | 316 | ####################################################################################################
# Copyright (c) 2019, 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 free softw... |
ab599b7f035d8de0ae15663c1832c01fd7b27bcac03b605f5d850028c92e791a | Python | 13,312 | 303 | import argparse
import pickle
from typing import List, Tuple, Optional, Callable
import numpy as np
import torch
import tqdm
import gaussian_denoiser.denoiser_wrappers as denoiser_wrappers
import lib.data_utils.data_util as du
import lib.data_utils.dynamic_data_util as ddu
import lib.dataset_config_parser.dataset_con... |
2c18dc2005a11777f4fff1b5cd4c922a74a223b1efe2a8a961da5347ecf1fc82 | Python | 13,313 | 333 | import pyBigWig
import tempfile
import os
import sys
import hashlib
import numpy as np
class TestRemote():
fname = "http://raw.githubusercontent.com/dpryan79/pyBigWig/master/pyBigWigTest/test.bw"
def doOpen(self):
bw = pyBigWig.open(self.fname)
assert(bw is not None)
return bw
def... |
39881d84022f0c1c73e979438963872010d1869c53c19c265c20fee28860a77a | Python | 13,313 | 340 | """
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 logging
import os
import random
import signal
import sys
from typing import TYPE_CHECKING
impor... |
d0ae8376148926c63c351b57fb867332f91a2cbafd6033dc1f2f06888f5f7a48 | Python | 13,318 | 358 | # coding=utf-8
import base64
import json
import os
import zlib
from collections import OrderedDict
from itertools import chain, islice, repeat
from multiprocessing import cpu_count
from operator import attrgetter
from typing import List, Mapping, Optional, Sequence, Union
import loompy as lp
import networkx as nx
imp... |
1b23df5a3460e88fa43368e8dd95ec04093ede509b3c66596a6c83e8fcf6ef29 | Python | 13,319 | 383 | from copy import deepcopy
from typing import Optional, Tuple
from warnings import warn
import torch
import torch.nn as nn
import sinabs.layers as sl
DYNAPCNN_WEIGHT_PRECISION_BITS = 8
DYNAPCNN_STATE_PRECISION_BITS = 16
def discretize_conv_spike(
conv_lyr: nn.Conv2d, spike_lyr: sl.IAF, to_int: bool = True
) -> ... |
ae5e596aedf1d98005e3537bb512091cda5f2521dc008aa77e881e65db2e6a96 | Python | 13,319 | 343 | import logging
from types import ModuleType
from typing import Dict, Optional, Union
import ray
from ray.air._internal import usage as air_usage
from ray.air._internal.mlflow import _MLflowLoggerUtil
from ray.air.constants import TRAINING_ITERATION
from ray.tune.experiment import Trial
from ray.tune.logger import Logg... |
3b43b94b3442fb2f168b0ed267baece1f082304477fe5a8e404fb32bfba9f840 | Python | 13,326 | 386 | # built-in dependencies
import os
import json
import hashlib
import struct
from typing import Any, Dict, Optional, List, Union, cast
# 3rd party dependencies
import numpy as np
# project dependencies
from deepface.modules.database.types import Database
from deepface.modules.exceptions import DuplicateEntryError
from ... |
e7e55a5aace3c19e4046fecba71e5765501bbeec417c5b73717496bae623d9e2 | Python | 13,329 | 403 | """Shared CLI helpers for alignment wrappers."""
from __future__ import annotations
import os
import shlex
import shutil
import subprocess
import sys
from concurrent.futures import ThreadPoolExecutor, as_completed
from pathlib import Path
from typing import Callable, Iterable, List, Optional, Sequence, TypeVar, cast
... |
4fbd3159194cea28c5d05a6d28f179e24992fe98841b4d19665a088f82e25407 | Python | 13,340 | 377 | import random
from collections import defaultdict
from itertools import compress
import numpy as np
import torch
from rdkit.Chem.Scaffolds import MurckoScaffold
from sklearn.model_selection import StratifiedKFold
def generate_scaffold(smiles, include_chirality=False):
"""Obtain Bemis-Murcko scaffold from smiles
... |
0e8717f4bc4df79c4bddeea57e5871c6b55440bc17307c8b2fa49e2c2229c7d1 | Python | 13,345 | 326 | import os
import torch
import torch.utils.model_zoo
import torchvision.models as models
from src.model.snn import *
from src.model.cann import CANN
from src.tools.utils import *
# gpu environment
#os.environ['CUDA_VISIBLE_DEVICES'] = "3"
device = torch.device('cuda' if torch.cuda.is_available() else "cpu")
class MHN... |
71d2c37b6f8c4f2443465166c4c2d062d196d7acf54493d629efb6dd2c9cd012 | Python | 13,345 | 331 | import copy
import sys
import os
import json
#sys.path.append('/scratch/weilenmc/repos')
module_path = '/usr/scratch/santis/weilenmc/repos'
sys.path.append(module_path)
os.chdir(module_path)
#os.environ['PYTHONPATH'] = module_path
#sys.path.append('../..')
from typing import Dict, Tuple
import numpy as np
import ray... |
13aee4b2943c2c5794015a58b210b508cb33d722836613546ffa6ec589469c03 | Python | 13,355 | 402 | """
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 copy
from functools import partial
from typing import TYPE_CHECKING, Any, Literal
from ase.atom... |
a85204a9ad6fb923a790a95ecf2f294caf7a1942b0740dcaa6a2f8911955f7ed | Python | 13,355 | 370 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Calibration for inference."""
from typing import Optional, Dict, Tuple, TYPE_CHECKING, cast
from collections.abc import Iterator
from functools import partia... |
2afbe950c52c61f7d8894144b0db341eafd26801b94310d5818dc0d2c4912bba | Python | 13,356 | 314 | import os
import pickle
import pandas as pd
import numpy as np
import nibabel as nib
import pcntoolkit as ptk
from pcntoolkit.dataio.fileio import load as ptkload
from pcntoolkit.dataio.fileio import save as ptksave
from pcntoolkit.dataio.fileio import save_nifti, load_nifti
from pcntoolkit.normative import predict, e... |
be207318dcc3a9dbde3828bc8dc94f07019b97f29a7728d85b05c6bcdeebd4ab | Python | 13,357 | 314 | import os
import pickle
import pandas as pd
import numpy as np
import nibabel as nib
import pcntoolkit as ptk
from pcntoolkit.dataio.fileio import load as ptkload
from pcntoolkit.dataio.fileio import save as ptksave
from pcntoolkit.dataio.fileio import save_nifti, load_nifti
from pcntoolkit.normative import predict, e... |
99c012180406c799c710c032307196f670d6443949180433cfd655d1301ce0fd | Python | 13,358 | 263 | from suite2p.extraction import dcnv
import numpy as np
from functools import partial
import matplotlib.pyplot as plt
from matplotlib import use
use('qt5agg')
from core import util
# Declare path variables
ROOT_DATADIR = "J:/Hansol_Yue/new_ca_social_fc_together_for_new/" # Please change to your Hansol_Yue... |
b35ed21dfaf17d7edd59540f8254ecc87702cc1d255c23bbf93a3219d67276e6 | Python | 13,359 | 401 | #******************************
# This code is for the paper:
# Deep Relation Learning for Regression and Its Application to Brain Age Estimation
# IEEE Trans. on Medical Imaging
#
# @author: Sheng He
# @email: heshengxgd@gmail.com
#
#*******************************
import torch
import torch.nn as nn
i... |
766781597d8b13cf32da38a80674c9b83f4156763262eec77133a510c8332ac4 | Python | 13,360 | 365 | # Copyright 2023 The HuggingFace Team. 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 applicabl... |
e959672ceda06e19f0bd0871a59e3355e4a910f1bf7e506a75c3191b29ed138d | Python | 13,361 | 380 | import logging
import logging.handlers
import os
import re
import sys
import threading
import time
from dataclasses import dataclass
from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Tuple, Union
import colorama
import ray
from ray._private.ray_constants import (
RAY_DEDUP_LOGS,
RAY_DEDUP... |
36ccce7f179eedc2b0736ff9baaf40eb4f406ca69f073b35e585d75cdf89502e | Python | 13,362 | 354 | # -*- coding: utf-8 -*-
#
"""
Intersect SV called by PE/SR-based algorithms.
Paired-end and split-read callers provide a reasonably precise estimation of
an SV breakpoint. This program identifies variant calls that fall within
the expected margin of error made by these programs and clusters them together.
The cluster... |
2e421f0443811e7a09d114196e0392f04f59a2b80e1579970a7f87fb71a4b92f | Python | 13,364 | 391 | import copy
import importlib
import os
import re
import secrets
import sys
from typing import Dict
# RayConfig reads the auth mode once at import, so set the mode before importing
# ray. A per-process random token, inherited by subprocesses, lets the cluster
# and this process agree without a hard-coded secret.
os.env... |
899b7c6b1791e5851ba6113a94129208a9b6eb43f68047366fd88238346f681d | Python | 13,365 | 354 | r"""Protein-structure acquisition for :mod:`omicverse.mol`.
:class:`MolStructure` is the central object — a parsed protein structure
plus its confidence metadata. :func:`fetch_structure` pulls an
experimental (RCSB PDB) or predicted (AlphaFold DB) structure;
:func:`predict_structure` folds a raw sequence with the ESMF... |
90a027f1f84abc68b8efa4ec662164dc4337486610126bad66a3b2efbbdfe86e | Python | 13,366 | 355 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 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.
#
# Any modifications or ... |
7b2dbbd73d85219ced3e487dfd234ee0620b52e3d09355df48839003842d82de | Python | 13,375 | 476 | r"""
Single-cell omics analysis utilities.
This module provides comprehensive tools for single-cell RNA-seq analysis including:
- Cell type annotation and automated identification
- Trajectory inference and pseudotime analysis
- Gene regulatory network analysis
- Cell-cell communication analysis
- Multi-modal integrat... |
ef596d4a3b014a6face57e9d2a98b6060b45d20cfc63aa0ee460fa5ebbd7ea18 | Python | 13,377 | 349 | """
All functions except covbat are forked from
https://github.com/brentp/combat.py
combat function modified to enable correction without empirical Bayes
covbat function written by Andrew Chen (andrewac@pennmedicine.upenn.edu)
"""
import pandas as pd
import patsy
import sys
import numpy.linalg as la
import numpy as np
... |
551d08e0ae3289778ad593e30b6b312d9d5104ac326a8e08bb784f9949d132ed | Python | 13,384 | 301 | """
Cache FA model and metrics for all sites.
Inspired by Umakanthan 2021 neuron paper -- bridging neuronal correlations / dim reduction
Cache script --
for each site, calculate:
- % shared variance
- loading similarity
- dimensionality
- also compute dimensionality / components of full space, includ... |
ee427d9089619d48d66f3bd4b761bba78bea51168a36e154874a18a521227bbf | Python | 13,389 | 317 | import random
import numpy as np
from torch.utils.data import Dataset
import sys
import pandas as pd
from tqdm import tqdm
from sklearn.preprocessing import LabelEncoder
from collections import OrderedDict
import os
import math
import torch
import torch.optim as optim
import torch.optim.lr_scheduler as lr_scheduler
... |
6638db949be481174809eed12e63deeda373fb85565847ed190d290a7f8a5014 | Python | 13,400 | 347 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
"""
import sys
import pandas as pd
import numpy as np
from svtk.adjudicate import rf_classify, labelers
ALLOSOMES = 'X Y chrX chrY'.split()
def adjudicate_BAF(metrics, labeler, name):
# Deletions
testable = metrics.loc[(metrics.svtype == 'DEL') &
... |
7131719297c8af6dad4e387f789880060dafc5f3b593c539a785a872da465a59 | Python | 13,401 | 468 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Device configurations presets for resistive processing units."""
# pylint: disable=too-many-instance-attributes
from dataclasses import dataclass
from aihwk... |
90d72cfe2077131118bb1140c597138bcd41c2904c4bf6075188cdc116959343 | Python | 13,404 | 365 | ####################################################################################################
# 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... |
f2ea91e42b194e7d9dc7cb20597434d7c63d498d9bc1889041ac63fea9d42842 | Python | 13,406 | 300 | """Register each run to one reference run."""
import os
import subprocess
import nibabel as nb
DATADIR = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti/derivatives'
SUBS = ['sub-05']
fixed = f'{DATADIR}/{sub}/ses-01/anat/upsample/sub-05_ses-01_uni_part-mag_run-01_MP2RAGE_N4cor_brain_crop_ups4X.nii.gz... |
c9e05d7e3b2498d45a86da1614c35de7faab6951ea8db1bcd37482b264e81eb2 | Python | 13,407 | 376 | import sys
import os
import importlib
import warnings
import subprocess
import numpy
import pandas
import collections
import psutil
from typing import Text, Any, Union, List, Optional, Iterable, Iterator, Tuple, Generic, Callable, TypeVar
from types import ModuleType
Vector = Union[List, pandas.Series, numpy.array]
N... |
a9f8fabb0e224490f9a275500292f74a77010f89cdea621eb822704d96c9b60e | Python | 13,408 | 368 | #
# 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... |
7618f174a25cbb50a1758a64c8bdccde52483ba4a88e9b01aad665a111061c4c | Python | 13,420 | 406 | from __future__ import annotations
import logging
from collections.abc import Iterable, Mapping, Sequence
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Literal
try:
from typing import TypeAlias
except ImportError: # pragma: no cover - Python < 3.10
TypeAlias = Any
import... |
b2c2f840a5b3788a5970f966d4bab011a8fb8491825a7776fbaa2298d3b00e25 | Python | 13,420 | 361 | # Copyright 2024 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, ... |
1f3c1635e162b5ae0fc24d00170f9575a6953243c272a114057548ec42ab4341 | Python | 13,424 | 361 | import numpy as np
import pandas as pd
import mne
import mne_bids
import mne_icalabel
import h5io
import autoreject
import coffeine
import meeglet
from pathlib import Path
from types import SimpleNamespace
def make_config(
subject: str,
bids_root: str | Path,
deriv_root: str | Path,
session: str, # e... |
fdc7db286c40770b7cd843f82fa24bd5503f242cfcd81a95e3de0cb62250113c | Python | 13,426 | 346 | import torch
import torch.nn.functional as F
from torch import nn as nn
from torch.autograd import Variable
from torch.nn import MSELoss, SmoothL1Loss, L1Loss
from pytorch3dunet.unet3d.utils import expand_as_one_hot
def compute_per_channel_dice(input, target, epsilon=1e-6, weight=None):
"""
Computes DiceCoef... |
fe4ff50b4e7747824460da8ef651f6ba2fa566ff95d7d88f752c9aa0b1635923 | Python | 13,426 | 344 | from numpy.random import seed
seed(1)
import tensorflow as tf
tf.random.set_seed(1)
import random
random.seed(1)
import tensorflow as tf
import csv
import numpy as np
import SimpleITK as sitk
import matplotlib.pyplot as plt
from numpy import argmax
import pandas as pd
import tensorflow.keras.backend as K
... |
bbd89f4b42ddd2180319c41a9a33b4e06fe1f9eb1839aed1092583cd71c23793 | Python | 13,431 | 322 | import copy
import os
import random
from typing import Any, Dict, Iterable, Optional, Union
import numpy as np
import torch
from .utils import deprecate
def enable_full_determinism(seed: int):
"""
Helper function for reproducible behavior during distributed training. See
- https://pytorch.org/docs/stabl... |
160a05c633fee2f1f80f6f883e93f5419257d1367990247a879e93d4686768d4 | Python | 13,434 | 421 | # Vendored from `decoupler` (https://github.com/scverse/decoupler) by
# omicverse for in-tree GPU acceleration work. Original copyright by
# the decoupler authors, redistributed under decoupler's GPL-3.0
# license. Cross-module imports rewritten from `decoupler.*` to
# `omicverse.es.*` (see scripts/vendor_decoupler.py)... |
a08b2e8ef613dc48873fd9f4793d7d98fc08db983e1d527827e2d9cb673ef4b8 | Python | 13,438 | 296 | # Copyright 2023 The HuggingFace Team. 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 applicabl... |
20f0332a27d4c44bcde5ad963a7a3667381576956b7c0e62679aa2bf41f9e0e6 | Python | 13,444 | 312 | import numpy as np
import torch
from torch import nn
from torch.functional import F
from torch.optim import Adam
from torch_geometric.nn import MetaLayer, MessagePassing
from torch.nn import Sequential as Seq, Linear as Lin, ReLU, Softplus, Sigmoid, Softmax
from torch.autograd import Variable, grad
class SDIdifftype(M... |
2e2f2e75e23fe0f6feb98e281eff66f3c2f9b0522ce9ee80f043b8361c56db24 | Python | 13,447 | 279 | import torch
import torch.nn.functional as F
def single_bin_flashed_recons_compute_coupling_exp_arg(stacked_coupling_filters: torch.Tensor,
coupled_sel: torch.Tensor,
all_observed_spikes: torch.Tensor) -> tor... |
2b4e90b66283ca66163e86176984c9215e25f9eb6a10a1dd7bec68b8d092cfdc | Python | 13,448 | 401 | import binascii
import collections
import os
import pickle
from datetime import datetime
from struct import calcsize, pack, unpack
from pfrl.collections.random_access_queue import RandomAccessQueue
# code for future extension. `_VanillaFS` is a dummy of chainerio's
# FIleSystem class.
_VanillaFS = collections.namedtu... |
27b15efed0559d62d564040d372875df5f092dccdc240b84949a2eb515acea60 | Python | 13,449 | 358 | import multiprocessing as mp
import nibabel as nib
import nipype.interfaces.io as nio
import numpy as np
import os
import pandas as pd
from itertools import product
from joblib import Parallel, delayed
from os import path
# PyBIDS 0.6.5 and 0.10.2 compatibility
try:
from bids.grabbids import BIDSLayout
except ModuleNo... |
9ae5b8ae4bbf90fa37e404ed6dc37afd398e2ed22dcf88d07f55e6993837d769 | Python | 13,451 | 462 | """
This file serves as a documentation example and CI test for basic LLM batch inference.
"""
# __basic_llm_example_start__
import os
import shutil
import ray
from ray.data.llm import vLLMEngineProcessorConfig, build_processor
# __basic_config_example_start__
# Basic vLLM configuration
config = vLLMEngineProcessorC... |
9ebbb6d4d824a25f7f6af4bda9277e39717735a06b4a00b56a3b9afa730cab53 | Python | 13,457 | 447 | # -*- coding: utf-8 -*-
"""This module defines everything that goes in vtkplotlib.image_io.
"""
import sys
import os
import io
import numpy as np
from pathlib import Path
from vtkplotlib._get_vtk import (vtk, vtk_to_numpy, numpy_to_vtk, numpy_support,
VTK_VERSION_INFO)
from vtkplotl... |
267c65838894bc1b4263edc531ef1f44a8d9e905f774546022d335c246e0c384 | Python | 13,459 | 348 | #
# \file generator.py
#
# \brief Generates the CUTLASS Library's instances
#
#
import enum
import os.path
import shutil
from library import *
###################################################################################################
#
class Conv2dOperation:
#
def __init__(self, conv_... |
5c50f3b7675501dd23593320b68726bcbca46bad8444726b8b698cd1ad51dc92 | Python | 13,461 | 424 | # 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, ... |
f1d80ffeb25a7969703a3b4bfd1cd634fe6fb86fd59a41a41de903028af36466 | Python | 13,461 | 391 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 7 10:57:35 2021
@author: naomi
"""
from scipy import special
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.gridspec as gridspec
from matplotlib import ticker
import random
import os
os.environ['QT_QPA_PLATFORM'] = 'offscreen'... |
af509cdea497a47c5dc0eb7b17072c554fe7829005ced22009aa2cd3dec1d882 | Python | 13,476 | 344 | from __future__ import annotations
import gc
import logging
import os
from collections import defaultdict
from functools import partial
from pathlib import Path
import anndata as ad
import numpy as np
import pandas as pd
from scipy.stats import norm
from concurrent.futures import ThreadPoolExecutor
from tqdm import t... |
8beafc9787e651cb69df70721c7bc5039a0c52904ba184b398ee1e66d88be5c5 | Python | 13,481 | 340 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Tests for general functionality of layers."""
# pylint: disable=too-few-public-methods
from tempfile import TemporaryFile
from unittest import SkipTest
from... |
904696f5a1aeac5dbd03622bddcab4d673cb44fc07512a0939adbd599799c308 | Python | 13,482 | 264 | import os
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.utils.data import DataLoader
import argparse
import time
import datetime
from torch.utils.tensorboard import SummaryWriter
import functools
import numpy as np
from DWonder.RMBG.utils import FFDrealign4, inv_FFDreali... |
315c52d2083471696c18b80f1137d97246668e4c03d7dec37fd87acf62bceb38 | Python | 13,489 | 353 | # built-in dependencies
import os
import re
import json
import hashlib
import struct
from datetime import datetime, timezone
from typing import Any, Dict, Optional, List, Union, cast
# 3rd party dependencies
import numpy as np
# project dependencies
from deepface.modules.database.types import Database
from deepface.m... |
bec851e53e526832add60556c719293c1608f3e8332ec203162de0f7923f048d | Python | 13,499 | 426 | import re
from typing import Iterable, List, Optional, Tuple, Union
import numpy as np
import torch
from numpy.typing import NDArray
from flyvis import connectome
from flyvis.utils import groundtruth_utils
def order_node_type_list(
node_types: List[str],
groups: List[str] = [
r"R\d",
r"L\d",... |
286c625c7d65b737fa55f28fe42263c9c6250d882786a0a8da9bcb7b46837b41 | Python | 13,500 | 306 | # 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, sof... |
ab7ade3e16f0a4ce813ef55245204d03f0fa3a9a889dc82aaed03a2f8a1eccbd | Python | 13,501 | 341 | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import numpy as np
from unicore.data import (
Dictionary,
NestedDictionaryDataset,
LMDBDataset,
AppendTokenDataset,
Pr... |
476fffce1fd31510110af5e501b3963f082f7d0b2f371677a9d5d275b0e4de8d | Python | 13,504 | 306 | # This file will containa ll the necessary function for extracting waveform parameters from average waveforms
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import detrend
import scipy as sp
from scipy.ndimage import gaussian_filter
import pandas as pd
def detrend_waveform(waveform):
"""
... |
0bcb9c58810b40ab8b8b864eae6a37b0d595f75a25976c4b7f1e3a3203e32ec2 | Python | 13,509 | 394 | # built-in dependencies
import os
import json
import hashlib
import struct
from typing import Any, Dict, Optional, List, Union, cast
# 3rd party dependencies
import numpy as np
# project dependencies
from deepface.modules.database.types import Database
from deepface.modules.exceptions import DuplicateEntryError
from ... |
f9e0b900a91ea2fca9f586979bc5ec65ee7a2342bc88f97c9ddd46ac963d3219 | Python | 13,511 | 295 | import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Network(nn.Module):
"""
Registers the coordinates of CA atoms and the rotations of local coordinate
systems as learnable parameters.
batch (int): number of structures to predict simultaneously
length ... |
099b4c617052a9ef45b8d361639fc696b43a02a9fe5e039660706d522cdeb6ad | Python | 13,513 | 360 | """
Unified output utilities for SCLLM models.
This module provides consistent progress bars, status messages, and formatting
across all SCLLM models (scGPT, scFoundation, Geneformer, CellPLM).
"""
import sys
from typing import Optional, Any, Dict, List
from tqdm import tqdm
import contextlib
from io import StringIO
... |
6797b8109d3cd6508af04431897a68e945564424ac038cbaa41add2089d31b6b | Python | 13,513 | 394 | from itertools import product
import numpy as np
import pytest
import torch
import torch.nn as nn
import sinabs.activation as sa
from sinabs.layers import LIF, LIFRecurrent
def test_lif_basic():
torch.set_printoptions(precision=10)
batch_size, time_steps = 10, 100
tau_mem = torch.tensor(20.0)
alpha ... |
c3ce68a2696877f11fb3f711c00d294dfd238623989acaab5e55dc8ecee241ad | Python | 13,522 | 440 | """OpenTargets Platform API client."""
import logging
from typing import Any, Dict, List, Optional
import json
from .base import BaseAPIClient
from ..config import settings
logger = logging.getLogger(__name__)
class OpenTargetsClient(BaseAPIClient):
"""Client for OpenTargets Platform GraphQL API.
Ope... |
f8d82cdabd4fd00b78d735fc8131e2cc895d470286a678ede0e37d4d86980f8b | Python | 13,524 | 440 | """OpenTargets Platform API client."""
import logging
from typing import Any, Dict, List, Optional
import json
from ..base import BaseAPIClient
from ...config import settings
logger = logging.getLogger(__name__)
class OpenTargetsClient(BaseAPIClient):
"""Client for OpenTargets Platform GraphQL API.
O... |
e8d28be52558d7fcd5f6204293cff19a5916ae86c6eafe1e2644d02e19438089 | Python | 13,525 | 408 | #%% read csv
import pandas as pd
# df = pd.read_csv('./data/model_predictions_after_corr_stripped/fig_2c_combined.csv')
df = pd.read_csv('/home/skowshik/publication_ADRD_repo/adrd_tool/model_predictions_stripped_MNI_swinunetr/fig_2c_combined.csv')
#%%
import matplotlib as mpl
import matplotlib.pyplot as plt
import num... |
b1617a9237275a17e551a2610d85d7c78a6b725677bcbc2f90380f3fd0fc92ba | Python | 13,531 | 359 | """Plotting for ``ov.protein``.
Diagnostic + result plots for the bulk-proteomics workflow:
* :func:`volcano` — log2FC × -log10(adj.P) scatter for a DE result.
* :func:`missing_pattern_plot` — heatmap of per-protein × per-sample
missingness (white = observed, dark = missing).
* :func:`abundance_rank_plot` — per-sam... |
e7a786663dd037c476178293f184a2db35144c7724afc9c5f403687085318138 | Python | 13,532 | 387 | """Ensembl data collector."""
import logging
import json
from typing import Any, Dict, List, Optional
from src.api.ensembl import EnsemblClient
from src.models.genomic import Gene, Variant
from src.models.protein import Protein
from .base import BaseCollector
from config.config import settings
logger = logging.getL... |
4a437256c08086a167e2153b58853fe1edbe62b96faefdb88acf92d3a60446dd | Python | 13,534 | 316 | r"""Layer A — enzyme-constrained metabolic models (a lightweight GECKO).
This is the metabolic half of the A↔B hinge that distinguishes ov.synbio from
a metabolism-only or a protein-only toolkit: turn a per-reaction turnover
number :math:`k_{cat}` (which the protein layer can *predict* from an enzyme
sequence via :fun... |
a402d2496651ac1c661f20410027cd1c9c8508485477403f414370a476f7f905 | Python | 13,536 | 396 | import sys
import copy
import numpy as np
import warnings
from scipy.special import erf
from scipy.stats import pearsonr
sys.path.insert(0, '/home/mhg19/Thesis/network')
from network import Population, RateNetwork
from transfer_functions import ErrorFunction, ReLU
from connectivity import SparseConnectivity, LinearSyna... |
008cd8aadc142da5d5f31dff0874a8dbaa33a2b2214ebeaaf91d558398cfbbdb | Python | 13,538 | 268 | from os import path
import nipype.pipeline.engine as pe
import nipype.interfaces.ants as ants
from nipype.interfaces import fsl
from samri.pipelines.utils import GENERIC_PHASES
def autorotate(template,
in_file='structural.nii',
):
"""Multi-rotation-state transformation start. This allows the registration to commen... |
3b0aa35d30208aa7a5dfbae6f51789e74f2690e7f4faa6588dcd5aa2a337990c | Python | 13,545 | 427 | # !/usr/bin/python
# ----------------------------------------------
# Repeat the multi-region analysis using scanpy:
# ----------------------------------------------
import glob
import h5py
from scipy import sparse
import re
from sklearn.utils import sparsefuncs
# from sklearn.decomposition import IncrementalPCA
# from... |
1ce4dfdc740f00c518955b4161654bec0f1356d537b1955bc489ab1e6ff134dd | Python | 13,549 | 298 | # Copyright 2023 Peter Willemsen <peter@codebuffet.co>. 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 requ... |
a01441b84d965aef1dd7657d1c3d0657385d6c023da2e51a6cf0d291dc6481ce | Python | 13,550 | 365 | """
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 functools
import json
import logging
import os
import random
import timeit
from collections impo... |
0cd7b8c1a1836422e18e6b749a22ee086cbb3b982b2f326e9abeab49c316b78a | Python | 13,557 | 288 | from copy import deepcopy
from typing import Literal, Tuple, Union, List
import torch
from batchgenerators.utilities.file_and_folder_operations import isfile
from dynamic_network_architectures.architectures.abstract_arch import AbstractDynamicNetworkArchitectures
from torch._dynamo import OptimizedModule
from nnunetv2... |
a42ed9a4dbae64362af625097b34fbfd3013a94613fd4b18f9e69527c3064c94 | Python | 13,558 | 438 | #!usr/bin/python
# -------------------------------------------------------------
# Compute co-expression modules within python scanpy framework,
# Using data loader + modules + graph handlers
# Created: 06/16/21
# -------------------------------------------------------------
import sys
bindir = '/home/cboix/data/DEVTRA... |
38811b06e8818ee1a189be88f8c3cf7873d01ec0e0c245849a514f1fa9d30fdd | Python | 13,571 | 391 | """
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 argparse
import hashlib
import json
import logging
import os
import pickle
import tempfile
impor... |
c23c89344b1acd9b280e47d91a86497612529c94d88c322b5c5396bcea9ffa6e | Python | 13,571 | 347 | # This is a script for training of the penalized CNN for Motion Artifacts Removal
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
# Import the necessary libraries
import tensorflow as tf
from tensorfl... |
7ef20eb274c5610fc534e7ad7ddae9795ccb9e128193b98cfabc8d201d2780f3 | Python | 13,580 | 347 | """
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.
Crystal Structure Generation Module using Genarris
This module provides functionality for generating putative crystal structures using
the Gen... |
3bb2f3b59cfd1dfc009e8e42f26434fc80a9cc060ee77852b4d2301fb3718ace | Python | 13,586 | 472 | # -*- 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=missing-function-docstring,too-few-public-methods
"""Models helpers for aihwkit tests."""
from typing import Any
from torch.nn import (
B... |
70d016612e581e286cdfe727d45b5be17faa5b5114b33e3c0093b3056a688d7b | Python | 13,587 | 374 | r"""Mummichog — pathway inference directly from m/z peaks.
For untargeted LC-MS data where you have m/z values but no compound
annotations, mummichog (Li et al 2013) does two things:
1. **Adduct-aware mass matching** — each m/z peak could represent
several candidate KEGG compounds (e.g. ``[M+H]+``, ``[M+Na]+``,
... |
fc969eb302ad7f385d58d2fb3862e7ee7484043ff2816adf409a6cb429aecdd4 | Python | 13,589 | 417 | # 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, ... |
0702248c9d7a7d71e2140465f238002f29c29280d929b7fa5dab20bcb52a5588 | Python | 13,592 | 390 | """NeuralNet subclasses for classification tasks."""
import re
import textwrap
import numpy as np
from sklearn.base import ClassifierMixin
import torch
from torch.utils.data import DataLoader
from skorch import NeuralNet
from skorch.callbacks import EpochTimer
from skorch.callbacks import PrintLog
from skorch.callba... |
42c0b137e0f855d7460905cb9261de77da0b29dd3dfffa9e32d4b1e521c69adc | Python | 13,597 | 473 | import collections
import glob
import logging
import os
import re
import numpy as np
import scipy.stats
import torch
NUMPY_RANDOM = np.random
class Identity(torch.nn.Module):
def __init__(self):
super().__init__()
def forward(self, x):
return x
def pos_inf(dtype):
return torch.finfo(d... |
ac8d6894883dd0c2f9b3a7ebcb56e259015fd954f6003a0c181e815ac56cef39 | Python | 13,609 | 385 | """Test for cli.py"""
from math import cos
from unittest.mock import Mock
from unittest.mock import patch
import numpy as np
import pytest
from sklearn.pipeline import FeatureUnion
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import MinMaxScaler
from torch import nn
from torch.nn import RReLU
fi... |
84b9b24be90030c0c51f08cda8f1f99dca927fba760b7fded05981363546e56c | Python | 13,610 | 420 | """
Generates a single image that has a sub-image for every reference found in all of the projects supplied.
It uses the already generated :doc:`../qualdepth` for each sample to create a single multi-colored line to easily show where Gaps, LowCoverage, LowQuality and LowCoverage+LowQuality regions are.
Help usage
====... |
6d0bb97d69c5388d1140f315b284c2e08dcadc3a75219645731e5b765ed9f656 | Python | 13,611 | 326 | #!/usr/bin/env python
""" create a groundtruth for different videos
use for nosetests and continuous integration development.
See Also
------------
caiman/tests/comparison/comparison.py
"""
# \package None
# \version 1.0
# \copyright GNU General Public License v2.0
# \date Created on june 2017
# \author: Jeremie ... |
8932b55fce278de658b92c97c041a1ee1c0446468e1435ed43b8331b95973449 | Python | 13,613 | 430 | """
Utilities for tedana package
"""
import logging
import os.path as op
import warnings
import nibabel as nib
import numpy as np
from nilearn._utils import check_niimg
from scipy import ndimage
from sklearn.utils import check_array
LGR = logging.getLogger("GENERAL")
RepLGR = logging.getLogger("REPORT")
def reshape... |
017f5aafd2135274020c1ab2a885b8f4fa5d59f481d1f0ee31b7c31ac12633fe | Python | 13,614 | 374 | #!/usr/bin/env python3
"""
Load testing script for the Ray Serve video API.
Usage:
python -m client.load_test --video s3://bucket/path/to/video.mp4 --concurrency 4
python -m client.load_test --video s3://bucket/video.mp4 --concurrency 8 --url http://localhost:8000
python -m client.load_test --video s3://bu... |
6b2333e706d4145635f4daef0946e47342308ba99af07ccc77125b10520a8e7f | Python | 13,620 | 341 | """
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 logging
from typing import Literal
import torch
from torch import nn
from fairchem.core.common... |
4de7f4c16cdba091ca22c0de2ba6bc71f7ec4b50a89bd7255dbef4a72db9c3a5 | Python | 13,624 | 408 | import argparse
import os
import time
import gzip
import pickle
import numpy as np
import pydicom as dicom
from pathlib import Path
from copy import deepcopy
from time import strftime
from functools import partial
import os
import glob
from PIL import Image
from skimage.morphology import skeletonize
from copy import de... |
7ca9b5e0ff5a7901fd1aef1fbbd74d57629adb003651b004485542e7ae664f6b | Python | 13,628 | 326 | """
The script does the following:
- compute custom f1 score for each spinal level
- compute mean f1 score across slices for each level
- compute dice score for each spinal level
- compute mean dice score across slices for each level
- produce PDF report for rootlet segmentation task
The script req... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.