sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
2414ea8bea673723f091fcd32daad6f1611f1ff655d00203ad94437a9b0c628a | Python | 3,511 | 107 | import pytest
from tests.hw_utils import (
find_open_devices,
get_ones_network,
is_any_samna_device_connected,
reset_all_connected_boards,
)
import sinabs
import sinabs.backend.dynapcnn as sdl
@pytest.mark.skipif(
not is_any_samna_device_connected(), reason="No samna device found!"
)
def test_dep... |
526bdb957959b88ef4d3b81ba0a269bb271e6b60596620b3a76e65a60ad3d331 | Python | 3,512 | 90 | import rbo
import torch
# Weighted Mean Square Error
def weighted_mse_loss(pred, target, weight=None):
if weight is None:
return torch.square(torch.sub(pred, target))
else:
return torch.mul(weight, torch.square(torch.sub(pred, target)))
# Weighted Root Mean Square Error
def weig... |
2b709e52ce06715191e374b7011cec8336ae0de88b5298692107a0d03e577d98 | Python | 3,513 | 76 | import re
import sys
import os
# polyA
colname = ["", "base_s", "base_p", "exon_s", "exon_p", "intron_s", "intron_p", "intron_chain_s", "intron_chain_p", "transcript_s", "transcript_p", "locus_s", "locus_p", "matching_intron_chain", "matching_transcripts", "matching_loci", "missed_exons", "novel_exons", "missed_intron... |
780ed24e85bd7e2ec195530bbff6131f0d3432792a9e5b72da39b695db8ec3a7 | Python | 3,513 | 103 | import argparse
import os
import logging
import json
import boto3
import pandas as pd
dynamo = boto3.client("dynamodb")
s3 = boto3.client("s3")
def scan_all(*args, **kwargs):
"""Scan all rows of a dynamo table
"""
last_key = "tmp"
results = []
while last_key:
last_key = {}
if las... |
c9f87662f54e92a1d2d8e14f9f03ceb3e7b56081ac829ac74e6462f2ff2d3c0a | Python | 3,513 | 121 | import logging
from dataclasses import dataclass
from enum import Enum
from typing import Optional
import torch
import torch.nn as nn
from pokeformer.nn.dist_embeds import GaussianEmbedding
from pokeformer.nn.graph_head import GraphHead
from pokeformer.nn.graph_transformer import GraphTransformer
from torch_geometric.... |
ed8b41932a4f494b20cda4592a5eae63b29e2cb68b6010fd59bc050471fce13a | Python | 3,513 | 69 | from IsoNet.models.unet.blocks import conv_blocks, activation_my, decoder_block
from tensorflow.keras.layers import MaxPooling2D, UpSampling2D, MaxPooling3D, UpSampling3D, AveragePooling3D,Conv2D,Add,Conv2DTranspose,Conv3D,Conv3DTranspose,Dropout,BatchNormalization,Activation,LeakyReLU
from tensorflow.keras.layers impo... |
c0b9cffb5e03a614f76cd801045b7cdba93cb2a4e3ca1f9b8b118c90e23a3a93 | Python | 3,514 | 99 |
import numpy
import abberior
import yaml
import os
from abberior import microscope
from .general import GeneralMicroscope
class AbberiorConfigurator:
"""
Configuration of an Abberior microscope.
This class is used to configure the microscope settings for a given measurement.
"""
def __init__(se... |
5ab5fba708595c7ed7dee9e2cb3eef730462108a90be997f94afc3853c412828 | Python | 3,516 | 94 | import os
import pandas as pd
from src.commons.process_dataframe import keep_valid_columns, insert_new_col_from_two_cols, \
get_sub_df_according2col_value, get_mean, get_std, insert_new_col
from src.commons.process_number import get_deviation, get_percent_change
from src.constants.ms2_mix_uniform_3_constants impo... |
fcf75dbac74b5fbd0235774bcdcd17c5172c82670cb92f469ad5582214e73b94 | Python | 3,516 | 80 | ####################################################################################################
# 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... |
a47d9b40e05c5da371852a6c233dd0fb896d6fa012702d27cbf9c15474cbc57b | Python | 3,518 | 122 | from dataclasses import dataclass, field
import numpy as np
import math
@dataclass
class MatMulConfig(object):
"""
Matrix multiplication config for the machine learning accelerator.
"""
op_a_addr: int = 0x8000
op_b_addr: int = 0x9000
target_addr: int = 0x10000
op_a_use_noc: bool = False
... |
0a5636359c78c5788116b5642da604c46996a5fac13347fe1ed4ccecb97f7cd8 | Python | 3,519 | 110 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Session handler for the AIHW Composer API."""
from typing import Any, Text, Union, TYPE_CHECKING
from requests import HTTPError, Session
import urllib3
from... |
8cb5581b74f4d8cf938a6cba5a785ac0b61cd0659c1ad1aec47b90902613ef1a | Python | 3,519 | 115 | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 30 12:57:17 2023
@author: Leyang Xue
"""
import sys
import numpy as np
import matplotlib.pyplot as plt
# Add package path
packagepath = '../kcorePercolation' # Manually specify the path to your script
sys.path.append(packagepath)
from utils import kcorePercolation as kp... |
d607aa5fe7141f5338189b761dbc6bdb9a9c05cd3e3021d1e4e2f41331093691 | Python | 3,519 | 93 | import torch as th
import numpy as np
class CustomBatch:
"""
Custom collate function for returning formatted batches
"""
def __init__(self, data):
transposed_data = list(zip(*data))
S = th.stack(transposed_data[0], 0)[:,0]
U = th.stack(transposed_data[1], 0)[:,0]
... |
d0c3159b6a00f90fc4270bb66a534d47d5b3fbcbaa868368d8ff25f2854a4755 | Python | 3,520 | 111 | import numpy as np
import torch
from basetest_training import _TestTraining
from torch import nn
from pfrl import replay_buffers
from pfrl.envs.abc import ABC
from pfrl.explorers.epsilon_greedy import LinearDecayEpsilonGreedy
from pfrl.nn import BoundByTanh, ConcatObsAndAction, RecurrentSequential
from pfrl.policies i... |
ee5b15985035e3db1fb4054fba125c11d3400a81eaa413838f7e351b69a60f99 | Python | 3,520 | 103 | import os
import sys
import pytest
from ray.dashboard.modules.dashboard_sdk import (
parse_cluster_info,
parse_runtime_env_args,
)
class TestParseRuntimeEnvArgs:
@pytest.mark.skipif(
sys.platform == "win32", reason="File path incorrect on Windows."
)
def test_runtime_env_valid(self):
... |
be99ddc779d897433f542861523dc396f937b71f0ee715af1b7830fd637452fe | Python | 3,521 | 107 | import argparse
import os
import mmcv
from mmdet.apis import inference_detector, init_detector
from mmengine import Config, DictAction
from mmengine.utils import ProgressBar
from lqit.registry import VISUALIZERS
from lqit.utils.misc import get_file_list
def parse_args():
parser = argparse.ArgumentParser(descrip... |
307bec33c6b9739ba41e41f9f4e55853401e8af55e360767f5382a6f4ed63ad5 | Python | 3,523 | 138 | from typing import Set, Tuple, Type
default_invalid_structure_string = (
"Invalid structure found. This is most likely due to an unsupported SNN "
"architecture. In general, a DynapCNN network should consist of groups of "
"a weight layer (conv or linear), a spiking layer (IAFSqueeze), and "
"optionall... |
5fde4f2851b93e3fb055bda95e959be4b2e87e31280d7565291c108a30edb1c8 | Python | 3,524 | 116 |
"""
Created on: 03/18/2014
Updated on: 05/19/2017
@author: Dorjee Gyaltsen
@brief: antibody epitope prediction - standalone version
"""
import os
import sys
from argparse import ArgumentParser
# adding dependencies to the Python path
project_dir = os.path.dirname(os.path.realpath(__file__))
deps = os.path.join(pro... |
c85e2a67845442d160593ee17f548caaf8ed8ab477afb0ac3993625be18eba99 | Python | 3,525 | 121 | import math
import random
import numpy as np
from torch.utils.data import DataLoader, Dataset
import scanpy as sc
import torch
import sys
sys.path.append('..')
from ..VAE.VAE_model import VAE
from sklearn.preprocessing import LabelEncoder
def stabilize(expression_matrix):
''' Use Anscombes approximation to varia... |
690db9650d4dcce4b2534343c613843b1c8d610fcd2ff646fbf3f705a6fd5444 | Python | 3,527 | 96 | # Thanks to https://github.com/HanxunH/Active-Passive-Losses/blob/master/loss.py
from turtle import forward
import torch
import torch.nn.functional as F
class NegEntropy(object):
def __call__(self,outputs):
probs = torch.softmax(outputs, dim=1)
return torch.mean(torch.sum(probs.log()*probs, dim=1)... |
911f78a475d68a4600465ce1c0b4853542e734e38846f3e4897d055eb655d0cf | Python | 3,528 | 73 | import requests
from .__config import base_url
from .__aux_funcs import process_response
def fetch_generic_assay_meta(generic_assay_stable_ids=None, molecular_profile_ids=None, projection="SUMMARY"):
"""
Fetch meta data for generic assays based on a filter. \n
:param generic_assay_stable_ids: List of Stabl... |
661dc423a19a2889fe1e05dd09fe5bf1e95eb3481e89d1cb878b542d689231c6 | Python | 3,529 | 110 | import torch
from ntd.modules import SLConv
from ntd.networks import CatConv, AdaConv
class TestSLConv:
def randn_test(self, padding_mode):
test_layer = SLConv(
kernel_size=64,
num_channels=100,
num_scales=3,
heads=3,
padding_mode=padding_mode,
... |
61d82327e97930f95095065164d76adcd40e3b86df4fa9cada61917958b47c6a | Python | 3,530 | 92 | r"""Internal helpers shared by the ``ov.epi`` wrappers.
``ov.epi`` is a thin bridge over the `epione
<https://github.com/aristoteleo/epione>`_ epigenomics package: every
public function imports :mod:`epione` *inside* the call and delegates to
the matching ``epione`` symbol. Keeping the import inside the function
(rath... |
9a0f999f3cfc9bdd398c59c8d79e6a293872e15549728c4d519afb04bc8b7447 | Python | 3,530 | 103 | import pdb
import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import (
entropy,
wasserstein_distance
)
from geomloss import SamplesLoss
import torch
Loss = SamplesLoss("sinkhorn", blur=0.05,)
TEST_CASE = 'multi_phase_pipeflow_with_leak'
HIGH_FIDELITY_MODEL_TYPE = 'PDE'
HIGH_FIDELITY_NUM_PART... |
3aaf639fef51bed98ca4dffb26ab967fb8cc55333a0c6dc609c9104cfd50ac6e | Python | 3,531 | 151 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 3 08:54:14 2022
@author: sam
"""
import numpy as np
import os
import numpy as np
import tensorflow as tf
import keras
from keras import backend as K
import matplotlib.pyplot as plt
import pickle
def check(f, requirements):
for r in requirement... |
c4db0ec53080e83b229181769c795a16472e5a9a9d28e6f0e278bdde774217a5 | Python | 3,531 | 122 | # CanonicalProperties.py
# Copyright (c) 2010 Jes Frellsen
#
# This file is part of Muninn.
#
# Muninn is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# Muninn is distributed in the hope that it wi... |
ca2b176652cdc11f03ec5456e0a8ac838b668a996d279ea6855ae5091a300fc2 | Python | 3,534 | 106 | """
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.
Tests: pretrained_mlip.resolve_checkpoint name-vs-path dispatch without
network access (Hugging Face downloads are mocked).
"""
from ... |
cd7201b358107fcf1ba1f1a41c1c778a296a16439530fc63a56e28916b9e3d1d | Python | 3,534 | 87 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Read in all participants with ICA-FIX 3T resting-state data, then isolate
participants who have all four scans. Use the HCP1200 data dictionary to
isolate participants who have all 10 cognitive test scores of interest. Retrieve
the mean relative FD for each participan... |
20026c1b0db0f61ed773ecfb062a01d63f9b1ad7b5b1ca3fd2d13febe95fb366 | Python | 3,535 | 89 | ###################################################################################################
# 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 free... |
5ea484c5ab0695cfbfe154b12518799d0db2ecce3f6144680d96dd953477e9bb | Python | 3,536 | 84 | """
Created on 03/03/23
@author: dimiboeckaerts
PROPHAGE RBP DETECTION & CLUSTERING
"""
# 0 - LIBRARIES
# --------------------------------------------------
import os
import json
import subprocess
import numpy as np
import pandas as pd
# 1 - FUNCTIONS
# --------------------------------------------------
def cdhit_... |
4186af331ace0ac724e3eda6add473ce3bce357795683dc48fcb4b1709bce6e2 | Python | 3,537 | 141 | # __create_pg_start__
from pprint import pprint
import time
# Import placement group APIs.
from ray.util.placement_group import (
placement_group,
placement_group_table,
remove_placement_group,
)
from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy
# Initialize Ray.
import ray
# Cr... |
039817bf5bb9af69b8db62935dcae01e6dc0cf59d5b955d2a54e15ba80952bfc | Python | 3,538 | 86 | """
Created on Sun May 30 19:40:39 2021
@author: trmabdelaal
"""
import scvelo as scv
import scanpy as sc
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from sklearn.metrics.cluster import contingency_matrix
from sklearn.metrics import f1_score
import s... |
ae5ee057d0f81845e31653953159292b5c422e4fcb89bff447042bf96128f4e9 | Python | 3,539 | 58 | import numpy as np, pandas as pd, json, sys
from scipy.optimize import minimize
from scipy.special import gammaln, expit
import os
F=os.environ.get('FRICKE_XLS', os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'data', 'Fricke_et_al_combined_raw_data.xls'))
v=pd.read_excel(F,sheet_name='1. virgin female d... |
a87b393b66b661e13bcaf7d4fbea4c3c00be57f1436dee0bae6c21c480c0dd8c | Python | 3,540 | 102 | """
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.
Tests for SphericalSmearing class.
"""
from __future__ import annotations
import numpy as np
import pytest
import torch
from fairchem.core.m... |
aba13a494a9629586a02f8d6657a38549fab1128080b8d2a9042e21aaae4e990 | Python | 3,540 | 103 | """This module is meant to test a real use case.
It will include testing of the network equivalence, and of the correct output configuration.
"""
import pytest
import samna
import torch
from nirtorch.utils import sanitize_name
from torch import nn
from sinabs.backend.dynapcnn.dynapcnn_network import DynapcnnNetwork
... |
8594a8ecd960edf7c81822fbae33d4a85d39d62d5bcb19ab6c7dd79823244601 | Python | 3,541 | 88 | ########################################################
######### Philipp R. Steen #########
######### Jungmann Lab #########
######### Max Planck Institute of Biochemistry #########
######### Ludwig Maximilian University #########
######### 2024 ... |
7985d3894030cbd368a327ff17e7da646bc4a2b6f88a9e716edc6b8c23aebea5 | Python | 3,542 | 117 | #!/usr/bin/env python
# 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 a... |
fb5e28c9b24f0a820897a64302771ca83605a5b21a295b867736bb8227ea8048 | Python | 3,542 | 87 | import matplotlib.pyplot as plt
import pandas as pd
import sys
import seaborn as sns
import numpy as np
def main(argv):
num_ls = []
num_ls_cleaned = []
for sample in argv:
print("sample: ", sample)
discard_file="/Users/chaokuan-hao/Documents/Projects/PR_SPLAM/results/800bp/"+sample+"/OUTP... |
081edeb98f8b129e4d4ba11a7a8e481471ee29170fbd2b9149c5fcfa9cb67ee7 | Python | 3,543 | 93 | # Usage: python predict_no_y.py number_of_separation NEPDF_pathway model_pathway
# command line in developer's linux machine :
# python predict_no_y.py 9 /home/yey3/cnn_project/code3/NEPDF_data /home/yey3/cnn_project/code3/trained_model/models/KEGG_keras_cnn_trained_model_shallow2.h5
from __future__ import print... |
786cc7ce78c25e69eb60113064db117782753d7e4fe864da6a1cacaaa6a034a5 | Python | 3,543 | 86 | from neuron_morphology.constants import (
AXON, BASAL_DENDRITE, APICAL_DENDRITE
)
# Feature Extractor, marks, and specializations
from neuron_morphology.feature_extractor.data import Data
from neuron_morphology.feature_extractor.marked_feature import (
marked, specialize, nested_specialize
)
from neuron_morpho... |
c2c40c0efb94a63c74837ba6982bfc9e2cc8dab558acc0fec324c43a291f90d0 | Python | 3,544 | 123 | import pdb
import yaml
from yaml.loader import SafeLoader
import torch
import matplotlib.pyplot as plt
from latent_time_stepping.datasets.FNO_time_stepping_dataset import FNOTimeSteppingDataset
from latent_time_stepping.oracle import ObjectStorageClientWrapper
from latent_time_stepping.time_stepping_models.FNO_time_ste... |
f3c2654ed821b3e98ec577619e3d535489dd6a367af1ff87c13c5d2865a95191 | Python | 3,544 | 120 |
import numpy
import random
import sys
import torch
sys.path.insert(0, "..")
import matplotlib
matplotlib.use("macosx")
from sklearn.preprocessing import PolynomialFeatures
from matplotlib import pyplot
from scipy import stats
from banditopt import algorithms
# numpy.random.seed(42)
# random.seed(42)
class Sampler:... |
85e1266a5b07c1ad244274bc26be4ff6f63209b79e9deda3a9aee4bda9d2d712 | Python | 3,545 | 136 | # flake8: noqa
# isort: skip_file
from pathlib import Path
import tempfile
import ray.train
from ray.train.v2.api.data_parallel_trainer import DataParallelTrainer
def train_fn(config):
for i in range(3):
with tempfile.TemporaryDirectory() as temp_checkpoint_dir:
Path(temp_checkpoint_dir).joi... |
200ddc0d7e254280fa047c50ebb7fba1f0948cf4c7c3c467897166f63fb582d1 | Python | 3,546 | 102 | import skorch
import numpy as np
import torch
from torch.autograd import Variable
from sklearn.metrics import f1_score
class Net(skorch.NeuralNet):
def __init__(
self,
criterion=torch.nn.CrossEntropyLoss,
clip=0.25,
lr=20,
ntokens=10000,
*ar... |
dff0a0f253d12a02f5570d70ec867d325402fbf1cb35d44dea12248a1af453aa | Python | 3,546 | 117 | import unittest
import shutil
import tempfile
import os
import numpy as np
import pandas as pd
from neuron_morphology.feature_extractor.feature_extraction_run import \
FeatureExtractionRun
import neuron_morphology.feature_extractor.feature_writer as fw
from neuron_morphology.features.layer.layer_histogram import ... |
8b95900518b5cd091dc67e632c257cdb60da61a65a9568b80146cf9d27f34aa1 | Python | 3,547 | 109 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
Count the instances of each SVTYPE observed in each sample in a VCF.
A record is only counted towards a sample's total if the sample received a
non-reference (0/0) or a non-null (./.) call. Records without an annotated
SVTYPE in the INFO field are counted as "NO_SVT... |
be64df030450d97bc99bc654c4664c52cf00c3d78ab802cd3d82a6cef67e5ad0 | Python | 3,549 | 122 | import argparse
import os
import shutil
import numpy as np
import cv2
import time
import pickle
from Xavier_SpeedTest_folder_function import imageProcessor
import torch
import os
def processResult(imgProcessor,img_folder,row_segmentation,output_dir,mask_output_dir,effectiveImgList=None):
isOutput = mask_outpu... |
28cd261e54018b40cd9df44d2a031fb4d0f8f6dc3657c5838c10e376509fa829 | Python | 3,550 | 89 | import os
import pickle
import sys
import numpy as np
# with open("./spliceai_result_"+SPLICEAI_VERSION+"/"+output_file+"/d_scores_"+TYPE+".pkl", 'rb') as fw:
# pickle.dump(donor_scores, fw)
# with open("./spliceai_result_"+SPLICEAI_VERSION+"/"+output_file+"/a_scores_"+TYPE+".pkl", 'rb') as fw:
# pickle.dump(... |
8b045afe11b8bc129f00ead1c63749b10b9bc05c49ee46bf92000db0162a4186 | Python | 3,550 | 132 | # -*- coding: utf-8 -*-
"""Test the contents of the vtkplotlib.image_io module."""
import numpy as np
import os, sys
from pathlib import Path
import pytest
import vtkplotlib as vpl
from tests._common import TEST_DIR
import io
pytestmark = pytest.mark.order(2)
def test_trim_image():
fig = vpl.figure()
#... |
d506039e49fb3cf9a1982e93298ed8422f331e8b603cfe3c508489750cb0423c | Python | 3,550 | 111 | #!/usr/bin/env python
from __future__ import print_function
# batteries
import sys
import gzip
import argparse
import logging
from time import time
# 3rd party
from lxml import etree
# argparse
desc = 'Convert UniRef XML to a uniref50 <=> uniref50 index'
epi = """DESCRIPTION:
Simple code to extract the cluster relati... |
f5cac1c9ab187ba8497632e4cb0ca6093dab0ca5464b0de0d31223030650973e | Python | 3,551 | 105 | from typing import List, Optional, Tuple, Union
import numpy as np
import torch
import torch.nn as nn
from sinabs.cnnutils import conv_output_size
# - Type alias for array-like objects
ArrayLike = Union[np.ndarray, List, Tuple]
class SpikingMaxPooling2dLayer(nn.Module):
"""Torch implementation of SpikingMaxPoo... |
2b1ad790cba23f85b4759e56e47f9bd0ed816b95b252f385ab408c0c9a45e46d | Python | 3,552 | 87 |
import os
import numpy as np
import tensorflow as tf
import keras
from keras import backend as K
import matplotlib.pyplot as plt
from model import reduce_and_lock_diffusion
from keras_dynamicLayers_RNNcell_dualModel import rnnCell_dualNet_ as rnnCell_
from model import trainableInput
from prep_data import prep_data
d... |
64d1199e3d8df895f7e81aedfe096c4f927458bd4b7856708946a88cb1525e2e | Python | 3,552 | 82 | import os,sys
import time, re
import pickle as pk
from datetime import datetime
import numpy as np
import pandas as pd
from operator import itemgetter
import scipy
from scipy import sparse
import scanpy as sc
import collections
import multiprocessing
import configparser
import tracemalloc
import warnings
import importl... |
93766ff2f3d3fb27f10155d949674ad9930df9e0e942efdce60e311dbd0dc22f | Python | 3,552 | 105 | ''' Wrapper functions to use SpatialDE directly on AnnData objects
'''
import logging
import pandas as pd
#import NaiveDE
from .aeh import spatial_patterns
from .base import run
from .util import qvalue
def spatialde_test(adata, coord_columns=['x', 'y'], regress_formula='np.log(total_counts)'):
''' Run the Spat... |
a78d6c20a8ffa550a857e0462ab7a65b56b9c7a409149699a39a45e4dcb7f259 | Python | 3,555 | 91 | # 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... |
d8f0758a2d376f55f80f6cbbd5a3c165b18b300e580eea81c636e5d2cd6bcc41 | Python | 3,555 | 119 | '''
Configs for training & testing
Written by Whalechen
'''
import argparse
def parse_opts():
parser = argparse.ArgumentParser()
parser.add_argument(
'--data_root',
default='./data',
type=str,
help='Root directory path of data')
parser.add_argument(
'--img_list',
... |
2306cb3d59310e24d7efb1d5fc755e6011b6cb91bf4e29cca2dce1382e9476f5 | Python | 3,556 | 107 | """
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.
File MD5 sums cached in ``md5sum``-compatible sidecar files.
"""
from __future__ import annotations
import contextlib
import hashlib
import l... |
9744a5c19088736584f1cf493f06c47f07b6f0f8dcf4fbfad00887422c72de64 | Python | 3,556 | 115 | import os
import io
import av
import itertools
import lmdb
import numpy as np
import pandas as pd
from PIL import ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True
from ml4ht.data.data_description import DataDescription
VIEW_OPTION_KEY = 'view'
metadata_elements = [
'PhotometricInterpretation',
'TransferS... |
adde85097bd3f04c4dfb896fa8fec3b0d682375c6c32ab20372ec49fc379ad8d | Python | 3,558 | 111 | """
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
from typing import TYPE_CHECKING
import torch
import torch.nn as nn
if TYPE_CHECKING:
from fairch... |
2865269b6b6b1306a26a5930ae7c0fc1970851671c23e8d1d6824c8706f8b5c7 | Python | 3,559 | 94 | import tensorflow as tf
from models.deep_learning.deep_learning_models import DLRegressor
from utils.constants import is_spline
class ConvGRURegressor(DLRegressor):
"""
This is a class implementing the ConvGRU model for time series regression.
! Remember to use regularization techniques such as dropout, w... |
66a64bdb4f0033fead895c64dced6e4f746a7c0b8f23b00f353d932c127c9cd6 | Python | 3,559 | 126 | import sys
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.Alphabet import generic_dna
from Bio import SeqIO
import vcf
import os
def main():
args = parse_args()
seqs = iter_refs( args.vcffile, args.fastaid )
write_fasta( seqs, args.output_file )
def write_fasta( records, outputfile )... |
fa57db25f39ac60e5ac69864c8d34c1212f487aa58a3b1d520fdea1918a3f6de | Python | 3,559 | 140 | import cc3d
from tqdm import tqdm
import numpy as np
import crackle
import time
import gzip
def prettyprint(tm, voxels):
print("{:.2f} sec. {:.2f} MVx/sec".format(tm, voxels / tm / (1000*1000)))
def summary(times, voxels):
times = times[1:]
mean = sum(times) / float(len(times))
print("mean:")
prettyprint(m... |
1f3bdfe0cf9fce3a5fbc5b68fdd5b517f676d3aa54b5d1d61cffaaefa5f8f2a2 | Python | 3,561 | 84 | import numpy as np
from sklearn.linear_model import LinearRegression
import copy
import logging
log = logging.getLogger(__name__)
def regress_state(rec, state_sigs=['behavior', 'pupil'], regress=None):
"""
Remove first order effects of given state variable(s). Idea is to model all state
variables, for e... |
3f9b8889c4f2eaf9abd46e7e2a86fc31d4104c0502861f20b8236f80f1cff9f9 | Python | 3,561 | 81 | import os
import json
import numpy as np
import matplotlib.pyplot as plt
import nibabel as nib
pars = ['D','f','vd']
plot_par = {'D':'$D$','f':' $f$ ','vd':'$v_d$'}
units = {'D':'µm$^2$/ms','f':'%','vd':'mm/s'}
scale = {'D':1000,'f':100,'vd':1}
plot_range = {'D':[0,2],'f':[0,10],'vd':[0,5]}
yticks = {'D':4,'f':4,'vd':... |
98567f2170d03b6d694c137ad1ccf87ec3fb5c54470e6b31a778da97d2d80e5a | Python | 3,561 | 100 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import xml.etree.ElementTree as ET
from typing import List, Optional, Union
import mmcv
from mmdet.datasets import XMLDataset
from mmengine.fileio import get, get_local_path, load
from mmengine.utils import is_abs
from lqit.registry import DATASETS... |
0bb329c645b00df02afc7d6978a35a2293cc7b9d993d3d2b3fba275c6fcabb45 | Python | 3,562 | 102 | """End-to-end phylogeny builder: ASV FASTA → MAFFT → FastTree → newick string.
Chains :func:`omicverse.alignment.mafft` and :func:`omicverse.alignment.fasttree`
and returns both the on-disk paths and the in-memory newick text ready to
drop into ``adata.uns['tree']``.
"""
from __future__ import annotations
import re
f... |
eeefbaab5de8c1305af8e1eb27b227c1a22794a40880526911149492bc59c5aa | Python | 3,564 | 49 | from importlib.metadata import distribution, PackageNotFoundError
import json
import pathlib
import subprocess
import sys
import time
import warnings
package = distribution("candycrunch")
__version__ = package.version
# CandyCrunch's dev version follows glycowork's dev branch, whose version stays the same over... |
fdc5929b4323dc2a47596c37f812b0f26d51eeaea132b96811dae26841b2c28a | Python | 3,564 | 80 | ####################################################################################################
# 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... |
7bc58798b04d7b73fd25dc89337022af6f0e97e6b85052f64fb3e3ebbdcbcb1b | Python | 3,565 | 130 | import base64
import io
import sys
from typing import List
from unittest import mock
import pytest
from ci.ray_ci.utils import (
chunk_into_n,
ecr_docker_login,
filter_tests,
get_flaky_test_names,
)
from ray_release.test import Test
def test_chunk_into_n() -> None:
assert chunk_into_n([1, 2, 3,... |
92ba56dca1f6851480cb948969a3f196af4a4b89af18fc38c7f5c13665402547 | Python | 3,565 | 140 | import os
import subprocess
seed_list = [1111, 2222, 3333, 4444, 5555]
snn_ratio = [0.0625, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 0.9375]
log_folder_path = "./log/"
dataset = "dvsGesture"
rnn_type = "rnn"
def extract_one_performance(model, seed, ratio=None):
if model == "rnn" or model == "lstm" or model... |
0906abad308cacb7f03797e33aa81a5f3bb08abfb66dd22ee1145f8102883bbf | Python | 3,566 | 135 | import json
import numpy as np
from pathlib import Path
from eeg_utils import EEGLoader, EEGDownSegmenter
from utils import parse_arguments
import mne
mne.set_log_level('WARNING')
def run_eeg_preprocessing(
raw_dir: Path,
out_dir: Path,
file_extension: str,
default_subjects: list,
IC_dict: dict,
... |
c008770a48b36d3f16f5fc9040a4954c744421514b48e9ed4ec94d6eb5534291 | Python | 3,566 | 127 | import argparse
import os
import subprocess
import sys
import time
from collections import OrderedDict
import requests
from aws_requests_auth.boto_utils import BotoAWSRequestsAuth
def retry(f):
def inner():
resp = None
for _ in range(5):
resp = f()
print("Getting Presigned... |
dcda3bee5dcd615184b023f12feab44fe9c02c07f9176a20f66f4c69948e7666 | Python | 3,566 | 41 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: onnx_common.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_p... |
25d63600bcae85c5c9756647af9940b41e2a18638be55833ed95696c1b04dce8 | Python | 3,567 | 93 | # -*- coding: utf-8 -*-
####################################################################################################
# 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>
#
# Th... |
2aa686505ceba9abfddb46dd94f5f4b9ddcbd710843e8d661af9fe7560bb1959 | Python | 3,567 | 107 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
# Copyright (c) 2021 Qualcomm Technologies, Inc.
# All Rights Reserved.
# mypy: disable-error-code=attr-defined
# pylint: disable=not-callable
"""Basic quantiz... |
5dec695ad1c89180f99edcea6b6789d36322081dc777c690ad681c4069de10f9 | Python | 3,568 | 117 | from __future__ import annotations
import glob
import logging
import os
import pandas as pd
logger = logging.getLogger(__name__)
def _read_sumstats(fh, alleles=False, dropna=False):
"""Parse GWAS summary statistics."""
compression = None
if str(fh).endswith("gz"):
compression = "gzip"
elif... |
6093a13f07659099c42e07dd8dfd4ebefa13a4a856ccfc3650bdb23d85e171a2 | Python | 3,568 | 90 | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 23 10:21:00 2020
@author: ju-bar
Routines for Thon ring analysis.
This code is part of the 'emilys' repository
https://github.com/ju-bar/emilys
published under the GNU General Publishing License, version 3
"""
import numpy as np
from emilys.image.polar import polar_resa... |
7505a99990921e29c0f4238705a42cf56fd393ab98283c734eec6095fe06174c | Python | 3,568 | 149 | """
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.
Creates LMDB files with extracted graph features from provided *.extxyz files
for the S2EF task.
"""
from __future__ import annotations
impor... |
e7e26fa8753e718904a6e990a717bb4aff607c208abe1812b4f72bf26f392df4 | Python | 3,568 | 100 | """Test LEF main"""
import json
import tempfile
import unittest
from pathlib import Path
import pandas as pd
from lefshift import constants
from lefshift.__main__ import get_args, call_subtool
class MainTests(unittest.TestCase):
"""Test LEF main"""
def test_predict(self):
"""Test prediction"""
... |
6f9efa98a6926f96c6065f02cf313aa05c999b5475eb1852c509a3d909927fbc | Python | 3,569 | 99 | import random
import unittest
import torch
from rising.loading import DataLoader
from rising.random import UniformParameter
from rising.transforms import Mirror, ProgressiveResize, ResizeNative, Rot90, SizeStepScheduler, Zoom
from rising.transforms.functional import resize_native
from tests.transforms import chech_da... |
38516314c3d0d6c68f81e345703efec6a16ec611c22f8c9bf86fa14fbfae8ced | Python | 3,570 | 94 | import torch
import numpy as np
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_to_dst_type
from monai.data import decollate... |
47d94d29c34e4fcf29d78dd49eb8a02abd331371a38a4c84272b5139b6309e31 | Python | 3,570 | 99 | ####################################################################################################
# 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... |
bb9b23109c230d5e4515d08f2a720bc868ed5faa5ad2f25a2f27b75041d90baf | Python | 3,570 | 107 | #!/usr/bin/env python3.7
"""Remove specified files from sample directories.
The copyrights of this software are owned by Duke University. Please
refer to the LICENSE and README.md files for licensing instructions. The
source code can be found on the following GitHub repository:
https://github.com/wmglab-duke/ascent
"... |
f8e82de6d79f912a7e56a86caa4918e71853e2b845b4e550978fbadac882b1fc | Python | 3,570 | 105 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Basic demo for the CaImAn Online algorithm (OnACID) using CNMF initialization.
It demonstrates the construction of the params and online_cnmf objects and
the fit function that is used to run the algorithm.
For a more complete demo check the script demo_OnACID_mesoscope... |
ec10cb914f5a3e7b11f21aeb5b0386083206102399e027a9f80be9f3879a862a | Python | 3,573 | 114 | """
Server-only harness CLI helpers for replay, scenario evaluation, and cleanup.
"""
from __future__ import annotations
import json
import os
from pathlib import Path
from typing import Any, Optional
from .cleanup import HarnessCleaner
from .contracts import ScenarioSpec
from .trace_store import RunTraceStore, Scen... |
def5c0a69dc3c01c3d064d6f4fa9807f7be5caa84030d0c5a20896428d9661b2 | Python | 3,575 | 126 | import os
import sys
import time
import errno
import time
import timeit
import numpy as np
from numba import jit
@jit(nopython=False)
def VEP2Dmodel_sensor(params, constants, init_conditions, SC, Gain, dt, ts):
nt=ts.shape[0]
nn=SC.shape[0]
ns=Gain.shape[0]
#parameters
eta=params[0:nn]
t... |
bb36978a904ce343532ffd5eba8f54df1156230cb91bb111991c852c7a898fce | Python | 3,576 | 115 | # import
## batteries
import os
import re
import sys
import gzip
import glob
import shutil
import argparse
import logging
import urllib.request
import codecs
import tarfile
from collections import OrderedDict
import gtdb2td
## 3rd party
import networkx as nx
from networkx.algorithms.dag import descendants
from network... |
f46968055f3c1bd4a26bcbdb34e5f6b264969b88831b06055c67222b2f4a1d77 | Python | 3,580 | 257 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from allensdk.brain_observatory.ecephys.ecephys_project_cache import EcephysProjectCache
# In[2]:
# this path determines where downloaded data will be stored
manifest_path = os.path.j... |
2b5e90c2c53b98c19c858b1bcc8f8a56be6ae85e90f42d939873e11909be5e14 | Python | 3,581 | 96 | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 28 13:43:00 2022
@author: ju-bar
Differential phase contrast routines
This code is part of the 'emilys' repository
https://github.com/ju-bar/emilys
published under the GNU General Publishing License, version 3
"""
import numpy as np
def dpc_image(a, b, c, d, alpha = 0.... |
1f474fb89927b03046056ea4f7d4bea9a858a3939c092890d376a9ded72906bd | Python | 3,583 | 113 | #!/usr/bin/env python3
"""Example code for using scdemon part of the library."""
# Example - compute co-expression modules using a scanpy anndata object
import os
import logging
import numpy as np
import pandas as pd
import scanpy as sc
import scdemon as sm
from scdemon.utils import recipe_full
from scdemon import plo... |
24f9fe7436962b32f95de130f057fef37d57a3e541ca73b93dd094d611dbf5af | Python | 3,583 | 105 | # 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 hashlib import md5
def pad_1d_tokens(
values,
pad_idx,
left_pad=False,
pad_to_length=None,
pad_to_multiple=1,
):
"""
padding o... |
c1d558553c151b04b8a431c4348e583cf4a2ef87b1fba0eccef4484edb842751 | Python | 3,583 | 127 | """
Train the visual system model using the specified configuration.
This script initializes and runs the training process for the model.
It uses the configuration provided through Hydra to set up the solver, manage the
training process, and handle checkpoints.
Key option defaults:
- `train=true`: Whether to run the... |
12371b0ad0c9d723580c9d84cf4e825dd12d963b4021565b049dacdf10eaf430 | Python | 3,585 | 125 | import time
from pathlib import Path
import numpy as np
import samna
import torch
import torch.nn as nn
from torchvision import datasets
from sinabs.backend.dynapcnn import DynapcnnNetwork
from sinabs.backend.dynapcnn.chip_factory import ChipFactory
from sinabs.backend.dynapcnn.io import close_device
from sinabs.from... |
ae85a36e98906260143ac279f4b65242341d667f6bafd9a34074fd42e56f87e4 | Python | 3,585 | 135 | """Deprecated plotting compatibility wrappers for ``omicverse.utils._plot``."""
from __future__ import annotations
import importlib
import warnings
_REMOVAL_VERSION = "2.2"
def _warn(old_name: str, replacement: str) -> None:
warnings.warn(
f"`ov.utils.{old_name}` is deprecated and will be removed in om... |
f5ffa572febe26394545efdbf1b8a2a7653d39a8aeac437f82301caaf6f383f0 | Python | 3,585 | 102 | #Megaplot data processing
import geopandas as gpd
import glob
import os
import numpy as np
import pandas as pd
from src import CHM
import shapely
def read_files(directory, site=None, config=None):
"""Read shapefiles and return a dict based on site name"""
shapefiles = glob.glob("{}/*.shp".format(directory))
... |
720f816f058421c012083d7b6d6d1ddef1b036050e591e146df8598f62a87765 | Python | 3,586 | 124 | '''
Copy from cellrank
'''
from typing import Any, Dict, Type, Tuple, Literal, Callable
from abc import ABC, ABCMeta
from enum import Enum, EnumMeta
from functools import wraps
_DEFAULT_BACKEND = "loky"
Backend_t = Literal["loky", "multiprocessing", "threading"]
class PrettyEnum(Enum):
r"""Enum with a pretty _... |
36114d824aa5b34bdb9bf91f9ae4abbd279a6504135386608b32a1bdda184728 | Python | 3,587 | 89 | import os
project_root = '/ccb/cybertron/khchao/splam-analysis-results/'
output_dir = f'{project_root}/train/results/tool_benchmark/spliceai/'
def main():
SEQ_LEN = "800"
HALF_SEQ_LEN = int(SEQ_LEN) // 2
QUATER_SEQ_LEN = int(SEQ_LEN) // 4
print("QUATER_SEQ_LEN: ", QUATER_SEQ_LEN)
output_files = [... |
afb604bec27e9630c1527befed4e0c95f6f4cb586fc5b5f03e0fa9380fae884d | Python | 3,587 | 115 | import time
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from config import args
from dataloader import DataLoaderAE
from models import GNN
from torch_geometric.nn import global_mean_pool
from util import NegativeEdge
from datasets import MoleculeDataset
def do_EdgePred(node_rep... |
d364fb8aaac1c4fb5d8807d3cda15ebac5bc08808d5d6399f982a6cd53f8030b | Python | 3,587 | 111 | from typing import Union, Sequence
import numpy as np
from .lattice import Lattice
class Grid(Lattice):
"""
Grid lattice with basis vectors orthogonal to each other and only 1 site in each
unit cell.
"""
def __init__(
self,
extent: Sequence[int],
pbc: Union[bool, Sequence[... |
3b04efeebb0d043b73ad4644b58370d3b4a831816513d349bab9c63fd0d18820 | Python | 3,588 | 114 |
import pdb
import numpy as np
import torch
import matplotlib.pyplot as plt
from data_assimilation.particle_filter.base import BaseLikelihood, BaseObservationOperator
from scipy.stats import norm, multivariate_normal
'''
class NeuralNetworkLikelihood(BaseLikelihood):
def __init__(
self,
observati... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.