sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c0a979535b8cea8f8d9da8bb0bc2f7e25c8b6e2117f9c720aa6ab8d7fe2dc2cf | Python | 9,391 | 142 | import sys
from parameters import ParameterSet
from mozaik.models import Model
from mozaik.connectors.meta_connectors import GaborConnector
from mozaik.connectors.modular import ModularSamplingProbabilisticConnector, ModularSamplingProbabilisticConnectorAnnotationSamplesCount
from mozaik import load_component
from moza... |
f7ba51f221774e50b7883b3ea1e8925c9eacbccbd0cce11a68c2645b807d2e25 | Python | 9,391 | 297 | import abc
import asyncio
import inspect
import logging
import multiprocessing
import multiprocessing.connection
import os
import sys
from dataclasses import dataclass
import aiohttp
import ray
from ray import ray_constants
from ray._private import logging_utils
from ray._private.gcs_utils import GcsChannel
from ray.... |
42cacfce977dd70c31ebbbe4637568f820e8c2fbeebd846e1138d58a8c21e044 | Python | 9,395 | 319 | """GWAS Catalog 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 GWASCatalogClient(BaseAPIClient):
"""Client for GWAS Catalog REST API.
The GWAS Catalog provi... |
2c9a64e5d4b02d3d846018946446ed26b17f367bc5149b950845e454dda83823 | Python | 9,397 | 319 | """GWAS Catalog 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 GWASCatalogClient(BaseAPIClient):
"""Client for GWAS Catalog REST API.
The GWAS Catalog pro... |
f53959692bd7ada3683d87c2b4392f949728c395a69652dd151355911961c2f4 | Python | 9,398 | 188 | import os, datetime, logging
import pandas as pd
from multiprocessing import Pool
from Data_Managment.crawl_data import get_inhouse_id_paths, get_ids, already_in_inhouse_database, full_processed_articles, load_publication_pickle
from misc.save_files import read_pickle, write_pickle, read_pandas_from_csv
from Keyword... |
78e2a257628a3cee7a5d847c57d28418cb7a46fda34c26a2644584a42ba0bbc6 | Python | 9,399 | 276 | ####################################################################################################
# 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... |
b074ca72abce7f8c18bcf7087155e149eb55483478511ec37e3d4b619c9841ac | Python | 9,399 | 215 | # Ultralytics YOLO 🚀, GPL-3.0 license
import os
import platform
import shutil
import sys
import threading
import time
from pathlib import Path
from random import random
import requests
from tqdm import tqdm
from ultralytics.yolo.utils import (DEFAULT_CFG_DICT, ENVIRONMENT, LOGGER, ONLINE, RANK, SETTINGS, TESTS_RUNN... |
ea8a8733d3beaa664776dc12fe6161d5813f6f9f88c52e07ade10a737bf25be7 | Python | 9,400 | 245 | # coding=utf-8
# Copyright 2023 HuggingFace 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 ag... |
0a403ef07acf47c32d92d34a4010b77296cb0ae0de0e7f6081d1934699c80f15 | Python | 9,405 | 233 | #!/usr/bin/env python3
import torch
import torch.nn as nn
from torch import autograd
from torch.optim import Adam
import torch.nn.functional as F
import sys
try:
import tinycudann as tcnn
except ImportError:
print("This script requires the tiny-cuda-nn extension for PyTorch.")
print("You can install... |
a9be92348dc65db6572a81129c9d2e9ba914eb8695233d93c5e8e021be5c0470 | Python | 9,405 | 228 | # -*- coding: utf-8 -*-
"""Data utilities and dataset loader for 3D SIM data.
The data loader is designed to load 3D SIM data with OTF and timestamp information. The data loader support loading .tif
and .czi file (from Zeiss) format.
"""
import dataclasses
import glob
import os
from typing import Tuple, Union, List
i... |
a369306f4b815c6335f236bbb78d757899724c1409da0390ea5f3553d51c2107 | Python | 9,407 | 198 | import torch
import torch.nn.functional as F
import numpy as np
import torch.nn as nn
from scipy.stats import expon
from scipy.sparse import csr_matrix
from .sparse import simple_mask
import torch.distributions as td
import math
def drop_nodes(x_dict, drop_node_rate=0., max_batch_size=2000, inplace=True):
if inpl... |
b649ca3f929272561791e7b61511ef56c2c4bad07596a50d107d063f0bf5a96a | Python | 9,412 | 236 | import torch
import warnings
import numpy as np
import torch.nn.functional as F
from ._NTD import NTD
from tqdm import tqdm
from sklearn.model_selection import ShuffleSplit
from ._utils import MSE, MAE, RMSE, MAPE, R2, generate_graph_Laplacian
from ._preprocessing import preprocessing
class GNTD():
# Initial... |
ea45009f7295ea0985f3467b437b9ee6dcf0412fd0423b249d0693897d5e714e | Python | 9,412 | 250 | """Tabular CSV/TSV readers with sample-axis safety checks.
The default `pandas.read_csv` silently auto-renames duplicate column
labels (``id154``, ``id154`` → ``id154`` + ``id154.1``), which masks
the single most common silent failure mode in joint-table analyses:
two columns of a counts CSV that hold the same biologi... |
c7746d473c55d1643f1dfbcfcbfc01ea62544e82ed1bb8396453e01df0508096 | Python | 9,413 | 250 | # Copyright 2026 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
86e1451d1eecf846b0acdd13950925d713874f874d55e3ddfabf6c177a6e3679 | Python | 9,416 | 237 | """Embedding-backed web retriever with chunking, re-ranking, and dedup.
This retriever integrates live web search (via ``WebRetrieverStore``) with
optional robust content extraction and in-memory embedding search to select
the most relevant passages for a query.
Dependencies are optional; when unavailable, the retrie... |
e3dcbefbb7be5358be1c9f7eea8b6e87c0fe6d9633f0c95d4fb8248db07ad578 | Python | 9,418 | 245 | import torch
import torch.nn as nn
import torch.nn.functional as F
from .backbone import ResNet18
from torch.nn import BatchNorm2d
class ConvBNReLU(nn.Module):
def __init__(self, in_chan, out_chan, ks=3, stride=1, padding=1, *args, **kwargs):
super(ConvBNReLU, self).__init__()
self.conv = nn.Conv... |
b6df6563e4164faa28f4715862341b78f35890337fc2df6250d3e61807142d35 | Python | 9,419 | 177 | #!/usr/bin/env python
from __future__ import print_function, unicode_literals, absolute_import, division
import argparse
import sys
from pprint import pprint
import numpy as np
from tqdm import tqdm
from csbdeep.io import save_tiff_imagej_compatible
from csbdeep.utils import _raise, axes_check_and_normalize
from cs... |
03f9d18eda13773d6f7ff129e1b2e48439684c03bc18e67838655985ae712b65 | Python | 9,434 | 324 | import collections
from numbers import Number
from typing import (
Any,
Callable,
Deque,
Generic,
List,
Optional,
Sequence,
Tuple,
TypeVar,
)
import numpy as np
from pfrl.utils.random import sample_n_k
T = TypeVar("T")
class PrioritizedBuffer(Generic[T]):
def __init__(
... |
8d560e59f8f10fef8d0f9e5ea6109e789319d65e5e59f3fdefa4110e3f981b72 | Python | 9,434 | 262 | #!/usr/bin/env python
# Python version of the evaluation script from CoNLL'00-
# Intentional differences:
# - accept any space as delimiter by default
# - optional file argument (default STDIN)
# - option to set boundary (-b argument)
# - LaTeX output (-l argument) not supported
# - raw tags (-r argument) not support... |
6315a58796d1a7f93e0f0faeba897c4edaebe04afeb75279007e771090b470cc | Python | 9,435 | 230 | import logging
from datetime import datetime
from transformers import AlbertForSequenceClassification
from agent.classifiers.tr_ffnn_ensemble_classifier import tr_ffnn
from agent.classifiers.data.tr_ffnn_dataset_mgmt import get_datasets, annotate_dataset
from agent.classifiers.tr_ensemble_triple_trainer import train_... |
3e020eb2ede1aeb0cdebc7f9808c14f413a1a760da92ba2715dce9fa5fc5d56d | Python | 9,438 | 257 | import getpass
import glob
import nibabel as nib
import numpy as np
import os
import pandas as pd
from copy import deepcopy
from os import path
from scipy import ndimage
from sklearn.preprocessing import minmax_scale, MinMaxScaler
def prepare_abi_connectivity_maps(identifier,
abi_data_root='/usr/share/ABI-connectivit... |
1df209f475f3a2bdf5b8a482ac4d8f26a90481b58e92b44dbd2e5652688912e5 | Python | 9,443 | 257 | """
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 traceback
import warnings
from copy import deepcopy
from typing import ... |
c9b92aa497069b1753ef19dea7def3bc197a77f6d19dd5f058530d6a56de5e4f | Python | 9,448 | 215 | ####################################################################################################
# Copyright (c) 2025, Open Brain Institute
# Author(s): Marwan Abdellah <marwan.abdellah@openbraininstitute.org>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is ... |
588f5c7df501cb19694401c9b311e1a75d61a92a1f08d93685574517dc5cfb93 | Python | 9,450 | 281 | import time
from statistics import median
import numpy as np
import pytest
import tensorflow as tf
from ml4h.models.transformer_blocks_embedding import (
build_embedding_transformer,
build_general_embedding_transformer,
)
try:
tf.config.set_visible_devices([], "GPU")
except (RuntimeError, ValueError):
... |
8e1e7fb8edcbbc3e711c574cf7959bb678201759cb1404474b9cf11cf9ba3dc1 | Python | 9,450 | 185 | import os
import json
import argparse
import shutil
import subprocess
import multiprocessing
from utils.tools import ROOT_PATH, absolute_path, create_configs_from_gridsearch_dict
"""
Grisearch in a module-wise fashion.
First, it trains the CSNN models and generates train and validation feature maps.
Then, it trains t... |
e176a84dae18957746964f252f2b6452e079bfe8e3cb73f71564903ada6a74de | Python | 9,451 | 239 | #
# 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... |
3521baa86393d4fae0c492fa8c3cab79041b7db1c36bcf18a9b1b7429e646f07 | Python | 9,452 | 296 | """
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 unittest.mock import MagicMock, patch
import pytest
import torch
from fairchem.core.models.uma.es... |
8fc06ab9a48b72cd3766ed3ff5db79245bd751b0a20aa0a803d843d515d77a80 | Python | 9,452 | 263 | """ClinVar data collector."""
import logging
import json
from typing import Any, Dict, List, Optional, Union
from src.api.clinvar import ClinVarClient
from src.models.genomic import Variant, Gene
from .base import BaseCollector
from config.config import settings
logger = logging.getLogger(__name__)
class ClinVarC... |
d4d4aa5620880c2002cdc52a3330014229f8640a094bedf128356ca0aba1e97c | Python | 9,453 | 243 | from __future__ import annotations
import importlib.util
import logging
from dataclasses import asdict, dataclass
from typing import Any
import anndata as ad
import numpy as np
import pandas as pd
import scipy.sparse as sps
from sklearn.mixture import GaussianMixture as SklearnGaussianMixture
from ._utils import Any... |
a99ad09cabe173691f0cb8ef303893bf633a076ef25684dbb981b6a3cb41fbce | Python | 9,455 | 267 | import os
from pathlib import Path
from typing import Dict, List
import pyarrow.fs
from ray.tune.experiment import Trial
from ray.tune.logger import LoggerCallback
from ray.tune.utils import flatten_dict
def _import_comet():
"""Try importing comet_ml.
Used to check if comet_ml is installed and, otherwise, ... |
1f384d4675bf049b573b2ab7dc50fe7a6557d9f41f188d712a52033afe3d5695 | Python | 9,458 | 299 | import numpy
import yaml
import os
import glob
import sys
import random
import seaborn
import umap
from matplotlib import pyplot, gridspec, colors
from matplotlib.offsetbox import OffsetImage, AnnotationBbox
from skimage import io
from PIL import Image, ImageDraw
from banditopt import algorithms
# Defines constants ... |
a7e0c0bab194c7561d7eaa9ad426081eceba57a0914a1d1eaea937378e5baae7 | Python | 9,461 | 220 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import numpy as np
class MultiHeadAttention(nn.Module):
def __init__(self, d_emb, n_heads, d_model, idx, bias=True, scale=True, gate=False):
super(MultiHeadAttention, self).__init__()
d_head = d_model // n_heads
... |
68d732aa086b89d6a36fcb3bdf9d541d56a04710a428090abe58bcfec12ae1e7 | Python | 9,463 | 244 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scanpy as sc
import anndata
import os
import torch
import scipy.sparse as sp
from sklearn.preprocessing import normalize
from tqdm import tqdm
from .._settings import add_reference
from .._registry import register_function
simba_install=Fals... |
45a3484b648117c851c8d2623ff9d61befa147e27183bdd5c3f1f75fb8a8e8a7 | Python | 9,471 | 269 | import argparse
import os
import subprocess
import sys
from typing import Dict, List, Optional, Tuple
from ci.ray_ci.doc.api_param_coverage import (
Violation,
build_class_index,
new_violations_for_file,
)
# Only the Python API surface is in scope. Mirror the audit's skip list so
# tests, examples, and ve... |
f601218b3dd75a4673368e8d17410c07afb030e55933933b7457015097c9660f | Python | 9,473 | 260 | # -*- coding: utf-8 -*-
### ---------------------- IMPORTS ---------------------- ###
import os
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.widgets import SpanSelector
from PyQt5 import QtCore
### ----------------------------------------------------- ###
class VerifyGui(object):
"""
... |
d6df0975360e38db1fa1cf7a1dc5511aa3962997e32fbc099c652e360eb7e716 | Python | 9,474 | 244 | from typing import TYPE_CHECKING, Any, Dict, Iterator, List, Optional, Tuple, Union
import numpy as np
from ray._common.retry import call_with_retry
from ray.data._internal.object_extensions.arrow import raise_on_pickle_object_columns
from ray.data._internal.util import _check_import
from ray.data.block import BlockM... |
fd2e8f524a6a844f3093aecd34e705d371038d00aca13b6cfce242b4baedf123 | Python | 9,474 | 247 | import os
import re
from typing import Tuple
import pandas as pd
from ignite.distributed.utils import backend, get_rank
from ignite.engine import Engine
from ignite.engine import Events
from monai.engines.utils import CommonKeys
from monai.utils.misc import ensure_tuple
from src.engines.utils import AdversarialKeys
f... |
37346e396603fb5b18ed365533274e9ac544026a173bc5e093550f4cd816a695 | Python | 9,476 | 265 | import json
import logging
import os
from abc import ABC
from typing import Any, Dict, List, Optional, Type
from ray._common.utils import import_attr
from ray._private.runtime_env.constants import (
RAY_RUNTIME_ENV_CLASS_FIELD_NAME,
RAY_RUNTIME_ENV_PLUGIN_DEFAULT_PRIORITY,
RAY_RUNTIME_ENV_PLUGIN_MAX_PRIORI... |
c58373ccdc44294ee4db6e720bee258c8349573c7c1a3bfaeb4309e9dc6d08df | Python | 9,480 | 269 | #
# 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... |
beb4bb632243009d6ad866276956caa524237cce8a5ac3a4358d51e56af9a818 | Python | 9,484 | 270 | # flake8: noqa
import copy
# __rllib-sa-episode-01-begin__
from ray.rllib.env.single_agent_episode import SingleAgentEpisode
# Construct a new episode (without any data in it yet).
episode = SingleAgentEpisode()
assert len(episode) == 0
episode.add_env_reset(observation="obs_0", infos="info_0")
# Even with the initi... |
1b939740067299aa77e902608bf7460c21f2a42f87cb263572392a6956215618 | Python | 9,494 | 280 | #!/usr/bin/env python
#
# This script is used to generate a figure showing the inter-session variability for on a single subject (sub-01) with
# 10 sessions from the open-access courtois-neuromod dataset.
#
# The script also computes a distance from the PMJ to the middle of each spinal level and COV. Results are saved ... |
969dbdb160f610c984a07f561786640bd7fc09d97905e28c700aa358f12d7554 | Python | 9,495 | 277 | import os
import shutil
import sys
import tempfile
import pytest
# Required for bazel
file_parent = os.path.dirname(__file__)
sys.path.append(os.path.join(file_parent, "../"))
import bazel_sharding # noqa: E402
WORKSPACE_KEY = "work"
def _prefix_rules(rules):
return list({f"//{WORKSPACE_KEY}:{rule}" for rule... |
5037961977d069d3e0703314623d215803c05a4c06752f8e70c2cb0e498df391 | Python | 9,497 | 223 | import torch
import logging
from agent.nlp.vocabulary import get_text8_vocabulary, get_corpus_vocabulary
from agent.classifiers.utils.models_cache_mgmt import get_tokenizer
from agent.nlp.preprocess import remove_stop_words
logging.basicConfig(format='%(levelname)s : %(message)s', level=logging.INFO)
logger = logging... |
87b653e3deb02abefba19bf3a6248424a2cee2a5f2d479088e8e2f3425e7ed09 | Python | 9,508 | 287 | from random import shuffle
from typing import Any, Callable, Mapping, Optional, Sequence, Union
import torch
from rising.random import ContinuousParameter, UniformParameter
from rising.transforms import AbstractTransform
from rising.utils import check_scalar
__all__ = ["Compose", "DropoutCompose", "OneOf"]
def dic... |
c26ae03200f0061345d844f6462181598c48838cae6279f6582a31c03f25858d | Python | 9,511 | 263 | r"""Metabolights public-study loader.
Turn a Metabolights accession (e.g. ``"MTBLS1"``) into a
``samples × metabolites`` AnnData in one call, without having to
hand-merge the sample sheet with the MAF (Metabolite Assignment File)
every time.
The EBI-hosted ISA-Tab layout per study is:
- ``s_<ID>.txt`` — sample sheet... |
d52ed0ad518d1cb1e8c1861336a7225afb2c0a2ca5633966ee7c80c778b59bd9 | Python | 9,511 | 250 | # Copyright 2023 BioMap (Beijing) Intelligence Technology Limited
import torch
import sys
import os
import numpy as np
import random
from .pretrainmodels import select_model
import math
import pandas as pd
def next_16x(x):
return int(math.ceil(x / 16) * 16)
def seed_all(seed, cuda_deterministic=False):
rand... |
31e1310e4bbc6adf5904bcb8d620e31b055fe1b3c6176960b6d602e262751d75 | Python | 9,513 | 205 | r"""mRNA therapeutics design — joint codon + structure optimisation.
Designing an mRNA (vaccine / protein-replacement therapeutic) is not just codon
optimisation: the *secondary structure* controls stability and translation, and
the two objectives trade off. :func:`mrna_design` exposes both a transparent
baseline and ... |
183e3f73ef43592c400c77792abfb2b6fa2fca61b20410d19d003a640051c383 | Python | 9,514 | 294 | import logging
from dataclasses import dataclass, field
from pathlib import Path
from typing import List, Optional
import pandas as pd
import torch
import tqdm
from omegaconf import MISSING
from torch.utils.data import DataLoader
from pokeformer.preproc.detect_pocket import detect_pocket, detect_pocket_file
from poke... |
ee8d536d789feb28f0531a9487db36793f0fdbd9c7ad180362f1870442ed7ed8 | Python | 9,518 | 242 | """
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 typing import TYPE_CHECKING
import numpy as np
from ase import Atoms
from ase.data import covalen... |
06d763116629dce51f36dcb74785d1d66cacb59c2f2de42773b4861ca3be30e9 | Python | 9,519 | 319 | # -*- 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.
#... |
c97f84fe0846f563d99237c628879803767816f775200b439451c356aa7de76b | Python | 9,520 | 213 | from tkinter import Y
import numpy as np
import matplotlib.pyplot as plt
import pdb
import torch
import torch.nn.functional as F
import cv2
import scipy
from Datasets import MASK_SIZE
from utils import *
import torchvision.transforms as transforms
def get_crop(input_map, cali_M, flip = False, msize=400):
... |
5ee28e53047d79b980eb8cb3e75b0fd87bc6c4fbaf42ea9cc528afd3fbe9bf94 | Python | 9,523 | 281 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. 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 cop... |
2b05c34018356dc1a12823e99453adc273fb12f46b5e8bd8e55871697fb8d461 | Python | 9,525 | 283 | # 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 writing, software
# distributed under th... |
208941977b52901af5475de42045a6ffb8be1230b404c6f91e859a36c5b66b7d | Python | 9,527 | 289 | """Plotting helpers for ``ov.single.MetaCell``.
Each function takes a fitted :class:`~omicverse.single.MetaCell` (or a
mcRigor :class:`~omicverse.external.mcRigor.RigorReport`) so the tutorials
stay tiny — one call per figure, no inline matplotlib snippets — except
for the centroid overlay, which is plain ``ov.pl.embe... |
e2cbe9d4085e7422b5d422d440d29b0e154167c95a6d36660419fa0a9e6c3539 | Python | 9,539 | 245 | r"""``method=`` dispatchers for HE→ST prediction and super-resolution."""
from __future__ import annotations
from typing import TYPE_CHECKING, Literal, Sequence
from ..._registry import register_function
if TYPE_CHECKING:
from anndata import AnnData
from wsidata import WSIData
PredictMethod = Literal["stpa... |
22f7f7dd7c0b4d18f67a3e7b193080f5c584a33625745c19ffb421aacd5bbfc8 | Python | 9,540 | 270 | import os
import pybedtools
from splam import config, chr_size
def create_donor_acceptor_bed(junction_bed, junction_dir, reference_genome):
#################################
# For 'd_a.bed': 0-based, 1-based
# For 'donor.bed': 0-based, 0-based
# For 'acceptor.bed': 0-based, 0-based
###############... |
1d88834ee7a28d80a9c303ae460e9480b20b076f8225b3750800f96661020d5e | Python | 9,541 | 277 | """A training script of Soft Actor-Critic on RoboschoolAtlasForwardWalk-v1."""
import argparse
import functools
import logging
import sys
import gym
import gym.wrappers
import numpy as np
import torch
from torch import distributions, nn
import pfrl
from pfrl import experiments, replay_buffers, utils
from pfrl.nn.lmbd... |
667edf43459353feef801c1f565a0620dad78af65334806c99418b5806d7f350 | Python | 9,542 | 255 | import warnings
from typing import Dict, List, Optional, Tuple, Union
import numpy as np
import torch
import torch.nn as nn
import pylab
from .layers import StatefulLayer
from .synopcounter import SNNAnalyzer
from .utils import get_activations, get_network_activations
ArrayLike = Union[np.ndarray, List, Tuple]
cl... |
a26f6470a9b87b159e5506db3d9efb8378177261eb02e24a71eb3d1ff2f88114 | Python | 9,544 | 199 | dataset_dict={}
dataset='7_Cryo_aw_f'
dataset_dict[dataset]={}
dataset_dict[dataset]['rabies_out']=f'/scratch/m/mchakrav/desgab/data_preprocess/multicenter/rabies_{dataset}_20221024'
dataset_dict[dataset]['local_threads']=20
dataset_dict[dataset]['group_spec']='*'
dataset='7_Cryo_med_f1'
dataset_dict[dataset]={}
datas... |
6b0d78bf421a7531d7c768522108904726b41585bf5ceeeebc326f3075e8f9bf | Python | 9,547 | 200 | # Ultralytics YOLO 🚀, GPL-3.0 license
import contextlib
import subprocess
from itertools import repeat
from multiprocessing.pool import ThreadPool
from pathlib import Path
from urllib import parse, request
from zipfile import BadZipFile, ZipFile, is_zipfile
import requests
import torch
from tqdm import tqdm
from ul... |
b4ffe29d95c1d32af83369fc941654c4cb89f2f91d393c8e50095657035aba91 | Python | 9,547 | 299 | """
Skill Description Loader - Progressive Disclosure
Mimics Claude Code's startup behavior by loading only skill names and descriptions
from YAML frontmatter, keeping memory footprint minimal (~30-50 tokens per skill).
"""
import re
from pathlib import Path
from typing import List, Dict, Optional
import yaml
from .... |
54ddc4bee593f79096e3a6e2aabb08f383dc8d36e3e3211d514971c6b8ae90c1 | Python | 9,554 | 292 | # 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, ... |
fa233c2dd08e0b780f9b541c891f2d8a6a33c3dacaa9b702569f4be15e1e3d67 | Python | 9,554 | 284 | import os
import re
from itertools import product
from bids.layout import BIDSLayout
def read_bids_dataset(bids_input, subject_list=None, collect_on_subject=False):
"""
extracts and organizes relevant metadata from a bids dataset necessary
for the dcan-modified hcp fmri processing pipeline.
:param b... |
6c38c496a3dc6b7c37131515c2edc2559a4930b75e235f02162fffc322f84170 | Python | 9,556 | 254 | import argparse
import os
import random
import warnings
import matplotlib.pyplot as plt
import numpy as np
import torch
from ldctbench.hub import load_model
from torch.autograd import Variable
from tqdm import tqdm
from ldctinv import utils
from ldctinv.data.LDCTMayo import LDCTMayo
from ldctinv.pretrained import loa... |
a15392ea87bbcd574ce1cbedb03cc2d4fb12fc9c7205ba8f477c1e34f07d3a98 | Python | 9,558 | 269 | """MISEV2023 / MIFlowCyt-EV characterization reporting for single-EV data.
The Minimal Information for Studies of Extracellular Vesicles (MISEV2023)
guidelines ask every EV study to document which positive EV markers and which
contaminant ("non-EV") markers were assessed, plus particle/protein and
single-EV characteri... |
526204a39422931b06163f479bb75f354633100cb072adf66f934872ab027ff6 | Python | 9,568 | 252 |
import gym
import numpy
import random
import os
import time
from gym import error, spaces, utils
from gym.utils import seeding
from matplotlib import pyplot
from collections import OrderedDict
import gym_sted
from gym_sted import rewards, defaults
from gym_sted.utils import SynapseGenerator, MicroscopeGenerator, get... |
39084acfa05424e30a0098e4d8b951462a7362a6489af6f6a2574f820e45122c | Python | 9,569 | 265 | """ClinVar API client."""
import logging
from typing import Any, Dict, List, Optional, Union
from datetime import datetime
from ..base import BaseAPIClient
from ...config import settings
logger = logging.getLogger(__name__)
class ClinVarClient(BaseAPIClient):
"""Client for NCBI ClinVar API.
ClinVar i... |
5fec8959cf94f81ef9fa2a986fd568c5f9304e0541448bd83b44fd2d88c2ea5c | Python | 9,570 | 317 | import argparse
import numpy as np
import torch
import torch.nn as nn
import pfrl
from pfrl import agents, experiments, explorers
from pfrl import nn as pnn
from pfrl import replay_buffers, utils
from pfrl.initializers import init_chainer_default
from pfrl.q_functions import DiscreteActionValueHead, DuelingDQN
from p... |
b426cc9e774faa66037ac50b47a63ca4e39c17ab89d065ccedceedea39914b9a | Python | 9,571 | 265 | """ClinVar API client."""
import logging
from typing import Any, Dict, List, Optional, Union
from datetime import datetime
from .base import BaseAPIClient
from config.config import settings
logger = logging.getLogger(__name__)
class ClinVarClient(BaseAPIClient):
"""Client for NCBI ClinVar API.
ClinVa... |
c375aa9034974815c1626370ab01a515be0fdee12ddbec18143e6af7352fba66 | Python | 9,572 | 289 | import warnings
from os.path import join
import torch
import torch.nn as nn
warnings.filterwarnings('ignore')
import anndata
import math
import scanpy as sc
import dask.dataframe as dd
import pandas as pd
from tqdm.auto import tqdm
from torch.utils.data import (DataLoader,Dataset)
torch.set_default_tensor_type(torch.... |
a8f6e4b9fa0295d9540f65527e133d7d821eb053144870a851de778f37139a5f | Python | 9,574 | 311 | """ Helper function for the main pipeline """
# Imports
import numpy as np
import torch
import copy
import os
import matplotlib
from scipy.fftpack import fft, fftshift, fftfreq
def generate_datasets(data_stack, train_val_fraction=0.8):
"""
Generate train and validation data stacks
Parameters
-------... |
61fd7f43954773a849481a43c7d88d82ff68164c1df0727bbc650531178f3c66 | Python | 9,575 | 211 | proj_dir = "/path/to/main_project_folder/" # edit this line
import numpy as np
import random
import xarray as xr
import time
import h5py
import pandas as pd
from denseweight import DenseWeight
from sklearn.model_selection import train_test_split
from tensorflow.random import set_seed as tf_set_seed
from tensorflow.ker... |
da27f2a9175634e6893739a0084137b8b24a6ec0dec34eeeed024d283860a612 | Python | 9,577 | 244 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 01 17:50:00 2021
@author: ju-bar
Geometry functions
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
#import timeit
class vertex_form:
"""
Class ve... |
3d2ce4001430b41487a3508442991f0cf44b1cc35e7210957ef45e2297b984f2 | Python | 9,578 | 260 | """QC of the AP/PD src/sink terminals assigned on the surface boundary."""
import numpy as np
from lib.qc import ERROR, WARNING, QCResult
from lib.surface import EXPECTED_TERMINAL_ORDER, TERMINAL_NAMES
QC_NAME = "srcsink"
# default thresholds, can be overridden by the rule params
DEFAULT_THRESHOLDS = {
"max_rela... |
782445b7af81e54e997ffc73d33b61a83034925d73ae190f58d4459434b2e7d1 | Python | 9,578 | 248 | import copy
from typing import List, Optional
import ray.dashboard.consts as dashboard_consts
from ray._common.utils import (
get_or_create_event_loop,
)
from ray._private.utils import (
parse_pg_formatted_resources_to_original,
)
from ray.dashboard.utils import (
async_loop_forever,
compose_state_mess... |
86c505a9367233c2b123282895f428b62f7a98244979fec96e6bf36979b4af91 | Python | 9,578 | 267 | # adopted from
# https://github.com/openai/improved-diffusion/blob/main/improved_diffusion/gaussian_diffusion.py
# and
# https://github.com/lucidrains/denoising-diffusion-pytorch/blob/7706bdfc6f527f58d33f84b7b522e61e6e3164b3/denoising_diffusion_pytorch/denoising_diffusion_pytorch.py
# and
# https://github.com/openai/gu... |
23fa9f369b02af30d68a6d49b32b66e004af5d844f01d0b12b179522699776c9 | Python | 9,583 | 284 | import os
from pathlib import Path
from tempfile import TemporaryDirectory
import numpy as np
import pandas as pd
import pytest
from siapy.core.exceptions import InvalidInputError, InvalidTypeError
from siapy.entities import Pixels
from siapy.entities.pixels import (
HomogeneousCoordinate,
PixelCoordinate,
... |
380f7577ab01d0bbb51e13366d204cc810ac1bb28e2f360a6a41a56e67ebc0b6 | Python | 9,584 | 328 | # !/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
import g... |
e48d675eef5527099c255f461e73cab1cba1fe4f7f278141c0be1630245eb966 | Python | 9,585 | 234 | 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... |
57242e85664b01f5c098cce86e96c5eb163829ea36c2ffc80d499acfb6b4d5d5 | Python | 9,591 | 203 | from typing import List, Iterator, Dict
from enum import Enum, auto
from abc import ABC, abstractmethod
class StorageType(Enum):
CONTINUOUS = auto()
CATEGORICAL_INDEX = auto()
CATEGORICAL_FLAG = auto()
ONE_HOT = auto()
STRING = auto()
BYTE_STRING = auto()
def __str__(self):
"""Sto... |
f53eafcf29f95ee1ff38551673345928b76d63743fd5126e4e806d787692adb3 | Python | 9,592 | 250 | # --------------------------------------------------------
# Fused kernel for window process for SwinTransformer
# Copyright (c) 2022 Nvidia
# Licensed under The MIT License [see LICENSE for details]
# --------------------------------------------------------
import torch
import swin_window_process
import random
import... |
64880e922a2d9eabd8c39c3023b59825adf0eff38bf9c4ca806bff6f5a211e4e | Python | 9,593 | 218 | import math
import timeit
import numpy as np
import torch
from Bio import SeqIO
import torch.nn as nn
import torch.nn.functional as F
import argparse
from utils import *
from core import GradientDescent
def get_args():
parser = argparse.ArgumentParser(description="GDFold2: a fast and parallelizable p... |
8484b66f1880a7f5786402af76c88c84773d9a8214f92e74ffb918b327438d70 | Python | 9,593 | 205 | import numpy as np
import mne
import math
from scipy.stats import norm
mne.set_log_level(verbose="WARNING")
np.random.seed(0)
def approximate_sigma(x, proba, loc=0):
"""
:param x:
:param proba:
:param loc:
:return:
"""
canditate_sigma = np.linspace(0.01, 100, num=10000)
obs_proba = n... |
835eef5aea14c91797aa6abc783968b4aeb52187a60f4bf5bcda73acbed512b3 | Python | 9,595 | 255 | # coding=utf-8
# Copyright 2023 HuggingFace 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 ag... |
ff37cac62534303ab9bb0e2875ce4d4afd8dcf47d39c59810612efae5cfb1c1c | Python | 9,595 | 219 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Creates InferenceRPUConfig to add to nn model"""
from typing import Dict, Any
from collections import OrderedDict
from aihwkit.simulator.configs.configs impo... |
88a4579e93e97d17484ee19134faca89b3d23e606f9511f4bed85e53fb40bf64 | Python | 9,597 | 277 | from typing import Optional, Callable, Tuple
from functools import partial
import jax
import jax.numpy as jnp
from .solver import auto_pinv_eig, pinvh_solve
from ..state import DenseState, Variational
from ..sampler import Samples
from ..operator import Operator
from ..symmetry import Symmetry
from ..utils import to_a... |
0a1608226e2a6199c322cb5fbe21602c1334b298fa4f4a9ccf92457831ee724a | Python | 9,606 | 313 | import argparse, os, sys, glob, datetime, yaml
import torch
import time
import numpy as np
from tqdm import trange
from omegaconf import OmegaConf
from PIL import Image
from ldm.models.diffusion.ddim import DDIMSampler
from ldm.util import instantiate_from_config
rescale = lambda x: (x + 1.) / 2.
def custom_to_pil(... |
3ab57f39a31a0fd9dfa7844b1b2e90865ced58cd213d00d3cb917b55a02b9eb8 | Python | 9,613 | 268 | # coding=utf-8
# Copyright 2023 HuggingFace 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 ag... |
81636bc0dec3b0f8c1301f4b92599e7ba2c83d10a492191b2a3f9281194b9abe | Python | 9,613 | 246 | import numpy as np
import os
import pandas as pd
import sys
from telemanom.helpers import Config
sys.path.append('..')
class Plotter:
def __init__(self, run_id, config_path='config.yaml'):
"""
For plotting results in Jupyter notebook.
Args:
run_id (str): Datetime referencing se... |
70a250725f5a5c88b598d46f7386c46a65d6075c401962adbccc820fc3c3b3eb | Python | 9,616 | 287 | # 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... |
d7c0bdb87f37b7fe7540b5f821db1fa3c9f2bffd78a921c84c4b829d36af35e4 | Python | 9,617 | 283 | import os
import subprocess
import spinnaker2.hardware
from spinnaker2.configuration import (
Experiment,
ExperimentConfig,
MemoryRegion,
PEConfig,
)
from spinnaker2.coordinates import (
PE,
ByteAddr,
WordAddr,
align_addr_to_next_multiple_of_other,
)
from spinnaker2.helpers import read_... |
181e015f43e7615ee2ce835fdef1a12a8c43a58fa07f062a5d121871b7eabf47 | Python | 9,618 | 328 | cd /mnt/d/Brain_region_project/SCENIC/
conda activate scenic_protocol
python
import scanpy as sc
import numpy as np
import pandas as pd
adata=sc.read_csv("Exc_counts_matrix_1000.csv")
sc.pp.filter_genes(adata,min_cells=100)
adata.raw=adata
sc.pp.normalize_total(adata, target_sum=1e4)
sc.pp.log1p(adata)
sc.... |
f174703e646e5848c9dbeb395ac8ee47ad1b2d72ea86dd9025b1a4473d193f8d | Python | 9,621 | 287 | import torch
import argparse
import json
from torch.utils.data import DataLoader
from models import PretrainModel, load_model_arch
from utils.Dataset import RetroDataset, col_fn_retro
from utils.training import ddp_pretrain, ddp_preeval
from utils.data_utils import (
check_early_stop,
create_log_model,
d... |
6d9469a9f9c7bc60d7efc0363b5751032c09e6193f4108ccf1be1a87c7bc7636 | Python | 9,623 | 251 | from multicamera_acquisition.interfaces import get_camera
from multicamera_acquisition.video_io_ffmpeg import write_frame
from multicamera_acquisition.paths import ensure_dir
from multicamera_acquisition.interfaces.arduino import (
packIntAsLong,
wait_for_serial_confirmation,
)
from multicamera_acquisition.visu... |
d38633487306ca6e4e4d9eea2aa0fa5ee29b51aceb940d689f71cdd414362475 | Python | 9,623 | 350 | from dataclasses import dataclass
import numpy as np
from scipy import signal
from scipy.stats import gaussian_kde
from sklearn.metrics import roc_curve
@dataclass
class FigureLayout:
"""
Dataclass to define the layout of a figure. That is, width and font size.
Args:
width_in_pt: Width of the fi... |
03b022693a255b559b2b3c3a59be6cad6dd170ff09357ae99e2b5b7c15951e5b | Python | 9,629 | 245 | import torch
import torch.nn as nn
import numpy as np
from torch.optim import AdamW
import torch.optim as optim
import itertools
from model.warplayer import warp
from torch.nn.parallel import DistributedDataParallel as DDP
from model.oldmodel.IFNet_HDv2 import *
import torch.nn.functional as F
from model.loss import *
... |
8a6b261ad8dd150bc27f240487e7c3332fc4f2e683efa55bf63ce76039f89b64 | Python | 9,631 | 237 | # Copyright 2023 NVIDIA 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 required b... |
6f94616af1e54a4b30a45a0658cb0cda7541a3158e76873cd33b5383dbff2caa | Python | 9,632 | 283 | """Ensemble of trained networks."""
from __future__ import annotations
import logging
from functools import wraps
from pathlib import Path
from typing import Callable, Iterable, List, Optional, Tuple, Union
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import colormaps as cm
from torch import nn... |
102fbaba6ad834912543762a9528116c2228f035385de238d7f79ee04912e8f9 | Python | 9,635 | 194 | #!/bin/env python
from collections import defaultdict
import argparse
import json
import pysam
import sys
from typing import List, Text, Set, Dict, Optional, Tuple
"""
Creates a GQRecalibrator training sites json file with SV calls from PacBio data.
Looks for calls clustered together in the input vcfs and comes up w... |
b38939365135e87f9225bde4d32f9867c55aeb7108e8b7d741e8ceff914b2e4a | Python | 9,642 | 225 | # --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --------------------------------------------------------
import os
import torch
import torch.distributed as dist
try:
from t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.