sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
44ac7c8d2c9adb9d117282ad0d73afb354f4c6bd8e2e2d33ef95b5c89565cd6c | Python | 15,768 | 446 | """
Sleep Restriction Stimulators
This module contains stimulators designed for sleep restriction experiments,
providing daily time-limited operation with flexible scheduling.
"""
__author__ = "giorgio"
import logging
import os
from ethoscope.stimulators.sleep_depriver_stimulators import mAGO
from ethoscope.stimula... |
a1eb598785c69fcbccc4291ac014ed064cfc696ba281bc8656abbfd3ebef4623 | Python | 15,768 | 391 | import json
from collections import OrderedDict
from pathlib import Path
from typing import List
import re
import numpy as np
import torch
import torch.utils.data as data
from tqdm import tqdm
from gluoncv.torch.utils import coot_utils
def load_h5file(h5_path):
import h5py
return h5py.File(h5_path, "r")
cl... |
832b076d95c764fe2e8fa1ce6abd17da73eba9dff887ffa582547a8617e92e6c | Python | 15,769 | 272 | from mp_dip.utils.utils import classes_d
import numpy as np
classes_d_in = {j: i for i, j in classes_d.items()}
def sanity_check_swa(atom, class_probabilities):
# Slow waves 0.2–2 0.5–6
amplitude = (40 <= atom['amplitude'] <= 1e30) # minimum amplitude? 30 might be a bit too much but leave it for now # dl... |
9d0670f493be7f50f08d70eaac3e443b4351a2fe699be5888ce00fd4141aa78a | Python | 15,769 | 406 | """Regression tests for round-10 (cert10) state-serialization fixes.
Round-9 (cert10 g1, commit 241bc170) hardened state serialization for Trace,
Op, Layer, and Buffer, but the fix was INSTANCE-deep rather than CLASS-deep:
it fixed the specific fields the audit happened to find, not the whole
defect class across every... |
f696a4ea51f1c7eff963f3f190801fbd89a0f94f85da6aa893cc24bef990e0e9 | Python | 15,771 | 481 | """Local, transitional A-vs-B throughput gate: rust-native Ragged vs awkward.
Proves seqpro.rag._core.Ragged is at least as fast as awkward's native layout
algebra before the Spec D cutover drops awkward. NOT a permanent CI fixture —
deleted at cutover (see docs/superpowers/specs/2026-06-21-ragged-throughput-gate-desi... |
c4c67cad7b90f42d4f0c09732e5998f9dcf2498dd8064281f6053af7379fa32d | Python | 15,774 | 280 | """
gse169148_annotation.py — GSE169148 样本注释的权威来源
================================================================================
为什么需要这个模块
================================================================================
初版分析(2026-09-11)用**位置规则**推断样本注释:
假定 GSM5176932..GSM5176951 = 10 例患者 × (治疗前, 治疗6月后),连续配对
这个假... |
9f9827cad1376933be9bc70b2e81f4fe7da729e0118a6ca3b63854875e735295 | Python | 15,781 | 416 | from keras.src.api_export import keras_export
from keras.src.backend.common import is_float_dtype
from keras.src.backend.common import standardize_dtype
from keras.src.layers.preprocessing.image_preprocessing.base_image_preprocessing_layer import ( # noqa: E501
BaseImagePreprocessingLayer,
)
from keras.src.layers.... |
730262d50ad1728a911f1392b177253dd1eed688688f4326eb931384bf7a7720 | Python | 15,783 | 419 | """
Brain implementation backed by a Nengo spiking network.
Wires the behavioural modules into a Nengo model so that the oscillators and
the intermittency are realized by simulated neural populations rather than by
the analytical implementations.
"""
from __future__ import annotations
from typing import Any
import nu... |
e8594f37dcaa555d598be929844810527032291a20c3b92177cf5e9f83aeba01 | Python | 15,784 | 402 | import os, subprocess, multiprocessing, shutil
import nipype, pandas as pd
import bash_function_generators as slurm
from pathlib import Path
import SimpleITK as sitk
#%% Change this to your local location that store MASHelperFunctions.sh
# mas_helpfunctions_path = f'../../MASHelperFunctions.sh'
mas_helpfunctions_path ... |
d09891294d8d6c588c5d752222f13e294f5f811bec94cb62f1e5a53ac3373ef6 | Python | 15,786 | 382 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import re
import subprocess
import sys
import types
from pathlib import Path
from shutil import rmtree, which
import numpy as np
import torch
from ultralytics.nn.modules import Detect, Pose, Segment
from ultralyti... |
39f13faa1d49285c0fc3a3f607bd89e0e37bcbc7931bac62c347283da28392ec | Python | 15,787 | 464 | # -*- coding: utf-8 -*-
"""
Created on June 02 2016
@author: Rafael Neto Henriques (rafaelnh21@gmail.com)
"""
# import relevant modules
import numpy as np
import math as mt
from dipy.sims.voxel import (multi_tensor, _add_gaussian, _add_rician,
_add_rayleigh)
def rfiw_phantom(gtab, snr=No... |
a4a2fa6be435a6f05649bdee0753c8ea2984fc702d65ec2b269a0dc046d2e676 | Python | 15,787 | 379 | #!/usr/bin/env python3
from Bio.PDB.PDBParser import PDBParser
from Bio.PDB.Polypeptide import three_to_one
from Bio.PDB.Polypeptide import is_aa
from Bio import pairwise2
from multiprocessing import Pool, cpu_count
from functools import partial
import scipy.cluster.hierarchy
import numpy as np
import sys, argparse, ... |
9bf5eb8359d6c794f5bc932188381b2f9fde8c5611fce038d75a2cfa5af23969 | Python | 15,792 | 414 | ##########################################################################
## ##
## Copyright (c) 20019 Philipp Lösel. All rights reserved. ##
## ##
## This file is par... |
be986380f64e3731b14e4de7a02bd157307c573f80a6f5b9240e8e9c2c36bafe | Python | 15,797 | 407 | #!/usr/bin/env python3
"""
Dx AP — PD-vs-HC under full Dx AA pipeline (extras-extracted).
Follow-up to Dx AO. The 5D-only PD result was AUC 0.598 — barely above
chance. The natural question is whether the PD signal lives in the
extras (IAF, DFA, FOOOF aperiodic, topographic, asymmetry, alpha
connectivity), which we ne... |
2aa5501cf5aa0e0789336777e04ee5b92b1343de4c72a5027927ec495ac75e2e | Python | 15,800 | 337 | from ovseg.training.NetworkTraining import NetworkTraining
from ovseg.training.loss_functions_combined import CE_dice_pyramid_loss, to_one_hot_encoding, \
weighted_combined_pyramid_loss
import torch
import torch.nn as nn
import torch.nn.functional as F
import os
import numpy as np
class SegmentationTraining(Netwo... |
21995e871132a6b635b7b34c14e02797a69e71a2bcad0152ac75b9acf83de6f1 | Python | 15,802 | 370 | '''
Script to compute performance metrics.
Works on cross-validated predictions that are saved as test_outputs.pickle by the training script.
'''
import pandas as pd
import os
import pickle
from typing import List, Tuple
from tqdm.auto import tqdm
PEPTIDE_START_STATE, PEPTIDE_END_STATE = 1, 50
PROPEPTIDE_START_STATE,... |
82fcbe7854d5103aaf443152c7b4f4a69c643e6296607aebe2807900dc542322 | Python | 15,805 | 416 | """F03 ledger memo items 9-11: the experiment ledger + read-only serving.
Pins the failure rows the memo funds: arm-time fail-closed preflight,
per-event durability with the kill -9 invariant (exactly k finalized events
recovered, torn tail discarded AND disclosed), interior tamper refusal,
quarantine-on-sink-death re... |
a454b9b7af1b49f6909bddb7f606c763467f2030457a533352704a3e57ecd971 | Python | 15,805 | 385 | #!/usr/bin/env python3
"""
Dx BL — ComBat / neuroComBat head-to-head comparison
=====================================================
Reviewer item: "There is no comparison [to ComBat]. 'We have not
conducted a systematic literature review' is not an acceptable
substitute when the central methodological claim is novel... |
31e253c77d598a3b63b0a17ae5f1fe6edc43dc078e37499a46786c446949dd2a | Python | 15,806 | 451 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# Copyright (c) 2016, Rafael Neto Henriques
#
# Developer : Rafael Neto Henriques (rafaelnh21@gmail.com)
# -------------------------------------------------------------------------
# Adapted impleme... |
ccf259bc243116e15e9a9835abe93eec8d20570b999a5bca82e622b6275d47e3 | Python | 15,822 | 539 | """
Unit tests for lib/model/modules/memory.py
Tests Q-learning (RLmemory), olfaction/touch specializations,
and mushroom body (RemoteBrianModelMemory) without requiring
real Brian2 server connection.
Philosophy: Test the LOGIC, not the physics.
"""
import random
from types import SimpleNamespace
import pytest
impo... |
33fb2676b779f30712b80462889acb772422d4aa9d7102fea0d1b4ac64795909 | Python | 15,833 | 366 | """Round-49 whole-class immunizer: SafeBundleUnpickler is a STRICT SUBSET of torch's
``weights_only`` baseline (secA_1).
A default (trust=False) bundle-metadata unpickle must NOT be able to
(a) CONSTRUCT a torch storage -- ``UntypedStorage(N)`` allocates N raw bytes at
``tl.load()`` time (a multi-GiB out-o... |
3b39ee2f82bdad6306ffd4183c7de627c83af190ab5cd1c8ed4d494f975aa8c0 | Python | 15,838 | 441 | #!/usr/bin/env python
""" Software to create Precision-Recall-Gain curves.
Precision-Recall-Gain curves and how to cite this work is available at
http://www.cs.bris.ac.uk/~flach/PRGcurves/.
"""
from __future__ import division
import warnings
import numpy as np
import matplotlib.pyplot as plt
def precision(tp, fn, f... |
3ecb23ebc44fa48446fdf70284c59941879f4f8a8d4f9afbf65a78ae0bd6ba7b | Python | 15,842 | 307 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Read the *text* back out of a generated .docx and compare it with its Markdown source.
WHY THIS MODULE EXISTS
----------------------
`manuscript/manuscript_en.docx` is the file that actually goes to the journal, and it is
*generated* from `manuscript/manuscript_en.md` ... |
5c69e7ff15a0786c9805ec5d1b1638be6bf0ce7226d627441f1908b40e14d18e | Python | 15,848 | 427 | """C07X amendment, payload A: episode row grammar v2 + root/step identity facts.
Covers foldA s5 item 3 (i)-(vi) + foldB s4.4 items 3, 4, 5 riding the open
tlspec-v9 window (SV-6 decided GENERIC; TLSPEC_VERSION stays 9):
- episode ledger grammar v2 (family version 2): declared step-output kind +
source (``step_outp... |
aaa58dfcd548f86c0ab481674f5649a97a23bf241ab24a537e5c37c48cc8975a | Python | 15,849 | 504 | """Interfaces for Nilearn code."""
import os
import pandas as pd
from nilearn import masking
from nipype.interfaces.base import (
BaseInterfaceInputSpec,
File,
InputMultiPath,
SimpleInterface,
TraitedSpec,
traits,
)
from nipype.interfaces.nilearn import NilearnBaseInterface
from xcp_d.utils.u... |
8754c0ea7aeba7d45853c0bb7c6319543633774301c1e87576f2ff0081a3c1c1 | Python | 15,851 | 342 | '''
@saulzhang
The implementation code of the paper "Predicting Future Frames using Retrospective Cycle GAN" with Pytorch
data: Nov,12,2019
'''
import argparse
import os
import numpy as np
import math
import itertools
import datetime
import time
import torchvision.transforms as transforms
import torch.nn as nn
import t... |
aecf7db9a8e889d72f5cd644ad85448a9f392ddc1e28d2d545878829e29a4004 | Python | 15,852 | 485 | ###########################################################
# LC analyses: spot-level deconvolution using cell2location
# Lukas Weber, Apr 2022
###########################################################
# references:
# - cell2location tutorial: https://cell2location.readthedocs.io/en/latest/notebooks/cell2location_tu... |
3b8491925552280ce7d5a2deaab899e1e66415d12ac436a833f468f988c68f51 | Python | 15,853 | 381 | """Define abstraction for capturing the metadata of job's output datasets."""
import abc
import json
import os
import shutil
from logging import getLogger
from typing import (
Any,
TYPE_CHECKING,
)
import galaxy.model
from galaxy.model import store
from galaxy.model.metadata import (
FileParameter,
Me... |
a38ce496105ca987523e12e6a1cb902f01fba93f988e7efadd3d41542ab4be52 | Python | 15,854 | 532 | import sys
sys.path.insert(0, "../PINNs/Utilities/")
import tensorflow.compat.v1 as tf
tf.compat.v1.disable_eager_execution()
tf.disable_v2_behavior()
import numpy as np
import matplotlib.pyplot as plt
import scipy.io
from scipy.interpolate import griddata
import time
from itertools import product, combinations
fro... |
c842953cc7c30d0b665c23fed82489f3f8c5ceb748d9810f579bc850caf12e65 | Python | 15,854 | 420 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import logging as log
import math
import os
import matplotlib.pyplot as plt
import slowfast.utils.logging as logging
import slowfast.visualization.utils as vis_utils
import torch
from slowfast.utils.misc import get_class_na... |
1742d5cd9c4dfb8d0a0858fca03f041ea0cc6ca25dde24a01000f3e9171be5cd | Python | 15,855 | 485 | ###########################################################
# LC analyses: spot-level deconvolution using cell2location
# Lukas Weber, Apr 2022
###########################################################
# references:
# - cell2location tutorial: https://cell2location.readthedocs.io/en/latest/notebooks/cell2location_tu... |
a3e9d27cfe25ce7a05992295aa6549cdb97cd90a4052247c71343b372201fd41 | Python | 15,855 | 395 | """Storage-identity + capability-driven host-input-metadata witness (r31).
Round-30 (both labs) proved the r29 per-accessor input-metadata witness was STRUCTURALLY OPEN:
* Hole A (storage-identity attribution): ``x.data.storage_offset()`` /
``x.detach().storage_offset()`` / ``x.data.untyped_storage().nbytes()`` rea... |
829e867da98211b2e538c5f55fa3c3079fbc7db1be263a2b79d854c9062ba915 | Python | 15,862 | 419 | import svgutils_transform as svgu
import sys
sys.path.append('../libraries')
from cfg import *
hex2rgb = lambda x : tuple(int(x.lstrip('#')[i:i+2], 16) for i in (0, 2, 4))
def contrastingColors(numColors):
base = int(np.ceil(numColors**(1/3)))
if base>256:
raise RuntimeError( 'base ({}) must be 256 or below'... |
7fc3f5162436a7ec496e1f20d655d1daa9bb39148419020a39d2d953fd948607 | Python | 15,863 | 290 | import torch
import itertools
from util.image_pool import ImagePool
from .base_model import BaseModel
from data import aux_dataset
from . import networks
class UNITModel(BaseModel):
"""
This class implements the CycleGAN model, for learning image-to-image translation without paired data.
The model traini... |
604c805000d4a94420dfda48670e4bf11b42d1779f8786b578303479060af005 | Python | 15,866 | 270 | import glob
from copy import copy
import numpy as np
import argparse
from tqdm import tqdm
from tqdm.contrib.concurrent import process_map
import pickle
from mp_dip.utils.multivariate_atom_analysis import add_dipole_label
from mp_dip.utils.data_preprocessing_utils import convert_montage_channel_nr_to_raw
from mp_dip.ob... |
b24b4701cf5e3eb8f17f82e235d60b755dce9cb81ec437a0a4b0876b09a53fdd | Python | 15,866 | 406 | """Adversarial scaling gates: pathological-but-legal shapes with exact pass/fail bars.
Each gate runs a REAL capture at a size where a complexity regression is
catastrophic but current behavior is comfortable (sizes calibrated 2026-08-19,
torch 2.13, the benchmark host: wide-equivalence 300 ~0.9s, 300-pass recurrence ... |
5f82fd50f78a7a268b9e31a87c9f3200c8d5c77a3cc3e762481084421bc153df | Python | 15,867 | 449 | import numpy as np
import torch
from skimage.metrics import structural_similarity as ssim
from edamame.utils import is_notebook, config
from edamame.analysis.misc import getRNMSE
torch.set_default_tensor_type("torch.cuda.DoubleTensor")
class OL_kernel_GPU :
def __init__(self, N, M, e_bar = 1, eps = 1e-16, activat... |
1e1b732d6c068ad1feda04db3b954fc6533abb2435a9aacc122ff3a43f82b7a0 | Python | 15,880 | 346 | # Torch imports
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import TensorDataset, DataLoader
import torchvision.transforms as transforms
# Lightning imports
import pytorch_lightning as pl
from pytorch_lightning import Trainer
from pytorch_lightning.loggers import TensorBoar... |
bb7e2dd6a1697f4c261c8240e55fd1e0de84ac8fd72d4d1b0094a57cf1210e41 | Python | 15,884 | 452 | # -*- coding: utf-8 -*-
"""
# Install Package
"""
!git clone https://github.com/khtao/StainGAN.git
!git clone https://github.com/khtao/StainNet.git
!pip install dominate
!pip install visdom
"""# Import Libraries"""
import itertools
import os
import statistics
import matplotlib.pylab as plt
import numpy as np
import ... |
74c51bec596649acb894c8b05893c2beb0338d9b3cb773ab205703d3ce55f9a1 | Python | 15,885 | 456 | """Behavioral coverage for fastlog ``activation_transform`` parity.
Mirrors the slow-path raw-vs-transformed contract added in PR #166 while
documenting the intentional fastlog divergence:
* Fastlog stores transformed payloads on parallel ``ActivationRecord``
fields (``transformed_ram_payload`` / ``transformed_disk... |
5289736e48ef37f487d35af0d0f7b3cf7e9fb7768deda3defb35d2ba043f8dab | Python | 15,891 | 412 | import numpy as np
import torch
import math
from gensim.models import KeyedVectors
from omop_learn.models import transformers
def gelu(x):
return 0.5 * x * (1 + torch.tanh(math.sqrt(2 / math.pi) * (x + 0.044715 * torch.pow(x, 3))))
class VTClassifer(torch.nn.Module):
def __init__(
self, bert_model,
... |
51c4f9b2a958aa7357dd5461c1084cb6634522b4383872dffd3ee889556a736e | Python | 15,894 | 434 | import torch, torchvision
import torch.nn as nn
from torchsummary import summary
from torch.utils.data import TensorDataset, DataLoader
from tqdm import tqdm
import numpy as np
from skimage.transform import resize
import os
from typing import Tuple
from sklearn.utils import shuffle
# define parameters
EPOCHS = 60
N... |
c0cd4c8cc4aba49260a7f970b1294cede6756e716dde37f43187cd14a66aacd1 | Python | 15,902 | 512 | """Convert poly2d to mask/bitmask."""
import os
from functools import partial
from multiprocessing import Pool
from typing import Callable, Dict, List
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
from scalabel.common.parallel import NPROC
from scalabel.common.typing impor... |
275b2653f1485da20bb9d82ef11fb59090e65dff7302cb40b522a89bd94d48a9 | Python | 15,906 | 386 | #!/usr/bin/python
# coding=utf-8
# 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/LICEN... |
261f2c283996d32a06078553811712d372ae79a87fbd41d4ee07c2ae39d15934 | Python | 15,907 | 458 | # -*- coding: utf-8 -*-
"""
# Install Package
"""
!git clone https://github.com/khtao/StainGAN.git
!git clone https://github.com/khtao/StainNet.git
!pip install dominate
!pip install visdom
"""# Import Libraries"""
import itertools
import os
import statistics
import matplotlib.pylab as plt
import numpy as np
import ... |
04ac7a6ac2cd4e620bb47c0ac1cd9d61c6306cb1d154e0e18f97b274950d00a8 | Python | 15,920 | 438 | """
smoother.py — Temporal smoothing for detection decisions.
Why temporal smoothing?
-----------------------
Both the gate and a future CNN classifier operate on short windows
(~100-500 ms). A single anomalous frame can occasionally produce a false
positive: a loud cage rattle might briefly pass the gate, or a classi... |
0d3a180a579b5608316a370630d72356805bce04bde8648b592059d59127b8ca | Python | 15,921 | 482 | """
This code creates the model described in MoDL: Model-Based Deep Learning Architecture for Inverse Problems for OPT data, modifying the implementation for PyTorch in order to use Torch Radon
@author: obanmarcos
"""
import torch
import torch.nn as nn
import numpy as np
from torch_radon import Radon, RadonFanbeam
fro... |
a1060555f3939ccd9fbf5bd09de89ce8a81c151748f2bc15fdae1b906cbe1175 | Python | 15,932 | 440 | """Tests for the Parameter Database Panel UI layer.
Integration-style behavior (per-row actions, popups, Add flow) is
exercised through `build_standalone_page()` — the same entry point used by
`python -m larvaworld.portal.parameter_database` — rather than by calling
internal builders (`build_parameter_db_content`, `_b... |
cc8ec8a11116bc14159a0cb674e1ee6c274884d3dacb72bf62a8c19d2147c934 | Python | 15,940 | 389 | #!/usr/bin/env python3
"""
Diagnostic V — quick-win attempts to lift LOCO above 0.80.
Three modifications tested independently and combined:
1. Sex / age residualization within each cohort (HC-only fit, applied
to all subjects). Skips figshare which has no demographics.
2. Subject-level QC: drop subjects in t... |
1acc685cb61be9962e4127b6d6ac040bc375b0a41b6ff4c61cd72e22e9fd94d7 | Python | 15,942 | 447 | """Round-4 security regression: bundle ``metadata.pkl`` load-time unpickle RCE.
``tl.load`` historically read a bundle's ``metadata.pkl`` with an UNRESTRICTED
:class:`pickle.Unpickler`, so a crafted ``.tlspec`` whose ``metadata.pkl``
carried a ``__reduce__`` / ``os.system`` gadget executed arbitrary code at
``pickle.l... |
79862842d35e49261ae3411500894dfabf557e1b43af5f3f728d50af36b6085e | Python | 15,946 | 531 | """Containers with R-like behaviors."""
import rpy2.rlike.indexing as rli
import itertools
from typing import Any
from typing import Iterable
from typing import Iterator
from typing import List
from typing import Tuple
import warnings
class NamedItem:
"""A named item (in a NamedList."""
def __init__(self, n... |
23f0ecc689c87e4fe6bf58c2660d7f5a6c30285c5620676bd8291619bda6294a | Python | 15,955 | 398 | """
Authentication API Module
Handles user authentication, login/logout, and session management endpoints.
"""
from ethoscope_node.auth.middleware import get_current_user, require_auth
from .base import BaseAPI, error_decorator
class AuthAPI(BaseAPI):
"""API endpoints for user authentication and session manage... |
a60bfa654d580aa1191a3d2c3062e77639ef5cf2d44dbc401f32f1db6df71b4e | Python | 15,963 | 420 | """Test suite for the network functionalities, which serves as the main user interface.
"""
# imports
from rectipy.nodes import RateNet, SpikeNet, InstantNode, SpikeResetNet
from rectipy.edges import Linear, RLS
from rectipy import Network
import torch
import pytest
import numpy as np
from pyrates import clear_fronten... |
3f6b20bd1129782fcf768f00d7b01c75166d50c059a674de4651d47e71db0932 | Python | 15,969 | 461 | """Status-honesty goldens for receptive-field rule remediation."""
from __future__ import annotations
import importlib
from collections.abc import Iterator
import pytest
import torch
import torch.nn.functional as functional
from support.rf_isolation import preserved_rf_registry
from torch import nn
import torchlens... |
1ab455a761d33f3b78d232d9ecc71a247ec2f79168868b0b584464819e248a6f | Python | 15,977 | 316 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
a0c34c7a2352a84b7a9653b33a001e1cdbb7ea46cb0848afb5095022e0bd0d6e | Python | 15,978 | 463 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Workflows for parcellating imaging data."""
import os
from nipype import Function, logging
from nipype.interfaces import utility as niu
from nipype.pipeline import engine as pe
from niworkflows.engine.... |
a16d34642f17694cee444e5bc3315e1410f50ca21dbc0a9d9a55efa05158e1ec | Python | 15,980 | 376 | from inspect import signature
from math import sqrt
from typing import Optional
import torch
from torch import Tensor
from torch_geometric.data import Data
from torch_geometric.nn import MessagePassing
from torch_geometric.utils import get_num_hops, k_hop_subgraph, to_networkx
def set_masks(model: torch.nn.Module, ... |
c075cadbef319f8f1154e8a5f27b620df807fa2d12370d79b8201f0b99b2d1b0 | Python | 15,984 | 369 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
# ------------------------------------------------------------------------------
import logging
import copy
import cv2
import numpy as np
impor... |
84e18407d2543057456ee116b4fb524a21c0ab7af925ce3360598e090e8c6f6f | Python | 15,986 | 563 | """
Class managing parameter naming
"""
from __future__ import annotations
from typing import Any, Callable
import numpy as np
__all__: list[str] = [
"NamingRegistry",
# 'tex',
# 'sub',
# 'sup',
# 'subsup',
]
from .dictsNlists import AttrDict, SuperList
def join(s: str, p: str, loc: str, c: s... |
e60683698c2be53051f119ab01cf2946f5570d93e5de08c1cf04d84d10c577bb | Python | 15,992 | 335 | # Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to... |
424724fee7c40cdbbdef5226a7910a89af2c0499aca8b7f74dc6aa518ac24406 | Python | 15,997 | 419 | """Round-5 RNG seal closures (grind-r5 b8 R57).
* ``Generator.spawn()`` advanced no digested state (it mutates only
``seed_seq._n_children_spawned``), so a spawn+child-draw on a digest-rooted
model generator escaped with ``channels=[] / uncertain=False`` -- a clean
false-VERIFIED. Spawn state is now folded into ... |
44dd0f678d84288b3c76aa66d56f09baab4d2f864b6216332d749dd8e554d867 | Python | 16,001 | 462 | from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import range, zip, map, reduce, filter
from itertools import product
# import warnings
import numpy as np
import pytest
from csbdeep.data import NoNormalizer, NoResizer
from csbdeep.internals.predict import tile_overlap
... |
d1e5b66599a555772bc7619ff5dc5b70513a367a94a77ff476d0fe379daf29e0 | Python | 16,002 | 418 | """Test suite for the network functionalities, which serves as the main user interface.
"""
# imports
from rectipy.nodes import RateNet, SpikeNet, InstantNode, SpikeResetNet
from rectipy.edges import Linear, RLS
from rectipy import Network
import torch
import pytest
import numpy as np
from pyrates import clear_fronten... |
2d72b03c82a0ed5621fe1ce86da5e97210ac21abf6cb2328ea9f0b403a0933a5 | Python | 16,005 | 340 | # Copyright (c) 2025, Tri Dao.
from dataclasses import dataclass
from typing import Union, Tuple
import cutlass
import cutlass.cute as cute
from cutlass.cute.nvgpu import cpasync
from quack import layout_utils
import flash_attn.cute.utils as utils
def pack_gqa_layout(T, qhead_per_kvhead, nheads_kv, head_idx, seql... |
2ce3b6eca8ffb111e451bee01f52b5dd0d82a1ff45a4a23c95188b89cae738fb | Python | 16,008 | 500 | __author__ = "quentin"
import datetime
import http.client
import json
import logging
import os
import random
import sqlite3
import subprocess
import time
import traceback
import urllib.error
import urllib.parse
import urllib.request
# Where the node keeps its SQLite. The updater runs on the same machine as the
# nod... |
6a7f5fbe616d3d1cf9f582f0405536c8714023397ee07e1a7400ab7878253db1 | Python | 16,008 | 370 | import numpy as np
import wormneuronsegmentation as wormns
import pkg_resources
def get_curvatureBoxProperties():
boxIndices = [np.arange(1),np.arange(1,6),np.arange(6,19),np.arange(19,32),np.arange(32,45),np.arange(45,50),np.arange(50,51)]
nPlane = 7
return {'boxIndices': boxIndices, 'nPlane': nPlane... |
32cbbff75fa1e301004f53132e1973ecc5ff0d05ff9be557452c148c3ee0d7f1 | Python | 16,010 | 420 | # adapted from https://github.com/facebookresearch/detectron2/blob/master/detectron2/structures/masks.py
# pylint: disable=unused-argument
import copy
import itertools
from typing import Any, Iterator, List, Union
import numpy as np
import torch
import torchvision
from .boxes import Boxes
def polygon_area(x, y):
... |
87bbd1d99735df0dced97bdfce9289e2315ad73126f75acb5abeedea71c53655 | Python | 16,010 | 401 | """Checkpoint live-ref guard: cross-member parameter reads refuse typed (A-CKPT).
TorchLens records WHICH parameter a run used, not its bytes: a parameter read
resolves through a live handle to the model and returns TODAY'S weights, not
the weights at capture time. Two Bundle members captured from one mutated
model th... |
bcb805b3dc7117352331642777998a206045075026e563020172ae190bc0555e | Python | 16,010 | 392 | """r55 CLASS 4 immunizer -- bounded JSON/literal parse at every manifest boundary.
r54 ``free_2`` (LOW-MED): a deeply-nested ``manifest.json`` blew the C recursion
stack in stdlib ``json.load`` at load / format-detection -- an uncaught
``RecursionError`` that escaped ``tl.load(path)`` before the descriptor-parse
grace... |
ca16d2cec7b37904b1682f4087af3f5b12ae7c861c201d7f45564018630cdc84 | Python | 16,011 | 538 | """
Unit tests for model value grid modules.
Tests cover:
- Grid: Basic grid dimensions and properties
- ValueGrid: Value storage, retrieval, cell operations
- FoodGrid: Food-specific color mapping
- GaussianValueLayer: Analytical odor gradients
- ThermoScape: Temperature gradient computation
Strategy:
- Mock minimal... |
ea48b50b8fbfe6d367fe562a0084583ebcb57533b5fe5905dcf4c6b540ec9bf2 | Python | 16,021 | 460 | import numpy as np
from tqdm.auto import tqdm
from . import xpu, stats
from .xpu import cupy_wrapper, iscupy, get_array_module
cov = lambda x: x @ x.T
covm = lambda x, ax=0: cov(x - x.mean(ax, keepdims=True))
twod = lambda x: x.reshape(x.shape[0], -1)
@cupy_wrapper(['regressors', 'data'], dtype='float32')
def regre... |
fe1176ede9070e0ec4f66342c800606b1721f26f8ac21091a26a9523437e81b8 | Python | 16,021 | 440 | import os
import numpy as np
import pytest
import torch
from absl.testing import parameterized
from torch.distributed import tensor as torch_tensor
from torch.distributed.device_mesh import DeviceMesh as TorchDeviceMesh
from keras.src import backend
from keras.src import testing
from keras.src.backend.torch import di... |
3e61cbeaf94b1a73be597d402443f78adafe1cdf60aa8eb0102f03b733723208 | Python | 16,023 | 416 | """Unit tests for comparing RDMs (which is called RSA)."""
from types import GeneratorType
import numpy as np
import pytest
from mne_rsa import rsa, rsa_array, rsa_gen, searchlight
from mne_rsa.rsa import _kendall_tau_a, _partial_correlation
from numpy.testing import assert_allclose, assert_equal
def rdm():
"""... |
6fc17f2256c830cafea5e0093e63821c0db85dbfc76f81c479fac20f8f124b99 | Python | 16,023 | 366 | import glob
import os
import sys
import pandas as pd
from collections import defaultdict
import argparse
import numpy as np
import tqdm
from datetimerange import DateTimeRange
from sklearn.metrics import balanced_accuracy_score, f1_score, precision_score, recall_score, confusion_matrix
from mp_dip.obci_readmanager.... |
4ce79263451f7a56324003aedac0d8d3939e090f98615f47fd1a57ef65b4554f | Python | 16,025 | 335 | #!/usr/bin/env python3
"""
File: merge_PICALO_job_results.py
Created: 2021/11/24
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 tre... |
8b1c27f89dadb0052bb489c310c7828a3bf99b862dda7c34414291db9cca98b8 | Python | 16,025 | 298 | import numpy as np
from gym import utils
from gym.envs.mujoco import MujocoEnv
from gym.spaces import Box
DEFAULT_CAMERA_CONFIG = {
"trackbodyid": 2,
"distance": 3.0,
"lookat": np.array((0.0, 0.0, 1.15)),
"elevation": -20.0,
}
class HopperEnv(MujocoEnv, utils.EzPickle):
"""
### Description
... |
8f5722362b10aaeb5555b654a7a9ba1fa1eb389e876d1b2dd41016b9b6afa6e2 | Python | 16,032 | 428 | import torch
from torch import nn
import numpy as np
import torch.nn.functional as F
# class cross_entropy(nn.Module):
# def __init__(self):
# super().__init__()
# self.loss = torch.nn.CrossEntropyLoss(reduction='none')
# def forward(self, logs, yb_oh, mask=None):
# assert logs.shape ... |
d24f66e2620a0273cbadf8cbc8898b8b9e4e167882500c87e76161981aa0a4ed | Python | 16,032 | 343 | import geocoder
import unittest
from unittest.mock import Mock, patch, MagicMock
import numpy as np
import pandas as pd
import sys
from carbontracker import constants
from carbontracker.emissions.intensity import intensity
from carbontracker.emissions.intensity.intensity import IntensityFetch, IntensityService
clas... |
51d60b3b548419b0e7cd554fcdfd9acea738e708b6f4ecb80c52c57817ba6441 | Python | 16,033 | 426 | """
mua_spikes.py
Class for mua spike loading and analysis
from Cambridge Neurotech SiProbe recordings.
"""
import pandas as pd
import numpy as np
import pickle as pkl
from ..core.loader import (LoadMUASpikes)
from ..curation import (filter_activechannels)
from ..opto import (optostim_times)
from ..spikes import (re... |
2857efd611e1cdc1407f37173b31ec8ef3fa543a2fd72e83d8538da145e7e86d | Python | 16,041 | 467 | from functools import lru_cache
from typing import Generator
import numpy as np
from mirp._features.ngldm_matrix import MatrixNGLDM
from mirp._images.generic_image import GenericImage
from mirp._masks.base_mask import BaseMask
from mirp._features.histogram import get_discretisation_parameters
from mirp._features.text... |
bda9419a761dfe7ea1fa7d8944d6e233fb4ad0da4f18bd9c659e1e0cb647cd59 | Python | 16,042 | 430 | #!/usr/bin/env python
import datetime
import json
import logging
import time
from typing import Any
import requests
from ..utils.configuration import EthoscopeConfiguration
from ..utils.etho_db import ExperimentalDB
# A run that's still active stores end_time as integer 0 in SQLite, but legacy
# rows can carry "0" ... |
c420d94ee681403bb6ac9c0f513547cff295bae3892ea0a9256645913374e965 | Python | 16,048 | 358 | # pylint: disable=arguments-differ, unused-argument
"""Samplers for positive/negative/ignore sample selections.
This module is used to select samples during training.
Based on different strategies, we would like to choose different number of
samples as positive, negative or ignore(don't care). The purpose is to allevia... |
95c61fac223c8164e0f844639354cc05a3a86fd45ad395f56a5269f12ab9f302 | Python | 16,049 | 420 | import unittest
from spitfire import SimpleNewtonSolver
from numpy import abs, imag, any, inf, zeros, array, nan
from numpy import copy as numpy_copy
def direct_residual(fun):
def doubled(x, *args, **kwargs):
output = fun(x, *args, **kwargs)
return output, numpy_copy(output)
return doubled
... |
6a5db758dfbfc35148a7e71bedfd5ea6ac7ce6bf003fc35f03dd5c87b6310d22 | Python | 16,051 | 347 | """
File: inter_optimizer.py
Created: 2021/03/25
Last Changed: 2022/12/15
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.
"""
# Standard imp... |
ac9628092e77407f71a85957cf77763323393a4a4cd298720324ffbee46077f6 | Python | 16,055 | 534 | """Runtime container view tests."""
from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.ir.container import HFKey, NamedField, TupleIndex
from torchlens.utils.collec... |
5aba46e00185d7c907972a7168545f953378423f435242723eef984b3f640088 | Python | 16,056 | 345 | 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... |
9a761520620a4881829bd119a4be9070e016419ad6be659b229dcbe17b2fa771 | Python | 16,058 | 446 | import os
import unittest
from pathlib import Path
from textwrap import dedent
from unittest import mock
from unittest.mock import patch
from codecarbon.core.config import (
clean_env_key,
get_hierarchical_config,
get_hierarchical_config_with_sources,
normalize_gpu_ids,
parse_env_config,
parse_... |
80772a26f741ff9f92d3ad80a5c89ade54e96a558e0829b4e6462f4a14cfd1a7 | Python | 16,059 | 448 | # -*- coding: utf-8 -*-
"""
@author: ASUS
"""
import xgboost
import shap
import json
import warnings
warnings.filterwarnings("ignore")
shap.initjs()
import pandas as pd
df = pd.read_excel('mydata.xlsx')
df.sort_values(by=['id', 'year'], ascending=[True, True], inplace=True, ignore_index=True)
df_new = ... |
df730e7de8cf537af4b813dbf219cb474abebbfc48244529f48e19acf72381e5 | Python | 16,059 | 371 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""投递归档到 Zenodo,铸造 DOI,并把 DOI 回填进手稿。
为什么需要这个脚本
------------------
`src/manuscript_check.py` 有一条硬断言:手稿里不得残留 `ZENODO_RECORD_ID`
占位符。它在设计上是**跨不出去的**——因为 DOI 只能由外部服务铸造,仓库内部
无论如何都造不出一个"能解析"的标识符。此前第十八~二十轮把渠道从 Zenodo 转到
Zotero,代价是 Zotero **不铸造 DOI**;2026-09-25 复审推翻了这个交易,理由是:
一篇主张... |
f9b24b679175cf13b1348ddc01b2c100c3f1aa99f0ade03de69eee04ee451ce7 | Python | 16,062 | 516 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""
This implementation is based on
https://github.com/rwightman/pytorch-image-models/blob/master/timm/data/auto_augment.py
pulished under an Apache License 2.0.
COMMENT FROM ORIGINAL:
AutoAugment, RandAugment, and AugMix for PyTorch
This code im... |
3561ff2a4c6e1c46a2e16a9e8bd29f75071fbff167769f71b5d79a6e2866c573 | Python | 16,065 | 354 | __author__ = 'quentin'
import cv2
try:
CV_VERSION = int(cv2.__version__.split(".")[0])
except:
CV_VERSION = 2
try:
from cv2.cv import CV_CHAIN_APPROX_SIMPLE as CHAIN_APPROX_SIMPLE
from cv2.cv import CV_AA as LINE_AA
except ImportError:
from cv2 import CHAIN_APPROX_SIMPLE
from cv2 import LINE_... |
2a6bc75e2ce56ab5b2d091dca005444b1bf094aeacbfba0acebb3ecbd5400b01 | Python | 16,066 | 360 | import os
import numpy as np
import dataset.data_act as data_act
import pandas as pd
import dataset.data_weather as data_weather
import datetime
from ourmodel.loss_transfer import TransferLoss
import torch
import math
from dataset import data_process
from torch.utils.data import Dataset, DataLoader
def series_to_supe... |
60cad4f1a9178ab83ddc7a68a10e90c961a3a6e69d8f8e82cbd4540fde47ca8c | Python | 16,073 | 421 | from collections import defaultdict
from collections.abc import Iterable, Mapping, Sequence
from contextlib import suppress
import numpy as np
import pandas as pd
import scanpy as sc
import seaborn as sns
from anndata import AnnData
from matplotlib.axes import Axes
from mudata import MuData
from .utils import _get_va... |
8e863d3000bd19d0b9ca046b66acf2c654b5c7871e0859c581239342a4a94b30 | Python | 16,080 | 446 | #!/usr/bin/env python
# encoding: utf-8
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import os, sys, re
import logging
import argparse
import collections
import numpy
import time
import TGraph
import TNode
import Node_path
import Node_alignment
from Gra... |
32ede6ac72f2cb8184f605838674a6d7d8341286873dd4851d2dc10d0828d948 | Python | 16,087 | 458 | import numpy as np
import pytest
from absl.testing import parameterized
from keras.src import backend
from keras.src import layers
from keras.src import models
from keras.src import testing
from keras.src.backend.common import get_keras_mask
from keras.src.backend.common import standardize_shape
def np_dot(a, b, axe... |
284049f1cbb023e03afe74f5ab952fdd98a246bd1ee2599ab520da8e01738726 | Python | 16,089 | 430 |
import sys, os
import time
import torch
import json, pickle
import numpy as np
import pandas as pd
from math import sqrt
import networkx as nx
from collections import OrderedDict
from rdkit import Chem
from scipy import stats
from rdkit.Chem import MolFromSmiles
from torch_geometric import data as DATA
from torch.util... |
4ec9580e40fbacc4d3a3921bb49bea186c7440cf621cd0eebe1e44d635d0eb7f | Python | 16,103 | 358 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from typing import Any
import numpy as np
from ..utils.ops import xyxy2ltwh
from .basetrack import TrackState
from .byte_tracker import BYTETracker, STrack
from .utils import matching
from .utils.stracks import pa... |
6bc96a72c6d4c129d07086b9ab980cf01335440aba227b52a081367b20278d83 | Python | 16,107 | 473 | from __future__ import annotations
import argparse
import contextlib
import importlib.metadata
import io
import multiprocessing
import os
import platform
import sys
import traceback
import types
import warnings
from pathlib import Path
from typing import AnyStr
from typing import Final
from loguru import logger
from ... |
1c9b4e1ebffcd735117f45543cdf2e2bd135b5c11f17038371304447f41242c4 | Python | 16,109 | 545 | """Proxy/PromiseProxy implementation.
This module contains critical utilities that needs to be loaded as
soon as possible, and that shall not load any third party modules.
Parts of this module is Copyright by Werkzeug Team.
"""
import operator
import sys
import types
from functools import reduce
from importlib impor... |
2b9325fc7255f83f554e2fb27e97c99a29feee08bad29611bb4351381a489d13 | Python | 16,113 | 448 | """Forward validation fails a capture whose graph is missing a tensor argument's origin.
Replay re-executes each op on its saved arguments, so a tensor argument with no
recorded graph/source provenance (a closure or module-global tensor, a module-held
tensor the held-tensor scan cut off, an opaque module output adopte... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.