sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
cba4b02fcadcd2f79b0b6716a94de56f0b5bee37858732b280381468580c97bb
Python
455
11
r"""Cytometry I/O — Flow Cytometry Standard (``.fcs``) files. A peer of ``io.bulk`` / ``io.single`` / ``io.spatial`` rather than a member of one of them: an FCS event is a cell, but the file format, its metadata model ($PnN/$PnS, $SPILLOVER) and the instruments that write it are their own world, shared by conventional...
e31b6b01617261f39614b1fab51b4834aabf1a20774b6165f5464518533eed7e
Python
455
20
from dcll.dcll.pytorch_libdcll import * from dcll.dcll.experiment_tools import * from dcll.dcll.load_dvsgestures_sparse import * import torch import numpy as np def setup_seed(seed): torch.manual_seed(seed) torch.cuda.manual_seed(seed) np.random.seed(seed) torch.backends.cudnn.deterministic = True se...
bfabbffe3c55b1862a26b72661ddd55c8a86db1560f61cf2e2ca9e2ac4dd9b63
Python
456
20
import os import functools import warnings import time import csv import matplotlib; matplotlib.use("TkAgg") from matplotlib import pyplot import numpy import skimage.io #from skimage.external.tifffile import TiffWriter import yaml import microscope import user import utils from datetime import date configs = microsc...
8a468c13f41059f0f0896ebc829551c26222579a723bc783faecc0e2ee42a9f4
Python
457
18
import numpy as np def rescale_linear(array, new_min, new_max): """Rescale an arrary linearly args: array: a number array new_min: the minimum value for new scale new_max: the maximum value for new scale """ minimum, maximum = np.min(array), np.max(array) if maximum - mini...
71233d295c0db4a25e20b79e7499bf2aafc2cfd3af0b5c1e4ba5293d3ca9616f
Python
458
19
"""Channel adapters for Jarvis.""" from .telegram import AccessControl, run_bot from .discord import run_discord_bot from .feishu import run_feishu_bot, run_feishu_ws_bot from .imessage import run_imessage_bot from .qq import run_qq_bot from .wechat import run_wechat_bot __all__ = [ "AccessControl", "run_bot"...
bef5b353f96bb12a1bd89a4e746ee893c466d058d1fafee881880aeb3aee0069
Python
458
16
from pbr.version import VersionInfo __version__ = VersionInfo("sinabs").release_string() from . import conversion, utils, validate_memory_speck from .from_torch import from_model from .network import Network from .nir import from_nir, to_nir from .synopcounter import SNNAnalyzer, SynOpCounter from .utils import ( ...
39af4a60c71de2bf185475a46652710628f6cd50ea5ae674a8846f999cead839
Python
459
17
from abc import ABC from typing import Optional from data_profiling.report.presentation.core.renderable import Renderable class ItemRenderer(Renderable, ABC): def __init__( self, item_type: str, content: dict, name: Optional[str] = None, anchor_id: Optional[str] = None, ...
e3498f5075fe6bf7c6bf0ab7369baf3e8fdb85304b37df9c3e38cbaa9c702653
Python
459
7
from pfrl.explorers.additive_gaussian import AdditiveGaussian # NOQA from pfrl.explorers.additive_ou import AdditiveOU # NOQA from pfrl.explorers.boltzmann import Boltzmann # NOQA from pfrl.explorers.epsilon_greedy import ConstantEpsilonGreedy # NOQA from pfrl.explorers.epsilon_greedy import ExponentialDecayEpsilon...
065ac959f2ac0402c2f3776c38f5dc1dd5a6c1723b40c2b7308f5c0d1d222d0a
Python
460
17
"""Configuration constants and paths for SiaPy library. This module defines important directory paths and configuration constants used throughout the SiaPy library, including base directories and test data locations. """ from pathlib import Path __all__ = [ "BASE_DIR", "SIAPY_DIR", "TEST_DATA_DIR", ] BA...
722c60b9847987f5b6688a282107e6a5e401debb2dc390d51057006e0779084c
Python
460
12
from ray.air.execution.resources.fixed import FixedResourceManager from ray.air.execution.resources.placement_group import PlacementGroupResourceManager from ray.air.execution.resources.request import AcquiredResources, ResourceRequest from ray.air.execution.resources.resource_manager import ResourceManager __all__ = ...
a6fe154acd119f96e9c464fbe3b618bd969a909c9c2d616432dc816db31bb793
Python
460
16
__author__ = "Horea Christian" import argh from samri.pipelines.diagnostics import diagnose from samri.pipelines.reposit import bru2bids from samri.pipelines.preprocess import generic, legacy from samri.pipelines.glm import l1 def main(): # Adapting function names to 1-level hierarchy generic.__name__ = 'generic-pr...
b7cf98c14c4bbaf361dc9e76548e62033f54f2b1fadaf8d2c2ac32ece2b55d9a
Python
460
16
import logging from torch_geometric.utils.num_nodes import maybe_num_nodes from torch_scatter import scatter_add, scatter_max logger = logging.getLogger(__name__) def pyg_softmax(src, index, num_nodes=None): num_nodes = maybe_num_nodes(index, num_nodes) out = src - scatter_max(src, index, dim=0, dim_size=n...
e9b90bbb5332db440df811e0296bb588e36cd67a4a533f1bdc332e1d2604a659
Python
460
15
from siapy.entities import SpectralImage from siapy.entities.images import SpectralLibImage # Load from ENVI format (uses spectral python library) image_sp = SpectralLibImage.open( header_path="path/to/header.hdr", image_path="path/to/image.img", ) image = SpectralImage(image_sp) # Or you can use the class me...
2a8154747df3b5b2c51a8802165d3abb1ba4350f6d813e6da33cb5d295ee90b8
Python
462
15
""" 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 os BULK_PKL_PATH = os.path.join(__path__[0], "bulks.pkl") ADSORBATE_PKL_PATH = os.path.join(__p...
4c368e9fb34f258d91d66a56dcafb4f7548ae3ac63968357d73fd5e84ff9f4d0
Python
462
15
import scrublet as scr import scipy.io import matplotlib.pyplot as plt import numpy as np import os import random print(sys.path) def predict_doublets(matrix): counts_matrix = scipy.io.mmread(matrix).T.tocsc() scrub = scr.Scrublet(counts_matrix, expected_doublet_rate=0.10) doublet_scores, predicted_double...
7a33dc89adb5885e6ef2e612fc411996f9869dbcc5f196e3a397c9648d138a38
Python
463
20
from torch import nn class Lambda(nn.Module): """Wraps a callable object to make a `torch.nn.Module`. This can be used to add callable objects to `torch.nn.Sequential` or `pfrl.nn.RecurrentSequential`, which only accept `torch.nn.Module`s. Args: lambd (callable): Callable object. """...
a329ed353e261c7c6f24e7971171cdc84735302135add9df3eade51e9edb0581
Python
464
19
# Generated by Django 4.1.6 on 2023-12-18 01:13 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("infer", "0020_proteomeresultstats"), ] operations = [ migrations.AlterField( model_name="proteometask", name="id", ...
e85b63ecfd7ead0b947571813fe2763177bcdda8c06870211be6e257f078de4f
Python
464
16
import pandas as pd metadata_final_file = "metadata_final_forLDSC_20221229.csv" df = pd.read_csv(metadata_final_file, sep=",", index_col=False) mets_munge_file = "../MetS_GWAS_munge.sumstats.gz" df2 = df[['Category', 'Trait']] df2['MetSMunge'] = [mets_munge_file] * len(df) df2['TraitMunge'] = df['Munged_path'].tol...
f7d26085877a936e3de3161a2f8be70bf11598ddf007785d2e3b9e117e9b060e
Python
464
25
# # Global configuration # class MOFAConfig: """ MOFA config manager """ def __init__(self, use_float32: bool = False): self.use_float32 = use_float32 @property def use_float32(self): return self.float32 @use_float32.setter def use_float32(self, float32): if ...
098e32fb666d601d6bcb4bbcdd9a553434964855f7fe5e9579a725b7c04b264c
Python
465
14
from data_profiling.report.presentation.core.root import Root from data_profiling.report.presentation.flavours.html import templates class HTMLRoot(Root): def render(self, **kwargs) -> str: nav_items = [ (section.name, section.anchor_id) for section in self.content["body"].content[...
9ee1904e6de44a943610e6c5ba18b887b218c626302236e7493cbe97b6f3ca08
Python
465
16
from abc import ABCMeta, abstractmethod class Explorer(object, metaclass=ABCMeta): """Abstract explorer.""" @abstractmethod def select_action(self, t, greedy_action_func, action_value=None): """Select an action. Args: t: current time step greedy_action_func: function ...
aea0158d66dd5d6f9b0500b79cd9a702a7b45fabb2492afb3be9f70304212271
Python
465
21
""" =========== SingleSpike =========== :class:`~sinabs.activation.SingleSpike` activation function. """ import matplotlib.pyplot as plt import torch import sinabs.activation as sina v_mem = torch.linspace(0, 5.5, 500) spike_threshold = 1.0 activations = sina.SingleSpike.apply(v_mem, spike_threshold, sina.MultiGaus...
385d8e0b09f6c5e1295b8393ef37df248ec7d95d4ed0253c3a00a1a9f77b957d
Python
467
22
import pandas as pd import numpy as np from scipy.interpolate import splrep, BSpline, make_smoothing_spline import matplotlib.pyplot as plt plt.style.use('ggplot') import glob dir_path = "data/rrls/catalog/" rrl_list = list() for file_name in glob.glob(dir_path + '*.csv'): x = pd.read_csv(file_name, low_memory=...
94c7a61e9dc1838612f7bf2af531d3c3dd8f71836ef1781bdf79185cea6fc328
Python
467
18
from enum import Enum class VQVAELosses(Enum): BASELINE = "baseline" BAUR = "baur" MSE = "mse" SPECTRAL = "spectral" HARTLEY = "hartley" JUKEBOX = "jukebox" WAVEGAN = "wavegan" PERCEPTUAL = "perceptual" JUKEBOX_PERCEPTUAL = "jukebox_perceptual" HARTLEY_PERCEPTUAL = "hartley_per...
c63cbef23d479a7a82ce79759e79800191e5948d77786d0d0232aab350cc12be
Python
467
12
from pathlib import Path from shutil import unpack_archive from . import utils def download(path: Path, version: str = "4.4.224"): url = f"https://downloads.thebiogrid.org/Download/BioGRID/Release-Archive/BIOGRID-{version}/BIOGRID-ORGANISM-{version}.mitab.zip" utils.download_file( url, path / f"BIOGR...
1a2187e5bedddfe2cdbfaf7a9e761e89ba5abf863d08d5d305ecfda9159a8623
Python
468
18
from mmdet.datasets import CocoDataset from lqit.registry import DATASETS RTTS_METAINFO = { 'classes': ('bicycle', 'bus', 'car', 'motorbike', 'person'), 'palette': [(255, 97, 0), (0, 201, 87), (176, 23, 31), (138, 43, 226), (30, 144, 255)] } @DATASETS.register_module() class RTTSCocoDataset(...
3bf8ffca8bdfe7f52e591ef06e44316edfc8caf75fc72d7570e184a67fa9fd5e
Python
468
23
import os import urllib.request import zipfile def download_extract(unzip_dir, url): outdir = str(unzip_dir) os.makedirs(outdir, exist_ok=True) zip_path = os.path.join(outdir, "temp.zip") urllib.request.urlretrieve("https://" + url, zip_path) with zipfile.ZipFile(zip_path, "r") as zf: z...
6487e26c3642b9ef648e7b47e996e9f66fe6a3168124b35ff9b4b5ce867203bd
Python
468
16
from typing import Any, List from data_profiling.report.presentation.core.item_renderer import ItemRenderer class FrequencyTableSmall(ItemRenderer): def __init__(self, rows: List[Any], redact: bool, **kwargs): super().__init__( "frequency_table_small", {"rows": rows, "redact": redact}, **kwar...
fe778482bbf1022726365ba0494d2c1d1e344120147bfb59d0100ef87a3fe6cd
Python
468
22
""" OPIPP: Optimization-based Pairwise Interaction Point Process ======================= A Python implementation of OPIPP, a method for retinal mosaic simulation. Classes: Scope Feature AdaptiveSchedule Mosaic Pattern """ from .scope import Scope from .feature import Feature from .cooling impor...
4e273246a1bef50ad63da30334557981089a40b3eb5f4fad9b07de105df1e1ac
Python
469
11
# Vendored from `decoupler` (https://github.com/scverse/decoupler) by # omicverse for in-tree GPU acceleration work. Original copyright by # the decoupler authors, redistributed under decoupler's GPL-3.0 # license. Cross-module imports rewritten from `decoupler.*` to # `omicverse.es.*` (see scripts/vendor_decoupler.py)...
ade5afe82b69fac35021cf6566491a42d5c712454377d7c96955400514c6990c
Python
469
21
#!/bin/python #------------------- Description & Notes --------------------# #------------------- Dependencies ---------------------------# # Standard imports # Third-party imports # Internal imports from .fastx import read from .kmer import read from .kmer import write #------------------- Constants ------------...
05a84b3b97919faad224ac799ee102a3ba3f714e887214aeb5e2d7f5c0f635ab
Python
470
13
from typing import List, Union def is_flat_embedding(x: Union[List[float], List[List[float]]]) -> bool: """ Check if the embeddings represent a single flat list of floats rather than a list of list of float. Args: x (List[float] or List[List[float]]): Embeddings to check. Returns: ...
186ce445775c26bc57c3705060fc01728bc540c3e0a8ab1f2b83cfe18aab8743
Python
470
26
from abc import ABCMeta, abstractmethod class Dataset(object): def __init__(self): __metaclass__ = ABCMeta @abstractmethod def __getitem__(self, item): ''' needs to return a data_dict for the sample at the position item :param item: :return: ''' pas...
3d9e09c1c4e9402e8d141b4931ff95270c19e4bdaa4e2a54b3874e2de29c62c6
Python
470
18
# Generated by Django 4.1.6 on 2023-02-06 04:27 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("infer", "0006_ppidatabase_remove_weights_organisms_dataset_and_more"), ] operations = [ migrations.AddField( model_name="ppidatab...
5e09d65870374817230fd98f928f4d17e29f8161e5ed945dc82c3d44095992c2
Python
470
23
from typing import Tuple, Dict class AdversarialKeys: """ A set of common keys for adversarial networks. """ REALS = "reals" FAKES = "fakes" GLOSS = "g_loss" DLOSS = "d_loss" def batch_decomposition(batch: Tuple) -> Tuple: if len(batch) == 2: inputs, targets = batch ...
a8c9aec732d4bb01cc7bb7776593d32a6507c10455fc04df60dbcc59d3026e50
Python
470
14
from setuptools import setup setup( name='mbeann', version='0.1.0', author='Motoaki Hiraga', author_email='100577843+motoHiraga@users.noreply.github.com', url='https://github.com/motoHiraga/pyMBEANN', license='MIT', description='An implementation of Mutation-Based Evolving Artificial Neural...
2a681479b0d1a84d1acd5af22f71b8ada2db60c1490240f36317cfa883a86212
Python
471
15
""" Test for issue 613: https://github.com/Data-Centric-AI-Community/data-profiling/issues/613 """ import numpy as np import pandas as pd from data_profiling import ProfileReport def test_issue613(): df = pd.DataFrame([{"col": "ABCDEF"}, {"col": "DEFGEFGHK"}, {"col": np.nan}]) report = ProfileRep...
b1e1ecc46eadf1fc4de16d3c42205dfccfb84c90e37ce1dcbd664138a29e40f4
Python
471
10
import os import sys # train RMBG model os.system('python train_RMBG_model_conti.py --datasets_folder train_RMBG1 \ --n_epochs 2 --GPU 0 --batch_size 1 \ --fmap 32 --lr 0.0001 \ --denoise_model vol_600_200_rr2 --pth_nam...
73590e57bbc6c9d843b2cdf03c816b0a50b66257e190c737624c27673784e7e1
Python
472
16
import csv import os import code OUT="./PRS" Traits=['BMI', 'WC', 'T2D', 'FG', 'HTN', 'TG', 'HDL'] for trait in Traits: file = os.path.join(OUT, trait, "score_sum_indiv.profile") with open(file, 'r') as f, open(file + '.reformat', 'wt', newline='') as f2: reader = csv.reader(f, delimiter=' ') ...
4023b424395399bab3fb6f90994bc4b0b1d19ef6d18491f59b881d1fede40f45
Python
473
21
import extraction import patient import patient_longitudinal_info import format version = "xxxxxx" # please specify version (folder name) of your data output = "processed_data" patient.extract_patient_info(version, output) patient_longitudinal_info.extract_longitudinal_info(output) extraction.extract_data(version...
abe3ec30a3198a2cbf2e30f6f4e6bde374a2d5aa38b486adf66198cacbaf9b56
Python
473
16
MODEL_CONFIG = { "weight":{ "protein": "poc_pre_220816.pt", "molecule_no_h": "mol_pre_no_h_220816.pt", "molecule_all_h": "mol_pre_all_h_220816.pt", "crystal": "mp_all_h_230313.pt", "oled": "oled_pre_no_h_230101.pt", }, "dict":{ "protein": "poc.dict.txt", ...
523fd7b1e291844de8279286acb9606a4b4c19abe7716676d0795769f0ab1faf
Python
474
8
from .trainer_pretrain import TrainerPreTrain from .trainer_finetune_regression import TrainerFineTuneRegression from .trainer_finetune_classification import TrainerFineTuneClassification from .trainer_gan_lit import TrainerGANLit from .external.ase_dataset import AseReadDataset from .external.ase_dataset_attribute imp...
c36d4403a0099427107428ae839aa480f12f69b837f11bec4795e06dff1c7aa9
Python
474
11
from samri.pipelines.manipulations import transform_feature # Takes too long #def test_transform_feature(): # transform_feature('/usr/share/mouse-brain-templates/dsurqec_200micron_roi-dr.nii', '/usr/share/mouse-brain-templates/dsurqec_200micron_masked.nii', '/usr/share/mouse-brain-templates/ambmc_200micron.nii', # ta...
1691aead150d2a580f2b63bc85efc033ef679571473bd585effac187e4498766
Python
475
21
from warnings import warn from fire import Fire from .helpers import ( categorical_crossval_, deploy_categorical_model_, train_categorical_model_, ) if __name__ == "__main__": warn( "feature models are deprecated and may be removed in the future.", FutureWarning ) Fire( { ...
bfb324fbdaf351ef32b4d19ef763b78b569c7f04708a928ec6a36ef6ff8be1ff
Python
476
24
r""" Loss function """ import torch def feature_reconstruct_loss(embd:torch.Tensor, x:torch.Tensor, recon_model:torch.nn.Module ) -> torch.Tensor: r""" Reconstruction loss (MSE) Parameters ---------- embd embd of a cell ...
9a4f9ff7179a7a34b5104bd5082c9665ad090fcdfb6c0eb0d690b8ac5f7e0569
Python
477
17
#Training HSI Augmentations from torchvision import transforms def train_augmentation(image_size): """Torchvision transforms Args: image: a torch vision tensor with C, H, W order Returns: transformed_image: an augmentated image """ transform_list = [] transform_list.append...
f9555ec2f4652913110ecb4357cf3f321d2a8772b647d31e50d2abeee44adcd5
Python
477
13
# TODO: delete after fully support editor metric and datasets. _base_ = [ '../_base_/models/unet.py', # '../_base_/datasets/underwater_enhancement.py', '../_base_/datasets/underwater_enhancement_with_ann.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] train_dataloader = ...
2f939ea73ce6003c7fb819685e9df83959a82fe5bdfed907c19dc1c13ee12c94
Python
478
16
import csv import os import code OUT="./PRS" Traits=['BMI', 'WC', 'T2D', 'FG', 'HTN', 'TG', 'HDL'] for trait in Traits: file = os.path.join(OUT, trait, "score_sum_indiv.profile") with open(file, 'r') as f, open(file + '.KoGES.reformat', 'wt', newline='') as f2: reader = csv.reader(f, delimiter=' ...
5d8b34cb18409e0882950ab6630709aff9551df25fb8a0fd5608de5d238468f5
Python
478
22
import enum class DatasetState(enum.IntEnum): """Enum representing the possible states of a dataset during execution.""" UNKNOWN = 0 RUNNING = 1 FINISHED = 2 FAILED = 3 PENDING = 4 def __str__(self): return self.name @classmethod def from_string(cls, text): """Ge...
d0cd174c2b2ca560cecf4813619c1a4e8a2ac36cd38c4af1ee93bf90287b1335
Python
479
13
import numpy as np import scipy.stats def spike_to_rate(spikes, window_std=20): window_size = np.arange(-3*window_std,3*window_std,1) window = scipy.stats.norm.pdf(window_size, 0, window_std) window /= window.sum() n_units = spikes.shape[0] estimate = np.zeros_like(spikes) # Create an empty array o...
7eae3813031d8bfbbc7328b4c0f1874ce72896a706a4b9027bbe67a32a1c9155
Python
480
21
""" Test for issue 215: https://github.com/Data-Centric-AI-Community/data-profiling/issues/215 """ import pytest from data_profiling.report.formatters import fmt_percent @pytest.mark.parametrize( "ratio, expected_formatting", [ (0.01, "1.0%"), (0.001, "0.1%"), (0.0001, "< 0.1%"), ...
dde7f08cd012bd8418b2d4e23cf105f41b8d6e7305fd38d49fd2dce580c91695
Python
480
20
""" 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 importlib.metadata import PackageNotFoundError, version try: __version__ = version("fairchem....
3fbac50c636d4101a5ef4641d6a8b1e251cfe3135a7de8ac183404bbf20022e1
Python
481
20
def b( s: 'str | bytes', encoding: str = 'ascii', errors: str = 'replace', ) -> bytes: """Encode a string to bytes, passing bytes through. Args: s: String or bytes input. encoding: Encoding to use. Defaults to ``'ascii'``. errors: Error handling strategy. Defaults to ...
ba2d95ffbe7aa2d2da214d44fc0b547e5b7d2ac26d6b8ca52c7b7cadb297f83c
Python
483
9
# Ultralytics YOLO 🚀, GPL-3.0 license from .base import BaseDataset from .build import build_classification_dataloader, build_dataloader, load_inference_source from .dataset import ClassificationDataset, SemanticDataset, YOLODataset from .dataset_wrappers import MixAndRectDataset __all__ = ('BaseDataset', 'Classific...
27ded71319e7836f52760c521e83028d6dee6b5042e8562b516c623c605619f9
Python
484
11
from .standardize import VCFStandardizer from .std_delly import DellyStandardizer from .std_wham import WhamStandardizer from .std_lumpy import LumpyStandardizer from .std_manta import MantaStandardizer from .std_melt import MeltStandardizer from .std_scramble import ScrambleStandardizer from .std_dragen import DragenS...
28d267234f7a7e40b36e3b949a6f7834a8eb382b7b7b23da040031123bba7e2f
Python
486
27
# flake8: noqa # __start__ # File name: monitoring.py from ray import serve import logging from starlette.requests import Request logger = logging.getLogger("ray.serve") @serve.deployment class SayHello: async def __call__(self, request: Request) -> str: logger.info("Hello world!") return "hi" ...
d6023551b5610a49bb77a3cf1a3b261c500cb911fd233441f012f03e87982df9
Python
486
12
if __name__ == "__main__": import argparse from algo.sz_detection import szDetection parser = argparse.ArgumentParser( description="Run a seizure detection algorithm on an EDF file and store computed seizure annotations to a TSV." ) parser.add_argument("input", help="Path to the input EDF E...
312845ff54a0e320ff0237c2970b7f336dcd411361e23bf14d5d22c551997ee4
Python
487
17
# Copyright (c) OpenMMLab. All rights reserved. from mmengine.utils import get_git_hash from mmengine.utils.dl_utils import collect_env as collect_base_env import lqit def collect_env() -> dict: """Collect the information of the running environments.""" env_info = collect_base_env() env_info['lqit'] = lq...
c1417d331b6acef58900044354b64cd83fcb0195a923bf1989be748959917efb
Python
487
10
from exputils.manage.experimentgenerator import generate_experiment_files from exputils.manage.experimentstarter import start_experiments from exputils.manage.experimentstarter import start_slurm_experiments from exputils.manage.experimentstarter import start_torque_experiments from exputils.manage.experimentstarter im...
66b64b1eb00a8fe621ba83598e4031d5416118fede311fee23a258a9e3af3b46
Python
488
23
""" =========== MaxSpike =========== :class:`~sinabs.activation.MaxSpike` activation function. """ import matplotlib.pyplot as plt import torch import sinabs.activation as sina v_mem = torch.linspace(0, 5.5, 500) spike_threshold = 1.0 activations = sina.MaxSpike(max_num_spikes_per_bin=2).apply( v_mem, spike_thr...
edc6cbf10b9c67a4e04c31cf971ca5b024f6bd748a2d2c711ccf1546a12b0cca
Python
488
18
from rising.transforms.abstract import AbstractTransform def chech_data_preservation(trafo: AbstractTransform, batch: dict, key: str = "data") -> bool: """ Checks for inplace modification of input data Args: trafo: transforamtion batch: batch with torch.Tensor data key: key to exa...
1b6465324b97f8b052069f933abe09596b71ec9b94a9820c79619f54e1f42700
Python
489
22
import torch from sinabs.layers.channel_shift import ChannelShift def test_channel_shift_default(): x = torch.rand(1, 10, 5, 5) cs = ChannelShift() out = cs(x) assert out.shape == x.shape def test_channel_shift(): num_channels = 10 channel_shift = 14 x = torch.rand(1, num_channels, 5, ...
20781de2d8dd70223c8ba5857e07ec99742686ebc0e4ae1fa2a3932787af226d
Python
489
12
from .transformer import Transformer from .vitautoenc import ViTAutoEnc from .unet import UNet3D from .unet_3d import UNet3DBase from .focal_loss import SigmoidFocalLoss from .unet_img_model import ImageModel as UNet3DModel from .img_model_wrapper import ImagingModelWrapper from .resnet_img_model import ResNetModel fro...
7207d7f1863390715fed75974fa55caa7de89fe18e661d719d8012760a1a6309
Python
490
15
""" 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 os DISSOCIATION_REACTION_DB_PATH = os.path.join( __path__[0], "dissociation_reactions_22May2...
92594103359f61ee1eae311d627e0db7ac45e610a873115b74abd5d09652f08e
Python
490
15
from pathlib import Path import os #list of subj_ids subj_id = ['c01', 'c02', 'c03', 'c04', 'c05', 'c06', 'c07', 'c08', 'c09', 'c10', 'c11', 'c12', 'c13', 'c14', 'c15', 'c16', 'c17', 'c18', 'c19', 'p01', 'p02', 'p03', 'p04', 'p05', 'p06', 'p07', 'p08', 'p09', 'p10', 'p11', 'p12', 'p13', 'p14'...
772d6d1f20e1676134fe23fb71dc22c182bbd80775ba5ef081dc590d859cb5d4
Python
491
16
from __future__ import annotations from typing import Any from ..gateway.routing import GatewaySessionRegistry from .models import ConversationRoute class MessageRouter: """Resolve runtime conversation routes into Jarvis sessions.""" def __init__(self, session_manager: Any) -> None: self._registry ...
93ea2c994abdb9d4ca0fe9ec496c348ff6fbc86104037284880bb53828362d98
Python
492
22
""" ======================== Integrate and Fire (IAF) ======================== :class:`~sinabs.layers.IAF` layer. """ import torch from utils import plot_evolution import sinabs.layers as sl const_current = torch.ones((1, 100, 1)) * 0.03 single_current = torch.zeros((1, 100, 1)) single_current[:, 0] = 0.1 iaf_neuro...
7b87b2627ce188fc085b7d2d83faf7ecabb0ffa3ef218b839b95c0e1c6557982
Python
493
8
from agent.data.entities.config import DEV_ITEM_FILTER, DEV_LABEL from agent.classifiers.data.tr_ffnn_fd_dataset_mgmt import get_datasets_from_filter def get_datasets(pretrained_model, max_lenght, binary_classifier=False, _expand_tokenizer=False, _use_saved_model=True, _tokenizer_type="text", _cuis=No...
e19eb59b73fd354c1b79bb0ae7cc002aceb2df621de946a2491c9e1d7a3779c0
Python
493
17
# This file is autogenerated by the command `make fix-copies`, do not edit. from ..utils import DummyObject, requires_backends class OnnxRuntimeModel(metaclass=DummyObject): _backends = ["onnx"] def __init__(self, *args, **kwargs): requires_backends(self, ["onnx"]) @classmethod def from_conf...
10284812449d7ce0eb5e24aa3f7f4e4284e2b25be923cd3f65d3cdd99d6cc439
Python
494
23
from dataclasses import dataclass import numpy as np from .node import NIRNode @dataclass(eq=False) class Delay(NIRNode): r"""Simple delay node. This node implements a simple delay: .. math:: y(t) = x(t - \tau) """ delay: np.ndarray # Delay def __post_init__(self): # set...
2f844548ec07d67e6c7ef2026217b3e59aec1fe72f5a407c82f6aa77365dafb7
Python
495
16
from pathlib import Path import pandas as pd from data_profiling import ProfileReport from data_profiling.utils.cache import cache_file if __name__ == "__main__": file_name = cache_file( "colors.csv", "https://github.com/codebrainz/color-names/raw/master/output/colors.csv", ) df = pd.rea...
a949ae3fddb6e8ba44c08a0373ffeada7d245ae4b4a7dfa9e8686bd24fae9eec
Python
495
15
import importlib def load_function_or_class(path): """Load a function or class at runtime given a full path. Example of the path: mypkg.mysubpkg.myclass """ class_data = path.split(".") if len(class_data) < 2: raise ValueError("You need to pass a valid path like mymodule.provider_class") ...
21151db8d70d09f6a671335f3242e5184a665b1577e39bc7168043f55a81d0e3
Python
496
16
from ._features import make_dataset, H5TileDataset, train, deploy __all__ = ["make_dataset", "H5TileDataset", "train", "deploy"] __author__ = "Marko van Treeck" __copyright__ = "Copyright 2022, Kather Lab" __license__ = "MIT" __version__ = "0.3.0" __maintainer__ = "Marko van Treeck" __email__ = "mvantreeck@ukaachen.d...
5fb284f684a56def38ebda19858fd75e821b178c9c996b7903ca82e7e87e5135
Python
496
17
from pathlib import Path import pandas as pd from data_profiling import ProfileReport from data_profiling.utils.cache import cache_file if __name__ == "__main__": file_name = cache_file( "chicago_employees.csv", "https://data.cityofchicago.org/api/views/xzkq-xp2w/rows.csv?accessType=DOWNLOAD", ...
0f731956a14ee63ee9ca8d52d60426f41e516600f21739ea444756929cc2ea0f
Python
497
8
from agent.data.entities.config import TEST_ITEM_FILTER, TEST_LABEL from agent.classifiers.data.tr_ffnn_fd_dataset_mgmt import get_datasets_from_filter def get_datasets(pretrained_model, max_lenght, binary_classifier=False, _expand_tokenizer=False, _use_saved_model=True, _tokenizer_type="text", _cuis=...
1be097f42ef681538e98feb5af49c6fa05ce4fbdab3c13cc1136d8758a1bd952
Python
497
19
"""Endstate reweighting from MM to NNP""" # Add imports here from .endstate_correction import * # Handle versioneer from ._version import get_versions versions = get_versions() __version__ = versions["version"] __git_revision__ = versions["full-revisionid"] del get_versions, versions import logging # format loggin...
6f27adc1fe371d8a61f8be5008474e86add2e68821bc69f1679fbbbed4cf2d6d
Python
497
8
from case1 import * import time,os; t0=time.time(); fn="c1_par.json" d=json.load(open(fn)) if os.path.exists(fn) else {"true":[],"est":[]} while len(d["true"])<int(sys.argv[1]) and time.time()-t0<230: p=TRUE+rng.normal(0,0.6,10); p[9]=np.log(0.7); p[8]=TRUE[8]+rng.normal(0,0.8) D=design(275,60,80,80); Y=simulat...
34fc01ae75857afcb6efa050869aac89a1eca3d1d7b35a83dadf4abf73081bd1
Python
498
4
from ._flow_expressions import construct_flows_from_cellchat, construct_flows_from_commot, construct_flows_from_cellphonedb, construct_flows_from_liana from ._flow_preprocessing import subset_for_flow_type, filter_flow_vars, determine_differentially_flowing_vars, determine_spatially_flowing_vars, determine_informative_...
bce812afe6d019165e02668a1a0f82a36ff009eb077051abc179296ab9220f6b
Python
498
25
# __anti_pattern_start__ import ray ray.init() @ray.remote def f(i): return i # Anti-pattern: no parallelism due to calling ray.get inside of the loop. sequential_returns = [] for i in range(100): sequential_returns.append(ray.get(f.remote(i))) # Better approach: parallelism because the tasks are executed...
010b323895768ac83a78e07facf71dae5426a9f5715ab16a892cb97ba17310c6
Python
499
15
import pandas as pd from matplotlib import pyplot as plt import argparse #parser = argparse.ArgumentParser("dir") dataDir = "6lu7/log336h_6lu7/data10/" cols = ["Docking_Score", "QED_score", "Toxicity_Probability"] df = pd.read_csv(dataDir+"present/scores.csv", names=cols) for col in cols: fig, ax = plt....
5fdc0a940e2793cfbf0d2ed60623c7b9b1d940c6f83ac484d0e91e15e9b13423
Python
499
21
import torch.nn as nn from sinabs.activation import Quantize class QuantizeLayer(nn.Module): """Layer that quantizes the input, i.e. returns floor(input). Args: quantize: If False, this layer will pass on the input without modifying it. """ def __init__(self, quantize=True): super()...
37788b95531a84f2c36213bfcbefc0c0b2c8b8ba8402fbd7fad180f937ae460e
Python
500
23
import gym class ScaleReward(gym.RewardWrapper): """Scale reward by a scale factor. Args: env: Env to wrap. scale (float): Scale factor. Attributes: scale: Scale factor. original_reward: Reward before casting. """ def __init__(self, env, scale): super()._...
55fa0e40df59b5815becf0bc4b4018fc825eb18d029da7b30550d0862f1ac84b
Python
500
18
""" ======================================== Adaptive Leaky Integrate and Fire (ALIF) ======================================== :class:`~sinabs.layers.ALIF` layer with an adaptive threshold based on the output spikes. """ import torch from utils import plot_evolution import sinabs.layers as sl const_current = torch.o...
5d361b8f35d0727a67fb35c8422a0c9cd4a0b38e85cb6d10f08a9473c0a43b85
Python
500
8
import case3; case3.EXT=True from case3 import * import time,os,warnings; warnings.filterwarnings("ignore"); t0=time.time(); fn="c3_par.json" d=json.load(open(fn)) if os.path.exists(fn) else {"true":[],"est":[]} while len(d["true"])<int(sys.argv[1]) and time.time()-t0<230: p=TRUE+np.r_[rng.normal(0,0.35,9),0,0]; dd...
b3f1586d1adab69d7cddf33d1e246705589b2e8bf07899e35ff9f38dba818875
Python
500
19
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Read HCP1200 subjects with resting-state fMRI scans based on the directory structure extracted from DataLad. Output: 'r_allHCP_subjects.txt' Resting-state HCP subjects are listed at each line. """ import os import numpy as np #Extract all available subject files. ...
5d7c454f4100ca1df03bd950e24324e6d0aaf3730094d93d82b3977b87602f85
Python
501
17
{ 'grid_search': { '__factory__': 'palladium.fit.with_parallel_backend', 'estimator': { '__factory__': 'sklearn.model_selection.GridSearchCV', 'estimator': {'__copy__': 'model'}, 'param_grid': {'__copy__': 'grid_search.param_grid'}, 'scoring': {'__copy...
4f40c7adcf377428b7201d486e605fb89bc42b09294ea0aadd16da87e9377509
Python
503
17
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.27.0")): raise OptionalDependencyNotAvailable() except Opt...
02a7f5dd39992d140e8ed47058acfcb1dfddba48b7a3fda0b3a65abba2d12f19
Python
504
23
import pandas as pd import pytest from data_profiling import ProfileReport @pytest.fixture def correlation_data_num(spark_session): correlation_testdata = pd.DataFrame( { "test_num_1": [1, 2, 3, 5, 7, 8, 9], "test_num_2": [11, 12, 13, 15, 17, 18, 4], } ) return sp...
17d490aa2e6023a89c72318997d6227e9511fec987280c26a5c6ca69ceb406d6
Python
505
15
from samri.pipelines.reposit import bru2bids BRU_DIR = '/usr/share/samri_bindata/' # The `20180730_053743_6587_1_1` measurement is acquired with the (incorrect) Bruker ParaVision Prone (i.e. supine) orientation. # This is relevant for testing the flip_if_needed function def test_bru2bids(tmp_path): bru2bids(BRU_DIR,...
4e90f675378121e6aacdc1aebabeae00567ee8cd5a81b0871a91ec40f5d4272f
Python
505
8
from agent.data.entities.config import CTT3FR_ITEM_FILTER, CTT3FR_LABEL from agent.classifiers.data.tr_ffnn_fd_dataset_mgmt import get_datasets_from_filter def get_datasets(pretrained_model, max_lenght, binary_classifier=False, _expand_tokenizer=False, _use_saved_model=True, _tokenizer_type="text", _c...
0df7d7e34983cd64cc0b26212ae76021e061b6a4d2a624a4573700311b9ef1d6
Python
506
17
# This file is autogenerated by the command `make fix-copies`, do not edit. from ..utils import DummyObject, requires_backends class MidiProcessor(metaclass=DummyObject): _backends = ["note_seq"] def __init__(self, *args, **kwargs): requires_backends(self, ["note_seq"]) @classmethod def from...
2c3e525d68685ac7d613087e79871953061015c9547539c10b14412ec565cf07
Python
507
8
from agent.data.entities.config import CTT3_TEST_ITEM_FILTER, CTT3_LABEL from agent.classifiers.data.tr_ffnn_fd_dataset_mgmt import get_datasets_from_filter def get_datasets(pretrained_model, max_lenght, binary_classifier=False, _expand_tokenizer=False, _use_saved_model=True, _tokenizer_type="text", _...
30a2967a7158df7cbffd72d5ce2092b8734bbc4c762cab1a48c9e8b1a42801c4
Python
507
21
from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("engine", "0109_replica_job_type"), ] operations = [ migrations.RenameField( model_name="task", old_name="consensus_replicas", new_name="initial_replicas"...
d43af0d2bad2ae4505b3c74411a061cc008bfdf78dee69bf5e76b7f09da33c1e
Python
507
5
# -*- coding: utf-8 -*- import sys from mozaik.meta_workflow.parameter_search import CombinationParameterSearch,SlurmSequentialBackend,LocalSequentialBackend import numpy #CombinationParameterSearch(LocalSequentialBackend(),{'sheets.exc_layer.ExcExcConnection.weights' : numpy.linspace(0.0,0.006,5),'sheets.inh_layer.Inh...
e8b40f0fed1188627b7d2f43addb18b75664983cad687a1a64fd4a9322513e1d
Python
507
18
# copy svimmer merged calls for each sample to my folder import os samples = [i.strip() for i in open("samples.txt")] fdir = "svimmer_result_directory" odir = "union" if not os.path.exists(odir): os.mkdir(odir) w = open("vcf_list_union", 'w') for i in os.listdir(fdir): if i[:-7] in samples: os.system("cp ...
054ac147666d5acd7afd5a1ffaa10967ee6a763abcd753bfb2697b69bc331aef
Python
508
18
import argparse import lib.dataset_config_parser.dataset_config_parser as dcp import sys from typing import List if __name__ == '__main__': parser = argparse.ArgumentParser('Parse the results of the GLM fit grid search') parser.add_argument('cfg_path', type=str, help='path to config') args = parser.pars...
ba4b5e6786a4beb1898a0e93f8033919d380a6a05a57d8a1dc304e3cddc9eaea
Python
508
10
from case1 import * import time,os; t0=time.time() models=["M0","M1","M2","M2c","M3"]; gi=int(sys.argv[1]); R=int(sys.argv[2]); gm=models[gi] fn=f"c1_gen{gi}.json"; rows=json.load(open(fn)) if os.path.exists(fn) else [] while len(rows)<R and time.time()-t0<240: D=design(); p=TRUE.copy() if gm=="M0": p[[1,4,5]]=...
7d8212d444b3ea8da75e9531c3df8f105940f40205a1ae626b3f642e18a0509e
Python
509
19
# Generated by Django 4.1.6 on 2023-02-06 03:53 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("infer", "0004_alter_organism_ncbi_taxon"), ] operations = [ migrations.RemoveField(model_name="weights", name="path",), migrations.Ad...
935d2466d37883aa1d644113904b0d0ba925b1d85463c1655df4c30c71524eed
Python
510
19
import os import argparse import easygrid import pdb # DFR add 8-31-21 testOutputPath = "/net/trapnell/vol1/home/readdf/trapLabDir/hubmap/results/2021_08_27_GWAS_work_nobackup/testEasyGridDir/" pipeline = easygrid.JobManager(testOutputPath) testOutFile = testOutputPath + "helloWorld.txt" testCommand = 'e...
d6b0918b318cf93200e51e4d5d481e6023dd7dc8899ca3ce3ea79e1d24d66590
Python
510
21
"""This file add the decorator on the DataFrame object.""" from pandas import DataFrame from data_profiling.profile_report import ProfileReport def profile_report(df: DataFrame, **kwargs) -> ProfileReport: """Profile a DataFrame. Args: df: The DataFrame to profile. **kwargs: Optional argumen...