sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
728df2b3d35a8bf398ba8f5ccddb4b911495096552adb016fcb096a71b2c1f3f | Python | 11,940 | 368 | # 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, ... |
b1a7873cfe0f9ce6c70c395298da80a79b9bb2f81351998ac4ddc14400d643b3 | Python | 11,942 | 272 | r"""Compiled kernels for Bonsai's innermost likelihood math.
Why this exists
---------------
Profiling a 400-cell run (127 s) showed the cost is not in the tree search but in
how the leaf-level arithmetic is spent: 7.7 M calls to :func:`numpy.sum` and
10.4 M ufunc reductions, roughly 19 s of which is NumPy's Python-le... |
b39798365368cb62eea780d2a1834aa3f48a8c85c6776c2b8bcb6c75a936bcd6 | Python | 11,943 | 278 | import torch
import torch.nn as nn
from torchvision import models
from torchvision.models.vgg import VGG
class FCN32s(nn.Module):
def __init__(self, pretrained_net, output_c):
super().__init__()
self.output_c = output_c
self.pretrained_net = pretrained_net
self.relu = nn.ReLU(i... |
431940c31d14fe1fce7f6dbecd2be93075898405121f2b0c935de2951feff70a | Python | 11,945 | 293 | from deltasplice.utils import write_splice_sites, write_splice_site_file_header
import numpy as np
from loguru import logger
from pyfasta import Fasta
from deltasplice.constant import default_model_paths, model, IN_MAP, default_anno_file,EL, CL, SeqTable, repdict
import copy
import torch
import json
import pandas as ... |
ce232afaa335bc1ad55d59168e8195e2bafe753a0803bfae1c46f8038d8cc501 | Python | 11,950 | 419 | # -*- encoding: utf-8 -*-
from __future__ import division, print_function
import itertools
import functools
import warnings
import numpy as np
where = np.flatnonzero
from .core.utils import fill_triu_inplace, fill_tril_inplace
def where_diagonal(A, k=0):
N = A.shape[0]
if k >= 0:
return np.arange(0, ... |
7cfb155d78b91792d3791fa4d3c51fada199b4653eb81aafa19b38cfdb6368ab | Python | 11,954 | 302 | #!/usr/bin/env python
#
# This script is used to generate a figure showing the inter-rater variability for individual subjects and spinal
# levels.
# The script also computes a distance from the PMJ to the middle of each spinal level and COV. Results are saved to
# a CSV file.
#
# Usage:
# python 03a_generate_figur... |
84d15e9ad9b268394020b39ce21a9bf29db07c843199bdfbc9633b9db267ac6f | Python | 11,954 | 249 | # Ultralytics YOLO 🚀, GPL-3.0 license
from multiprocessing.pool import ThreadPool
from pathlib import Path
import numpy as np
import torch
import torch.nn.functional as F
from ultralytics.yolo.utils import DEFAULT_CFG, LOGGER, NUM_THREADS, ops
from ultralytics.yolo.utils.checks import check_requirements
from ultral... |
75f858b6ee1ed238d599a4fac3e365e352882a9e90ffbb6ac68a7ec757f91b3a | Python | 11,957 | 259 | import math
import timeit
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from argument import *
from utils import *
from core import GradientDescent
class SPIRED(GradientDescent):
"""
Protein folding environment for SPIRED.
"""
def _vector_term(self,... |
b064bff275f25e7b4c07228fb33ac3751cf3acadfaadac10b3a84bd1024c12b0 | Python | 11,957 | 410 | from math import pi
import numpy as np
import pandas as pd
from bokeh import events, models, plotting, transform
from sklearn.preprocessing import MinMaxScaler
color_mapping = {"accepted": "#2ecc71", "rejected": "#e74c3c", "ignored": "#3498db"}
tap_callback_jscode = """
// Accessing the selected component ID
... |
b0c257a9030702b47f1457fe1b17636bd8ab150de9760590fe3df5b7676bb540 | Python | 11,977 | 317 | # 3rd party dependencies
import pytest
import cv2
import numpy as np
# project dependencies
from deepface import DeepFace
from deepface.modules.verification import find_distance
from deepface.commons.logger import Logger
logger = Logger()
models = ["VGG-Face", "Facenet", "Facenet512", "ArcFace", "GhostFaceNet"]
metr... |
ac7692c007dbfa44142b63a44fb1102d2b25582c7a940a109f69914336f9aec1 | Python | 11,979 | 295 | # 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... |
1a915bbc34dcff1ec702d2501ecc12263851e7cf8eceb8b5bfe18969a15a3d57 | Python | 11,989 | 336 | # -*- coding: utf-8 -*-
r"""Archetypal tissue zones."""
import matplotlib
import matplotlib.pyplot as plt
# +
import numpy as np
import pandas as pd
from ...models.base.base_model import BaseModel
# defining the model itself
class ArchetypalAnalysis(BaseModel):
r"""This model identified archetypal tissue zones... |
ffbe197a73d7c9dad08a60420b108e25d5b65be64bacfcf6590b668dfb9bd91a | Python | 11,991 | 317 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 13 15:27:41 2020
@author: sam
"""
from tools.waveletFunct import haar_wavelet
from tools.waveletFunct import db2_wavelet
import numpy as np
from ssm import LDS, SLDS
class activityClassifier_LDS:
def __init__(self, classifier = None, a =... |
e9e3b75375338f79fac7d51409d4e736a5bc5698285bf5769cde384fb2e369ae | Python | 11,993 | 363 | # 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... |
359084accb4d6b3f80254498620934180e6d3a5cbaaf6be71c98cfe9791a2e3e | Python | 11,996 | 341 | """OpenTargets Genetics data collector."""
import logging
from typing import Any, Dict, List, Optional
from src.api.opentargets_genetics import OpenTargetsGeneticsClient
from src.models.genomic import Gene, Variant
from .base import BaseCollector
from config.config import settings
logger = logging.getLogger(__name_... |
d66fbeeed9706b6c48e4dcf0d45774ef51ee1ba947eebe59b721ae990a1e16d7 | Python | 11,996 | 331 | from __future__ import annotations
from typing import Any, Iterable, Literal
import numpy as np
import pandas as pd
from autofeat import AutoFeatClassifier, AutoFeatRegressor # type: ignore
from sklearn.base import BaseEstimator, TransformerMixin
from siapy.core.exceptions import MethodNotImplementedError
from siap... |
decfc9343c6a331c6ee07aed4312547f0b1fd604168cbd3705d4f34836cc6e5c | Python | 11,997 | 348 | """
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
import gzip
import json
import pickle
from pathlib import Path
from unittest.mock import Mo... |
33ea1b3889208823238962f759bae2478b3aabb68690fe5cbbd61253e3a1503e | Python | 11,999 | 269 | import argparse
import pickle
from typing import List, Callable, Optional
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_config_par... |
105f7bda778ddea261587df0a8fa370dc2a3b4d550a6527cf6819d35fcf69f11 | Python | 12,001 | 290 | from logging import getLogger
from typing import Any, Callable, List, Optional, Union
import numpy as np
import PIL
import torch
from ...schedulers import DDPMScheduler
from ..onnx_utils import ORT_TO_NP_TYPE, OnnxRuntimeModel
from ..pipeline_utils import ImagePipelineOutput
from . import StableDiffusionUpscalePipeli... |
bea31c253ae1e0207069e4b7794e767b76f76359bb2652ed7b8c5f03120fd678 | Python | 12,001 | 410 | """
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 tempfile
from contextlib import contextmanager
from pathlib import Path
from ty... |
b03513ed056f0f20391a3548e5068974fc006597e4c3ae3b7318d25bc0cd5f5f | Python | 12,002 | 271 | import json
import os
import numpy as np
import pandas as pd
import SimpleITK as sitk
from torch import utils
from lifelines.utils.concordance import concordance_index
from pycox.models.loss import cox_ph_loss
from torch.utils.data import DataLoader
from datetime import datetime
import torchvision.transforms as transfo... |
c9beef18d967d543b7379192418927026c3f1d2154f0e635c681f6d7af84ea9b | Python | 12,007 | 313 | import math
import os
from os.path import join as opj
from os.path import dirname as opd
from os.path import basename as opb
from os.path import splitext as ops
import shutil
import time
from typing import Callable, List, Tuple,Dict
import torch
import torch.optim
import numpy as np
from utils.tool import read_img, sav... |
6f26c26cded43618aae7be549b82ee4804a103158a10599da88c46c62169061d | Python | 12,009 | 324 | """A Python class containing an implimentation of MPPCA denoising.
Inputs are a 4D image with dimentions (X x Y x Z x N)
Usage:
import mpdenoise as mp
imgdn, sigma, nparameters = mp.denoise(img, kernel=[7,7,7], M=60, shrinkage='frobenius')
LICENCE
Authors: Benjamin Ades-Aron (... |
3eff6cf853bc5b9b6a86b75d8dc374f9b653fa468797a015c3bf5c9d501d6a83 | Python | 12,010 | 378 | # 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)... |
7c016f862151aa78dec2eda95c71cb353f6218020090061996ab1f679c4cbc33 | Python | 12,011 | 354 | from copy import deepcopy
import numpy as np
import torch
from sinabs.activation import MembraneSubtract
from sinabs.backend.dynapcnn import discretize
from sinabs.layers import IAF
# - Test tensor to be discretized
float_tensor = torch.tensor(
[
[
[13.5594, -39.0465, -31.1756, 41.0779],
... |
951afb7eaa4167ccc5114d056d173ebc7158c35cd242714c0d77b9d5d3a3d12f | Python | 12,013 | 349 | r"""Differential correlation for metabolomics.
Classical differential analysis asks *which metabolites change in
abundance?* Differential correlation asks a complementary question:
*which metabolite-metabolite relationships change between
conditions?* Two metabolites might have identical mean levels in A
and B yet be ... |
880f49813b51b930e89b1c6ff39c7657585b5a12188bdeb60dc977e24c26ab4b | Python | 12,017 | 301 | """
Metabolomics analysis for omicverse — AnnData-native peak-table workflows.
``ov.metabol`` covers the downstream-of-peak-picking stages of a
metabolomics study: QC, imputation, normalization, transformation,
univariate and multivariate statistics, pathway enrichment (MSEA /
mummichog), and a lipidomics path. Input ... |
ffa00d46b9bd44a6f4123162abd7efd90929bb0b1aef92fc949c4c713ee060a9 | Python | 12,017 | 341 | # 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... |
6a6b929d7fa23a5873e9e36e03ea9821790bacf809e692c54530679a4f19a8dd | Python | 12,018 | 338 | from math import pi as PI
import torch
from torch.nn import Embedding, Linear
from torch_geometric.utils.scatter import scatter
from torch_geometric.nn.inits import glorot_orthogonal
import sympy as sym
class Envelope(torch.nn.Module):
def __init__(self, exponent):
super().__init__()
self.p = ex... |
f669e0ecb67a62d255f94776aaf118782528b1bc62eeaf79689afe599171b7e1 | Python | 12,019 | 428 | """Paleobiology Database API client for fossil data."""
from typing import Dict, List, Optional, Any
from ..base import BaseAPIClient
class PaleobiologyClient(BaseAPIClient):
"""Client for Paleobiology Database API."""
def __init__(self):
super().__init__(
base_url="https://paleobiod... |
10322c7ff3bb387bf35761cf52e06847be1ce8c50de5d3f81102a16e25bf79e4 | Python | 12,021 | 306 | # 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... |
25985004fcae1ea03fe7ec93c2005b98169a396e0dd2deeec10ce114a94dc89d | Python | 12,023 | 335 | #
# Copyright (c) 2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... |
7046a562a8155cc1680068da3c7b2215429d74fc851bb1328f331700b392017b | Python | 12,023 | 210 | """Small AnnData-first runners for distinct COMMOT and FlowSig tasks."""
import hashlib
import json
from importlib.metadata import PackageNotFoundError, version
import numpy as np
import pandas as pd
from scipy import sparse
from .._registry import register_function
def _versions():
result = {}
for package ... |
3e695b2cafabaeda7c78ab49b5c294ae52201cbf8e73c84443fed9318827b325 | Python | 12,026 | 357 | from abc import ABCMeta, abstractmethod, abstractproperty
from typing import Optional
import numpy as np
import torch
from pfrl.utils.batch_states import batch_states
from pfrl.utils.recurrent import (
concatenate_recurrent_states,
flatten_sequences_time_first,
recurrent_state_from_numpy,
)
class Abstra... |
51d0844339939533e25b8a2afa099dcc6c72d6e528fbb481d50483663f317d74 | Python | 12,027 | 311 | # 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... |
bb28a2dbdc60918bd76d5cd9761587f0a7a8aaa8429cd1d40682b5767fb28e16 | Python | 12,029 | 328 | """
OmicVerse format adapters for DataCollect.
This module provides utilities to convert collected biological data
into OmicVerse-compatible formats (AnnData, pandas, MuData).
"""
import pandas as pd
import numpy as np
from typing import Dict, Any, Optional, Union, List
import logging
logger = logging.getLogger(__na... |
b3b96463b8f740901043533fb053fd48c6720fe30573992e8877f5ef530ca2ab | Python | 12,032 | 336 | from typing import Any, Dict, List, Optional, Union
from ray.dag import DAGNode
from ray.dag.format_utils import get_dag_node_str
from ray.experimental.gradio_utils import type_to_string
from ray.util.annotations import DeveloperAPI
IN_CONTEXT_MANAGER = "__in_context_manager__"
@DeveloperAPI
class InputNode(DAGNode... |
ef5aa7862d145c224f1eba0bbee816295ee6e5a1ab2dd90c3f0964f99743f6c0 | Python | 12,037 | 298 | """
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
from typing import TYPE_CHECKING, Any, ClassVar
import numpy... |
60580b0bc87d0e78269d971aae2fa970a58f026f4020f37a27ccf417ec367d89 | Python | 12,039 | 387 | """Transformations and augmentations on hex-lattices."""
from typing import Any, List, Optional
import numpy as np
import torch
from .augmentation import Augmentation
from .utils import (
flip_matrix,
flip_permutation_index,
rotation_matrix,
rotation_permutation_index,
)
__all__ = [
"HexRotate",... |
322dd83bcbb76e6dd2776bc158a5048765ae47ad7a318a27bec820e554d1dc71 | Python | 12,041 | 282 | """
Author: Arnault CAILLET
arnault.caillet17@imperial.ac.uk
August 2023
Imperial College London
Department of Civil Engineering
Derived from the Github code provided with Caillet, A. H., Phillips, A. T., Farina, D., & Modenese, L. (2022). Estimation of the firing behaviour of a complete motoneuron pool by combining e... |
8f0db892781c077cee1e504c9c5ad34765168c93d145a09e879dda1e7fadb0f5 | Python | 12,042 | 209 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'manual_form.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, ... |
b7d15808c2a6a44c06d6b409965a36a62a34b17067ccdfc7d64800fccd86ae24 | Python | 12,047 | 348 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# Created By : Kangjoo Lee (kangjoo.lee@yale.edu)
# Last Updated: 08/06/2024
# -------------------------------------------------------------------------
# =========================================... |
52dce9bca1113d1c9e98133ae5411fcc9d65ee9d80e467d74f1540281a862553 | Python | 12,049 | 333 | import rdkit
import rdkit.Chem as Chem
import numpy as np
import random
elem_list = ['C', 'N', 'O', 'S', 'F', 'Si', 'P', 'Cl', 'Br', 'Mg', 'Na', 'Ca', 'Fe', 'As', 'Al', 'I', 'B', 'V', 'K', 'Tl', 'Yb', 'Sb', 'Sn', 'Ag', 'Pd', 'Co', 'Se', 'Ti', 'Zn', 'H', 'Li', 'Ge', 'Cu', 'Au', 'Ni', 'Cd', 'In', 'Mn', 'Zr', 'Cr', 'Pt',... |
198de7ba10c2371f3cd9ea39610a968426d5b95fb5c9b2337bb9a7e9ad415939 | Python | 12,053 | 336 | ####################################################################################################
# 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... |
11afe533b8fd79d14a08880019ab26a9c809284fbcf9788f88752eb043ee772a | Python | 12,060 | 344 | import torch
from utils.tokenlizer import smi_tokenizer
from utils.graph_utils import smiles2graph
import numpy as np
from typing import Any, Dict, List, Tuple, Optional, Union
from torch_geometric.data import Data as GData
from utils.chemistry_parse import (
augment_product_smiles,
clear_map_number,
find_a... |
253513fef478eec7ddae3aab21f6202f9c51c539bf75539fadc4dad26399871b | Python | 12,061 | 331 | import os
import sys
import numpy as np
import scipy.stats as stats
import pandas as pd
import anndata
import scanpy as sc
import seaborn as sns
import torch
import matplotlib.pyplot as plt
from torch.utils.data import DataLoader,ConcatDataset
import torch
import torch.nn as nn
from torch.nn import functional as F
fro... |
0c49203c02481fd1e46a1b4349fd9aad9c4038f7c95599b02d27b1d025443c40 | Python | 12,066 | 287 | import types
from typing import List, Optional, Tuple, Union
import torch
from transformers import CLIPTextModelWithProjection, CLIPTokenizer
from transformers.models.clip.modeling_clip import CLIPTextModelOutput
from diffusers.models import PriorTransformer
from diffusers.pipelines import DiffusionPipeline, StableDi... |
14d0bf2d6c3abe52bfa673826ec63370ccda89a00a846841805b477d6914538d | Python | 12,068 | 234 | import numpy as np
from typing import Optional, Dict, Union
from dataclasses import dataclass
from basis_functions.time_basis_functions import make_cosine_bump_family, backshift_n_samples, \
trim_basis_reduce_condition_number, trim_basis_by_cond_index, basis_shift_forward
@dataclass
class LNPModelHyperparameters... |
66458de99a250f626c7f34fc1460f92a0c898d60603beb81c191661fbb4c78d7 | Python | 12,070 | 303 | from typing import Dict, Optional, Union
import numpy as np
import torch
from scipy.sparse import issparse
import scanpy as sc
from ...pp._scale import _get_obs_rep, _set_obs_rep
from anndata import AnnData
#from scgpt import logger
class Preprocessor:
"""
Prepare data into training, valid and test split. N... |
131c7abb1ff030d2465ae2e5316b054471abc681d2a25dcb27a3b4e31b94d4a5 | Python | 12,072 | 231 | # -*- coding: utf-8 -*-
from mozaik.storage.datastore import PickledDataStore
from mozaik.controller import Global
from parameters import ParameterSet
import mozaik
from mozaik.controller import setup_logging
import sys
from msa_analysis_plotting import *
from mozaik.storage.queries import *
# Usage: python run_analys... |
ee594646922c0dd38b823c956ba54efe37cbb9493ee6c84f1d0ca47db1421be4 | Python | 12,073 | 258 | # Ultralytics YOLO 🚀, GPL-3.0 license
from itertools import repeat
from multiprocessing.pool import ThreadPool
from pathlib import Path
import cv2
import numpy as np
import torch
import torchvision
from tqdm import tqdm
from ..utils import NUM_THREADS, TQDM_BAR_FORMAT, is_dir_writeable
from .augment import Compose,... |
6920ccf4e43cc8913f78f3e9b84438f4260986f86a436df6d73bd1853e51cb89 | Python | 12,074 | 430 | """Paleobiology Database API client for fossil data."""
from typing import Dict, List, Optional, Any
from .base import BaseAPIClient
class PaleobiologyClient(BaseAPIClient):
"""Client for Paleobiology Database API."""
def __init__(self):
super().__init__(
base_url="https://paleobiodb... |
548cc731cb91cf3cc1853d956674d273be4259ba976157f51178146fd67b1e25 | Python | 12,077 | 342 | ###SRNDNA
###shared reward, block design
from psychopy import visual, core, event, gui, data, sound, logging
import csv
import datetime
import random
import numpy
import os
#maindir = os.getcwd()
#parameters
useFullScreen = True
useDualScreen=1
DEBUG = False
frame_rate=1
instruct_dur=3
initial_fixation_dur = 4
#fi... |
8922f432d6af4bba6df838da8fdcb283bb32b33868dc4cca2fc778f109367416 | Python | 12,092 | 250 | # encoding: utf-8
import numpy
from mozaik.core import ParametrizedObject
from parameters import ParameterSet
from mozaik.tools.distribution_parametrization import PyNNDistribution
from mozaik.tools.misc import *
from parameters import ParameterSet
import mozaik
logger = mozaik.getMozaikLogger()
class ModularConnect... |
57f4793cc16b6f16fc05b6d4a4ea40e5f9ba453ca70a03ff0ab4b901dfc9a930 | Python | 12,093 | 306 | r"""
This module contains definition of the PopulationSelector API.
It is used as mechanism for selecting subpopulations of neurons within
Sheets. The most typical use is for selecting neurons for recordings, where
a PopulationSelector can for example simulate the sampling of neurons
when using a multi-electrode arra... |
628aaec2ddb385a61c9cb220a92301e24c7849dad9aea9b3dcf6f8d8104ebc40 | Python | 12,096 | 276 | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, absolute_import, division
import datetime
import warnings
import sys
from six import string_types, PY2
from functools import wraps
# from .config import BaseConfig
from ..utils import _raise, load_json, save_json, axes_check_and_normali... |
3c169d88ca6ee063fda4244298b2669069c2ca6ad5edaece0a13993ca2d41645 | Python | 12,099 | 328 | # 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... |
943947676526a35b74aff0d7febc268f3c72ed9704636337e1021138317dabb7 | Python | 12,100 | 346 | """Contains learning rate scheduler callbacks"""
import sys
# pylint: disable=unused-import
import warnings
import numpy as np
import torch
from torch.optim.lr_scheduler import _LRScheduler
from torch.optim.lr_scheduler import CosineAnnealingLR
from torch.optim.lr_scheduler import CyclicLR
from torch.optim.lr_schedu... |
c57b8c6a39c2c16aa603be0e043a040a74013b58b7fceaa4cb9ba6bc496180b7 | Python | 12,103 | 243 | #!/usr/bin/env python
# coding: utf-8
# author: Maruthi Mutnuri (maruthi2008@gmail.com)
# loading libraries
import pandas as pd
import numpy as np
# loading database file
MEASUREMENTS_df = pd.read_pickle('/project/M-ABeICU176709/ABeICU/Temp/MEASUREMENTS.pickle', compression = 'zip')
# selecting columns
MEASUREMENTS... |
d5cb53c4d4f638d6152b977df55859bd7c3168e1b8a43da567f3c644f3cee9b4 | Python | 12,114 | 389 | from typing import Iterable, List, Sequence, Tuple, TypeVar, Union
import numpy as np
import torch
import torch.nn as nn
import sinabs
from .validate_memory_speck import ValidateMapping
def get_new_index(existing_indices: Sequence) -> int:
"""Get a new index that is not yet part of a Sequence of existing indice... |
e682c06bd2ff0bd70a40574827572f7b6315b32a60c7cfa3131dde048e53b9f5 | Python | 12,116 | 291 | import os
import numpy as np
import matplotlib.pyplot as plt
def plot_training_predictions(y_test, y_pred, results):
plt.scatter(y_test, y_pred, color='blue', label= 'data')
plt.plot(y_pred, y_pred, color='red', linewidth=2)
plt.title('Regressor')
plt.xlabel('observed')
plt.ylabel('predicted')
... |
d73bf60cd1e042d102eba969b626cedfe8d6a454985253eb598f0df8a4e0f3cf | Python | 12,118 | 368 | # 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... |
442abcd6f5875282298b09858eae33c79044ff395159560b6b4b57e3f2c75a96 | Python | 12,119 | 345 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Configurations for resistive processing units."""
# pylint: disable=too-few-public-methods
from dataclasses import dataclass, field
from typing import Class... |
2c33403f6bf95a81a901ca427137af1270b7dd6141855e5e3fb6093c7074bf7e | Python | 12,123 | 291 | import os
import yaml
import pickle
import argparse
import subprocess
import numpy as np
import gym
import torch
from torch.optim import Adam
import lop.envs
from lop.algos.rl.buffer import Buffer
from lop.nets.policies import MLPPolicy
from lop.nets.valuefs import MLPVF
from lop.algos.rl.agent import Agent
from lop.... |
9f9da7f4d8da6b1457ae04145ef4f69c3e49488261dc75404609002d1388fd99 | Python | 12,125 | 274 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
# pylint: disable=too-many-instance-attributes, too-many-arguments, too-many-branches
"""Phenomenological noise models for PCM devices for inference."""
from c... |
b2ac6375a54bc222f7d9577ad186081185a8150ff9567123dbb98c5b25eb49b2 | Python | 12,128 | 302 | import torch
import numpy as np
import pandas as pd
import os
import copy
from sklearn.metrics import (
mean_absolute_error,
mean_squared_error,
r2_score,
roc_auc_score,
accuracy_score,
log_loss,
f1_score,
matthews_corrcoef,
precision_score,
average_precision_score,
recall_s... |
85d5fbceb7784039f47688e4e00003dc06ff0d7ecc4674ea6e76cfd048f01366 | Python | 12,130 | 345 | """
Here be some documentation
"""
import subprocess
import os
import argparse
import sys
from os.path import basename, join, isdir, dirname, expandvars
from glob import glob
import tempfile
import reads
import shlex
import data
from ngs_mapper import compat
import log
lconfig = log.get_config()
logger = log.setup_lo... |
02e4385f04873ff12fe84721bf585863821bfa04bf00042080ec82b673ae121d | Python | 12,135 | 279 | # Copyright 2023 Google Brain 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 requ... |
e49b68c534abec9f88bb0cb42f2c88a594a07659ac154d87c38632b298c69f7d | Python | 12,138 | 336 | import json
import os
import platform
import sys
import tempfile
from typing import List, Optional
from unittest import mock
import pytest
from ci.ray_ci.container import _DOCKER_ECR_REPO
from ci.ray_ci.linux_tester_container import LinuxTesterContainer
from ci.ray_ci.tester_container import RUN_PER_FLAKY_TEST
from c... |
0bae4d86b9cc0d1cab085432ac28955ab6d05de31c99cc1be4e8d5817d446b88 | Python | 12,139 | 355 | import numpy as np
import pandas as pd
import nibabel as nib
import datawrangler as dw
import seaborn as sns
from nilearn.maskers import NiftiMasker
from matplotlib import pyplot as plt
from sklearn.decomposition import IncrementalPCA as PCA
from tqdm import tqdm
from scipy.spatial.distance import cdist
import statsmo... |
e24556a47bbaa97e604352c3f1f31a62a1cf542e399645c29abdc6e620c4ac67 | Python | 12,141 | 337 | import numpy as np
import pandas as pd
import scanpy as sc
from scipy.stats import rankdata
from sklearn.metrics import pairwise_distances
from tqdm import tqdm
from . import core
def prepare_multiome_anndata(
atac_ad, rna_ad, SEACells_label="SEACell", n_bins_for_gc=50
):
"""Function to create metacell Annd... |
3e7f414802dbcdc423529a0cd7a1ca24a4c27a2901360d80a247798d204f6a80 | Python | 12,153 | 342 | from abc import ABCMeta, abstractmethod
from typing import Tuple, List, Callable, Optional, Iterable, Union
import functools
import operator
import torch
import torch.nn as nn
from torch import autograd as autograd
class _SingleSolverMixin(metaclass=ABCMeta):
parameters: Callable[[Optional[bool]], Iterable[torc... |
ba485c9b838fe0dc900ad50eef177cf7962422335f0b096d884084ba55406fac | Python | 12,153 | 235 | # Copyright 2021 Division of Medical Image Computing, German Cancer Research Center (DKFZ)
# and Applied Computer Vision Lab, Helmholtz Imaging Platform
#
# 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 L... |
1c9bbc056c9691bac3e5bb8daae2cb983a02419f76687e70a443439b1b2f745f | Python | 12,154 | 289 | import pdb
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import torch
import yaml
from scipy.interpolate import interp1d
from data_assimilation.particle_filter.observation_operator import ObservationOperator
from data_assimilation.true_solution import TrueSolution
TEST_CASE = 'wave_submerged_... |
004d3deb851b64cb1694715079b287f70e344e8e8b095dbd28c59b2ed35907b6 | Python | 12,157 | 352 | #
# Author: Zoltan Varga (vargaz@gmail.com)
# License: MIT/X11
#
#
# This is a mono support mode for gdb 7.0 and later
# Usage:
# - copy/symlink this file to the directory where the mono executable lives.
# - run mono under gdb, or attach to a mono process started with --debug=gdb using gdb.
#
from __future__ import ... |
6a5f998fbf493cf13d4659f2d7ab2358ffdbc529b49779448a833e2364524c5e | Python | 12,159 | 270 | r"""De-novo protein **binder** design — the RFdiffusion → ProteinMPNN pipeline.
The headline protein-design workflow: given a target protein and hotspot
residues, generate a new mini-protein that binds it.
1. **RFdiffusion** (PPI mode) diffuses binder backbones docked against the
target's hotspots (:func:`~omicver... |
9e6a52ce305be9488c1df714381112df6c75a75526b16e1b802945d4408131c3 | Python | 12,160 | 275 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: valeria
"""
from scipy.io import loadmat
from sklearn import svm
import random
#from operator import itemgetter
import numpy as np
import math
import time as tm
class Dataset():
def __init__(self, path_tomatdata, path_tomatrix):
self.matlabs... |
ae32d4a045b9f77493883237c695a2efc608f9db0fb346d1838913a171fef1bf | Python | 12,167 | 319 | import logging
import os
import shlex
from contextlib import contextmanager
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional
import ray._private.ray_constants as ray_constants
from ray._common.runtime_env_package import (
RUNTIME_ENV_PACKAGE_EXTENSIONS,
WORKING_DIR,
has_packa... |
fd01ffc9c5c59408bb363955b1827fd7d9053633675131b320636784b4d4ebe9 | Python | 12,168 | 373 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
OPTICAL FLOW
Created on Wed Mar 16 16:31:55 2016
@author: agiovann
"""
from builtins import zip
from builtins import range
from past.utils import old_div
import cv2
import numpy as np
import pylab as pl
import scipy
from scipy.sparse import coo_matrix
from scipy.io ... |
e6efda42f32cf9a8c11846b38655b4c4bcf2f3ff144bd35bbdcef0d6f274d919 | Python | 12,178 | 453 | import pandas as pd
import numpy as np
import scipy as sp
import os
import errno
from sklearn.decomposition import PCA
import umap.distances as dist
from sklearn.utils.extmath import svd_flip
from sklearn.utils import check_array, check_random_state
from scipy import sparse
import sklearn.utils.sparsefuncs as sf
from u... |
12114b658e1b056a817916dd881374a7e0076783dfe13aefba3652febee0e699 | Python | 12,179 | 293 | # coding=utf-8
# Copyright 2023 The HuggingFace Inc. team.
#
# 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... |
27a02ec1e510af78902def144be74bc46fb5ab1ed6f251d26bcef40e5da3fb31 | Python | 12,183 | 390 | import logging
import sys
from pathlib import Path
from typing import Dict, Optional, Tuple
import os
import click
import numpy as np
import pandas as pd
import yaml
from seak.cct import cct
from deeprvat.utils import pval_correction
logging.basicConfig(
format="[%(asctime)s] %(levelname)s:%(name)s: %(message)s"... |
065cbf35077cfff6e7620bd50da5473a5d28e0847c09a449f6a81916db1f5f8f | Python | 12,187 | 286 | import os
import pytest
import logging
import pandas as pd
import numpy as np
import tensorflow as tf
from types import SimpleNamespace
from ml4h.recipes import inference_file_name, _hidden_file_name,save_to_google_cloud
from ml4h.recipes import train_legacy, train_multimodal_multitask
from ml4h.recipes import infer_... |
490e090ebdcd3511daae48abc482b9262318a4ac6c2d6a793133de546c4eef9f | Python | 12,189 | 354 | """Figure 4a,b for the best models of an ensemble instead of the task-optimal cluster.
Reproduces the arrangement of figure 4a (T4/T5 angular tuning) and figure 4b (T4c
currents) of Lappalainen et al. (2024), but selects models by task error --- the
best `--top-fraction` of the ensemble --- rather than by the task-opt... |
be303e6aebbdd5079d022f6db2428db6a7509ce88fe34c971ef69f5ff69eef2f | Python | 12,189 | 282 | """
To train a GPT from sratch
"""
import argparse
import os
import time
import math
import pickle
from contextlib import nullcontext
import numpy as np
import torch
from torch.nn.parallel import DistributedDataParallel
from torch.distributed import init_process_group, destroy_process_group
import pynvml
from model i... |
a3dbe30d4b6d709418897dd93c2c21236bb87391befcbf1637f6c768f98aa904 | Python | 12,197 | 336 | # 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... |
e713282cfefff2a673287123b0330f6af8c027bb32cc1f6eb4fbfdbad5891989 | Python | 12,198 | 329 | """Command runners specific to TPU VM pods.
TPU VM pods may contain multiple hosts, each including attached TPU chips and
associated internal/external IP addresses.
To support TPU VM pods, we represent entire TPU pods as "Ray Nodes", meaning
that TPU pods will need to run the operations specified in `CommandRunnerInt... |
037de25afe53a6b2367f301c08fcc18aa36dfc3450ea82a71a792e0db93c0d3a | Python | 12,204 | 271 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion):
# --------------------------------------------------------------------------------... |
26d307984ac1c5da28266b56ce591d6e0e4f419071380fb9cfa9ed736b5169fe | Python | 12,205 | 293 | import cv2
import matplotlib.pyplot as plt
import numpy as np
import torch
import torchvision
import ffmpeg
def joints_dict():
joints = {
"coco": {
"keypoints": {
0: "nose",
1: "left_eye",
2: "right_eye",
3: "left_ear",
... |
85b27d54bf5cb6038d7fa5d1368e9712b23d51e24d83312c7c777b136cfbb9b2 | Python | 12,211 | 330 | r"""Layer A — genome-scale metabolic models (GEMs) via COBRApy.
Constraint-based reconstruction and analysis: read a model (local SBML or a
BiGG identifier such as ``e_coli_core`` / ``iML1515``), run FBA/FVA/pFBA, and
screen single / double gene knockouts. All CPU, all built on
`COBRApy <https://github.com/opencobra/... |
add551c8878ddba4b672a026ba6cef8cae5bf066c7e0e5340478e0d312c32f02 | Python | 12,211 | 339 | import logging
import numpy as np
import torch
from torch import nn
import torch.nn.functional as F
from sklearn import mixture
from ..decoder import MLPDecoder
class SplitLatentLayer(nn.Module):
def __init__(self, enc_hid, latent_dim=None, conti_dim=None, cat_dim=None, cont_l2_reg=0.01, cont_l1_reg=0.01, **kwargs... |
0140fa4bba67a2c467f2d5e30f1761111c99daa18cc83f472c1026c37b1bd564 | Python | 12,212 | 177 | #-----------------------------------------------------------------------------------------------------------------------------------------------
# Author: Brandon S Coventry Purdue University, UW Madison Neurosurgery
# Date: 08/2022
# Purpose: This program isn't discussed in the paper, but is a de... |
3ab562d1347f9b64ab7136a4ae940bf1834f6c6f9803fb527d6c157e7cd6da6c | Python | 12,220 | 387 | """
Unit and regression test for the endstate_correction package.
"""
# Import package, test suite, and other packages as needed
import os
import pickle
import sys
import numpy as np
import pytest
from endstate_correction.protocol import (
FEPProtocol,
NEQProtocol,
SMCProtocol,
)
from endstate_correction... |
b36e564c3e33b6bcf045dbf5b2ab8372199c795230df1a8d020ad736aef4f904 | Python | 12,228 | 334 | import bpy
from bpy import context
import os
import sys
import argparse
## Example call from commandline: blender -b -P decimate_mesh_blender.py -- -f mesh.obj -o mesh_dec.obj -r 0.5 -i 2 -n 4 -l 0.5
## Blender will ignore all options after -- so parameters can be passed to python script.
# get the args passed to ble... |
d53fb9b7bcf1421bc24a0c55969990727bf6b7a1b09641a537f6dac81e075f9c | Python | 12,229 | 260 | # Ultralytics YOLO 🚀, GPL-3.0 license
"""
Run prediction on images, videos, directories, globs, YouTube, webcam, streams, etc.
Usage - sources:
$ yolo mode=predict model=yolov8n.pt --source 0 # webcam
img.jpg #... |
624dbd17d5e3d43898f7141ee8d32d86aad1d272897adf85dabb63e0429a3c26 | Python | 12,231 | 311 | """High-level manager coordinating scope, research and writing steps.
This module provides the :class:`ResearchManager` which ties together the
``scope``, ``research`` and ``write`` helpers to produce a simple end-to-end
research workflow. Model configuration is delegated to
:class:`~omicverse.llm.model_factory.ModelF... |
61bb3ad2ed165c8bd5335a834cc4dbd7ed043da28c8658127adaaa9949b14757 | Python | 12,233 | 321 | import scanpy as sc
from anndata import read_h5ad
import pandas as pd
import numpy as np
import scipy as sp
import os
import fnmatch
import time
import argparse
from statsmodels.stats.multitest import multipletests
# Inhouse tools
import scdrs.util as util
import scdrs.data_loader as dl
import scdrs.method as md
"""... |
6810d0e28e7370371b257aa3be66d8746e63641ad95749e8f4ae8a7423ff5d44 | Python | 12,240 | 367 | """Adapted from https://github.com/yang-song/score_sde_pytorch"""
import logging
import numpy as np
import torch
from einops import repeat
from scipy import integrate
import ntd.utils.sde_lib as sde_lib
from ntd.utils.utils import standardize_array
log = logging.getLogger(__name__)
def get_model_fn(model, train=F... |
468d27eb7c4e79e783ff619af21ac559448b7508a98138ccfee915294fbef845 | Python | 12,246 | 246 | import json
import numpy as np
from matplotlib import pyplot as plt
from scipy.optimize import curve_fit
from general_utilities.data_helper_function import create_epochs, compute_t_stat, compute_fsize
def generate_single_trials(times, fsize, components_dict, channel, n_trials, conditions, sigma, sfreq):
"""
... |
122718b4bee4e1fff9a011d8acd2a730646fe3f627334413c96db9b570fb792e | Python | 12,254 | 416 | """mol2ccs model."""
import logging
import numpy as np
from keras import Model, callbacks, initializers
from keras.layers import Dense, Dropout, Input, concatenate
from keras.models import load_model
from keras.optimizers import Adam
from spektral.data import BatchLoader
from spektral.layers import ECCConv, GlobalSum... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.