sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
96d08d36eaca0d2852b92c6cca492ff4125d66e1bae36b217217407923538b4f
Python
8,741
231
"""W051 regressions for the step-join ENTRY BASIS (audit 3.3). The join basis was "first tensor argument" with no disclosure of WHICH argument was read: a kwargs-first masked LM (``forward(attention_mask=None, input_ids=None)``) graded its attention MASK and reported false exogenous positions on a true continuation; a...
e483a968d507d5262d0b9048d070cfca6f31d887eeff89270ea0c67f05dbc7a2
Python
8,741
177
from unittest import TestCase, mock import numpy as np import spateo.segmentation.icell as icell from ..mixins import TestMixin, create_random_adata class TestICell(TestMixin, TestCase): def setUp(self): self.utils_patch = mock.patch("spateo.segmentation.icell.utils") self.em_patch = mock.patch...
f6c73c61a602ee3b8b87bfa90284fbc96e567b77c3a6d86c0e3919c5f12b64c6
Python
8,741
346
import datetime import decimal import io import uuid import pytest from werkzeug.http import http_date import flask from flask import json from flask.json.provider import DefaultJSONProvider @pytest.mark.parametrize("debug", (True, False)) def test_bad_request_debug_message(app, client, debug): app.config["DEBU...
f8490be3cac5b5975dd804db5d5fda6a29dc432bafb9aea16a45c41aee660cb3
Python
8,741
189
import numpy as np from tqdm.auto import tqdm from . import xpu, regression from .xpu import cupy_wrapper, iscupy, get_array_module @cupy_wrapper(['arr']) def getdff(arr, medianfilt_size=7, minfilt_size=61, gaussfilt_sigma=61., onlydf=False, epsilon=1.): """ Calculate deltaF / F0. This function calculates the dF...
2b20c0831b98dc5f961e4875e60a33798cf326d8af8fc89599c2f925f0028779
Python
8,742
220
""" Author: Bruno De Santi, PhD Affiliation: Multi-modality Medical Imaging Lab (M3I Lab), University of Twente, Enschede, The Netherlands Date: 20/09/2023 Description: Collection of processing techniques used in MUVINN-reg Paper/Project Title: Automated three-dimensional image registration for longitudinal photoacou...
de3bbe1eeabb8c5f447048727c0e8d5c3f3709ce79c7d29976afa61d71c5882e
Python
8,742
249
import copy import os import torch import torch.utils.data import torchvision import torchvision.transforms as T from pycocotools import mask as coco_mask from pycocotools.coco import COCO class FilterAndRemapCocoCategories: def __init__(self, categories, remap=True): self.categories = categories ...
44414619675844b260e8128e6c2b1ce41bf2387669f92b8d7968be7481301b1c
Python
8,743
287
#!/usr/bin/env python """ Basic SuCOS scoring. Allows a set of molecules from a SD file to be overlayed to a reference molecule, with the resulting scores being written as properties in the output SD file. SuCOS is the work of Susan Leung. GitHub: https://github.com/susanhleung/SuCOS Publication: https://doi.org/10.26...
b5f744f115fbc094880367ab17058a9d89dc3a1159fb19df9b2cecb8feb88185
Python
8,743
309
from matplotlib import pyplot as plt from PIL import Image import pandas as pd import matplotlib import numpy as np import networkx as nx from stlearn._compat import Literal from typing import Optional, Union from anndata import AnnData import warnings from stlearn.utils import _read_graph def pseudotime_plot( a...
906774e6e7927c55be1d97877d000242d046fe064b2b9d412d855d8519cd8a8d
Python
8,745
251
import os import json from volume import Volume import pandas as pd import pydicom import numpy as np def dcm2json(seq_overview, dcm2bids_tags, utils_dict, dcm_list, json_path, pet_doses=None, verbose=False): """ Converting dicom metadata to json file saved in session folder :param seq_overview: [pandas ...
8d53ebc99cf818a808cbd73ba53af03dc90e39a6cc0d16d560095120286ac575
Python
8,746
279
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # ------------------------------------------------------------------------------ from __future__ import absolute_import from __future__ import d...
0a091fbc7edcee33392cb63d7191c37dce66ec7a58739d518785a242b5afe881
Python
8,750
209
import argparse import numpy as np import torch import torch.nn as nn import torch.utils.data from src.getdata import getdata_from_csv from src.utils import DrugTargetDataset, collate, AminoAcid, ci, kd_loss from src.models.DAT import DAT3 parser = argparse.ArgumentParser() parser.add_argument('--cuda', default=True...
b9bdd163fa2e4f579f5d25744d0a2a1168d4b9b379d4534ecd51aa4e2e457e04
Python
8,750
216
#!/usr/bin/env python """Fetch every third-party input this pipeline needs. Nothing this script downloads is redistributed in the archive. Run it to rebuild the working tree from the original sources. python deposit/fetch_data.py --all python deposit/fetch_data.py --proteoclock --organaging python deposit...
5d5c84653a3852d723cddfddab9b93c67cf1a0b157a9d7c89bc4720fff5be02f
Python
8,752
318
import numpy as np from . import utils from . import extract_signals def get_range(arr, axis=None): """ Difference between the highest and the lowest value Parameters ---------- arr : np.array typically a time-varying signal axis : int, optional if None, difference between th...
536b0d0abd0e5d5c44105c694dc6debda747a0e44e16a1486d3f3c55b8832d5a
Python
8,754
236
import torch import pandas as pd from brainbox.physiology import neural from src import datasets, train, util class PVC1ModelQuery: static_model_query = { "vgg": {"3.1": [0.66, 1.0, 1.5]}, "bwt": {"None": [0.66, 1.0, 1.5]} } dynamic_model_query = { "stack_prediction_4-6-2_True": ...
811f2e65465a4212df7a21cb0c3ce50dee1d063d2ef5d79a2f706e7633b583e4
Python
8,754
227
from __future__ import print_function, division, absolute_import import os import torch # http://pytorch.org/about/ from torch.autograd import Variable from torch.utils import model_zoo import torchvision # https://github.com/pytorch/vision import torchvision.models as models import torchvision.transforms as transfor...
900de1a38b61d7aa0461beffb05f5c702675af361d39542c8f40c694bd7353dd
Python
8,756
209
"""B4 + B15: join-guarded differential consumers and the diff projection matrix. ``changed()`` / ``top_changed()`` pair cross-trace occurrences through the shipped guarded join (labels leave the join key), and ``diff_report`` settles the union of both captures into the closed added / removed / unresolved / excluded_ma...
ea19e2d7183973ebce8994874584762967da01d43b66a6f3630a150d9b6cac9b
Python
8,757
238
from __future__ import absolute_import, division from tqdm.auto import tqdm import torch import torch.nn.functional as F from trainingUtils import MultipleOptimizer, MultipleScheduler, compute_kernel, compute_mmd from models import Decoder, SimpleEncoder,LocalDiscriminator,PriorDiscriminator,Classifier,SpeciesCovariate...
1319a4a867c61d92c63f73db02805b6399dbd3924565ae57c0bf45e444d3d23b
Python
8,758
279
import gc import sys import time import pytest from celery.utils.dispatch import Signal if sys.platform.startswith('java'): def garbage_collect(): # Some JVM GCs will execute finalizers in a different thread, meaning # we need to wait for that to complete before we go on looking for the ...
faf6615444e053442e58920bc24f7eae6d674b255a00d971aed237556b90915f
Python
8,759
264
"""Base Transform class and relate utils.""" import torch from bioseq2seq.utils.logging import logger from bioseq2seq.utils.misc import check_path from bioseq2seq.inputters.fields import get_vocabs class Transform(object): """A Base class that every transform method should derived from.""" def __init__(self,...
8b0c95bce48ecf788eab3a82646dcb721f3a4db8be83caa46e42ccc9f14a889c
Python
8,760
236
"""A synchronous vector environment.""" from copy import deepcopy from typing import Any, Callable, Iterator, List, Optional, Sequence, Union import numpy as np from gym import Env from gym.spaces import Space from gym.vector.utils import concatenate, create_empty_array, iterate from gym.vector.vector_env import Vect...
2ec96bdf1ca0242ac696f27324e10b27f290a712c15085c446a69a3d00b95cb1
Python
8,766
303
# -*- coding: utf-8 -*- import numpy as np from matplotlib import pyplot as plt import random import sklearn import seaborn as sns import scipy as sp from matplotlib import rc import matplotlib.ticker as mtick import matplotlib as mpl from scipy import signal from sklearn.linear_model import LinearRegres...
781010b7f408b689d24d0948ce912eab87db2cba37aabb5d2dfb32d31bf277fd
Python
8,766
210
from contextlib import AbstractContextManager from typing import List from dependency_injector.providers import Callable from sqlalchemy import Text, and_, cast, func from carbonserver.api.domain.projects import Projects from carbonserver.api.errors import NotFoundError, NotFoundErrorEnum, UserException from carbonse...
a806b98e6a7f7e44019552f82d6d7837baeb30f364df2300a4d14bc5110fba25
Python
8,766
221
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created in April 2019 @author: Nathan de Lara <nathan.delara@polytechnique.org> """ from typing import Union, Tuple, Optional import numpy as np from scipy import sparse from sknetwork.linalg.sparse_lowrank import SparseLR from sknetwork.utils.check import check_form...
11c818853f3a8daea571c727964747ef36f78805c5eedca9a1d3808739035296
Python
8,770
251
"""Fetches gene sequence from gene fasta created by extract_genes.py""" import prob2020.python.utils as utils class GeneSequence(object): def __init__(self, fasta_obj, nuc_context=1.5): self.fasta = fasta_obj self.nuc_context = nuc_context def set_gene(self, bed_line): ...
0d25d72d51e414ac633d029671e121911ab9c2d455ab98f626a4cf894720759b
Python
8,772
192
import logging import os import shutil from galaxy import ( model, util, ) log = logging.getLogger(__name__) def do_split(job_wrapper): parent_job = job_wrapper.get_job() working_directory = os.path.abspath(job_wrapper.working_directory) parallel_settings = job_wrapper.get_parallelism().attribu...
a30244deffcc420a008de80c480cb9375d155fd7c9cc8a3fb77725ad174280ec
Python
8,772
166
########################################################################## ## ## ## Copyright (c) 2019-2025 Philipp Lösel. All rights reserved. ## ## ## ## This file is par...
45abd69a94040fc6482d731ad3eb5e8b83edf21dcf8dc377f24fb983b3ff3d0c
Python
8,777
230
import argparse import numpy as np import torch import torch.nn as nn import torch.utils.data from src.getdata import getdata_from_csv, get_cold_data_from_csv from src.utils import DrugTargetDataset, collate, AminoAcid, ci from src.models.DAT import DAT3 import random parser = argparse.ArgumentParser() parser.add_argu...
7c4d284210d4ace510c6b045c1a4561a1bb57a3506304e3a3e47d528f05fd5f0
Python
8,777
213
import sys import os import gc sys.path.append('../TM2_segmentation') import SimpleITK as sitk import numpy as np import pandas as pd import nibabel as nib from skimage.transform import resize, rescale from scipy.ndimage import rotate from scipy import ndimage import matplotlib.pyplot as plt from numpy import median i...
b322edf661a6d6036905ee70edcdc6d7e7c4742f1e0f9ff5c9bac77a796308d1
Python
8,777
241
# %% ''' Splits patients into medicated and non-medicated Reruns the behavioural and glm analyses ''' import matplotlib.pyplot as plt import seaborn as sns import numpy as np import pandas as pd import pingouin as pg from functions.data_helpers import get_phenotype, get_task_beh_data from functions.data_helpers impor...
3ab70392dfab4c95a64c776abbcff295634cbed6addc75047e3464eb2c0450e9
Python
8,779
295
"""Logging utilities.""" import logging import numbers import os import sys import threading import traceback from contextlib import contextmanager from typing import AnyStr, Sequence # noqa from kombu.log import LOG_LEVELS from kombu.log import get_logger as _get_logger from kombu.utils.encoding import safe_str fro...
86b31e156e5d7d9db469b74081d8aeca29e240117b84c91a83fb7d143aa4dcbc
Python
8,779
206
"""C03: the ONE addressing repair (site-key-primary targets, guarded join). Leverage B4/B5 + surgery Build 0a/0b, one substrate: - Saved spec target manifests carry ``resolved_site_keys`` (site-key-primary; labels are display-only disclosure -- the ME ordinal rule). - ``check_spec_compat`` compares site keys FIRST ...
77dec1e24150c86c4fddd070dde494afea1942e850eec144309b486d8074c63d
Python
8,780
202
from contextlib import AbstractContextManager from typing import List from dependency_injector.providers import Callable from fastapi import HTTPException from sqlalchemy import and_, func from carbonserver.api.domain.experiments import Experiments from carbonserver.api.infra.database.sql_models import Emission as Sq...
439f11a30444d49e9ce93a5779dfd08d8ce1a2869b9fefe79d8b386998777ca1
Python
8,788
223
#!/usr/bin/env python3 """ File: prepare_metabrain_eqtl_file.py Created: 2021/12/06 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 ...
0f3b8c106a70a8c3af62a4bc3b8ef6f011d349941961d0828c1b8683d30c4163
Python
8,789
167
# Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com) # PLUS import os import sys import argparse import numpy as np import torch import plus.config as config from plus.data.alphabets import Protein import plus.data.homology as homology import plus.data.dataset as dataset import plus.model.plus_rnn...
6a8165f2ec4c0f869a865d3964fc88728b24ae24d583cacdc0edf87e3545a6d4
Python
8,791
237
"""Stream a layer to a GeoParquet file without materialising the whole output frame. The chunks (the point nodes, then ways in batches, then the relations) are assembled one at a time and written in that order by one writer, under the columns of the in-memory reader's result in its order. Every way chunk carries the t...
9d25c6e7359aa202aab1607c8e0b3e5b5492e8baa49d63a5a5e37b30b6479e53
Python
8,791
259
# --- 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 Dimension(_BaseTraceHierarchyType): _parent_path_str = "splom" _path_str ...
c38a7630e98c7473d6eb154df8e76a4ea1d9f14715d31034eb0b7702942e9d6e
Python
8,792
277
import os from types import SimpleNamespace import pytest import typer from codecarbon.cli import monitor as monitor_module class FakeTracker: def __init__(self, *args, **kwargs): self.kwargs = kwargs self.stopped = 0 self._conf = {"output_file": "emissions.csv"} self._output_han...
367a5f02722136b05ea006b82185aed77389b76d94b6dff5093921ce907647ff
Python
8,793
257
# pylint: disable=missing-function-docstring, missing-class-docstring """ A Closer Look at Spatiotemporal Convolutions for Action Recognition CVPR 2018, https://arxiv.org/abs/1711.11248 Large-scale weakly-supervised pre-training for video action recognition CVPR 2019, https://arxiv.org/abs/1905.00561 """ import torch i...
dbf200b488a18d9c55459795d391a27c14c451cdcd96ccf5310dfcd39383cbb9
Python
8,794
210
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ @author: Pramod Bharadwaj Chandrashekar @email: pchandrashe3@wisc.edu """ import math import numpy as np import pandas as pd import DeepCORE_attention_util as dau def match_enhancer_location(gene_info, enhancer_info): """ Function to extract all the locations...
6630eb5867cb7879ea4b1f92b19bc1fb5d1e4d257d84c476df4a82f0912385a0
Python
8,795
221
# coding: utf-8 from itertools import chain, starmap from collections import Counter import torch from torchtext.data import Dataset as TorchtextDataset from torchtext.data import Example from torchtext.vocab import Vocab def _join_dicts(*args): """ Args: dictionaries with disjoint keys. Return...
e8646b5451d0e7df80114104a7b27e5af6762a90d78fd51223e9c550ff6d90a7
Python
8,795
214
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import base64 from pathlib import Path from typing import Any import cv2 from ultralytics.data.loaders import LoadPilAndNumpy from ultralytics.utils.checks import check_requirements class LLM: """OpenAI-comp...
0fa5ff3a38901e6f4a34f68aed0ca8273e99827f1a358491d31a99dc8e8174b8
Python
8,796
253
"""Tests for the Raspberry Pi power interface (`vcgencmd pmic_read_adc`).""" import time from types import SimpleNamespace from unittest.mock import MagicMock, patch import pytest from codecarbon.core import cpu from codecarbon.core.units import Energy, Power, Time, Water # Shape of `vcgencmd pmic_read_adc`, with r...
49187da1358e7450a45400155f55a75b036896b63be8c48ecffb558a22b138ca
Python
8,797
239
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Test the continuous normalizing flow layer in tfep.nn.flows.continuous. """ # ================================...
7d49f03d50c96d603dc8f48951945537761434f567ed4e7bd04b8da5e393e180
Python
8,800
200
"""MS COCO object detection dataset.""" from __future__ import absolute_import from __future__ import division import os import numpy as np from PIL import Image import mxnet as mx from .utils import try_import_pycocotools from ..base import VisionDataset __all__ = ['COCOInstance'] class COCOInstance(VisionDatase...
f71e8daa4b378987da375c7865c04a2aedf1d5e3fc3eaab519f7c099fc390c90
Python
8,800
224
#!/usr/bin/env python """This scripts checks whether mutations are specified correctly. Specifically, this script tests mutations to check whether they are reported as being on the positive strand or on the coding strand. """ # fix problems with pythons terrible import system import sys import os file_dir = os.path.di...
8458622ac1da984caab348d1a8ad28dd481cc165d8c4b3b211484fa9a25bc516
Python
8,801
265
from typing import List, Optional, Union import numpy as np import pyvista as pv from pyvista import DataSet, MultiBlock, PolyData, UnstructuredGrid try: from typing import Literal except ImportError: from typing_extensions import Literal #################### # Integrate models # #################### def m...
e224c6e08e58b827dce5e6a2acd33f3278b82f7e25a81ea8bfdad111036c7d69
Python
8,801
223
"""History artifact tests: atomic append, recovery, ring policies (D19/D20).""" from __future__ import annotations import json import os from pathlib import Path import pytest import torch from torchlens.observability import ( CommittedBlock, Histogram, HistoryArtifactError, HistoryReader, Histo...
98930f41b964d8efe8c5bb35369260c47438f18bb264b314a3fad994cd42fe40
Python
8,803
214
"""Bounding box visualization functions.""" from __future__ import absolute_import, division import random try: import mxnet as mx except ImportError: mx = None from .image import plot_image def plot_bbox(img, bboxes, scores=None, labels=None, thresh=0.5, class_names=None, colors=None, ax=None, ...
0664db0ca77127d1e4ec0c0060b82f5370abfda3381c865fc226b2ee56a5a4d7
Python
8,804
230
"""Tensor->Python-scalar escape honesty for sparse runnable execution. Round-8 hardening (the r8 "money bug"). A tensor->Python-scalar escape (``.item()`` / ``int()`` / ``float()`` / ``aten._local_scalar_dense``) used AS A VALUE bakes the derived scalar into a downstream op as a literal constant. The escape breaks the...
d262423162b89fa1192203c8610180317e912cafbf1026465b57818bb6a002ae
Python
8,804
236
"""Checks kit item 4/5: the D6 nonfinite table test (memo test plan row 3). fp32 x {inf, nan} x {clip, no clip}; scaler x {inf, nan}; bf16 x {inf, nan}. With a scaler S-B never fires and 0 parameters move; without one S-B fires and raises BEFORE the write with weights bitwise clean after; the clipping collateral count...
9d748ad37f192b1d0a958406abd3772ae27d9a51fcf5412795afa1a6ba901b4c
Python
8,805
227
# SOURCE: vendored from oxwhirl/wqmix @ master (files: src/modules/mixers/qmix.py, # src/modules/mixers/qmix_central_no_hyper.py, src/modules/agents/rnn_agent.py, # src/modules/agents/central_rnn_agent.py -- fetched 2026-07-02). # # This vendors the REAL WQMIX (Weighted QMIX) architecture: the per-agent recurrent Q-net...
41bf19434fd57e7b82c69d3f7846b12f6aad0593308b6868c18493e34994dc36
Python
8,807
210
"""C07X identity-fact load validators (tlspec v9 entry-dark slots). The Trace-level root entry-point fact (``Trace.root_entry_point``, written unconditionally at capture; foldA D10) and the two entry-dark Op facts the C07X amendment declares (``Op.episode_step``, F-EPISODE writes; ``Op.tl_authored_root``, F41 writes),...
d00fcf2a9fbb8533f416114bbfcf23677120f2cb9be7e85ecf2727b7bea8a903
Python
8,807
261
""" Integration tests for memory leak issue #8882. These tests reproduce memory leak scenarios that occur when Celery tasks raise unhandled exceptions, causing ExceptionInfo objects to not be properly garbage collected. """ import gc import logging import os import tracemalloc from celery import Celery logger = log...
bc57b2962a2d4274a7931e57930981eafa078414d51515dcc57452eb45881528
Python
8,811
245
'''DNN Feature decoding - decoders training script''' from __future__ import print_function from itertools import product import os from time import time import warnings import argparse import bdpy from bdpy.dataform import Features, save_array from bdpy.distcomp import DistComp from bdpy.ml import ModelTraining fr...
97f5a6ad36ac4f35be7f30b638dbb9ed950d34b6e2fec3ba8f889d3beb8eefbe
Python
8,812
224
"""Entry contract for structure-only capture (L7a wave 0, D8-default branch). Covers the memo's sec 1.2 options threading, sec 1.3/2.2 Layer-0 entry conflicts, the sec 1.5 entry-matrix cells reachable without D8 (E-1 degenerate form (b), E-6 flag-off zero-diff), and the S3-registrar mode-marker prep. Every structure-o...
82e57d5eeb56c3459ff55b51c334c6ee65386604a261eb834ddabcba7279586e
Python
8,814
200
from enum import Enum from itertools import product from typing import List, Any import os import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from tqdm import tqdm from drug_interactions.datasets.Datasets import TrainDataset, TestDataset, NewOldTestDataset, NewNewTestDataset, ...
d81e2fd4a49780e7d4a828a6b156b3f91d4f01234f2f9a8c27d6fd7e1719da2a
Python
8,815
273
""" This module contain all graphics and plotting """ import numpy as np import matplotlib.pyplot as plt import seaborn as sns def probplot(prob, sigma=1, xmin=-10, xmax=10, ymin=-10, ymax=10, ax=None, colorbar=True, grid=False): """Plot a conditional probability matrix. Parameters ---------- prob :...
732bcea738e9511b3638a7f41ae436ba45d069d830d5db9b0c84b73aa1add40f
Python
8,819
221
"""A06 capture-options truth: the cache key covers EVERY semantic option. WALKTHROUGH list-A row 26 (first clause): ``cache=True`` could serve captures that never armed ``raise_on_nan`` / ``track_nonfinite`` / ``save_budget`` -- the key was a hand-enumerated include-list, so semantic knobs added after it silently fell...
6d29b07d468c2291557a526debe9a1057c2eb18fb691fb5f319587306edb3b83
Python
8,820
309
# --- 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 Delta(_BaseTraceHierarchyType): _parent_path_str = "indicator" _path_str ...
1c7910b0bb04b587d43ba6031232936593aeec2cb88510cb3b591092fecde57b
Python
8,821
251
""" navigation_sim.py — headless SimPy navigation model Separate from simulation_06.py, which keeps the PyQt5 demo GUI. This module is what the pipeline imports: no Qt dependency, no hardcoded accuracy table. The key difference from the earlier version: measured decoding accuracy is the probability that a decoded com...
25e92d7b62a510ac065f4fb480c595b4cc40279a2c885f84e7e6dac22e4ab63f
Python
8,824
101
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: osmformat.proto # Protobuf Python Version: 6.33.5 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _desc...
10b008af5980d82e4d134309627f17b3f1a631e118b2490c7a4f020cbd921531
Python
8,825
200
import logging import os import sys import matplotlib.pyplot as plt import torch import torch.nn.functional as F from torch.cuda.amp import GradScaler, autocast from torch.utils.tensorboard import SummaryWriter from tqdm import tqdm from utils import save_config_file, accuracy, save_checkpoint import pandas as pd impor...
87676cbabbe6d6b568aa392bf4c8314af74da18689f93532819c91dc8906cb8e
Python
8,826
250
import math import typing as ty import torch import torch.nn as nn from torch.nn import functional as F from torch.nn.utils.rnn import pad_sequence class Embedding(nn.Module): def __init__(self, dim_numerical: int, dim_embedding: int, dim_categorical: int, ...
ce29c362b601e2dd75b3ac5d962e82a93001ac66ed324da0839e4b13a4bd64cd
Python
8,826
212
""" Functions for verifying files. Copyright (C) 2021 Tham Cheng Yong This file is part of NanoVar. NanoVar is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) a...
61582bb5e904bb0007650f411a55eed21a4ed333548263560420c0beb5feab35
Python
8,827
246
import threading import time import unittest from unittest import mock from codecarbon.external import scheduler as scheduler_module from codecarbon.external.scheduler import PeriodicScheduler from tests.testutils import FakeClock # Fake seconds: time only moves when a test calls clock.advance(). INTERVAL = 1.0 # Rea...
7dc5836275d2aa38ffcd35ad0a2f381d2dd7ed369dc1d6f2a5445ef209d1afe0
Python
8,828
313
# -*- coding: utf-8 -*- from docutils import nodes from docutils.parsers.rst.directives.admonitions import BaseAdmonition from docutils.parsers.rst.directives import unchanged class HandbookAdmonition(BaseAdmonition): """RST directive """ node_class = nodes.admonition # empty is no allowed has_co...
205f1351d17f4730d6732d853f15790b77749f4f6480637ace48106af356cc76
Python
8,829
248
import numpy as np import matplotlib.pyplot as plt from scipy.special import softmax import pandas as pd from utils_ensemble import list_of_result_to_dico, acc_of_ensemble import torch from scipy.signal import savgol_filter from sklearn.model_selection import ShuffleSplit import json import argparse from utils.json_loa...
2d248e1548ebb0a3531607617c03bf3a6858af1687667788efbb423ddf9d705b
Python
8,829
301
from typing import List, Any import numpy as np # auto-object related utility functions ####################################### def get_branch_info(branch: Any) -> tuple: """Extract the relevant data from a solution branch object. Parameters ---------- branch Solution branch as returned by ...
96deca7354e47d6de0fa44f26c5556a830936e2db35883e176d49b428b929148
Python
8,831
187
"""this script is used to prepare DET dataset for tracking, which is Object detection in Large Scale Visual Recognition Challenge 2015 (ILSVRC2015) Code adapted from https://github.com/STVIR/pysot""" import argparse import tarfile import os import glob try: import xml.etree.cElementTree as ET except ImportError: ...
627407b8d0676562248ea5d48b5cb37059a6c0845b2114b7b4dca1b4fdb39052
Python
8,834
219
import copy import torch import torch.nn as nn from model.vq import VQLayer class MaskConvBlock(nn.Module): """ Masked Convolution Blocks as described in NPC paper """ def __init__(self, input_size, hidden_size, kernel_size, mask_size): super(MaskConvBlock, self).__init__() assert kernel_size-m...
4ca0b63437f3d34b4738b920ecf884c9efab48281a8e8437eea08a72178c8f17
Python
8,835
226
'''Trains a simple convnet on a custom dataset''' from __future__ import print_function import tensorflow from keras.models import load_model import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation import os import cv2 from numpy.linalg import inv from skimage import * from skima...
10a6296420feb1cc566b8e32d5c4c6fdb6891ac850698c6e544fcfa1f5d48e3c
Python
8,836
310
""" The Folder class helps to navigate a hierarchical data tree. """ import json import string from collections import UserDict from datetime import datetime from pathlib import Path from rich.console import Console # , ConsoleOptions, RenderResult from rich.panel import Panel from rich.tree import Tree from .inter...
73e38ba89a4e05765a43ad32184eed01ef65b6ffbaec96542a250eaeb22d385f
Python
8,836
301
"""Phase 8 multi-trace follow-on tests.""" from __future__ import annotations import json from pathlib import Path import torch from torch import nn import torchlens as tl from torchlens.intervention._topology.topology import compare_topology class _ModuleModel(nn.Module): """Tiny module-nested model for bund...
bebc7064896d9e949c1aab0c916c445314221a2f3b9a34ab93191371da5ae0e6
Python
8,836
253
'''Tests for bdpy.bdata.bdata.''' import unittest import numpy as np from numpy.testing import assert_array_equal from bdpy.bdata.bdata import BData class TestBdata(unittest.TestCase): '''Tests of 'bdata' module''' def __init__(self, *args, **kwargs): super(TestBdata, self).__init__(*args, **kwar...
53627f9359203c894d2ba3d1a8e13ddc6adc45b6ad2046ca80592499dfd9e538
Python
8,837
222
import numpy as np import torch from torch import nn from torch.nn import functional as F from .utils import gabor_kernel device = torch.device("cuda" if torch.cuda.is_available() else "cpu") class FakeReLU(torch.autograd.Function): @staticmethod def forward(ctx, input): return input.clamp(min=0) ...
c4c3ac98cb3789e838d63161a331768a80c742efbd350840f6d230e0f813bae7
Python
8,837
255
from __future__ import annotations from collections.abc import Callable from larvaworld.gui_v2.registry_bridge import GuiNavigationModel from PySide6.QtCore import Qt from PySide6.QtWidgets import ( QFrame, QGridLayout, QHBoxLayout, QLabel, QPushButton, QVBoxLayout, QWidget, ) def build_...
23f6ab4a967c89e4d09fd74445865dbbf70cb3521ad8947dc31d937f6050d75a
Python
8,838
210
""" Finding 'Oscillations' With Filters =================================== Examining the results of filtering aperiodic signals. This example uses the `neurodsp <https://neurodsp-tools.github.io/>`_ module for time series simulations & analyses. """ ##################################################################...
bb4e3890ff54bf1674697c64a6124a98bcb67aad171ebdd5c3d2cf0f7f27c0fa
Python
8,838
250
############################################################################## ## swigprocess.py -- Script to generate swig based interface for python and R ## Revision: $Id$ ## ## Copyright (C) Kshitij Kulshreshtha ## ## This file is part of ADOL-C. This software is provided as open source. ## Any use, reproduction, o...
64afd80919c0dd34bc645ec652029b3067b93234308f1fe9256cfc84c65297f6
Python
8,840
280
# This example requires the following dependencies to be installed: # pip install lightly # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import copy from functools im...
5fe7305128cc0218b0f9b23023e6b822774df0a3277f8d263a16d73aaa0c4660
Python
8,842
216
""" This module define TrainingFineTune """ import logging import torch from dataset_manager.training_dataset_manager import TrainingDatasetManager from model_manager.model_factory import ModelFactory from model_manager.weight_modifier import WeightModifier from config_manager.config_manager import ConfigManager from u...
40f578bfb0b8c04a22c26f9334c9570805c9cb2b816066fed976623c57ec146c
Python
8,845
168
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import os import sys import json os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorflow as tf import tensorflow.compat.v1.logging as tflogging tflogging.set_verbosity(tflogging.ERROR) import logging loggi...
6ab08be1030fff29baa91f6562680f0ee2eccfc23f6e8990dfe45dede28d2176
Python
8,846
238
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 28 10:17:17 2020 @author: Audrey Mazancieux This script performes event_related analyses for the LC and translated LC in the y axis. It includes: - Creation of translated mask - Time serie extraction for each mask - Epoch and save ...
232e9d4a9ce4eff319528f16843c2b385771b41ac93a0bfd6f0804477ce2055b
Python
8,848
211
# -*- coding: utf-8 -*- """ General class for estimator models: fit an array of regressors to fMRI data. =================================================== A EstimatorModel instanciation requires: - model: an instance of sklearn.linear_model that will be use to fit a design-matrix to fMRI data, - alpha: i...
3f7943a7a4b125782d913c6932eb4e755789a45d5731386c56fb5da7d60fa4e5
Python
8,852
230
"""Observe-kit item 1: NaN label unification identity fixtures + the raw-label lint. One op, ONE public name: every NaN surface (find_nan, bisect_nan, the CaptureError message and structured fields, CaptureOutcome.boundary_label, PartialTrace summaries) reads its label out of the step-8 raw-to-final identity map produ...
d0437207602aded20930868f6b2936534bc90e2d769316b90b2933ff182e4bd0
Python
8,852
203
#!/usr/bin/env python # Make the robot grasp objects from table top # Python libs import sys, os import json import numpy as np import math # ROS libs import tf2_ros # probably not needed import rospy import moveit_commander # ROS messages from actionlib import SimpleActionClient from tiago_pick_demo.msg import...
1bfee8453557c3b52217e9bb524cdeec1b424377dc9f2882b6c2af84de07e10a
Python
8,853
216
""" 06: Metrics & Model Evaluation ============================== An overview of metrics & model evaluation to examine model fit quality. """ ################################################################################################### # Import the model object from specparam import SpectralModel # Import fun...
1fda3664fb844073a2a34e376809f69f663c398c7074a44d6ad1898bacceac65
Python
8,853
227
"""The consumers highly-optimized inner loop.""" import errno import socket from celery import bootsteps from celery.exceptions import WorkerLostError from celery.utils.log import get_logger from . import state __all__ = ('asynloop', 'synloop') # pylint: disable=redefined-outer-name # We cache globals and attribute...
043058aba102ac32b2c5c74ad94455c57507b35f6287955fc32f5f152cc94402
Python
8,854
254
from biomedisa.features.biomedisa_helper import * from tifffile import imread import numpy as np import time import numba @numba.jit(nopython=True) def reduce_blocksize(data, value=1, buff=25): zsh, ysh, xsh = data.shape argmin_z, argmax_z, argmin_y, argmax_y, argmin_x, argmax_x = zsh, 0, ysh, 0, xsh, 0 fo...
10a70957826e97299b688e5d2d730c2b498a70a9f041f9be9666adc436d5a2ff
Python
8,854
256
""" Tests for the rover/sitter behavioural phenotypes derived from the generic (species-average) Drosophila DEB model. """ from __future__ import annotations import json import pytest from larvaworld.lib.model.deb import deb_equations as de from larvaworld.lib.model.deb import rover_sitter_model as rs #: Yield coe...
07327e2e35821de77a84aa0638269fee60ac8f0c4f990bc6ad9f1a4d4e1087b0
Python
8,855
237
# Run test with: # torchrun --no_python --nproc_per_node=8 pytest -q -s tests/ops/test_fused_dense_parallel.py import math import pytest import torch import torch.nn.functional as F from apex.transformer import parallel_state, tensor_parallel from flash_attn.ops.fused_dense import ColumnParallelLinear, FusedDense, Fu...
23e0f4a39e3318b1a243fe117c5059c29ffea3744362b8a11fdb24b7ee69534f
Python
8,855
192
"""Deployment-envelope detection helpers (lane F37, R5). The population TorchLens is aimed at loads large models through Hugging Face Accelerate: ``device_map="auto"`` dispatch, CPU/disk offload, and 4/8-bit quantization. Offloaded modules hold META parameters between forwards -- the real values live in the hook's ``w...
0355307561f254795ad251a0dfc25e3965db07ffbc578f3bf85b3f399ea3650f
Python
8,857
237
#!/usr/bin/env python3 """ File: plot_double_triangle_heatmap.py Created: 2022/05/21 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...
91c9cf904d6922061f007bb2ca96a21acfc9019e5462e37dbbd600838eb4b351
Python
8,858
186
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license """Shared ReID encoder used by BoT-SORT, Deep OC-SORT, and TrackTrack. * `.pt` YOLO checkpoints — loaded via `YOLO()`; embeddings are pulled from the second-to-last layer through the predictor's `embed=[...]` argument (works with classification and Re...
a33184c1fbfc38d048f516106051a3102f6cd9eff38cadaf46755ccf15a3109c
Python
8,861
222
#!/usr/bin/env python3 """ Dx BA — Pool expansion test (§3.15) redo under proper per-fold ================================================================ Re-runs Dx AR's 7-cohort vs 6-cohort comparison under the proper per-fold per-cohort-deployment pipeline. Tests whether adding ds005385 (Dortmund Vital, 109 HC age ...
d8a6a1fd85d1246a2905c45b70d6f1cfdb2a608b8f198c28511124813c3cd8cc
Python
8,861
333
def filter_map_mean(newtwork, filter_dic): import os # newtwork2022 = newtwork.replace('2018', '2022') outfile = open(newtwork.replace('.', 'EdgeFmean.'), 'w') type_ls_file = open(os.path.join(os.path.split(newtwork)[0], 'excluded_types_list.txt'), 'w') type_ls = [] with open(newtwork)...
76d6664ac64d926618a4504e0c4b446398aa45c32b129bb171e06ad26a51ee7c
Python
8,866
282
# SOURCE: vendored from dipjyoti92/StarGAN-Voice-Conversion-2 @ master # https://raw.githubusercontent.com/dipjyoti92/StarGAN-Voice-Conversion-2/master/model.py # # StarGAN-VC2 (Interspeech 2019): Kaneko et al., "StarGAN-VC2: Rethinking # Conditional Methods for StarGAN-Based Voice Conversion". Community PyTorch # refe...
8e1f940c8c658e89405aea99782d24038e6f77c612ef73c73d3bf72588f5d7a3
Python
8,867
239
import warnings import numpy as np from typing import Generator, Self from mirp._data_import.dicom_file import MaskDicomFile from mirp._data_import.utilities import get_pydicom_meta_tag from mirp._data_import.dicom_multi_frame import (ImageDicomMultiFrame, ImageDicomMultiFrameStack, ...
664d70507593ce3af6c86f5308c7c00717bec657c344bde691ac690857a21fbe
Python
8,869
200
import os import numpy as np import matplotlib.pyplot as plt from os.path import join from library.script_wrappers import find_nidx_along_traj, best_worst_analysis from library.shared_vars import sim_results_dir, plots_dir from library.utils import load_pickle from library.visualization import plot_popras, plot_phase_p...
9726d161f29cd0abe96d81c3a18caa10ed3a0ccc9525ba9cfb59232286049d58
Python
8,870
221
#!/usr/bin/env python """ WandB Script Wrapper This script is intended to serve as a wrapper to execute an existing target Python script without any modifications, while capturing its standard output, standard error, and system metrics (CPU, memory, and GPU) with Weights & Biases (WandB). It leverages WandB's built-...
e67069473fa7c3aaf763230d326c11883c735b7ad878c2a0d901e88734e93fc7
Python
8,871
270
"""IO utility functions. """ import math from typing import Optional, Tuple, Union import cv2 import numpy as np import pandas as pd from anndata import AnnData from scipy.sparse import csr_matrix, issparse, spmatrix from scipy.spatial import Delaunay from shapely.geometry import LineString, MultiPolygon, Point, Polyg...