sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
53d768ac862ee145dfd1336ce2e344de5287463dc7cd140414bb979c50938a94
Python
5,253
129
"""Test-naming vestigial governance (r7 R80): round tokens stop growing. 402 test functions carry a round/sprint token (``_rNN``, ``_pN``, ``_certN``, ``_fwN``, ...) and 10 test-file stems collide once the token is stripped — a PURPOSE-named file coexisting with a ROUND-named file of the same purpose, so a contributor...
6018d8b1ac39af81eb77dbec9de2e14b30e167d19d81d09b2ae55a144c7371f1
Python
5,253
136
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ An ``AuxReader`` for MDAnalysis capable of reading PLUMED-generated files. """ # =============================...
0c7e1de1aa1fe09bbabcf4109cbcfb22500dd46cb197b6822d09c86bcf9266f6
Python
5,254
130
from typing import Optional from galaxy import exceptions from galaxy.util import bunch from .structure import ( get_collection, get_structure, leaf, ) CANNOT_MATCH_ERROR_MESSAGE = "Cannot match collection types." class CollectionsToMatch: """Structure representing a set of collections that need to ...
6c2a3ff8aaba3a44b99e37f790e61bdfb7a2431b2ff7d3eba1d3a7536aa4a5d5
Python
5,254
159
import pytest import numpy as np from BM3D.src.step1 import * from BM3D.src.support_function import compute_distance_of_two_blocks def test_step1_basic_estimation(): # Create a test image noisy_img = np.random.rand(10, 10) # Set the parameters for the function param = (2, 1, 1, 3, 1, 1, 1, 1, "cos")...
3d37deee3e93a294c8895fbdd9b28f09849b2b2bb8be5b6c9e50e0b38831dfe6
Python
5,255
134
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from ultralytics.utils import LOGGER, TESTS_RUNNING, colorstr, torch_utils from ultralytics.utils.torch_utils import smart_inference_mode try: assert not TESTS_RUNNING # do not log pytest WRITER = None # TensorBoard SummaryWriter instance ...
bdc210ed3da6e294cec604a161c180ad0abf7df407e8cd91f17c8cce4111dcb2
Python
5,255
127
import os import torch import pandas as pd import scanpy as sc from sklearn import metrics import multiprocessing as mp from sklearn.metrics.cluster import adjusted_rand_score from sklearn.metrics.cluster import ( v_measure_score, homogeneity_score, completeness_score) import glob2 import matplotlib.pyplot as plt i...
7fbdf19e76793ec84bd86f7f0a67acb686d42363efe929649a004b091e54563d
Python
5,256
177
"""Gevent execution pool.""" import functools import types from time import monotonic from kombu.asynchronous import timer as _timer from . import base try: from gevent import Timeout except ImportError: Timeout = None __all__ = ('TaskPool',) # pylint: disable=redefined-outer-name # We cache globals and at...
8f543743492289d148831ddd969ae0b9d62b1d7e1aef0ffb894132a910549fe9
Python
5,256
83
"""General-purpose training script for image-to-image translation. This script works for various models (with option '--model': e.g., pix2pix, cyclegan, colorization) and different datasets (with option '--dataset_mode': e.g., aligned, unaligned, single, colorization). You need to specify the dataset ('--dataroot'), e...
02960eef941c2a95a771abaab50a65c1cbbae1e5b1611b074d120ec0b2f69866
Python
5,257
158
# Very simple functions to extract useful data from Leica Microscope # XML files import os import glob import re def get_prop(node, prop): return node.xpathEval('@%s'%prop)[0].content def get_xmljob(name, patt = "*[0-9].xml"): if name[-4:] == '.xml': return name folder,filepattern = os.path.sp...
4be7071dc099808bccf7797f34d6aa5130e9f5f8bf29f75ab9b9ad5a7725a7e7
Python
5,257
168
import numpy as np from numpy.testing import assert_array_equal import pytest from pytest import approx from sklearn.pipeline import make_pipeline from sklearn.svm import SVC from pyriemann.classification import MDM from pyriemann.tangentspace import TangentSpace, FGDA pytestmark = pytest.mark.numpy_only metrics ...
ad148b31909bb3b4259d5933c66e70057f63f6dfef3bf922cd2790e2bb8e32dc
Python
5,257
109
import sys from collections import defaultdict import csv import utils def CompileData(filename, interval): uncleaneddata = utils.ReadDataFromFile(filename) cleaneddata = utils.Clean(uncleaneddata, interval) datawithvel = utils.CalculateVelocity(cleaneddata) completedata = utils.CalculateAcceleration(...
68e30d7bc12b89563cdf60a8586927c238cf07e5083f3269ea8f27665a9ba36b
Python
5,259
164
"""Regression tests for r19a attribution honesty/robustness fixes. Covers: - W2A3-05: attribution restores exact per-module train/eval state (not the root flag). - W2A3-06: attribution computes correctly under an ambient ``torch.no_grad()``. Owner-reserved wrong-math findings (W2A3-01/02/03/13/17) are NOT fixed here;...
832e92e42e46e7470c92ad8b2ccdd98ab15ecebf077860358800bdfadce578d9
Python
5,259
116
""" process_recording plugin - analysis algorithms The module can be imported independently of the base UI system. Post-processing of electrophysiology recording, including baseline correction, filtering, and trace-averaging SimplyFire - Customizable analysis of electrophysiology data Copyright (C) 2022 Megumi ...
65d4dac4ec461f743ec118f7089514b170567162d0c4c33a96d5518a76e9edec
Python
5,260
147
"""Composition-tree conftest: census prewarm + product/model galleries (row 0.6). Fixture economics are measured law (compo memo D12): a save+load hop is ~4.7x a capture, so cells CONSUME the session gallery and may not construct products -- read-only cells share, mutating cells fork (~75 ms even on a 567-op trace), p...
9d53edc0a07d0625f4b14f57b3a36851c65a96f44bbc592076190d416661193d
Python
5,260
169
# --- 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 Box(_BaseTraceHierarchyType): _parent_path_str = "violin" _path_str = "vi...
1699dd7f040e88c1b0c6da5adfef97771ccfbef29033c8b9696cd151499c3d51
Python
5,261
134
import os, json import numpy as np from tqdm.notebook import tqdm from PIL import Image, ImageDraw from cv2 import findContours, RETR_TREE,CHAIN_APPROX_SIMPLE from sklearn.metrics import jaccard_score import torch from torch.utils.data import Dataset from torchvision.transforms import ToPILImage class leafDataset(Da...
5bc7a31acd2d5838b2acbbe83ce1cef3ade503db0e22943705804416290e712f
Python
5,261
163
# -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals, absolute_import, division from six.moves import range, zip, map, reduce, filter from six import string_types import numpy as np try: from tifffile import imwrite as imsave except ImportError: from tifffile import imsave import war...
a7a086e9bb8c781b559dd6f723979748dad2afa5fcd98ef3bc766b014d3784ce
Python
5,261
158
"""Stimuli classes""" """ Copyright (c) 2022 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHA...
87abddbfa3677868d84d5b2bfd7817d20b7a6fec4825674d8f7b358a1fc054b0
Python
5,262
162
#!/usr/bin/env python """Run simple cell optimization""" """ Copyright (c) 2022 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PUR...
6a22fdc9ee356a256d45228d627485f798184d0316a37bcd850ea492bcb2bb84
Python
5,263
44
etas = { 'generic20_learning': { 'alpha_ATLAS_LUMI_2012': { 'muT__hat': 1.49401930723, 'muT__muT__down': 0.0338444171345, 'muT__muT__up': 0.0309159829066, 'muT__muW__down': -0.00153824251909, 'muT__muW__up': 0.00148147282231, 'muT__phi__down': 0.00734038944363, 'muT__phi__up': 0.00543738632322, 'muW__hat': 0.7620640...
99a76ec70d75679fea9318a7cac9fbf1118bfb57ba80a8b85f3e07d7fad80fd2
Python
5,264
150
import torch from torch.cuda.amp import GradScaler from torch.nn.utils import clip_grad_norm_ from torchmetrics import Accuracy, MeanMetric, Recall, Specificity, AUROC, ROC, ConfusionMatrix from torchmetrics.functional import accuracy from tqdm import tqdm class Fit: def __init__(self, amp, device): self....
363ca20b95d8b4e08a65e5521f671e57c5378b8ed03b2942f55248c07380bba2
Python
5,266
159
"""Image Dataset""" # Copyright (c) 2020. Lightly AG and its affiliates. # All Rights Reserved import os from typing import Any, Callable, List, Optional, Set, Tuple, Union import torch import torchvision.datasets as datasets from typing_extensions import Protocol from lightly.data._image_loaders import default_loa...
ab7b3b85bb4cc4211befef7aa6eb7e15dd841095adc96036e2eb758dad8ebcf5
Python
5,266
158
################################################################################################################################################################# ####################### Testing MultiRBP #####################################################################################################################...
bd79579f9b72dcdf0b474c73f181cb120b8a29193a5c4a0342567b7fefa45255
Python
5,266
154
import numpy as np from . import smoothing from . import utils from . import extract_signals @utils.copy_td def add_firing_rates(trial_data, method, std=None, hw=None, win=None, backend='convolve1d'): """ Add firing rate fields calculated from spikes fields Parameters ---------- trial_data : pd.D...
c4be47b7ee8d60dee2f26f2c5db97f201d3ad7a3514e10973c40601a21bba837
Python
5,266
149
import os import json from collections import OrderedDict import glob # # python3 gather_if_info.py /home/hjorth/HBP/BasalGangliaData/data/neurons/striatum/dspn /home/hjorth/HBP/bgmod/models/optim/HBP-2021Q4 # # python3 gather_if_info.py /home/hjorth/HBP/BasalGangliaData/data/neurons/striatum/ispn /home/hjorth/HBP/bgm...
007e43bc8df1e5793d9615987eb71f80cfb4a4d90267b9c83ac81364530a2682
Python
5,267
140
"""Round-11 F6 regression: parameterized ``if/else`` models must save runnable. A conditional arm records a private ``_trace`` back-reference to its owning ``Trace``. ``ConditionalAccessor`` has no portable-state spec, so the bundle scrub returns it verbatim and the arm's back-reference still points at the LIVE trace ...
709f69bebdf8c49555c8ec3738f0397b89d2abf1112ee6f3844d124e81069108
Python
5,267
114
""" Workflow report agent for generating markdown reports from Galaxy workflows. """ import logging from pathlib import Path from typing import Any from galaxy.model import Workflow from .base import ( AgentResponse, SimpleGalaxyAgent, ) log = logging.getLogger(__name__) class WorkflowReportAgent(SimpleGal...
8c3056b42f0ef7c2d9eb2e1a7dee1dc6e308ed76fedc6740b9c6b37d4793f9ec
Python
5,270
205
# 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...
1da7fc52009546f2d5937ab7842cd62d4a10611b28ec69e6b7ba41c86ce7e606
Python
5,271
135
import torch.nn as nn from torch.nn import functional as F import torch class CNN_Block(nn.Module): def __init__(self, input_channels, num_channels, kernel_size, pooling_size): super().__init__() self.conv1d = nn.Conv1d(input_channels, num_channels, kernel_size=kernel_size) self.pooling = n...
a65f92232f387dfcbb9cb2fcf3dcd03a1185a7954b1c9837f91b03b264f5862b
Python
5,271
154
#!/usr/bin/env python """ Cluster a set of molecules based on their 3D overlays as determined by the SuCOS score. This will generate a set of SD files, one for each cluster of molecules (presumably corresponding to a binding pocket in the protein target). SuCOS is the work of Susan Leung. GitHub: https://github.com/...
b6ec1b783c890aa9a4ec88c8f2e1b58c26c92a099795a135aaf8822b31cca602
Python
5,271
188
"""Round-22 runnable attestation and non-finite literal regressions.""" from __future__ import annotations import dataclasses import math import struct from pathlib import Path import pytest import torch from torch import nn import torchlens as tl from torchlens._io.runnable import _encode_literal from torchlens._r...
1d986abc463238dee6ee2d2420ae985daa459136c1b0b3b668ee6fb6e116341b
Python
5,272
152
# 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...
ed1d0c3d873dc36578352c744f5c57c0374b57198e62eb108276a41dcc3809fd
Python
5,272
96
import sys sys.path.insert(1, '../') import numpy as np import pandas as pd import os import shutil dataset_dict_paths = { 'ABCD': "/media/sda/Anna/TM2_segmentation/data/t1_mris/registered/z/", 'ABIDE': "/media/sda/Anna/TM2_segmentation/data/t1_mris/abide_ench_reg/z/", 'AOMIC':"/media/sda/Anna/TM2_segment...
dec288b60b70be58de3616e8c556e9a2e1aab574c1d230657bbf074d11f91de3
Python
5,273
145
import unittest import torch import torch.nn as nn from bdpy.dl.torch import models def _removeprefix(text: str, prefix: str) -> str: """Remove prefix from text. (Workaround for Python 3.8)""" if text.startswith(prefix): return text[len(prefix):] return text class MockModule(nn.Module): de...
3acb8fcce7b1f3075b7ef05544f383d086b2ea67848033edd0d90513d22d0026
Python
5,276
150
"""Focused coverage for glossary-conformance phase B2c structural fields.""" import re from pathlib import Path import torch from torch import nn import torchlens as tl import torchlens.receptive_field as receptive_field from torchlens.options import CaptureOptions class _B2cModel(nn.Module): """Model docstrin...
cedc27d1c35ffe3293a267f4d39c510a4e560511b2a57e18fab90af8d1235977
Python
5,276
153
from abc import ABC, abstractmethod import os import numpy as np class AdditionalData(ABC): """ Handles additional data to be loaded. Can be called with arguments - path: path to the dataset - i: index of the chunk - j: index of the sequence in the chunk - cl_max: context length of the u...
da697f1176a8f066cebb94a17d0c6c7666867efac81d5a1ff83e64d5fe0a8a9d
Python
5,278
144
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from role_prediction.graphormer.collator import collator from role_prediction.graphormer.wrapper import MyRolePredictionDataset from pytorch_lightning import LightningDataModule import torch from torch.nn import functional as F from torch.utils.d...
19b0936ac877d8fc00096df251418c085a37adcf27781158863c6e5d125e3a3a
Python
5,280
133
"""``set()``-door and target-spec record lowering (W051-REPLAY out-of-fence 1-2). Lane W051-REPLAY lowered ``Op``/``Layer`` records at HOOK-PLAN normalization, so ``do(record, helper)`` worked, but the ``set()`` door (``do(record, tensor)``), ``resolve_sites(record)`` and the mutator-site validation still refused a re...
8261126b3031596db93d0822fa5b6adc6a3a9957a953e7e07131b2f488da2c65
Python
5,282
135
""" BASIL GUI for Oxford ASL - Preview of the structure of the data set Copyright (C) 2020 University of Oxford """ import wx class DataStructurePreview(wx.Panel): """ Visual preview of the structure of an ASL data set """ def __init__(self, parent, ntis, repeats, ntc, order, tagfirst): wx.Pa...
d606fb8eecf7867e49f02fc4d0fa3de16cc8a693fa953c3278bb2a0825654c58
Python
5,284
156
#!/usr/bin/env python3 """ File: vcf_to_dosage.py Created: 2024/01/19 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. """ # S...
583485a369a106d1b0f1f0c7a0bf7375a3aca9821f8c4847488c8b2e9472e953
Python
5,286
144
#!/usr/bin/env python """ Input: set of molecules with pre-calculated physico-chemical properties Output: set of molecules that pass all the filters Copyright 2012, Bjoern Gruening and Xavier Lucas TODO: AND/OR conditions? """ import argparse import json import shlex import subprocess import sys impor...
64b54ffb3c04f6f54e793234bda80c315d1ad2048ffeaafa7d591a750d46b137
Python
5,286
162
import sys sys.path.append("../src") import numpy as np import pandas as pd import pre_process from Bio.Seq import Seq import opt_analysis import entropy_opt import seaborn as sns import data_prep import matplotlib.pylab as plt import numpy as np from mpl_toolkits.axes_grid1 import make_axes_locatable from matplotlib i...
ad42aa716259f72a563cc9695bcd4c19834588f64a2b51dc4028e75377951ab5
Python
5,286
141
from __future__ import annotations import math from typing import Optional, Sequence import torch import torch.nn.functional as F def zero_like_reference(reference: torch.Tensor) -> torch.Tensor: return reference.new_tensor(0.0) def reconstruction_loss(prediction, target: torch.Tensor, mode: str = "mse", mask...
2a25cd10a1dd44a6b6e0f3a1769bf574fe9eb00f90ffbd7d1c9eb5a92a09b9a3
Python
5,287
182
"""Convert BDD100K bitmasks to COCO panoptic segmentation format.""" import argparse import json import os from multiprocessing import Pool from typing import Dict, List import numpy as np from PIL import Image from scalabel.common.parallel import NPROC from scalabel.common.typing import NDArrayI32, NDArrayU8 from sc...
4bbdee3049d176317913156c70363ff091cb38e2481c836d0921f3e80aa327a6
Python
5,288
144
"""Replacement-object identity honesty (round-3 T-RUNNABLE fix lane). One live tensor object injected at two or more matched sites lets the LAST fire steal the site label: every downstream consumer records the last site as parent, the earlier site's children vanish (byte-identical payloads make the misattributed graph...
5dce851b289b45c1a2ac38885518c0c753d2cf17a3ebd7c454e7b234b4786281
Python
5,290
159
from sklearn.metrics import pairwise_distances from typing import Optional, Union from anndata import AnnData import numpy as np from ..._compat import Literal from tqdm import tqdm _PLATFORM = Literal["Visium", "Old_ST"] _WEIGHTING_MATRIX = Literal[ "weights_matrix_all", "weights_matrix_pd_gd", "weights_m...
9710f9ef05443658d1b63d1aaf1fc798676a36415e3d61a707a1375463c36f6e
Python
5,290
153
"""Tests for the agent-facing machine-readable dump ``Trace.to_agent_json``.""" from __future__ import annotations import json import pytest import torch from torch import nn import torchlens as tl class TinyRecurrentModel(nn.Module): """Model that reuses one module twice to exercise pass-qualified labels."""...
9bf5dd0f95e0d755473f4c41de4ccffdb40af81779d43e5d41aca5fb32becc49
Python
5,290
129
"""A-GATE real-model leg: two real Qwen2.5-0.5B-Instruct turns (foldB s5 row 5). Toy-only validation is disqualifying for chain territory: two successive turns of one real chat model are exactly the Path-1 shape (one live model object, different inputs, ``same_object`` relationship), and the topology refusal is the ex...
3ca568d794191dcbc1ea10ee5c7c83dcc8f9df270f1992786b119d309bdefb11
Python
5,291
148
"""Microbench: flat-buffer ragged reverse-complement vs gvl's awkward idiom. Run: uv run --with attrs python scratch_bench_rc.py Reproduces the exact awkward path gvl uses today in ``_dataset/_query.py:reverse_complement_ragged`` -> ``_ragged.py:reverse_complement``: Ragged(ak.to_packed(ak.where(to_rc, rc_awkwa...
42d1993bb86ac37b69433ab0fce0b1f37f415f63248762d91b0d39312c96a458
Python
5,291
120
# 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...
adb83ca4ce9741076efa870e0fb8edcceda22bdffc9fe6126b2677801db9cc71
Python
5,291
150
import copy import numpy as np import pandas as pd from mirp._features.texture_matrix import DirectionalMatrix class MatrixCM(DirectionalMatrix): def __init__(self, distance: int, **kwargs): super().__init__(**kwargs) # Set distance self.distance = int(distance) # Placeholders...
fcd980b46cbf6d8002c6d9e17bba57ff626620dd3c37a37ace7a9027b7cc5d6e
Python
5,291
162
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Stripped out routines for Sentry.""" import os import re import sentry_sdk from niworkflows.utils.misc import read_crashfile from xcp_d import config CHUNK_SIZE = 16384 # Group common events with pre...
2e7234412f6e9ce8718e22db04340df53b16f1f02811d6e4052f6ec4f9c25801
Python
5,292
149
from __future__ import annotations import logging import threading import time from collections.abc import Generator from itertools import chain from typing import Callable, Optional import numpy as np from bream4.device_interfaces.devices.base_device import BaseDeviceInterface from grpc import RpcError from minknow_...
77c7a1d46c1a51d97b1617193758d02a03acf64f926891b8bc8fda6b865cbaf1
Python
5,293
174
"""GraphSAINT: subgraph-sampling GCN training architecture. Paper: "GraphSAINT: Graph Sampling Based Inductive Learning Method", Zeng et al., ICLR 2020. This compact classic fixes one pre-sampled induced subgraph and applies the paper's core idea: run a complete GCN on the sampled subgraph with explicit edge and node...
dbdf892628a27568943d9e050b2907a3f52d3626fa87d4a1032cc869c568fe37
Python
5,293
113
""" This module define MetricsManager """ from metrics.metrics_factory import MetricsFactory from converter.converters_factory import ConvertersFactory from utils.utils import move_tensor_to_device class MetricsManager: """ This class manage which metric is for each task and save the values durring training ...
57abd5d1b215f42499991e7c4cea0f49a683cb424b1ae245f8fa80057b72af38
Python
5,294
153
import math from typing import Literal import numpy as np from anndata import AnnData from sklearn.linear_model import LinearRegression # type: ignore from sklearn.metrics import pairwise_distances from tqdm import tqdm _PLATFORM = Literal["Visium", "Old_ST"] _WEIGHTING_MATRIX = Literal[ "weights_matrix_all", ...
b2e753ebb0ff0433219e0114945adfa6f0f9f0ae12118abf67766e12814c4842
Python
5,295
172
"""Pool Autoscaling. This module implements the internal thread responsible for growing and shrinking the pool according to the current autoscale settings. The autoscale thread is only enabled if the :option:`celery worker --autoscale` option is used. """ import os import threading from time import monotonic, sleep ...
e3035628d153f376aced55cf88f9937126058d7743e2dd4c0061f2f28bce86a6
Python
5,295
115
import json import geopandas as gpd import pandas as pd import pytest from shapely.geometry import box from pyrosm import cli, get_data def test_find_lists_the_extracts_of_an_area(tmp_path, monkeypatch, capsys): """``pyrosm find`` takes a bounding box (also one that starts with a minus sign), a vector file ...
f7b64d6271fad88bb5204ddeafa31836524bb9e8c7ebf00fbdc57683e8f4edfe
Python
5,295
110
"""8. Extracting video features from pre-trained models ======================================================= Feature extraction is a very useful tool when you don't have large annotated dataset or don't have the computing resources to train a model from scratch for your use case. It's also useful to visualize what ...
fe5fe8bac156a99e5d8021a10c8a931438a69aec28afaacf5442f866d9f23ecc
Python
5,296
136
"""Autoroute kwarg-forwarding pins: no public trace option silently vanishes. The autoroute detector branch of :func:`torchlens.trace` forwards the public keyword bundle into detectors (which re-enter ``tl.trace`` through bridge helpers such as ``bridge.hf.trace_text``). Any ``trace()`` parameter missing from that bun...
6d3576505eb597ea4800df1235811a8223e60322507ba6f669a7f8142d58ca20
Python
5,297
175
from __future__ import annotations from abc import ABC, abstractmethod from typing import Iterable import torch import torch.nn as nn from bdpy.dl.torch import FeatureExtractor from bdpy.dl.torch.domain import Domain, InternalDomain class BaseEncoder(ABC): """Encoder network module.""" @abstractmethod ...
8c03d8aeff3511d53ba30496d18b72f11fd3301adb782144f7446c0f7fa16895
Python
5,297
160
import os import posixpath import platform import re import shutil import sys from distutils import sysconfig import setuptools from setuptools.command import build_ext HERE = os.path.dirname(os.path.abspath(__file__)) IS_WINDOWS = sys.platform.startswith("win") with open("README.md", "r", encoding="utf-8") as f...
9e49270e62bfedda44417d606c9476019347cfd13a4abbddef05c79dda4bea3f
Python
5,297
139
"""Fork copy-on-write / structural-sharing invariants. ``Trace._fork_trace`` builds the fork as ONE structural copy of the parent graph under a single shared ``copy.deepcopy`` memo instead of one independent copy per field. These tests pin the two properties that make that safe: 1. ISOLATION -- no fork-owned object m...
06e50782905fff86a0850ede0804a77d589a1fd203bfd577ba7042984d786df9
Python
5,298
44
etas = { 'generic20_learning': { 'alpha_ATLAS_LUMI_2012': { 'muT__hat': 0.816226673571, 'muT__muT__down': 0.0407591584793, 'muT__muT__up': 0.0368081554649, 'muT__muW__down': -0.000479700448688, 'muT__muW__up': 0.00109448525299, 'muT__phi__down': -0.00363077690366, 'muT__phi__up': -0.00236353831815, 'muW__hat': 1.586...
018ae80e11647ac09839c174703e5b1c729675e62eb0b560b30cd972b3adc8e5
Python
5,300
164
import os import sys import traceback from typing import Dict, Tuple from pathlib import Path import pickle import numpy as np from numba.core.errors import NumbaDeprecationWarning from numba.core.errors import NumbaPendingDeprecationWarning import warnings warnings.simplefilter('ignore', category=NumbaDeprecationWa...
79ded869d58d2dabe52a97bec59da923af4081c6c8445f0353380a98a69119ff
Python
5,300
110
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import cv2 import numpy as np import torch from PIL import Image from ultralytics.data.augment import classify_transforms from ultralytics.engine.predictor import BasePredictor from ultralytics.engine.results impor...
7c71ac83d979e5a2bf613253ad2c5a1fc73217dab21e9e96541489d58f414774
Python
5,300
152
"""Tests for xcp_d.interfaces.utils module.""" import json import os import nibabel as nb import numpy as np import pandas as pd from xcp_d.interfaces.utils import LINCQC, ConvertTo32 def test_conversion_to_32bit_nifti(ds001419_data, tmp_path_factory): """Convert nifti files to 32-bit.""" tmpdir = tmp_path...
df11f730756f58bc4413cf98389fd1de9328ea642ae7f2afa1a22b4e9178d7cf
Python
5,300
142
"""F03 item 7b: the head-ablation sugar + THE SAME-FILE ORACLE (heavy tier). The sugar's v-facet lowering is checked candidate-by-candidate against a hand-written torch forward_pre_hook zeroing head i's slice of the c_proj input (no TorchLens in the oracle path) on a config-built GPT-2 running through the REAL HF ``fr...
e6dcda8b1c6e0fd6b27acff32f9a8d5b29f8a62d1c22bf723490fe95a0bff789
Python
5,301
128
import time from jinja2 import meta, TemplateError import pytest import promptsource.templates from promptsource.utils import get_dataset_builder from uuid import UUID # Sets up Jinja environment env = promptsource.templates.env # Loads templates and iterates over each data (sub)set template_collection = promptsource...
86c4d8136105a740e7ea1f357ab6c119b668f58a681c0d8e1d4bba9861608f1c
Python
5,302
139
"""In-place functionals (``inplace=True``) are captured as mutating calls.""" from __future__ import annotations from collections.abc import Callable from pathlib import Path from typing import Any import pytest import torch import torch.nn.functional as F from torch import nn import torchlens as tl from torchlens....
ec2a30e8ec12ebdc4d41957f76b979db70d60e1e579d13f27cc14ef2a03043d6
Python
5,302
99
#!/usr/bin/env python # -*- coding: utf-8 -*- """ cohort_labels.py — 队列/对照的**图用英文标签**单点映射 ------------------------------------------------------------------ 为什么需要这个模块:`out/external_paired_delta.csv` 的 `contrast` 列是**中文** (内部分析稿的语言),而图要排进英文稿件。matplotlib 默认字体 DejaVu Sans **没有汉字字形**,于是中文会渲染成一串"豆腐块"(tofu,▯)—— out/fig7...
3478af4755f56fd30f8c20af35b25901824f96d1c182234524c31635bcaad3ef
Python
5,303
135
"""Utils for auto classification estimator""" # pylint: disable=bad-whitespace,missing-function-docstring import os import math import mxnet as mx from mxnet import nd from mxnet import gluon from mxnet.gluon.data.vision import transforms from ....data import imagenet def rec_batch_fn(batch, ctx): data = gluon.ut...
52263192ffe23476f16c1306f1ab52d17593f02273334cf720f1c1bf50408365
Python
5,303
119
#! /usr/bin/env python3 # -*- coding: utf-8 -*- ''' Implementation of a socket server wrapped in a ROS publisher. In this base version, the ROS node publishes the data as a string message without any processing. For more complex behaviors, create a child class, and modify the callback. ''' import math #import copy impo...
ea9118fd9d185cecfdd214f0ab069f45563a18715a663d9a48c75f3741b0e4e6
Python
5,303
157
import torch.nn as nn import torch.utils.model_zoo as model_zoo from .custom_modules import FakeReLUM from .layers import conv2d_same, pool2d_same __all__ = ['kell2018'] class AuditoryCNN(nn.Module): def __init__(self, num_classes=1000): super(AuditoryCNN, self).__init__() # Include initial batc...
924dd3ca3dea0d71221eb1b013eceb1dce2006de630c00efca3d194c168d8eda
Python
5,304
139
import logging import os from pathlib import Path import random import shutil import pandas as pd from Bio import SeqIO from review_comparison.utils import generate_fasta_file class DeleteToSimilarSeq: def __init__( self, name_train_dataset, name_diff_dataset, min_seq_identity, ...
b03e130dc51ad6cb8a08a819364108d706b1df70e7b70d942c9203f7cef38f05
Python
5,304
178
"""Define parameter converters.""" from copy import deepcopy from specparam.params.converter import AperiodicParamConverter, PeriodicParamConverter from specparam.params.periodic import compute_peak_height ################################################################################################### ## DEFINE D...
f189958f3820d8ac8d0577227a94754e7c3410cba56ab00972172a38afbb25b5
Python
5,304
175
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/stable/config # -- Path setup ------------------------------------------------------------...
3d4b6472fdb3d64d04464de3d5327778bcc76a9c7390b062069af3e73e316368
Python
5,305
129
try: import unittest from copy import copy from os.path import abspath, join from numpy.testing import assert_allclose import numpy as np try: from scipy.integrate import simpson except ImportError: from scipy.integrate import simps as simpson from spitfire.chemistry.me...
8d4a3100fdde0cc988a639bc55c7d4b181a3acfd742dfcff1f91533c8aae65ef
Python
5,305
175
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Test objects and function in the module ``tfep.utils.cli.tool``. """ # =======================================...
d8cd42ea2fc096509c9b5d6e87d108013cba8b6eae762a1beb3d960356e242c7
Python
5,305
158
from __future__ import annotations from numbers import Number from pathlib import Path import pytest from larvaworld.lib import reg, util from larvaworld.lib.reg.generators import EnvConf from larvaworld.portal.canvas_widgets.environment_mapping import ( env_params_to_canvas_state, ) from larvaworld.portal.simul...
1ccdd57437ed2c7bcefb843393574e8a1cb5f2e76475a27ab0389417ecb7a182
Python
5,306
188
from abc import ABC, abstractmethod import collections from functools import lru_cache import json import os import pickle import numpy as np from modular_splicing.dataset.data_rewriter import DataRewriter from modular_splicing.dataset.h5_dataset import H5Dataset from modular_splicing.utils.construct import construct...
cc2241ff2c55347faf55b9f2acb737b23318cd28f466544cb26f74b944739032
Python
5,306
163
"""A generic memory recall task.""" from collections import OrderedDict import numpy as np from neurogym.core import TrialEnv from neurogym.utils import spaces from neurogym.utils.logging import logger class MemoryRecall(TrialEnv): """Memory Recall. Args: stim_dim: int, stimulus dimension ...
080d005c2e4e05f3c97b58a4cf9c2fe4bdb514bf077021f4a19743dd13b8dfd1
Python
5,307
131
#!/usr/bin/env python3 # -*- coding: utf-8 -*- '''Find closest positive pixel in segmentation given refined particle coordinates Search for segmentation (MRC format) in specified directory for each tomogram in STAR file. Find closest positive pixel in segmentation for each refined particle coordinate Output CSV tabul...
d79530fcb5115bdb2ce0ab3cbef882c7d55fac9245c3320726bfdc8e821b3cb2
Python
5,307
122
########################################################################### # Created by: Hang Zhang # Email: zhang.hang@rutgers.edu # Copyright (c) 2017 ########################################################################### """Cityscapes Dataloader""" import os import numpy as np from PIL import Image import mx...
802a7dfaa078d7bbeda3385a279ba4a3659b24673ed547310b27379c59b16661
Python
5,308
129
"""This file contains all the tigramite functionality""" # License: GNU General Public License v3.0 import numpy as np from matplotlib import pyplot as plt from tigramite import data_processing as pp from tigramite import plotting as tp from tigramite.independence_tests.parcorr import ParCorr from tigramite.independenc...
a6c003e8c563cf8aee4acd8d6dbdb4d33526f65c114c8eb517545ef316f56dd5
Python
5,310
150
import logging import re from galaxy.datatypes.data import ( get_file_peek, Text, ) from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datatypes.sniff import ( build_sniff_from_prefix, FilePrefix, get_headers, ) from galaxy.datat...
f0989e9c6c1a7ab1d1555bf95dc9105bce6bd6ec7b5a044375412ab17836a903
Python
5,311
148
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Aug 29 14:04:11 2023 @author: fcheng """ import os import numpy as np import matplotlib.pyplot as plt import seaborn as sns import pandas as pd from plot.makeDataFrame4plot import makeDataFrame_diff_orientation,makeDataFrame_diff_orientation_1stStag...
e77923b12d92109cb2435e5198f59c531f226b7f78c18cc1fbe5aacbbf795a1f
Python
5,312
156
"""Monodepth Digging Into Self-Supervised Monocular Depth Estimation, ICCV 2019 https://arxiv.org/abs/1806.01260 """ from mxnet.gluon import nn from mxnet.context import cpu from .resnet_encoder import ResnetEncoder from .depth_decoder import DepthDecoder class MonoDepth2(nn.HybridBlock): r"""Monodepth2 Par...
5c28b7746363091767cfda374a5ddd2a864c1f06469b65af775af60b27a0ab37
Python
5,313
157
""" Splits data into test data (one block) and training data (remaining five block) for cross validation. """ import pandas as pd import numpy as np df1 = pd.read_csv("Source Data 1.csv", sep="\t") df1 = df1.dropna(axis=0, how="any") for i in range(2, 3): # repetitive df2 = df1.query(f"subject == {i}") df3 ...
b033d82657e57e7d1a5f124c481bff75afd1bb8086e82355439800e269803b2d
Python
5,313
125
import os import torch from torch_geometric.data import InMemoryDataset, DataLoader, Batch from torch_geometric import data as DATA from torch.utils.data import TensorDataset # initialize the dataset class DTADataset(InMemoryDataset): def __init__(self, root='/tmp', dataset='davis', xd=None, y=N...
2e2b16b53302c0df3c933de0d0a52ffd5b76cfaba37887293831a615ad889b0c
Python
5,314
140
#!/usr/bin/env python import argparse import json from cp_common_functions import (build_header, concat_conditional, get_json_value, get_pipeline_lines, get_total_number_of_modules, INDENTATION, update_module_count, ...
ae7f916d3b6d5843d3706fa45f5ea5e0c3559943cd67a4870b3a6210b3f9a632
Python
5,315
141
"""Check the completion spec against the option tables in src/cli.cc. The spec is hand-maintained and cli.cc is the authority, so the two drift apart whenever an option is added, removed or reassigned. A stale spec does not merely under-suggest: it offers options the binary rejects. Checked here: 1. every option i...
4991244d9990ab6557c75e84133d5a8473fa6eab26f849223d7e30cdac9bd478
Python
5,316
177
__credits__ = ["Rushiv Arora"] import numpy as np from gym import utils from gym.envs.mujoco import MuJocoPyEnv 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(MuJocoPyEnv, utils.EzPi...
620c9d6d70aa02565421426a0acbcaeda05ab53931596aa3af2a6fcad48ea945
Python
5,316
145
import torch.nn as nn import torch import torch.nn.functional as F from einops import rearrange, repeat from einops.layers.torch import Rearrange # Transformer implementation: https://github.com/lucidrains/vit-pytorch # helpers def pair(t): return t if isinstance(t, tuple) else (t, t) class PreNorm...
a778d81d89065012b7b4ab6f7fc10c37672a587b1588435eb1f2f9e3a3725590
Python
5,316
175
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If extensions (or modules to docume...
9b11bc28de15581807311b15b641bc105dee70782e452a5678050265b9bd43ad
Python
5,317
147
"""Construction-order factorial (W1-ORD / D8 / defect L4), memo 8.1 item 2. Honest twins refute each other purely from the ORDER in which the two model objects were constructed relative to TorchLens's first wrap: whichever model was built pre-wrap holds pre-wrap function references (``self.act = F.gelu``) and records ...
cf4af5c832b444116c0c2c41a2a947c0d9703eb6ca48bd2bc0448af6a567febc
Python
5,317
135
"""User-authored relation evidence never mints TRUST (W051-HONESTY M8). ``RELATION_CLAIM_GRADES`` reserves ``verified`` / ``consistent`` / ``divergent`` for TorchLens MEASUREMENTS, yet every evidence item that reaches a row today is user-authored (no producer writes envelopes). A user ``"verified"`` used to be stored ...
81eaa79d43b6537009c6316dddca67bd031c7ee3485533c1057230a15a5fcc08
Python
5,318
149
import itertools import numpy as np from digest import conds from util import isiterable def pairlabel(cfg, ipair): return f'{cfg.pairings[ipair][0]}/{cfg.pairings[ipair][1]}' def getindex(cfg, **kwargs): if 'isi' in kwargs: if isiterable(kwargs['isi']): iISI = [cfg.ISIs.index(isi) for ...
83688cf26bc5cbbfabdf630cb08f73be653b26ee59538847d82fb338ccb26b22
Python
5,318
166
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> from itertools import product import os from eelbrain.testing import TempDir from eelbrain._experiment import TreeModel, FileTree class Tree(TreeModel): _templates = dict(apath="/{afield}/", afield=('a1', 'a2', 'a3'), ...
62fb3aa452bf325183f22a482ef54c3ebde1044d0961fd6dc1dd3a4de78990bb
Python
5,320
192
""" Append experiment. Split whole dataset into three part, where split one patient into three part, from start to end. split pad dataset path: /workspace/data/split_pad_dataset_512 three part split pad dataset path: /workspace/data/three_part_split_pad_dataset """ # %% import os import sys import shutil # there sh...