sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
c641be1bec61985e880f542684c323850000eb4ba0c772b19cf735f2301ed4a6
Python
7,386
243
########################################################################## ## ## ## Copyright (c) 2019 Philipp Lösel. All rights reserved. ## ## ## ## This file is par...
d17f917468f88e69d43acac54881da1d4785173e88d0e31d5453fb768fe195d5
Python
7,386
199
from __future__ import annotations import warnings from functools import partial from typing import Any, Callable import torch import torch.nn as nn from torch import Tensor from lightly.models import utils from lightly.models.modules.masked_vision_transformer_decoder_timm import ( MaskedVisionTransformerDecoder...
f4d5af5cfd64b58775d2cea6132cd1fa29f1c23b8d02712fad45e068300cb96d
Python
7,386
184
# import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import Module from .layers import AvgReadout, Discriminator, Clusterator, Discriminator_cluster, full_block, GraphConvolution, \ InnerProductDecoder class conST(nn.Module): ...
82be6116b0f352d19fa7fd2dbb4b25973232af78cc41e8089059a50dab90271c
Python
7,388
221
from distutils import log import distutils.command.sdist as orig import os import sys import io import contextlib from setuptools.extern import six from .py36compat import sdist_add_defaults import pkg_resources _default_revctrl = list def walk_revctrl(dirname=''): """Find all files under revision control""" ...
14ca336ab025a91153ca3302246d66e1f4b3b04485d5e96c20335c7a0088d8e1
Python
7,390
204
"""Tests for the Trace summary feature.""" from __future__ import annotations from collections.abc import Generator import pytest import torch from torch import nn import torchlens as tl class TinySummaryModel(nn.Module): """Small model with stable top-level module names for summary tests.""" def __init_...
01cde58342c50ebadfc081288854325d02b40af3ed2b9343e72f38bd0e8d0977
Python
7,391
181
"""02. Train SiamRPN on COCO、VID、DET、Youtube_bb ================================================== This is a Single Obejct Tracking tutorial using Gluon CV toolkit, a step-by-step example. The readers should have basic knowledge of deep learning and should be familiar with Gluon API. New users may first go through `A ...
722ccb208b460c9ad8c06e6fcc5fa208fba4065fe971bf6d475885f24c61f6e3
Python
7,392
212
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from tgcn import ConvTemporalGraphical from graph_part_remove_joint_upper_limb import Graph class Model(nn.Module): r"""Spatial temporal graph convolutional networks. Args: in_channels (int): Number...
f7a34713cbaac7d7412f0ea4d01c9ab1b3d2287f1e8dd99c4f38ff92a978628e
Python
7,393
238
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by Bin Xiao (leoxiaobin@gmail.com) # Modified by Bowen Cheng (bcheng9@illinois.edu) # ------------------------------------------------------------------------------ fro...
6dd840d98abbc47887980c6d16474fca3ef453daf3d7fcfbba96bd1d00043b38
Python
7,394
188
import yaml import configargparse import os,re import pandas as pd from pathlib import Path import matplotlib as mpl from matplotlib import font_manager import matplotlib.pyplot as plt import seaborn as sns from matplotlib.ticker import ScalarFormatter class ScalarFormatterClass(ScalarFormatter): def _set_for...
a0817ea24c95744fea96743176529768e9c1d26e9c4af9a0173b372abba0925c
Python
7,394
177
#!/usr/bin/env python3 """ Dx BK — Single-channel + random-K-channel sweep redo (proper per-fold) ======================================================================= Two analyses re-run under the proper per-fold deployment-mode pipeline using cached figshare per-channel ablation extractions: A) Single-channel a...
382600199bbd91202fb294930a2e27105099703a9f8277d30e857c219639c7af
Python
7,395
181
import pylustrator pylustrator.start() import os import tensorflow.keras as keras from tf_spiking import DenseLIF, DenseLIFNoSpike, IntensityToPoissonSpiking from tf_spiking.helper import TrainingHistory import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from copy import deepcopy ...
4971fa7dae548e1b13c51f34d3f81e5f1f8a28225500150d5df6e686585649df
Python
7,395
191
""" 'Oscillations' as Peaks ======================= Exploring the idea of oscillations as peaks of power. This example uses the `neurodsp <https://neurodsp-tools.github.io/>`_ module for time series simulations & analyses. """ ##########################################################################################...
9b8f5d75f1715df3b1aa076de165345d30ec036428a655a368d93f7b0b528964
Python
7,396
149
# coding: utf-8 # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License...
a09eac518472bf6082ac0525684ff54bd409adadc3332cb3c3d86cd4ed9560bb
Python
7,397
204
""" Execution of simulation runs in a separate process. Launches a run as a subprocess so that long simulations do not block the caller, and reports back when the run completes. """ from __future__ import annotations from typing import Any import argparse import subprocess import pandas as pd from .. import util fr...
dfcb5578cff354adf7c1b210261b5ecba39ff944cb1eb57f866f6e9c67932170
Python
7,397
190
#!/usr/bin/env python3 """ Script to detect the network IP range/subnet for ethoscope devices. This script analyzes the network interfaces and determines what IP range the ethoscopes are likely to be on, which can be used for SSH configuration. """ import netifaces import ipaddress import socket import sys from typin...
118c321db63c4d7936f6d3a997f1503b0e41041925f35ff7c90ee1cf45fdea0b
Python
7,398
259
# BASE URL = "https://download.bbbike.org/osm/bbbike" suffix = ".osm.pbf" class Cities: available = ['Aachen', 'Aarhus', 'Adelaide', 'Albuquerque', 'Alexandria', 'Amsterdam', 'Antwerpen', 'Arnhem...
76a6ca9d791af4eda28b7b1761c638a37c6dd2bb18568c15b6a8ce4e973dc593
Python
7,398
188
import unittest from numpy import max, abs, ones, zeros, hstack, sqrt, finfo from cantera import gas_constant from spitfire import ChemicalMechanismSpec as Mechanism import pickle import cantera as ct ct.suppress_thermo_warnings() # because we are faking heat capacity polynomials species_decl = list([ct.Species('A',...
51c8ffd29d2925df72de33a51859c6024ab4453677053362cdfdcbe8b7a3a1cc
Python
7,399
122
"""This script estimates TRFs for several models and saves them""" from pathlib import Path import re import eelbrain import mne STIMULI = [str(i) for i in range(1, 13)] DATA_ROOT = Path("~").expanduser() / 'Data' / 'Alice' PREDICTOR_DIR = DATA_ROOT / 'predictors' EEG_DIR = DATA_ROOT / 'eeg' SUBJECTS = [path.name fo...
b937568ed055bf4cc0c90a9f07dbb8b58d4f3693c9bc1940137a0b4b9b0a0b23
Python
7,401
190
""" Unit tests for ImgMaskROIBuilder. Tests ROI generation from grayscale image masks where each contour becomes an ROI. """ import os import pathlib import unittest from unittest.mock import patch import cv2 import numpy as np from ethoscope.roi_builders.img_roi_builder import ImgMaskROIBuilder # Get the absolute...
2cca8d7699a6ed84fd1f2d0d88c5ebb024af38ae47f3414cd9d94a815542ecac
Python
7,402
198
"""History schema tests: vocabularies, payload coherence, merges (D4-D8).""" from __future__ import annotations import pytest import torch from torchlens.observability import ( PHASES, PRESENCE, STREAMS, HistorySchemaError, ObservationRecord, RunRecord, SiteRecord, Spine, StepBloc...
f851a0b54704e9dfdcbe7124e5a962a6f9d34a379552d14a238f30a208ab8c26
Python
7,402
200
# -*- coding: utf-8 -*- # @Author: gviejo # @Date: 2022-01-17 14:10:40 # @Last Modified by: gviejo # @Last Modified time: 2023-10-27 16:23:54 import numpy as np import pynapple as nap from scipy.signal import butter, lfilter, filtfilt def _butter_bandpass(lowcut, highcut, fs, order=5): nyq = 0.5 * fs low =...
cfc7d9497c1e0fd6a8bd450acb3b038f7ce0f6aaebc788bea15aad835b579e5d
Python
7,403
188
import torch import os import random import pandas as pd from torch_geometric.data import InMemoryDataset from rdkit import Chem from tqdm import tqdm from typing import List from .conf_ensemble_dataset import ConfEnsembleDataset from bioconfpred.conf_ensemble import ConfEnsembleLibrary from bioconfpred.data.sources i...
199fd060ad39899ff42ab3dcf49d105e525ca0e598ab453b423060df202d60e1
Python
7,407
205
"""Output Biopython SeqRecords and SeqFeatures to GFF3 format. The target format is GFF3, the current GFF standard: http://www.sequenceontology.org/gff3.shtml """ import urllib from Bio import SeqIO class _IdHandler: """Generate IDs for GFF3 Parent/Child relationships where they don't exist.""" def __i...
95b5bd55ba5c0e299495dc4a222364d803d5361f59b988386e3c945baa4c812f
Python
7,407
192
import os import numpy as np import copy import torch from openbabel import openbabel, pybel from rdkit import Chem from rdkit.Chem import rdMolTransforms from rdkit.Chem import AllChem from scipy.spatial.transform import Rotation from sklearn.cluster import KMeans from src.utils.dist_to_coords_utils import get_mask_r...
a4687bc3f30717e51b64e079804c47112cc258e51755808b56b6e2d1ca6a0fe6
Python
7,407
211
# Copyright (c) 2024 PaddleHelix Authors. All Rights Reserved. # # Licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 # International License (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at # # http://creativecommo...
f9b4f12eeed88417ac8a212b1ca5bf6f60d6096bb9865c62bfd19fe0d0cd52ec
Python
7,409
176
import numpy as np class Graph(): """ The Graph to model the skeletons extracted by the openpose Args: strategy (string): must be one of the follow candidates - uniform: Uniform Labeling - distance: Distance Partitioning - spatial: Spatial Configuration For more informa...
c151d1ab2ed347cc0a8a92b6c828a1ff08068c91a35bb11d4e782d10f6cc5f29
Python
7,410
252
import seaborn as sns from .. import settings import matplotlib.pyplot as plt from typing import Union, Mapping, Sequence, Iterable, Optional from ._utils import _plot_seaborn, _violin_long import xarray as xr def countplot( sdata: xr.Dataset, vars: Union[str, Sequence[str]], groupby: Optional[str] = None...
b50d57fccb9be3bb7ddbe3cc46172fa80196feccf2c8f548f2a8e1e48822af4c
Python
7,411
214
""" X-ray Photoelectron Spectroscopy (XPS) Datatypes Datatypes for surface analysis data produced by X-ray photoelectron spectroscopy (XPS, also known as ESCA). Two related formats are provided: * :class:`Vamas` - the ISO 14976 VAMAS standard plain-text format, the open interchange format for surface analysis data ...
e65448a90333d590deed9c23df2843d8437c7e9200e5bb5274464d5f66fde77a
Python
7,411
182
# -------------------------------------------------------- # Based on BEiT, timm, DINO and DeiT code bases # https://github.com/microsoft/unilm/tree/master/beit # https://github.com/rwightman/pytorch-image-models/tree/master/timm # https://github.com/facebookresearch/deit # https://github.com/facebookresearch/dino # --...
327f1ef6d9ac1ca6846b23f6e71cffec705fb763ab5aa8453bf76d64c4ed517c
Python
7,412
220
import os os.environ['DTORROOT'] = '/DATA/forLishan/randomddd' #os.environ["CUDA_VISIBLE_DEVICES"] = "0" from dtor.utilities.utils_stats import stats_from_results,roc_and_auc from sklearn.metrics import roc_curve, auc import numpy as np import argparse import torch from dtor.utilities.utils import set_plt_config from d...
fc70ba48e0d952331e20d4cc7ce7904f18cf2550a196908397bd90f32046bf9d
Python
7,414
199
import numpy as np import scipy import brian2.only as br import analysis import os IPSC_timestep = 20 * br.us IPSC = np.genfromtxt("data/PC_IPSC_20ms.csv")[1:] # 20 us timestep IPSC = IPSC / max(IPSC) EPSC = np.genfromtxt("data/MF_EPSC_20ms.csv")[1:] EPSC = EPSC / max(EPSC) def run_DCN_wave(**k...
1c7461be48e6e8ada709cccd00e8a6097f12a6b4a3d2b8a52d4b68bc94c3c034
Python
7,415
234
import os os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2" import argparse import numpy as np from pyteomics import mgf, mass from dataclasses import dataclass, asdict import tensorflow as tf import tensorflow.keras as k from tensorflow_addons.layers import InstanceNormalization from utils import * print(tf...
c89b1e55f1b49f5105b6ab13e9afd28b55d64fbf3d2409c1f5557fbe505c057f
Python
7,416
189
from __future__ import annotations import warnings import torch import torch.nn.functional as F from torch import Tensor from torch.nn import Module, Parameter from lightly.models.modules import center from lightly.models.modules.center import CENTER_MODE_TO_FUNCTION class DINOLoss(Module): """Implementation o...
9f7490d815e586a685122290aff9ea61a6d10514d5996d96ff911db7d62c6602
Python
7,417
187
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 1 11:37:26 2021 @author: Audrey Mazancieux This script estimates a general linear model (GLM) at the subject level for all stimuli in the local-global task. Other regressors include V4 time serie, movement parameters, and physiological regresso...
6195ac80339e1c6c1c83a3b523ef0182cb297eb47adb13f07a1dcdb6d107547c
Python
7,419
248
# coding=utf-8 # Copyright 2025 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...
a973ccb7e752a5705d9af01f16954fa044807c867ed6cd0a0d8693fe42870446
Python
7,420
235
""" This module includes a dual classification method. Not used in the current implementation of the MetalHawk, but will be included in a future version. """ from copy import deepcopy import numpy as np from sklearn.pipeline import Pipeline from sklearn.preprocessing import RobustScaler class DualOutputClassifier(o...
99abc9377e6e76c2464595583dbc56ceccfa26895f70cce105a91bd251d78244
Python
7,423
184
from __future__ import print_function, unicode_literals, absolute_import, division from six.moves import range, zip, map, reduce, filter from ..utils import _raise, backend_channels_last from ..utils.tf import keras_import, BACKEND as K Conv2D, MaxPooling2D, UpSampling2D, Conv3D, MaxPooling3D, UpSampling3D, Cropping2...
a38a271d6280e1e72c275ae138c91dfe9dacaa4790e80f3188571e2a877a1d9b
Python
7,423
200
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 21 15:09:10 2022 @author: fcheng """ #coding:utf-8 import os import numpy as np import PIL from PIL import ImageFont import cv2 from plot.image_process import img_process, gammaCorrection # save dirs save_dir = "./results/plots/quick_test" i...
47a69a3f1ffe9674cfa4d4b1f26a68d454f4af7bc2d4a96ebb7642b886bae416
Python
7,425
223
from typing import Any, Callable, Optional, Union from pl_bolts.datamodules.vision_datamodule import VisionDataModule from pl_bolts.transforms.dataset_normalizations import emnist_normalization from pl_bolts.utils import _TORCHVISION_AVAILABLE from pl_bolts.utils.warnings import warn_missing_pkg if _TORCHVISION_AVAIL...
600fe763e700c77569beb37a0c28dea64d087450a12ca7c6c2f3c2067b32fd0d
Python
7,425
206
"""Ledger contract lockstep (row 0.8): validation, red-capability, projection diff. The ledger's closed vocabularies and per-state teeth are enforced here, every rule is red-capability-proved with planted rows (a gate nobody has proved can fail is not a gate -- memo section 9), production capability ids are REFERENCED...
60f8d83b935a585076e0fa037abbb5fc53e38eff2449745bea40b7eb42c7cba9
Python
7,426
249
import numpy as np import dateparser import camelot import tabula import pdfplumber import pandas as pd import math import gc from pdfminer.high_level import extract_pages from camelot.core import TableList from utils.tabledetection.tabnet import ExtractTable def clean_numbers_str(text): chars = ['%', '*'] ...
a1730e0b612aa5994c94fa9aa710a0f97043aaae326f2f8beccc7cae9c2b5329
Python
7,426
193
from pathlib import Path from typing import Literal import h5py import numpy as np import pytest from anndata import AnnData from mudata import MuData from scipy import sparse import muon as mu @pytest.fixture def filepath_hdf5(tmp_path: Path) -> str: return str(tmp_path / "mofa.hdf5") @pytest.fixture def mda...
a3f7fb091e99ca5d0dd7ce7d7ce0cd09325dac8e095cfc23537131a3e292468f
Python
7,426
209
import pickle import os import numpy as np import sys import torch import torch.nn.functional as F from torchvision import transforms, utils from src.utils import save_gif, save_png, save_video, convert, convert_image,\ save_apng from src.html import make_simple_index, make_list_index def single(stylegan_weights...
5928337a2049fbbb6ca615e21ac8a080df015257f476955f648ddc6ba450d593
Python
7,427
266
from __future__ import annotations from collections.abc import Sequence from typing import Optional, Union import numpy as np import pandas as pd from bream4.device_interfaces.devices.base_device import BaseDeviceInterface from bream4.toolkit.analysis.metrics.waveform_utilities import waveform_triangle from bream4.t...
208dc91e9d535e00b49769a17491027cb5a6322945cb0c27d35ad6101b944c53
Python
7,428
219
import itertools import re import attr import h5py import numpy as np class MultiH5File: """ Concatenate the files in the list, using higher indices for each type as the list progresses. E.g., if file one has keys X0, Y0, X1, Y1 and file two has keys X0, Y0, X1, Y1, then the resulting fi...
080fa9cc6af157d466c1716da7fde4d9e9c2aba9c29d892bd40ffab2a4f3ede8
Python
7,429
178
# -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals, absolute_import, division import numpy as np from collections import namedtuple from ..utils.tf import keras_import, BACKEND as K Model = keras_import('models', 'Model') Input, Conv3D, MaxPooling3D, UpSampling3D, Lambda, Multiply = keras...
ebfc6d868b6809be5bc31d130822bc0454804bb2452dca0d61a966cf80e3cde2
Python
7,430
165
from __future__ import division from __future__ import print_function import os # disable autotune os.environ['MXNET_CUDNN_AUTOTUNE_DEFAULT'] = '0' import argparse import glob import logging logging.basicConfig(level=logging.INFO) import time import numpy as np import mxnet as mx from tqdm import tqdm from mxnet impor...
1a885f12956e7c2d8c77d9b2c9ccc094a4f385fed7b4c56c491818d744f67040
Python
7,431
195
import pandas as pd import numpy as np import random import os from torch.utils.data import Dataset import numpy as np from dtor.utilities.utils import expand_image from dtor.utilities.utils import bbox3d, crop3d,pad_nd_image from tqdm import tqdm import pandas as pd import torch from sklearn.model_selection import KFo...
3971481190b7cc34c84c3408b683e6cc3509dc9e544e02b6eabf4e100abd3716
Python
7,431
215
# 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...
7f18ad6a8e14616e07abb076e7c4ff700ab61f747614dd7e9b0772d77f30f1f1
Python
7,432
225
#!/usr/bin/env python3 # coding: utf-8 """ Created in April 2020 @author: Thomas Bonald <bonald@enst.fr> @author: Nathan de Lara <nathan.delara@polytechnique.org> """ from typing import Union import numpy as np from scipy import sparse from scipy.sparse.linalg import LinearOperator from sknetwork.linalg import diagon...
ed5c280750658d0ebe18935fa63f5710a1e1cf962ce8c1c248ef36cb05388b34
Python
7,432
194
""" This script shows the training pipeline for k-fold training, without logging it via wandb. """ import tensorflow as tf import tensorflow.keras as keras import tensorflow_addons as tfa from keras import backend as K from sklearn.model_selection import StratifiedKFold from tf_spiking.helper import TrainingHistory fr...
df3a2c6c8eb1823c4961e46f4718e7643fe678b7a342d8e2aab209f26efac051
Python
7,433
231
"""Strict typed accessor behavior tests.""" from __future__ import annotations import pytest import torch import torchlens as tl from torchlens._errors import AmbiguousOpLookupError from torchlens.data_classes.buffer import Buffer from torchlens.data_classes.grad_fn import GradFn from torchlens.data_classes.layer im...
1259cc7e4a1db056b65ed36ae366cfa39967d9dce0e66d8abe683d6f125f2940
Python
7,436
220
"""Contains the core functionality of the lightly Python package.""" # Copyright (c) 2020. Lightly AG and its affiliates. # All Rights Reserved import os from typing import List, Tuple import numpy as np import yaml import lightly.cli as cli from lightly.cli.embed_cli import _embed_cli from lightly.cli.lightly_cli i...
8dc5a9e2511904c43b3679d70ad6eb10e5fb1acd4e1aac7f448d3c669ea0bea3
Python
7,437
224
"""Focused tests for the non-blocking Explore preview worker.""" from __future__ import annotations from dataclasses import replace from pathlib import Path from types import SimpleNamespace import pytest from larvaworld.portal.canvas_widgets.environment_models import LarvaPreviewFrame from larvaworld.portal.explor...
ee0e8507b052b60b03b9ec00c234aca6aae79816021405cb43339f79ffbc6182
Python
7,437
193
#!/usr/bin/env python3 """ File: export_masked_matrices.py Created: 2022/07/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....
90f649af873478467fb2772828ceb5492cd9fbbe8146dff7c1606fa03a1fc62c
Python
7,438
192
"""Lazy-module entry tolerance and residual refusals (quickstart B13/B14). The wave-1a all-verbs entry refusal flipped off on the memo's own signal (4.4) when the numbers-truth lane landed the parameter completion unit, and the BUFFER-side refusal flipped off with the F20 lazy-buffer completion (A10-fix2 remainder): t...
2cabae31b12b6dfa4b4fc30c8e03a5cb537a0dd69fc0552271c9e20ef0c4d737
Python
7,439
203
"""Mask RCNN default config""" # pylint: disable=unused-variable,missing-function-docstring,bad-whitespace,missing-class-docstring # from typing import Union, Tuple from autocfg import dataclass, field @dataclass class MaskRCNN: # Backbone network. backbone = 'resnet50_v1b' # base feature network # Final ...
b2f6fae66bed31fa315ba74141e8764e231f551433ab9de16dd54bae13a700d4
Python
7,440
186
import os import numpy as np from mirp import extract_features_and_images_generator from mirp.extract_features_and_images import extract_features_and_images from mirp.deep_learning_preprocessing import deep_learning_preprocessing, deep_learning_preprocessing_generator from mirp.utilities.parallel import cluster_exist...
0e65ba62f3175393ba67fbb47ad2c130d34b3e0196dacb372a361c2e1adb2c93
Python
7,442
202
import numbers import numpy as np from scipy.linalg import eigh from sklearn.base import BaseEstimator, TransformerMixin from sklearn.utils.extmath import stable_cumsum from .utils.mean import mean_covariance from .utils.base import sqrtm, invsqrtm class Whitening(BaseEstimator, TransformerMixin): """Whitening...
6572bf597367695b5b88aeacd9721ca9e2a96c3acef2e98a94df0be06c474172
Python
7,446
182
"""Unit tests for the creation of cross-validation folds.""" from functools import partial import numpy as np import pytest from mne_rsa.folds import ( _compute_item_means, _convert_to_one_hot, _match_order, create_folds, ) from numpy.testing import assert_equal from sklearn.model_selection import KFo...
135e5abe79c3cda173d65f2403f9813ed43e5c1141f772fa6e371db4f82cd608
Python
7,447
136
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import json import types import zipfile from pathlib import Path import torch from ultralytics.nn.modules import Detect from ultralytics.utils import LOGGER from ultralytics.utils.export.engine import _NormalizeCo...
51366ba90dccf4879f4aae843552f20f32587c2bfa8302e6a1968a043b7e349c
Python
7,448
141
import pandas as pd from review_comparison.generate_pred_EnzBert import get_EnzBert_predictions from review_comparison.post_process_deepec import post_precessing_DeepEC from review_comparison.Sequence_KNN import SequenceKNN from review_comparison.request_to_DEEPre import Wrapper_DEEPre_server def generate_all_predict...
8ac19135dfa40ca8ef7582438aa446894970f1e4e92cf4cfb32913a576ac67bc
Python
7,448
172
from d2l import torch as d2l import torch import sklearn.metrics as metrics from sklearn.metrics import auc, roc_curve, f1_score, precision_score import pandas as pd import numpy as np from dataProcessing.modules import to_categorical def get_accuracy(y_hat, y): if len(y_hat.shape) > 1 and y_hat.shape[1] > 1: ...
437c74ed48d08cd05dd55b3e8a5b4555ce20310263e48e0f88fbc9b6d1451717
Python
7,450
181
"""eigenmt.py: Re-implementation of eigenMT (Davis et al., AJHG, 2016)""" __author__ = "Francois Aguet" __copyright__ = "Copyright 2019, The Broad Institute" __license__ = "BSD3" import torch import numpy as np import pandas as pd import time import os import sys from collections import OrderedDict sys.path.insert(1...
c5e7af633e17c3ecf70f1e3b12b7d857db9ca415e66a769cdd9609744ce56eec
Python
7,450
172
import torch from math import floor import random class InversionLossLayer(torch.nn.Module): """Loss used for most metamer generation experiments""" def __init__(self, layer_to_invert, fake_relu=True, normalize_loss=False): super(InversionLossLayer, self).__init__() self.layer_to_invert = layer...
221662919a8348b48f0dd0a2252b77f3e2c1db953ce441e4f5ca0f3db6cf1af2
Python
7,452
205
import pytorch_lightning as pl import torch import numpy as np import pandas as pd from sksurv.metrics import integrated_brier_score, concordance_index_censored from sksurv.util import Surv from survival_plus_x.models.vit import vit_output_head from survival_plus_x.losses.gensheimer import neg_log_likelihood from sur...
4508bd752cf4aecd2dbc938fbbc76b4508ee67fff8e01458a74ae88e12381bce
Python
7,453
202
""" This module create ProtBertProjectGOPoincareBall """ # pylint: disable=W0223 from curses import nonl import logging import torch.nn as nn import torch import geoopt import numpy as np from goatools.obo_parser import GODag from goatools.gosubdag.gosubdag import GoSubDag from tqdm import tqdm import time import torch...
8873afed224bd7147f025d2bcf16686aef26d09a6da1e196c985943878381173
Python
7,454
213
"""F03 ledger memo items 1 + 2: canonical EVENT audit rows and sweep baseline. Item 1's F03 slice: the tlspec-v9 ``kind="EVENT"`` audit-row WRITER (the v9 admission declared the contract; this lane lands the writer) with its seq/prev-digest hash chain, persisting through save/load validation. Item 2: ``tl.sweep(includ...
2e29c523e91cd140f818df71c64e959dde9f222aa24753d7623029c21583a5ba
Python
7,455
191
import logging import os import re import shutil from tempfile import TemporaryDirectory from autouri import HTTPURL, AbsPath, AutoURI from WDL import parse_document logger = logging.getLogger(__name__) class WDLParser: RE_WDL_IMPORT = r'^\s*import\s+[\"\'](.+)[\"\']\s*' RECURSION_DEPTH_LIMIT = 20 BASEN...
6da91b6f6ad1554282b81cfe9152310bbb2aa76567a68065c5f39d673a443ce1
Python
7,457
197
r""" Boundary-Value Problems: the Gelfand-Bratu Fold ================================================ This example demonstrates PyCoBi's support for two-point boundary-value problems (BVPs) — auto-07p's ``IPS=4`` mode. Two new ``ODESystem.from_template`` kwargs let you express boundary and integral residuals directly ...
3299b34202651f28cdcd068ba483e29b1b3202a2825f5eff77becbfa3338c039
Python
7,460
193
import copy from keras.src import layers from keras.src import ops from keras.src.api_export import keras_export from keras.src.backend import KerasTensor from keras.src.backend.common import set_keras_mask from keras.src.quantizers.geometry import ReversibleLookupGeometry @keras_export("keras.layers.ReversibleEmbed...
791be238f1e44abf904eb791d8b5cb3913da005e1b2a27c1ac021b67e2f6d3f6
Python
7,461
241
"""P1 tests for the output container registry.""" from __future__ import annotations import gc import weakref from dataclasses import dataclass from pathlib import Path import pytest import torch from torch import nn import torchlens as tl from torchlens.ir.container import ContainerSpec, DictKey from torchlens.ir....
23fdf6e48b52b94bef516a51c6ce6869139594761eb8d9f851da3039ec08ff0d
Python
7,462
230
"""The CosmosDB/SQL backend for Celery (experimental).""" from kombu.utils import cached_property from kombu.utils.encoding import bytes_to_str from kombu.utils.url import _parse_url from celery.exceptions import ImproperlyConfigured from celery.utils.log import get_logger from .base import KeyValueStoreBackend try:...
6d8bcee09c72bd10147122b760e93236ecf98ac6659f59b1de2c34bd2d54d6be
Python
7,462
169
import logomaker from utils import parse_config, load_CDS, build_output_dir, setup_fonts import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import os def plot(summary_df,signed_df,window,vlim,tallest,ref,window_name,tscript,save_dir,class_type,target_pos,attr,axis=None): ...
2c8c31643b6df0809c9d84827fd8fe8b98b5f183fae9af1da4d4df926a8d4552
Python
7,466
229
"""Sprint B1 annotation persistence and API regressions.""" from __future__ import annotations from pathlib import Path from typing import Any import numpy as np import pytest import torch from torch import nn import torchlens as tl from torchlens.data_classes.trace import Trace from torchlens.intervention.errors i...
41c6425ba7ae83011fa990251a4f231a90f074767a12dde841a7161e20ece76e
Python
7,466
172
import os import json import torch import numpy as np import torch.distributed as dist from torch import nn from model.custom_cross_entropy import CustomCrossEntropyLoss from model.grud_model import GRUD from model.early_stopping import EarlyStopping from data.dataset import RegionDataset from torch.utils.data import D...
5a76a0124ac1a7ec39303e2b421c5840d74b76d4e36a2d597ba5b1e2e09bee6f
Python
7,466
202
"""Typed refusal codes of the contrastive, depyf, nnsight and MLflow bridges. Every refusal these bridges added raises a ``TorchLensError`` subclass that keeps its historical built-in lineage (``ValueError``/``TypeError``/ ``RuntimeError``) and carries a stable ``code`` plus a non-empty ``remedy`` (docs/reference/erro...
58d076de9cbcbc0411549c97af1d2b176566e5c3c270696dc67f08773a8d1e4f
Python
7,469
225
""" Calibration-related plotting """ from __future__ import annotations from typing import Any, Optional, Sequence import numpy as np import seaborn as sns from .. import plot, reg, funcs __all__: list[str] = [ "plot_segmentation_definition", "plot_stride_variability", "plot_correlated_pars", ] def pl...
04c2c8af24062de411fcb2a73a18c6f4f681b7617c22b933b5e25d0c103fa646
Python
7,470
203
"""Axis-permutation receptive/projective geometry battery (R20-1, fixwave-2). Any transpose/permute/movedim between the queried operation and the model input makes the descriptor's input-axis order differ from the unit's output-axis order. Zipping windowed unit coordinates in descriptor order silently TRANSPOSED exact...
82c747f55b5869571370fd6bcd960fcb557fc14aa076f55cb01d61e0c93b446b
Python
7,472
197
import math import hydra import torch import torch.nn as nn from einops import rearrange from flash_attn.bert_padding import index_first_axis, pad_input, unpad_input from flash_attn.flash_blocksparse_attn_interface import ( convert_blockmask, flash_blocksparse_attn_func, ) class FlashBlocksparseAttention(nn...
8cba905d5c9aa8c35f8cd802df10af6105699fbe8099a23a5ca092e9446fd69c
Python
7,473
195
"""Pickle / ``tl.save`` parity for intervention-spec-carrying traces. Pre-fix, plain ``pickle`` of a Trace captured with ``intervene=`` failed (``zero_ablate.<locals>.factory`` and ``when.<locals>._predicate`` are local closures) while ``tl.save`` of the same trace succeeded -- a serialization split on one object. Two...
4e7202b94f92d1d6e2c0a6dabab2b75c37823981ac1060b0b896c1a37d9d75ce
Python
7,474
200
import pickle import warnings import numpy as np import pytest import gym from gym.envs.registration import EnvSpec from gym.logger import warn from gym.utils.env_checker import check_env, data_equivalence from tests.envs.utils import ( all_testing_env_specs, all_testing_initialised_envs, assert_equals, )...
10ce7b1eb3ce13900129f02b1b96bf1bee8285d9e048f69094986fae123b48ec
Python
7,476
214
""" =============================================================================== Visualization of SSVEP-based BCI Classification in Tangent Space =============================================================================== Project extended covariance matrices of SSVEP-based BCI in the tangent space, using princi...
49a7eefbe3178deffd60a40c6fd766b6c4ab743642d2bc7d7eaf7a8856f031c5
Python
7,476
187
# --- 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 XBins(_BaseTraceHierarchyType): _parent_path_str = "histogram2d" _path_st...
f760e195f34372da767b4e53d4bef9f4f6470afad6792c59047bcea1517813d0
Python
7,476
187
# --- 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 YBins(_BaseTraceHierarchyType): _parent_path_str = "histogram2d" _path_st...
b1812ea06657aafef1674f1557e51564b56c5946fdf53b465f60f563dee2c414
Python
7,477
225
# LICENSE # # _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._ # # BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License"); # # - you may not use this software except in compl...
f13a654e2b69d1e34ae9611f0daab495ecc223ddf3d40ff1b4d6d864456979b8
Python
7,477
225
import numpy as np from neurogym.core import TrialEnv from neurogym.utils import spaces class DelayMatchSample(TrialEnv): """Delayed match-to-sample task. A sample stimulus is shown during the sample period. The stimulus is characterized by a one-dimensional variable, such as its orientation between...
7aeac59dfddfe4b37a2488f679dfbe8c935175b846cf616f71c5dc295a9e675b
Python
7,480
194
"""Dual Attention Network https://arxiv.org/abs/1809.02983""" from mxnet.gluon import nn from mxnet.context import cpu from mxnet.gluon.nn import HybridBlock from .segbase import SegBaseModel from .fcn import _FCNHead from .attention import PAM_Module, CAM_Module # pylint: disable-all __all__ = ['DANet', 'get_danet', ...
87c4e1822c4e4b3a406cafe152b55b1fb1ed4d7c6d34881fd652baa85f8de88c
Python
7,480
219
"""Visual Tracker Benchmark. Code adapted from https://github.com/STVIR/pysot""" import json import os from glob import glob from tqdm import tqdm from mxnet.gluon.data import dataset from gluoncv.utils.filesystem import try_import_cv2 class Video(object): """ Abstract video class. get video class information...
cacb294aedfc597c071bfe6d2c794222bc35b0741bd56a31670ace58ea3c8033
Python
7,480
274
import locale locale.setlocale( locale.LC_ALL, 'en_US.UTF-8' ) import re import pandas as pd import numpy as np def clean_numbers_str(text): chars = ['%', '*', '#'] if type(text) != str or text is None: return text for ch in chars: text = text.replace(ch, '') return text.strip(...
5c686df38fba3bbfb2696991d86705105b1e8a8c9c626e9bcda41550c234729b
Python
7,481
256
"""Backward observer tests for tap and record spans.""" from __future__ import annotations import torch from torch import nn import torchlens as tl from torchlens.observers import TapObserver class _TinyRelu(nn.Module): """Tiny module with a paired ReLU grad_fn_handle.""" def __init__(self) -> None: ...
a43de75ca08f093a5771a5af490d60b5f24ea5cacabb11cb7cce32b374ef0a71
Python
7,481
217
""" =============================================================================== Visualization of SSVEP-based BCI Classification in Tangent Space =============================================================================== Project extended covariance matrices of SSVEP-based BCI in the tangent space, using princi...
b682be9d8de56e1c7d34226adb008ba84a32299b3860d8ca45252a6850dd9e09
Python
7,481
238
"""Functions for generating model components.""" import numpy as np from specparam.utils.checks import check_flat from specparam.modes.modes import check_mode_definition from specparam.sim.transform import rotate_spectrum ##############################################################################################...
75cd52a079fa8e879b5e1556ade80f332498fba6b691fbffb68934e5738982b9
Python
7,482
232
#!/usr/bin/env python """ User defined variables and functions that are used across all scripts. """ import numpy as np import matplotlib.pyplot as plt from scipy.signal import ( sosfilt, iirfilter, # cheby1, ) from functools import partial from somnotate._plotting import plot_signals, plot_states from so...
c80f43bfc494cfd2ea11c3ff64df53ea64536cd0eb2299f15d94124f02f47283
Python
7,482
135
""" Workflow recommendation engine using Transformer neural network """ import argparse import os import sys import time sys.path.append(os.getcwd()) from scripts import extract_workflow_connections from scripts import prepare_data from scripts import utils import train_transformer import train_dnn import train_cnn ...
aa1834e66290765f1d92a28788d822fd9af6eab3c60d7775779d78d5b2d36945
Python
7,483
198
#!/usr/bin/env python3 # coding: utf-8 """ Created on Jun 2020 @author: Victor Manach <victor.manach@telecom-paris.fr> @author: Rémi Jaylet <remi.jaylet@telecom-paris.fr> """ from typing import Optional, Union import numpy as np from scipy import sparse from scipy.spatial import cKDTree from sknetwork.embedding.base ...
aea205c51cb76e6cc7e7650a1e77ebcceb984119063da7da6ac685fc59e085bb
Python
7,483
186
"""Script to generate keras public API in `keras/api` directory. Usage: Run via `./shell/api_gen.sh`. It generates API and formats user and generated APIs. """ import os import re import shutil import namex PACKAGE = "keras" BUILD_DIR_NAME = "tmp_build_dir" def ignore_files(_, filenames): return [f for f in ...
eefc7b873fd1b671070e355b1414703fd763d4808691a70c7f91ef7453864b4c
Python
7,485
176
"""Save-entry gate helpers for ``torchlens._io.bundle.save``. Three entry-time guards that run before (or instead of) the per-trace save pipeline: the two PERMANENT erasure-prevention invariants (edge-substitution carriers and the shard-local disclosure, both keyed on the ACTIVE SCHEMA so a regression re-fires them), ...
075721ab0c36bd223a58775bc5d1e651f7aa70c546f7bbaa6f802299bb286573
Python
7,486
182
#!/usr/bin/env python3 #-*-coding:utf-8-*- # 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/lic...
677b786d55b63b191b0fb1bd9e6d0b729c1352b6f93b683d52d944bde5f4e1c6
Python
7,486
266
""" ==================================================================== Augmented Covariance Matrix ==================================================================== This example compares classification pipelines based on covariance maxtrix (CM) versus augmented covariance matrix (ACM) [1]_. """ # Authors: Igor Ca...