sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ca332d09890a0ebed507349bfd6ff50eddde01a9600ac4c73f6c50a73a2e9d09 | Python | 14,804 | 433 | import numpy as np
import torch
from torch import nn
from pfrl.action_value import QuantileDiscreteActionValue
from pfrl.agents import dqn
from pfrl.nn import Recurrent
from pfrl.utils.recurrent import one_step_forward, pack_and_forward
def cosine_basis_functions(x, n_basis_functions=64):
"""Cosine basis functio... |
b97e431e7a490caa2469cd6996c79bdc6c3ff5ea30a05454917ec7eadae1e1ba | Python | 14,809 | 472 | from pathlib import Path
import h5py
import numpy as np
import pandas as pd
import pytest
from click.testing import CliRunner
from pandas.testing import assert_frame_equal
from deeprvat.preprocessing.preprocess import cli as preprocess_cli
script_dir = Path(__file__).resolve().parent
tests_data_dir = script_dir / "t... |
1bb4b83b7faff8cbc8644b90332ebff131d313bad6dc2e0175c6bae266defc5b | Python | 14,820 | 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... |
80727e14d659e86c914b150aaab0feed93da536eeb3ee0addb6ef9d4d2e973f0 | Python | 14,822 | 397 |
import gym
import numpy
import random
import os
import abberior
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,... |
e555ef381146d63546fe99a96221007e6463fff56d87fb71e62cd8083f7aea7d | Python | 14,824 | 473 | """Video loading and frame sampling utilities using ffmpeg."""
import asyncio
import json
import subprocess
from dataclasses import dataclass
from typing import Optional
import numpy as np
from PIL import Image
from constants import NUM_WORKERS
@dataclass
class VideoMetadata:
"""Video metadata extracted from f... |
036d1fb5ed59c6c69bcc80a92d01c3c1f17644b29b6142134d13e1b85db5676c | Python | 14,835 | 446 | """
Remove noise from segmenting files.
"""
__date__ = "August 2019 - January 2021"
from itertools import repeat
from joblib import Parallel, delayed
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import numpy as np
try: # Numba >= 0.52
from numba.core.errors import NumbaPerformanceWarning
except ModuleN... |
4435940de24197aca25a18d310ed196667faf5444ddac5c943a307caf6deb047 | Python | 14,848 | 382 | """Multi-cohort 16S meta-analysis utilities.
Two APIs:
- :func:`combine_studies` — stitch a list of AnnDatas (one per study) into a
single AnnData with a shared feature axis, an ``obs['study']`` label, and
zero-filled cells for taxa absent from a given study. This is the
"mega-analysis" input — run regular DA o... |
38592cd1745e2415ea905bcabd5d70345ad1dab14c7a13b4b435b8c1b14ad6ea | Python | 14,855 | 371 | r"""The A→B handoff: given a reaction, which enzyme should catalyse it?
``pathway_search`` and ``retro_biosynthesis`` find a route from substrate to
product. Layer B can then design, score and check an enzyme. Between the two
there was nothing: the route came out as a list of chemical transformations, and
somebody had... |
557e7eae104709c47247d3db85dda753230d4bc5219939a0ce88dd21551bdcb9 | Python | 14,860 | 360 | """
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.
Structure Deduplication Utilities for FastCSP
"""
from __future__ import annotations
import multiprocessing as mp
import os
from collections ... |
95b1844f78ac6c2dbab6d6a0510a7b9130e316e9927fcc8bfa4f2286f62db13b | Python | 14,863 | 398 | import argparse
import math
import os
from pathlib import Path
from typing import Optional
import torch
import torch.nn.functional as F
import torch.utils.checkpoint
from accelerate import Accelerator
from accelerate.logging import get_logger
from accelerate.utils import set_seed
from diffusers import AutoencoderKL, ... |
2e92c016bacd132e7e5b39301d7e1ce6a90f042736a05431b573594f9452fa6b | Python | 14,865 | 497 | # This file is autogenerated by the command `make fix-copies`, do not edit.
from ..utils import DummyObject, requires_backends
class AltDiffusionImg2ImgPipeline(metaclass=DummyObject):
_backends = ["torch", "transformers"]
def __init__(self, *args, **kwargs):
requires_backends(self, ["torch", "transf... |
f5ceaa25ff3fb3fc6a56a003a4fb8ad87398f96df98e39be8692c7824485a348 | Python | 14,870 | 418 | import logging
import os
import sys
from datetime import datetime
from typing import List
import click
from ci.ray_ci.automation.crane_lib import CraneError, read_file_from_image
from ci.ray_ci.automation.image_tags_lib import (
ImageTagsError,
copy_image,
format_platform_tag,
get_platform_suffixes,
... |
de1d32bce3b26fdc3c048756e30990c67d35e0910aaad2a7731af4c9ce14f6b0 | Python | 14,872 | 386 | import collections
import copy
from logging import getLogger
import numpy as np
import torch
from torch import nn
from torch.nn import functional as F
import pfrl
from pfrl.agent import AttributeSavingMixin, BatchAgent
from pfrl.replay_buffer import ReplayUpdater, batch_experiences
from pfrl.utils import clip_l2_grad... |
47b469885532800f8e4edb4ddf4cd4aeb77d0a0c2fa366dfc9348e061cac2fa0 | Python | 14,876 | 416 | # Copyright 2022 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... |
dfefdad8bf98e5d493a5e1e4b710e7c2111dd247435245f87054b0648cf0a571 | Python | 14,876 | 363 | from typing import Optional, List, Union, Sequence, Tuple, Dict
import torch
import torch.nn as nn
from monai.networks.blocks import Convolution, SubpixelUpsample
from monai.networks.layers import Act
from src.layers.vector_quantization import VectorQuantizerEMA
from src.layers.residual_unit import ResidualUnit
from ... |
842ae22de71c482008a1b6561343811349f898ae17404e59a75606bd91cd042d | Python | 14,882 | 373 | #!/usr/bin/env python3
"""Class for handling a gene-gene graph."""
from ..utils import vcorrcoef
from ..data import snap_colors
from .utils_community_detection import (
calculate_gene_modules_leiden,
get_modules_from_partition,
set_module_colors
)
from .utils_pruning import prune_graph_components, prune_gra... |
c13401be517b7a5503a1f08e09e47187486a1c67206ef1809f049d84c070190d | Python | 14,895 | 389 | """Readers for the four bulk-proteomics file formats omicverse supports
out of the box: MaxQuant ``proteinGroups.txt``, DIA-NN
``report.pg_matrix.tsv``, FragPipe ``combined_protein.tsv``, and Olink
long NPX TSV/CSV.
Every reader returns an ``AnnData`` with the omicverse convention:
``obs = samples`` (rows), ``var = pr... |
1ea4317ae2f2c637896bb2d5802b773861c6b3e0e95e75ffbadc1fd3aba1472f | Python | 14,897 | 419 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion):
# --------------------------------------------------------------------------------... |
80ccc8aaf6e77852d37b6f153aefa4d5dc78be6c4c862f8deed6dd8f86b51579 | Python | 14,905 | 391 | """Provide functions for the endstate correction workflow."""
import os
from dataclasses import dataclass, field
from typing import List, Optional, Union
import mdtraj as md
import numpy as np
from openmm import unit
from openmm.app import Simulation
from pymbar import MBAR
from endstate_correction.smc import SMC
c... |
ccdceb68a77d27c71068bd8e0910e3ca9177bef291dca83eab34dfd0a532b877 | Python | 14,906 | 304 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 23 20:42:39 2021
@author: saad
"""
import tensorflow as tf
from tensorflow.keras import Model, regularizers
from tensorflow.keras.layers import Conv2D, Dense, Activation, Flatten, Reshape, MaxPool2D, Permute, BatchNormalization, Dropout, LayerNorm... |
c515169b23e936fd2d04ea734cd967e2811a5ba4f03831ac694c758a0c0f6a44 | Python | 14,911 | 416 | # 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... |
8e68f00e8bcac3eef0e0314990da05c6c08c7d7e785ec3677e1e10761d91632e | Python | 14,914 | 365 |
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 1 09:53:28 2021
@author: Polina Timofeeva
This program:
1) Gets the wav files
2) Filters the sounds
3) Finds speech onset
4) Recognizes speech
5) Creates a .csv file with long format data for all participants for further analysis
Make ... |
9554ca56c39f94fc9336e952796a0630aaf7db3466359f206df761edb99df325 | Python | 14,919 | 392 | r"""Module providing encapsulation of Tangram for spatial deconvolution.
This module implements a wrapper for the Tangram algorithm, which enables mapping
between single-cell RNA sequencing data and spatial transcriptomics data. The main
functionality includes cell type deconvolution, spatial mapping, and gene express... |
27b1373a35c9b85c3c28ea9981cbe4d62df226ee5ed77c5b626c63e576ae3df5 | Python | 14,920 | 305 | #!/bin/env python
"""
Merge one or more STRipy VCFs into a single output VCF.
This script supports two common usages:
1. Append STRipy calls onto an existing GATK-SV VCF with ``--main-vcf``.
In this mode, the main VCF header and records are copied to the output first,
then STRipy records are appended. Only S... |
fdee7fbeb0249baa0add0223d57388ffc029b3f9731ed7ac96f6fb58500b93ba | Python | 14,920 | 452 | # 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, ... |
ddc1169c4b77cbeaafe422b08b330bdb812609567d5214b4801a640cd7e592fc | Python | 14,922 | 440 | #!/usr/bin/env python3
import argparse
import glob
import json
import logging
import os
import re
import shutil
import subprocess
from typing import Dict, List, Optional, Set, Tuple
import yaml
logger = logging.getLogger("ray_oss_analysis")
def _setup_logger(log_file: Optional[str] = None, enable_debug: bool = Fals... |
085930028c16ff8b9b3fd7b468a0035ee05cd1f588d7885af592812896b233d3 | Python | 14,928 | 452 | # -*- 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.
#... |
7af25137d49961e2a74dfbde1ed89273a60127c40946ad039e0ebf882a98a051 | Python | 14,938 | 425 | import logging
import os
import random
import sys
import threading
import time
import traceback
from datetime import datetime, timedelta
import pytest
import requests
import ray
from ray._common.test_utils import wait_for_condition
from ray._private.test_utils import (
format_web_url,
request_with_auth_token,... |
dc349ea6560cd828b893aad2d5d79adae0200ef52db87df89d32bcd3e228ea03 | Python | 14,946 | 464 | # -*- coding: utf-8 -*-
#
"""
utils.py
Helper functions for svtk.
"""
from collections import deque
import pysam
import pybedtools as pbt
NULL_GT = [(0, 0), (None, None), (0, ), (None, )]
def is_smaller_chrom(chrA, chrB):
"""
Test if chrA is naturally less than chrB
Returns True if chrA == chrB so co... |
bb69415c9ccad85832f08532c2b468777e54bd0d64dcb403d8e98aa065b3e210 | Python | 14,953 | 476 | from itertools import product
from typing import List, Literal, Optional
import numpy as np
import pandas as pd
import torch
from datamate import Namespace
import flyvis
from flyvis.utils import hex_utils
from flyvis.utils.hex_utils import Hexal, HexLattice
from .datasets import StimulusDataset
from .rendering.utils... |
6a639a72573482aa19a2dabb58a74f3b654630a937e6e4a0e62d0176642305c7 | Python | 14,955 | 335 | # Copyright 2023 Katherine Crowson and The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... |
130a99c58cfd23ed2b18e2768c9e97b860632c97924af7c056059a38c5d91103 | Python | 14,957 | 405 | import hashlib
import json
import logging
import os
import runpy
import shutil
import subprocess
import sys
from pathlib import Path
from typing import Any, Dict, List, Optional
import yaml
from filelock import FileLock
import ray
from ray._common.runtime_env_uri import parse_uri
from ray._common.utils import (
g... |
142aa2a93f1736ecbc8abefa3d8a4b84d23e1b0827a7839db29419f78900efe1 | Python | 14,961 | 393 | # -*- 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.
#... |
f2e89fb2d083cdd38456e6742c0ce9b618296ee585ec9ae5aa58044f3113b7ac | Python | 14,964 | 374 | import pickle
import pytest
import numpy as np
import quantities as qt
from copy import deepcopy
from mozaik.models import Model
from parameters import ParameterSet
from mozaik.sheets.vision import VisualCorticalUniformSheet3D
from mozaik.tools.distribution_parametrization import (
load_parameters,
PyNNDistribu... |
d544ea2615dce3452f6da653bffaaf374bf600161fa1724be92241aa2ebaef06 | Python | 14,965 | 352 | import logging
import numpy as np
from rdkit import Chem, DataStructs
from rdkit.Chem.AllChem import GetHashedMorganFingerprint, GetMorganFingerprintAsBitVect
from rdkit.Chem.Crippen import MolLogP, MolMR
from rdkit.Chem.Descriptors import TPSA, ExactMolWt
from rdkit.Chem.rdMolDescriptors import (
CalcNumA... |
3d2f52d1b12789b55f793ade47b96ca3fe400a72eb03d67cefa3ce4bc5a7a8e6 | Python | 14,967 | 387 | """Original implementation of piVAE.
https://github.com/zhd96/pi-vae/blob/3d31fae18bf9dda5290ac74435296b94eb05f854/code/pi_vae.py
tf.log has edited to tf.math.log.
"""
## This file implements all the code for pi-VAE model.
import tensorflow as tf
#print(tf.__version__)
from tensorflow.keras.models import Sequential
fr... |
7b461c1e7a1bc907ec3772588c8ac352f48f34bc41d8d9d2999a11917b812a5f | Python | 14,983 | 464 | # ------------------------------------------------
# Processing + plotting of specific cell datasets:
# Created: 04/04/21
# ------------------------------------------------
import glob
import h5py
import re
import gzip
import numpy as np
import pandas as pd
import time
import gc
import os
import sys
# For plotting:
im... |
dcbad014f08f7c86c40f78bc1164880ef1bb5298f14f81274f844a40405688ab | Python | 15,003 | 347 | from copy import Error
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import BatchNorm1d, Dropout
from torch_geometric.nn import GATv2Conv, Linear, SAGEConv, to_hetero
from torchmetrics import R2Score
from src.data import get_missing_links, get_singular_edge_indices
from sr... |
3e21669d1b9632bdc1f30086d78823bdf27684fb875bdc1a3283e5ad2f9fdc9a | Python | 15,006 | 381 | ####################################################################################################
# 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... |
76e7affb720560393bba2acd7cd6fd26db4d96fd1458a38090b60793789f25b9 | Python | 15,017 | 390 | import pandas as pd
import scanpy as sc
from scanpy import read
import os
from scipy.io import loadmat
from datetime import datetime
def _zebrahub(foldername="./", use_velocity:bool = False):
"""Load Zebrahub data as AnnData object (2Gb). Optioally load with velocity matrices (10Gb) by setting use_velocity = True... |
3418ba296be4a68ed876b08f216f61a7e3fe467fd2804620feee1bd723b55a66 | Python | 15,019 | 326 | # Ultralytics YOLO 🚀, GPL-3.0 license
import contextlib
import re
import shutil
import sys
from difflib import get_close_matches
from pathlib import Path
from types import SimpleNamespace
from typing import Dict, List, Union
from ultralytics.yolo.utils import (DEFAULT_CFG, DEFAULT_CFG_DICT, DEFAULT_CFG_PATH, LOGGER, ... |
e5980cd608792ce74b399d9369265554454457f87fbdbeff7cbf732350667e70 | Python | 15,028 | 400 | from __future__ import annotations
import logging
from itertools import repeat
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
from numba import jit
if TYPE_CHECKING:
from .genesig import GeneSignature
from .rnkdb import RankingDatabase
__all__ = [
"recovery",
"aucs",
"en... |
8ef47d9a9e9225fc5160f28967566d33009ffa656357902f35834ba65077c9d1 | Python | 15,030 | 438 | import numpy as np
import pandas as pd
import torch
from braindecode import EEGRegressor, EEGClassifier
from braindecode.models import ShallowFBCSPNet
from braindecode.models.modules import Expression
from braindecode.models.util import to_dense_prediction_model
from braindecode.util import set_random_seeds
from scip... |
d3b455287a09a1f882bc669f96af1ba939fd5f826da8272358d89f58c4f3e60e | Python | 15,035 | 403 | #
# 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... |
35c5e9df0893d7e9eb08d01ef2cbbe4cfaca96fb13e68115838c16343dc0f5d6 | Python | 15,036 | 457 | import os
from typing import List, Sequence
import pandas as pd
from tqdm.auto import tqdm
from data_profiling.config import Settings
from data_profiling.model import BaseDescription
from data_profiling.model.alerts import AlertType
from data_profiling.model.handler import get_render_map
from data_profiling.report.pr... |
e03ad3b823a4105df211baf7be308eed355047a8bf0d9cd2e06b614d725397e7 | Python | 15,051 | 398 | """IMPORTANT: this is an experimental interface and not currently stable."""
import json
import os
import tempfile
from contextlib import contextmanager
from typing import Any, Callable, Dict, Iterator, List, Optional, Union
from ray._private.label_utils import validate_label_selector
from ray.autoscaler._private imp... |
a844f46f815e03469f56a61bf9054dd80429048336eea5e6e8993b39d5f097d3 | Python | 15,055 | 356 | import requests
import os
import numpy as np
import pandas as pd
from .._registry import register_function
@register_function(
aliases=["GPT细胞类型注释", "gptcelltype", "ai_celltype", "GPT注释", "AI细胞注释"],
category="single",
description="AI-powered cell type annotation using GPT-4, Qwen, Kimi, and other large lan... |
f22626dae211ef5d239b09b573825435debf777f6003b64b10bea7ab95502df1 | Python | 15,056 | 334 | import argparse
import pickle
from collections import namedtuple
from typing import Dict, List, Any, Iterator
import numpy as np
import torch
import lib.data_utils.data_util as du
import lib.data_utils.dynamic_data_util as ddu
import lib.dataset_config_parser.dataset_config_parser as dcp
from denoise_inverse_alg.glm_... |
00a26150f6646f518fb98b8f68246d0bc91503f0ed53a67e83608bc43c96677f | Python | 15,063 | 408 | """Code in this file is heavily based on the code from the following repository: https://github.com/CompVis/invariances"""
import functools
import torch
import torch.nn as nn
from ldctinv.vae.blocks import ActNorm
class BasicFullyConnectedNet(nn.Module):
def __init__(self, dim, depth, hidden_dim=256, use_tanh=... |
a22990c4f195c22f7869e6a573259a9a441468dc1c26ed73fc13c91af0945438 | Python | 15,066 | 369 | import os
import sys
import tempfile
import time
from unittest.mock import AsyncMock, patch
import pytest
import ray
from ray._private import ray_constants
from ray.dashboard.modules.reporter.profile_manager import (
CpuProfilingManager,
MemoryProfilingManager,
)
from ray.dashboard.tests.conftest import * # ... |
bc90eabc788add508b8772918b1a52f3f3a60fda137137ef03cf278ef6cedbca | Python | 15,070 | 327 | import argparse
import itertools
import pickle
from collections import namedtuple
from typing import List, Callable, Sequence
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... |
c890b879a8e6bbcd0439ae1c51301ce3040ffda37d170af11fda3913c287d2bf | Python | 15,083 | 288 | from numpy import *
intro = "This subroutine evaluates the "
pgstr = ["potential ", "potential and its gradient ","potential, its gradient and its hessian"]
intro2 = "\n\n .. math::\n\n"
eq_start = "u(x) = "
eq_start2 = "\sum_{j=1}^{N} "
str1 = "c_{j} \\frac{1}{\|x-x_{j}\|}"
str2 = "v_{j} \cdot \\nabla \\left( \\fra... |
bbfbb1bf4a2d9f03a9d181c2571e51a5b020d8c46ecf49fdf0272b0393b180ce | Python | 15,093 | 319 | import torch
import os
import sys
from .model.model import MulanConfig, scMulanModel
from .model.model_kvcache import scMulanModel_kv
import torch.nn.functional as F
from .utils.hf_tokenizer import scMulanTokenizer
import scipy.sparse
import numpy as np
from tqdm import tqdm
from anndata import AnnData
from typing impo... |
0fb4d7c7436de8912355189c71f186d79e2f89e7b7869dd412bd14b460c76314 | Python | 15,096 | 406 | import numpy as np
import eelbrain
from pathlib import Path
from sklearn.linear_model import LinearRegression
class BoostingDataLoader():
""" Class to load data for boosting analysis.
This class is used to load EEG and speech data for boosting analysis. The EEG data is stored as numpy arrays in the
`eeg_... |
44df94f8335d4ce9d5dd74db1b34863e20aabc6e34aa51b45121f1f3d2320571 | Python | 15,097 | 497 | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 22 18:58:53 2024
@author: Leyang Xue
"""
import sys
import matplotlib.pyplot as plt
import numpy as np
from collections import Counter
import math
# Add package path
packagepath = '../kcorePercolation' # Manually specify the path to your script
sys.path.append(package... |
8cbab63ce36f76121de50d49aba6b48e70f670dbf82e6164303e6c106b811841 | Python | 15,103 | 404 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 27 14:46:44 2021
@author: irisstone
Miscellaneous helper functions for fitting and analyzing GLM/HMM code
"""
import numpy as np
import scipy.io as sio
def permute_states(M,method='self-transitions',param='transitions',order=None,ix=None):
... |
085a3f237287206b8859cfac28797d4f9fdcaec0bfabee39f3bd436047bd1c05 | Python | 15,105 | 421 | # -*- 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.
#... |
a5d5236e0ea579234cba918128de7703e5d085c1e95bde1a357da08fbc6737cb | Python | 15,106 | 478 | from functools import partial
import torch
import torch.nn.functional as F
from torch import nn
# Constants
scale_eval = False
alpha = 0.02
beta = 0.00002
resnet_n_blocks = 1
# Set normalization layer
norm_layer = partial(nn.InstanceNorm2d, affine=False, track_running_stats=False)
align_corners = False
up_sample_mod... |
4ed2a1fb9ea036ea9f5e79b9013cf15766a8bba23a11c3c5adff8d89ab1cd176 | Python | 15,109 | 431 | import os
import torch
import numpy as np
import yaml
from pathlib import Path
from skimage import measure
from typing import Optional, List
from monai.config.type_definitions import NdarrayOrTensor, NdarrayTensor
from monai.utils import optional_import
from monai.utils.type_conversion import convert_data_type, convert... |
3d9d22bd311541fe7c0ad7ee173e9b128ad37d5adf551a3424b3319f50e3d198 | Python | 15,110 | 344 | #!/usr/bin/env python
# coding: utf-8
# author: Maruthi Mutnuri (maruthi2008@gmail.com)
# loading libraries
import pandas as pd
import numpy as np
import random
from sklearn.model_selection import PredefinedSplit, GridSearchCV, train_test_split
from sklearn.linear_model import LogisticRegression, Lasso
from imblear... |
be0fe1553784969e6576a2b56e9c8d2ac6379c37833cd21f936529d46ece2b0a | Python | 15,112 | 488 | import os
from typing import Dict, Sequence
from urllib.parse import urlparse
import numpy as np
import pandas as pd
import pytest
from visions.test.utils import (
contains,
convert,
get_contains_cases,
get_convert_cases,
get_inference_cases,
infers,
)
from data_profiling.confi... |
005ae51cea5cf6529ea54b2f1c193901405ad7c59be8f5c411366907a2ceb924 | Python | 15,116 | 421 | # built-in dependencies
import os
import json
import hashlib
import struct
from typing import Any, Dict, Optional, List, Union, cast
# 3rd party dependencies
import numpy as np
# project dependencies
from deepface.modules.database.types import Database
from deepface.modules.exceptions import DuplicateEntryError
from ... |
2842eff3d7e6d82f7efddecbee75045f703c36c4af439dbe4dbc03850c11b8ba | Python | 15,117 | 359 | # 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... |
deb2d186bc68cbc58f4748630bc72730c1181f73e27dadb887ca772303fb8e82 | Python | 15,117 | 326 | import os
import h5py
import numpy as np
import torch
from skimage import measure
from pytorch3dunet.datasets.hdf5 import AbstractHDF5Dataset
from pytorch3dunet.datasets.utils import SliceBuilder
from pytorch3dunet.unet3d.utils import get_logger
from pytorch3dunet.unet3d.utils import remove_halo
logger = get_logger(... |
073628260028103d80bf3f6c0bc1844748e89193e17117784d73fd1e27b4ae86 | Python | 15,122 | 425 | from __future__ import annotations
import asyncio
from dataclasses import replace
import logging
import time
from typing import Any, Awaitable, Callable, List, Optional, Protocol
from ..agent_bridge import AgentRunResult
from .._bridge_session import resolve_bridge_session_id
from ..channel_media import build_channel... |
91e03c372161ad6dc28e58969824fdcb56324d378468719846bae42d9cbe2aec | Python | 15,123 | 402 | # 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, ... |
0b4c597cfb40d362be14a4d299f357e449fad3ead05ecef6be63abc43b48bf03 | Python | 15,127 | 351 | import math
from sklearn import metrics
from sklearn import preprocessing
import numpy as np
import pandas as pd
import re
import time
import datetime
import random
random.seed(1234)
from scipy import interp
import warnings
warnings.filterwarnings("ignore")
from collections import Counter
from collections import Order... |
2ce3d64242032b6d4586e80874bf9205f2f6db90219b190f88f04af5f7b0d1e7 | Python | 15,127 | 452 | """
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.
"""
"""
A python script to run a validation of the ML NEB model on a set of NEB calculations.
This script has not been written to run in parall... |
8ae830ee205bc87d6fb2b3029e698889fc61c414ddc8594a4c6df6974df27a34 | Python | 15,133 | 418 | """GWAS Catalog data collector."""
import logging
from typing import Any, Dict, List, Optional
from src.api.gwas_catalog import GWASCatalogClient
from src.models.genomic import Gene, Variant
from src.models.disease import Disease
from .base import BaseCollector
from config.config import settings
logger = logging.ge... |
ef0321a7092432b27d7ddcab8a49ffc9f561e18eccdd17f2460817e3051b4d1e | Python | 15,137 | 337 | import streamlit as st
import pandas as pd
from PIL import Image
import subprocess
import os
import base64
import pickle
from streamlit_option_menu import option_menu
# Set page configuration
st.set_page_config(page_title='ASHS-Pred', page_icon='🌐', layout="wide")
# Create title and subtitle
html_temp =... |
0ad02e2f35639410c5655c7f1eac64d96247104e52c1b41fe0a09a8afa87b9cd | Python | 15,139 | 346 | from torch.utils.data import Dataset, DataLoader
import torchvision.transforms as transforms
import random
import numpy as np
from PIL import Image
import json
import os
import torch
from torchnet.meter import AUCMeter
from autoaugment import CIFAR10Policy
from Asymmetric_Noise import *
def unpickle(file):
import... |
9a8802623a4cf0d3c883fbba86e3a829d4e6cefcb37e23472e266d3ca7306abd | Python | 15,149 | 351 | # -*- coding: utf-8 -*-
####################################################################################################
# Copyright (c) 2020 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis... |
22f95e7fa20173e3b866b748cebc886aedd22aeccd9f4195200cd2535b13c1c2 | Python | 15,157 | 372 | """
Triangle-quality improvement of a surface mesh, keeping its topology and
shape.
- flip_edges: flips interior edges where that raises the smallest angle of
the two adjoining triangles, if the quad they form is nearly flat (so the
surface hardly changes). This removes caps (triangles with an angle near
180 deg... |
0150968403ec2ff31f735f8cbc018d0ce5588d6e7492457c774e4a876a24805e | Python | 15,161 | 399 | # -*- 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.
#... |
06b6b186a6907c9e35e5df140a961291ddd53c09bdb66330b6a8a0b11c914793 | Python | 15,162 | 391 | # Motif code
import numpy as np
import pandas as pd
from .weights import import_W_signed
from numpy.linalg import matrix_power as mp
from copy import deepcopy
def motif_mats_basic(W):
N = W.shape[0]
u = np.ones(N) / np.sqrt(N)
ui = np.ones(N) / N
H = np.outer(u,u)
Th = np.identity(N) - H
retu... |
42515ea96c1fd0a741543368c8f30fb427ec5c2eaa412e4c10b05e9a153bde46 | Python | 15,162 | 354 | # --------------------------------------------------------
# Swin Transformer
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ze Liu
# --------------------------------------------------------
import os
import time
import json
import random
import argparse
import d... |
8a9000524e7c62d581da50f86e10e33802dbec6e4caacce989964150e94556e0 | Python | 15,186 | 509 | import logging
import multiprocessing
import os
import re
import signal
import socket
import subprocess
import sys
import warnings
from abc import ABC, abstractmethod
from time import sleep
from typing import Dict, List
from flyvis import results_dir
logging.basicConfig(
format="[%(asctime)s] [%(filename)s:%(line... |
a3ebf3e381cdb004539f7946984b1ab51c57c072e46ce9b9288b012025d2036c | Python | 15,199 | 416 | # 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... |
8df19d55b656f0376e6f7b1b67ff424071b3797a33204ce8929134f14f179547 | Python | 15,206 | 314 | import argparse
import json
import logging
import os
import sys
import numpy as np
import pandas as pd
import tensorflow as tf
from data_descriptions.echo import LmdbEchoStudyVideoDataDescription
from echo_defines import category_dictionaries
from model_descriptions.echo import DDGenerator, create_movinet_classifier,... |
e17b79f2d6c5045550e9733ad5dbb72a12fb8606232a0b1e446aa60e72b9b811 | Python | 15,206 | 268 | import matplotlib.pyplot as plt
import pickle
import numpy as np
import os
from util import *
from sklearn.metrics import accuracy_score, confusion_matrix, roc_auc_score, roc_curve, precision_recall_curve, PrecisionRecallDisplay
from scipy.stats import norm
from scipy.stats import gaussian_kde
def plot_scatter_plot(l... |
7b98aeb6559850ccdbe59d993c40a965d1b48da988d47f435615141560f9fd98 | Python | 15,216 | 374 | #Convert NEON field sample points into bounding boxes of cropped image data for model training
import glob
import geopandas as gpd
import rasterio
import numpy as np
import shapely
import os
import pandas as pd
from src.neon_paths import find_sensor_path, lookup_and_convert, bounds_to_geoindex
from src import patches
f... |
4983a6d58360fc2a2d28caeb601711592bbe8128a59131ba50a23775b9edc155 | Python | 15,220 | 318 | 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... |
cedb792d9a74342d248ec5f6d23e61be4882e031f4800d835f0df55b49ba0602 | Python | 15,220 | 456 | """
Production API for OmicVerse DataStateInspector.
This module provides convenient factory functions and integration helpers
for using the DataStateInspector in production workflows.
"""
from typing import Optional, Dict, Any, Callable
from functools import wraps
from anndata import AnnData
import warnings
from .i... |
b7673bc7809d616ddfee2e1edc47a07fa2621bc94e475f697ac951aed1a4d1c6 | Python | 15,227 | 380 | """ Subclasses of the tensorflow.keras.Model class.
These objects should be hidden from the user
"""
import os
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
import tensorflow as tf
import logging
tf.get_logger().setLevel(logging.ERROR)
from apnet.layers import DistanceLayer, FeedForwardLayer
#################
max... |
2f98e6edf9b0ea5f1fb9dd6ef879ae21f22f5418235d55d0f28a098cea02f921 | Python | 15,229 | 409 | # Copyright (c) DP Technology.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Optional
import torch
from torch import Tensor, nn
import torch.nn.functional as F
def softmax_dropout(input, dropout_prob, is_training=True, m... |
7d63b1a808e55bc270b4ac1832ac81e9aa8698db6b7f0860a693a984180a5efb | Python | 15,229 | 447 | # coding: utf-8
import os
import sys
from queue import Queue
from unittest import mock
import pytest
from ray._common.test_utils import wait_for_condition
from ray._common.utils import binary_to_hex, hex_to_binary
from ray.autoscaler._private.prom_metrics import AutoscalerPrometheusMetrics
from ray.autoscaler.v2.inst... |
4a1866a7e274121cdd9f649d065cd10a949cf306967c40b41add4cf7f15b44aa | Python | 15,232 | 484 | import os
import math
import argparse
import numpy as np
from scipy.ndimage import binary_fill_holes
from tqdm.auto import tqdm
import pydicom as dicom
import matplotlib.pylab as plt
from matplotlib.colors import ListedColormap
import torch
from utils import load_xcf
def project_points(points, theta):
norm_... |
9481472fda425db68e0f72debb4e1becf8eec3037f2d70e2171ee9f9f912eebf | Python | 15,236 | 405 | import copy
from typing import Dict, List
from abc import abstractmethod
from warnings import warn
import torch
import sinabs
from sinabs.backend.dynapcnn.config_builder import ConfigBuilder
from sinabs.backend.dynapcnn.dvs_layer import DVSLayer
from sinabs.backend.dynapcnn.dynapcnn_layer import DynapcnnLayer
from si... |
e5f584b2a6b116077ecfe3138fae88b1a1c562dcbb3f111f0e756db2db3b1adf | Python | 15,241 | 450 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 12 09:05:00 2022
Building off off evaluate_partA_bypixel, this compares moethods to FIT_NLLS
on a pixelwise basis
This does not make it intot he paper
@author: pbolan
"""
import numpy as np
from os import path, makedirs
import sys
import glob
imp... |
7483007c1df99f9c4bd20021cb9aa804018375baffdcb9b211d8569c652a7c4d | Python | 15,245 | 363 | """
Code taken from ---
Supervised Contrastive Learning: https://arxiv.org/pdf/2004.11362.pdf.
It also supports the unsupervised contrastive loss in SimCLR
"""
from __future__ import print_function
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
@torch.no_grad()
def init_prototyp... |
7e530f956ca54840dcf0b670d1f7843ecea3b0e47f4d72ba81dcd12496ca97fd | Python | 15,248 | 474 | import cv2
import os
import numpy as np
import torch
os.environ['CUDA_LAUNCH_BLOCKING'] = '1'
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 19 11:08:19 2023
@author: Administrator
"""
from sklearn.metrics import accuracy_score
from sklearn.metrics import precision_score
from sklearn.metrics import recall_score ... |
3380de6eefbb6b0f5a0e0efa7050dbd534795b159fdb8f3ca98bd43d66946c28 | Python | 15,251 | 382 | '''
Copyright 2023 Tashreque Mohammed Haq
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 ... |
546bf78dc5b9c981994f4f109e05824e4974669f900e6b3b4c6012c0048ede6d | Python | 15,258 | 409 | """Methods for integration of DICOM plots within notebooks."""
import collections
import os
import tempfile
from typing import Dict, List, Optional, Tuple, Union
import zipfile
from IPython.display import display
from IPython.display import HTML
import numpy as np
import ipywidgets as widgets
import matplotlib.pyplot... |
0e4b67fbfb2d733929f2167c90b50817a2b22c16ed11fe4eb6f130ce9f5550b5 | Python | 15,266 | 326 | r"""Advanced genome editing — prime editing, CRISPRi/a, and Cas13.
Beyond cut-and-repair (:mod:`_crispr`), this module covers the modern editing
modalities:
* :func:`prime_editing_design` — design a **pegRNA** (spacer + reverse-
transcriptase template + primer-binding site) and the PE3 nicking guide for a
desired... |
3f43ca2a11dce2b0005b05678b765c05dd104cc078603257a10cb7b851a17713 | Python | 15,270 | 523 | """cBioPortal API client for cancer genomics data."""
import logging
from typing import Any, Dict, List, Optional, Union
from .base import BaseAPIClient
from ..config import settings
logger = logging.getLogger(__name__)
class cBioPortalClient(BaseAPIClient):
"""Client for cBioPortal REST API.
cBioPort... |
417e2824e520ff842c561e5593116973944ca69a377f9b3a1abf19cf2c0458db | Python | 15,271 | 404 | #!/usr/bin/env python3
"""
Stripy Custom Loci BED Format Validator
Validates TSV files for use with Stripy's custom loci feature.
Provides detailed error messages for format violations.
"""
import argparse
import csv
import sys
from pathlib import Path
from typing import List, Optional
class ValidationError:
""... |
f64ad171c47f420992ce936e2536ef725354b4673e22c3a8b4add633a25be0fb | Python | 15,271 | 463 | """
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 contextlib
import dataclasses
import logging
import threading
from dataclasses import dataclass
... |
07a4c83ad45661665d6210d45e13429fe31554ba81c453c3fbdd9aba8c091b61 | Python | 15,272 | 523 | """cBioPortal API client for cancer genomics data."""
import logging
from typing import Any, Dict, List, Optional, Union
from ..base import BaseAPIClient
from ...config import settings
logger = logging.getLogger(__name__)
class cBioPortalClient(BaseAPIClient):
"""Client for cBioPortal REST API.
cBioPo... |
5f4215be114e92120d61c9023295637820f757fe3160e8b4009cc00d0dc1eb4e | Python | 15,278 | 389 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# Created By : Kangjoo Lee (kangjoo.lee@yale.edu)
# Last Updated: 08/06/2024
# -------------------------------------------------------------------------
# =========================================... |
34070f3b7b94a41a7aaa952e4ded8d0926283434363f9d381c256abc520b5338 | Python | 15,282 | 370 | import torch
import random
from sklearn.metrics import accuracy_score, roc_auc_score, confusion_matrix, auc, precision_recall_curve, precision_score
import matplotlib.pyplot as plt
from torch.utils.data import DataLoader, Dataset
import calibration as cal
import logging
import yaml
import os
import pandas as pd
import ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.