sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
19d02994c706dfd812118bf730e3075cf9c24368af85036b898ce0df17fc4ce1
Python
11,685
354
"""Interface layer for pykube library shared between Galaxy and Pulsar.""" import logging import os import re from pathlib import PurePath try: from pykube.config import KubeConfig from pykube.exceptions import ( HTTPError, ObjectDoesNotExist, ) from pykube.http import HTTPClient f...
f13f9a030c7a7d4be8dd4a1fb337fe604ef107fd700a2d0b3476525073095efb
Python
11,685
242
import json import numpy as np import os, sys from collections import Counter from sklearn import preprocessing from sklearn.metrics import f1_score from sklearn.metrics import confusion_matrix import torch import torch.nn as nn import torch.nn.utils.rnn as rnn_utils import torch.nn.functional as F from torch.utils.dat...
2fa8c1ed7740216d1af10a705c5d7b65dc37741e42097edfcdaf8fd4670fe4c1
Python
11,686
335
import numpy as np from numpy.testing import ( assert_array_almost_equal, assert_array_equal, assert_raises, ) import pytest from pyriemann.estimation import ( Covariances, ERPCovariances, XdawnCovariances, CospCovariances, HankelCovariances, Coherences, Shrinkage, BlockCova...
d94708e420ece1b8fb3e43a5aaf3eccdea1fcc7a6fc5d654e7ef73a3110385ec
Python
11,690
263
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Transformation that constrains the (weighted) centroid of the DOFs. """ # ====================================...
6170dcee425d74e2b536b4eacc61be86b9bd6d363320d5d5d09b396fe1f1092d
Python
11,691
371
import os import json import morphio import numpy as np from numpy.testing import assert_equal from numpy.testing import assert_raises from numpy.testing import assert_allclose from numpy.testing import assert_array_equal from numpy.testing import assert_almost_equal from tns.utils import TNSError from tns.generate.so...
470c9a961968606e19fd6e3439c82931261b07124477594e5eb772eb0b596110
Python
11,692
202
import glob import json import os import socket import sys import argparse from functools import partial from multiprocessing import cpu_count import numpy as np from mne.datasets import fetch_fsaverage from tqdm import tqdm from tqdm.contrib.concurrent import process_map from mp_dip.obci_readmanager.signal_processi...
fc098d728f894afb1a135654dff9394430573476045b880ba00838becc972aad
Python
11,693
412
''' File: draw_curve copy.py Project: error_analysis Created Date: 2023-10-04 15:24:24 Author: chenkaixu ----- Comment: This script used to analysis the experiment results, especially for the the error classification. Across 5 fold cross validation and then print the metrics. Meanwhile can print the CM. Have a good c...
1c61dd74df29f3ce9e2aae623a1724981f014f1a8060aa22a97851f581ed62f9
Python
11,694
309
from conftest import get_metrics import pytest import numpy as np from numpy.testing import assert_array_equal from pyriemann.spatialfilters import Xdawn, CSP, SPoC, BilinearFilter, AJDC @pytest.mark.parametrize("spfilt", [Xdawn, CSP, SPoC, BilinearFilter, AJDC]) @pytest.mark.parametrize("n_channels", [3, 5, 7]) @py...
634eb781987f21b5cfb2a901bd31f93cb2e5d55f59efd839570c50de87252dba
Python
11,695
333
''' The code here is modified from https://github.com/charlesq34/pointnet under MIT License ''' if __name__ == '__main__' and __package__ is None: from os import sys sys.path.append('../') import torch import torch.nn as nn import torch.nn.parallel import torch.utils.data from torch.autograd import Variable i...
d109d033d7dcb1abc6722f68f830f7f974d9dfdd1a320b429c2191c1a35b339c
Python
11,696
313
"""RG vision scenarios on real ResNet-18 weights (testing memo 5.2; F36 E2). RG01 trace, RG10 extraction, RG11 RDM/CKA, RG12 runnable roundtrip, RG13 render floors, RG16 training step, RG20 receptive fields -- each with an INDEPENDENT oracle (assertion-ladder rung 1), on the pinned ``r1-resnet18-imagenet1k-v1`` regist...
5e1caf80cf6061c84b053aa203c99799b3e97e49956794c6c35a0718743760a7
Python
11,698
223
import argparse import csv import datetime import logging import os import SimpleITK as sitk import pytorch_lightning as pl import torch import torch.utils.data from pytorch_lightning.loggers import TensorBoardLogger from datasets import get_dataset from models import get_model from strategies import get_strategy fro...
37cbb7691860efe781f637ebf7190a05e78688c32cf4038812aea318dd1ca634
Python
11,700
251
# Based on: https://medium.com/analytics-vidhya/implementing-srresnet-srgan-super-resolution-with-tensorflow-89900d2ec9b2 # Paper: https://arxiv.org/pdf/1609.04802.pdf (SRGAN) # Pytorch Impl: https://github.com/Lornatang/SRGAN-PyTorch/blob/main/model.py import os import tensorflow as tf import keras import model_build...
4d54530bbf919a41d831d8b2d77cd49d965bbf3305f0e08e0db17d5665f75dc9
Python
11,700
322
"""Import and construction tripwires for runnable contract scaffolding.""" from __future__ import annotations import inspect from dataclasses import fields import pytest from torchlens.errors import ReattachError, RunnableTLSPECError, StateBindingError from torchlens.runnable import ( CANONICAL_INITIALIZER_BY_R...
2080fd6ce43b39d4e721378b09460bb4dc84cde322edc6b3cda47fd175e71d87
Python
11,704
297
"""Prefork execution pool. Pool implementation using :mod:`multiprocessing`. """ import os import threading import time from billiard import forking_enable, get_start_method, set_start_method from billiard.common import REMAP_SIGTERM, TERM_SIGNAME from billiard.pool import CLOSE, RUN from billiard.pool import Pool as...
55658e9fc7d6c9e6de6d55386afd6c94ac08edc41dcba4f6129537f3408504ce
Python
11,704
338
import warnings from pathlib import Path from typing import List, Literal, Optional, Union, cast import pandera.polars as pa import polars as pl import xarray as xr import zarr from pybedtools import BedTool from seqdata._io.utils import _df_to_xr_zarr from seqdata.types import PathType BED_COLS = [ "chrom", ...
f630bfb83c51d6b371b20ecc9de6eb6baeaaaa1640be5c78544579fffe160a36
Python
11,704
319
"""Golden tests for the receptive-field geometric engine.""" from __future__ import annotations from collections.abc import Iterator from fractions import Fraction import pytest import torch from support.rf_isolation import preserved_rf_registry from torch import nn import torchlens as tl from torchlens._io import ...
237c73539c49f06da94c5d5e4fb93bec4464aa8e47dea515b99a153724332183
Python
11,708
336
# Copyright (c) ByteDance, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import datetime import functools import os import subprocess import sys import time from collections import defaultdict, d...
23cc6f49fdbd729eda603e8764c7d0e043af5e39878acf33dca0bedced5232ba
Python
11,711
347
import json from typing import List, Tuple, Dict from datetime import timedelta, datetime from scipy.sparse import csr_matrix, coo_matrix, hstack import pandas as pd import numpy as np import sparse from sklearn.model_selection import train_test_split from omop_learn.data.common import ConceptTokenizer from omop_lear...
478c67b321e51bb15c4522667d1fa25e13f51214e2fc562b711a23aba2910ec7
Python
11,711
305
# SOURCE: vendored from Audio-WestlakeU/RVAE-EM @ 3398d13ca903 # https://raw.githubusercontent.com/Audio-WestlakeU/RVAE-EM/3398d13ca903/model/RVAE.py # https://raw.githubusercontent.com/Audio-WestlakeU/RVAE-EM/3398d13ca903/model/module.py # # RVAE-EM (Pengyu Wang et al., "RVAE-EM: Generative Speech Dereverberation Base...
8dcf147dd6e3a540b90e989de5ccfc7abebc0a8137fb4e58eb9b4cd9d8141e2e
Python
11,711
313
import numpy as np from utils import Recorder, Q_nak from mitochondria import Mito from steady_state import get_steady_state from lifcell import LIFCell from gates import ros_inf, get_ros import figure_properties as fp import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from matplotlib.collections ...
9f8e156fbaac27b7acda3c1b09359b3b365357daf02649cc2443eb230fc72cd4
Python
11,711
351
# 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...
118801a84b122373bf5f509ee38686422e02f8637a9fe4fee41438c1017f88d1
Python
11,712
316
import torch import torch.nn as nn import torch.nn.functional as F from torchvision import models try: from torchvision.models.utils import load_state_dict_from_url except ImportError: from torch.utils.model_zoo import load_url as load_state_dict_from_url # Inception weights ported to Pytorch from # http://do...
9c129fe9da6d4361d9d1008e5a6c26d28a24c9502a293a2d45a9c9c04d6b93e3
Python
11,713
299
"""SM100 backward with the query heads of a KV head packed into the Q tile (FLASH_ATTENTION_BWD_PACK_GQA=1) against the per-head path (FLASH_ATTENTION_BWD_PACK_GQA=0) and against FP64 eager. See NOTE [bwd pack_gqa] in pack_gqa.py: one tile per KV head iterates over the packed rows of all its query heads, dK / dV stay ...
6d6717493030517f20d00b2a563a8b108fa67af45852cdd40e9b6429f62cdf1c
Python
11,716
364
# # Galaxy documentation build configuration file, created by # sphinx-quickstart on Tue Mar 6 10:44:44 2012. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values hav...
b1a254963fb9a5c0db5b8c8f7bdb94d40fde10dbadff35c1a1bdf3c9a6629016
Python
11,716
275
import warnings import numpy as np import pandas as pd from typing import Any from mirp._data_import.dicom_file import ImageDicomFile from mirp._data_import.generic_file import MaskFile from mirp._data_import.generic_file_stack import ImageFileStack, MaskFileStack from mirp._data_import.utilities import get_pydicom_me...
2b02ef2c7abf60d563ce1c9ec1576130b133028f99c9203948b2a1ab941b0c3b
Python
11,720
283
import torch from icecream import ic import random import numpy as np from kinematics import get_init_xyz import torch.nn as nn from util_module import ComputeAllAtomCoords from util import * from inpainting_util import MSAFeaturize_fixbb, TemplFeaturizeFixbb, lddt_unbin from kinematics import xyz_to_t2d def mask_in...
57f3772cbd2e3becd4ecdb23c9f956653a9c0f3ee528d0303d14114c2765d69e
Python
11,721
286
import os import math import logging import numpy as np import scipy from scipy.signal import fftconvolve from .TqdmLoggingHandler import TqdmLoggingHandler logger = logging.getLogger(__name__) logger.setLevel(logging.WARN) logger.addHandler(TqdmLoggingHandler()) # We thank Eli Horn for providing this code, used wit...
17d0eee2a1d3e5fdbc31947a6faaf4a4ffd1caa3608f54e6be3031685776b10f
Python
11,727
304
"""r55 CLASS 3 immunizer -- the op-execution allocation-bomb seam r53 free_1 missed. r54 ``free_1`` (HIGH): a taken-path op whose output size is a literal integer (``torch.arange(n)``/``zeros(n)``/...) let an attacker edit one plaintext ``manifest.json`` integer to drive an ~8 TB allocation on the default ``tl.load(pa...
7ae56b43c097140e41d7362cce6816e3a36ff248a844b7663be1b732d630b3ec
Python
11,729
280
import sys from random import choice, randint import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy import signal from scipy.stats import truncnorm def plot_df_acf(df, cat1, name): # from statsmodels.graphics.tsaplots import plot_acf # from scipy import signal df = np.array(df) u1 = s...
beee7a01ee8e463fd933fdc3533f6e5dbd62548ce6d0119837cc902f8ac05bf1
Python
11,729
373
import pytest from pyrosm import get_data @pytest.fixture def test_pbf(): pbf_path = get_data("test_pbf") return pbf_path @pytest.fixture def helsinki_pbf(): pbf_path = get_data("helsinki_pbf") return pbf_path @pytest.fixture def test_output_dir(): import os, tempfile return os.path.join(t...
402979172d38e4be2766e395403daa4223258b08f270f885b6d8bd0666b95701
Python
11,730
307
import sys try: import dash import dash_bootstrap_components as dbc except ImportError: print( "\n❌ Error: Carbonboard requires additional dependencies that are not installed.\n" "\nTo install them, run:\n" " pip install codecarbon[carbonboard]\n" "\nOr if using uv:\n" ...
459c33c3153979314a0d236c8cf192e2f076b34a21b7fc133e574220739f5b08
Python
11,732
257
#!/usr/bin/env python3 ''' This script will generate the lines for a new types file with the iterative poses generated from counterexample_generation_jobs.py !!WARNING!! Part of this process is to determine which newly generated poses are NOT REDUNDANT with the previously generated ones. This requires an O(n^2) calcu...
6b74d82ecad8119e407c04eb7a0e0f7dbb530582411c7728cfe6d4970f8915e5
Python
11,734
289
"""MS COCO object detection dataset.""" from __future__ import absolute_import from __future__ import division import os import numpy as np from PIL import Image import mxnet as mx from .utils import try_import_pycocotools from ..base import VisionDataset from ...utils import try_import_dali from ...utils.bbox impor...
0758e8f1ad6ad94fbfe69526639bd951ee41fb03df631feb8d328d35a95140fd
Python
11,735
359
import numpy as np from keras.src.backend.common import dtypes from keras.src.backend.common import standardize_dtype from keras.src.backend.jax.ops.math import fft as jax_fft from keras.src.backend.jax.ops.math import fft2 as jax_fft2 from keras.src.backend.numpy.ops.core import convert_to_tensor from keras.src.utils...
5caed0e92376060e3c5ae9493e9e7b41cbaa165fb2e69062a1562032da5c9b3b
Python
11,744
262
"""Functions for simulating power spectra.""" import numpy as np from specparam.utils.checks import check_iter from specparam.sim.params import collect_sim_params from specparam.sim.gen import gen_freqs, gen_power_vals, gen_rotated_power_vals from specparam.sim.transform import compute_rotation_offset from specparam....
95547a20a24e732034e85370a2e9207d0d4c9313333b38462efd424dc4ca9258
Python
11,744
289
import numpy as np import torch from torch import nn import networkx as nx from typing import * from functools import partial def circDist1Sq(phi: torch.Tensor, psi: torch.Tensor): return (torch.pi - (torch.pi - (phi - psi).abs()).abs()).square().sum(dim=-1) def entropyLogAm(x: torch.Tensor, m: int): return m...
21f67cdb3960a222cb358b41240a4d4e6df3d392525b5a407fc261642f4a7a94
Python
11,745
241
import numpy as np from brian2.only import * import deepdish as dd from readout import load_results from digest import conds import spatial out_fname = 'distance.h5' def get_bspikes(res, episode): b = np.zeros(np.asarray(res['raw_dynamics']['v'].shape)[[0,2,3]], bool) for itrial, (i, spike_t) in enumerate(z...
f1c4c0bce8bc6e2320a8dace00f932004957b165f4e2f198b1a6fd14fc0e9da2
Python
11,745
354
""" Utility functions for COOT model """ import ctypes import datetime import logging import multiprocessing as mp import os from pathlib import Path import random import sys from typing import Tuple, Dict import numpy as np import torch import torch.backends.cudnn as cudnn from torch import cuda import torch.nn.funct...
16ca1c350bebfddcb3c4e7123bb55213fbcf1b04a6cfc58e98bc24b0e239d747
Python
11,747
336
#!/usr/bin/env python # # device_listener.py # # Copyright 2022 Giorgio F. Gilestro <gg@jenner> # # 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 Software Foundation; either version 2 of the License, or # (at ...
a8c2442bb735eb1246505fc591f7db629fa3e406a57cc2a34d22cec90b64ad0c
Python
11,748
327
import json import pathlib import warnings import errno import numpy as np from .structure import StructureComposite, StructureCompositeStack from .data import DataSource from .formats import get_signature from .util import equal_states from ._version import version class ImposeDataFileNotFoundError(FileNotFoundErr...
b28d09cb2ee13aacc5ad3be26688685373719a511ff1c4efeac006093d892834
Python
11,748
326
""" Tabular data prediction using TabPFN """ import argparse import time import matplotlib.pyplot as plt import numpy as np import pandas as pd from sklearn.metrics import ( accuracy_score, average_precision_score, balanced_accuracy_score, f1_score, precision_recall_curve, r2_score, root_m...
be236fe0a2c6ad005983656d6505b80d179a9e09d8efc8bf1b606de2745e0ebd
Python
11,754
402
""" Functions to shuffle timestamps to create surrogate datasets. """ import warnings import numpy as np from .. import core as nap def shift_timestamps(data, min_shift=0.0, max_shift=None, mode="drop"): """ Shifts all the time stamps of a random amount between a minimum and maximum shift, wrapping the ...
012737afc49e6e4401f6d00fda49934998c9e191c5cc0670fc4d3010fca2502c
Python
11,756
374
import os def to_head( projectpath ): pathlayers = os.path.join( projectpath, 'layers/' ).replace('\\', '/') return r""" \documentclass[border=8pt, multi, tikz]{standalone} \usepackage{import} \usepackage{bm} \usepackage{transparent} \subimport{"""+ pathlayers + r"""}{init} \usetikzlibrary{positioning} \useti...
c061946c218cf2fcb202dd0fe98a40a41fff0b3315dde0b8591b8897bc701555
Python
11,757
299
"""A-BUNDLE-OUTCOME proofs: Bundle declares outcome authority (foldB D9 + D8). Bundle is the THIRD instance of the "two answers for one product" outcome-authority disease (PartialTrace: ``_OUTCOME_DELEGATE_FIELD``; Recording: ``_OUTCOME_SELF_AUTHORITY``): ``outcome_for(bundle)`` returned ``None`` while every member wa...
6fd182c9acb781df16abe6760a7e9a667dc419febdbe87f626ab9087877a7c88
Python
11,759
336
# 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...
a0cfa842df9fa9cf864e497b6ef791d67437e1962a565f772e568b6124b047dc
Python
11,763
233
import torch import torch.nn.functional as F from torch.distributions import NegativeBinomial from torch.distributions.gamma import Gamma import math import numpy as np import pandas as pd from sklearn.model_selection import train_test_split,cross_validate,KFold from sklearn.neighbors import KNeighborsClassifier from s...
2442c364bf3c39e4898612debf7294b0660cbd36b57c63e9d61acdbb228907af
Python
11,764
320
from keras.src.api_export import keras_export from keras.src.quantizers import strategy_registry from keras.src.saving import serialization_lib @keras_export("keras.quantizers.QuantizationConfig") class QuantizationConfig: """Base class for quantization configs. Subclasses must implement the `mode` property ...
6e6deabf24ea50b8c41f2fcbfea1241b68771e8e25673c4eae807de8be7573b3
Python
11,767
252
import numpy as np import logging from cuteSV.cuteSV_genotype import overlap_cover, assign_gt import pickle def resolution_INV(path, chr, svtype, read_count, max_cluster_bias, sv_size, bam_path, action, MaxSize, gt_round, sigs_index): ''' cluster INV ***************************************************...
08aceb5f06f9873eede502f1bdeffba40f6a61c3b4cd7081386715f03e777c8f
Python
11,770
325
from sklearn.metrics import roc_curve, auc, roc_auc_score, brier_score_loss, precision_recall_curve, f1_score, precision_score, recall_score from math import sqrt from collections import OrderedDict from imblearn.over_sampling import RandomOverSampler, SMOTE, BorderlineSMOTE, SVMSMOTE, ADASYN from imblearn.under_...
cf10dc526c4700652dba00762e7b5686e975dee96935e9ad8fb0b572936fdc2c
Python
11,774
302
import html import json import posixpath import re import tarfile from contextlib import contextmanager from typing import ( Annotated, ) from pydantic import Field from galaxy.exceptions import ( MessageException, ObjectNotFound, ) from galaxy.files.models import ( AnyRemoteEntry, BaseFileSourceC...
9e6e07dc69842a99c4cbd420b917ce4832765e0483dccf12215be577078ebaf1
Python
11,775
295
import sys,re,os import subprocess from Bio import SeqIO from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord from Bio import AlignIO import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import numpy as np from utils import getLongestORF,parse_config, setup_fonts, build_output_dir,palette_by...
94abc110082e456019d06656011b6385b2a8f9011d75d71ae09a2b3dd1f37765
Python
11,776
338
''' load the RBNS data ''' import csv import re import h5py import urllib3 import urllib import gzip from io import StringIO import requests import numpy as np import time from utils_rbns import create_datapoints rbns_data = 'metadata_rbns.csv' encode_dir = 'encode/' data_dir = 'data_large/' # 'data/' protein_idx_ma...
96344869dcd59b9dddf66b4c9a6ddc0428d55b10b90920e822c743f3e21e81d7
Python
11,776
325
# -*- coding: utf-8 -*- """ Transformerに必要な基本的なlayer群を記載 tf2.1.0で動作させることを想定して実装 """ import tensorflow as tf import numpy as np from tensorflow.python.keras import constraints from tensorflow.python.keras import initializers from tensorflow.python.keras import regularizers ## padding_mask ## def create_padding_mask...
648dac10616530371ba15292c831871cd6a6867064d50dc2084aa7e4c61ae411
Python
11,777
326
from typing import Any import numpy as np import pandas as pd import copy from warnings import warn from mirp._images.generic_image import GenericImage from mirp._imagefilters.utilities import FilterSet2D, FilterSet3D from mirp._images.transformed_image import TransformedImage from mirp.settings.generic import Setti...
be534b9bcf3caae0e70061975bfdf5149b70e020930579bec450d386709a3404
Python
11,777
359
import pysam import os import re import copy import gzip from TestUtils import load_and_convert, make_data_files, TABIX_DATADIR def setUpModule(): make_data_files(TABIX_DATADIR) class TestBED: filename = os.path.join(TABIX_DATADIR, "fivecolumns.bed.gz") def setup_method(self): self.tabix = pys...
d88206bf430c05f2339f7decd8c88cbaf6af01f87b6cb09f1741e5d90eb89aff
Python
11,777
226
import argparse import os # os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # os.environ["CUDA_VISIBLE_DEVICES"] = "0" # specify which GPU(s) to be used import time import numpy as np import torch from torch.utils.data import DataLoader from external_src.group_free_3D.models import parse_predictions from external_src...
802fc7439427951e78edc9f72fb264e544f4ccf14f23086482ce50c9a8bf041e
Python
11,779
326
"""Functions for shuffling data.""" from functools import wraps import numpy as np from spiketools.measures.spikes import compute_isis, compute_firing_rate from spiketools.measures.conversions import (convert_times_to_train, convert_isis_to_times, convert_train_to_times) ...
8fc91d732b9b8c1704e482aa51be92374f2751fc143196d55e50978642aec962
Python
11,784
287
#!/usr/bin/env python3 """ File: prepare_bios_eqtl_file.py Created: 2021/11/11 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 tree....
67292ab67456992d634b23d26b88ecd786d7926a55d1dabf5d8f11ec14330d90
Python
11,786
326
"""Functions to analyze and investigate model fit results - periodic components.""" import numpy as np ################################################################################################### ################################################################################################### def get_band_p...
b74cfa9193180149dd78f8e0dfb09fdd9b58350e94eb3ef6cb440619fbfe3796
Python
11,786
253
from pyabf.abfReader import AbfReader import datetime import os # TODO: replace with pathutil class HeaderV1(AbfReader): """ The first several bytes of an ABF1 file contain variables located at specific byte positions from the start of the file. All ABF1 header values are read in this single block. ...
39c7be02d516a7a22dd864748fb27da0b13072acc40b89ce45e7e5d225426522
Python
11,790
525
"""Static Paddle wrapper inventory snapshot tests.""" from __future__ import annotations from collections.abc import Iterator from contextlib import contextmanager import pytest from torchlens.backends.paddle import wrappers as paddle_wrappers from torchlens.backends.paddle.wrappers import PaddleInventory, _PaddleW...
a6a1213f0da1328a94cfde9dec98d376aee779872ff44a4d3bd491958e0ff30b
Python
11,790
307
"""IO functions for NanoString CosMx technology. """ import glob import os import re import warnings from typing import List, NamedTuple, Optional, Union import numpy as np import pandas as pd with warnings.catch_warnings(): warnings.simplefilter("ignore") import skimage.io from anndata import AnnData from s...
04ee8006e77e685a7f5aa558e7935de42442546b3be36a15c034e41554f992ca
Python
11,791
351
""" Load, save, delete and reset actions for a stored configuration. Provides the bare registry-CRUD buttons, meant to pair with a caller-supplied selector rather than carrying a catalog of their own. """ from __future__ import annotations from collections.abc import Callable from typing import Any import panel as ...
160a8219ea30462e7da441c7f87c4b1552712561ca25c36f0d4d05eeff02f22a
Python
11,797
302
from keras.src import backend from keras.src import ops from keras.src.backend.common import get_keras_mask from keras.src.backend.common import set_keras_mask from keras.src.backend.common.keras_tensor import KerasTensor from keras.src.layers.layer import Layer class Merge(Layer): """Generic merge layer for elem...
3bdbe78f8f50c3585166ee78de227e74631071f43dcb9d6b9256f595ec1fff3d
Python
11,799
245
""" This code contains additional analysis suggested by reviewers. """ import os import os.path as op import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd from mne.channels import find_ch_adjacency from mne.stats import spatio_temporal_cluster_test, ttest_ind_no_p from scipy.s...
7cedf36f547a056dff60dc40d843987bd9669eda6cb84075db801e2d55546d73
Python
11,805
325
#!/usr/bin/env python3 """ File: create_upsetplot2.py Created: 2023/07/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 tree. """ ...
c6a7fb94a5827962961eae3e418de093e9d6b7410d0165f8ee4ba0c4660c8e65
Python
11,805
300
import ssm import ssm.extensions.mp_srslds.emissions_ext as mp_emission import ssm.extensions.mp_srslds.transitions_ext_2 as mp_transition import ssm.init_state_distns as isd import scipy.io from matplotlib import pyplot as plt import numpy as np import autograd.numpy.random as npr import seaborn as sns from ssm.plots ...
ca9f3b55518998b7f089b0a7ba2515bbe4bf3414f990680233c7b3e5e64ee101
Python
11,810
296
""" Topographical Analyses with MNE =============================== Parameterizing neural power spectra with MNE, doing a topographical analysis. This tutorial requires that you have `MNE <https://mne.tools/>`_ installed. This tutorial needs mne >= 1.2. If you don't already have MNE, you can follow instructions to g...
2910bac2ad8e7dbf15e22276b6132e8f25432b2e7fbf753ceda45d2e6694f664
Python
11,817
261
from __future__ import division import argparse, time, logging, os, math from tqdm import tqdm import numpy as np import mxnet as mx from mxnet import gluon, nd from mxnet import autograd as ag from mxnet.gluon import nn from mxnet.gluon.data.vision import transforms import gluoncv as gcv gcv.utils.check_version('0....
fbae76cc2b555ca8ac1cb6e9118279d283750a8ece84d81e57a659073ff8f58a
Python
11,817
316
""" Multi-stimulator system for sequential stimulator activation. Allows multiple stimulators with individual date/time ranges within a single experiment. """ __author__ = "giorgio" import logging from ethoscope.hardware.interfaces.interfaces import DefaultInterface from ethoscope.stimulators.stimulators import Base...
01b386bd5cdb378402a1ed1471358fa363aca8cc0a3e046ccf37d3a3871fc23c
Python
11,819
321
"""Implementation of EM algorithm to identify parameter estimates for a Negative Binomial mixture model. https://iopscience.iop.org/article/10.1088/1742-6596/1324/1/012093/meta Written by @HailinPan, optimized by @Lioscro. """ from functools import partial from typing import Dict, Optional, Tuple, Union import numpy...
4b4349d5dc42ea49f353be132c8ff9026c3c8deed5535123968d8f252a95265e
Python
11,819
263
#!/usr/bin/env python3 """ Dx BN — Training-pool-derived τ + out-of-sample Platt scaling ============================================================== Reviewer item: τ in §3.1 was selected on the held-out figshare ROC, making sens/spec/PPV in-sample-optimized. Re-derive max-BA τ from training-pool LOCO scores (proper...
13f6a1a634e4b574eeca3e57c913579a669388da8bd4d75d5bd59b3dd63a991b
Python
11,820
287
import os import pickle import matplotlib.pyplot as plt import tensorflow as tf import tensorflow.keras.backend as K from sklearn.metrics import confusion_matrix from tensorflow.keras import Input, layers, models, optimizers, callbacks from tensorflow.keras.layers import Layer def create_input_layers(xshapes): i...
5a99392b497013c9901d5fb2dbba6e9304903a149ab2fddd7559fba1de4099c4
Python
11,822
359
"""Key-value store.""" from typing import List, Tuple, Union, Optional import os import sqlite3 from pathlib import Path import numpy as np _array_t = np.ndarray _path_t = Union[str, Path] class BaseKeyValueStore(object): """Base class for key-value store.""" def get(self, **kwargs) -> _array_t: ...
6e22428fe5c26ca9d05cd777a44f8d96d0e247f866910e186969904dcff9ff6d
Python
11,822
326
import os import time import numpy as np import pandas as pd import nibabel as nib from os.path import join as pjoin from scipy.signal import detrend from scipy.fft import fft, fftfreq from magicbox.io.io import CiftiReader, save2cifti from cxy_visual_dev.lib.predefine import proj_dir, All_count_32k anal_dir = pjoin(p...
19a0722d77b4fe60f53c71bf4b85b0cbe30d4e8bb76aa0ea1be60c8f613f2e05
Python
11,826
342
"""Phase 3a capture-unification regression tests.""" from __future__ import annotations from collections.abc import Callable import pytest import torch from torch import nn import torchlens as tl from torchlens.fastlog import RecordContext class PredicateToy(nn.Module): """Small model with mixed operation typ...
2d932d3121925ae2005ac1d34b9cb0d5dceecb0f984ab176fee90c9e5d2ccb6b
Python
11,826
326
''' Late Stage Functionalization predictions after the NMR Pretraining. NOTE: WE ARE USING THE ALL ATOM GRU 2 LINEAR LAYER SETUP FOR THIS COMMIT! ''' import os import argparse import pandas as pd import numpy as np import torch import logging from collections import Counter from neural_nets.LSF_Finetune_Net import L...
81d21cfdc2e0d4a2c4c8fe8aa840e20aa381ff470212fd948ed2185df59fc8b7
Python
11,826
275
"""grouping= knob entry legality + the grouping_policy_v1 stamp: writer content, loader coherence rules C1-C8, tamper degradation, the canonical degraded settlement's monotonic round trip, and the G-gates for the stamp family (S3 switch discipline). All stamp vocabulary and refusal spellings are PROVISIONAL pending th...
a4a4840dec6040e78170224649e5c54ced73b84d6f788ca5dd9fc4e3f274054b
Python
11,827
312
""" Matplotlib Exporter =================== This submodule contains tools for crawling a matplotlib figure and exporting relevant pieces to a renderer. """ import warnings import io from . import utils import matplotlib from matplotlib import transforms from matplotlib.backends.backend_agg import FigureCanvasAgg cl...
c42cac0cb59b7b4db45716afab103985a44dc9ea7102894c079edba989b9103a
Python
11,831
292
import torch import torch.nn as nn from dgl.ops import edge_softmax import dgl.function as fn from dgl.utils import expand_as_pair from graphmae.utils import create_activation class GAT(nn.Module): def __init__(self, in_dim, num_hidden, out_dim, ...
f2a7173831372c4d3d8a438318b7007dfa1a4d27ffb6e6ba4ab2ffe2cae70891
Python
11,831
314
# Copyright (c) 2022 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...
e6100fdd7a9c01f016b56034ffb8d920ff1d4de947a13088e0ada52a593e9e42
Python
11,833
240
""" Advanced test cases - with plots of computed alpha-relative density ratios. """ from .context import densratio from scipy.stats import norm, cauchy, uniform, bernoulli, multivariate_normal import numpy as np import unittest import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt class AdvancedTes...
998fa9f098e261aa69b2863a642fc6453d7d1a11022b991dcdf122f6c61127e7
Python
11,835
302
#========================================================================== # # Copyright NumFOCUS # # 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/l...
11af226551ec99af086c48fcbcebea1bdbe82efd8a5e3f5afa361d5e316543fc
Python
11,840
318
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import json import os import random from itertools import chain as chain import numpy as np import slowfast.utils.logging as logging import torch import torch.utils.data from slowfast.utils.env import pathmgr from . import...
909a9adcc3776c9c5c6337fc1a3800853bc7d2ef790976e54e6dd6531e57335a
Python
11,841
331
"""tvscope B4/B5 + composition rows 2-3: the manifest block + the input path. Every new artifact carries the schema-versioned ``input_preprocessing`` block (allowed to say unknown); legacy/pre-block artifacts read as unknown; resume never grafts new provenance; the input-transform identity joins the resume signature s...
f5e848f10e02be012e9c995af3c4788159b8fdfabdd489eeae64e115cef40e02
Python
11,846
349
import math from typing import Dict, Optional import torch from torch import Tensor, nn import torch.nn.functional as F from transformers.activations import ACT2FN def softmax_dropout(input, dropout_prob, is_training=True, mask=None, bias=None, inplace=True): """softmax dropout, and mask, bias are optional. ...
a8a374ae5560b7e962f03e168f370b5b13b32f084330773f0d9c6c95117bc6f7
Python
11,847
304
# --- 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 Colorscale(_BaseTraceHierarchyType): _parent_path_str = "sankey.link" _pa...
741b98569b30409d6f616e6225f17148cfe204146782e842fb557f07cc7b44a2
Python
11,849
310
""" module for custom functions used for evaluation and validation of trained models """ import logging, logging.config from lib.models import BoneAgeModel logger = logging.getLogger(__name__) import os import matplotlib.pyplot as plt import numpy as np from numpy import linalg as la from scipy import s...
87f75d077edc2a3ad409c6a04a003c2d92b1529b17d7986e9efee23b50d02e95
Python
11,852
313
import pandas as pd import numpy as np import pre_process import entropy_opt import modeling from seqtools import SequenceTools from Bio.Seq import Seq from tensorflow import keras def aa_probs_from_nuc_probs(nuc_probs): """ Calculates amino acid probabilities given nucleotide probabilities. """ l_nuc...
b061c4f54e51368e7f49f7e06c116c1940710cf5a55881d676be44c040bbd943
Python
11,854
291
from typing import Any import numpy as np import pandas as pd import copy from mirp._images.generic_image import GenericImage from mirp._images.transformed_image import TransformedImage from mirp.settings.generic import SettingsClass from mirp._imagefilters.generic import GenericFilter from mirp._imagefilters.utiliti...
6974e2bb20a027e2ddd98df06c1cc0bc109777dd6f85ad162aecb0533daca63d
Python
11,855
292
from keras.src import tree from keras.src.api_export import keras_export from keras.src.backend.common import standardize_dtype from keras.src.backend.common import standardize_shape @keras_export(["keras.InputSpec", "keras.layers.InputSpec"]) class InputSpec: """Specifies the rank, dtype and shape of every input...
012fb2f73929f1ab51131a2ed97558cbb0a031abb0369d97dbea06ab9ee24e63
Python
11,857
251
import torch import numpy as np from typing import Callable, Union import torch.nn.functional as F from monai.data.utils import compute_importance_map, dense_patch_slices, get_valid_patch_size from monai.utils import BlendMode, PytorchPadMode, fall_back_tuple # def pad_patient_3D(patient, shape_must_be_divisible_by=1...
3dcf1566fb51f1a5b4458e4d0770d9bd168a9e31bf0ed5c8cfe3b8b3531ceeae
Python
11,857
256
''' This file contains all model components. Pasted from crf_models.py lstm_cnn.py ''' import torch import torch.nn as nn from crf import CRF class LSTMCNN(nn.Module): def __init__(self, input_size: int = 1280, dropout_input=0.25, n_filters=32, filter_size=3, hidden_size=64, num_lstm_layers=1, dropout_conv1=0...
bd7da045a7aac573a3d5d3cf4627a75c4697c235d5c6f2cd550d18909e53eeff
Python
11,857
350
# -*- coding: utf-8 -*- """ Created on Wed Aug 31 11:53:02 2022 @author: LABadmin """ def AlignStim(signal, time, eventTimes, window,timeUnit=1,timeLimit=1): aligned = []; t = []; dt = np.median(np.diff(time,axis=0)) if (timeUnit==1): w = np.rint(window / dt).astype(int) else: w =...
4337eea547151a032fb825e910d018396df82487fafae29736e94cf2cb42ce5a
Python
11,865
243
import os from pyexpat import model import torch import torch.nn as nn import argparse import time import datetime import numpy as np import math import tifffile as tiff from torch.autograd import Variable from torch.utils.data import DataLoader from utils import save_yaml_test from skimage import io fr...
0cfc8eac411ce8b36532c7c333176be08f3a25ec5fd14c3fe07bf4381ec77753
Python
11,868
301
"""Lane F22 neuro.datasets handoff contract (neuro MEMO 4.1, rows T7/T10/T14). Pins: - Default sweeps cover only STIMULUS-INDEXED saved sites through the core gate (buffer overwrites skipped with ONE summarized disclosure); explicit ineligible requests refuse actionably. - Descriptors are the product: site, reque...
de4d28c65e08f2ce93f9e9f22bc036edd756090075336dc2e82b056343b4c5d2
Python
11,871
359
"""Container visualization and UI tests.""" 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.experimental import dagua class DictOutputModel(nn.Module): """Return a two-leaf dictionary outpu...
dabdc2a05f31cfa8cb3b1920187bfa44c413d735e554ac9eb87b07017704bf85
Python
11,874
312
from typing import List import numpy as np import pytest import seqpro as sp from hypothesis import given, note from seqpro.rag import Ragged from hypothesis import strategies as st seq = st.text( alphabet=st.characters(codec="ascii", min_codepoint=32, max_codepoint=126), min_size=1, ) seqs = st.lists(seq, mi...
45c9c81b25aebb7d1e8d29c7ed53666457ca58aeab46cb84d539a9c469d8a2da
Python
11,878
248
import os.path as osp import torch import torch_geometric from torch_geometric.data import Dataset, Data from pathlib import Path from helpers.configurations import TAKE_SPLIT, OR_4D_DATA_ROOT_PATH from role_prediction.graphormer.role_prediction_configs import USE_GT, USE_IMAGES import json import numpy as np from pyv...
2701b4cbf74d168c137ae0166eb202790c47b874618e29ea954c17a25953de48
Python
11,880
281
# FAITHFUL PORT of debbiemarkslab/DeepSequence @ master (original framework: Theano) # DeepSequence/model.py (class VariationalAutoencoder) # The real repo is written in Theano (`theano.tensor`, `theano.shared`) and cannot run # in the base torch env. This ports the "Doubly Variational Autoencoder" (Riesselman, # Ing...