sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
96079cf8b702df29aba6a3b1d20c0ec9a93791d2b6b70da22e2a56b2106e76b8
Python
7,708
202
from keras.src import backend from keras.src import ops from keras.src.api_export import keras_export from keras.src.callbacks.callback import Callback @keras_export("keras.callbacks.SwapEMAWeights") class SwapEMAWeights(Callback): """Swaps model weights and EMA weights before and after evaluation. This call...
c60434eea2c509ee2a2e076d58f00f3e04cd14347041c399ee7482a1a3f60373
Python
7,708
283
"""Read-compatibility tests for TorchLens 2.16.0 ``.tlspec`` fixtures.""" from __future__ import annotations from pathlib import Path from typing import Any import pytest import torch from torch import nn import torchlens as tl from torchlens.intervention.types import HelperSpec, InterventionSpec from torchlens.opt...
6d16ff4bcd3f19c874f9e02d35f972400b2611e48540415f3d1bf17072a7f249
Python
7,709
229
# Copyright 2022 Deepfold 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 law or agreed to in writin...
ed4df050d73b4e5823f9ca6e460b516d7cef4c73cbdba2d8b20eb7379be5b000
Python
7,709
230
"""Tests for the specparam.models.event, including the event model object and it's methods. NOTES ----- The tests here are not strong tests for accuracy. They serve rather as 'smoke tests', for if anything fails completely. """ import numpy as np from specparam.models import SpectralGroupModel, SpectralTimeModel fro...
f56471b3feccfba0e3906f79b67754abe662359b83bf4fda44b85fa2cf201584
Python
7,709
211
# coding=utf-8 # Copyright 2023 The Google Research Authors. # # 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 applicab...
bed1f9bfb38715224cbbafa5fbe93ed832dc0a88989fb332074ad2621df391de
Python
7,713
237
""" module for custom functions used for creating and training the model """ import torch import torch.nn as nn import torch.nn.functional as F import torchvision import torchvision.models import pytorch_lightning as pl from time import time import scipy from pytorch_lightning.utilities.types import EVAL_DATALOADERS, ...
ba1392c85dde67bbf672cef0a7bac9e1ece355e04778cd1456247f6189f968dd
Python
7,715
208
from collections import namedtuple import os import struct from time import sleep import nibabel as nb import numpy as np import string def mosaic(data): x, y, z = data.shape n = np.ceil(np.sqrt(z)) X = np.zeros((n*x, n*y), dtype=data.dtype) for idx in range(z): x_idx = int(np.floor(idx/n)) * ...
6a390018e016ce5e6a2465f4c906b438ad98c4a4ee361c8e74ed2ce48bc7fd64
Python
7,716
212
"""Tinygrad recurrence grouping: multi-pass layers, relabel safety, tamper oracles.""" from __future__ import annotations import dataclasses from typing import Any import pytest tinygrad = pytest.importorskip("tinygrad") from tinygrad import Tensor # noqa: E402 import torchlens as tl # noqa: E402 from torchlens...
afa54990e4aedc14abd55fd9fac93fcb3a5c0b0364dccba9d7c8235f592ae471
Python
7,716
208
#!/usr/bin/env python3 """ File: create_replication_heatmap.py Created: 2022/12/20 Last Changed: Author: M.Vochteloo Copyright (C) 2020 University Medical Center Groningen. A copy of the BSD 3-Clause "New" or "Revised" License can be found in the LICENSE file in the root directory of this source t...
f184235168d45fd79acc7ba1a9d17e30fc919beb1b5509bedc20d613c88b4b8e
Python
7,716
171
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Do very simple cleaning of .bam files for ATAC-seq data pre-processing. # # This script: # * Drops low mapping quality reads (<10) # * Removes chrM mitochondrial reads # * Removes PCR duplicates (using samtools) # * Removes blacklisted regions (from ENCODE or custom bla...
d3654ce822050bac94952fc4ce8191693aec8ee1f96652735bdb6ccaa7a430e1
Python
7,720
154
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
688bb5fb2e4a10dad5eb23b0eae4da0c7647c00f7f1b56b1abcf64b356050f28
Python
7,722
244
import tensorflow as tf from tensorflow import keras from functools import partial import numpy as np import os import cv2 from tensorflow.keras.preprocessing.image import ImageDataGenerator def crop_top(img, percent=0.15): offset = int(img.shape[0] * percent) return img[offset:] def central_crop(img): ...
965f96369cc0e5b5001e7fc5d0a2c878f9b7a7e5dafbf796b88ae39d04156ff8
Python
7,723
197
#!/usr/bin/env python3 """ Dx Y2 — severity-stratified sensitivity under the Dx AA canonical tool. Re-runs Dx Y but applies the rank-norm + whitening + Quad_LDA pipeline that became canonical at Dx AA, instead of the z-score tool that Dx Y originally used. Same severity bands as Dx Y: - Severe: MMSE < 12 (or MoCA ≤ 1...
a22554be91150277ffc9220d8dc9355170cea45a8a1b7eced14aacf84fdcc273
Python
7,723
207
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Data loader.""" import itertools from functools import partial import numpy as np import torch from slowfast.datasets.multigrid_helper import ShortCycleBatchSampler from torch.utils.data._utils.collate import default_co...
2f7e8e7b2e44dcfca64e39202a2254aa3245d7ee686ac38b9d919df0dad6bbc5
Python
7,724
195
from typing import Iterable, List, Optional from codecarbon.core import gpu_amd, gpu_nvidia from codecarbon.core.gpu_device import GPUDevice from codecarbon.core.units import Time from codecarbon.external.logger import logger AMDSMI_AVAILABLE = gpu_amd.AMDSMI_AVAILABLE PYNVML_AVAILABLE = gpu_nvidia.PYNVML_AVAILABLE ...
65229e75e5238f1c65d97ee3ca32d36e630859ce876c01ba190778cfe862d829
Python
7,724
218
import numpy as np import scipy.stats from ridge_utils.npp import mcorr def model_pvalue(wts, stim, resp, nboot=1e4, randinds=None): """Computes a bootstrap p-value by resampling the [wts] of the model, which is [wts] * [stim] ~ [resp]. """ origcorr = np.corrcoef(resp, np.dot(stim, wts))[0,1] if ra...
ac562a832e4a749a6a899fa7fb8108d88122cfe23151081b598417b6acb8d4a9
Python
7,724
201
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Test objects and function in tfep.nn.transformers.mixed. """ # ===============================================...
d6973bba3cc9bde1b224fc629f38177b0bdb47f5d440b2dd10cfe4f36c87cd22
Python
7,724
176
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license """Depth estimation trainer for YOLO models.""" from __future__ import annotations from copy import copy from pathlib import Path from typing import Any import torch from ultralytics.models import yolo from ultralytics.models.yolo.detect import Det...
16ee3051d550b5f3e530b734480ddcddba6542333ab164bd70d67708b7ea2d52
Python
7,726
239
"""Tests for Phase 6 NaN/Inf debugging affordances.""" from __future__ import annotations import pytest import torch from torch import nn import torchlens as tl from torchlens.errors import CaptureError from torchlens.partial import PartialTrace class NonFiniteFixture(nn.Module): """Tiny module that produces N...
e2beecdcf7807be6246eed5b3a878d851f6d705309d40b5331a9cf0d2d31b8ec
Python
7,728
183
""" Functions for parsing and verifying input parameters. Copyright (C) 2021 Tham Cheng Yong This file is part of NanoVar. NanoVar is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License...
c65fc5de672039d30a743dcb9f79b3c6ca2adec51221491cf674d770a6327f9d
Python
7,731
259
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Lighting(_BaseTraceHierarchyType): _parent_path_str = "cone" _path_str = ...
15f7dcb8f169764f9f83ee173cc818502b60e15b1bc0babfbcb0b8df66b1d058
Python
7,733
241
""" Model architecture from open_ipcl repository. https://github.com/harvard-visionlab/open_ipcl MIT License Copyright (c) 2021 grez72 ## Architecture modified by jfeather for metamer code compatability## """ from __future__ import print_function import torch import torch.nn as nn from IPython.core.debugger import...
a7bda7e149ad09d46bfe18ab2a5dbfc72cafa1ec080a2a3f54f0ad8c24de862f
Python
7,733
219
# Copyright 2022 Deepfold 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 law or agreed to in writin...
afb93777d32a5972653e41d842e82a3aeee03ee4d4c3114a140ee813c8427978
Python
7,733
163
from __future__ import print_function import tensorflow as tf import os, argparse, pathlib from eval import eval from data import BalanceCovidDataset # To remove TF Warnings tf.compat.v1.logging.set_verbosity(tf.compat.v1.logging.ERROR) os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' parser = argparse.ArgumentParser(descri...
a62e45c5eb28ef1f028252032defec3b5b3fa82944cd4880d10abdcc1bd0c048
Python
7,737
234
import os import cv2 import numpy as np import scipy.ndimage from torch.nn.functional import cosine_similarity import torch from matplotlib import pyplot as plt def denormalize_(image): # 去归一化 image = image * (255 - 0) + 0 return image def array2image(array): image = np.ceil(255 * (a...
7f8780e7e62943d02b3a6ba67165e0a17928374b39ba3d0c9b017cecab853e5f
Python
7,738
201
import lzma import zlib import pytest DATA = b"pyrosm reads OpenStreetMap data " * 64 @pytest.mark.parametrize( "case, stream, size, expected", [ ("declared size", zlib.compress(DATA), len(DATA), DATA), ("size too small", zlib.compress(DATA), len(DATA) - 1, None), ("size too large",...
da3a9dd1b85489872b07752d234ddae56f8852f7efd7cfcfd4765f02d38540e5
Python
7,738
196
import warnings from typing import Any import gymnasium as gym import numpy as np import pytest from matplotlib import pyplot as plt import neurogym as ngym from neurogym import _PSYCHOPY_INSTALLED from neurogym.core import BaseEnv, TrialEnv from neurogym.envs.registration import all_envs, all_tags, make from neurogy...
eff1cdc4049549ef2e7cc5fe8fa75e9704339adaf91a9881b553d51947bd4e3e
Python
7,738
188
import os import random import numpy as np import json from collections import OrderedDict def seq_format(proteins_dic, output_dir): # datasets = ['kiba', 'davis'] # for dataset in datasets: # seq_path = os.path.join('data', dataset, 'seq_original') # fpath = os.path.join('data', dataset, 'proteins.tx...
aff01421aea0d3dc7d09e29ce140582b80c47bc43506abccb351be8c2e425dba
Python
7,739
268
"""P1 backward sidecar trigger and registry tests.""" from __future__ import annotations from typing import Any import pytest import torch from torch import nn import torchlens as tl from torchlens.backends.torch import backward as backward_mod from torchlens.backends.torch.backward import ( _BACKWARD_GRAD_FN_R...
f10908cd68e35d023c50897aecf72becd509e6f6fb149db51531206e292f1073
Python
7,739
185
"""Smoke-tier wiring test for ``benchmarks/perf_gate.py`` (b10 R78 round-3). The perf gate existed with NO smoke-tier exercise: a refactor could break its import, its baseline files, or its comparison math and nothing red would show until someone ran a real benchmark. This file imports the gate machinery, checks the c...
f31e6fa3d182114c9e4223dd6eb65a0808d8ecd42f9a3f37342b0aac0c1f1bba
Python
7,742
203
"""Phase 2 capture-unification regression tests.""" from __future__ import annotations import inspect from pathlib import Path from typing import Any import pytest import torch from torch import nn import torchlens as tl from torchlens import _state from torchlens.backends._protocol import CaptureBackend from torch...
7555afd10a47c8b568a18edd648ed64b17460d9ee9734f16c943919925ca5e5b
Python
7,744
229
### Support for some raw binary data formats (MLF, PLS, PIC) ### MLF is format by Moor Instruments ### PLS is format by D. Postnov (jr) ### PIC format is used on CCDB import numpy as np from numpy import uint16, uint32, uint64 from numpy import int16, int32, int64 import numbers def read_at(fid, pos, Nelem=1, dtype=u...
e6d95d4047859027e23b654761867a8b214cdc98fd486ec9d3683e43f22c9021
Python
7,746
210
import os import pandas as pd from PIL import Image import torch from hn_cnn.constants import * from hn_cnn.image_preprocessing import process_scan # Mapping for the clinical data # Include each variable: Primary Site, T-stage, N-stage, ... # Key: the name of the column containing the variable in the dataset # ...
8f4ae879fc5d269176cfe9eb5104b27a2952f0cca32948532933b7784d990141
Python
7,747
258
import numpy as np import matplotlib.backends.backend_pdf import matplotlib.pyplot as plt from analysis_utils import get_adjacency plt.rcParams['figure.figsize'] = (5, 5) plt.rcParams.update({'font.size': 20}) freq = ['0.015_0.75_pinknoise.mp4', '0.015_1.5_pinknoise.mp4', '0.015_12_pinknoise.mp4', '0.015_3...
a56f353b14104d6402b5edfc025fae5446b732d5d632c9a799b8eef1db70b259
Python
7,752
193
""" Translation main class """ import os import torch from bioseq2seq.constants import DefaultTokens from bioseq2seq.inputters.text_dataset import TextMultiField from bioseq2seq.utils.alignment import build_align_pharaoh import seaborn as sns import matplotlib.pyplot as plt class TranslationBuilder(object): """ ...
0c6dd5cda69d9586848806befaf7cc684113f68a8fe72adcab3db98c0b510fa1
Python
7,753
175
import numpy as np import vtk, slicer import vtk.util.numpy_support as vtk_np from slicer import vtkMRMLScalarVolumeNode from slicer import vtkMRMLLabelMapVolumeNode from biomedisa_extension.SegmentEditorBiomedisaPrediction.Logic.BiomedisaPredictionParameter import BiomedisaPredictionParameter from biomedisa_extension....
4ebaf0545e9db4a0e75f5f7845decb1adc457b76254f5a7ec1819c926ba5a639
Python
7,753
260
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Lighting(_BaseTraceHierarchyType): _parent_path_str = "mesh3d" _path_str ...
d33a38d992e01302c01c4eb70b30647b40e113eaeabb269f09bc951e6afcbdf7
Python
7,753
260
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Lighting(_BaseTraceHierarchyType): _parent_path_str = "volume" _path_str ...
3ca218cd35bb1dba5c08c1733f025e6e27c65a25e2e2e718a23cdc6541140b6d
Python
7,754
205
import os import numpy as np import pandas as pd from mirp.settings.generic import SettingsClass from mirp.settings.transformation_parameters import ImageTransformationSettingsClass from mirp.settings.feature_parameters import FeatureExtractionSettingsClass from mirp.settings.resegmentation_parameters import Resegmen...
552f128ebdc87809e774ea648c2e8c13e40b140ec2e9f7068a7c75f9cbcc3fa2
Python
7,757
205
try: import llspy except ImportError: import os import sys thisDirectory = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(thisDirectory, os.pardir, os.pardir)) import llspy import json import multiprocessing import os import sys import time from distutils.version impor...
636c3eae5daabfb28facf8366c3d917f6a1bc10061d1caa06459a85e06fd07fd
Python
7,757
219
# coding=utf-8 # Copyright 2024 The Google Research Authors. # # 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 applicab...
cc0a5a95652207250e117ffe515c061c66d352f8fc007dfc332a1b48c0155501
Python
7,757
259
""" Plot previous choice weights against previous stimulus weights """ import matplotlib import matplotlib.pyplot as plt import numpy as np import pandas as pd import pylab as pl import seaborn as sns import pycircstat as pc matplotlib.rcParams["pdf.fonttype"] = 42 sns.set( style="ticks", font="Helvetica", ...
0ee509ccb0a314940b477cc9a627fd43f76448d6cf4449cc4f0d6e3cec21134d
Python
7,760
215
"""Robustness sprint PR 3 — parallel/framework robustness. Covers the parallel-wrapper and framework-integration subset of the catalog: - ``DistributedDataParallel`` unwraps via ``.module`` just like ``DataParallel`` (previously only the latter was handled, so DDP users got silently-wrong layer addres...
363beb9b876bbf31b95f777aad7029eb3c62776ac19c8ab20010de90b78a15b1
Python
7,760
220
import os from tqdm import tqdm import os.path as osp from typing import * from torch_geometric.data import ( Data, InMemoryDataset, download_url, extract_zip, ) import numpy as np import torch from torch import Tensor from torch_geometric.utils import scatter from torch_geometric.data import Data, ...
952fad85f359800a42d1b9e5cde7f1e968ec260592a4c7dfcf408852f0a55f43
Python
7,760
226
from argparse import ArgumentParser from typing import Any import torch from pytorch_lightning import LightningModule, Trainer, seed_everything from torch import Tensor, nn from torch.utils.data import DataLoader from pl_bolts.callbacks import LatentDimInterpolator, TensorboardGenerativeModelImageSampler from pl_bolt...
0c5c88b0fa72138efd785447da81812f5eeb1c16dbab925cb807790ed82df69f
Python
7,761
171
"""Place cell related functions.""" import numpy as np from spiketools.spatial.utils import compute_nbins from spiketools.spatial.occupancy import compute_bin_counts_pos from spiketools.spatial.checks import check_bin_definition from spiketools.utils.checks import check_array_orientation from spiketools.utils.extract...
c4f74f5fbdaec651b5638bc86892bc73a2a5311e868953df8e73ce76c9403bc7
Python
7,761
207
"""A-RAGGED-DOCS: pass-vs-step teaching honesty + the episode pass-axis disclosure. Pins the foldB D11 docs-honesty fix (OPUS r3 R3-7): the shipped ``pass_variance`` example taught "variance explodes late in the sequence" as ``passes=[8, 9, 10]``, which is FALSE on any model whose layer is not called at every step — p...
e6a6b6dbd440677b204275473037fa448e090b9e5d0ac48e7696998d0820685e
Python
7,762
224
# Copyright (c) 2021 PaddlePaddle Authors. 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 app...
162dc8936f900f1506292d83d54bfab58889a005f8bc7ba9f48a415eaa404952
Python
7,763
195
''' K-Folding script author: obanmarcos ''' import os import os, sys from config import * sys.path.append(where_am_i()) import lightning as pl import argparse import numpy as np import matplotlib.pyplot as plt import pandas as pd from utilities import dataloading_utilities as dlutils from utilities.folders import * ...
84fefaa9ab8ec4ca78846aadc74eaaef7737522915cb79d7ec03305be872474d
Python
7,763
294
from typing import List, Tuple, Dict, Union, Optional import argparse import logging from pathlib import Path from pprint import pprint import numpy as np import numpy.typing as npt from ase import units as ase_units import plotly.express as px import plotly.graph_objects as go import pandas as pd import torch...
534dc4a0a019bae47362a7c1a111ef3478269fdafc2ae499c1c394c746fdb542
Python
7,767
176
import copy import json import os from collections import OrderedDict import PIL.Image import numpy as np import torch import torchvision from torch.utils.data import Dataset from datasets.basic import MultiSiteDataset from utils.project_utils import get_platform_specific_value class MidlineDataset(MultiSiteDataset...
d7be79a02ef105a7d8a008c50f078cd4239d2ed93f8ffcc14f8afb234146eb21
Python
7,768
265
import locale locale.setlocale( locale.LC_ALL, 'en_US.UTF-8' ) import re import pdfplumber import pandas as pd import dateparser try: from local_extractor.utils import common_utils from local_extractor.utils import custom_exceptions from local_extractor.utils.table_concatenation import concatenate_tables...
f7e6f60b6eeb3248a677352fffef93f1b562530d49bdd64bad03e32113c2bcae
Python
7,768
155
# -*- coding: utf-8 -*- import os import yaml import argparse import numpy as np from utils import check_folder, read_yaml, save_yaml, write, get_subject_name, get_output_name, aggregate_cv, create_maps, fetch_masker, fetch_data, get_nscans from utils import get_splitter_information, get_compression_information, get_d...
b0e13c32719827f583fc0c240bc552c623b0bab70a740bfe9431880f8ec0a6cd
Python
7,770
281
"""Utility functions for working with data arrays.""" from copy import deepcopy import numpy as np from scipy.ndimage import gaussian_filter from spiketools.utils.extract import create_nan_mask from spiketools.utils.checks import check_array_orientation, check_param_options, check_bin_range #######################...
ad920c19289a2adece3d1ac3ce1cd4bfa2f5dbf5b8fff16318badab4b36a093b
Python
7,771
133
# pylint: disable=line-too-long,too-many-lines,missing-docstring """UCF101 video action classification dataset. Code adapted from https://github.com/open-mmlab/mmaction and https://github.com/bryanyzhu/two-stream-pytorch""" import os from ..video_custom import VideoClsCustom __all__ = ['UCF101'] class UCF101(VideoCls...
2d2e8d13ddd5b3609e9209c3106bde13653995658d74c0c235b6da539d810b7e
Python
7,773
260
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Lighting(_BaseTraceHierarchyType): _parent_path_str = "streamtube" _path_...
46f207123dc4a23e9a6b533956dc078bbd6ae75ea81b0b94087cc9addce2aa68
Python
7,773
260
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Lighting(_BaseTraceHierarchyType): _parent_path_str = "isosurface" _path_...
87c657640f756b947f7844177c076ede9e4f4e8a168373186a08b9a283572e10
Python
7,774
190
"""Quickstart real-model rows (F17 B17; memo section 6). Real checkpoints, never toy stand-ins: resnet18 (IMAGENET1K_V1), gpt2 (real tokenizer), CLIP (the multi-input boundary rider). Missing libraries skip; missing checkpoints on a provisioned box are setup failures, never skips. All cost assertions are counters, nev...
a82499afaf8c848fe7d231d44b50fbdf201fa648143b999549a52f567a58af2e
Python
7,774
200
"""F12 pins: the Stage-0 deterministic audit and the R0 baseline runner. Stage-0 runs with no model in the loop; a failure is a build bug and never reaches an evaluator. The R0 leg here baselines the geometry gate and the shipped headlabel family on the toy corpus (the real-corpus R0 legs are D03's, per the gallery sp...
ed0d87d30259bdbad9ffcd0dff0b2aecf4e73077e85a2c9a873e74053332ed70
Python
7,775
157
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
1945ef18b5998f1fd7b037c0bbfd04792088c9ea9128342d0dea03b8091ee853
Python
7,777
180
""" Centralized path configuration for the AD confirmatory tool testsuite. Two filesystem roots are required to run this codebase: AWARENESS_DATASETS — directory containing raw EEG cohort data (ds004504/, ds006036/, Brain_Lat/, figshare_5450293/, ds003775/, LEM...
c6c6fe0bffba11d57e9dc7c8d3514c03266abbada7260fd9b9c627e2c5d6b8eb
Python
7,777
214
#!/usr/bin/env python3 import csv import os import re import subprocess import zipfile from multiprocessing import Pool import progressbar import sox import unidecode from deepspeech_training.util.downloader import SIMPLE_BAR, maybe_download from deepspeech_training.util.importers import ( get_counter, get_im...
c0b7c64bdd393be9a4dd49c558b0b54fd678ce90a33cff8ddf25e0bdf1aff49e
Python
7,779
210
"""Tests for the Analysis portal app -- real (non-mocked) end-to-end coverage against the package's bundled DATA_DIR reference dataset, since `_AnalysisController` relies on `GraphRegistry`/`analysis_helpers` functions whose failures (registry construction, plot availability, figure saving/rendering) are all silently s...
c8c707d68e20788753e6ed815cf2e23fdc5a2694de42724a1dcf97a06528cdca
Python
7,779
183
from __future__ import annotations import logging import threading import time from collections import OrderedDict, defaultdict from collections.abc import Generator from typing import Callable, Optional import grpc from grpc import RpcError from minknow_api import protocol_service from bream4.device_interfaces.devi...
103c12049853f5cb3ea29401a55410910ac4ea61314fc125a7be338576ee7218
Python
7,780
195
''' K-Folding script author: obanmarcos ''' import os import os, sys from config import * sys.path.append(where_am_i()) import pytorch_lightning as pl import argparse import numpy as np import matplotlib.pyplot as plt import pandas as pd from utilities import dataloading_utilities as dlutils from utilities.folders i...
6d7df8d7727044c323e385fef8ac1a714e0de18f28f1e89a193912ad83a30806
Python
7,780
194
import logging import os from datetime import datetime from autouri import GCSURI, S3URI, AbsPath, AutoURI from .cromwell_backend import BACKEND_AWS, BACKEND_GCP logger = logging.getLogger(__name__) class CaperBase: ENV_GOOGLE_APPLICATION_CREDENTIALS = 'GOOGLE_APPLICATION_CREDENTIALS' DEFAULT_LOC_DIR_NAME ...
a91e0745c4405fe00c1755d48effdf7d41e9c8dd665892b7d64bffd1a2a8e8d7
Python
7,780
269
"""Shard codecs: safetensors default behind the manifest field (item 11). The shard format is a MANIFEST FIELD (extract D1), so a format change is a value change, never a layout break: ``safetensors`` is the v2 default (keyed row slicing, third-party readable, bf16/fp8 byte-exact), ``pt`` stays readable forever and wr...
ea822cbac8769d19d46ca562cc9e6a4d54013eab46e023be3f902330692e4689
Python
7,780
245
import socket from types import SimpleNamespace from unittest.mock import patch import pytest from celery.utils.threads import (Local, LocalManager, _FastLocalStack, _LocalStack, bgThread, bound_open_broker_sockets, default_socket_timeout) from t.unit import conftest class test_def...
f2ca835b393b6727b35a62a46725025dc285b135e5eda4d4d59cd42e012525d3
Python
7,780
240
"""System information utilities.""" from __future__ import annotations import os import posixpath from math import ceil from typing import NamedTuple from kombu.utils.objects import cached_property __all__ = ( 'load_average', 'df', 'AUTO_CONCURRENCY', 'is_auto_concurrency', 'available_cpu_count', 'cgroup...
f52a195109b4314e5d50328e04fd89738728c0d7e3a21105eebff811c047f043
Python
7,780
202
import numpy as np from functools import partial from .constants import * from mne.io import Raw from os import path import pickle as pkl class FrequencyBands(object): def __init__(self, signal, bands): self.data = {} self.names = list(bands.keys()) for band_name, filter_pars in bands.items...
5a0ac9e39bb866049742e61865cff759e9d3248675c071ec99507d0dfa8ac68e
Python
7,782
209
import os.path import tempfile import pytest import tensorflow as tf from tensorflow.python.eager import context from keras.src import backend from keras.src import callbacks from keras.src import layers from keras.src import losses from keras.src import metrics from keras.src import optimizers from keras.src import ...
751b3ff1c1b2a177cd2f55eb36d2d025bf92a2e4a09d13c78c71f0a554564be7
Python
7,782
143
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
1addcdba0821dc31c1513e17b62da0b35c184744e4591a71e6338389cdb19bf3
Python
7,783
214
""" This code creates simulated data for fig in Methods. """ import numpy as np import matplotlib.pyplot as plt from scipy.signal import butter, filtfilt, hilbert from scipy.stats import vonmises def create_signal_nzm(n_samples, fs, nzm_coeff): """ Generates alpha signals with non-zero mean profile :...
eddd3f39a13073b2d4cf810b5d5aae1181bce77a2d725af2519d8ee93d0d2ac7
Python
7,783
265
from typing import ClassVar import equinox as eqx import jax.numpy as jnp from cvsx.unit_conversions import convert class PressureVolume(eqx.Module): _e: float v_d: float v_0: float _lam: float p_0: float _e_scale: float = 100.0 _lam_scale: float = 10.0 def __init__(self, e, v_d, v...
f1e86f8675ef7750901278753613de8b7e930a60b911f214d397151253516c73
Python
7,783
220
import warnings from collections import OrderedDict import copy import pathlib import errno import numpy as np from .flblend import FlBlend from .formats import load from .util import equal_states, dict_update_nested class DataSourceSignatureMismatchWarning(UserWarning): pass class DataChannel(dict): """O...
2a1dd927027d24061d51bc29bb9960950d14eb6b761f34540b668e10575d9b27
Python
7,785
198
from __future__ import annotations import pytest from pytest_celery import RESULT_TIMEOUT, CeleryTestSetup, CeleryTestWorker, CeleryWorkerCluster from tenacity import retry, stop_after_attempt, wait_fixed from celery import Celery, signature from celery.exceptions import SoftTimeLimitExceeded, TimeLimitExceeded, Work...
dab80dc8e01de73a251676abd6675ba40e96d84c64160a2710755691bc417648
Python
7,786
206
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 10_coverage_gate.py — 蛋白质组衰老时钟的「覆盖率闸门」 ------------------------------------------------------------------ 这是整个路线 A 里最重要的一个前置检查,必须在跑任何模型之前执行。 原因: 各时钟权重是在 UK Biobank Olink Explore 3072(约 2900 蛋白)上训练的。 一旦你手上的数据集是 Explore 1536 / Target 96 / 或其他平台, 权重所要求的蛋白会大量缺失,而 pro...
09c4523fc1bdff2100d130e35311227bacf7ca8e0a3fa6ea80191751a75f3899
Python
7,787
217
from types import SimpleNamespace from more_itertools import chunked import numpy as np from permacache import permacache, stable_hash import torch from modular_splicing.data_for_experiments.standardized_sample import ( standardized_sample, ) @permacache( "modular_splicing/motif_perturbations/motif_statisti...
4987cf977f2f737e3faf87733a0fb5516a263a47898294a7612274d9a5cd84eb
Python
7,788
208
#!/usr/bin/env python # coding: utf-8 import numpy as np import pycuda.gpuarray as gpuarray from pycuda.compiler import SourceModule import pycuda.driver as cuda def _build_kernel(): code = """ __global__ void Funktion(short *verts1, char *arr1, char *arr2, char *mask2, char *lock1, char *lock2, int xsh1, int...
8ae5385dea6310bb3cb8f689ce1331c6b920c74f762adef8168d37eeefba1faa
Python
7,789
206
import tensorflow as tf import tensorflow_datasets as tfds from cvnn import layers import numpy as np import timeit import datetime from pdb import set_trace try: import plotly.graph_objects as go import plotly PLOTLY = True except ModuleNotFoundError: PLOTLY = False # tf.enable_v2_behavior() # tfds.di...
fda57cf0cb4746ffb43a1e8004ac2ba746f8880576877ca5bd7e5344d7276090
Python
7,789
230
# This example requires the following dependencies to be installed: # pip install lightly # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import copy from functools im...
bb5b4b1b7c1d1c122c22fb435146820125589e9a4bc3190577b5cf80cecea024
Python
7,790
157
#!/usr/bin/env python3 import os,sys,matplotlib,zipfile,argparse,string matplotlib.use('Agg') from pylab import * from lefse.lefse import * import random as rand colors = ['r','g','b','m','c'] def read_params(args): parser = argparse.ArgumentParser(description='Cladoplot') parser.add_argument('input_file_1', metav...
22973e8a061a4a64e3fb8a923d0ea9bd2d5d6e11c5886692b911424b6114c07a
Python
7,791
264
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType import copy as _copy class Lataxis(_BaseLayoutHierarchyType): _parent_path_str = "layout.geo" _pat...
28d8616ef040b4bc2e342f59b63d6b8e65bc147b694bfd673f70aeaebd521c31
Python
7,791
187
"""Writer-contract lockstep: the committed contract of record vs the live tree. Three guarantees (ecosystem MEMO 3.1/3.3/3.4, megaplan P05): 1. LOCKSTEP -- regenerating the writer contract from the live tree reproduces ``torchlens/schemas/writer_contract_v<TLSPEC_VERSION>.json`` exactly. Any persistence contrac...
629796c37ce3ce1764d788bbcca137f8a3b51128e5b8f94ec3cfc6739aadb0cf
Python
7,791
264
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType import copy as _copy class Lonaxis(_BaseLayoutHierarchyType): _parent_path_str = "layout.geo" _pat...
c045a2c0b468f6cb88d3bceebf671c30b069bb05df0cf99cc870f11cb0c50ed5
Python
7,792
237
"""Comprehensive storage-mode behavior tests for fastlog.""" from __future__ import annotations import ast from pathlib import Path import pytest import torch from torch import nn import torchlens as tl from torchlens._io.streaming import PARTIAL_SENTINEL from torchlens.fastlog import CaptureSpec, PredicateError, R...
09ff0070ea9704fa2578e84b23c79993fa649d5489043b0add8b816af1ce497c
Python
7,794
204
"""B3 + B8 + B9: honesty batch, overlay repair, escrow bound + address preflight. Every raise site added by lane F34 gets its provoking test here (census law): ``node_overlay_zero_match``, ``node_overlay_partial_match`` (warning), ``cone_origin_invalid``, ``site_table_empty``, ``escrow_budget_exceeded``. """ from __f...
642e17bb36c132f1b27e3044aecde77ad85f5310bc692b356a5ccc5c42f7e38c
Python
7,795
212
# coding=utf-8 # Copyright 2023 The Google Research Authors. # # 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 applicab...
e95bd11af6049d2cd00d8a8218e4dc4ca29fde0741506423be38c03590e7346b
Python
7,795
222
from typing import Any, Union, Optional import numpy as np import torch import torch.nn from torch.nn import Sequential, ReLU, Linear, LayerNorm try: from torch.nn import LazyLinear except ImportError: print("torch version is %s. Lazy modules are turned off." % torch.__version__) #from torch_scatter import sca...
562dd1093b3a371819227db97548f1b57450d196229f1656b347d329d191c6fa
Python
7,796
213
"""T7 (grind-p3): getitem mixed-key variants stay oracle-exact, and check() probes exact claims on non-windowed axes. HIGH variant battery: the rank-changing getitem fix (slice affines plus recorded selection indices composed through both engines and both query walks) is pinned against an independent autograd oracle f...
27b3fa1507f6a55420f2ed6f57e9ea716189d18d7f715f21c5f14f7053c1f5cd
Python
7,798
197
"""Regression tests for the cert10 (round-10-prep) intervention hardening fixes. BLOCKER -- ``_record_predicate_intervention_spec`` (``torchlens/backends/torch/ops.py``) built its dedup cache key from ``repr(decision.hook)``. When the fired helper is a ``HelperSpec`` carrying a live ``torch.Tensor`` argument -- i.e. T...
da47f990357818787095922642fb7e2b97f79f8a6a9ed99567dfdb76c48160a2
Python
7,800
220
import numpy as np import torch import torch.nn as nn ########################################### # THE HIGH-TO-LOW-DIMENSIONAL TRANSFORMER # ########################################### class A(nn.Module): def __init__( self, network_dim, data_dim, hidden_features=256, hid...
7fb0b75fe448b07a1c909d3ab77bc81fd2cf016fc43bf1b590b50dd1c26dd247
Python
7,804
242
import gzip import numpy as np from Bio.PDB import * try: from Bio.PDB.Polypeptide import protein_letters_3to1 def three_to_one(s): return protein_letters_3to1[s] except ImportError: from Bio.PDB.Polypeptide import three_to_one from Bio.PDB.Polypeptide import is_aa aa_modif={"TRN":"TRP", "CSO":"CYS...
530320c3b6f5d35926c00ccf97ff525a8ff4dc8ddc01aa44b03b6546f14256ff
Python
7,805
167
from torchvision.transforms import transforms from data_aug.gaussian_blur import GaussianBlur from torchvision import transforms, datasets from data_aug.view_generator import ContrastiveLearningViewGenerator from exceptions.exceptions import InvalidDatasetSelection from PIL import Image import pandas as pd from sklearn...
79286aa73ec2e6c39afd68aeaf6b7f39b6c16c07fd1a62c0597d8dd14b514863
Python
7,806
170
import logging from typing import TYPE_CHECKING from galaxy import model from galaxy.jobs.runners import JobState from galaxy.util import now from ._safe_eval import safe_eval if TYPE_CHECKING: from galaxy.app import GalaxyManagerApplication from galaxy.jobs import ResubmitConfigDict from galaxy.jobs.runn...
3e77848310d257f5be73c150877103c1a0e970ec81183dbc297a933253720553
Python
7,809
215
''' Keras implementation of B networks ''' import tensorflow as tf def b_layer(x, filters, kernel, layer_num, pooling=True): '''Base layer for B models ''' if pooling: x = tf.keras.layers.MaxPool2D( pool_size=(2, 2), name='MaxPool_Layer_{}'.format(layer_num))(x) x = t...
9339a72e8b2557fd5cf78041480eb8574ccdc70bf891410d6c33c72270ee9803
Python
7,810
213
""" Base UI for data tables. SimplyFire - Customizable analysis of electrophysiology data Copyright (C) 2022 Megumi Mori This program comes with ABSOLUTELY NO WARRANTY This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Sof...
adb0d2f099ec931755deaf98e2047a38faa52584f177c29357e45cf329e1162e
Python
7,810
273
import random import time import sys import itertools import multiprocessing import array, numpy, rpy2.robjects as ro import rpy2.robjects.packages from rpy2.robjects import Formula from functools import reduce n_loops = (1, 10, 20, 30, 40) def setup_func(kind): #-- setup_sum-begin n = 20000 x_list = [random....
2aab80bf27c96aa3c8f181251dc79ed8c45b1bf91fdd073bcd1bddccfd6c6d07
Python
7,811
189
from typing import List, Optional, Tuple, Union import numpy as np from anndata import AnnData from spateo.configuration import SKM from .methods import generalized_procrustes_analysis, paste_pairwise_align from .transform import paste_transform from .utils import _iteration, downsampling @SKM.check_adata_is_type(...
531220c210634c33f7ee61c553c204dce02f99d170296a8f4d709dc3d932caf8
Python
7,811
210
import datetime from flask_restplus import Namespace, Resource from flask_login import login_required, current_user from flask import request from ..util import query_util, coco_util, profile, thumbnails from config import Config from database import ( ImageModel, CategoryModel, AnnotationModel, Sess...