sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
1c4cd0dd12f00a08cfd451b8f1d65ab0216a98ecb831716b14ccf3bd668ddb07
Python
838
25
""" Test for issue 388: https://github.com/Data-Centric-AI-Community/data-profiling/issues/388 """ import pytest from data_profiling.controller import console def test_issue388(get_data_file, test_output_dir): console_data = get_data_file( "titanic.csv", "https://raw.githubusercontent.com/datasci...
7704b757d56027821162bd92c079005af73332c3bd2bf98f3a6379db7f90b8c0
Python
838
38
# -*- coding: utf-8 -*- import sys from pathlib import Path # vtkplotlib isn't zip safe and I have no intention of trying to make it so. # Hence, using __file__ instead of (super slow) pkg_resources is fine. from vtkplotlib import __file__ as _init_path DATA_FOLDER = Path(_init_path).with_name("data") MODELS_FOLDE...
8d452080a71209840fcd940b7af20aebc111e164a7bd9fd90de6228bbe95c9aa
Python
840
30
#!/bin/python import sys from collections import defaultdict def count_vids(list_path): counts = defaultdict(lambda: 0) with open(list_path, 'r') as f_list: for path in f_list: with open(path.strip(), 'r') as f: for vid in f: counts[vid.strip()] += 1 ...
daf18fe87d87d5fa88b929be29d6d1aeb46ffab3fc92b80c8824bda8299a1e0b
Python
840
24
from typing import Any, Callable from data_profiling.report.presentation.core.item_renderer import ItemRenderer from data_profiling.report.presentation.core.renderable import Renderable from data_profiling.report.presentation.core.toggle_button import ToggleButton class Collapse(ItemRenderer): def __init__(self,...
f84adf961e975aa850eb13df45ee1308b3d1d9275c85be414da4bfe516c31b01
Python
840
35
import os from typing import Optional import click from ci.ray_ci.automation.update_version_lib import ( get_current_version, update_file_version, ) @click.command() @click.option("--new_version", required=True, type=str) @click.option("--root_dir", required=False, type=str) def main(new_version: str, root_...
9414ea966a88957b7a3783a7c3d5d8cc371b4d118e5c14d73f319eb9b584e585
Python
842
31
from os import path def paragraphs(document): start = 0 for token in document: if token.is_space and token.text.count("\n") > 1: yield document[start:token.i] start = token.i yield document[start:] def unique_terms(entities): seen = set() ents = [] for item in...
81ea74290365dbebbaf872628f76151b843cdbf7faa73dcae31ae257ea9ff053
Python
843
28
import numpy as np def sample_n_k(n, k): """Sample k distinct elements uniformly from range(n)""" if not 0 <= k <= n: raise ValueError("Sample larger than population or is negative") if k == 0: return np.empty((0,), dtype=np.int64) elif 3 * k >= n: return np.random.choice(n, k...
c73d822a0ca23bb2a368ba8d105723b9868bbe032378060abdbb1133e8327418
Python
843
19
from model_dummy_1 import expected_output as expected_output_1 from model_dummy_1 import input_dummy as input_dummy_1 from model_dummy_1 import snn as snn_1 from model_dummy_2 import expected_output as expected_output_2 from model_dummy_2 import input_dummy as input_dummy_2 from model_dummy_2 import snn as snn_2 from m...
86978346437f3c8c118bdbda19ee9f478728a79c8d31668f1b4315dfc719925b
Python
844
31
import os import argparse import numpy as np import torch parser = argparse.ArgumentParser(description='') parser.add_argument('--aptnn', type=str, default='aptnn.torch', help='File name of the trained committee nnp (default: aptnn.torch)') args = parser.parse_args() # Note: This is just to gather information, no n...
5a6a360e8e254f3e909f56964faf708c71b5eab1c8d019ae42064da3518b7dba
Python
848
31
#!/usr/bin/env python # coding: utf-8 import torch import torch.nn as nn from Actor1 import init_weights class Actor(nn.Module): def __init__(self, OBS_DIM, ACTION_DIM, TARGET_DIM, RNN_SIZE, FC_SIZE, RNN): super().__init__() self.OBS_DIM = OBS_DIM self.ACTION_DIM = ACTION_DIM ...
3ef3188493eb8f8ff72e28c1278c51caa8afadb187b532f9cd8dd3ecf623967b
Python
849
29
import sys import pytest from ci.ray_ci.linux_container import LinuxContainer def test_get_docker_image() -> None: assert ( LinuxContainer("test")._get_docker_image() == "029272617770.dkr.ecr.us-west-2.amazonaws.com/rayproject/citemp:test" ) def test_get_run_command() -> None: command ...
b20af91a9acc918ab88a22dcb742fe6a37be0c722e5d78b84ddba3d8f03e9c5b
Python
850
29
import numpy as np import pandas as pd import sklearn from sklearn.model_selection import train_test_split import time import tensorflow as tf import sys from keras.models import Sequential from keras.layers import Dense from keras.wrappers.scikit_learn import KerasClassifier from sklearn.model_selection import cross_v...
6533818ac8c8394a3e0edeaff1ac3a5745d508bd9635c5c13d45d69ef1954f5a
Python
851
16
import case1,sys from case1 import * case1.rng=np.random.default_rng(5); rng=case1.rng TS=[float(x) for x in sys.argv[1].split(',')]; nmul=int(sys.argv[2]) idx=[NAMES.index(k) for k in FREE["M2"]] T=[];E=[];SE=[] import time;t0=time.time() while time.time()-t0<200: p=TRUE+rng.normal(0,0.6,10); p[9]=np.log(0.7); p[8...
c0710ea97d9c99e8bd35a57603cf9f97bb3fbbdda84eb876e3a72e3fe32fbd08
Python
851
30
"""Pure-Python port of mcRigor (Hou & Li, Nat Commun 2025). Reference --------- Hou X, Li JJ. *Rigorously detecting dubious metacells in single-cell genomics.* Nature Communications 16, 5236 (2025). https://doi.org/10.1038/s41467-025-63626-5 Original (R + Rcpp) implementation: https://github.com/JSB-UCLA/mcRigor Thi...
c09598785c39f22716c07063fe6706aea1659372d7e5273aa200076a155cd691
Python
851
32
import pathlib import sys import glob import pandas as pd cleaned_path = sys.argv[1] out_path = sys.argv[2] outliers = sys.argv[3] file_list = glob.glob(cleaned_path) outlier_list = outliers.split(',') # specify the missing preproc scans failed_list=['sub-jgrAesAWc21L_ses-1_task-rest_acq-EPI_run-1_bold', 'sub-212_ses...
d56c7ad0e4dd8d890473c94fcee92e26c2b76c1dbb451584f08d4cd66deb3d19
Python
853
19
# 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...
468223dd4210a59f9c8b8a2c56e313377281d4b93c51fbb72d0df2971cff1533
Python
855
31
from __future__ import annotations """ Lightweight PDF extractor using PyMuPDF (fitz) if available. Falls back to a clear error if dependency is missing. """ from pathlib import Path from typing import List, Tuple def extract(path: Path) -> List[Tuple[str, str]]: """Extract text from a PDF file into markdown c...
cb1ac649b547774d4f34d03f168136333de7ec2de96fb87db45e70c5a5e0ce10
Python
856
31
#!/usr/bin/env python # -*- coding: utf-8 -*- # ------------------------------------------------------------------------- # Created By : Kangjoo Lee (kangjoo.lee@yale.edu) # Last Updated: 08/06/2024 # ------------------------------------------------------------------------- # Imports import h5py import os import glo...
ed4864547f4070aeaf666929d867631de5b8457eb32d754d933e6f125c4ccc1a
Python
856
12
from .setrunparameters import setRunParameters from .mmutils import (findPointDensity, gencmap, createProjectDirectory, readMat, embeddingFolder, embeddingSuffix, loadProjections, saveProjections, loadTrainingSet, loadEmbeddings, loadWatershed) from .motionmapper import (run_...
869c5b5d11d539fcd11b8f88140fe29b735cdb0735ff9937719b5c234792cdd9
Python
857
16
from .logger import get_caller_name, log_img_scale, print_colored_log from .memory import AvoidCUDAOOM, AvoidOOM from .process_debug import process_debug_mode from .setup_env import (register_all_modules, setup_cache_size_limit_of_dynamo, setup_multi_processes) from .typing_utils import (ConfigT...
ccf7faecdd585609a3b2ce102c904ae841584d5b0c3a18c7ecf71b1e64b9e690
Python
857
26
import torch import torch.nn from convex_optim_base.optim_base import SingleDirectSolveProblem, BatchParallelDirectSolveProblem def single_direct_solve(problem: SingleDirectSolveProblem, verbose: bool = False, **kwargs) -> float: with torch.no_grad(): solv...
01016d87e2cea5657a852156613428e55878c8994f9a6b34bc19cdea6f48843a
Python
858
33
"""Noisy Networks See http://arxiv.org/abs/1706.10295 """ import torch.nn as nn from pfrl.nn.noisy_linear import FactorizedNoisyLinear def to_factorized_noisy(module, *args, **kwargs): """Add noisiness to components of given module Currently this fn. only supports torch.nn.Linear (with and without bias) ...
25e3f13c0c5dfd4a3255d9cec2cfec4408eb540272bad91e11059cc3c52e08fb
Python
858
27
import numpy as np import torch from ..utils import common_functions as c_f from ..losses.large_margin_softmax_loss import LargeMarginSoftmaxLoss class ArcFaceLoss(LargeMarginSoftmaxLoss): """ Implementation of https://arxiv.org/pdf/1801.07698.pdf """ def __init__(self, *args, margin=28.6, scale=64,...
6273e335486b0dfba0497957773c1c1b9f35bb2516797c2d8f9281e57b1fc308
Python
858
27
default_scope = 'mmdet' default_hooks = dict( timer=dict(type='IterTimerHook'), logger=dict(type='LoggerHook', interval=50), param_scheduler=dict(type='ParamSchedulerHook'), checkpoint=dict(type='CheckpointHook', interval=1), sampler_seed=dict(type='DistSamplerSeedHook'), visualization=dict(typ...
b1091511037bccbc10cfd24435bea59d94e11e7efc1831af898a104eaaef5cf0
Python
858
20
# -*- 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. #...
606955c91e105c9561adf3eddd8fadab8d7f55f5d85e0bc1db0b7ba9713d2835
Python
859
35
# flake8: noqa accuracy = 42 # __keras_hyperopt_start__ from ray import tune from ray.tune.search.hyperopt import HyperOptSearch import keras def objective(config): # <1> model = keras.models.Sequential() model.add(keras.layers.Dense(784, activation=config["activation"])) model.add(keras.layers.Dense(1...
dba53373fd6df44a72e7138e8238c05cb626c68a49425a2074d8a04bcbbdc47a
Python
859
26
from siapy.entities import SpectralImage from siapy.utils.images import blockfy_image, calculate_image_background_percentage, spy_merge_images_by_specter # Merge VNIR and SWIR images vnir_image = SpectralImage.spy_open(header_path="vnir_data.hdr") swir_image = SpectralImage.spy_open(header_path="swir_data.hdr") merge...
2342359da92b1749e058187ed921c783b3a408ec68b6aba4c07390e39196c82b
Python
860
36
from typing import Tuple import torch import torch.nn as nn class FlipDims(nn.Module): def __init__( self, flip_x: bool = False, flip_y: bool = False, swap_xy: bool = False ): super().__init__() self.flip_x = flip_x self.flip_y = flip_y self.swap_xy = swap_xy def ...
6f7052aabcc4b1cb8b25e879d783e5cda2c3a82ca5c1b246a9f93202c31c70c6
Python
860
34
"""Contains skorch-specific exceptions and warnings.""" from sklearn.exceptions import NotFittedError class SkorchException(Exception): """Base skorch exception.""" class NotInitializedError(SkorchException, NotFittedError): """Module is not initialized, please call the ``.initialize`` method or train ...
93ff230f037e71a282ad7af467034611b12b3a88a53b898d05efe4eb7a5fc189
Python
860
48
# flake8: noqa # fmt: off from ray import serve @serve.deployment def f(*args): return "Hi there!" serve.run(f.bind()) # __prototype_code_start__ import requests response = requests.get("http://localhost:8000/") result = response.text # __prototype_code_end__ assert result == "Hi there!" # __production_co...
574b9a7aad793a29e26ee9d02ff7e5c609cb1ccc7f2a3a0930d42dfdce8d2b26
Python
862
35
from samri.pipelines.glm import l1, l1_physio, seed PREPROCESS_BASE = '/usr/share/samri_bidsdata/preprocessing' def test_l1(tmp_path): l1(PREPROCESS_BASE, mask='mouse', match={'session': ['ofMaF'], 'acq':['EPIlowcov']}, out_base=tmp_path, workflow_name='l1', ) # Takes too long or hangs #def test_physio():...
3fae88b436c0dd800230c06d7de6862f87d643329ae924c071d1e076c80aacaa
Python
863
29
"""Test workflow parser utility functions.""" import argparse import pytest from tedana.workflows.parser_utils import check_tedpca_value def test_check_tedpca_value(): """Test the check_tedpca_value function.""" with pytest.raises(argparse.ArgumentTypeError): check_tedpca_value("hello", is_parser=Tr...
32bf9aebe9026d765c9886f6f8b9c4bdd9c6303c274f6c201df87779eb49efb5
Python
864
27
default_scope = 'lqit' default_hooks = dict( timer=dict(type='IterTimerHook'), logger=dict(type='LoggerHook', interval=50), param_scheduler=dict(type='ParamSchedulerHook'), checkpoint=dict(type='CheckpointHook', interval=1, max_keep_ckpts=1), sampler_seed=dict(type='DistSamplerSeedHook')) # visuali...
409573d1e17b5a888c6be6e960e6ae390ce146db05c23a6ea49f1756858d6cc4
Python
864
39
'''numpy-stl Sphinx configuration.''' import datetime from stl import __about__ as metadata # -- Project information project = 'numpy-stl' author = metadata.__author__ version = release = metadata.__version__ copyright = f'2014-{datetime.date.today().year}, {author}' # -- Extensions extensions = [ 'sphinx.ext.a...
5346e5796c96485d4bc1b07384dcd033201fc30be62a6c806307c34e32aec5ef
Python
864
35
from abc import ABCMeta, abstractmethod class StateQFunction(object, metaclass=ABCMeta): """Abstract Q-function with state input.""" @abstractmethod def __call__(self, x): """Evaluates Q-function Args: x (ndarray): state input Returns: An instance of Acti...
6317c74f391e7a48a41e9d1870f7f3c6417e8fa54987977c4aea544d7709925a
Python
864
40
import os import sys import gzip import bz2 import argparse import logging import urllib.request from collections import OrderedDict def Decode(x): """ Decoding input, if needed """ try: x = x.decode('utf-8') except AttributeError: pass return x def Open(infile, mode='rb'): ...
152079890c3db9927a7a10f05e6c2213d08ee92f9b36649eba8c55d6bd2820bd
Python
866
29
try: from pathlib import Path from siapy.entities import SpectralImageSet print("Libraries detected successfully.") except ImportError as e: print(f"Error: {e}. Please ensure that the SiaPy library is installed and the environment is activated.") exit(1) # Set the path to the directory containing...
4c70bfd0f4bb485a16719cb9d5ce57fa3169de5af034fa7ec998622a48fed976
Python
868
32
import logging from collections import defaultdict from Bio.PDB import Selection from pokeformer.utils.pdb_utils import calc_id_model, get_biopdb_struct import freesasa logger = logging.getLogger(__name__) coeff = 0.9033294541493975 intcep = 5.528451433776809 def calc_sasa(pdb_path, name="protein"): struct =...
e5f7abcf93a70492ac3715e822dadd3049344234abc7d60f387405cfe8855d18
Python
868
19
#Test multinomial import pytest import geopandas as gpd import pandas as pd from shapely import geometry from src import multinomial def test_run(tmpdir): #Create predictions boxes = [geometry.box(0, 0, 5, 5),geometry.box(0, 0, 5, 5),geometry.box(0, 0, 5, 5), geometry.box(0, 0, 5, 5)] p = gpd.GeoDataFrame...
bc0678a9e1adb62ffd83114884e00b8305f5c5e4da59d595e39d01a19cfb1fc9
Python
869
19
# This file is part of the INTREPPPID programme. # Copyright (c) 2023 Joseph Szymborski. # # This programme is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, version 3. # # This programme is distributed i...
5575fea373714ef734090f7285b28d1fbe7c27a5a98bf8ef5848bbfd0dd1e9ca
Python
870
26
""" Bypass the required registration step for higher level analyses in FSL FEAT """ import subprocess import glob ROOT = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/Nifti' subs = ['sub-08'] for sub in subs: featFolders = sorted(glob.glob(f'{ROOT}/derivatives/{sub}/ses-0*/func/*bold*_trunc.feat'))...
5a26d95fe195c4bfa25856a9ea644c5c59e8f4f96680c85977645157d41d0083
Python
870
26
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
8a33349d055d8822435f4e328566765a67713d6e99227f05b2a9b51181b534dc
Python
871
31
# -*- coding: utf-8 -*- # @Time :2024/6/6 20:43 # @Author :MENGLong Li # @File :ShowHistory.py # @Software:PyCharm import matplotlib.pyplot as plt def plot_results(history, EPOCHS): # 显示 MAE plt.figure(figsize=(10, 6)) epoch_range = range(1, EPOCHS + 1) plt.plot(epoch_range, history.history['m...
e3754db20a286d244b8cdcbc736ef71b871a0df0491acb1d17222efaffe94f99
Python
871
31
#test metrics from src import metrics import pandas as pd def test_site_confusion(): y_true = [0,0,1,1,1] y_pred = [0,0,1,1,0] site_lists = {0:[0], 1:[0]} assert metrics.site_confusion(y_true, y_pred, site_lists) == 1 y_true = [0,0,1,1,1] y_pred = [0,0,1,1,0] site_lists = {0:[1], 1:[0]...
b4f04200cfb0628822056c0f72d44cba9bdc5a3c115f16d9d13bc635673558e2
Python
872
37
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ """ from setuptools import setup, find_packages from Cython.Build import cythonize import pysam setup( name='svtk', version='0.1', description='Structural variation toolkit', author='Matthew Stone', author_email='mstone5@mgh.harvard.edu', p...
da93d7608f4c9bf742074b88df5fbfab9defa43b6c59c727d65ef0145b0414a4
Python
873
25
from setuptools import setup import torch.cuda from torch.utils.cpp_extension import CppExtension, CUDAExtension, BuildExtension from torch.utils.cpp_extension import CUDA_HOME ext_modules = [] if torch.cuda.is_available() and CUDA_HOME is not None: extension = CUDAExtension( 'structured_kernels', [ ...
1d96bb8401050473adf92062fdad7785f5806c0dfb21741382d1c7cc9b6bb28f
Python
874
40
import cc3d import numpy as np import scipy.ndimage from cloudvolume.lib import save_images from cloudvolume import CloudVolume, view import time from PIL import Image def twod(): img = Image.open('test2d.png') return np.array(img)[:,:,0].T def threed(): labels = np.zeros( (480, 480, 3), dtype=np.uint8) tmp...
819998b6863073a0a73a8f7183a320feb7a1719f2905a1e2d2e31090b77a4027
Python
874
25
#!/usr/bin/env python __author__ = "" __email__ = "" import numpy as np import torch import torch.nn as nn from typing import Union, Tuple, Optional from torch_geometric.typing import (OptPairTensor, Adj, Size, NoneType, OptTensor) from torch import Tensor import ...
1eb89a5293a915602501c7b934f9755b43807f408dc7e8c246739d6f1b9fb124
Python
875
33
""" Specialized API clients for DataCollect. This module provides API clients for specialized databases including: - BLAST: Sequence similarity searches - JASPAR: Transcription factor binding profiles - MPD: Mouse Phenome Database - IUCN: Species conservation status - PRIDE: Proteomics data repository - cBioPortal: ...
601caa3c2657752cd4ad9b4f798a74010e10b44ce843eec261ec0b0d1dfd1a23
Python
875
19
import os import torch base_config = [ {"input_channels": 2, "cnn_channels": 128, "conv_kernel_size": 3, "pool_kernel_size": 2, "conv_stride": 1, "pool_stride": 2, "fc_padding": 1, "fv_padding": 1, "avr_pool": True}, {"input_channels": 128, "cnn_channels": 256, "conv_kernel_size": 3, "pool_kernel_size": 2, "...
82593a188d18c0f731da739ef01ad378173fbf7c6f90fe720bf31c68d36bea0f
Python
875
19
import os import torch base_config = [ {"input_channels": 2, "cnn_channels": 128, "conv_kernel_size": 3, "pool_kernel_size": 2, "conv_stride": 1, "pool_stride": 2, "fc_padding": 0, "fv_padding": 1, "avr_pool": True}, {"input_channels": 128, "cnn_channels": 256, "conv_kernel_size": 3, "pool_kernel_size": 2, "...
671c7a8ecf807bd31a402bea11961a8777e32e1aece9b2dc4ba2a081bd01e0ae
Python
876
37
import cv2 import os import numpy as np import argparse import message_filters import io import PIL.Image import time from subprocess import call if __name__ == '__main__': ''' parser = argparse.ArgumentParser() parser.add_argument('imgDir', type=str, default='', help='path to data'...
96112d7650001a115bc469e0cd29a8e5edeef5d13a7c897c70b754de9d7400bf
Python
876
33
import datetime import logging from ray.autoscaler._private.cli_logger import cli_logger logger = logging.getLogger(__name__) class LogTimer: def __init__(self, message, show_status=False): self._message = message self._show_status = show_status def __enter__(self): self._start_time...
f0161d1c6e78fdc92d1c7fda6422b8ae09b0686e5afb07a4997b8f216a4266bf
Python
876
25
import gym env = gym.make("gym_sted:PreferenceMOSTED-easy-hslb-v0") env = gym.make("gym_sted:PreferenceMOSTED-easy-hshb-v0") env = gym.make("gym_sted:PreferenceMOSTED-easy-lslb-v0") env = gym.make("gym_sted:PreferenceMOSTED-easy-lshb-v0") env = gym.make("gym_sted:PreferenceMOSTED-hard-v0") env = gym.make("gym_sted:...
6d619316d519cde67ba5e65c80ed55406ffc606ca189341429413f5fd8e70b91
Python
877
31
from typing import Dict, List import samna from samna.speck2f.configuration import SpeckConfiguration from sinabs.backend.dynapcnn.dynapcnn_layer import DynapcnnLayer from .dynapcnn import DynapcnnConfigBuilder # Inherit DynapCNNConfigBuilder to share implementation with other DynapCNN/Speck devices class Speck2FC...
74325b1bd0d485e50eb095171e9c6420862516453fa9d17170a928821ca6b74f
Python
877
34
import torch import torch.nn as nn from packaging import version import sinabs.layers as sl def test_repeat(): data = torch.rand((5, 100, 2, 10, 10)) conv = nn.Conv2d(2, 4, 10) repeated_conv = sl.Repeat(conv) output = repeated_conv(data) alt_output = conv(data.flatten(0, 1)).unflatten(0, (5, 100)...
a8aebfa3c9d84e8e3a16d927bbd6766d9a926af61250fbb2813b8a0394f3197f
Python
877
24
import sys from itertools import groupby def fasta_iter(fasta_name): with open(fasta_name) as fh: faiter = (x[1] for x in groupby(fh, lambda line: line[0] == ">")) for header in faiter: headerStr = header.__next__()[1:].strip().split()[0]#Entire line, add .split[0] for just first column...
d827b67bbe785a1c3d9b06bcab5431d08e29472484dd6af79f6f0bbd8ae3ab46
Python
878
29
import sys import argparse import vamb parser = argparse.ArgumentParser( description="""Command-line bin creator. Will read the entire content of the FASTA file into memory - beware.""", formatter_class=argparse.RawDescriptionHelpFormatter, add_help=False, ) parser.add_argument("fastapath", help="Path to ...
2b45bb60e2248ff802d6b100503e5a0a4f9f24f7c56e6cd51ef55ca63a20af84
Python
879
38
# __without_backpressure_start__ import ray ray.init() @ray.remote class Actor: async def heavy_compute(self): # taking a long time... # await asyncio.sleep(5) return actor = Actor.remote() NUM_TASKS = 1000 result_refs = [] # When NUM_TASKS is large enough, this will eventually OOM. fo...
5a8f591a76738896ea06c36e21c30c398fe7abd8aedc47b2cb0c4c1c3a5deff0
Python
879
20
################################################################################ # -- Default set of parameters ################################################################################ from defaultParams import * fr_chg_factor = np.array([1.0]) E_extra_stim_factor = np.array([1.0]) EEconn_chg_factor = np.aran...
aeae91bd2f85184e5a3ad4d79af90a4e62099701b1673e2f04543e9d5dc72c2a
Python
879
31
from typing import Dict import samna from samna.speck2e.configuration import SpeckConfiguration from sinabs.backend.dynapcnn.dynapcnn_layer import DynapcnnLayer from .dynapcnn import DynapcnnConfigBuilder # Inherit DynapCNNConfigBuilder to share implementation with other DynapCNN/Speck devices class Speck2EConfigB...
d4da55ff46836d67b84002c4cf880a6fb82683d37e0607efccef507031b8588a
Python
879
33
""" Test for issue 1602: https://github.com/ydataai/ydata-profiling/issues/1602 """ from pyspark.sql import types as T from data_profiling import ProfileReport def test_spark_handles_decimal_type(test_output_dir, spark_session): from decimal import Decimal spark = spark_session schema = T.StructType( ...
99369ac72abee7a54781e1d2075a53efa9d09f4967d39115a436be48f6c0e358
Python
880
35
class GeneralMicroscope: """ Implements a General Microscope. This class should be inherited by other microscopes """ def __init__(self, config): self.config = config def get_conf_params(): return { "p_ex" : self.config["conf-params"]["p_ex"], "pdt" : ...
2c0c15d340a6a912cabf42b4af5588821ebff06befbee9fad0c7bb082f865624
Python
884
21
# # 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...
4022af17b26788918ae44d510f8e1713653385277c495320f7f48c6b70f04102
Python
884
33
from typing import Any, List, Tuple import pandas as pd from data_profiling.config import Settings from data_profiling.visualisation.plot import scatter_pairwise def get_scatter_tasks( config: Settings, continuous_variables: list ) -> List[Tuple[Any, Any]]: if not config.interactions.continuous: ret...
06816b8150cb87686979b396e1e16fa73da3cf7d7e976701e40a2fdd32eaafe2
Python
885
30
from Bio import SeqIO import sys, os from itertools import imap def is_sanger(): ''' Inspect the top read in the file and see if the quality encoding max > 40 ''' filepath = sys.argv[1] reads = SeqIO.parse( filepath, 'fastq' ) r1 = next( reads )._per_letter_annotations['phred_quality'] r...
356ff41c1b7dd4bb94f421229e31b1b9ffc3e052abf88f6462853bbc56749ce9
Python
885
30
""" ============================== Utility Function ============================== Utility function for plots in the documentation. """ import matplotlib.pyplot as plt import torch import sinabs def plot_evolution(neuron_model: sinabs.layers, input: torch.Tensor): neuron_model.reset_states() output = neuron...
7041d1b2f14281f50788cfe5bcc19fb8af8694f899d072558292cff4052c06c5
Python
885
26
import logging from datetime import datetime from agent.pipeline.review_level_mgmt import update_sentence_review_level_spo_to_check from agent.pipeline.review_level_mgmt import update_sentence_review_level_spo_skip_validations from agent.pipeline.review_level_mgmt import update_sentence_review_level_spo_completed fro...
d73e838d85375f2367a35ae1872a255b10fee11b54e96a5d6a3d1e0403d713e8
Python
885
34
""" Test for issue 864: https://github.com/Data-Centric-AI-Community/data-profiling/issues/864 Validate Extreme Values sub-tabs state the correct number of extreme values shown. """ import random import pandas as pd from data_profiling import ProfileReport def test_issue864(): def random_list(n): retur...
66790068a727d77e64072081072e87918a6babcafaba7f91c6d5162b2b95e9a3
Python
886
26
# Copyright 2021 Division of Medical Image Computing, German Cancer Research Center (DKFZ) # and Applied Computer Vision Lab, Helmholtz Imaging Platform # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the L...
81e4923e935d87d0b160a1340d83308f7295425ca7cf14e4f50ade9bad146cdc
Python
886
25
import argparse import numpy as np import pandas as pd from tqdm import tqdm parser = argparse.ArgumentParser() parser.add_argument('-i', '--input', required=True, help='Input bedgraph.') parser.add_argument('-c', '--chrom-sizes', required=True, help='Chromosome size file.') parser.add_argument('-o', '--output', requ...
b77af39dfa307ee1ee579ccd3e6523fc66da4d72f8e6339cd34450eebe9ad9f8
Python
887
30
from PIL import Image import numpy as np from ctypes import * import ctypes import copy import os import cv2 import time import pdb import PySpin import matplotlib.pyplot as plt import torch import torch.nn.functional as F def showOn2ndDisplay(monitorNo, windowNo, x, xShift, y, yShift, array): Lcosl...
0c22244eb182aaa7666fa1e414f8037831dbb6b932a5893c31583d1076ed1477
Python
888
35
CODE_DIR = '/home/kelarion/github/' SAVE_DIR = '/mnt/c/Users/mmall/Documents/uni/columbia/assignment_errors/' import socket import os import sys import pickle as pkl import numpy as np import scipy as sp import scipy.linalg as la import scipy.io as sio from sklearn import svm, manifold, linear_model from sklearn.mod...
af5ac2a7e430c94097cfd236d0fcb734aa7c5c0893147fd84f0a758f8c132897
Python
888
32
"""Reference implementations for testing consistency and backward compatibility. This package contains reference implementations of previously deprecated or parametrized model components, used for testing consistency and backward compatibility in the test suite. """ from .deprecated_transforms import ( cebra_tran...
e18a42afb9c05c7d0eeacf651fb26be20a4e69807c49e06057cfdb8a5fbcbb85
Python
888
27
# -*- 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. #...
2b7eb2ee78172e8a3480ac73137170888dc3a98c3b689d5e19ae38b60eb679d8
Python
890
25
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. """Helper class for adding rpu_config to neural network model""" # pylint: disable=no-name-in-module,import-error from aihwkit.cloud.converter.definitions.i_inp...
7a21d628248e642851f7e26ae479052135d643ce01e74cc02b8549b867bb1115
Python
890
40
# __memray_profiling_start__ import memray import ray @ray.remote class Actor: def __init__(self): # Every memory allocation after `__enter__` method will be tracked. memray.Tracker( "/tmp/ray/session_latest/logs/" f"{ray.get_runtime_context().get_actor_id()}_mem_profile.bi...
f0df3b0f3eb9d73623f2dd66283c1c8246acff1d908060829d069da16c6e1457
Python
890
35
import cv2 import numpy as np from glob import glob from sklearn.model_selection import StratifiedKFold import numpy as np from sklearn.model_selection import StratifiedKFold def threshold_at_one(x): return x>75 def jpg_to_ndarray(path): image=cv2.imread(path, cv2.IMREAD_GRAYSCALE) return image def label...
163a8e41cee76321f41db37a5be985d5d593afbfbc3a01768dc2256a40f6be65
Python
892
37
# __anti_pattern_start__ import ray import numpy as np ray.init() def process_results(results): # custom process logic pass @ray.remote def return_big_object(): return np.zeros(1024 * 10) NUM_TASKS = 1000 object_refs = [return_big_object.remote() for _ in range(NUM_TASKS)] # This will fail with heap...
30423687bf9d226fae351d53a17728904f30f78df2f51dec6d3052a8c6a19c2b
Python
892
18
"""Vendored backbone-based Bonsai (upstream v1.0.0), CC BY-NC 4.0. For datasets too large for a direct reconstruction: build a tree on a subset, graft the remaining cells onto it, refine, repeat. Upstream's own four steps. Modifications, all mechanical and marked ``omicverse:`` at the site: * imports rewritten to re...
47017a473f29df13992a8c551496ee27fe3ff325dc3fdecf43b23723992d1df9
Python
892
38
import setuptools import ava with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="AVA: Autoencoded Vocal Analysis", version=ava.__version__, author="Jack Goffinet", author_email="jack.goffinet@duke.edu", description="Generative modeling of animal vocalizations", long_descrip...
9ff12b4b587fa69a21b9e22ed51275b4aae966b4948f09dcaf180f2147c62577
Python
892
31
from setuptools import setup, find_packages setup( name="chromoformer", packages=find_packages(exclude=[]), include_package_data=True, version="1.1.3", license="MIT", description="Chromoformer - Pytorch", author="Dohoon Lee", author_email="dohlee.bioinfo@gmail.com", long_description...
aab3fb92028342efc02be16445e77015b298f015bc15ec76cc1b74589a49da20
Python
893
41
import unittest from rising import AbstractMixin class Abstract: def __init__(self, **kwargs): super().__init__() self.abstract = True class AbstractForward: def __init__(self, **kwargs): super().__init__(**kwargs) self.abstract = True class PreMix(AbstractMixin, Abstract)...
0ad07e3d49af35535ae53076ee0f79ae04cfd458095174c6c686ce626fd0b857
Python
894
32
""" A collection of miscellaneous tools used by the feature extractor """ from typing import Dict, Any def unnest(inputs: Dict[str, Any], _prefix="") -> Dict[str, Any]: """ Convert nested dictionaries (with string keys) to a dot-notation flat dictionary. Parameters --------- inputs: The diction...
22a0714029f4ffe2efbd5974c7d6af8edb1c7ca29bfe963e86a76aac1373c602
Python
895
39
# flake8: noqa # __websocket_serve_app_start__ from fastapi import FastAPI, WebSocket, WebSocketDisconnect from ray import serve app = FastAPI() @serve.deployment @serve.ingress(app) class EchoServer: @app.websocket("/") async def echo(self, ws: WebSocket): await ws.accept() try: ...
48bf1bdf09312e8f5b356562461df9106d0a8cbbc7b1b41c71657b2ffbbc0fe3
Python
895
27
import logging from datetime import datetime from agent.data.entities.config import ROOT_LOGGER_ID from agent.data.sql.sql_mgmt import get_connection from agent.data.entities.item import select_last_items from agent.crawlers.twitter_crawler import get_tweets logging.basicConfig(format='%(levelname)s : %(message)s', l...
9a53fb1be3e8de56ff9acaf7ae021e4c22e5853a3a9d726122eda7d3b5b9fe16
Python
895
27
# 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...
2e179aa5a299aae493edf7d02073d377539b98ee5e180f7aa7286a8c671dd677
Python
896
26
import re from ipywidgets import widgets from data_profiling.config import ImageType from data_profiling.report.presentation.core.image import Image class WidgetImage(Image): def render(self) -> widgets.Widget: image = self.content["image"] if self.content["image_format"] == ImageType.svg: ...
368f11e2350a8c1ee2b03aa06090787a4a465a27b1dab60128e725567ef46398
Python
896
25
import argparse import numpy as np import pandas as pd from tqdm import tqdm parser = argparse.ArgumentParser() parser.add_argument('-i', '--input', required=True, help='Input bedgraph.') parser.add_argument('-c', '--chrom-sizes', required=True, help='Chromosome size file.') parser.add_argument('-o', '--output', requ...
3a749454774ca6632c13f074ce1e2918fffeca9c29987627997a089f0f902e4f
Python
896
32
# Generated by Django 4.1.6 on 2023-02-07 00:52 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("infer", "0012_alternategenename_alternateproteinname_go_protein"), ] operations = [ migrations.CreateModel( name="ProteinEmbeddin...
af12f6209a37f3f94cf42f9e17dabeba39884f38e0d962fd2e1fc7617386934b
Python
897
27
# 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...
182af0160a4b5c3aac30346244bbf6078f0ec0cfd91ffe96182d54a1a7587053
Python
898
29
import setuptools # read the contents of requirements.txt with open('./requirements.txt') as f: requirements = f.read().splitlines() setuptools.setup( name = 'adrd', version = '0.0.1', author = 'Chonghua Xue', author_email = 'cxue2@bu.edu', url = 'https://github.com/vkola-lab/adrd_tool/', ...
20da34a5966e971a79f4a343ee2918cfe0ce5e970d7dc944e6f4ac055a5c1c9f
Python
898
28
import bpy #################################################################################################### # @SomaReconstructionDocumentation #################################################################################################### class SomaReconstructionDocumentation(bpy.types.Operator): "...
3a6101f64f437748768e2da31e8cefa8074e8b01a159d1bdb7cb62acffbc6d96
Python
898
27
# 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...
8807e9c0528d164e404b5e39c013afcae34cccee559e004322be1f4d32e564cc
Python
898
27
# 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...
3c45e2085e42a52ffae80db9ee7bce7bf3fc0a761fbf67912f8af0aae531efea
Python
899
30
import unittest import torch from rising.transforms.functional import tensor_op class TestSpatialFunctional(unittest.TestCase): def setUp(self) -> None: self.batch_2d = torch.arange(1, 10).reshape(3, 3)[None, None] def test_tensor_op_tensor(self): outp = tensor_op(self.batch_2d, "permute", ...
8aeed3dcefd969352dca505579283997c21bd7a287f3fbabd2c0fc61842622a6
Python
899
28
# 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...
932561f905745d8125da6c762466d8f3e9a20b02a7eea3cb5676a26f3bd69ef2
Python
899
27
# 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...
9b751e287b99943b490659420624664c794b85788dc6c0eb740d461c10b9431c
Python
899
27
# 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...
a1ba648e746b3f8b24f777da3eef2322430755d0d633c4203dc804a81e2173f7
Python
899
26
# -*- coding: utf-8 -*- ### -------------- IMPORTS ------------- ### import numpy as np from helper import features ### ------------------------------------ ### # define metrics metrics = ['total', 'detected', 'percent_detected', 'false_positives', 'false_positive_rate'] ## define parameter l...