sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b7c66d923976e22a9ad940f482519a82f6e9153f783ec75238fc0259e6326190 | Python | 10,085 | 244 | r"""Retrobiosynthesis — enzymatic reaction-rule retrosynthesis over a target
molecule.
Where :func:`~omicverse.synbio._retro.pathway_search` searches for routes to a
metabolite *within a genome-scale model* (native reactions only), this module
proposes **novel enzymatic steps** by applying reaction rules — the RetroRu... |
b85aa1919d36a91f96c5ae33b082867b3b42e3ae02cc97a6cd63609e90973656 | Python | 10,086 | 276 | import scanpy as sc
from anndata import read_h5ad
import pandas as pd
import numpy as np
import scipy as sp
import os
import time
import argparse
from statsmodels.stats.multitest import multipletests
import scdrs
"""
# Fixit
# Todo
- Implement scdrs.method.proprocess to incorporate sparse_reg_out and sparse_compute_... |
ac1596f5d3dd103956c61274651b301fdb3d91dc1ed97277acead61aeb08762f | Python | 10,087 | 258 | """AlphaFold data collector."""
import logging
from typing import Any, Dict, List, Optional
from datetime import datetime
from src.api.alphafold import AlphaFoldClient
from src.models.structure import Structure, Chain
from src.models.protein import Protein
from .base import BaseCollector
from config import settings
... |
3eff0a0a3807176ffe35baa71926d0535eb7a979da1824ecc7f1631f1f48d8dc | Python | 10,090 | 188 | """Fixed and adaptive Gabor banks from the uploaded MATLAB implementation."""
import logging
import math
import numpy as np
import torch
from .ops import myconv2, ridge_orientation
from .preprocessing import preprocess_batch, iter_preprocessed_batches
LOG = logging.getLogger(__name__)
def _optimized(config, device):... |
4fcececc821e77557f9468b2517e2916f422225b2a55766ef398da02ea073918 | Python | 10,094 | 329 | # 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... |
267b834ee5ca192f5b286f7f41aab30707f2565f3535830cce3696adbc2ef4e9 | Python | 10,098 | 307 | """
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 json
import numpy as np
import pylab as plt
from matplotlib import cm
from matplotlib.colors imp... |
e73bd413b356a38797d3721bbe23e07d5b3f9b243af50a1a6c9ea5c985654b58 | Python | 10,099 | 270 | """
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.
Conformer-fragment energy corrections for ML-relaxed molecular crystals.
For each row we extract the ``z`` molecules from ``cif_relaxed``, run... |
2021fe1ba83c1364d952950f42e9e915199377a3c8ef5f146908a0e02ccaafd4 | Python | 10,100 | 261 | import logging
import os
from pathlib import Path
from types import ModuleType
from typing import Any, Dict, List, Optional
from ray._common.runtime_env_package import PY_MODULES, validate_package_extension
from ray._common.runtime_env_uri import Protocol, parse_uri
from ray._common.utils import try_to_create_director... |
e8ef426460915a8e55fb1384b7188d35bf080c8872eb990297d82a4c04b59d19 | Python | 10,102 | 237 | import tempfile
import torch
from diffusers import (
DEISMultistepScheduler,
DPMSolverMultistepScheduler,
DPMSolverSinglestepScheduler,
UniPCMultistepScheduler,
)
from .test_schedulers import SchedulerCommonTest
class DEISMultistepSchedulerTest(SchedulerCommonTest):
scheduler_classes = (DEISMul... |
460fd2c50f870a4bfce46e461d8eb7b428fe6e028a6d83e2c29ea88a76328700 | Python | 10,106 | 264 | """MCAP (Message Capture) datasource for Ray Data.
MCAP is a standardized format for storing timestamped messages from robotics and
autonomous systems, commonly used for sensor data, control commands, and other
time-series data.
"""
import json
import logging
from dataclasses import dataclass
from typing import TYPE_... |
a2a5bb11484fdb4b15867b298c02f35904641859554eb82633c9b75c463b4fa0 | Python | 10,107 | 362 | """
Shared harness contracts for OVAgent runtime, tracing, and web streaming.
"""
from __future__ import annotations
import hashlib
import time
import uuid
from dataclasses import asdict, dataclass, field
from typing import Any, Literal, Optional
HARNESS_EVENT_TYPES = (
"llm_chunk",
"tool_call",
"code",... |
92b951114c58f05c2a54d379d162fd4e4da866c943d699c67643ec8d189ac290 | Python | 10,109 | 244 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from typing import List, Callable, Union
class MM_FBOnly_PreappliedSpatialSingleCellGLMLoss(nn.Module):
def __init__(self,
timecourse_filter: Union[torch.Tensor, np.ndarray],
feedback_filter: ... |
2362f069c4d1ef4bcd0d005bc64cb4ef0acccdb4a323f2b083e01d50cb59ba7c | Python | 10,112 | 284 | # 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... |
9c7241c9d7d4cc30137a838515c70c6cabdd1560d8a2d11be03d7b9957a56614 | Python | 10,113 | 223 | 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.hqs_... |
6d6218a73e2cb73eb251a496d5d3a80976acee9036cd3fea942eb4a68477aa29 | Python | 10,114 | 321 | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 18 14:36:56 2021
@author: Sheng He
@email: heshengxgd@gmail.com
"""
import torch
import torch.nn as nn
import copy
import math
import vgg as vnet
import resnet as rnet
import numpy as np
class GlobalAttention(nn.Module):
def __init__(self,
trans... |
c5af1929fd1537b87851ccedc7c4eb7d97c24437d3a47ea1aa8c6c92ff7d268f | Python | 10,114 | 237 | import numpy as np
import pandas as pd
from random import choices
from random import sample
from itertools import combinations
from scipy import stats
import itertools
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
import sys
import os
import glob
from attn_weights import *
fro... |
f9ae6e6e5eb4e1295aa8c12b4336a7cb2d1bc5444114e20254a47a035e80199d | Python | 10,125 | 322 | # -*- 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
# pylint: disable=too-many-lines
"""Inference related parameters for resistive processing units."""
from datacla... |
ebc4c033d56cc1944457c441f4c469e51e574f9103313a1c946b47989200b251 | Python | 10,127 | 230 | import nipype.interfaces.utility as util
import nipype.interfaces.ants as ants
import os
from nipype.interfaces.fsl import ApplyMask, GLM, MELODIC, FAST, BET, MeanImage, FLIRT, ImageMaths, FSLCommand
from nipype.interfaces import ants, fsl
import nipype.pipeline.engine as pe
from samri.utilities import bids_substituti... |
df612cacce3befd86bbb06056be7819cada605a9786c9936ad857a308f35712c | Python | 10,129 | 275 | r"""STFlow backend — whole-slide flow matching (ICML 2025 Spotlight).
STFlow's upstream codebase ships only training scripts; the authors have
since productionised it as STPath with public zero-shot weights. This
wrapper therefore implements the canonical "fit-on-your-reference,
predict-on-your-query" workflow: a flow... |
156f1f229153f72da20829e3bd87df39dab74faf5cc8747e2f7727f32806e127 | Python | 10,138 | 299 | """
Wrapper library for using the crane tool for managing container images.
https://github.com/google/go-containerregistry/blob/v0.19.0/cmd/crane/doc/crane.md
Functions raise CraneError on failure.
"""
import os
import platform
import subprocess
import tarfile
import tempfile
from typing import List, Optional
import... |
74bd39733a230cb1fa151deebc517540a60a862b1bdd27799929dfdaf11236af | Python | 10,140 | 308 | ####################################################################################################
# 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... |
a73f81af448d76fd3ccc84666c5a168f3a02b899f3deb1ff6801ab9d86c3cd5f | Python | 10,149 | 311 | """
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.
Shared helpers for the UMA Nitro tests.
"""
from __future__ import annotations
import copy
import os
import hydra
import pytest
import torch... |
cedd1bfdd44171c8dabdd041344f8548f098248d4e7b38a9d930b90275a4b367 | Python | 10,151 | 292 | import numpy as np
import sys, os
import tskit, msprime
# recapitation
def recap(fp, op, generation_time, seed=123):
# load
ts = tskit.load(fp)
alive_inds = []
for i in ts.individuals():
alive_inds.append(i.id)
#
N = len(alive_inds)
# simplify to get rid of extraneous populations... |
0e1ece5d4da403225315c8668bee38f20b790181dd48e08f0166c72f761d0d41 | Python | 10,152 | 274 | import argparse
import glob
import io
import logging
import os
import tarfile
import av
import cv2
import lmdb
import numpy as np
import pandas as pd
import pydicom
import skimage.measure
import skimage.morphology
def get_largest_connected_area(segmentation):
labels = skimage.measure.label(segmentation)
asse... |
519904e723f74f32bdd5855ec908dfb0a38aba63b1b908e4b59816f674a3cea7 | Python | 10,152 | 271 | from typing import Callable, List, Optional, Type, Union
import torch
import torch.nn as nn
from torch import Tensor
from torchvision.utils import _log_api_usage_once
"""
This is a modified version of torchvision's code for instantiating resnets. Here's a list of the changes made to the
source code:
- All conv... |
94cc6eaa434107ba3d4efbd216f19da99cc37e2579073f79caf8c466f48092e5 | Python | 10,155 | 221 | # Ultralytics YOLO 🚀, GPL-3.0 license
from copy import copy
import numpy as np
import torch
import torch.nn as nn
from ultralytics.nn.tasks import DetectionModel
from ultralytics.yolo import v8
from ultralytics.yolo.data import build_dataloader
from ultralytics.yolo.data.dataloaders.v5loader import create_dataloader... |
f168c402b494e9b87f78d69ab3001981de38342dbcb4f6c68180b5e01960f399 | Python | 10,156 | 225 | import torch
from torch.utils.tensorboard import SummaryWriter
import torch.nn as nn
import numpy as np
import argparse
import pickle
import os
from lib.data_utils.matched_cells_struct import OrderedMatchedCellsStruct
import lib.dataset_config_parser.dataset_config_parser as dcp
from lib.dataset_config_parser.datase... |
b6fd1976a82aab91589f662d0b427ba8370e0f219bbc0504b400b3427eea2b95 | Python | 10,158 | 252 | import tensorflow as tf
gpus = tf.config.list_physical_devices('GPU')
if gpus:
try:
# Currently, memory growth needs to be the same across GPUs
for gpu in gpus:
tf.config.experimental.set_memory_growth(gpu, True)
logical_gpus = tf.config.list_logical_devices('GPU')
print(len(gpus), "Physical GPU... |
2369c1212cbff51d30bd014055442015ffa31ee4ae86e2f0eae55bf17e8263ee | Python | 10,160 | 323 | #!/usr/bin/env python
from ctypes import *
from ctypes.util import find_library
from os import path
import sys
__all__ = ['liblinear', 'feature_node', 'gen_feature_nodearray', 'problem',
'parameter', 'model', 'toPyModel', 'L2R_LR', 'L2R_L2LOSS_SVC_DUAL',
'L2R_L2LOSS_SVC', 'L2R_L1LOSS_SVC_DUAL', ... |
9269a780fd5b249df658ff6c8b9ec98287726730770a9f68573c0f5c023fe025 | Python | 10,160 | 260 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 24 18:39:45 2016
@author: Andrea Giovannucci
For explanation consult at https://github.com/agiovann/Constrained_NMF/releases/download/v0.4-alpha/Patch_demo.zip
and https://github.com/agiovann/Constrained_NMF
"""
from __future__ import print_functi... |
178de98821333f8706824b40e24abb8735fa6734f90cbdbeeae583af0089ea69 | Python | 10,161 | 311 | #!/usr/bin/env python
import sys, os, select
import socket
import random
import string
import copy
import time
from datetime import datetime
import numpy as np
import argparse
import time
import matplotlib.pyplot as plt
from itertools import product
def run(args, params, paramstr) :
# File structure: resultsdir/p... |
ee904b78736987391fff25311ae81e554fe0e347bf0f6c41cef4372d9d0aa8a0 | Python | 10,163 | 325 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Analog cells for RNNs."""
from typing import Optional, Tuple, Type
from collections import namedtuple
from torch import Tensor, sigmoid, tanh, zeros, cat
fr... |
43282f7c799cca84af4314abf8d6410b64ac50e37198ceb4d84a651a397c16c2 | Python | 10,167 | 283 | # coding: utf-8
import importlib
import os
import sys
import tempfile
import pytest # noqa
from ray._common.utils import binary_to_hex
from ray._private.test_utils import get_test_config_path
from ray.autoscaler import AUTOSCALER_DIR_PATH
from ray.autoscaler._private.util import format_readonly_node_type
from ray.au... |
1535d42e6398ee634262bf6b87ece5425984fac1750e40fccac92ec8b5fdb69e | Python | 10,180 | 296 | # -*- 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-locals, too-many-branches
"""Fitting utilities.
This module includes fitting utilities for ``aihwkit``.
Using this module has extra ... |
0203a5c0459823ff9b68e1ab24fe69dfa187a75d9b042830a4bc3e850d94b033 | Python | 10,181 | 274 | import torch
from torch.nn import Module, BatchNorm1d, LeakyReLU, Conv1d, ModuleList, Softmax, Sigmoid, Flatten, Dropout2d, Linear
from torch.optim.lr_scheduler import LambdaLR
from torch.optim import Optimizer
from torch.utils.data import Dataset, DataLoader
import argparse
import math
import random
import numpy as n... |
1cd68fb1d475538a6d531c13603b18a8db85d1f067f46aeb9362f9e08a6b93ec | Python | 10,182 | 263 | import argparse
import logging
import os
import scipy.io as sio
import numpy as np
import torch
import torch.nn.functional as F
from PIL import Image
from torchvision import transforms
import torch.nn as nn
from models.FCN import FCNs,VGGNet
from models.UNet_5 import UNet
from models.UNet_3 import UNet_3
from models.se... |
9be14fe3a11c3ed16d94ef6d4fee5b2126aab173d8aa0c13dd462bf56676b646 | Python | 10,184 | 268 | # -*- coding: utf-8 -*-
"""
Vendored MEBOCOST -- metabolite-mediated cell-cell communication inference.
Vendored from https://github.com/kaifuchenlab/MEBOCOST (Zheng et al., 2022,
"MEBOCOST: Metabolite-mediated Cell Communication Modeling by Single Cell
Transcriptome"). Vendored at commit 3e0be6f638b71c0f5bd08cef8b144... |
7e7eb72519e3fb2b822d82831394eba0f4f34903fd883b7b5a6aaecaed9d13ac | Python | 10,189 | 316 | from abc import abstractmethod
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
from data_assimilation.model_error import BaseModelError
from data_assimilat... |
5bf2c64214df941c76b3598241719bba286c8150b8baa2995bacb481da1457aa | Python | 10,193 | 225 |
import numpy
import json
import os
from matplotlib import pyplot
from scipy.spatial import distance
from .user import select
from .prefnet import PrefNet
from .pareto import find_dominating
OBJ_NAMES = {
"FWHM (nm)" : "Resolution",
"Signal Ratio" : "SNR",
"Bleach" : "Bleach",
"Squirrel" : "Squirrel"... |
5f33a7d5a5cf0592f35ec04c80574f2837cf61b4f5a3c26cc3cf793a980bf1b8 | Python | 10,195 | 314 | # -*- coding: utf-8 -*-
#
# lime documentation build configuration file, created by
# sphinx-quickstart on Fri Mar 18 16:20:40 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... |
d359599d8fb1107364e8b518ff435826c42053bf2dd0d997d2c4dabe6fc4f4d4 | Python | 10,196 | 242 | import pandas as pd
import numpy as np
import anndata as ad
def atac_concat_get_index(adata1,adata2):
import gc
# 数据预处理
adata1.var.loc[:,'ATAC'] = adata1.var.index
adata1.var = pd.DataFrame((x.split('_') for x in adata1.var['ATAC']) , index = adata1.var.index , columns = ['chr','chromStart','chrom... |
68d98bf59081801178c2c51198d04b22d99b473cf78b0c60a6404fef512ffd65 | Python | 10,201 | 227 | from typing import Any, Callable, Dict, List, Optional, Union
import PIL.Image
import torch
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer
from diffusers import (
AutoencoderKL,
DDIMScheduler,
DiffusionPipeline,
LMSDiscreteScheduler,
PNDMScheduler,
StableDiffusionImg... |
ce4e71903106cfe43550aa042b994bc22123df34115c0f8292e62b45107efa6a | Python | 10,204 | 287 | import os
import warnings
warnings.filterwarnings("ignore")
import scanpy as sc
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import numpy as np
import pickle
import os
import argparse
import logging
import time
from tqdm.auto import tqdm
import matplotlib.pyplot as ... |
fc9f890e42c198189d28bcde9d5a0ec3d3d0a4348ad2ddb6581a0201708831ac | Python | 10,204 | 264 | import numpy as np
import pandas as pd
from plotnine import *
import glob
import yaml
import pickle
import os
font_size = 8
font_family = "Helvetica"
ANNO_COLOR_INDV_LIST = ['#3182bd', '#6baed6',
'#b2723f', '#df880f', '#8B4513', '#CD853F', '#D2691E', '#DEB887',
'#99CC... |
af18ccd40b6dcb1308ee8e03640f34342bcf75b307a69c95551423ad1991920e | Python | 10,205 | 357 | """Guide to PHARMACOLOGY database API client."""
import logging
from typing import Any, Dict, List, Optional
from .base import BaseAPIClient
from ..config import settings
logger = logging.getLogger(__name__)
class GtoPdbClient(BaseAPIClient):
"""Client for Guide to PHARMACOLOGY (GtoPdb) API.
The IUPH... |
d2829674e59c30f1634305e6fc99b9c22ce6fe06399339b39d57428088133683 | Python | 10,207 | 322 | """
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 json
import os
import signal
import subprocess
import sys
import tempfile
import... |
f0ac075d8c14ab3f86cdf565fd69a499c0fb5151cb20d8247b1ee47f6a506dab | Python | 10,207 | 357 | """Guide to PHARMACOLOGY database API client."""
import logging
from typing import Any, Dict, List, Optional
from ..base import BaseAPIClient
from ...config import settings
logger = logging.getLogger(__name__)
class GtoPdbClient(BaseAPIClient):
"""Client for Guide to PHARMACOLOGY (GtoPdb) API.
The IU... |
5e42f674cd2c50263507162d0ed510e80b24b55871cefea20e4279acae0d7635 | Python | 10,209 | 263 | """
Grouped configuration dataclasses for OmicVerse Agent (P0-2).
Replaces the 15-parameter ``OmicVerseAgent.__init__`` with four focused
config objects. ``AgentConfig.from_flat_kwargs`` preserves full backward
compatibility with the original constructor signature.
"""
from __future__ import annotations
import copy... |
65e7afc3ff8a603cc78ff84644e69acaf6734e90262207fbbc76bb6321dd7ae4 | Python | 10,210 | 275 | # 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)... |
b4b1e001131291dc2f32646d9a6c4047f54684337720c84631228aedfb9e88b9 | Python | 10,211 | 322 | # -*- 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.
#... |
04aa39f6651ab6a2f2e1ad657b36922115d310ef896c47e2026e642a50d03ae9 | Python | 10,212 | 333 | """An example of training PPO against OpenAI Gym Atari Envs.
This script is an example of training a PPO agent on Atari envs.
To train PPO for 10M timesteps on Breakout, run:
python train_ppo_ale.py
To train PPO using a recurrent model on a flickering Atari env, run:
python train_ppo_ale.py --recurrent --fli... |
9f6c688c9baa64d740e268a1d28cdb639d060136d87409d5a6377c333f880319 | Python | 10,215 | 222 | import pathlib
path = pathlib.Path.cwd()
if path.stem == 'tmb_survival':
cwd = path
else:
cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')]
import sys
sys.path.append(str(cwd))
import numpy as np
from lifelines import CoxPHFitter
import pandas as pd
import pickle
from model import utils
from matp... |
04c5bc4345be90d4d628a7b9b7eff67d9348cc8c3eca6c030df56358c20d25f6 | Python | 10,216 | 370 | from attr import dataclass
import ray
from data_assimilation.numpy.PDE_models import PipeflowEquations
import numpy as np
import matplotlib.pyplot as plt
import pdb
from matplotlib.animation import FuncAnimation
from data_assimilation.numpy.particle_filter import ParticleFilter
from data_assimilation.numpy.test_cases.p... |
93fe954a6511518918360944a6bd792d234bf99e4a08ef6649c65d68706ec330 | Python | 10,217 | 274 | import torch
from torch.nn import Module, BatchNorm1d, LeakyReLU, Conv1d, ModuleList, Softmax, Sigmoid, Flatten, Dropout2d, Linear
from torch.optim.lr_scheduler import LambdaLR
from torch.optim import Optimizer
from torch.utils.data import Dataset, DataLoader
import argparse
import math
import random
import numpy as n... |
c3795a95b9b9bb8b2842400d5ab91b085703e230c747aa97cde055a4cea832e3 | Python | 10,218 | 228 | import os
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
import numpy as np
import torch
from scipy.stats import linregress
from scipy.special import zeta
from scipy.optimize import minimize
import plt_config
import matplotlib
import matplotlib.pyplot as plt
matplotlib.use('Agg') # for running on server withou... |
5d0f1a9e7d332c4507ae128aab111efd183aa5cc86702336480186ce37e36089 | Python | 10,219 | 283 | #%%
import pandas as pd
import numpy as np
import toml
import datetime
import torch
import random
import ast
import os
import glob
import nibabel as nib
import json
from tqdm import tqdm
from .MRI_load import load_mris
from collections import defaultdict
from time import time
from copy import deepcopy
from icecream im... |
9a62fe2c85c87dc66c3bc608fce3070c002ff7704040748142d83ae7281ed9af | Python | 10,223 | 226 | import os
import numpy as np
from scipy.stats import rankdata, wilcoxon
import pandas as pd
import matplotlib.pyplot as plt
import json
from permutations_stats.permutations import friedman
import ivim
root = '/path/to/root'
input_root = os.path.join(root,'data')
results_root = os.path.join(root,'results')
subs = [sub... |
57457cc9c1093f0b2e351621920ff8a6db85912c6318425cca12ec3c87ae5c27 | Python | 10,225 | 275 | """
EEG Data Processing and Classification Pipeline
===============================================
This script handles loading, preprocessing (downsampling, bandpass filtering),
and splitting of EEG data. It also includes examples of how to train
Transformer and CNN models using PyTorch and TensorFlow.
Dependencies:
... |
848723df8c36382e893fbbf9a4c0510224e973ab41060072170bb0d5d40ca913 | Python | 10,227 | 247 | # Ultralytics YOLO 🚀, GPL-3.0 license
"""
Check a model's accuracy on a test or val split of a dataset
Usage:
$ yolo mode=val model=yolov8n.pt data=coco128.yaml imgsz=640
Usage - formats:
$ yolo mode=val model=yolov8n.pt # PyTorch
yolov8n.torchscript # TorchSc... |
c2fd51c8199896074ac574f36e715d07cf201d5cc5cf0ce17e0b4ba4792f518d | Python | 10,228 | 303 | """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.
... |
0e385c332f43145260d63add6e82e640ba8a73f4c3103c39b86e275206467919 | Python | 10,231 | 269 | r"""Shared input handling for the data-first plots in ``ov.pl``.
The statistical plots added alongside the omics-specific ones (survival, ROC,
confusion, forest, ...) deliberately do **not** require an ``AnnData``. They
accept, interchangeably:
* a ``pandas.DataFrame`` plus column names,
* bare arrays / Series / list... |
9811dccd301b99184b492dac48327408da5d9256625eb882d27fad2da395267c | Python | 10,233 | 300 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import typing as T
import numpy as np
import torch
import torch.nn.functional as F
from einops import rearrange, repeat
from torch import nn
... |
5f1c977d2b6e309140e41521f585af3fcb7fc981b568bd5a2ec5872d2f16a557 | Python | 10,238 | 247 | ####################################################################################################
# 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... |
b5fddfedca1f0703ef00eb19c8621d3c3705799206dd699f4aa5ee0e43e29776 | Python | 10,238 | 279 |
import numpy as np
import torch
from torch_geometric.data import DataLoader, Data
import gc
import sys
import time
import logging
import socket
from datetime import datetime
from mpi4py import MPI
from e3nn.o3 import ReducedTensorProducts
from aptnn.aptnn import APTNN
from aptnn.parameters import ModelParameters
... |
780f564ee58785e3effe8fc1338c82ee1f59bee907af49a862041b29c6ca732e | Python | 10,239 | 252 | # 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... |
fbdac4121fec58d236fdbb83593f512941d440eec25b43a69167a1ea6eabf959 | Python | 10,239 | 339 | #!/usr/bin/env python3
import argparse
import math
import os
from copy import deepcopy
import torch
from audio_diffusion.models import DiffusionAttnUnet1D
from diffusion import sampling
from torch import nn
from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNet1DModel
MODELS_MAP = {
"gwf-440k": {
... |
45122471a7c298c7c0af23c8ee038cab91ec081f9a2f00f8f79d2953112cfbd6 | Python | 10,242 | 264 |
#from utility import * # check utility.py for functions documentation
#from component import *
#A = np.arange(10)
#print('input list = ',A)
import ex
import sys
import numpy as np
from collections import deque
#from time import gmtime, strftime
from scipy.signal import butter, lfilter
class Component(object):
... |
74b932d73c6474043c62ff8cefc54b3ab84d07c08730187b8b3161233d6d09fb | Python | 10,243 | 355 | import pandas as pd
import matplotlib
import matplotlib.transforms as mtrans
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from os.path import join
import submitit
import os
from scipy.stats import norm
def pval2zsc(pval):
import scipy
return -scipy.stats.norm.ppf(pval)
def zsc2pv... |
ec34395aaa42b88dbb42636e9eaf7bf92a3021fcbeb20993c9179f017a8b0dc8 | Python | 10,243 | 178 | import sys
# for linux env.
sys.path.insert(0, '..')
import argparse
import os
import time
from PD_std_eligibility_screen import exclude
from PD_std_pre_cohort_rx import pre_user_cohort_rx_v2
from PD_std_pre_cohort_dx import get_user_cohort_dx
from PD_std_user_cohort import pre_user_cohort_triplet
import pickle
import... |
8eed2acea4457997c3856366eba95c1b22a213cb9297c35b306f1316653e4345 | Python | 10,245 | 295 | import warnings
from logging import getLogger
import torch
from pfrl import agent
from pfrl.utils import clip_l2_grad_norm_
from pfrl.utils.batch_states import batch_states
from pfrl.utils.mode_of_distribution import mode_of_distribution
logger = getLogger(__name__)
class A2C(agent.AttributeSavingMixin, agent.Batc... |
3c6aa78e50ef7524e363c9b955197a3318c7271828e860f34723665fd0c6c471 | Python | 10,249 | 338 | # -*- 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=missing-function-docstring,too-few-public-methods
"""Models helpers for aihwkit tests."""
from typing import Any
from torch.nn import (
... |
6a3bf854bcc19caa553efd26f106d9e933731faacf819af3a77e647532fb3854 | Python | 10,249 | 288 | import torch
import torch.nn as nn
import torch.nn.functional as F
from pfrl.initializers import init_lecun_normal
from pfrl.nn.mlp import MLP
from pfrl.nn.mlp_bn import MLPBN
from pfrl.q_function import StateActionQFunction
class SingleModelStateActionQFunction(nn.Module, StateActionQFunction):
"""Q-function wi... |
aa500d25c102de9475a3a04398d0f1c16583c9652874fa01d01644db7047cb3e | Python | 10,250 | 310 | # 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... |
b47fec0745257549b4a7b8636b2eab15cbbd71d5f14452b8b636088496b7f3e5 | Python | 10,251 | 296 | # ReScience yaml parser
# Released under the BSD two-clauses licence
import yaml
class Contributor:
def __init__(self, role, name, orcid="", email="", affiliations=[]):
self.role = role
self.name = name
self.fullname = name
self.lastname = self.get_lastname(name)
self.abbrv... |
b3c4499cedcc11e64d8aa243a34d96ee2d6c7e03430aa331f11bf8d98f3664fe | Python | 10,252 | 328 | import os
import sys
import time
import pytest
from ray.autoscaler.v2.instance_manager.config import NodeTypeConfig
from ray.autoscaler.v2.instance_manager.subscribers.cloud_resource_monitor import (
CloudResourceMonitor,
)
from ray.autoscaler.v2.scheduler import (
ResourceDemandScheduler,
ResourceRequest... |
a009f5b837b278b3ed9b95b6408becd6e77f302fea1f1f6a60bba944fcc5c771 | Python | 10,254 | 266 | #!/bin/env python
import argparse
import pysam
import sys
from typing import Any, List, Text, Dict, Optional
_gt_sum_map = dict()
def _parse_ploidy_table(path: Text) -> Dict[Text, Dict[Text, int]]:
"""
Parses tsv of sample ploidy values.
Parameters
----------
path: Text
table path
... |
b5d21c1f87797384c85945652499a898f33e18e66d1e52fdb4e36f2e59660a02 | Python | 10,255 | 389 | """
This script compiles Figure 2-figure supplement of the manuscript.
"""
import os
import pickle
import matplotlib.pyplot as plt
import numpy as np
import scipy.special as sc
import settings
import matplotlib as mpl
from joblib import Parallel, delayed
from mpl_toolkits.axes_grid1 import make_axes_locatable
from sci... |
ef3e464fd01344de77f86470ebccf2f0ff8af55ab57643202fe6bf2eefaeddb0 | Python | 10,255 | 227 | import pandas as pd
from scipy.stats import shapiro
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import os
import argparse
# This script generates one Bland-Altman plot for all pairs of spinal and vertebral levels.
# NOTE: This script will be used for presentation to generate a figure inst... |
f3f9fe1ec0b105b60a5d162a000d14e215f25999390b8a0848d8c29a3a9e2b7a | Python | 10,257 | 290 | """
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 json
import subprocess
from types import SimpleNamespace
from click.testing import CliRunner
f... |
b016a336dabab245fcd945f2cb3d424d4736d52047ae5ba0f0798de13ef7db96 | Python | 10,258 | 224 | # -*- coding: utf-8 -*-
"""Cut a large image into patches for patch-based 3D SIM reconstruction and later merge them together.
Todo:
* Clean up the code and remove unused functions.
"""
import json
import os
from os import path
from absl import flags
from absl import app
import numpy as np
from scipy.signal impor... |
e497e269bd5fa4f7dc8dafcc3a1f1363dd80a7a55d18d9ea4ab544ff5c99f2e0 | Python | 10,262 | 276 | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 8 17:34:18 2023
@author: nlancaster
"""
#Supplemental Figure 3
#LC Peak Width Evalutions
import pandas as pd
file_path = 'P:/Projects/NML_TPC_2023_ThermoFisher_Phosphoproteomics_q-OT-Astral/SpectronautSearchOutputs/20230412_HEK239T_April_phosphobatch_250ng_0p75PulasrCut... |
11bf359c276b93a39ed069fb5769eb8493e481758d2aa8662fca6c1128d02d66 | Python | 10,263 | 307 | # -------------------------------------------------------------------------------------------------------------------------------------
# Following code curated for Bio-Diffusion (https://github.com/BioinfoMachineLearning/bio-diffusion):
# --------------------------------------------------------------------------------... |
bc304d119c5dc38a6d54aaede2c3244bf2b1fc90349caa5ba0c288c308c9b0e6 | Python | 10,265 | 225 | 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... |
44026f87b645b881bf83ef2fcde79ba2909ff4b5973c596832a9437f74515c9a | Python | 10,266 | 299 | # -*- coding: utf-8 -*-
#
"""
standardize.py
Standardize a VCF of SV calls.
Each record corresponds to a single SV breakpoint and will have the following
INFO fields, with specified constraints:
SVTYPE: SV type [DEL,DUP,INV,BND]
CHR2: Secondary chromosome [Must be lexicographically greater than CHROM]
END: ... |
e22ac2ef576b90460e4249fd065d84fe9854bf987c0bd44c9402ddaceaae80f6 | Python | 10,268 | 263 | from imports import *
import common
import string
from ngs_mapper import compat
class Base( common.BaseClass ):
modulepath = 'ngs_mapper.sanger_sync'
sampleabi = join( fixtures.FIXDIR, 'sample.ab1' )
rund = 'Run_3130xl_{year}-{month}-{day}_01-01_{run}_{year}-{month}-{day}'
sample = '{sample}_{primer}_... |
90c3387b99dd321db5e120803a8395e2706414cc21ed82b20798a1b8d3c42a41 | Python | 10,275 | 340 | # -*- coding: utf-8 -*-
### -------------------------------- IMPORTS ------------------------------ ###
import os
import numpy as np
from tqdm import tqdm
from helper.io_getfeatures import get_data, save_data
from scipy.signal import butter, ellip, cheb2ord, cheby2, zpk2sos, sosfiltfilt
### ---------------------------... |
b80a0ef935afcbda585f02cf207eb6fac41e387fae1142b0128973f885b27a45 | Python | 10,275 | 231 | import argparse
import os
import pickle
from typing import List, Callable
import numpy as np
import torch
import torch.nn as nn
from lib.data_utils.matched_cells_struct import OrderedMatchedCellsStruct
import lib.dataset_config_parser.dataset_config_parser as dcp
from lib.dataset_config_parser.dataset_config_parser ... |
50faf1d380d49d15e42e7ccc5f1334b7d44187bf1cbd4126fc4ee32ab7b458ad | Python | 10,277 | 347 | from pathlib import Path
from typing import Dict, Any, Optional
import torch
from torch import nn
import numpy as np
import torch.nn.functional as F
from infer.tasks.weightdrop import WeightDrop
class MeanClassHead(nn.Module):
def __init__(self, embedding_size, num_layers, weight_drop, variational):
sup... |
c83c6e80ad83b222e3b9b83b2023f5019720a81856507b6aab86d57c259ae906 | Python | 10,278 | 188 | import torch
import torch.nn as nn
from model.multi_task_model import tokenize_data, discriminate_generate, generate_discriminate
import argparse
from utils.utils import load_data, tokenize_multi_task, evaluate_multi_task
import os
from transformers import AdamW, BartForConditionalGeneration
from tqdm import trange
fro... |
7479307244c53b398c75308378d1480772eaabe46e09dff71715ff02aeef8f99 | Python | 10,281 | 303 | import os
import sys
from tempfile import NamedTemporaryFile
import pytest
from ray.dashboard.modules.job.common import JobSubmitRequest
from ray.dashboard.modules.job.utils import (
fast_tail_last_n_lines,
file_tail_iterator,
parse_and_validate_request,
redact_url_password,
strip_keys_with_value_... |
ed55833c44946283cc5cf7518e6cb4be2c9d11904cefa6952ded8c8a2942aed5 | Python | 10,282 | 305 | from typing import Optional, List
from functools import partial
from neuron_morphology.feature_extractor.data import Data
from neuron_morphology.features.statistics.coordinates import COORD_TYPE
from neuron_morphology.feature_extractor.marked_feature import marked
from neuron_morphology.feature_extractor.mark import ... |
08d71c30c588112da142afc12739cdcb10efc3a8d78bd2c3f21ad32a2adc4f97 | Python | 10,283 | 231 | import logging
from IsoNet.preprocessing.prepare import get_cubes_list,get_noise_level, prepare_first_iter
from IsoNet.util.dict2attr import save_args_json,load_args_from_json
import numpy as np
import os
import sys
import shutil
from IsoNet.util.metadata import MetaData
from IsoNet.util.utils import mkfolder
def run(... |
c07cad8c8edf45a2040cb7479e471b44a4f13b6699ea997332d2c120f37498c7 | Python | 10,284 | 277 | # ML4H is released under the following BSD 3-Clause License:
#
# Copyright (c) 2020, Broad Institute, Inc. and The General Hospital Corporation.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#... |
490c27cbde668c3b9d94822318ccf7df21ca682816238e79f08725a001c6afae | Python | 10,286 | 220 | """
This script is used to crop the composed images and labels to the same dimensions as the top images and then
convert the BIDS datastructure to nnU-Net datastructure.
This script is necessary because we need to crop composed images and labels to top images (covering C spine) to be able to use them
for nnU-Net train... |
e6ac29bef2cbdbaaa86f5492e7ba5841924dac17cb39ad1b602ac6a41a2f266c | Python | 10,286 | 279 | # 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)... |
f014a1896621fe25eee454915222db99abd245fb0cc3e147c4d5399f765e3bf2 | Python | 10,286 | 182 | __author__ = "Simon Andermatt"
__copyright__ = "Copyright (C) 2017 Simon Andermatt"
from copy import copy, deepcopy
import numpy as np
import tensorflow as tf
from mdgru.model import convolution_helper_padding_same
from mdgru.helper import compile_arguments, harmonize_filter_size, generate_defaults_info
from ..crnn.c... |
797c8e149c69887280188cc800c051231ea98afca712929746bdd351291866c0 | Python | 10,287 | 330 | import argparse
import base64
import json
import os
import sys
import time
import ray
import ray._private.node
import ray._private.ray_constants as ray_constants
import ray._private.utils
import ray.actor
from ray._common.ray_constants import (
LOGGING_ROTATE_BACKUP_COUNT,
LOGGING_ROTATE_BYTES,
)
from ray._pri... |
8191b56a256f059e3ee4301c6d5cc587e013f79eb81291364c8ab861b3a28196 | Python | 10,288 | 215 | from mdgru.eval import SupervisedEvaluation
import tensorflow as tf
import logging
import os
import pickle
from tensorflow.python import pywrap_tensorflow
from mdgru.helper import argget, check_if_kw_empty, compile_arguments, generate_defaults_info
import numpy as np
import copy
class SupervisedEvaluationTensorflow(S... |
28f8c97df0279f6b1213ecaa58601b33e76ff84e1f5242f58bd0469a94c3770e | Python | 10,291 | 313 | # 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, ... |
aed95ec292a519502f4008145735a614c77e57c080866ca2bd759ca716e0436b | Python | 10,295 | 248 |
import glob
import os
import subprocess
import nibabel as nb
subs = ['sub-05', 'sub-06', 'sub-07', 'sub-08', 'sub-09']
subs = ['sub-08']
# Define data dir
DATADIR = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti/derivatives'
BBOX = {'sub-05': {'RH': {'xlower': 435, 'xrange': 162, 'ylower': 55, 'yran... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.