sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
1f535eff7a225de7a60bce1f40302e5937a0a8619c0e3b0d6152b08b519d7824 | Python | 10,821 | 305 | import pandas as pd
import numpy as np
from scipy.stats import fisher_exact
from scipy import stats
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
from anndata import AnnData
from typing import Optional, List, Tuple
def odds_ratio(
adata: AnnData,
s... |
da500fbb9bad9be844cb6bfad4cb15480a22b48174460c826d12481818f554a4 | Python | 10,822 | 314 | import copy
import logging
import logging
import pickle
import sys
from pathlib import Path
from pprint import pprint
import click
import pandas as pd
import numpy as np
import plotnine as p9
import yaml
from typing import Tuple
from deeprvat.utils import pval_correction
from tqdm import tqdm
logging.basicConfig(
... |
6c477b6e04f7df688a5bcbe0d567f9264ec28ac71c6febcc16fcdf585d7b3618 | Python | 10,831 | 293 | """UniProt data collector."""
import logging
from typing import Any, Dict, List, Optional
from datetime import datetime
from src.api.uniprot import UniProtClient
from src.models.protein import Protein, ProteinFeature, GOTerm
from .base import BaseCollector
logger = logging.getLogger(__name__)
class UniProtCollect... |
49b1a6ccfe67203c8021aaf3e43b94c8d2c6b1539b4b91d1e71c1f2ca159db41 | Python | 10,834 | 241 | '''
Functions for computing evaluation metrics.
Some codes used for GRN evaluation are referenced from https://github.com/murali-group/Beeline.
'''
import pandas as pd
import numpy as np
from sklearn.metrics import precision_recall_curve, roc_curve, auc
from itertools import product, permutations
from scipy.sta... |
4c771422eebb4a241dfe5cb078d720bb287ba70815999d3a08b1120f01dec177 | Python | 10,839 | 304 | from multicamera_acquisition.interfaces.camera_base import BaseCamera, CameraError
import PySpin
class FlirCamera(BaseCamera):
def __init__(self, index=0, lock=True, **kwargs):
"""
Parameters
----------
index : int or str (default: 0)
If an int, the index of the camera ... |
3feb5a5375c90dc93d18fe07ca519a371fd859acb85edf82f7fd6df0e7385d75 | Python | 10,842 | 264 | from typing import Optional, Tuple, Union
import torch
from einops import rearrange, reduce
from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNet2DConditionModel
from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput
from diffusers.schedulers.scheduling_ddpm im... |
d75a83fc3fd8f5c1f7aaeb01fbdb766650d130f2d3f8af00b5be9a3421b451ac | Python | 10,844 | 336 | #######################################################################################################################
# Utility functions for visualisation and evaluation. #
# Author: Daniel Schirmacher ... |
3fdff3b9e8fabd85d6e8ddedf190058182d3a13b42d6cce492214d077cf37bdf | Python | 10,847 | 256 | from PIL import Image, ImageTransform
from common import ImageLoader
import numpy as np
import glob
import os
import sys
import shutil
import matplotlib.pyplot as plt
import skimage.restoration
def downscale_mean(image, factor):
image = image[:image.shape[0]//factor*factor,:image.shape[1]//factor*factor]
ima... |
8c5d7c6d2be4e91799e645a653430a246af0804c5785b85cfc35828da5834e90 | Python | 10,853 | 336 | """This is the script for `ray microbenchmark`."""
import asyncio
import logging
import multiprocessing
import ray
import ray.experimental.channel as ray_channel
from ray._common.utils import (
get_or_create_event_loop,
)
from ray._private.ray_microbenchmark_helpers import asyncio_timeit, timeit
from ray._private... |
e2eb9eb7ce9f1dae956920fd62f7fac1b94943e98a2013b2886438e3d630787d | Python | 10,853 | 248 | import logging
from typing import Any, Callable, Iterable, Optional, TypeVar, Union
from ray.data._internal.execution.interfaces import TaskContext
from ray.data.block import Block, UserDefinedFunction
from ray.util.annotations import DeveloperAPI, PublicAPI
logger = logging.getLogger(__name__)
T = TypeVar("T")
U = ... |
fce532dd2d952ec874f7cf146ebdeab71c6eea9b4ee7a7bfc5e1e2aedd61ec1b | Python | 10,862 | 300 | import os
from urllib.parse import urlparse
from urllib.request import url2pathname
from ray._common.runtime_env_uri import Protocol
RAY_RUNTIME_ENV_HTTP_USER_AGENT_ENV_VAR = "RAY_RUNTIME_ENV_HTTP_USER_AGENT"
RAY_RUNTIME_ENV_BEARER_TOKEN_ENV_VAR = "RAY_RUNTIME_ENV_BEARER_TOKEN"
_DEFAULT_HTTP_USER_AGENT = "ray-runtime... |
063d61aa940bd0d85f198e76ac5e550efa4ecc8de1f79ad5f704c6e5071bd653 | Python | 10,867 | 278 | from __future__ import annotations
from dataclasses import dataclass
import numpy as np
@dataclass(slots=True)
class ShufflingTestResult:
randomized_mse: np.ndarray
real_mse: float
@dataclass(slots=True)
class SimplsModel:
x_mean: np.ndarray
y_mean: np.ndarray
x_weights: np.ndarray
x_loadi... |
b372ea04719221d9d430888b46256ddca3e067c3f0d2d767ba2731df4d73164f | Python | 10,870 | 309 | # 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, ... |
b1fe957796ed123e788d5812ec66c39be40685a3f99561deca0206ae0e46ad13 | Python | 10,873 | 351 | """Artifact persistence and debug-output helpers for the agentic turn loop.
Extracted from ``turn_controller.py`` during Phase 2 decomposition.
These helpers handle harness history persistence, conversation logging,
and execute-code debug-output persistence to the workspace results directory.
"""
from __future__ impo... |
4198b496c933a2c394aed5df5390368c873d288ce6636ccedcca8da1b5372693 | Python | 10,876 | 349 | import hydra
import numpy as np
import torch
import wandb
from sklearn.metrics import accuracy_score, roc_auc_score
from torch import nn, optim
from torch.nn import BCELoss
from torch.utils.data import DataLoader
from torch.utils.data.dataset import Dataset
class BinaryTensorDataset(Dataset):
"""
Given two da... |
c0cc3916f914f59aae47f15559050b88319821c83cab6270f278d00caa7891d2 | Python | 10,879 | 294 | """
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 warnings
from collections import defaultdict
from pathlib import Path
from typing... |
146b1a1ff50576c316e3453ccb343464c2322b6c2ad5e43b11ff5be740e68b5d | Python | 10,883 | 275 | from imports import *
class Base(common.BaseClass):
modulepath = 'ngs_mapper.reads'
def check_trimmed_against_record( self, trimmedrec, record, trim=True ):
''' Check trimmed seq against initial record '''
# Useful values to check
origseq = record.seq._data
trimseq = trimmedrec... |
c9f9595c4146c17baf408a3ce7adb59e80fb392a349b62b0a34742025a3346bb | Python | 10,886 | 313 | """
Deals with the socket communication between Python (server) and Fortran (client or driver)
"""
import socket
import select
import numpy as np
import time
from datetime import datetime
import pickle
from aptnn.atom import Atom, Frame
__all__ = ['InterfaceSocket']
HDRLEN = 12 # Messages arbitrary length
T... |
fdd1ff63f1f10ac564cb4b74cd3333f9fda7805893051f5d9ea9f9771e3fa8b0 | Python | 10,886 | 229 | import torch
import logging
from torch import nn
from os.path import exists
from transformers import logging as transformers_logging
from agent.data.entities.config import MODELS_CACHE_PATH
from agent.classifiers.lstm_classifier import LSTMClassifierOutput, LSTMClassifierHidden
from agent.classifiers.utils.random_mgm... |
eb4f6cfb500a8164af55d21f0647ad4975799b8be0d856d9979ca3733e230e65 | Python | 10,887 | 235 | ####################################################################################################
# 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... |
364d06d7481f9cc9553c4732b25e22eecede8e3855e482e3a2907644eb7031b7 | Python | 10,893 | 246 | ####################################################################################################
# Copyright (c) 2023, 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... |
054faf70371eb8e8b2331ac4579cf1213c999f547311e6312054afa242b01e43 | Python | 10,895 | 366 | import gc
import threading
import time
from collections import Counter
from typing import Any, Optional, Type
import pytest
import ray
from ray.air import ResourceRequest
from ray.air.execution import FixedResourceManager, PlacementGroupResourceManager
from ray.air.execution._internal import Barrier
from ray.air.exec... |
eab11f290aa940dd165faf3b0cbbee5cfaa976c6b86318fec0ef5201ac05c59e | Python | 10,897 | 294 | """
WebSessionBridge — mirrors jarvis channel turns into OmicClaw web AgentSessions.
This module is the glue between the jarvis channel layer and the OmicClaw web
SessionManager. It is intentionally dependency-free at import time: the web
SessionManager is passed in at construction, so this file can be imported even
... |
55d202388922b94d62f46368ed31d3c254bff64515a9fe12e8cfb0c115952718 | Python | 10,905 | 267 | import exputils as eu
import numpy as np
import plotly.subplots
# TODO: Bugfix - if sveral subfigures are shown, then the boxes are positioned in each plot as if they are plotted
# in one subfigure
def plotly_box(data=None, config=None, **kwargs):
default_config = eu.AttrDict(
subplots=eu.AttrDict(... |
d6527345564ac60de90143c47e50851dde09d6b66c5a82f76987d3157e1974b0 | Python | 10,908 | 230 | """
Statistical genetics for omicverse — a unified post-GWAS analysis suite.
``ov.genetics`` is the analogue of ``ov.protein`` for human statistical
genetics: it threads the major post-GWAS analyses — eQTL mapping,
fine-mapping, colocalization, Mendelian randomization, single-cell
disease-relevance scoring, LD score r... |
473512ae0817bb5ced4a19e63338c68538e22ead64766248a4b07e5b049b985e | Python | 10,909 | 391 | # 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... |
3752cc22a2bf486a461c4a9086bd3dbd5ef01a890d4d6d8aa84e9c30c2852fa6 | Python | 10,910 | 331 | import logging
import os
import signal
import subprocess
import sys
import numpy as np
import torch
import torch.multiprocessing as mp
from torch import nn
from pfrl.experiments.evaluator import AsyncEvaluator
from pfrl.utils import async_, random_seed
def kill_all():
if os.name == "nt":
# windows
... |
b4a63312790622d714c4ae2665c37cf706ef04026f69f5c4f20a1a84e8d2feda | Python | 10,916 | 299 | import dataclasses
import itertools
import logging
import threading
from collections.abc import Generator
from typing import Any, Callable, Iterable, Optional, TypeVar
from ray.data._internal.util import _InterruptibleQueue
logger = logging.getLogger(__name__)
SENTINEL = object()
WorkItemT = TypeVar("WorkItemT")
Res... |
00b9780dc4d3acdc60c098853b10b5309b5ed4a98ff1e8afb6c49e6c463a6a73 | Python | 10,917 | 236 | """Dataset discovery and protocols mirroring the supplied MATLAB common functions."""
from dataclasses import dataclass
from pathlib import Path
import csv
import re
import numpy as np
EXTENSIONS = {".bmp", ".png", ".jpg", ".jpeg", ".tif", ".tiff", ".pgm"}
@dataclass(frozen=True)
class Record:
path: Path
lab... |
420cf54fefb04201e0aa169cbba769d1d8065388b5a1d4a412c0a86c972e7bcb | Python | 10,917 | 311 | # Copyright 2020 by Gongfan Fang, Zhejiang University.
# All rights reserved.
import warnings
import torch
import torch.nn.functional as F
def _fspecial_gauss_1d(size, sigma):
r"""Create 1-D gauss kernel
Args:
size (int): the size of gauss kernel
sigma (float): sigma of normal distribution
... |
405944c2a8bd5ddd229edacc7bbf11f1fc70d27130e98bf4d8b03082e4691da6 | Python | 10,920 | 297 | # Modified from https://github.com/open-mmlab/mmediting/tree/1.x/
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmengine.logging import MMLogger
from mmengine.runner import load_checkpoint
from lqit.registry import MODELS
def init_weights(module, init_type='normal', init_gain=0.02):
"""... |
622ffba6c731aa4979790fee0ab66cda7b154493e15d5fa5b3e2d48e80f62128 | Python | 10,920 | 291 | import numpy as np
import dill as pickle
from hic3defdr.util.matrices import select_matrix
class CoreHiC3DeFDR(object):
"""
Mixin class providing core saving and loading functionality for HiC3DeFDR.
"""
@property
def picklefile(self):
return '%s/pickle' % self.outdir
@classmethod
... |
d14d8a28d877d3b3b4d6bea3f54368b373bc50fc30717ca8fb9dafbca75ee5c7 | Python | 10,922 | 354 | """
JSON Schema generation from Python function signatures.
Converts registry function signatures and type annotations into MCP-compatible
JSON Schema ``inputSchema`` objects. Handles AnnData/MuData replacement with
``adata_id``, kwargs expansion, and override merging.
"""
from __future__ import annotations
import ... |
0f443a8a3d6639460f51068ba5473c41f0ac605549ab7bdc65b9b882b0b0333e | Python | 10,934 | 339 | #!/usr/bin/env python3
"""Train a network on MIL h5 bag features."""
import os
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Optional, Sequence, TypeVar, Union
from warnings import warn
import h5py
import numpy as np
import pandas as pd
import torch
import torch.nn.functional as F... |
aa7f2e3e552bdca854723f7993411b1521ec3ad9bd57e20979d88879863f79c1 | Python | 10,937 | 355 | """
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.
# Copyright (c) Meta Platforms, Inc. and affiliates.
# Borrowed from https://github.com/facebookresearch/mmf/blob/main/mmf/common/registry.py.
... |
819e400f48ed2c4d1e50c040c0b8191aefe6646d7ef10d445e635543a62d96de | Python | 10,939 | 317 | """Tests for downloading and loading the models on first use instead of at import.
None of these tests needs the network or the real model files: the download function
and ``tf.saved_model.load`` are replaced by recorders, and the weights are tiny
placeholder files.
"""
import os
import subprocess
import sys
import th... |
d800819ab04e46b6cdf58f2b4081105d1b74406cb27ac6e57f017a8e5d8cebd1 | Python | 10,941 | 228 | import torch
from torch.utils.data import Dataset, DataLoader, SubsetRandomSampler, random_split
import pandas as pd
import numpy as np
import os
import random
from collections import defaultdict, Counter
from itertools import combinations
import json
import torch.nn as nn
import torch.nn.functional as F
from sklearn.m... |
facc24f2d8e9869238c5f172f006fd32a24ab30401f49c4cc3c1c00f8ec9a0d0 | Python | 10,954 | 239 | import argparse
import pickle
from typing import List
import numpy as np
import torch
import lib.data_utils.data_util as du
import lib.data_utils.dynamic_data_util as ddu
import lib.dataset_config_parser.dataset_config_parser as dcp
from denoise_inverse_alg.poisson_inverse_alg import reinflate_cropped_lnp_model, pois... |
3f5917a4ccdd5f90e5c067d65b416e9768e7030c0ffd81d50957d56fa31dc6f5 | Python | 10,955 | 299 | from __future__ import annotations
from typing import Optional, Tuple, Union
from numbers import Number
import numpy as np
from scipy.linalg import eigh
import jax
import jax.numpy as jnp
from jax.ops import segment_sum
from quspin.operators import quantum_LinearOperator
from ..state import State, DenseState... |
c0d7a1949fdbbdc98301ddc1d561ba33daf3e9fc6692371f9291a840436b0c02 | Python | 10,956 | 306 | # Copyright 2021 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... |
ccfacb5e4cfc3bda85d985a766468176fe7064f629b6a4114cb97e1f9e9d6a78 | Python | 10,956 | 262 | ####################################################################################################
# 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... |
547d97879a0c4885d39d5cfdbf6fbbf9f421b8bf8175e1289cff919bdd1add50 | Python | 10,957 | 313 | # -*- 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=no-name-in-module, import-error
"""Mappings for version 1 of the AIHW Composer format."""
from collections import namedtuple
from typing impo... |
8b7d2ab5c8db6360da9909cd7a7a20de271cf3c67eb6e7fd65daf4cd2b87db75 | Python | 10,960 | 306 |
import numpy as np
import os
import random
from collections import Counter, defaultdict, OrderedDict
import random
from lisa.core.genome_tools import Region
class Gene:
'''
A gene has a unique genomic region, an accepted name, and aliases that also correspond to that gene or genomic region
'''
def __... |
25641b0cc39e433c9c8e7839717ab33eba69cdf4ed1d1895ffb42381d10be4e9 | Python | 10,962 | 254 |
import pandas as pd
import random
import numpy as np
import torch
from typing import Union
from .._registry import register_function
@register_function(
aliases=['bulk去卷积', 'bulk Deconvolution', 'bulk cell-fraction inference'],
category="bulk",
description="Deconvolution class for estimating cell-type c... |
26fd746b35306f6b083a84b2052dba5e82d7859745d072bf1da187499524a672 | Python | 10,970 | 334 | #!/usr/bin/env python
from __future__ import with_statement
import logging
import optparse
import os
import os.path
import re
import shutil
import subprocess
import sys
import itertools
__version__ = "0.5.7"
logger = logging.getLogger()
env_bin_dir = "bin"
if sys.platform == "win32":
env_bin_dir = "Scripts"
... |
92cfb10148043f80c33be47637a2c7c0bf3fa455072f0afaa5a805d79bacaa7c | Python | 10,973 | 233 | import os
import sys
import logging
import sys
import mrcfile
from IsoNet.preprocessing.cubes import create_cube_seeds,crop_cubes,DataCubes
from IsoNet.preprocessing.img_processing import normalize
from IsoNet.preprocessing.simulate import apply_wedge1 as apply_wedge, mw2d
from IsoNet.preprocessing.simulate import ap... |
306b27a4be4e5e6a6c819ba4a4e4d2f03e667aa2c159696e6f181eba33851f9d | Python | 10,974 | 403 | import os
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap
from einops import rearrange
from utils import save_image
from image import get_disk_mask
def cmap_myset(x):
cmap = ListedColormap([
'#17BECF', # cyan
'#FD8D3C', # or... |
38758ca452d2dc12d9321f7f712f25e875ad50e1764e6c5cb7693460fbfc08e9 | Python | 10,976 | 286 | """MLX backend for Harmony on Apple Silicon (MPS).
This module provides a native MLX implementation that avoids PyTorch MPS
beta-stage instability. It is used automatically when ``device='mps'``
and MLX is installed.
"""
import numpy as np
import logging
from datetime import datetime
from tqdm import tqdm
logger = l... |
40024f8244945e875ff7d4158923069fff8fcc2b283fdac8ab810df2cfa73ca1 | Python | 10,980 | 292 | from dataclasses import dataclass
from pathlib import Path
from typing import Iterator
import pandas as pd
from pydantic import BaseModel, ConfigDict
from siapy.core.exceptions import InvalidInputError
from siapy.core.types import ImageContainerType
from siapy.datasets.schemas import TabularDatasetData
from siapy.ent... |
cc0fe1e42c221b33c23971cc970c16f070a40eb764ef6f956bd383da982920fb | Python | 10,987 | 366 | import unittest
import basetest_dqn_like as base
import numpy as np
import pytest
import torch
from basetest_training import _TestBatchTrainingMixin
import pfrl
from pfrl.agents import CategoricalDQN, categorical_dqn
from pfrl.agents.categorical_dqn import compute_value_loss, compute_weighted_value_loss
assertions =... |
16a2a4dbbc6980fb33868de3c4064f347f884214c76f47ddec76c9c8cfa26b4b | Python | 10,990 | 337 | #!/usr/bin/env python3
import argparse
import json
import re
from pathlib import Path
import pysam
def parse_coords(coord):
m = re.match(r"(chr)?(?P<chrom>[^:]+):(?P<start>\d+)-(?P<end>\d+)", str(coord))
if not m:
return None
chrom = m.group("chrom")
if not chrom.startswith("chr"):
c... |
1e5dbf47d0934db4c03734904dc81c98b08fe678c89eaf30b55d6795786ec37a | Python | 10,993 | 276 | import numpy as np
from typing import List, Callable, Tuple, Dict, Optional, Any, Set, Union
import visionloader as vl
from lib.dataset_specific_ttl_corrections.ttl_interval_constants import FLASH_TRAINING_BLOCK_SIZE, \
FLASH_TEST_BLOCK_SIZE, N_BLOCKS
from abc import ABC
class WithinBlockMatching(ABC):
def... |
b8b05a2451305a948fe60e8a91efb210f580359e0289dd51319dbad1d05064d5 | Python | 10,995 | 366 | """
Push Wanda-cached release test images to ECR and GCP registries used for
release tests:
- AWS ECR: anyscale/{image_type}:{tag}
- GCP Artifact Registry: anyscale/{image_type}:{tag}
- Azure Container Registry: anyscale/{image_type}:{tag} (temporarily disabled
due to CI issues — see the Azure-disabled blocks below)
... |
96768ef081b4ca5e0b7155de7100a5411568ea0620c3350a40f6a08bce34cf04 | Python | 10,997 | 306 | r"""HEST-style baseline: pathology FM features → Ridge / MLP head.
Mirrors the HEST-Bench baseline that was shown to match or beat several
end-to-end neural architectures (Jaume et al., NeurIPS 2024 Spotlight):
1. Extract per-tile foundation-model embeddings on the reference Visium
slide and on the query WSI (same... |
6c2367ff8150e588d359cdd4b5b1b3c9285934b228f15dba63fee7130fb556f7 | Python | 10,999 | 271 | import pdb
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy import stats
import torch
import yaml
from scipy.stats import wasserstein_distance, entropy
from geomloss import SamplesLoss
import torch
from data_assimilation.oracle import ObjectStorageClientWrapper
Loss = SamplesLoss("sin... |
077d5cb34b63dcadaa559926de6b4e61d0e3bffa6785662ff724213c286f4e86 | Python | 11,001 | 471 | import numpy as np
import pytest
import nir
from tests import mock_affine, mock_input, mock_integrator, mock_output
from .test_readwrite import factory_test_graph
def test_sequential():
a = mock_affine(2, 3)
b = nir.Delay(np.array([0.5, 0.1, 0.2]))
c = nir.LIF(
tau=np.array([10, 20, 30]),
... |
62ed25fa30f5f63f47841bd1ace8d428727cfe9a923cdecd4b4ba0b36b7d2559 | Python | 11,001 | 216 | # 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.
from __future__ import absolute_import, division, print_function
import os
import numpy as np
from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit impo... |
58b8f866be491c059bb65d22f421906f2cda276017e7ffdc1c8af05c1c9ec786 | Python | 11,009 | 306 | ####################################################################################################
# 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... |
4c8c37647fce3d480a61be54c95bffce6fba93220225334a4500cf185fd12859 | Python | 11,014 | 296 | r"""
This modules implements the API for input space.
"""
import os.path
import numpy
import mozaik
from PIL import Image
from parameters import ParameterSet
from mozaik.core import ParametrizedObject
from collections import OrderedDict
from mozaik import __version__
TRANSPARENT = -1
logger = mozaik.getMozaikLogger... |
03b5a5f0a3a122195b75dffca243eeaafe7008c71a50953965a522ebc0c68e92 | Python | 11,015 | 267 | # LinAlg / Stats / Plotting Dependencies
from PIL import Image
from einops import rearrange
# Torch Dependencies
import torch
import torch.multiprocessing
from torchvision import transforms
# Local Dependencies
# from hipt_heatmap_utils import *
from hipt_model_utils import (
get_vit256,
get_vit4k,
tensor... |
e89d71f8654d87019bee111495eb9ad3f4643a987eb9e0a9c93ba047b9cb4859 | Python | 11,016 | 383 | # -*- coding: utf-8 -*-
import numpy as np
import sys
from pathlib import Path
from itertools import zip_longest
from vtkplotlib.figures import QtFigure, save_fig, view
from vtkplotlib.figures.QtFigure import QtWidgets, QtGui, QtCore
from vtkplotlib.data import ICONS_FOLDER
SCREENSHOT_ICON_PATH = ICONS_FOLDER / "scr... |
3db502182ba0b1c11c3f27eeccf3715782f6f5265020bdbc1ddbf638f31268d0 | Python | 11,024 | 372 | """Detected crops and reported regions must agree at image boundaries."""
from types import SimpleNamespace
from unittest.mock import Mock
import numpy as np
import pytest
from deepface.models.Detector import FacialAreaRegion
from deepface.models.face_detection.MtCnn import MtCnnClient
from deepface.models.face_dete... |
6b079e6f4de221c8d7e12d5a6633808256fdab44a502e041ee0486f0ca75c7ce | Python | 11,025 | 340 | """Shared types, configuration, retry logic, and utility helpers for the OmicVerse LLM backend.
This module is an internal implementation detail of the ``agent_backend`` package.
Public consumers should continue to import from ``omicverse.utils.agent_backend``.
"""
from __future__ import annotations
import concurrent... |
d20ea74b732fbc68415ea13ca6a7b742f6f8c96bd6c240e77bdc379741ca2c79 | Python | 11,026 | 286 | ####################################################################################################
# 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... |
4e435c7fdfe48ea9493a07b8ad83b506efa3956c604eb661d4786747e897e5d1 | Python | 11,030 | 294 | import socket
import os
import sys
import re
import pickle as pkl
import numpy as np
import scipy as sp
import scipy.io as sio
import matplotlib.pyplot as plt
from sklearn import svm, manifold, linear_model
from tqdm import tqdm
sys.path.append('C:/Users/mmall/Documents/github/repler/src/')
import students
import as... |
ca46d72e795060c7c3ddf044f575d00c727c0b2e3f5916b81747dac1e6ad4bf2 | Python | 11,030 | 265 | # 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... |
2cb9916250103e1768e616ca141491efbfd04d130f1e5a24b75f5944706e4615 | Python | 11,035 | 287 | #!/bin/env python
import argparse
import os
import sys
from typing import List, Text, Optional
from matplotlib import pyplot as plt
import matplotlib.ticker as mticker
import numpy as np
import pandas as pd
import seaborn as sns
from sklearn import metrics
def load_df(path):
df = pd.read_csv(path, sep='\t', com... |
0711552cccc11b9619c178ea08600463cae62e16237ae89b49b2a57a883ef30e | Python | 11,036 | 273 | import pandas as pd
import logging
import torch
import json
import re
from torch.utils.data import TensorDataset
from sklearn.model_selection import train_test_split
from scipy.special import softmax
from os.path import join, exists
from agent.data.entities.config import ITEMS_TABLE, SENTENCES_TABLE, FD_CLASS_VALUES
... |
a342c64335a950fbeed23623ad3688a1abb5014f97d19a68dd8d8a3873b58ea4 | Python | 11,045 | 239 | #!/usr/bin/env python
"""
Complete demo pipeline for motion correction, source extraction, and deconvolution
of one photon microendoscopic calcium imaging data using the CaImAn package.
Demo is also available as a jupyter notebook (see demo_pipeline_cnmfE.ipynb)
"""
from __future__ import division
from __future__ im... |
d282ab4dc07e0d4623e85ad8468137f3105350cefbdb4ca7a0654ee1ca5e6d70 | Python | 11,045 | 355 | """Reactome API client."""
import logging
from typing import Any, Dict, List, Optional
from .base import BaseAPIClient
from ..config import settings
logger = logging.getLogger(__name__)
class ReactomeClient(BaseAPIClient):
"""Client for Reactome pathway database API.
Reactome is a free, open-source, ... |
e74196a21318b95781057f77c828dcc10df441aeb364e57f532abef97b196297 | Python | 11,046 | 189 | r"""
This module contains API of visual stimuli.
"""
import numpy
import mozaik
from quantities import degrees
from mozaik.stimuli import BaseStimulus
from mozaik.space import TRANSPARENT, xy2ij, VisualRegion
from mozaik.tools.mozaik_parametrized import SNumber
from mozaik.tools.units import lux
from scipy.ndimage impo... |
ff8019ade3c5c7f1a70618a9f0a0ccafcc944116a331c1624d04ab26fe1c4589 | Python | 11,047 | 355 | """Reactome API client."""
import logging
from typing import Any, Dict, List, Optional
from ..base import BaseAPIClient
from ...config import settings
logger = logging.getLogger(__name__)
class ReactomeClient(BaseAPIClient):
"""Client for Reactome pathway database API.
Reactome is a free, open-source... |
b296d37f979cc58874e09e6511aaa034003adaed502f582d0fda6d8c8cd0aa53 | Python | 11,049 | 321 | '''
Home page w/ interactive TWAS table.
Nhung, Jan 2024
'''
import numpy as np
import pandas as pd
import os
import dash
from dash import Dash, callback, Input, Output
from dash import html, dcc
from dash import dash_table
import dash_bootstrap_components as dbc
###############################################... |
7ef28e45575885bdda1c9426a0df44a280ad395941627115efb252452fc67215 | Python | 11,050 | 277 | r"""
Extract cell features from anndata
"""
from random import random
from typing import Optional, List, Union
#from joblib import Parallel, delayed
import scanpy as sc
import numpy as np
import scipy
import scipy.sparse
from anndata import AnnData
import torch
from torch_geometric.data import Data
from .batch import... |
f6fecc8910a53d4349f818dbfa14ea7ece165304b876e6ed9e7d3320852f7550 | Python | 11,053 | 327 | """Agent subsystem initialization — CLI bootstrap banners.
Extracted from ``OmicVerseAgent.__init__`` so that each bootstrap concern
has its own focused, testable function. Every function here is a pure
factory — it creates and returns a subsystem value without storing it on
an agent instance.
CLI banner contract
--... |
1203f4e4ad446b7941ec076a59dc716ccae6f7d76f5c993df97b2e9fd0ac3610 | Python | 11,055 | 306 | ####################################################################################################
# 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>
#
# The code in this fi... |
ac07766d8c25e22a929bbe486450a48ddb8ec2a1170fb23e7cb9e3af279e4cc8 | Python | 11,059 | 309 | # Copyright 2021 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... |
d024081c7f6a3cf586b5345cb334c99dcf42e7f0269238d0784b2c3a6930dfe4 | Python | 11,060 | 301 | import os
import h5py
import torch
import torch.nn as nn
import torchvision
import torch.nn.functional as F
import pdb
import cv2
import random
import numpy as np
import matplotlib.pyplot as plt
import torchvision.transforms as transforms
import scipy.io as scio
from torch.utils.data import Dataset
from P... |
18cfc339f76a07c47f3eae215d8ab0f163494d1d69fa4b37dd83f5f774cca8ad | Python | 11,061 | 262 | r"""A **simulated** flow-cytometry sample for the ``ov.flow`` tutorials.
Everything else in ``ov.datasets`` is real published data. This is not, and the
docstrings say so in every place someone might read only one of them — a
cytometry matrix that looks like a PBMC panel is exactly the kind of thing that
gets cited by... |
968eae669f01815b1d1b9821514ba4f9b73608953a872e79bddc3771d542d847 | Python | 11,063 | 306 | #!/usr/bin/env python
#
# This script is used to generate a figure showing the inter-resolution variability for on a single subject
# (sub-010_ses-headUp) from the Spinal Cord Head Position MRI dataset
# (https://openneuro.org/datasets/ds004507/versions/1.0.1).
#
# The script also computes a distance from the PMJ to th... |
9a50d76d7f0ace42f5a6432cd37f69ef47396b6eb050b87ccb78b3f525afd5e5 | Python | 11,072 | 228 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion):
# --------------------------------------------------------------------------------... |
8546afdde526e9dff4afe6a699c940177ddddbc347e2e704e7b2edce2a8ce2de | Python | 11,077 | 283 | # Copyright 2023 Katherine Crowson and 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... |
b2fb9bb7f5fdf3ff1479752fcab842977f9deb422e607b380ecdefc687da9478 | Python | 11,079 | 231 | from sklearn.preprocessing import MinMaxScaler
import numpy as np
import pandas as pd
from torch.utils.data import DataLoader
from torch.utils.data import Dataset
import torch
class MyData(Dataset):
def __init__(self, X_seq, y_seq):
self.X = np.array(X_seq)
self.y = np.array(y_seq)
... |
2708d0f955df55274af72271b04b8a1420f554dfae7d865fa3671d367a3ce94c | Python | 11,080 | 311 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Low level implementation of torch-based tile."""
from typing import Callable, Any, Type, TYPE_CHECKING
from torch import Tensor, zeros, clamp, randn
from to... |
41d05effc506968e86a3cf2bed8b79505d316cb83ff5b1a2e04c25b921177655 | Python | 11,085 | 275 | """Pure-NumPy pre-ranked GSEA — a fast, single-process replacement for the
gseapy ``prerank`` backend.
Why this exists
---------------
``gseapy.prerank`` runs the permutation null with a joblib/loky **process
pool** (``processes=8`` by default). Inside a long-lived, multi-threaded
Python kernel (notebooks, the omicOS ... |
c7a6f058860ac97c133e4d92cc9e0495cbc2796fad133d01d6691cdae40f522c | Python | 11,085 | 317 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Basic training Experiment."""
from typing import Any, Dict, List, Tuple, Type, Optional
from torch import device as torch_device, max as torch_max, Tensor
f... |
74968eed04d6ecfedf8c8435ded7d036522b80d97113cea104216134569c6e81 | Python | 11,088 | 262 | import numpy as np
import torch
from tqdm import tqdm
from datasets.HumanPoseEstimation import HumanPoseEstimationDataset
from misc.utils import flip_tensor, flip_back, get_final_preds
from misc.visualization import save_images
from training.Train import Train
class COCOTrain(Train):
"""
COCOTrain class.
... |
9d57af0f896bd2bdc82864e0df6cf39358cc492d8c1de03837309ebdd9e795f8 | Python | 11,091 | 341 | import sys
sys.path.append('../')
from csbdeep.func_mcx import savecolorim
try:
from skimage.metrics import structural_similarity as compare_ssim
from skimage.metrics import peak_signal_noise_ratio as compare_psnr
except:
from skimage.measure import compare_psnr, compare_ssim
import os
import math
import t... |
e6c714218c87f29f0b5ff06cfbbdbcad26843d6a57c9c724cab2db98a8137b7d | Python | 11,091 | 313 | import logging
import os
import pickle
import sys
import threading
from typing import List
from typing import Tuple
import numpy as np
import pystow
import tensorflow as tf
import DECIMER.pre_process as pre_process
import DECIMER.utils as utils
# Silence tensorflow model loading warnings.
logging.getLogger("absl").s... |
8b8b00a781cfe55c2d432b32f7c0ef065f4091fc6e1f3e2945fc131d8994fa11 | Python | 11,093 | 236 | from argparse import ArgumentParser
import os
import os.path
import skimage
import skimage.segmentation
import sklearn.preprocessing
import sklearn.model_selection
import math
import pathlib
import glob
import shutil
import uuid
import random
import platform
import itertools
import torch
import torchvision
import nump... |
2ba05bfd1bc0c7b5dad8d5e5fdc67c98f0ed13cabb6e192ba36c016c45611142 | Python | 11,094 | 260 | # 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... |
66810574fc33d92eb86ff1d7b39a012d685e3e4406ba0af91ba5465d05f463f1 | Python | 11,094 | 311 | import copy
import functools
import os
import torch as th
import torch.distributed as dist
from torch.nn.parallel.distributed import DistributedDataParallel as DDP
from torch.optim import AdamW
from . import dist_util, logger
from .fp16_util import MixedPrecisionTrainer
from .nn import update_ema
from .resample impo... |
e3fc39dbcc6825400fd997b13100ed9201138115d8bf29ea6fdf4e9abf51809e | Python | 11,095 | 271 | #!/usr/bin/env python
# coding: utf-8
from collections import namedtuple
import torch
import torch.nn as nn
import torch.nn.functional as F
import copy
import random
transition = namedtuple('transition', ('state', 'action', 'reward'))
class ReplayMemory():
def __init__(self, MEMORY_SIZE, BATCH_SIZE):
se... |
74aea986f0ef9fde95ddc87e70ccd496a35e615870f69f2e7d3a37ba8adad2b8 | Python | 11,096 | 314 | import copy
from logging import getLogger
import torch
import torch.nn.functional as F
import pfrl
from pfrl import agent
from pfrl.utils import clip_l2_grad_norm_, copy_param
from pfrl.utils.batch_states import batch_states
from pfrl.utils.mode_of_distribution import mode_of_distribution
from pfrl.utils.recurrent im... |
b67a2d2c1da143ac126d64e5e4e1954278f15c92c67d2e63044f7ded2c7c306c | Python | 11,098 | 381 | import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
from pathlib import Path
import pandas as pd
import os
from matplotlib.patches import Patch
plt.rcParams["font.family"] = "Times New Roman"
def set_size(width, fraction=1, subplots=(1, 1), fig_height_pt=None):
"""Set figure dimensions t... |
b53ff64ccd678aff0cc2fa54eafd789fdeb95f352fb724e2190c842023011eec | Python | 11,105 | 337 | # from __future__ import annotations
from itertools import combinations
from typing import Callable, Optional, Sequence, Union
import torch
from torch.multiprocessing import Value
from rising.random import AbstractParameter, DiscreteParameter
from rising.transforms.abstract import AbstractTransform, BaseTransform
__... |
a01381a819ad8229abea39a0604b7690b90e2c99036c1f2e55ac4caf4129e2d9 | Python | 11,106 | 198 | import numpy
import quantities as qt
from .analysis import Analysis
from mozaik.analysis.data_structures import SingleValue
from mozaik.analysis.data_structures import PerNeuronValue
from parameters import ParameterSet
from mozaik.storage import queries
import mozaik
from builtins import zip
logger = mozaik.getMozaik... |
2747f31660136014d3d6431ac9d3a6cd127e30e23d8a496de7135e51913f9c1b | Python | 11,107 | 304 | #
# 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... |
a99d98e4b2a045837e33d83af509c7de43e8c47eae876d48a8522579f1be9777 | Python | 11,107 | 334 | import numpy as np
import warnings
def clle(X_samp, Y_samp, X_i, N_dis, use_gpu=True, verbose=False):
"""
Constrained Locally Linear Embedding (CLLE)
This function returns representation of point X_i.
Now supports GPU acceleration via MLX (Apple Silicon) or Torch (CUDA).
Parameters
... |
67976d1038eb6a8975b9db5236b978f52e62a23f6d41a6b8ac14985299de463d | Python | 11,119 | 247 | import os
import argparse
import sys
from splam import prediction, config, parse, extract_gff, header, clean_gff
import splam_extract
import splam_clean
VERSION = header.__version__
CITATION = "Kuan-Hao Chao, Mihaela Pertea, and Steven Salzberg, \033[1m\x1B[3mSPLAM: accurate deep-learning-based splice site predictor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.