sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
46e652a158a272612c6020f3197d00c592ccffbd645d4ff8837b6cb95938b198 | Python | 6,419 | 146 | from neuron_morphology.validation.result import MarkerValidationError as ve
from neuron_morphology.constants import *
def validate_coordinates_corresponding_to_dendrite_tip(marker_file, morphology):
""" This function checks whether the coordinates for each dendrite marker
corresponds to a tip of a dendri... |
dd27dca48aee26657dfec25d8d94d9f3e0e60044d14655ff45a0fcd2be3e8df1 | Python | 6,419 | 141 | # -*- coding: utf-8 -*-
"""3D SIM forward model with neural-space time model.
This module contains the forward models for 3D SIM and 3D SIM with space-time modeling. The loss functions used for the
3D SIM reconstruction are also provided.
"""
from typing import Tuple, Union
import numpy as np
import jax.numpy as jnp
... |
0d839d406ecb71612492cb88c2d4789c90e1fde791af86a5b28769e9f76fa1be | Python | 6,421 | 168 | import os
import numpy as np
from Bio import PDB
def sc6k_sites():
f = open('native_bind_sites_sc6k.txt','w')
f.close()
folder = '/data/XLW/DUnet_train/sc6k/curated_new/'
for i in os.listdir(folder):
f = open('native_bind_sites_sc6k.txt', 'a+')
f.write('%s\n'%i)
f.close()
... |
66679e132999d3a2619388b9c88771e7c2895ac4934db287cb416ee3a75283cd | Python | 6,421 | 159 | """
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 os
import tempfile
from typing import TYPE_CHECKING
import hydra... |
166f8830a460773b403102ff5fd82bb64f3370fcc1c22976ef92cdaf5cd62de8 | Python | 6,426 | 152 | ####################################################################################################
# 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... |
8a8b7d4f62e3e8634fa5b815ae453407e23fb33751c03e5ee581f2f2f26c56e7 | Python | 6,426 | 216 | import os
import pickle
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader, TensorDataset
from torchvision import transforms
from torchvision.models import resnet50
from PIL import Image
from sklearn.metrics import f1_score
IMAGE_TRANSFORM ... |
8b5ee6fd873255a070811c194ad640384d662e12894d2a61dad38ab6bb7d56a9 | Python | 6,426 | 181 | # built-in dependencies
import os
# 3rd party dependencies
import numpy as np
import pytest
# project dependencies
from deepface.modules import datastore
from deepface.modules.database.inventory import database_inventory
from deepface.modules.exceptions import DuplicateEntryError
# run docker/docker-compose.yml firs... |
ab4af47a823b90e606e407c3a2a3ca1397482300c6b7a6cd6f4e1d2c03e2627f | Python | 6,426 | 178 | """
Unified messaging standards for SCLLM models.
This module defines consistent, concise messages that should be used across
all SCLLM models (scGPT, scFoundation, Geneformer, CellPLM).
"""
class MessageStandards:
"""Standard message templates for consistent output across all models."""
# Model Loading ... |
2e5b512e209c4e9896ee76ea355c5660077b9b55482bbdc191494ad320430bd8 | Python | 6,428 | 196 | from anndata import AnnData
import numpy as np
import pandas as pd
# import pyliger
from typing import Optional
from scipy.sparse import csr_matrix
from sklearn.decomposition import NMF
import mofaflex as mfl
def construct_gems_using_pyliger(adata: AnnData,
n_gems: int,
... |
13964ed33a6593fb8558b9c7efcca58c9abc4b15c8cc77f84812ccf6647c7c9a | Python | 6,429 | 100 | if __name__ == '__main__':
from nnunetv2.paths import nnUNet_results, nnUNet_raw
import torch
from batchgenerators.utilities.file_and_folder_operations import join
from nnunetv2.inference.predict_from_raw_data import nnUNetPredictor
from nnunetv2.imageio.simpleitk_reader_writer import SimpleITKIO
... |
0b48b22245f60eae9093f177be2d609e749b3f60a5823add4ccca9ca693767d3 | Python | 6,433 | 177 | # 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... |
dcfd2af5b53ad80b9b0f93564308a2fb077d5c56edd0de06e60f1230f1e214da | Python | 6,433 | 190 | # 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, ... |
f7c2a3a8deceba89ef32acce730fcfd8c5319b06c9c0ea5bbf367bcd10a8febd | Python | 6,433 | 185 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""API client the AIHW Composer API."""
from typing import List, Dict
from aihwkit.cloud.client.entities import CloudExperiment, CloudJob
from aihwkit.cloud.cl... |
43478b2b85e28493a85819cc3a9de604d8d81748bbd6ce9b183443cee7f92116 | Python | 6,434 | 161 | import os
import cv2
import random
import string
import numpy as np
from tqdm import tqdm
from PIL import Image
from torchvision import transforms
from collections import defaultdict
import torchvision.datasets as datasets
from .image_metrics import get_iou
class CreateUltraMNIST:
def __init__(self, root: str, ba... |
ebcc469dfb500b856da06f150e726af28283f00ce7ccd42467260c892aae7d8f | Python | 6,435 | 202 | import json
import logging
import os
import pathlib
import random
import socket
import string
import threading
from datetime import datetime
from typing import Dict, Optional
from google.protobuf.json_format import Parse
from ray._private.protobuf_compat import message_to_dict
from ray.core.generated.event_pb2 import... |
323073a45d43e939bf882dbc38e7164d9a2ca0e5697d22e9fc41f1e0738169fd | Python | 6,436 | 161 | # Copyright 2023 Zhejiang University Team 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
#
#... |
f7a682324ef2518cde467b4b3359c5d119b946c364bbc90ab37d00709a3e2bc2 | Python | 6,436 | 155 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import os
import itertools
thresholds = [0.95, 0.80, 0.65, 0.50, 0.35, 0.20, 0.05]
db_names = {'GRCm39':'Mouse', 'NHGRI_mPanTro3':'Chimpanzee', 'TAIR10':'Arabidopsis'}
POS_NUM = 250
NEG_NUM = 25000
def handle_duplicate_names(p... |
5fa212326a4c2f9e16ebdab1b2c057e3cd1e890ea1e97da7679d9ee133f91cdf | Python | 6,439 | 174 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Tests for linear layer."""
from torch import Tensor
from torch.nn import Module, Sequential
from aihwkit.nn import AnalogSequential
from aihwkit.simulator.t... |
a61108111c43c49bdb85035807c5b4c094999a7312e19ef02a65f303c34cf62d | Python | 6,439 | 202 | import json
import os
import secrets
import sys
import pytest
# RAY_enable_export_api_write_config env var must be set before importing
# `ray` so the correct value is set for RAY_ENABLE_EXPORT_API_WRITE_CONFIG
# even outside a Ray driver.
os.environ["RAY_enable_export_api_write_config"] = "EXPORT_SUBMISSION_JOB"
# ... |
ae05a5a9cb65c269160eed3c26545cc81a76608d21e5b34d989d94b7c7134bcd | Python | 6,439 | 137 | #!/usr/bin/env python
# intron retention
import pandas as pd
import numpy as np
from prepare_and_parse import generate_split_table
from prepare_and_parse import class_by_transcript_pd
'''
Demystify the number of IR events as the number of exons with IR != IR events
:row = list of the gencode exon number classified wi... |
d2481caa49aaa0fa7453b6cc283bb5da07f8a9af302d740be7ddb323bcdf50c1 | Python | 6,439 | 164 | # -*- 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.
#... |
0ac5bce483a6c6c47565a8758395cfd25017250d1c11e524adf691c3a7036bb4 | Python | 6,441 | 182 | import sys
import tempfile
import unittest
from pathlib import Path
import pytest
from ci.raydepsets.tests.utils import (
copy_data_to_tmpdir,
get_depset_by_name,
write_to_config_file,
)
from ci.raydepsets.workspace import (
BuildArgSet,
Depset,
Workspace,
_substitute_build_args,
)
def t... |
9a6586898b763afb892c96d42a6d248e656b1fdd721b44b15d0b1f2a2a62cb19 | Python | 6,442 | 146 | ####################################################################################################
# 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... |
6017b50bbd1c6087492266f19c1a4151397249b278caacae35a77697a9fddf9d | Python | 6,443 | 183 | ####################################################################################################
# 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... |
d4cb50aa2c22cf276d88a599c5a75dee83c9d5d29cc44f5cd8c0603281085199 | Python | 6,443 | 160 | import logging
import logging.config
import sys
from concurrent.futures import ThreadPoolExecutor
import pytest
import ray
from ray._common.filters import CoreContextFilter
class TestCoreContextFilter:
def test_driver_process(self, shutdown_only):
log_context = ["job_id", "worker_id", "node_id"]
... |
53439360659cd342846c02e4282968820a92c0e64c031e2f33a4a39e688a9ff4 | Python | 6,444 | 162 | """Code execution engine for OVAgent — sandbox, code transform, error recovery.
Extracted from ``smart_agent.py``. ``AnalysisExecutor`` wraps an
:class:`AgentContext` and provides:
* ``ProactiveCodeTransformer`` — regex-based LLM code fix-ups
* ``execute_generated_code`` — sandbox execution with security scan
* ``bu... |
90aa9ba00f9488a4d551c3dc532c045251e0a7413674c5733b13a48ee9e021fe | Python | 6,444 | 179 | from imports import *
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.Alphabet import generic_dna
from Bio import SeqIO
from ngs_mapper.base_caller import VCF_HEAD
import vcf
from vcf.model import _Record
from StringIO import StringIO
class VCFBase(common.BaseClass):
modulepath = 'ngs_mappe... |
6e67532682ded29b3dde52dd473b9e59d60a466c28e3bb23c89b098630837f82 | Python | 6,445 | 247 | """ReMap Transcription Factor Binding Database API client."""
from typing import Dict, List, Optional, Any
from .base import BaseAPIClient
class ReMapClient(BaseAPIClient):
"""Client for ReMap API - regulatory regions from ChIP-seq."""
def __init__(self):
super().__init__(
base_url="... |
76b1bf49ba26059df187be5547e3ebed747eb50293baffc28873167a10453d57 | Python | 6,446 | 201 | ####Custom training the CNN in for allo input##
#Arg 1 is samfile
#Arg 2 is positive peak set
#Arg 3 is negative peak set
#Arg 4 is output name
import os
import sys
import shutil
import math
#Used to get counts in regions
def getArray(chr, start, stop, genLand):
array = []
for k in range (int(start),int(stop... |
8e8aba21003e7f48a90092e3556a0c9a080ed973d4e3116ccdc70c2e045d80f1 | Python | 6,446 | 247 | """ReMap Transcription Factor Binding Database API client."""
from typing import Dict, List, Optional, Any
from ..base import BaseAPIClient
class ReMapClient(BaseAPIClient):
"""Client for ReMap API - regulatory regions from ChIP-seq."""
def __init__(self):
super().__init__(
base_url=... |
3f7a1403c37d898893a75ab629e28c639720ed0f3a1fede7c59bb2d6422d6b2d | Python | 6,448 | 146 | from tkinter import Y
import numpy as np
import matplotlib.pyplot as plt
import pdb
import torch
import torch.nn.functional as F
import cv2
import scipy
from Datasets import MASK_SIZE
from utils import *
import torchvision.transforms as transforms
def get_crop_new(input_map, cali_M, flip = False, msize=40... |
45023f7f52d6ca4f74084c3ffdabb694dbb0d8ca2780c9eb140edcdb9183651a | Python | 6,449 | 168 | ####################################################################################################
# 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... |
fc279d8f69224db4a969b9df2086f90f4a007a21f133c5ba9c74ed3f3f039b0a | Python | 6,449 | 179 | # -*- 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=no-name-in-module,import-error
"""Converter for `BasicTraining` Experiment."""
from typing import Any, Dict, List
from torch.nn import Modul... |
5213f5c847747c00ce6809a9007cc97f28f042e976404452dba5581285dcd8be | Python | 6,453 | 132 | #!/usr/bin/env python
#
# Author: Eugene Gardner (eugene.gardner at mrc.epid.cam.ac.uk)
#
# DNAnexus Python Bindings (dxpy) documentation:
# http://autodoc.dnanexus.com/bindings/python/current/
import os
import dxpy
import tarfile
import pkg_resources
from pathlib import Path
from general_utilities.import_utils.fil... |
64d9a7b0073703842b87c46075911058f6c9f9c84a5d3dd932caa01055e362a2 | Python | 6,454 | 178 | # 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... |
c0b560c1e926fc28b2f0def43edaf2c41b6b9fc2b9819230c19f606737c6da9d | Python | 6,454 | 170 | #!/usr/bin/python
import subprocess
import os
import re
# The directory where the final results will be print to
#portal_directory = '/gpfs/bbp.cscs.ch/project/proj83/visualization-SSCXDIS-178/portal'
portal_directory = '/gpfs/bbp.cscs.ch/project/proj3/sscx_portal'
# The synaptic pathways directory
root_synaptic_pat... |
68fef823a122771a01278f9813add79d4e998b2691b13c49729a1a374201be49 | Python | 6,456 | 144 | import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
from tqdm import tqdm
from sklearn.feature_selection import f_classif
from statsmodels.stats.multitest import multipletests as fdr_correction
#Thic block is for ANOVA + shuffle analysis to define significant features in ... |
706320dd25f465818d88f71a2c108f933a66a3497debd895e8142bdda79e8cca | Python | 6,456 | 194 |
import pdb
from scipy.io import loadmat
import numpy as np
import torch
from data_assimilation.oracle import ObjectStorageClientWrapper
from data_assimilation.particle_filter.base import BaseForwardModel
from latent_time_stepping.utils import (
load_trained_AE_model,
load_trained_time_stepping_model
)
cl... |
e4078f1ff698f20760c788d583749741de4ff794115ed46060968ea84743ee80 | Python | 6,457 | 181 | # Copyright (c) OpenMMLab. All rights reserved.
import logging
import os
import os.path as osp
from argparse import ArgumentParser
from mmdet.testing import replace_to_ceph
from mmdet.utils import register_all_modules as register_all_mmdet_models
from mmdet.utils import replace_cfg_vals
from mmengine.config import Con... |
fd68492a0dd6c84628af1fa43b6c874010db4483ed4aff748ada3c236c87910a | Python | 6,457 | 177 | import logging
import os
import sys
from unittest.mock import mock_open, patch
import pytest
from ci.fossa import ray_oss_analysis
@pytest.fixture(autouse=True)
def reset_logger():
"""Reset logger level before each test."""
ray_oss_analysis.logger.setLevel(logging.INFO)
@patch("ci.fossa.ray_oss_analysis.l... |
a29f94be31911a9ef048194a748ad12e2e3b7e18cc158747e7b8c975133bcd2f | Python | 6,462 | 176 | import os
import re
import numpy as np
import h5py
import json
import torch
from nilearn.connectome import ConnectivityMeasure
from darts import TimeSeries
from darts.dataprocessing.transformers import Scaler
from sklearn.preprocessing import StandardScaler
def load_params(params):
"""Load parameters from json fi... |
9f6b93652952ffba9343157eb65cb3b6ae2c8814023cec13bb5f4f02ea45e6da | Python | 6,465 | 186 | import os
import torch
import random
import numpy as np
import scanpy as sc
import scipy.sparse as sp
from torch.backends import cudnn
#from scipy.sparse import issparse
from scipy.sparse.csc import csc_matrix
from scipy.sparse.csr import csr_matrix
from sklearn.neighbors import NearestNeighbors
def fil... |
183d8594f368ae37792f49f580a42f782ccaffe0e3d3c2e418878d34cddd2a77 | Python | 6,469 | 156 | # 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... |
74a2a7a7a8932b7474aa9afc7500d61e8d1fe50095943cf771d8d360e4b4e5a2 | Python | 6,472 | 154 | import torch as th
import torch.nn as nn
from .modules import MLP
# Detect device - use CUDA if available, otherwise use CPU
device = th.device('cuda' if th.cuda.is_available() else 'cpu')
class VelocityFieldReg(nn.Module):
"""
Velocity field for the dynamics of zu, zs, and zr
"""
def __init__(self, l... |
9a92499195a8393102cd9d486cab74d78f9767eaf4e622771dc6d895ac627804 | Python | 6,474 | 191 |
import pdb
import numpy as np
import torch
from data_assimilation.oracle import ObjectStorageClientWrapper
from data_assimilation.particle_filter.base import BaseForwardModel
from latent_time_stepping.utils import (
load_trained_AE_model,
load_trained_time_stepping_model
)
class NNForwardModel(BaseForwar... |
f5a2d4bd3e5475852f0bed41248117ca159dbed5a5dff290077db301dfff2c80 | Python | 6,474 | 216 | """Stable OmicVerse lookup helpers exposed via ``omicverse.utils``.
These wrappers make the ovagent registry/skill lookup flow available from the
same Python runtime that executes OmicVerse analysis code. This lets external
agent systems call OmicVerse-native lookup helpers without relying on a
separate Pantheon tools... |
91a0bdc05a8b3ae3b79ccdb78ada2be31b52a5f5e6c5444cf23cb04d0213151e | Python | 6,476 | 186 | import pdb,sys,os
import anndata
import scanpy as sc
import argparse
import copy
import numpy as np
from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_samples, silhouette_score
from typing import Union
import matplotlib.pyplot as plt
def initsetup(
name:str, bulk:str,logged:bool=False,
... |
234c06b55bd307772bf66465a1b19653ad2657afc33330995bd55ca03727ef43 | Python | 6,478 | 204 | """fastp wrapper for FASTQ quality control."""
from __future__ import annotations
import os
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,
resolve_executable,
... |
697171216e243d271bbb2adea8d12c1a839b16e84d0a6373c3bf63af8cd02872 | Python | 6,478 | 156 | import pickle
from matplotlib import pyplot as plt
from sklearn.metrics import confusion_matrix, balanced_accuracy_score
import sklearn.model_selection as md
import pandas as pd
import numpy as np
import seaborn as sb
import os
# Axis resizing helper function from https://stackoverflow.com/questions/44970010/axes-clas... |
f33d64f7ae62b9f0e2e3deba741006ee6e3928d7476e288961bd2da35dbc146e | Python | 6,478 | 207 | """Base classes for all dynamic stimuli datasets."""
from contextlib import contextmanager
from typing import Any, Dict, Iterable, List, Union
import numpy as np
import pandas as pd
import torch
from flyvis.datasets.augmentation.temporal import get_temporal_sample_indices
from flyvis.utils.dataset_utils import get_r... |
d9ba642f02fee971d6744d5fdce56158e11354ccb84ebd901c8044f48014877a | Python | 6,479 | 121 | import os
from sklearn.model_selection import KFold
from param import *
from utils import *
args = parse_args()
def similarity_feature_process(args):
similarity_feature = {}
path = args.path
device = args.device
"miRNA sequence sim"
rna_seq_sim = np.loadtxt(os.path.join(path, 'm_ss.csv... |
b285e3c3dd8b4afa239eee806e0d2c2e9510cf1f06531d6705f51502e4f9731f | Python | 6,481 | 209 | import cupy as cp
import cupyx as cpx
import numpy as np
import numpy.typing as npt
from pyJoules.energy_meter import EnergyContext
from pyJoules.device.nvidia_device import NvidiaGPUDomain
from pyJoules.handler.pandas_handler import PandasHandler
def bootstrap_ci(data: npt.ArrayLike, confidence: float = 0.01, num_... |
4bdb2a8ca24365ecbe9eb250ad8e3489a418fe3f127bd2156c0be939876f3542 | Python | 6,483 | 123 | import os
from sklearn.model_selection import KFold
from param import *
from utils import *
args = parse_args()
def similarity_feature_process(args):
similarity_feature = {}
path = args.path
device = args.device
"miRNA sequence sim"
rna_seq_sim = np.loadtxt(os.path.join(path, 'm_ss.c... |
f13ff90a0476e85c549bf0329d2995718e15d661f10f0888438b7bbc4c46ec3a | Python | 6,483 | 189 | #!/usr/bin/env python
import json
import argparse
import sys
from os.path import basename
import numpy as np
from matplotlib import pyplot as plt
def main( args ):
if args.title is None:
title = basename(args.outfile)
else:
title = args.title
make_graphic( args.jsonfile, args.outfile, arg... |
ee81478eb637436d8e90722a85fe4b2747aa40121194533b19fab94d53aa02f7 | Python | 6,484 | 163 | ####################################################################################################
# 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... |
2b98e08069042d05bc6bf03760c61512fbb43be1a89f2270cbdfbdd3b7a46e92 | Python | 6,485 | 173 | import asyncio
import copy
import logging
import os
import subprocess
import sys
from pathlib import Path
from typing import Dict, List, Optional, Tuple
from ray._common.utils import try_to_create_directory
from ray._private.runtime_env.context import RuntimeEnvContext
from ray._private.runtime_env.plugin import Runti... |
c6d1981eada00be040f03b8b5d13cec0d8a7924db76e4e969d2b0137b112395c | Python | 6,485 | 149 | # -*- coding: utf-8 -*-
import numpy as np
import numpy.random
import keras
import csv
import keras.layers
from sak.disambiguator import select_kernel_initializer
from sak.modules2D import StemModule
from sak.modules2D import AtrousMiddleModule
from sak.modules2D import LevelModule
from sak.modules2D import PoolingMod... |
58a923f32f65ac3803c42f67f39e0ebd1fa1599f799a9aabd2ea3e9d5ffb5dce | Python | 6,486 | 200 | import numpy as np
import os
import tifffile
import cv2
import logging
from numpy import prod, zeros
def get_type_max(data):
dtype = data.dtype.name
if dtype == 'uint8':
max = 255
elif dtype == 'uint12':
max = 4098
elif dtype == 'uint16':
max = 65535
elif dtype == 'float32... |
19d3cf04ca85e4fa4216d6404d3e6347408130cbf8774566b717a2be4368ef8a | Python | 6,487 | 173 | #
# 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... |
9fc7ea79105699fba8352e050a0b5312a9c8d315bceddf316210edf58fa4d2c4 | Python | 6,488 | 180 | # ---------------------------------------------------------------------------------------
# MS lesion segmentation pipeline
# ---------------------------------
# - incorporates:
# - MRI identification
# - registration
# - skull stripping
# - MS lesion segmentation using the CNN Valve... |
799e6d5cb2b91fb0f01ac015bdfa4789bb65c46b34250bda78c34ecc6276e83c | Python | 6,491 | 183 | # -*- 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.
#... |
125006fd9b7b6e78a702f4c0d837e8d5022c1e7ad5c053a6bb787daf59cffbc0 | Python | 6,493 | 217 |
import os
import yaml
import json
import copy
import pprint
import ast
import collections.abc
def update(d, u):
"""
Recursively update the `key:value` of a dictionary with another dictionary
:param d: A `dict` to be updated
:param u: A `dict` of the update
:returns : The updated `dict`
"""
... |
66ec08e167ae88a118de4eadf53407535d3308cddecdcf7ce8ad16bed58b61cd | Python | 6,493 | 208 | import argparse
import json
import os
import pickle
import pandas
import torch
from torch.utils.data import DataLoader
from tqdm import tqdm
from models import PretrainModel, load_model_arch
from utils.Dataset import InferenceDataset, col_fn_inference
from utils.data_utils import fix_seed
from utils.inference_tools i... |
591119cf426ff0bbb14c969ad2fd393b4bde2886a56aba44d0329ecd4fcd785f | Python | 6,494 | 136 | from typing import List, Dict
import numpy as np
import torch
import random
from scipy.ndimage import gaussian_filter
from sklearn.model_selection import StratifiedShuffleSplit
from common import DataRecord, DataScenarios, SEED
from utils import load_json_file, dump_as_pickle
from data.data_utils import generate_back... |
6f2fe9ba905b60aa55fde920c79d0347f2e33f66b43dd1c99ed49457a2a67066 | Python | 6,494 | 197 | # 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, ... |
b8404c3901cd50960f0de3875e5b2af21de4f69de25f6189953cbe32b38f39a1 | Python | 6,495 | 177 | # Modified from https://github.com/open-mmlab/mmediting/tree/1.x/
import os.path as osp
from typing import Callable, List, Optional, Union
from mmengine.dataset import BaseDataset
from mmengine.fileio import FileClient, list_from_file
from lqit.registry import DATASETS
IMG_EXTENSIONS = ('jpg', 'JPG', 'jpeg', 'JPEG',... |
dc0ea73fd1c2aea51e074a3ff92d7b3b9d3410342e63742e8a0e91e1fb5689e9 | Python | 6,495 | 179 | import asyncio
import logging
import os
import signal
import sys
from typing import AsyncIterator
from ray.dashboard import optional_utils
from ray.dashboard.optional_deps import aiohttp
from ray.dashboard.subprocesses.module import SubprocessModule
from ray.dashboard.subprocesses.routes import SubprocessRouteTable as... |
abb994c2167886e2154d61fb8d9a79c4923eaccd2e8c57012608c84f6873212e | Python | 6,496 | 195 | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 18 14:26:11 2024
@author: Leyang Xue
"""
import sys
import matplotlib.pyplot as plt
import numpy as np
# Add package path
packagepath = '../kcorePercolation' # Manually specify the path to your script
sys.path.append(packagepath)
from utils import kcorePercolation as... |
7d21bdf924b96aeff7fd7d4d9516625059490d0a44832e6b7668b2ca96f90a60 | Python | 6,497 | 219 | import numpy as np
import pandas as pd
import os.path
import sys
import scanpy as sc
from scipy.io import mmread
import anndata
from typing import Optional, List, Union
def _clean_up(df: pd.DataFrame) -> pd.DataFrame:
"""
Remove rows and columns with all zeros from a DataFrame.
Parameters
-------... |
a606983c8b359554e4b5274204c5ea8045450d7a1c1bb5c238330b8170267c6a | Python | 6,499 | 160 | import sys
import numpy as np
import time
import os
# os.environ['CUDA_DEVICE_ORDER'] = 'PCI_BUS_ID'
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
import keras
from keras import backend as K
# from sklearn.model_selection import train_test_split
# from CNN_classifier import CNN_classifier
import json as simplejson
from t... |
0bb76d93a7ed397c419ae019f7f8f12e6dd66c128f02cc7ae4f68ee05e527c21 | Python | 6,501 | 180 | """
An implementation of Context dependent GRU.
the gru uses the implementation from:
https://github.com/emadRad/lstm-gru-pytorch/blob/master/lstm_gru.ipynb
"""
import math
import torch
import torch.nn as nn
import numpy as np
from utils import to_pth, to_np
class CGRU(nn.Module):
def __init__(
self, ... |
d5d9fc9ca6303a8e182d8cd7005bad9429aaaa1d0305ee8d49775b5fe5676df3 | Python | 6,502 | 202 | import os
import csv
import numpy as np
import itertools
import subprocess
#See conditions nname below
def register_images(subject_dir, subject_id):
fmA_infile =os.path.join(subject_dir)
fmA_outfile = os.path.join(subject_dir, 'model', 'model001','onsets','task002_run001')
fmB_infile =os.path.join(subject_dir)
f... |
46bb131a0eabb275c1663c2605d4799ba2e20ac06ef50c318934503485e7b8e6 | Python | 6,506 | 164 | import unittest
import pytest
import torch
from torch import nn
from pfrl.testing import torch_assert_allclose
from pfrl.utils.recurrent import (
concatenate_recurrent_states,
get_recurrent_state_at,
mask_recurrent_state_at,
)
class TestRecurrentStateFunctions(unittest.TestCase):
def _test_lstm(self... |
5f4708617e819655edbe0b98e97eb4447eaa219c9695ec7c7ad22585795b94b7 | Python | 6,508 | 207 | """Correlations between variables."""
import itertools
import warnings
from typing import Callable, Optional
import numpy as np
import pandas as pd
from scipy import stats
from data_profiling.config import Settings
from data_profiling.model.pandas.discretize_pandas import (
DiscretizationType,
Discretizer,
)
... |
72708b1d0d6a61cb7316209a2e36c29577f6b3185b2f7fc1d7fcf0f5cda1adaf | Python | 6,509 | 190 | """
The intention of this script is to easily sync a given Sanger run path from the sequencer into the :doc:`NGSData <../ngsdata>` structure
You need to ensure that the run directory for the run you want to sync is available and that you know the path to it.
Accessing Sanger Data
=====================
You will need ... |
b17feb2866d03a8e213b05705294975a35b3800ce954ba879d9e4872c51387d0 | Python | 6,513 | 190 | """
docstring here
"""
from typing import Union, Sequence, Tuple
import numpy as np
from .symmetry import Symmetry
from ..global_defs import get_lattice
_Identity = None
_TotalSz = dict()
_SpinInverse = dict()
def Identity() -> Symmetry:
global _Identity
if _Identity is None:
_Ide... |
002d9ee3587a3b577b68f0b2380e9ccdc130990861d2ff1d90ee7fc5fa86c35b | Python | 6,515 | 130 | import os
import numpy as np
import matplotlib.pyplot as plt
project_root = "/ccb/cybertron/khchao/splam-analysis-results/"
# albation_study_root=f'{project_root}results/albation_study/MODEL/subset_10000/'
albation_study_root=f'{project_root}results/albation_study/MODEL_TEST/'
output_dir = f'{albation_study_root}img/'... |
bdd4d2697587a2fc28c1e3c7fb511282b0757e5cbd1d0237fcb2de93c64d2f77 | Python | 6,515 | 240 | from attr import dataclass
import ray
from data_assimilation.PDE_models import AdvectionEquation, PipeflowEquations
import numpy as np
import matplotlib.pyplot as plt
import pdb
from matplotlib.animation import FuncAnimation
from data_assimilation.particle_filter_old import ParticleFilter
from data_assimilation.aux_par... |
328b8f42429f3d29f6a268b99f7a6552bc69ab89fd11e0b74441ed7fd7a8496a | Python | 6,516 | 138 | # -*- coding: utf-8 -*-
from mozaik.storage.datastore import PickledDataStore
from mozaik.controller import Global
from parameters import ParameterSet
import mozaik
from mozaik.controller import setup_logging
import sys
from msa_analysis_plotting import *
from mozaik.storage.queries import *
# Usage: python run_analys... |
c1e547aa7a7e04f0758b392f2303dbddd374b770292f04116718e800d225f3ea | Python | 6,516 | 182 | import numpy as np
import networkx as nx
import os.path
import matplotlib.pyplot as plt
import time
import math
import gc
gc.collect()
import warnings
warnings.filterwarnings('ignore')
import os
from matplotlib.ticker import FormatStrFormatter, MaxNLocator
os.system('cls' if os.name == 'nt' else 'clear')
p... |
a05f279f175b68623dbaa07aedb3bf7e6aef1e13e4712b9ffa20f53973fae97e | Python | 6,518 | 163 | from typing import Iterable, Optional, Union
import pandas as pd
from omicverse.external.scTenifold.core._base import scTenifoldKnk, scTenifoldNet
from omicverse.external.scTenifold.core._networks import anndata_to_dataframe
from omicverse.external.scTenifold.core._types import Backend, ExpressionData, KOMethod, Kwar... |
065d4029ec05d0f914c9e48de7b5c48abf5c865831a3cfbaa41efc7f32cda7a8 | Python | 6,519 | 171 | import os
import re
import sys
import torch
import argparse
import pandas as pd
from pathlib import Path
from rdkit import Chem
from tqdm import tqdm
def get_conda_bin_dir():
if os.path.basename(sys.executable) == 'python':
# note: the case where the current script is run
# with the full path to... |
71d328932b698b51350300e536f75de254f1925b2d100bbc7dba36237e6dc5f0 | Python | 6,519 | 218 | # -*- coding: utf-8 -*-
#
"""
std_dragen.py
Standardize a DRAGEN-SV record.
"""
from collections import deque
from svtk.utils import is_smaller_chrom, parse_bnd_pos, parse_bnd_strands
from .standardize import VCFStandardizer
def checkInversion(record):
isInv3 = False
isInv5 = False
mateChr = ""
mat... |
5828cbb670288c38ae02411ad4f11b74ee50e84a6dd70c34713f3cb9972cb955 | Python | 6,520 | 185 | from pathlib import Path
import numpy as np
import pytest
import spectral as sp
from PIL import Image
from siapy.core.exceptions import InvalidFilepathError, InvalidInputError
from siapy.entities.images.spectral_lib import SpectralLibImage, _parse_description
def test_open_valid(configs):
spectral_image_vnir = ... |
4e92dcccd5d5c9d73105fb62cc1e0a5f9c9157509ffb6b546b926ba78d3a320f | Python | 6,522 | 148 | import torch
import utility
import loss
torch.backends.cudnn.enabled = False
import argparse
from div2k import FlouresceneVCD
from trainer import Trainer
from torch.utils.data import dataloader
import model
def options():
parser = argparse.ArgumentParser(description='EDSR and MDSR')
parser.add_argument('--mod... |
7d84bca889d739325eb5c85585082de085c69bb13342f5f39b298817b38cef17 | Python | 6,522 | 154 | from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import (
TYPE_CHECKING,
AbstractSet,
Iterable,
List,
Optional,
)
from pyarrow.fs import FileSystem
from ray.data._internal.datasource_v2.interfaces.file_manifest import FileManifest
from ray.data._internal.datasource... |
c9baae68efa2be15991687161685144410c13df7470e5aba858b77d9ba719960 | Python | 6,524 | 168 | '''
Example of MBEANN in Python solving XOR.
'''
import os
import pickle
import random
import time
import numpy as np
from examples.xor.settings import SettingsEA, SettingsMBEANN
from mbeann.base import Individual, ToolboxMBEANN
from mbeann.visualize import visualizeIndividual
def evaluateIndividual(ind):
# X... |
7c27663ea6eb8d1c4fd4e9135e8340d3e599298e8b1bac359d73a7ff98a30345 | Python | 6,525 | 195 | import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
import pdb
import os
simu_step = 1e-1
##### forward data propagation #####
def propagation_forward_data(E1,E2,gamma,kappa):
Pkd = [E1,E2]
dE1 = simu_step*(1j*0.5*gamma*E1-kappa*E2)/(1j)
dE2... |
7ce1bdd661407557ebcb380c7d6b0c911b9dcb51d60bf0f1e2219d85b955a54d | Python | 6,525 | 177 | from torch.utils.data import get_worker_info
import monai
from monai.data import Dataset, IterableDataset
from monai.transforms import apply_transform
from monai.transforms.transform import Randomizable
from typing import Dict, Optional, Tuple, Type, Union, Sequence, IO, TYPE_CHECKING, Any, Callable, List
import rando... |
bd5b6c27a6e40ebeb390a2ce22c0f7bfb740619f6ab361aebffb5b5b0b3fe727 | Python | 6,525 | 237 | import argparse
import os
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import pdb
from PIL import Image
from scipy.io import loadmat
from torch.autograd import Variable
from torchvision import transforms
from pascal import VOCSegmentation
from cityscapes import Cityscapes
from DM ... |
96b1a0d9aee8115312ed107befee67e7d7727f7df3ba8ca2711ee9ef402f5671 | Python | 6,528 | 199 | import mrcfile
import numpy as np
def compute_mean_std(data):
"""
Compute mean and standard deviation of a given image file.
Parameters
----------
data : array(float)
The data.
Returns
-------
float
mean
float
standard deviation
"""
mea... |
04c1026ef72f50e747948aa8080e1e41fe7457eadbe819e96607f86485f1b562 | Python | 6,531 | 181 | # 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... |
1f7ab908dd6bb2029f9c33b1587a2a9c7b9d102bfbfd9c25a7b1f075bd2f57fd | Python | 6,532 | 185 | import shutil
from typing import Dict, List, Optional, Union
from tensorflow.keras.callbacks import Callback as KerasCallback
import ray
from ray.train.tensorflow import TensorflowCheckpoint
from ray.util.annotations import PublicAPI
class _Callback(KerasCallback):
"""Base class for Air's Keras callbacks."""
... |
910b1b3b274f9106f2f5d693f7b9410245f5bb4c81deacf5d4b1f7877df07217 | Python | 6,535 | 184 | import io
import pathlib
from typing import Any, Dict, Union
import h5py
import numpy as np
import nir
def _read_metadata(node: Any) -> Dict[str, Any]:
if "metadata" in node.keys():
return {"metadata": {k: v[()] for k, v in node["metadata"].items()}}
else:
return {}
def try_byte_to_str(a: ... |
f319ba1cd332d5ee4e38e6b3403dbd9a88026e0833732d38dbf6136890edf8b4 | Python | 6,536 | 182 | import os
import numpy as np
import tensorflow as tf
from spinnaker2.mla import mla_helpers, mla_config
from spinnaker2.mla import conv2d as c2d
from spinnaker2.configuration import PEConfig, ExperimentConfig, MemoryRegion, Experiment
from spinnaker2.coordinates import ByteAddr, WordAddr, PE
import spinnaker2.hardware... |
d92cfd30a43c92f86ebf4777ae493d269c05c29240b4cae85d943e566dd193f5 | Python | 6,537 | 138 | import tensorflow as tf
from tensorflow.keras.layers import Input
from projectmetis.python.models.model_def import ModelDef
class BrainAge2DCNN(ModelDef):
# Def for standard conv block:
# 1. Conv (3x3) + relu
# 2. Conv (3x3)
# 3. Batch normalization
# 4. Relu
# 5. Maxpool (3x3)
# Model ... |
8967699fcb7ca0b9eb5dbf0aaa221c3fbee63730b40522ebabfa2e060b312414 | Python | 6,541 | 177 | """
Imputation for sequence data.
"""
import pandas as pd
import numpy as np
def interpolate_imputation(sequence_data, feature_median, feature_list):
"""
Imputation based on pandas' interpolate method.
:param sequence_data: key: PATNO, value: data matrix
:param feature_median: median of each feature
... |
d232f8958cac9c9083c513199328b8ba754a0334a535eff317463f80536933ba | Python | 6,541 | 176 | """
Module for creating and executing SASSI and STAGG runs, asynchoronously
***
built as part of the Russell Ray Lab Breathing And Physiology Analysis Pipeline
***
Breathe Easy - an automated waveform analysis pipeline
Copyright (C) 2022
Savannah Lusk, Andersen Chang,
Avery Twitchell-Heyne, Shaun Fattig,
Christoph... |
dbd31c53199e77a5b9438549febdc8325d6d076e7158aed3f6afbd1285b4a600 | Python | 6,541 | 210 | # Copyright (C) CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from collections.abc import Callable
from pathlib import Path
from zipfile import ZipFile
import pytest
from cvat_sdk import Client
from cvat_sdk.api_client import models
from cvat_sdk.core.proxies.types import Location
from PIL import Image
from r... |
6779af6539df05868f33847c787f249395fdf106d5da7ec0a5bbb1f5ba62291c | Python | 6,543 | 191 | """LQIT provides 17 registry nodes to support using modules across projects.
Each node is a child of the root registry in MMEngine.
If you want to use a codebase in OpenMMLab 2.0 series, it is suggested to
rigister your modules in the corresponding codebase registry node.
For example, if you want to use MMDetection an... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.