sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
15b8014755808f635147187b09638ab0fd28e228153ea5f5b3fbc2a83c516c5b | Python | 14,387 | 367 | ####################################################################################################
# Copyright (c) 2020, 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... |
66dab96ee724a521c61e6aaaa2ae0801b6eff13a734a338445ee5b7abdd8676c | Python | 14,395 | 436 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import json
from abc import ABC
from collections.abc import Callable, Sequence
from copy import deepcopy
from pathlib import Path
from typing import TYPE_CHECKING, Any, Generic, Literal, Self, TypeVar, overload
fr... |
9651ceb716812785827f2bff006937cd67cb7a10b30152bf1691a9fd0853f058 | Python | 14,396 | 384 | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import range, zip, map, reduce, filter
from six import string_types
import numpy as np
from collections import namedtuple
import sys, os, warnings
from ..utils import _raise, consume, axes_check_a... |
41f26769a50ba693f45fe31f74f5a301494c084924e44c4725ed7d4b1cebf2d1 | Python | 14,410 | 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... |
d45a7dcbdc49d9ccf22fcd177e9e44a14017db19b15b2203ac68c1f52e4a2b93 | Python | 14,410 | 315 | #!/usr/bin/python
#*-* coding: utf-8 *-*
"""
BiasAway module generating adapted background for motif overrepresentation.
BiasAway with the possibility of using very different ways of
generating backgrounds lying into two categories:
- Creation of new random sequences:
- mono-nucleotide shuffling using the foreg... |
48ce9fe98cb3ac717278c227544564759f5c563316bcc73d1b51a3c5c0d987bd | Python | 14,419 | 408 | # +
import warnings
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.colors import ListedColormap
from matplotlib.gridspec import GridSpec
import pandas as pd
def get_rgb_function(cmap, min_value, max_value):
r"""Generate a function to map continous values to RGB values... |
132b86d008f70b6eef4d8ade72e02e27fdd5e6d65b3bdf15b55ee7daadd594bb | Python | 14,427 | 332 | ####################################################################################################
# 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... |
6f6e6faf046f6fb069603ff9d42ff08c6ba7840c67b48867ad8e1ba62ed22a14 | Python | 14,434 | 439 | from typing import Dict, List, Tuple
import tensorflow as tf
from ml4h.models.Block import Block
from ml4h.TensorMap import TensorMap
tf.random.set_seed(1234)
Tensor = tf.Tensor
class TransformerEncoder(Block):
def __init__(
self, *, tensor_map: TensorMap, dense_layers: List[int],
dense_regular... |
bd1f77c63320e75c6dc234a070e24f3cca04b305214fd628a038210fe9a3de00 | Python | 14,437 | 435 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
Classification of complex inversion events.
"""
from collections import defaultdict
import numpy as np
import svtk.utils as svu
def breakpoint_ordering(FF, RR, mh_buffer=10):
"""
Match paired breakpoints to known coordinate orderings.
e.g. in a simple... |
903f22c12db7634e4231a4ea868aa15bff426877f6d5f55dfa9ecc3f7d966ca3 | Python | 14,438 | 391 | ####################################################################################################
# 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... |
13bcc906d02173813e9f2b1efb0e5998c4b960b8b5b1ded2a76098c0f16e4204 | Python | 14,446 | 267 | import logging, os, datetime
import pandas as pd
from gensim.models import KeyedVectors
from sklearn.manifold import TSNE, LocallyLinearEmbedding
from Embedding.prediction import prediction
from misc.abb_med_disease import gen_abb_med_disease
from Data_Managment.build_DocTermDict import DocumentTermDictionary, update... |
2f99c2635cafb5868c14340873cf197b1977a14f2a7a71f4abbd946b648ac0b1 | Python | 14,455 | 406 | #!/usr/bin/python
"""
Functions for marker gene selection and computing cell-cell distances or
similarities
"""
import numpy as np
from scipy import stats
from scipy.spatial.distance import pdist, squareform
import numba
try:
from scipy.stats import energy_distance, wasserstein_distance
except ImportError:
m... |
8668326d63acd2c5bcabef121860e7e4fd97b3df0831d042d9d4ed33125693b9 | Python | 14,456 | 280 | import unittest
import numpy as np
from reval.param_selection import SCParamSelection, ParamSelection
from reval.param_selection import _return_best, _return_knownbest, _create_result_table
from sklearn.neighbors import KNeighborsClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble impor... |
9d7843709f3d634b12b23544c53665fb5226c72f1ac8687bd87d80d5dcfea543 | Python | 14,463 | 412 | from dataclasses import dataclass
from pathlib import Path
from typing import TYPE_CHECKING, Any, Generic, Iterable, Sequence, TypeVar
import numpy as np
import pandas as pd
from numpy.typing import NDArray
from PIL import Image
from ..pixels import CoordinateInput, Pixels, validate_pixel_input
from ..shapes import G... |
b1f9c1f6e1b84f82238694abeb7ee6859e0e1297e199e228b8bc6d26b8dfaa06 | Python | 14,468 | 396 | from functools import reduce
from timeit import default_timer as timer
from typing import List, Optional, Sequence
import anndata as ad
import numpy as np
from joblib import Parallel, delayed
from scipy.sparse import issparse
def _as_flow_matrix(adata: ad.AnnData, flow_expr_key: str) -> np.ndarray:
"""Extract a ... |
dddef3dc87938d94096be860811aefd0328bfd0e816adcc2f6f148c34f3244b5 | Python | 14,468 | 235 | # -*- coding: utf-8 -*-
"""
Module for functional template inference.
Uses functional alignment on Niimgs and predicts new subjects' unseen images.
"""
# Author: T. Bazeille, B. Thirion
# License: simplified BSD
import numpy as np
from joblib import Parallel, delayed
from sklearn.base import BaseEstimator, Transformer... |
ec48dd75e45b970acab168b8d91d852914b08ce9a0d216a324d5332a3fc84c84 | Python | 14,468 | 339 | from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import range
from ..utils import _raise, backend_channels_last
from ..utils.tf import keras_import, K
Conv2D, MaxPooling2D, UpSampling2D, Conv3D, MaxPooling3D, UpSampling3D, Cropping2D, Cropping3D, Concatenate, Add, Drop... |
cc1588681669265b3f5c1ef7098e812be06d759b689489b94422ab06f6ae9c3c | Python | 14,477 | 399 | import json
import os
import secrets
import subprocess
import sys
import time
from types import SimpleNamespace
import pytest
import requests
import yaml
from click.testing import CliRunner
import ray
from ray._common.test_utils import wait_for_condition
from ray._private.authentication_test_utils import reset_auth_t... |
2680a0585e83e0425cf92fecb34399d389e91d522552e6975c94d468bd2775e0 | Python | 14,479 | 391 | import anndata
import numpy as np
import os
from sklearn.cluster import KMeans
from typing import Union
import scipy
import scipy.sparse
class scSemiProfiler:
def __init__(self,
name:str,
single_data:anndata.AnnData,
bulk_data:anndata.AnnData,
b... |
b96603a71e8e3fcd5669738586508048f82880715572e080bb4ff26b8c9427e5 | Python | 14,480 | 404 | """
OpenAI OAuth helpers for Jarvis.
"""
from __future__ import annotations
import base64
import hashlib
import json
import secrets
import threading
import time
import webbrowser
from datetime import datetime, timezone
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path
from ty... |
b9c43368794e329ad1212fbf565f87e6fb42f5f29f87d351281a16ddda3c01e4 | Python | 14,480 | 365 | """dbSNP data collector."""
import logging
import json
from typing import Any, Dict, List, Optional, Union
from src.api.dbsnp import dbSNPClient
from src.models.genomic import Variant, Gene
from .base import BaseCollector
from config.config import settings
logger = logging.getLogger(__name__)
class dbSNPCollector... |
6872d301ee7d87faf4ad9d1b1de4ae2031bcd753053fafed3adcb189921555f0 | Python | 14,487 | 370 | from pprint import pformat
from typing import Dict, List, Optional, Set, Union
from warnings import warn
import torch.nn as nn
from torch import Tensor
import sinabs.layers as sl
from .dvs_layer import DVSLayer
from .dynapcnn_layer import DynapcnnLayer
from .utils import Edge, topological_sorting
class DynapcnnNet... |
850ba9fa521bf2ab564995077cde5ffc043cea64869e81f9b9e1c182703f4b88 | Python | 14,488 | 393 | import time
import os
import logging
import sys
import numpy as np
import pandas as pd
import joblib as jl
import glob
import torch
from pivae_code import pi_vae, conv_pi_vae, datasets, util
from keras.callbacks import ModelCheckpoint
from numpy.random import Generator, PCG64
import cebra.datasets
import argparse
de... |
8617b8f9fcde0d6c16681e81cd3d153ae38f19a857cb90c895615f8f00e62a8e | Python | 14,493 | 469 | """
Useful functions related to the `ava.models` subpackage.
"""
__date__ = "July - November 2020"
from affinewarp import PiecewiseWarping
from affinewarp.crossval import paramsearch
import h5py
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import numpy as np
import os
from scipy.interpolate import inter... |
29d5c32c2cc5b814da5d5e950e4c7e827bf6ea4923660996bbb4fbc39070b99b | Python | 14,494 | 398 | """GEO (Gene Expression Omnibus) API client."""
import logging
from typing import Any, Dict, List, Optional, Union
import xml.etree.ElementTree as ET
from .base import BaseAPIClient
from ..config import settings
logger = logging.getLogger(__name__)
class GEOClient(BaseAPIClient):
"""Client for NCBI GEO API.
... |
5e4dfec70a8273502d0539467895bbdde2a57d28aec22b60f4ffd5a25f708da8 | Python | 14,495 | 431 | """
Functions to creating figures to inspect tedana output
"""
import logging
import os
import matplotlib
import numpy as np
matplotlib.use("AGG")
import matplotlib.pyplot as plt
from nilearn import plotting
from tedana import io, stats, utils
LGR = logging.getLogger("GENERAL")
MPL_LGR = logging.getLogger("matplotl... |
74db5faa4564d72f110e03e4f352475de5e74f3b4baa5537d4fb0519763a5e6c | Python | 14,496 | 398 | """GEO (Gene Expression Omnibus) API client."""
import logging
from typing import Any, Dict, List, Optional, Union
import xml.etree.ElementTree as ET
from ..base import BaseAPIClient
from ...config import settings
logger = logging.getLogger(__name__)
class GEOClient(BaseAPIClient):
"""Client for NCBI GEO API.... |
43dfb933277695b8bb74ea7a050e535bc4c66ad0cf4626a762d5089d78cf219b | Python | 14,497 | 503 | import datetime
from serial import Serial
import time
#init the serial port to the microtome
ser = Serial('COM1', 19200, timeout=2)
def calc_checksum(a):
return hex(((sum(int(a[i:i+2],16) for i in range(0, len(a), 2))%0x100)^0xFF)+1)[2:]
def leicaMessage(Rec,Sen,Grp,Cmm,Xst,Yst):
message_body = ... |
cd1e1faa100026456a206b9615193d0f25ce3bcf056b9bf034569c79d7229fb3 | Python | 14,504 | 386 | from __future__ import annotations
import contextlib
import importlib
from typing import Any, Iterable
import numpy as np
import pandas as pd
from anndata import AnnData
from .._optional import build_optional_dependency_error, missing_optional_dependency
from .._registry import register_function
from .._settings imp... |
867daad7f9b0b94aa3a2eee12bb855b12d5e019ca6c80f305e3c21abaf74a417 | Python | 14,505 | 378 | """
Geneformer multi-task cell classifier.
**Input data:**
| Single-cell transcriptomes as Geneformer rank value encodings with cell state labels for each task in Geneformer .dataset format (generated from single-cell RNAseq data by tokenizer.py). Must contain "unique_cell_id" column for logging.
**Usage:**
.. code... |
c7b635abc6a322b8ff6518f66497cfb561b8ad3ea28953a24c75268295ab42f8 | Python | 14,505 | 444 | from abc import abstractmethod
import os
from discontinuous_galerkin.base.base_model import BaseModel
import numpy as np
from attr import dataclass
import pdb
import matplotlib.pyplot as plt
from tqdm import tqdm
import ray
from scipy.stats import norm
import time
from data_assimilation.numpy.model_error import BaseMo... |
29de571a8e53bec55840edbe99dcbb3f1f01cd5a0b726846a97f40edcbff1cff | Python | 14,507 | 328 | import torch.nn as nn
import torch
import numpy as np
from src.models import *
from torch.nn import functional as F
import os
def _padding(downsample, kernel_size):
"""Compute required padding"""
padding = max(0, int(np.floor((kernel_size - downsample + 1) / 2)))
return padding
def _downsample(n_samples_... |
e92804436c806d46fcbb5ad81ed0809dac7b01eee5954297074508e68c29b165 | Python | 14,509 | 375 | """
Static, diff-scoped parameter-coverage check for Ray's public API surface.
Fails when a pull request adds a new ``@PublicAPI`` callable, or a new
parameter to an existing one, without a matching entry in the docstring
``Args:`` block. The intent is "no new debt": pre-existing undocumented
parameters are grandfathe... |
dc0f4764be4d0052a5a06b6daea206ccba9843cbc14e777245d2148ae126d22d | Python | 14,519 | 382 | """STRING data collector."""
import logging
import json
from typing import Any, Dict, List, Optional, Tuple
from src.api.string import STRINGClient
from src.models.protein import Protein
from src.models.interaction import ProteinInteraction
from .base import BaseCollector
from config.config import settings
logger =... |
1eead8305d931eed2360a6017e613cf457211ccf5c17063733be81d06903a651 | Python | 14,520 | 425 | import sys
import pytest
from ci.ray_ci.doc.api import (
_SPHINX_AUTOCLASS_HEADER,
_SPHINX_AUTOSUMMARY_HEADER,
API,
AnnotationType,
CodeType,
)
from ci.ray_ci.doc.mock.mock_module import (
MockClass,
mock_function,
mock_w00t,
)
_MOCK = "ci.ray_ci.doc.mock.mock_module"
_INTERNAL_MOCK =... |
815c7ac565b19a5e97fb9b9bb088d2d0de4e28611224096a1a18afbde3bec5ce | Python | 14,521 | 398 | #
# 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... |
665832117e7b79acd8dae07c79411b5320f0ee0a51f821821c03e3a5a0674ef6 | Python | 14,524 | 414 | """
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.
"""
import math
import pytest
import torch
import torch.nn as nn
from src.fairchem.core.models.uma.nn.mole import (
interval_intersection,... |
7c8945506c620acfcfb12d34e649070519179176a227e9fd3822a37bf84a4c7b | Python | 14,524 | 352 | ####################################################################################################
# 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... |
9d4ebb7dcc0bfe6a5b4d19771c47a72270230949089e27d55729ee41a4d2c3df | Python | 14,524 | 385 | """Parser Precision-Recall PR Curve.
Examples:
python tools/analysis_tools/pr_curve.py \
${ANN_FILE} \
${RESULT_JSON_FILE_1} ${RESULT_JSON_FILE_2} ${RESULT_JSON_FILE_3} \
--iou_thrs 0.5 0.55\
--plot_single
--classwise
--legend ${NAME_1} ${NAME_2} ${NAME_3}
--title_base ${RUN_NAME}
-... |
e5ac42c1890ed5ea60d7e0ef3faf56825c8d3ef4cb6ac5119a30ea60dce481a9 | Python | 14,524 | 348 | """
Module for Basic Settings Editor, where the user configures and
edits basic settings and criteria by which to define a breath
within a plethysmography recording. These settings only define
breathing, not "good" breathing.
***
built as part of the Russell Ray Lab Breathing And Physiology Analysis Pipeline
***
Breat... |
59137327224bc26336b84eb62f46b7ff29237dc91d6309d0f7d6e7856905077b | Python | 14,531 | 400 | """
Doing motion correction and regestering multiple runs across sessions.
"""
import ants
import os
import glob
import nibabel as nb
import numpy as np
import subprocess
import sys
sys.path.append('./code/misc')
from computeT1w import *
# Set some paths
DATADIR = '/Users/sebastiandresbach/data/neurovascularCouplin... |
1ee80f700a4de666d3b67e8192f3298d43c1deb9ee21f6e0e8989adc061eb1a2 | Python | 14,539 | 337 | import argparse
import pickle
from typing import List, Tuple, 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_con... |
19eddf12c80f0f38f1db6a93b00a9667fd3aeef522cb020364bb5a24f2f91205 | Python | 14,551 | 438 | """
Utils Functions used for dentate spikes classification model.
Created on Fri Oct 20 2023
Author: Manfredi Castelli - manfredi.castelli@ndcn.ox.ac.uk
"""
import numpy as np
import scipy.signal as sig
import matplotlib.pyplot as plt
sr = 1250 # sampling rate
DTT = 1000/sr # sampling time (in ms) of eeg signal
# ... |
f21d4e6bb08884512c83a18e52b25bbee81ac7145753db1e9fef88ec8351bd67 | Python | 14,553 | 329 | import os
import sys
import numpy as np
import yaml
from .network import Network_3D_Unet
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.utils.data import DataLoader
import time
import datetime
from .data_process import test_preprocess_chooseOne, testset, multibatch_test_s... |
e21d190e39f09758a65f67d14638c868a89a549ac9eb6ef4adec22fb6390b0df | Python | 14,557 | 414 | import asyncio
import concurrent.futures
import io
import logging
import os
from pathlib import Path
from typing import AsyncIterator, Optional
import grpc
import ray.dashboard.modules.log.log_consts as log_consts
import ray.dashboard.modules.log.log_utils as log_utils
import ray.dashboard.optional_utils as dashboard... |
635c54ff6920488dee1cbe89c80de7f221d6314b2701ded8bad82beea488501a | Python | 14,562 | 431 | #!/usr/bin/env python
## HiC-Pro
## Copyright (c) 2015 Institut Curie
## Author(s): Nicolas Servant, Eric Viara
## Contact: nicolas.servant@curie.fr
## This software is distributed without any guarantee under the terms of the BSD-3 licence.
## See the LICENCE file for details
"""
Script... |
de46ec77824d42e88927bb2be8a6d15f629ac880455452d98503a4ba130e92e2 | Python | 14,562 | 353 | """
For each train-test experiment, train a model based on predetermined parameters
@author: Haowen Zhou and Siyu (Steven) Lin, Oct 17, 2023
"""
# In[0] Dependencies and Library Configurations
from __future__ import print_function, division
import torch
import torch.nn as nn
import torch.optim as optim
from torch.opt... |
fbcc8e178f5fb780eea1c8f11cfe17245da65a2c5f4a76582047138864e6e76c | Python | 14,565 | 413 | """Marker identification and differential analysis for single-EV proteomics.
Single-extracellular-vesicle (single-EV) proteomic data is an EV x protein
matrix — a vesicle behaves like a "cell" and a protein marker like a "gene".
This module provides:
* :func:`rank_markers` — per-EV-subpopulation marker-protein identi... |
f73155233c236f73b1dbc87c278eb69bbeae82a05b66bf54658efc303917b1bd | Python | 14,566 | 449 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
import argparse
import logging
import multiprocessing as mp
import os
import pickle
import time
import ... |
a90b03862820975576a3ab54daa343f21c04ab12e7996c607d7f644fd7bbaa71 | Python | 14,576 | 336 | from .._settings import Colors
import numpy as np
import anndata as ad
from anndata import AnnData
import scanpy as sc
from .._registry import register_function
from ..report._provenance import tracked, note
@register_function(
aliases=[
"参考映射注释",
"reference mapping annotation",
"细胞类型参考映射注... |
1bab5fdd03a00a7739815f5427edbbcbdabb2c705dad639b6a7ddb3a7fe60394 | Python | 14,578 | 456 | """STAR alignment wrapper."""
from __future__ import annotations
import gzip
import os
import shutil
from pathlib import Path
from typing import Dict, List, Optional, Sequence, Tuple, Union
from .._registry import register_function
from ._cli_utils import (
build_env,
ensure_dir,
is_gz,
parse_memory_b... |
1ad28e7c779ebf800de9df01b4d2be5ef1f1d6dd751050bc3807d041c5cc26bd | Python | 14,580 | 446 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""aihwkit example 25: analog CNN with hardware aware training.
Mnist dataset on a LeNet5 inspired network.
"""
# pylint: disable=invalid-name
import os
from d... |
131dc996f1cd3f64c999707170b00d709b1ba4288c436f99ace7192cd04d5656 | Python | 14,583 | 315 | # Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
aac86d55fc7a2b0727a6016783fb2af46307ee5b9637e397b98571c10c30c95a | Python | 14,589 | 378 | import warnings
warnings.filterwarnings("ignore")
import scanpy as sc
import torch
from torch import nn, Tensor
import torch.nn.functional as F
import torch.utils.data as data
import torch.optim as optim
import numpy as np
import pickle
import os
import argparse
import logging
import time
from tqdm.auto import tqdm
... |
f4506111d55fe0a2277f550314ddb4671b2ad895828dd4657381573dea4c72cf | Python | 14,589 | 252 | import numpy as np
import os
import pandas
from sak.data_structures import MetricsStorage
from sak.inference import predict
import cv2
def evaluate(model, config, data, execinfo, metrics, metrics_CV2, results, results_CV2, recompute):
"""Wave evaluation"""
predict(model, config, data, execinfo, results, resul... |
02ed37846dc31db72da7bcbda742a02aa68ed0fec7c9c02a149f486c976e7d76 | Python | 14,599 | 461 | """
SaShiMi backbone.
Use this backbone in your own models. You'll also need to copy over the
standalone S4 layer, which can be found at `state-spaces/models/s4/`
It's Raw! Audio Generation with State-Space Models
Karan Goel, Albert Gu, Chris Donahue, Christopher Re.
"""
import sys
sys.path.append('../')
import torc... |
a30c5bcafa16afb95c994447d782e69fa7bfb5049d209e271a775df86e56ef51 | Python | 14,601 | 388 | # built-in dependencies
import os
from unittest import mock
from unittest.mock import MagicMock
import pytest
# project dependencies
from deepface.commons import folder_utils, weight_utils, package_utils
from deepface.commons.logger import Logger
# pylint: disable=unused-argument
logger = Logger()
def test_loading... |
ac3be2a18ff26ebbd28794f70b4685145d11d0698943373f0f05bbc9858421a8 | Python | 14,603 | 347 | import inspect
from typing import List, Optional, Union
import torch
from torch import nn
from torch.nn import functional as F
from torchvision import transforms
from transformers import CLIPImageProcessor, CLIPModel, CLIPTextModel, CLIPTokenizer
from diffusers import (
AutoencoderKL,
DDIMScheduler,
Diffu... |
fc315b2a3b07c1101f063f16a2e69b4e4f96d60fcc0bb80223b7b4829adc7675 | Python | 14,612 | 327 | # 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... |
8d1c4048d0fc00a4d334b6ce95a3ea4bb6356d00c0cc731de36d8ef6d23fc9b3 | Python | 14,613 | 335 | from __future__ import annotations
import abc
from collections import deque
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, Deque, List, Optional, Tuple
from typing_extensions import override
from ray.data._internal.execution.bundle_queue import (
BaseBundleQueue,
)
if TYPE_CHECKING:
... |
e857b26bbcf417c3dbf156c5f2b440e81e6555b6d1348a5c515b76a600db84f1 | Python | 14,613 | 328 | # Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
6a4e1dd52cf369371c7d2d4dc04b0f0f612c9ea34456b47ae0985b63d66d015d | Python | 14,614 | 252 | import numpy as np
import os
import pandas
from sak.data_structures import MetricsStorage
from sak.inference import predict
import cv2
def evaluate(model, config, data, execinfo, metrics, metrics_CV2, results, results_CV2, recompute):
"""Wave evaluation"""
predict(model, config, data, execinfo, results, resul... |
c2b9c527b5d0a0c98cbacb8e99150817e7b46fd734ba090ef711a7649cad7253 | Python | 14,615 | 476 |
from __future__ import print_function
from __future__ import division
import numpy as np
import scipy as sp
import pdb
import h5py
import sys
import argparse
import logging
import time
import gzip
import re
import os
import math
import uuid
import socket
import shutil
import random
import copy
from collections import... |
72089385b0a2d6b26607135af8e1af69f1a79bfbfb8fdb42cf5a341ac531a01b | Python | 14,617 | 365 | r"""OptForce — which fluxes *must* change, and the smallest set of interventions
that forces them (Ranganathan, Suthers & Maranas 2010).
OptKnock and RobustKnock answer "which deletions couple product to growth".
OptForce asks a different and often more actionable question: comparing the flux
ranges the wild type can ... |
613674b4a1b860999f961ddfb9213f790e7d399d0f6580d0be847ba7ca810cd9 | Python | 14,618 | 349 | import sys
# for linux env.
sys.path.insert(0,'..')
from datetime import datetime, timedelta
import os
import pandas as pd
from tqdm import tqdm
import time
import pickle
import argparse
import csv
import utils
import numpy as np
import functools
print = functools.partial(print, flush=True)
def parse... |
e0ba4d55bf72e5c5373160f842577a568eb34066d5c002b1c49d2488a79797aa | Python | 14,635 | 402 | import torch.nn as nn
import math
import torch.utils.model_zoo as model_zoo
from models.DeepLab.modeling.sync_batchnorm.batchnorm import SynchronizedBatchNorm2d
webroot = 'http://dl.yf.io/drn/'
model_urls = {
'resnet50': 'https://download.pytorch.org/models/resnet50-19c8e357.pth',
'drn-c-26': webroot + 'drn_c... |
05d7027f8c89fcb0192f83f80e4b4de896f3750a40f07cee5e37c0c311cc7d9b | Python | 14,636 | 443 | # type: ignore[reportAttributeAccessIssue]
import io
import math
import numpy as np
import pytest
from python_utils.logger import Logged
from stl.base import BaseMesh, RemoveDuplicates, logged
from stl.mesh import Mesh
from . import utils
def test_units_1d():
data = np.zeros(1, dtype=Mesh.dtype)
data['vect... |
dae7646346bc9a92fd21f337c389aa293cb4c583d472c0d490d1996e3f21f5ae | Python | 14,638 | 311 | # !/usr/bin/python
# -*- coding: utf-8 -*-
# Pytoolkit GeneSymbolUniform for hECA 2.0
# author: Yixin Chen, Haiyang Bian
# date: 2023/09/25
import scanpy as sc
import pandas as pd
import sys
import numpy as np
import scipy.sparse as sp
import os
from tqdm import tqdm
from concurrent.futures import ThreadPoolExecutor
i... |
ecdf6897bc87f294760632d1871db40ab87e835f55ebe79cc7adcf0cf3a9d508 | Python | 14,643 | 435 | """GWAS core for ``ov.genetics`` — pure numpy / scipy / statsmodels.
Unlike the rest of ``ov.genetics`` this module has no external backend:
the standard genome-wide-association primitives are implemented
directly. Covers per-SNP / per-sample quality control (:func:`gwas_qc`),
the per-SNP association scan (:func:`gwas... |
4a0292e29d28dd4b0aba9454bff2354526e0de3dfd15927ce1da775c84386409 | Python | 14,645 | 305 | import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import numpy as np
tf.random.set_seed(1)
import time
import math
import random
from tensorflow.keras.models import load_model
from model_layers import... |
f3d9a84fb2fae87cda028a34a65b4aa67098328bfb6b73eb007eadb679bd9557 | Python | 14,655 | 426 | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 03 20:43:00 2019
@author: ju-bar
Functions and classes handling 2D image aberrations
This code is part of the 'emilys' repository
https://github.com/ju-bar/emilys
published under the GNU General Publishing License, version 3
"""
#from numba import njit # include compila... |
c6269af57f457ab25bad6e2142dfe6f16457621b79d845d067d559d2dc2d08a4 | Python | 14,658 | 367 | #!/usr/bin/env python
""" test the principal functions of CaImAn
use for nosetests and continuous integration development.
See Also
------------
caiman/tests/comparison/comparison.py
"""
#%%
#\package None
#\version 1.0
#\copyright GNU General Public License v2.0
#\date Created on june 2017
#\author: Jremie KALFO... |
f2ed3301deb8f8fb4e552dbd3b63298ac42dcc89688a5d1f338336f9b1e4d3f9 | Python | 14,662 | 416 | # -*- 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.
#... |
dedab660387d0cb711a8c524462e2386b2b27b3803f3f4d2a7c3f1dbe8b05ca2 | Python | 14,668 | 455 | """
Useful functions for segmenting.
"""
__date__ = "August 2019 - March 2021"
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import numpy as np
import os
from scipy.signal import stft
from scipy.io import wavfile
from scipy.io.wavfile import WavFileWarning
import warnings
EPSILON = 1e-9
def get_spec... |
4032a8947faa0f1fd983d904f350c94aeb56b3c96a202ff13a8eb9190b18dec2 | Python | 14,670 | 337 | # Copyright 2023 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
6db97d6074684c08ec7805c0fad02e26b7504a31c084b919e4353faf6c98ea33 | Python | 14,671 | 398 | from typing import List, Optional, Tuple
import torch
import torch.nn.functional as F
KVItem = Optional[Tuple[torch.Tensor, torch.Tensor]]
KVCache = List[KVItem]
def select_kv_cache(cache: KVCache, index: torch.Tensor) -> KVCache:
selected = []
for layer_cache in cache:
if layer_cache is None:
... |
00d2abe536a6b5784b962f325c481aeca537f005143a769e3c98782f679355bd | Python | 14,672 | 335 | """
Usage:
lf_consensus --ref <ref> --vcf <vcf> [--mind <mind>] [--majority <majority>] [-o <output>] [--sample <sample>] [--bam <bam>] [--minbq <minbq>]
Options:
--ref=<ref> Reference fasta file
--vcf=<vcf> VCF output
--majority=<majority> Percentage required [default: 80]
... |
14dab8e1dbb218de1d7bfe9eb5c14cc88a33bd61d07d3c1560a6c786071cd5c0 | Python | 14,679 | 321 | import argparse
import pickle
from collections import namedtuple
from typing import List, Callable, Sequence, Optional
import numpy as np
import torch
import tqdm
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 con... |
c9df71171bbf175559f7ffa86f4b769b5604fc96ee50e0e2ef735ad6bea4f613 | Python | 14,694 | 395 | """Alpha + beta diversity for microbiome AnnData.
Uses ``scikit-bio`` for all single-sample / pairwise metrics; the ``unifrac``
package (``pip install unifrac``) is tapped when ``metric='unifrac'`` and a
phylogenetic tree is supplied.
"""
from __future__ import annotations
from typing import Iterable, List, Optional,... |
482af4a17ffa8889cb24c1d711870f38f71285f832ccd4d093a5b72ce8793815 | Python | 14,710 | 470 |
import numpy as np
import pandas as pd
import os
import torch
from torch import nn
from torch.functional import F
from torch.optim import Adam
from torch_geometric.nn import MetaLayer, MessagePassing
from torch_geometric.data import Data, DataLoader
from matplotlib import pyplot as plt
import matplotlib as mpl
mpl.use... |
808a818e4767154d8c43f18c9ec3080af903d74c546a584fd8490b9bb065f9f0 | Python | 14,713 | 421 | # -*- coding: utf-8 -*-
import errno
import multiprocessing as mp
import nibabel as nib
import numpy as np
from copy import deepcopy
from joblib import Parallel, delayed
from nilearn.connectome import ConnectivityMeasure
from nilearn.input_data import NiftiLabelsMasker, NiftiMasker
from nipype.interfaces import fsl
fro... |
c5ae06638fd7ee2e04b9fd5f7d51f8143a228a908897a8089abe6a81b4b2ae72 | Python | 14,713 | 355 | # Ultralytics YOLO 🚀, GPL-3.0 license
import glob
import math
import os
import time
from dataclasses import dataclass
from pathlib import Path
from threading import Thread
from urllib.parse import urlparse
import cv2
import numpy as np
import requests
import torch
from PIL import Image
from ultralytics.yolo.data.au... |
a0f69a6aa80adc93f28212a61b445fce31f42b0feff734f58932e75455fe19b6 | Python | 14,717 | 431 | import math
import cv2
import munkres
import numpy as np
import torch
# solution proposed in https://github.com/pytorch/pytorch/issues/229#issuecomment-299424875
def flip_tensor(tensor, dim=0):
"""
flip the tensor on the dimension dim
"""
inv_idx = torch.arange(tensor.shape[dim] - 1, -1, -1).to(tenso... |
e81da125373afec5750432e864436b4702393686a0ccdb896598ef3fe855904f | Python | 14,721 | 357 | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
141545d2167c3741dd135ce16fc183e580716182ec57a510a9e5672663d75900 | Python | 14,723 | 394 | # 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... |
b8f2f7ad6edbfef6edb8b9bfa377387b357af1ecd0b5edbc56727229b9fd81c9 | Python | 14,724 | 419 | #
# 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... |
3d63a8311b4c27e4d138161e2014a679c595e853eda6f81da2ca4660f7e4561e | Python | 14,729 | 261 | #!/usr/bin/env python
import sys
import argparse
import logging
import pandas as pd
from pysam import VariantFile, VariantRecord
from sv_utils import genomics_io, get_truth_overlap
from typing import List, Text, Optional, Dict, Tuple, Iterable, Set, Mapping
def get_confident_variants_vapor(vapor_files: Optional[D... |
699b9a968fa055da65db5977c7f306f5cfada2def81d98a2a9961f9829c54413 | Python | 14,735 | 403 | """Util class to install packages via uv."""
import asyncio
import hashlib
import json
import logging
import os
import re
import shutil
import sys
from asyncio import create_task, get_running_loop
from typing import Dict, List, Mapping, Optional
from ray._common.runtime_env_uri import parse_uri
from ray._common.utils... |
e442a3d375400b82de8869288b313fbe574769aaa7feb0105b8063b070967923 | Python | 14,741 | 354 | # 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... |
b5e8388b0d0e983cbc76d987a4ff11aa847f1239175d7a0d19e94c95ddf709e5 | Python | 14,747 | 336 | import argparse
import pickle
from collections import namedtuple
from typing import Dict, List, Tuple
import numpy as np
import torch
import tqdm
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 convex_optim_base.un... |
c7c42d690fbf71c5dba9b9d48b562408b95eb6a64ba9db8dbf295fe678078749 | Python | 14,750 | 483 | """
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.
A2A (all-to-all) graph parallel correctness tests.
Verifies that the A2A graph parallel implementation produces
correct results via multi-proc... |
a7dc4514a730d65cf0361ecd92ea9a2f0aec3376dbbed8f004bfae530d391550 | Python | 14,753 | 395 | # 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... |
a0ce934e516eb3f36821b971320e99a0da3b258b04ffe2cf313f2317d0ede264 | Python | 14,754 | 382 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
from collections import namedtuple
import torch
import torch.nn as nn
import torch.nn.functional as F
import copy
import random
def init_weights(m, mean=0, std=0.1, bias=0):
if isinstance(m, nn.Linear):
nn.init.normal_(m.weight, mean, std)
... |
657c193fd00ba313890bbfd3ca9a6b9a997c3ce77111d80277c65ce3858f1ea6 | Python | 14,757 | 290 | import numpy as np
from scipy import sparse
from sklearn.metrics import pairwise_distances
from PostProcessing.par3 import fastCOMdistance
def segs_results(segs: list):
'''Pull segmented masks and their properties together from a list of segmentation results from each frame.
The outputs are the segmented... |
e591e03a315deb3e51062bb948f60fb66e8e82245eea739c43c609bf9066ee0a | Python | 14,757 | 303 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import AutoLocator
plt.style.use('seaborn-colorblind')
# import pandas as pd
import random
import pickle as pkl
from math import floor
import torch
import seaborn as sns
import pandas as pd
from utils import load_json_file
from pathlib import ... |
edb59adb558d1c2dee72e72b037048b4bbe448f320337c2453c31cfb2f4f8c76 | Python | 14,769 | 499 | """Adapted from FastChat"""
import abc
import gc
import math
from typing import Iterable, Optional
import sys
import time
import warnings
import psutil
import torch
from transformers import (
AutoTokenizer,
AutoModelForCausalLM,
LlamaTokenizer,
LlamaForCausalLM,
AutoModel,
AutoModelForSeq2SeqLM... |
9bc019ae24b7bd755015b85e4332d1e5b5634ef39164b713d1631a89b7e6e3b4 | Python | 14,776 | 383 | import logging
import time
from collections import Counter
from functools import reduce
from typing import Any, Callable, Dict, List, Optional
from ray._private.gcs_utils import PlacementGroupTableData
from ray.autoscaler._private.constants import (
AUTOSCALER_MAX_RESOURCE_DEMAND_VECTOR_SIZE,
AUTOSCALER_REPORT... |
b50aa5ce8d9751ea83a32f16a5ecf8ce3504f15d0b855698b891cffda6ac1598 | Python | 14,781 | 251 | import numpy as np
import tensorflow as tf
from projectmetis.proto import model_pb2
from projectmetis.python.logging.metis_logger import MetisLogger
from projectmetis.python.models.keras.optimizers.fed_prox import FedProx
from projectmetis.python.models.keras.keras_proto_factory import KerasProtoFactory
from projectme... |
0d6b170e188d98fba0d829ac369cc9034bbd257af7e21a344a96274d6096dcf4 | Python | 14,787 | 404 | # 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... |
16b91dd9f82befe508d58a0bb6aa3ef3688a768ddde463aacfc60483a1b08f5c | Python | 14,789 | 396 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.