sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
f67ef45f5f7b803b9eb98e9d54bb3d50af1ae3470195cc9f6bd4a741d1472ed7 | Python | 6,994 | 198 | """Full validation of NON-identity edited forks (AUD-CODE 2.9).
``validate_forward_pass`` on ANY pushed fork with ``save_arg_values=True``
false-FAILED at the first downstream op (``argument_logging: parent not
logged as an argument``) because the argument-logging check compared the
child's capture-time ``saved_args``... |
7b7a33514309543e151ea1235b298a89acb4bab8e20d35af2ef0647183d4571f | Python | 6,995 | 200 | """This does not cover all CLI parameters defined in caper/caper_args.py.
Google Cloud Platform is tested in test_cli_server_client.py.
However, other cloud (aws) and HPCs (slurm/sge/pbs) are not tested.
In this testing module, 'caper run' is tested with a local backend.
See test_cli_server_client.py for 'caper serve... |
09ba12e5bf2861c4f7b15e8cff5605cf4d2542eec020d8d7102d75b6686b7b39 | Python | 6,997 | 183 | # Copyright 2025 Google.
#
# 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 writing, soft... |
e76ca80f9dd717e22370de2718576f4645c96f5fcec9f2558c8f830f517637ba | Python | 6,997 | 197 | """The XCP-D postprocessing worklow.
XCP-D postprocessing workflow
=============================
"""
from xcp_d import config
def main():
"""Entry point."""
import gc
import sys
from multiprocessing import Manager, Process
from os import EX_SOFTWARE
from pathlib import Path
from xcp_d.c... |
f0e8845b5c58e87ea63ebabca619d430e25f81bf78e8279b9a34a2151c804df8 | Python | 6,997 | 182 | import os
import glob
from concurrent import futures
from functools import partial
from collections import defaultdict
import numpy as np
from numpy import linalg as LA
from Bio import PDB
from Bio.PDB import MMCIFParser
from Bio.PDB.vectors import rotaxis
from Bio.Data.IUPACData import protein_letters_3to1_extended... |
04e05a8bc299a2daa82c6b33faf66c55350e84cc41220131bd6bdb023bae73b9 | Python | 6,998 | 205 | """Background job for non-blocking Explore simulation previews.
The job intentionally has no Panel or Bokeh imports. It owns all expensive
simulation, dataset, and Matplotlib work while the Explore controller remains
responsible for rendering progress and results on the document thread.
"""
from __future__ import an... |
964b7e2ba0bd77bd46f7ad8aeae985f72768ce686db9a74954e9983e8ded4a94 | Python | 6,998 | 238 | # AnnotateRnaz.py ---
#
# Filename: AnnotateRnaz.py
# Description:
# Author: Joerg Fallmann
# Maintainer:
# Created: Sat Jan 26 12:45:25 2019 (+0100)
# Version:
# Package-Requires: ()
# Last-Updated: Tue Jan 29 13:52:57 2019 (+0100)
# By: Joerg Fallmann
# Update #: 188
# URL:
# Doc URL:
# Keywords:
# Comp... |
e580fc7f840df1ec2bccbe6dc0b62504fdd5d785d82bedd96e42681d1f548e48 | Python | 6,999 | 188 | import numpy as np
from matplotlib import pyplot as plt
import scipy.ndimage
import os
import pandas as pd
import imageio
from skimage import io
from skimage.segmentation import clear_border
from skimage.measure import label, regionprops
from skimage import morphology
from skimage import restoration
import skimage.filt... |
f602f4deec683c9470ece393e4b9c3ee1628d00c96e0cab4ac8d1498ba910741 | Python | 7,000 | 231 | """
Obstacle geometry for the 2D robot simulation.
Provides the wall and box primitives that the robots' proximity sensors detect
and that block their motion.
"""
from __future__ import annotations
from typing import Any
import numpy as np
import param
from shapely import geometry
# import pygame
from shapely.affini... |
855fbe344770d259aef8c8ad835fc7bbe92e4193570000755a7497a06dbd78c5 | Python | 7,002 | 200 | """Monocular Depth Estimation Dataset.
Digging into Self-Supervised Monocular Depth Prediction, ICCV 2019
https://arxiv.org/abs/1806.01260
Code partially borrowed from
https://github.com/nianticlabs/monodepth2/blob/master/datasets/mono_dataset.py
"""
import random
import copy
import numpy as np
from PIL import Image #... |
677ee60a47fe94f6e72991981f4bd7f9b8e64524eb298a321d43db8b6eac17be | Python | 7,004 | 195 | """The column-offset map build enters no Python frame (r16 tap-budget fix).
``_build_col_offset_map`` is often first called inside an
``intervention_ready`` capture, where the RNG monitor's profile hook snapshots
NumPy RNG state on every Python frame entry. The old ``dis``-based build
entered several helper frames per... |
ebd2cd1918ec7c52e19e55dd240773a699e30ebaf8708efd2cefce20f5d21948 | Python | 7,005 | 138 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
6e5114158bc72bbf6d52b94ee05b78608db6b8f19942b5862401dc233c2267a1 | Python | 7,006 | 188 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 13 09:54:45 2020
@author: Audrey Mazancieux
This script performs preprocessing of physiological data recorded during
fMRI sessions to have one .txt file that can be used to perform physiological
noise modelling using the PNM module in FSL.
Prepr... |
0fe90b73f2d8f9972142a693dce10145954e70c6a77860446faaff8bffc5a2a1 | Python | 7,007 | 168 | """
Network-PyTorch Integration
===========================
While the methods `run`, `train`, and `test` of the `rectipy.Network` class provide wrappers to RNN simulation,
training, and testing via `torch`, the `Network` class and each of its layers can also be integrated into custom `torch`
code.
We will demonstrate... |
6da8a1144b4b1d14cee061370b9511d9ba7f60a228ca4f9356893cdc5ba8b205 | Python | 7,007 | 150 | from __future__ import division
from psychrnn.tasks.task import Task
import numpy as np
class MatchToCategory(Task):
""" Multidirectional decision-making task.
On each trial the network receives input from units representing different locations on a ring. Each input unit magnitude represents closeness to th... |
4d132a058e85e10fbe18183195420d93864321e50a6f1f7026533626e041a71b | Python | 7,008 | 178 | import numpy as np
from tqdm import tqdm
import pandas as pd
import pathlib
from collections import defaultdict
from scipy.linalg import svd
from functools import partial
import ruamel.yaml
import multiprocessing
import click
import re
from causal_optoconnectics.core import Connectivity
from causal_optoconnectics.tools... |
46acfe13d7cf5844573e74d73436b74fc9cbccffafd3326aa3a5da0d19cb1335 | Python | 7,010 | 184 | #!/usr/bin/env python3
"""
File: split_expression_matrix.py
Created: 2023/07/17
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... |
b98dc20d07bbe3092c7d1a242a84ac23789493865cfd9cac9558d71fcf7095d1 | Python | 7,012 | 180 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# A simple
#
#
# Copyright (c) 2014-2016 Nick Semenkovich <semenko@alum.mit.edu>.
# https://nick.semenkovich.com/
#
# Developed for the Gordon Lab, Washington University in St. Louis (WUSTL)
# http://gordonlab.wustl.edu/
#
# This software is released under the MIT Lic... |
41c2d03ff8c9311d1bb9cd4cea89818374ace766dd37441b527eeb1301e94afa | Python | 7,013 | 200 | import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from torch.optim import Adam, SGD
from torch.optim.lr_scheduler import ReduceLROnPlateau, LambdaLR
from ..models.base import (
BaseModel,
BasicFullyConnectedModule,
BasicConv1D,
BasicRecurrent,
)
from ..datasets import... |
fc094352873825aa41eccdb73f8130571bf960e1e74009c206bc301fe3bd1e80 | Python | 7,016 | 231 | __author__ = 'cenwan'
#-----This is a PyTorch implementation of FFPred-GAN synthetic protein feature samples generation method.
#-----This code is adapted from an implementation of WGAN-GP by caogang/wgan-gp@GitHub repository.
#-----The real training data can be downloaded via http://bioinfadmin.cs.ucl.ac.uk/download... |
218e357c615ecd4fd11c51d2b2ff0da3340c8dbe34bda6249a39d0a965c4995e | Python | 7,017 | 184 | import pickle
import json
import numpy as np
import os,sys
from collections import OrderedDict
import torch
from torch.utils.data import Dataset
import biovec
from Bio.Seq import Seq
from biovec import models
from tape import ProteinBertModel, TAPETokenizer
import warnings
warnings.filterwarnings("ignore")
def gener... |
76331d37b6035bacb7fc32cc05b0c9369442d634042ec1c0883ebbc03b1d8e75 | Python | 7,017 | 200 | import pkg_resources
import logging
from PyQt6 import uic, QtWidgets
import matplotlib
from bmlab.models.setup import AVAILABLE_SETUPS
from bmlab.session import Session
from bmicro.gui.mpl import MplCanvas
import os
matplotlib.use('Qt5Agg')
logger = logging.getLogger(__name__)
class DataView(QtWidgets.QWidget):... |
233a0294c684f9586eb7ea8e6d682de0d50d30b3f82cf840020562e9bec99fa6 | Python | 7,018 | 157 | import os
import torch
import json
from PIL import Image
from torchvision.transforms import ToTensor
from tqdm import tqdm
import pandas as pd
from src.data.Data_alignment import prepare_keypoints_for_analysis
from SG_MaskRCNN_train import SkeletonGuidedMaskRCNN, class_names, num_classes, colors
from src.utils.utils i... |
66e55ffc3329282533055b2da25bd03c079a8d0442e753a4cb9fe10c7ce1845b | Python | 7,020 | 183 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
import os
from pip._internal.cache import WheelCache
from pip._internal.cli import cmdoptions
from pip._internal.cli.base_command import RequirementCommand
from pip._internal.exceptions import CommandError, PreviousBuildDirError
from pip._i... |
dd14864a37514704921e09bc874cbbf2b5cf392b7d69ffeb0a72e64f4462860c | Python | 7,020 | 116 | #!/usr/bin/env python
# =============================================================================
# BCR similarity networks (dandelion) — Figure 5I.
# Builds an edit-distance sequence-similarity network per animal from the
# clustered productive heavy-chain AIRR database, coloured by tissue.
#
# INPUT : a single AI... |
d35d4d0e6b672d9933c0c644a3dc1391cf1e86ecd351399ff8337b12e75f3085 | Python | 7,021 | 170 | """Region Proposal Target Generator."""
from __future__ import absolute_import
import numpy as np
import mxnet as mx
from mxnet import autograd, gluon
from ....nn.bbox import BBoxSplit
from ....nn.coder import SigmoidClassEncoder, NumPyNormalizedBoxCenterEncoder
try:
import cython_rpn_target
except ImportError:
... |
a2d7695c332837184bc2f80ad947d2fd720bc3c80e3d386ee451133e8125572a | Python | 7,022 | 160 | #!/usr/bin/env python3
"""Суточный автономный прогон: добавляет новые seed'ы к главному сравнению A.5.
Процедура ровно та же, что в блоке A.5 ночной сессии (см. REPORT.md §2, блок A):
четыре условия — self / shuffled / neighbour / off — на ОДНИХ И ТЕХ ЖЕ seed'ах,
120 000 тиков, блочное усреднение (5 блоков × 15 000 по... |
a3c5917d9ea333b9c8ed25fd96746d8693d0cd7c126292ced314257a5a0df186 | Python | 7,022 | 146 | import sys
import os
cur_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(cur_dir)
import torch
import torch.backends.cudnn as cudnn
import time
from utils import *
from model import *
from data import *
import pickle
from config import CFG, resolution
import segmentation_models_pytorch as smp
from skl... |
ce731b880a613a8b6aadf806a016b3e952859d64cbef2e957fb579277826f9b0 | Python | 7,022 | 167 | """A setuptools based setup module.
See:
https://packaging.python.org/guides/distributing-packages-using-setuptools/
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
from os import path
# io.open is needed for projects that support Python ... |
1fdc7deba53d422ca8951ed380beac1b100e675e94853fc96aa16e9a1e94016d | Python | 7,023 | 199 | from typing import Optional
import histomicstk as htk
import numpy as np
import scipy as sp
import skimage.color
import skimage.io
import skimage.measure
from anndata import AnnData
from scipy import ndimage as ndi
from skimage.feature import peak_local_max
from skimage.segmentation import watershed
from tqdm import tq... |
00eccbbafdab3b471460c81c16d58a784a4b7bda3969b34d782c1f74910b224a | Python | 7,025 | 173 | from typing import List, Tuple
from pytorch_lightning import LightningModule
from timm.models.vision_transformer import vit_small_patch16_224
from torch import Tensor
from torch.nn import Linear, MSELoss
from torch.optim import AdamW
from lightly.models import utils
from lightly.models.modules import (
MaskedVisi... |
1363dd498dda0bc3c7838b042f99c64ae691900f7ca16357db3aae59d29e9f34 | Python | 7,025 | 204 | """Neuro-Fuzzy Inference Modules.
ANFIS, 1993, Jang, "ANFIS: Adaptive-Network-Based Fuzzy Inference System."
Gaussian membership functions feed product rule firing strengths, normalized
rule weights, first-order Takagi-Sugeno consequents, and a weighted output sum.
Only the forward inference graph is inclu... |
2bc99ddcb3f04f4f872e3af2ca003a3022f46f13bd282ea83ec1236057be9ab3 | Python | 7,025 | 199 | __author__ = 'quentin'
from threading import Thread
import time
import collections
import urllib.request, urllib.error, urllib.parse
import json
class HardwareConnection(Thread):
def __init__(self, interface_class, *args, **kwargs):
"""
A class to build a connection to arbitrary hardware.
... |
3475186a48bfdced7a3adbb7cd73047a900486834743f46232f30045a91aa5fe | Python | 7,025 | 195 | import skimage.transform as skTrans
import nibabel as nib
import numpy as np
from nibabel.affines import rescale_affine
import os
import pandas as pd
import logging
import SimpleITK as sitk
from scipy.signal import medfilt
import itk
import skimage
import functools
from skimage.transform import resize
import subprocess... |
dbe81ed0d496f1ab759dad3ebc81f3c9f63f794f5909e9add4c377ccd73abb03 | Python | 7,025 | 189 | from contextlib import AbstractContextManager
from typing import Callable, List
from uuid import UUID
from fastapi import HTTPException
from carbonserver.api.domain.users import Users
from carbonserver.api.infra.database.sql_models import Experiment as SqlModelExperiment
from carbonserver.api.infra.database.sql_model... |
b74639286a216a72770fd6c04193ddbcbdf289e559d653495e8053b953145a4a | Python | 7,027 | 171 | from locale import normalize
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # Code suppressing TF warnings and messages.
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
import sys
import warnings
warnings.filterwarnings("ignore", category=FutureWarning)
import subprocess
import argparse
import bm3d
import numpy as np
imp... |
8a42b63ddcaed0edb4c12f93f90c6a09dd1b3c843b427be7659a5cbbcec860ca | Python | 7,028 | 227 | import cv2
import numpy as np
from ethoscope.utils.debug import EthoscopeException
try:
CV_VERSION = int(cv2.__version__.split(".")[0])
except Exception:
CV_VERSION = 2
__author__ = "quentin"
class ROI:
def __init__(
self, polygon, idx, value=None, orientation=None, regions=None, hierarchy=Non... |
a78e5f84de2d7880715abbe6ba4512f22340302ec8422e21f5d95a923979fa71 | Python | 7,029 | 205 | #!/usr/bin/env python3
"""
_platt_oos_fit.py — Out-of-sample calibration of trained Platt
parameters on the held-out figshare cohort (paper §3.7).
Reads the canonical trained_model.json (Platt a, b fit on training-pool
in-sample LDA scores under the deployment classifier), computes the
held-out figshare LDA discrimina... |
e647fadb46dd2a588db28c6a1b46b1e6993db88b2f4c5becb7c639d25708bc58 | Python | 7,030 | 186 | import numpy as np
import pytest
import torch
from pytest_mock import MockerFixture
from torch import Tensor
from torch import distributed as dist
from lightly.loss import NTXentLoss
class TestNTXentLoss:
def test__gather_distributed(self, mocker: MockerFixture) -> None:
mock_is_available = mocker.patch.... |
57cbe99aa633877a5adefa169b10b37ed7dff7bce42d95190723df391bfa6b4d | Python | 7,031 | 159 | # -*- coding: utf-8 -*-
import torch.nn.functional as F
import torch.nn as nn
import numpy as np
import matplotlib.pyplot as plt
import os
import os.path
import time
import torch
import math
import platform
import torchsummary
from optical_layer import train_complex
from utils import padding, tile_kernels
from importli... |
d42a5f7e2a8dee60b864c66665483a2496daf18ba81f64ae4ab6fdf7482fe29a | Python | 7,032 | 189 | # SOURCE: vendored from https://github.com/akazemipour/DIAYN-PyTorch @ main
# (Brain/model.py, verbatim -- only import path adjusted since we drop the package's
# relative-import wrapper; no architecture changes)
"""DIAYN (Diversity Is All You Need; Eysenbach et al. 2018) learns a set of diverse skills
without a reward... |
7f0ed270b719741753e859c1268f4a68982d969af9f9a0efc9ec74147e80639e | Python | 7,035 | 195 | """Determine package version from git repository tag
Each time this file is imported it checks whether the package version
can be determined using `git describe`. If this fails (because either
this file is not located at the 1st level down the repository root or
it is not under version control), the version is read fr... |
1b6fae2d49243355ae4a4d9ed89d84eb08cf48401903a1b542ca9a7cfdb3b4c1 | Python | 7,036 | 192 | """Lifecycle tests for TorchLens private ``._tl`` metadata cleanup."""
from __future__ import annotations
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.backends.torch._tl import (
TensorMeta,
get_buffer_address,
get_module_meta,
get_tens... |
970c568000c7fe1467af7dbf9208a86e8dccaf0fc2f1e5cf3032f19db7a1c47d | Python | 7,037 | 196 | #!/usr/bin/env python
"""
Assess ligands against a second set of molecules using SuCOS scores.
This is a quite specialised function that is designed to take a set of potential follow up
compounds and compare them to a set of clustered fragment hits to help identify which follow up
ligands best map to the binding space ... |
b643e5446ff4e9167220bb4c4d8b0f79228d2fc02ffbc4f17a28abfdda7cee7e | Python | 7,038 | 210 | """CMNIST model specification
"""
from numpy import prod, sqrt
import torch
import torch.distributions as dist
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
from torchvision.utils import save_image, make_grid
from src.utils im... |
d15d913961afb8cd66aa1cc7aa8bfe0b760868521b6694b450de707e273d532e | Python | 7,039 | 228 | """
This module contain all estimation methods from
English et al. 2017, Neuron
"""
import numpy as np
from .cch import correlogram
def poisson_continuity_correction(n, observed):
"""Correct for continuity.
Parameters
----------
n : array
Likelihood to observe n or more events
observed : ... |
44e2c2a7af594412e92835317ce9ca26b4a6eddac0c94a9418d93a83acb352c4 | Python | 7,042 | 188 | """
#--------------------
Created on 2021.10.28
Version 1.0
__author__ = 'Xx'
#--------------------
"""
import math
from conf_test import conf_test
from tview import tview
'''
Description:
Routine for performing clear sky tests over land surfaces during daylight hours.
For daytime land the groups are:... |
16944db023985d27a852968c476ee96c24d8e0eca636c7138659965e0f1493bc | Python | 7,044 | 236 | from tempfile import TemporaryDirectory
import numpy as np
import polars as pl
import pandas as pd
import seqpro as sp
import xarray as xr
from pytest import fixture
import pickle
import seqdata as sd
import zarr
def read_fasta(file_path):
"""
Reads a FASTA file and returns a dictionary of sequences.
P... |
60778d0fe2e601499ff4150a0830e9e697e25c94eae3d7cf03e2194223ed1441 | Python | 7,044 | 247 | """.. _lightly-checkpoint-finetuning-tutorial-7:
Tutorial 7: Finetuning Lightly Checkpoints
===========================================
LightlySSL provides pre-trained models on various datasets such as ImageNet1k,
ImageNet100, Imagenette, and CIFAR-10. All these models' weights along with their
hyperparameter config... |
e434119b03d314fc8496ff1771157ca8df237fddca46162390a0bb17943d69c7 | Python | 7,045 | 225 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test objects and function in the module tfep.nn.flow.centroid.
"""
# =========================================... |
d69c5af0f577fbe464443d282e14a16aea1191ef0c74438ce4735712b64e3989 | Python | 7,047 | 171 | 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... |
d0cf4e3e5db008a88100e5b25f6bb978dc054db7d5c5000765176929c9da29ae | Python | 7,048 | 188 | from copy import deepcopy
import os
import numpy as np
import pandas as pd
import tensorflow as tf
import tensorflow.keras as keras
import tensorflow_addons as tfa
from tf_spiking import DenseLIF, DenseLIFNoSpike, IntensityToPoissonSpiking
from tf_spiking.helper import TrainingHistory
from training.brightness_offset_mn... |
02329025c501a1445307ca6ad479ae8106290700442ed861704bb9d7faffc4f2 | Python | 7,049 | 149 | ##########################################################################
## ##
## Copyright (c) 2019-2024 Philipp Lösel. All rights reserved. ##
## ##
## This file is par... |
abdcf606fd769f494776748b619b10995e31a8c5f598124cd15538c060001d5f | Python | 7,049 | 159 | from . import compression
from . import cochlear_filters
from . import envelope_extraction
import torch as ch
import numpy as np
import sys
class Cochleagram(ch.nn.Module):
"""
Generates a cochleagram, passing an audio signal through a set of bandpass
filters designed to mimic an ear, followed by envelope ... |
eb7790f443dcc384766c2f21bda30dc8e6fee8d0ad2351d3d27e0a016200eac8 | Python | 7,050 | 189 | from flask_restplus import Namespace, Resource, reqparse
from flask_login import login_required, current_user
from mongoengine.errors import NotUniqueError
from ..util.pagination_util import Pagination
from ..util import query_util
from database import CategoryModel, AnnotationModel
import datetime
api = Namespace('... |
79e35ca8425017caa6119961df1d8a9c9e00e4e5e48adeb80c734771ab826e01 | Python | 7,051 | 215 | import inspect
from keras.src.api_export import keras_export
from keras.src.losses.loss import Loss
from keras.src.losses.losses import CTC
from keras.src.losses.losses import BinaryCrossentropy
from keras.src.losses.losses import BinaryFocalCrossentropy
from keras.src.losses.losses import CategoricalCrossentropy
from... |
a53f67d325ddeaf2d40f2c5d575b8f9d055a4fd62a3e0e93f1434824ee41d569 | Python | 7,052 | 195 | from __future__ import annotations
from dataclasses import dataclass, field
from typing import Dict, Optional, Sequence
@dataclass
class MLPConfig:
hidden: Sequence[int] = field(default_factory=lambda: [64])
dropout: float = 0.1
input_dropout: float = 0.0
batch_norm_momentum: Optional[float] = 0.6
... |
5cc3c74e33ce3d38936a78a57e328d1ff077a709169e86a241e40cf9575054dc | Python | 7,053 | 151 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
"""Functions for estimating the best YOLO batch size to use a fraction of the available GPU memory in PyTorch."""
from __future__ import annotations
from copy import deepcopy
import numpy as np
import torch
from ultralytics.nn.tasks import RTDETRDe... |
71b64ff566896c373a013c8fdeecd753ab956ab91b36eb97c2b5957345bbc883 | Python | 7,053 | 221 | """Test confounds handling."""
import pytest
import yaml
from xcp_d.data import load as load_data
from xcp_d.utils import boilerplate
def test_describe_motion_parameters():
"""Test boilerplate.describe_motion_parameters."""
desc = boilerplate.describe_motion_parameters(
motion_filter_type=None,
... |
21756afdc2565216661d52244571ea883e5f5d4a2b71d32c70a493e6eaf454da | Python | 7,054 | 234 | import warnings
from typing import Any
from xml.etree.ElementTree import Element
import numpy as np
def setting_def(
arg_key: str,
typing: str,
to_list: bool = False,
xml_key: None | str | list[str] = None,
class_key: None | str = None,
test: Any = None
) -> dict[str, ... |
5c21f877a73cc843c7547c678e5be645f82be0b5e3266e53aa6304914d9a4b59 | Python | 7,054 | 209 | # coding=utf-8
# Copyright 2022 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... |
344344916419fc184940c5ea79e8a9d1b36699d3f0cf5440ee14a6d13835a893 | Python | 7,055 | 140 | """Анализ A.5 (главное сравнение) + A.3 (2σ шума из self-прогонов).
Читает runs/compare.jsonl. Применяет критерии годности (вымирание, потолок,
занято <4 децилей). Считает по обеим метрикам (внутриагентная — главная,
популяционная — исследовательская): среднее/sd/медиана, парный Уилкоксон
self vs shuffled (и neighbour... |
a9ac05542d14794a3155fe388005f8278946d01aff4026db6e01587a2f058dfd | Python | 7,055 | 199 | import numpy as np
import math
from copy import deepcopy
from .utils import pbc, rotate_trajs, PeriodicCKDTree
import mdtraj as md
from MDAnalysis.analysis.distances import self_distance_array
import math
def augment_evenly(
n: int,
trajname: str,
topology: str,
cvname: str,
savename: str,
box... |
e414c2d1790ad50e7b64ee2c68416b07399d891f6167d1e326330dac387a1d6a | Python | 7,055 | 172 | 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... |
33cb328f07676494f694254257925883064ce59965b8586586a4216e2fdb5c8c | Python | 7,056 | 225 | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
43cec14c9ecb941c91f1ef4dd173b192ef97f9b1e43053207c1d5c721df47888 | Python | 7,056 | 216 | #!/usr/bin/env python
#
# stlearn documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 9 13:47:02 2017.
#
# 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... |
d340236aaac901165036ab7bfe4cb3819f3c94c0ec9a1897355dc32bd6e44cd6 | Python | 7,056 | 169 | """Op/facet tier, Route B via fastlog (explorer memo item 8; lane F25).
The differentiator: op-grain sites via one fastlog pass per logged step
under the P1 summary role and the P2 reduce-only path, folded into the
SAME artifact schema (site kinds ``op`` / ``facet``), with disclosed cost
(the plan table), selector-alg... |
381d8b2af654c6697547a1d83058180c2bad1cfb8f69337f6ba2d7d9aca79c93 | Python | 7,057 | 152 | # Get final layer activations during prediction for Models (SocialGNN / CueBasedLSTM)
from collections import Counter
import os, sys
import pickle
import numpy as np
from collections import namedtuple
from datetime import datetime
import time
import argparse
from distutils.util import strtobool
parser = argparse.Arg... |
1fb41b3d4d3228624c9ec60ca66ac8ad7614626d78497c9f057d6aca312cd0e0 | Python | 7,058 | 271 | import pytest
import flask.views
from flask.testing import FlaskClient
def common_test(app):
c = app.test_client()
assert c.get("/").data == b"GET"
assert c.post("/").data == b"POST"
assert c.put("/").status_code == 405
meths = c.open("/", method="OPTIONS").allow
assert meths == {"GET", "HEA... |
3cf7806e17cd906d73c0dfefeda91b3acc421a712130eddf5aea74b07e5a7ef4 | Python | 7,061 | 170 | """
Network-PyTorch Integration
===========================
While the methods `run`, `train`, and `test` of the `rectipy.Network` class provide wrappers to RNN simulation,
training, and testing via `torch`, the `Network` class and each of its layers can also be integrated into custom `torch`
code.
We will demonstrate... |
e3a769c5ff37eda6d32a205882fa56fa0dce94a95cf73f86a8b212ecf85ab309 | Python | 7,061 | 136 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
28fa733c8e59952469d27fc1a3a8d8aafab0e52d209a9653a52754cff53ed325 | Python | 7,062 | 203 | from typing import Dict, List, Optional, Tuple, Union
from lightly.transforms.simclr_transform import SimCLRTransform
from lightly.transforms.utils import IMAGENET_NORMALIZE
class MoCoV1Transform(SimCLRTransform):
"""Implements the transformations for MoCo v1.
Input to this transform:
PIL Image or T... |
ba235dab3c537de03ec7cdbeccd4ff5050891a6a486fd678f6a380771ea2c3e3 | Python | 7,063 | 206 | """
====================================================================
Motor imagery classification by transfer learning
====================================================================
In this example, we use transfer learning (TL) to classify epochs from a
subject using a classifier trained on data from anothe... |
c1ef46e4cb8dc20948684b3953464e84e4ad563137829bf7a8ea5cc7b1d70710 | Python | 7,063 | 171 | """
DataProvider related decorators.
"""
# I'd like to decorate the factory methods that give data_providers by the name they can be accessed from. e.g.:
# @provides( 'id_seq' ) # where 'id_seq' is some 'data_format' string/alias
# def get_id_seq_provider( dataset, **settings ):
# then in some central dispatch (maybe... |
7f02728eac2b25fc84296e1e76c292edf46a6a13318d39daba97ee6424ffe7fc | Python | 7,066 | 214 | import numpy as np
from datetime import datetime
from pathlib import Path
from pdb import set_trace
import sys
from tensorflow.python.keras import Model
import tensorflow as tf # TODO: Imported only for dtype
import os
from os.path import join
from scipy.io import loadmat
# To test logger:
import cvnn
import loggin... |
ca35ee4048a30c19ec12e91c056164bf65c62b4df35875559fe66b849a7b66e7 | Python | 7,068 | 174 | import os
import torch
from src.optim import Optimizer
from src.data import prepare_data
from src.util import human_format, draw
from src.solver import BaseSolver # Some basic functions
class Solver(BaseSolver):
''' Solver for training'''
def __init__(self, config, paras):
super().__init__(config, para... |
7be9d69d0852e003ad1431bdf78310edf842ead01d35e593ef898b0297c59f2e | Python | 7,070 | 214 | from unittest import mock
from uuid import UUID
import pytest
from api.mocks import FakeAuthContext, FakeUserWithAuthDependency
from fastapi import FastAPI, status
from fastapi.testclient import TestClient
from carbonserver.api.infra.repositories.repository_projects_tokens import (
SqlAlchemyRepository as Project... |
f31e2da6de74177c8a8e692ed43c1bc62e36046e72d3376d456d86a8c6b27b8c | Python | 7,071 | 181 | # ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.14.5
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
# Simulation... |
90d9c21008bbd14f6ee28a8dd5b9e8cd9ef170a1ff61fe758ae6fb4b65d257fe | Python | 7,074 | 176 | import ml_dtypes
from keras.src import ops
from keras.src.dtype_policies.dtype_policy import QuantizedFloat8DTypePolicy
from keras.src.quantizers.float8_scaling import compute_float8_amax_history
from keras.src.quantizers.float8_scaling import compute_float8_scale
from keras.src.quantizers.float8_scaling import quanti... |
ac14ecb019287673bb77e4596d4c721ba5d86eef460e7e79e61a799f8515a478 | Python | 7,074 | 216 | """Shared-root plant for ground-truth output enumeration (b9 R74/75-1).
The review's live probe: a planted drop-the-last-leaf mutation in the ONE backends
output walker made capture AND the validation oracle omit output #2 of a
2-tuple model, and ``validate_forward_pass`` returned True -- a dropped
capture output surv... |
cb3dff2967a983e2ab5af4d06ad95a9761b29079e37c8ba107355458eb468516 | Python | 7,076 | 204 | """
Mock devices and device-related utilities for testing.
This module provides mock implementations of ethoscope devices and related
components for use in tests.
"""
import datetime
import json
from typing import Any, Optional
from unittest.mock import MagicMock, Mock
class MockEthoscopeDevice:
"""Mock impleme... |
f59962e6376ad0dd50dab85d9be8d5e440aad7eac7e73afdf7dcac8d1e4d3ab1 | Python | 7,077 | 211 | from os.path import join as oj
from datasets import Dataset
from tqdm import tqdm
import torch
import numpy as np
from torch.utils.data import DataLoader
import imodelsx.util
def get_model(checkpoint):
from transformers import BertModel, DistilBertModel
from transformers import AutoModelForCausalLM
if "di... |
44e3f259508d4e942ed0cabe00ffd316b6eabd078d574b85702cd66754729232 | Python | 7,078 | 206 | 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.parametric import neg_log_likelihood
from survival_plus_x.utils.utils import... |
8efa128e2e22abc715125f624e62f4c5c849c24c1d0d124093802d8290e05603 | Python | 7,078 | 200 | """This file contains all the widget functionality"""
# License: GNU General Public License v3.0
import os
import ipywidgets as widgets
from ipywidgets import Widget
from IPython.display import display
def DataUploadWidgets(path_of_data, name):
"""Widget used for data upload"""
list_dir = []
for entry in... |
a88a7c82c11d2c1fa4ace6c4e24f9ed3e3bb85cb76f332af8e522603f3598609 | Python | 7,078 | 195 | # SOURCE: vendored from GaloisInc/dlkoopman @ main (dlkoopman/nets.py, composition per
# dlkoopman/traj_pred.py's TrajPred._evolve / TrajPred.predict_new)
#
# https://raw.githubusercontent.com/GaloisInc/dlkoopman/main/dlkoopman/nets.py
# https://raw.githubusercontent.com/GaloisInc/dlkoopman/main/dlkoopman/traj_pred.py
... |
385b8e2ff0e69f03c149fe5819a64857943f577cd28e566d087f166eed2ba2df | Python | 7,079 | 183 | """VGG model definition, adapted from https://pytorch.org/docs/stable/torchvision/models.html,
to take single channel instead of 3-channel images.
Also added the option of dropout layers
after the pooling layers for extra
regularisation.
"""
import torch
import torch.nn as nn
class VGG(nn.Module):
def __in... |
b4e85a9638b96f37a9ddae5a4f1c82924f436cdfc2c4586d1ca8853ba544f4d4 | Python | 7,080 | 184 | # SPDX-License-Identifier: LGPL-2.1-or-later
import os
import unittest
from datetime import date
import numpy as np
import pyEcoHAB.utils.for_loading as uf
from pyEcoHAB import data_path, sample_data
from pyEcoHAB.SetupConfig import SetupConfig
from pyEcoHAB import Loader, Merger, Timeline
from pyEcoHAB import get_inco... |
4ad16da300a31dd603b1175da3f849ee8f389998b877d944022b451828458e53 | Python | 7,083 | 156 | from ..utils import utils, constants
from ..core.trajectorydataframe import *
from sklearn.cluster import DBSCAN
import numpy as np
import inspect
kms_per_radian = 6371.0088 # Caution: this is only true at the Equator!
# This may cause problems at high latitudes.
def cluster(tdf, clust... |
e53e368d5bd7054407398438b2891ddf3c243c90ec8a74becb9342dab06f07ee | Python | 7,084 | 212 | """ Pytorch Distributed utils
This piece of code was heavily inspired by the equivalent of Fairseq-py
https://github.com/pytorch/fairseq
"""
import os
import signal
import math
import pickle
import torch.distributed
from bioseq2seq.utils.misc import set_random_seed
from bioseq2seq.utils.logging import init_lo... |
8b17532fd7f58f9bf8b89be7c7bfabef1e5a9b89bf3cce35abf4e36232eb0caf | Python | 7,085 | 179 | """
Simulation Parameters
=====================
Manage parameters for creating simulated power spectra.
"""
###################################################################################################
# Import simulation functions for creating spectra
from specparam.sim import sim_power_spectrum, sim_group_po... |
d2037e623854c702fb075784fe4292d4a89d6b9ac1ae33cab3d6788f8f94f240 | Python | 7,088 | 185 | # Copyright (c) 2025, Tri Dao.
# As of 2025-04-23, we require triton >= 3.0
from typing import Optional, Union
import torch
import triton
import triton.language as tl
@triton.jit
def rotary_kernel(
OUT, # Pointers to matrices
X,
COS,
SIN,
CU_SEQLENS,
SEQLEN_OFFSETS, # this could be int or... |
cec36d3b039cf8a18ae6b6d9a524d1017ac071b1fadb7f313cd17f5605680456 | Python | 7,089 | 228 | """
Is there a way to determine the best lowpass filter based on measuring
the noise value? It would be great if lowpass filter settings could be
determined by the ABF, not by qualitative user input.
This also requires RMS measurement.
"""
import os
import sys
PATH_HERE = os.path.abspath(os.path.dirname(__file__))
PA... |
e48e9df23cd5455ad6b6d4529ed678f9a4b7c23c4f240a371df4d3c1c4620580 | Python | 7,091 | 185 | """F9: helpers alias the caller's tensor; doors that re-read a staged one refuse a change.
``tl.steer`` and the other tensor-carrying helpers keep the caller's tensor by
reference. Each staged entry records a full-content digest when it is staged; a
rerun and ``save_intervention`` refuse ``helper_tensor_changed_since_... |
ecb37447dd2e50d6c3f26ba39b169e4dc592bc9d3675c87c9979aeb7ad1401ca | Python | 7,091 | 205 | import numpy as np
from numpy import array,dot,argsort,diag,where, zeros, sqrt,linalg
from numpy.linalg import eig, eigh, inv, norm, svd
from ..core import ah
## TODOs:
## [X] show how much variance is accounted for by pcs
## [X] function to reshape back to movie
## [X] behave nicely if no scipy available (can't so... |
d87143a5b35183489e087f92101dd9fdd88d2cf8aba65dc45173f3e8ff6921bc | Python | 7,092 | 227 | import numpy as np
import torch
from tqdm import tqdm
def setup_seed(seed):
"""
setup random seed to fix the result
Args:
seed: random seed
Returns: None
"""
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
np.random.seed(seed)
torch... |
07056b50c8df865846cc7a0f12183cfe17eec6ae4b2b24cd5f7828877a681053 | Python | 7,093 | 217 | from __future__ import annotations
import importlib
import json
import os
import shutil
import threading
from collections.abc import Callable
from collections.abc import Iterator
from http.server import BaseHTTPRequestHandler
from http.server import ThreadingHTTPServer
from pathlib import Path
from typing import Final... |
06ad6b3610873c9d7881e33d52960a764a8a8aed64934a01ff679686bb9063b3 | Python | 7,094 | 184 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"Line plots"
from itertools import cycle, repeat
import numpy as np
from .._data_obj import ascategorial, asndvar, assub
from ._base import EelFigure, Layout, LegendMixin, XAxisMixin, AxisScale, frame_title
from functools import reduce
class LineStack(LegendM... |
d0e78bab75117ad04f3a3f9fafd56ce768b589cf351df5b5dbbb0cfd50323273 | Python | 7,094 | 166 | import copy
import warnings
import itk
import numpy as np
import pandas as pd
from mirp._data_import.generic_file import MaskFile
from mirp._data_import.itk_file import ImageITKFile
from mirp._data_import.generic_file_stack import ImageFileStack, MaskFileStack
class ImageITKFileStack(ImageFileStack):
def __init... |
7e8e4e9ac8684dc6f90b7a771447431ee0b1eb6631e7e3742fd03a6272a10afc | Python | 7,095 | 197 | #!/usr/bin/env python
"""Determine package version from git repository tag
Each time this file is imported it checks whether the package version
can be determined using `git describe`. If this fails (because either
this file is not located at the 1st level down the repository root or
it is not under version control), ... |
80a5769efc8437b8b8c2cf9bc1836604087255c5503068c8439a0f718798b774 | Python | 7,095 | 141 | from functools import partial
from multiprocessing import cpu_count
import numpy as np
from tqdm import tqdm
from tqdm.contrib.concurrent import process_map
from mp_dip.utils.signal_reconstruction import gabor
import sys
def _atom_reconstruct_width(atom, time):
center = (time[-1] + time[0]) / 2
partial_recons... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.