sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
fc05ec5ee410d55e3e90b59106e4a1412224ed1647042e2ca42c7f9fba927c2c | Python | 6,335 | 185 | """
Unit tests for stimulators/actions.py and stimulators/channel_maps.py.
Tests action classes, action registry, channel map generation,
and LED count-dependent mapping.
"""
import unittest
from ethoscope.stimulators.actions import (
ACTION_REGISTRY,
BaseAction,
LEDPulseAction,
LEDPulseTrainAction,
... |
8e1d731f898eb3bb2beda7cb78a7e3ae72b971a02ee4bb1b12aa225841493638 | Python | 6,336 | 162 | from pytorch_msssim import SSIM
from torchmetrics import MultiScaleStructuralSimilarityIndexMeasure as MSSSIM
import torch
acceleration_factor = 20
# ++++++++++++++++++++++++++++++++++
# MODEL
# ++++++++++++++++++++++++++++++++++
# ResNet dictionary parameters
resnet_options_dict = {'number_layer... |
bcb6ecc5d577a8fc38d76396e952b14d01325a1923293b4874d54468a9775c2b | Python | 6,336 | 181 | from copy import deepcopy
import os
import numpy as np
import pandas as pd
import tensorflow as tf
import tensorflow.keras as keras
import tensorflow_addons as tfa
import gc
from tf_spiking import DenseLIF, DenseLIFNoSpike, IntensityToPoissonSpiking
from tf_spiking.helper import TrainingHistory
from training.brightness... |
f5ca520d5f4eceb963a135dd4e764a0096dd1e91897a6d3d340a3a6b7a397ab1 | Python | 6,336 | 209 | """Tests for predicate-based node skipping in visualization."""
from __future__ import annotations
from typing import Any
import torch
from torch import nn
import torchlens as tl
from torchlens.data_classes.layer import Layer
from torchlens.visualization._render_common import GRADIENT_ARROW_COLOR
def _render_dot(... |
f7f5ec848fa6d55bbdcc296d8435d6f814180647be3216ec1ced8bd283b7012b | Python | 6,336 | 168 | # Copyright (c) 2020 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/LICENSE-2.0
#
# Unless required by app... |
5b5d8c82a5e9e229e318d1adb65dbc7b30326f1fd26f258842efd40cf45867d8 | Python | 6,337 | 178 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
25813b9042140d79a9a0dfec8ffd1156d80906cc5ce533d5c6a30a12b57cf906 | Python | 6,339 | 206 | """PaddleDetection Deformable DETR with compact multi-scale deformable attention.
Zhu et al. (ICLR 2021), "Deformable DETR: Deformable Transformers for
End-to-End Object Detection". Deformable DETR replaces dense attention over
all image tokens with attention over a small set of sampled locations around
reference poi... |
7963ef049147c30b27e7271b4f4e79a7572c964b5c2ed7ec1ee00b8d81511a49 | Python | 6,339 | 154 | """Renderer + export-target door conformance kits (C01 items 16-17).
Seam-closure discipline (memo s10): one out-of-tree instance per seam
exercised on a real model, builtins visible through the same door, a planted
registration WITHOUT capability rows going RED, and the capability gate
refusing an incapable renderer ... |
9018e29c33ab32dea1406b7265013b966a74cadadf228e0a0f361c3f6a3b3d2e | Python | 6,340 | 147 | import sys
import os
import argparse
import build_network
from torchvision import transforms
import pickle
from robustness.datasets import ImageNet
from robustness import train
from cox.utils import Parameters
from cox import store
from robustness import model_utils, datasets, train, defaults
from robustness.data_aug... |
9d2366542b23830d31486707eaa80d086fef6dd1ca9b4b7f25a276d7c12af5b3 | Python | 6,340 | 230 | #!/bin/env python
import ast
import json
import logging
import os
import threading
import time
from optparse import OptionParser
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
DEFAULT_JSON_FILE = "/etc/gpio.conf"
class Output:
"""
Handles GPIO as output
This is meant to be used in a remote thread
... |
e87ba137249f34fe6fc4d3c255b96ac0a915eb5feb8892aa78da8bff459f4dbd | Python | 6,340 | 204 | import json
import argparse
def even(x):
x = int(x)
if x % 2 != 0:
raise RuntimeError("Expected even number but received {}".format(x))
return x
def get_parser():
p = argparse.ArgumentParser()
p.add_argument(
"--CL_max",
default=10000,
type=even,
help="Sh... |
160d772d9c8068bb23702406539a6c4996c25d1466e78e8e50d9d19ddc6511e4 | Python | 6,341 | 181 | """Node-data overlay writer tests (memo D8, B4).
The writer is a thin serializer over the existing draw() overlay vocabulary:
missing, nonfinite, and rolled-varying values are omitted and counted by
reason (never a zero heatmap); value-derived providers refuse typed on
public profiles and value-free captures; the call... |
4c187893d5e9151b834481d249fbde8a29b07c2817dc26100f4076e2bff84523 | Python | 6,341 | 137 | '''
A MPNN for finetuning on the LSF dataset.
'''
import torch
import torch.nn as nn
import logging
logger = logging.getLogger(__name__)
from neural_nets.NMR_4ll_Net import NMR_MPNN
import collections
device = "cuda" if torch.cuda.is_available() else "cpu"
import os
class LSF_MPNN(nn.Module):
def __init__(self... |
92beacabc73bee73e7f6aa57b17974d822d84e6913ac79026973aa53d4608459 | Python | 6,341 | 175 | """Output Biopython SeqRecords and SeqFeatures to GFF3 format.
The target format is GFF3, the current GFF standard:
http://www.sequenceontology.org/gff3.shtml
"""
import urllib
class _IdHandler:
"""Generate IDs for GFF3 Parent/Child relationships where they don't exist."""
def __init__(self):
se... |
bfaada69761518d767df4634552288af2eb076365ae3af3cb66ea83793ddb3aa | Python | 6,342 | 188 | """Typed-code provocation tests for the C05 render-substrate disclosures.
Three C05 warning codes are disclosure-tier (never refusals):
``layout_engine_stderr`` (render_execution), ``collapse_floor_fallback``
and ``collapse_near_uncollapsed`` (auto_collapse, collapse memo D4).
The natural floor/near-uncollapsed provoc... |
bc634a095013f798aae1fbc5578cbced1cc27299e27a78537ef48230028441a7 | Python | 6,343 | 127 | from SocialGNN_withU_modelfunctions import SocialGNN, SocialGNN_E, CueBasedLSTM, get_inputs_outputs, get_inputs_outputs_baseline
import os, sys
import pickle
import numpy as np
from collections import namedtuple
import time
import argparse
from distutils.util import strtobool
parser = argparse.ArgumentParser(... |
6747d5dc889d5eb9385b134327b00e90151ca0688041288b240cf06ff14a4f93 | Python | 6,344 | 197 | import random
from pl_bolts.transforms.dataset_normalizations import (
cifar10_normalization,
imagenet_normalization,
stl10_normalization,
)
from pl_bolts.utils import _PIL_AVAILABLE, _TORCHVISION_AVAILABLE
from pl_bolts.utils.warnings import warn_missing_pkg
if _TORCHVISION_AVAILABLE:
from torchvisio... |
612f796677cefe8f53790266cb47d9a36140f79dc3c706dbd1debaca79930736 | Python | 6,347 | 156 | """
This script shows the training pipeline for k-fold training, without logging it via wandb.
"""
import tensorflow as tf
import tensorflow.keras as keras
import tensorflow_addons as tfa
from sklearn.model_selection import StratifiedKFold
from tf_spiking.helper import TrainingHistory
from tf_spiking import DenseLIF, ... |
74615c9d3646f0c42d2eca416310e59749b9c26ba57d4a4706bf1c4575639477 | Python | 6,347 | 208 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Textfont(_BaseLayoutHierarchyType):
_parent_path_str = "layout.map.layer.sy... |
5b2d10f9ae3f69b93ebe1f29af301ca4fca361bddbd3995f6be4dfeccedc42cd | Python | 6,350 | 192 | # 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/LICENSE-2.0
#
# Unless required by app... |
7cc2d98b6ec464c7f1d81d7305fc50b306545a41f56c1176f0ba641ca88c1095 | Python | 6,352 | 199 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# PyJibe documentation build configuration file, created by
# sphinx-quickstart on Tue Sep 26 17:55:31 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# aut... |
5f4f5be98d963f72c6f754cb3a7b493cf657364ae24989f502e760df6c566ec2 | Python | 6,353 | 175 | # Copyright 2022 Deepfold Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... |
e0b5e3e4ced58dba186257af85b1ccdd6c0e33519ee6d11f8d54b37e1486b19f | Python | 6,353 | 149 | import os
import random
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Dropout, Embedding, Input, Dense, GRU
from tensorflow.keras.models import Model
import utils
'''embed_dim = 128
ff_dim = 128
dropout = 0.1
n_train_batches = 50
batch_size = 128
test_logging_step = 10
train_logging... |
27c27b36212cafb44a0d6460658d626c5a7b8c88264ff5ff3a837ffe6118511e | Python | 6,355 | 182 | """Regression tests for r18rf -- recurrent ``draw_combined`` render-flow crash.
Root cause: ``_render_flow._get_max_call_depth`` crawled the module hierarchy by
indexing ``module_edge_dict[module]`` directly. For a recurrent (multi-pass)
model the combined-graph edge payloads only carry the FIRST-pass call key
(``fc:1... |
9997b290f3e9da69025e1f4ca5b3fedb7d264da0cf0bf755cb0b94a7a47fc00e | Python | 6,356 | 188 | """
Unit tests for drawers/drawers.py.
Tests BaseDrawer, NullDrawer, and DefaultDrawer frame annotation.
"""
import unittest
from unittest.mock import Mock, patch
import cv2
import numpy as np
from ethoscope.core.roi import ROI
from ethoscope.drawers.drawers import BaseDrawer, DefaultDrawer, NullDrawer
class Test... |
cb54d376f460e1396f588519afd98cc1d987df72409139829884c4347916e55e | Python | 6,356 | 153 | # Copyright 2022 Deepfold Team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
e71c6c818a83e9c4d6af01fd81834abccea478d82a12caa0553fe09b76091e20 | Python | 6,356 | 166 | import os
from pyrosm.utils.download import download
from pyrosm.data.geofabrik import Africa, Antarctica, Asia, AustraliaOceania, \
Europe, NorthAmerica, SouthAmerica, CentralAmerica, Brazil, Canada, France, \
Germany, GreatBritain, Italy, Japan, Netherlands, Poland, Russia, USA, SubRegions
from pyrosm.data.bb... |
69c336bc391484590b04bda6db272eabd4177b068b3298b8b48c345e6759a618 | Python | 6,359 | 158 | # Copyright Niantic 2019. Patent Pending. All rights reserved.
#
# This software is licensed under the terms of the Monodepth2 licence
# which allows for non-commercial use only, the full terms of which are made
# available in the LICENSE file.
from __future__ import absolute_import, division, print_function
import o... |
282f698dae504f56cc80af3b6462fbe0902510284402097a61129f97544aed07 | Python | 6,362 | 178 | """A wrapper for video recording environments by rolling it out, frame by frame."""
import json
import os
import os.path
import tempfile
from typing import List, Optional
from gym import error, logger
class VideoRecorder:
"""VideoRecorder renders a nice movie of a rollout, frame by frame.
It comes with an `... |
6dd59ef54dc71270fe043c7defd644bdeb44ddcbfb7f3561e8ec6e5e0f448d11 | Python | 6,363 | 189 | """Functions for working with atlases."""
from nipype import logging
LOGGER = logging.getLogger('nipype.utils')
def select_atlases(atlases, subset):
"""Get a list of atlases to be used for parcellation and functional connectivity analyses.
The actual list of files for the atlases is loaded from a different... |
8600ee98aab91c4be00af4220b030e37745b25ce4adc8d6b08a31193ac65a341 | Python | 6,363 | 177 | # SOURCE: vendored from NVlabs/sionna @ 04ddb9312116b408093b9d3ad363a3df355093a6
# (tutorials/phy/Neural_Receiver.ipynb, classes ResidualBlock / NeuralReceiver). The queue's
# "Sionna Neural Demapper" candidate refers to this component: Sionna's official convolutional
# neural-network OFDM receiver, which replaces clas... |
972b80c01f0c4c52e632cb96ce9f647395a129bee37198839c9e6e15f8d8473e | Python | 6,364 | 171 | """
===============================================================================
Estimate mean of SPD matrices with NaN values
===============================================================================
Estimate the mean of SPD matrices corrupted by NaN values [1]_.
"""
# Author: Quentin Barthélemy, Sylvain Che... |
4989c514be081b652d0b27feaf007bb76115c490cf030282064585548e60c9ee | Python | 6,366 | 164 | """tlspec v9 annotation-family admissions (C07 coordinated schema write).
Three reserved ``Trace.annotations`` families settle at v9:
- ``"sidecar"`` (C01 seam): flips from the pre-release registrar to plain
persistence; loads validate the namespace/envelope SHAPE fail-closed while
payload semantics stay with the... |
9e98d9ac6cdc984be12836929c4215781347dac3f58ae3184d3920ba6edf03dd | Python | 6,366 | 66 | import torch
import copy
import time
import os.path
from os import path as osp
import utility
import data
import model
import loss
from option import args
from trainer import Trainer
from torchinfo import summary
from thop import profile, clever_format
from tqdm import tqdm
from util.interpret_tool import get_model_i... |
44b444ec9ecb5bb5eb5ba318b8acd8dd2c10ebbe1dd81950b683ab8e08acde21 | Python | 6,367 | 167 | """Bound-method roots on REAL models (lane F41; foldA MEMO s6 F41 plan).
The realism arms the ruling names, on the R0 roster's REAL classes
(vendored tiny configs, zero network): ``tl.trace(model.generate, ids,
episode=...)`` on distilgpt2, greedy and sampled; a BERT bound-method
encoder; ``model.forward`` as the triv... |
5b3b9ceaaf6f3e01cf2869855670f8035b325bc908bf0a1727b970f5c90420e9 | Python | 6,367 | 166 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
d732c406be628eb8633a031fe9f9d70f9b34bcb023c90c6e450cc23dbd0fb012 | Python | 6,369 | 178 | """Debugger/IDE DX contract for record objects (god-object facade gate).
The columnar facade work must keep every declared field visible to the exact
enumeration protocol IDE debuggers use (pydevd/debugpy: ``dir(obj)`` then
``getattr``), backed by a real inspectable descriptor (slot, property, or
instance-dict entry) ... |
3376dd3188b60416ef3a63a08b9a9193f5ca1b51970efb5318bac50d1f9bf5d1 | Python | 6,370 | 193 | # coding=utf-8
# Copyright 2025 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
49974d7e83e6ee3da2eb34f64a18a8efdcc481ba6b3e951ee899a9404e1a9dd7 | Python | 6,370 | 197 | from dependency_injector import containers, providers
from carbonserver.api.infra.database.database_manager import Database
from carbonserver.api.infra.repositories import (
repository_emissions,
repository_experiments,
repository_organizations,
repository_projects,
repository_projects_tokens,
... |
6d16197c2ece240ac58d50582863d9e2ab91da4059f5cf372bbfd6a7ab052b68 | Python | 6,370 | 185 | """Runs st.tl.cci.run once and saves its results and measurements as h5ad.
The acceptance test runs this in a fresh process, so the peak memory is this
run's alone:
python -m tests.acceptance.run_cci SAMPLE.h5ad RESULT.h5ad [--use-label]
numba's functions are compiled on a small slice first, so the timed run is
... |
e9640631b3acf582b266c5aaa2f80b5e90aee6c0f4900e9c0b683fe837cb70f9 | Python | 6,371 | 147 | # FAITHFUL PORT of aquaskyline/Clairvoyante @ master (original framework: TensorFlow 1.x,
# `clairvoyante/clairvoyante_v3.py`)
#
# Clairvoyante (Nat. Commun. 2019) is the direct predecessor to Clair3 (see the
# `HKU-BAL/Clair3` entry in this same batch, which vendors Clair3's real torch code):
# a small variant caller ... |
38b27f8f2296ae5c4da088538a7e31317db4ff80b06b01adc92dcfda24145da4 | Python | 6,374 | 123 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
41fd504629c114f25948cd20d2b57574db278d6c46d3584112b23390f9f7d87b | Python | 6,374 | 123 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
7369ea672550b1c84677bce4b8a9cadc0b8409548e5175e00ea2e66b198f2e6c | Python | 6,374 | 166 | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
a3861c8cbd4ff766cf56037e5878f8ca57fe5da96808cb73156a92b2a0bf1fe8 | Python | 6,374 | 123 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
b59cc72bba7ac6334a649a20cd3a46ce4ec217fb7bf512d301746bb6213f9170 | Python | 6,374 | 123 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
074b857670b550a69e81037812aacaa321841593c683a2f789fa67b2587771ab | Python | 6,375 | 188 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import tensorflow as tf
import pandas as pd
import argparse
import os
import sys
import pwd
import pdb
import csv
import re
import math
from collection... |
2777c4ec9b72c60f005f40bff78c84029bdf3b6a6dd05a09e211e6285577906a | Python | 6,375 | 159 | import warnings
from typing import Any
import numpy as np
from mirp._images.generic_image import GenericImage
from mirp._masks.base_mask import BaseMask
def discretise_image(
image: GenericImage,
mask: None | BaseMask,
discretisation_method: None | str = "none",
intensity_range: None... |
94aec48a57e19cf4b49084cae6144a1721617400f6ccb80c49819e0de2461389 | Python | 6,375 | 163 | """pyrosm's log messages: one line per event, ``"<op> key=value ..."``, written through the
standard ``logging`` module under the ``pyrosm`` logger."""
import contextlib
import functools
import inspect
import logging
import re
import shlex
import threading
import time
logger = logging.getLogger("pyrosm")
# The handl... |
756f4e9be2fa62caf5c091d7c0a30187c4e4c736600db540e29d14240962e5a3 | Python | 6,377 | 179 | """Implementation from https://github.com/RobertTLange/gym-hanoi/blob/master/gym_hanoi/envs/hanoi_env.py"""
import itertools
import random
from typing import Union
import gymnasium as gym
import numpy as np
from gymnasium import spaces
from angorapy.common.senses import Sensation
from angorapy.tasks.utils import con... |
795527c6441363663a46d6a7530e374a74c26b063f78d32eb5f22eee1159fba5 | Python | 6,377 | 208 | """Text formatting utilities."""
from __future__ import annotations
import io
import re
from functools import partial
from pprint import pformat
from re import Match
from textwrap import fill
from typing import Any, Callable, Pattern
__all__ = (
'abbr', 'abbrtask', 'dedent', 'dedent_initial',
'ensure_newlines... |
c532e3a148374e1724c6bbd9b180dba3eb07c5d1d0793818a37cf6fa1e6da46f | Python | 6,380 | 190 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
updated by: Jin Hirano
updated by: fcheng Tue Jan 17 17:16:48 2023
"""
import argparse
import os
import glob
import scipy.io as sio
import numpy as np
import torch as th
import torch.distributed as dist
from diffusion.guided_diffusion import dist_util, logger
fro... |
8c09be57632f3a25653c8e4d48ce4b8dcbf9d370ce8be771c087312d522bfdb3 | Python | 6,381 | 224 | import numpy as np
from tensorflow.keras.metrics import CategoricalAccuracy
import tensorflow as tf
from pdb import set_trace
from cvnn.metrics import ComplexAverageAccuracy, ComplexCategoricalAccuracy
def test_with_tf():
classes = 3
y_true = tf.cast(tf.random.uniform(shape=(34, 54, 12), maxval=classes), dtyp... |
ea8f29e00a23b43b9cdf9ed3b1aa230121adaa7b9629090c220b586e140a38b2 | Python | 6,381 | 155 | """
TensorFlow 2 OscoNet code
"""
import numpy as np
import pytest
import tensorflow as tf
from OscopeBootstrap import qvalue
from OscopeBootstrap.create_edge_network_represention import create_edge_network_representation
from OscopeBootstrap.oscope_tf import PRECISION_fp, calc_e2, calc_e2_many_genes, find_best_psi_fo... |
f070da3d546c3936dbe5a0b8d9380f76a3d48006c3c517c76833e2a8b0763ee4 | Python | 6,381 | 152 | """C02 import lints: one compute reader, no health truthiness (costreport D1, sumfam D5).
Two package-wide AST lints with reason-bearing ledgers (the op-lane
inplace-writer precedent): a NEW module reading raw per-op compute fields
or branching on ``nonfinite_ops`` goes red until consciously ledgered.
"one source" as ... |
3b4e90076f39e1ce8b47d814f641cf6661ad8b5b899bc79bef486a8b1e58837e | Python | 6,382 | 162 | """Implementation of a space that represents the cartesian product of other spaces."""
from collections.abc import Sequence as CollectionSequence
from typing import Iterable, Optional
from typing import Sequence as TypingSequence
from typing import Tuple as TypingTuple
from typing import Union
import numpy as np
from... |
5b5d22594052122a96be9875428f0e9f41a2030692c888318ecdc70459036006 | Python | 6,383 | 168 | """Classify global cysts"""
from PIL import Image
import numpy as np
from skimage.filters import threshold_otsu # pylint: disable= no-name-in-module
import pandas as pd
from scripts.utils.constants import CSV_ORG_OVERVIEW, CSV_GLOBAL_CYST_ANNOT
from scripts.utils.minor_utils import make_mask_arr_visible
from scripts... |
6dd0844c36e69962f11f22524a1fb0c4303d9b44deb75298e5f6f32de2825caf | Python | 6,383 | 188 | """Echo format contract: byte stability, CI cleanliness, volume honesty.
Pins snoop memo test 12 (byte-stable transcripts, zero escape bytes off-tty
-- the escape-leak regression class behind the ``terminal_file_line_link``
defect), the max_lines suppression accounting, the zero-match disclosure,
and the hard grammar ... |
951bbf977d95e100d19ee911e6eb528c723d14c6c0055e9b2629fc6c7464c8dd | Python | 6,384 | 172 | import warnings
from functools import partial
import pytest
import torch
from torch import Tensor, nn
from lightly.models import utils
from lightly.utils import dependency
if not dependency.timm_vit_available():
# We do not use pytest.importorskip on module level because it makes mypy unhappy.
pytest.skip("T... |
c27db4e7b078f787d127c99d53e23a01b2013bd822390298524f5665c1ca0aff | Python | 6,384 | 154 | """S-18 warning contract: chokepoint, contract table lockstep, ratchet (row 0.4).
ZERO of the package's warn sites carried a machine-readable code before this
wave (memo D7). The mechanism: ``TorchLensWarning`` gains the error base's
remedy chokepoint (``fields["remedy"]`` derived from the authored
``Remedy: ...`` tai... |
f65485d7932cb31684dd74940b652eec14068137603380bcc08472ae8f550ca0 | Python | 6,385 | 165 | # -------------------
# get average cross-validation auc from 5 runs
# -------------------
import os
import sys
import time
import random
import numpy as np
import pandas as pd
import tensorflow as tf
from DePTH import _utils
def cv(hla_class, data_dir, average_valid_dir, enc_method,
lr, n_dense, n_units_... |
232b4cf8d74bd8b99662e6eda24e7ee36b87f0d9e93e14ada970207f8090db84 | Python | 6,388 | 124 | # Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com)
# PLUS
import os
import sys
import argparse
import torch
import plus.config as config
from plus.data.alphabets import Protein
import plus.data.pfam as pfam
import plus.data.dataset as dataset
import plus.model.plus_rnn as plus_rnn
import plus.mo... |
9a28d517153801573f6f7cdb8bd8b1a0b5fb5bd29b48a8dea3f445a1daab3f28 | Python | 6,388 | 154 | import os
ROOT_DIRPATH = '/home/bb596/hdd/'
if not os.path.exists(ROOT_DIRPATH):
print('You may want to define your own root directory, currently setting to "./"')
ROOT_DIRPATH = './'
# These URL needs to be provided by the user, as PDBbind is under license
# and requires to be logged in. The "Cloud CDN" link... |
73df8f3c494e89d919934598d9485fa6741e4fa430f6fa70a06546624d8fc3e7 | Python | 6,391 | 177 | """Data/controller layer for the Parameter Database popup.
Queries `larvaworld.lib.reg.par` (the global `ParamRegistry`) and returns
plain data structures (DataFrames, dicts) for the Panel UI layer to render.
No Panel/Bokeh imports here.
"""
from __future__ import annotations
from typing import Any, Optional
import... |
026cb2e0c877a10692251789511e8495eab3d6cff9ff1b472e95aa053af41590 | Python | 6,392 | 177 | """Unit tests for the generic canvas placement helpers.
Pure Python, no Panel/Bokeh dependency -- these operate purely on object
ids, coordinates, and caller-supplied callables.
"""
from __future__ import annotations
from types import SimpleNamespace
import pytest
from larvaworld.portal.canvas_widgets.placement_co... |
774829669291297ce97f18a66a57d8e36e24014f623997f8235267482e9a60b4 | Python | 6,392 | 155 | import sys
import traceback
from typing import List, Optional, Tuple, Type
import geocoder
import pandas as pd
from carbontracker import constants, exceptions, loggerutil
from carbontracker.emissions.intensity.fetcher import IntensityFetch, IntensityFetcher
from carbontracker.emissions.intensity.fetchers import elect... |
446647893ac99764ba705ab76118ebebe6b9f3997e44eb38f852094167921bb8 | Python | 6,393 | 129 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any
import cv2
@dataclass
class SolutionConfig:
"""Manages configuration parameters for Ultralytics Vision AI solutions.
The SolutionConfig cla... |
3bf35417bf8ddd84a4c28cc55a7b8d2ca581956edd1ec5db8a280c95647c77c3 | Python | 6,399 | 187 | import numpy as np
import numbers
from warnings import warn
def initialize_sigma2(X, Y):
(N, D) = X.shape
(M, _) = Y.shape
diff = X[None, :, :] - Y[:, None, :]
err = diff ** 2
return np.sum(err) / (D * M * N)
class EMRegistration(object):
"""
Expectation maximization point cloud registra... |
5853a388c0078433c4715c44cacc94235f5573daf2b7725b80901e24c5f11030 | Python | 6,400 | 217 | from multiprocessing import freeze_support
import Functions
import matplotlib.pyplot as plt
import mne
import numpy as np
import pandas as pd
if __name__ == "__main__":
freeze_support() # Necessary for parallelization
matdir = "./data/exp1" # Data directory, exp1 or exp2
matpathlist = Funct... |
6ab1b328ba4b49c9d1edffc376ea56ba96b3ba4de018449bb9fbfaa27980f12a | Python | 6,402 | 190 | # Copyright 2025 Google.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... |
89b57623bff5ebc2eeb45d7614bb995a65661b4e1e10ace145d53b31a96e3841 | Python | 6,402 | 188 | # Import necessary libraries
import argparse
import logging
from pathlib import Path
import numpy as np
import onnxruntime as ort
import yaml
from nibabel import load, save, Nifti1Image
from BM3D.src.denoise import bm3d, bm3d_CEST
from NLM.src.denoise import nlm, nlm_CEST
from PCA.src.denoise import pca
root = Path(... |
85a7cbfe5b28b9b5ba4545b766c231e8b3b6b60bb65c92a531e6629ae8add956 | Python | 6,404 | 188 | """
Logic behind the portal's landing registry.
Validates the registered entries, resolves their targets and computes the
badges and primary action each card shows.
"""
from __future__ import annotations
import warnings
from larvaworld.portal.landing_registry import (
ITEMS,
LANES,
PINNED_QUICK_START,
... |
a9b9a5584d9a8bbc5790afc64ea09eba31a59efffbeb8a1f98ba82e0e5eda78c | Python | 6,409 | 174 | import torch
from typing import Sequence, List
from .conf_ranker import ConfRanker
from bioconfpred.model import ConfPredModel
from rdkit.Chem import Mol
from torch_geometric.data import Data
class ModelRanker(ConfRanker):
"""Can rank conformers based on ConfPredModel (RMSD) outputs
:param model: Input train... |
8b5b2d455d804690cee1eb02a44aab88657b5161dd0841583128b6b673899c03 | Python | 6,411 | 201 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from matplotlib import cm
from causal_optoconnectics import causal_connectivity
from causal_optoconnectics.cch import fit_latency
from causal_optoconnectics.generator import simulate_simple_conditional_response, generate_poisson_stim_times
from tqdm... |
f967f4dc34ef404383a0d78e8ac6eca3e44652176b08d9bf763bd67ae984f698 | Python | 6,411 | 195 | # Copied from an older version of the pl_bolts library
import numpy as np
from pl_bolts.utils import _OPENCV_AVAILABLE, _TORCHVISION_AVAILABLE
from pl_bolts.utils.warnings import warn_missing_pkg
if _TORCHVISION_AVAILABLE:
from torchvision import transforms
else: # pragma: no cover
warn_missing_pkg("torchvis... |
2cc677747df936c2db3607c7a1d8214fcefd9eddc49ea641f6d10a14e788126e | Python | 6,412 | 127 | import torch
from .base_model import BaseModel
from . import networks
class RawGANModel(BaseModel):
""" This class implements the pix2pix model, for learning a mapping from input images to output images given paired data.
The model training requires '--dataset_mode aligned' dataset.
By default, it uses a... |
e14cef08fc7d2426eb23ccb4113a93c096eb0c1eeaa1d40a71cbebec28263fed | Python | 6,413 | 189 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
# %%
class torch_inplane_grid_augmentations(nn.Module):
def __init__(self,
p_rot=0.2,
p_zoom=0.2,
p_scale_if_zoom=0,
p_transl=0,
p_shear=0,
... |
0894cf3e8af5246c2aca622dc0d1540cc675bcfa795a2c0dac678dedc8ed2dc2 | Python | 6,414 | 182 | """Vizmech wave-3 items 21-22: theme x direction x depth x format x engine gate.
Pairwise coverage per PR (memo s7 axes; the full cross-product is a scheduled
venue). Every render is audited THROUGH THE ENGINE THAT RENDERED it (D4/D8:
the same cluster measured 356 pt under dot and 1260 pt under ``neato -n``),
and ever... |
75587df090ea562d51e1ceb9e5c3dbaac1eb12fdb75c1f28aad54f52cc0c017f | Python | 6,414 | 229 | from abc import ABC, abstractmethod
from typing import Tuple, Union
import numpy as np
import scipy.special
class UpdateRule(ABC):
def __init__(self, alpha: float):
"""
Implements an update rule for a linear learner. Assumes that all features have at most norm 1.
:param alpha: the normali... |
e92d056abb03f248e4464fa9cf8847aaabef8c6c7cb17017cc7b91b6016022df | Python | 6,414 | 183 | #################################################################################################################################################################
####################### Testing MRB ########################################################################################################################
#... |
53b2571f8f5a859f576cb8b46f193cc5d55b38dfa0243e910f05949a29e95ad5 | Python | 6,415 | 155 | """Observer/check slot tests: event schema + subscriber isolation (checks 4.7)."""
from __future__ import annotations
import pytest
from torchlens.errors._base import TorchLensWarning
from torchlens.observability import EventStream, ObserverEvent, ObserverEventError
from torchlens.observability._chassis import SUBSC... |
5e8602eff31686a8deeac005222872452cbc8b17848d113ba427260e7b185c30 | Python | 6,417 | 174 | import os
import albumentations as A
from albumentations.pytorch import ToTensorV2
import numpy as np
import cv2
from torch.utils.data import Dataset
from utils import *
import random
from matplotlib import pyplot as plt
from config import *
import copy
def visualize_augmentations(dataset, samples=10, cols=5):
"""... |
9e75fef40eae21e76f7c0550aad7f7f9722f68640ba63db67c0a24cc6b71bd72 | Python | 6,417 | 223 | # from cProfile import label
import os
import pickle
# from select import select
import cv2
import numpy as np
import pandas as pd
from anndata import AnnData
from scipy.sparse import csr_matrix
# image = np.zeros([15,15])
# cv2.ellipse(img=image, center=(5,14), axes=(4,2), angle=0.0, startAngle=0, endAng... |
e3895239b6c7a860ffa51660509ea378ef38d5b640288b0503cebcdbbb8bb6ff | Python | 6,417 | 179 | """
The workflow builder factory method.
All the checks and the construction of the workflow are done
inside this function that has pickleable inputs and output
dictionary (``retval``) to allow isolation using a
``multiprocessing.Process`` that allows XCP-D to enforce
a hard-limited memory-scope.
"""
def build_work... |
2c5b9da4291baf2fd948a3b2f4c317df07281367976faf3ed23ed7a74575700b | Python | 6,421 | 167 | import mxnet as mx
import numpy as np
import os, time, logging, argparse, shutil
from mxnet import gluon, image, init, nd
from mxnet import autograd as ag
from mxnet.gluon import nn
from mxnet.gluon.data.vision import transforms
import gluoncv as gcv
gcv.utils.check_version('0.6.0')
from gluoncv.utils import makedirs
... |
31a3a961035b202c280a639fca5165cd85dcf9c223b7cb177a8a8c223f503f9e | Python | 6,423 | 173 | """Tests for bdpy.recon.torch.modules.critic."""
import unittest
import torch
from bdpy.recon.torch.modules import critic as critic_module
class TestBaseCritic(unittest.TestCase):
"""Tests for bdpy.recon.torch.modules.critic.BaseCritic."""
def setUp(self):
self.features = {
"conv1": tor... |
89d241377069bfe49f7740893a7d91a69482fdfbdf438ebec88b99ae31d58147 | Python | 6,424 | 172 | import pkg_resources
import nanite
from PyQt5 import uic, QtCore, QtWidgets
from .mpl_qmap import MPLQMap
from ..head.custom_widgets import show_wait_cursor
class QMapCache:
"""Caches QMap data based on AFMGroup paths"""
_cache = {}
@staticmethod
def get_qmap(fdist_group):
path = fdist_gro... |
a2b8c0cef8c29283dfc8fa781e6df8172238f4b74c374ea51a9be9236540ce3c | Python | 6,424 | 208 | import tempfile
import os
import cv2
from threading import Thread
from ethoscope.tracking.monitor import Monitor
# Interface to V4l
from ethoscope.tracking.cameras import V4L2Camera
from ethoscope.tracking.cameras import MovieVirtualCamera
# Build ROIs from greyscale image
from ethoscope.tracking.roi_builders import ... |
e2946d1c4e95ff5fafbfb27be06a4ea9f9f7e2a509e7530ca769023e72f4a046 | Python | 6,424 | 166 | """
Created on January. 05, 2018
@authors: Kenzo-Hugo Hillion and Fabien Mareuil, Institut Pasteur, Paris
@contacts: kehillio@pasteur.fr and fabien.mareuil@pasteur.fr
@project: galaxy
@githuborganization: C3BI
Phylip datatype sniffer
"""
from typing import TYPE_CHECKING
from galaxy import util
from galaxy.datatypes.... |
cf70aef45adbb7f0b145a26f94433be3093a0b142a61e0072d1ec5786f221962 | Python | 6,426 | 162 | # 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... |
d4e4b1f857667b390fe4851e7081844b15a848f79b3fc3df14dc33a51f1afca0 | Python | 6,426 | 166 | import copy
from typing import List, Tuple, Union
import torch
from pytorch_lightning import LightningModule
from torch import Tensor
from torch.nn import Identity
from torch.optim import SGD
from torch.optim.optimizer import Optimizer
from torchvision.models import resnet50
from lightly.loss import DINOLoss
from lig... |
7dc8970b4950892b3ad26fd24c4fa05923e399df081e039fa516215adba1960a | Python | 6,427 | 163 | """
===============================================================================
Mean and median comparison
===============================================================================
A comparison between Euclidean and Riemannian means [1]_, and Euclidean and
Riemannian geometric medians [2]_, on low-dimensiona... |
adda360702a14981198c0209f3ca9050ae61d548643730ecc9a86881eb338e2c | Python | 6,427 | 219 | """Compatibility tests for additive influence-geometry result metadata."""
from __future__ import annotations
import pickle
from dataclasses import fields
from fractions import Fraction
from torchlens.receptive_field import (
GradientReceptiveField,
GridLayout,
ReceptiveField,
ReceptiveFieldAlignment... |
093c829937d17dec1a6a816b684ec0840cd3ace7aa13d7a983e368343e215aa4 | Python | 6,429 | 167 | """
===============================================================================
Mean and median comparison
===============================================================================
A comparison between Euclidean and Riemannian means [1]_, and Euclidean and
Riemannian geometric medians [2]_, on low-dimensiona... |
071432fd0264ed9a27f2de4daad32ef6642e9565d61d34cd56f461f11b28dce2 | Python | 6,430 | 185 | import logging
import os
import subprocess
import tarfile
from . import util
from .exceptions import CompressionError
logger = logging.getLogger(__name__)
EXTENTIONS = {
".bz2": ("lbzip2", "bzip2"),
".gz": ("pigz", "gzip"),
".zz": ("pigz", "gzip"),
}
archive_extension = {
"lbzip2": ".bz2",
"bzip... |
87021df51589ec18fb63ee94608cbec20960d1c90a1b76f93d4992c32824fa25 | Python | 6,430 | 164 | """F26: the executed-DAG graph IR + the (gated) TB ingest pin (memo 3.14).
The IR layer is dependency-free and carries the join oracle; the event-file
ingest pin runs only where tensorboard is installed (the packaged extra).
Realism: the graph builds from a REAL captured trace of a real conv
architecture (never ``jit.... |
947d18493fbd235f28bcf16cc656fe95c4f1c4518bb635403aca737ee2d1f797 | Python | 6,431 | 139 | """
Transposable element analyzer.
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... |
ff4fa47fa672e13129fd92efd7be5dea6116a127b61434f761526323638e736c | Python | 6,431 | 198 | """Medians of SPD/HPD matrices."""
import warnings
from array_api_compat import array_namespace as get_namespace
from ._check import check_weights
from .base import sqrtm, invsqrtm, logm, expm
from .distance import distance
from .mean import mean_euclid
def median_euclid(X, *, tol=10e-6, maxiter=50, init=None, wei... |
a81ad0b79bd666e493a58d2da2a975715d6974c936b28dbe0b84bbdb5fd00735 | Python | 6,432 | 194 | # 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... |
9aaa7d00c2b630826397f9f48071cea84b342726472a86b0fc1a8847d03ee6b7 | Python | 6,433 | 198 | from io import StringIO
from os import path as opath
from codegen.utils import write_source_py
# Build dict with info about deprecated datatypes
DEPRECATED_DATATYPES = {
# List types
"Data": {"base_type": list, "new": ["Scatter", "Bar", "Area", "Histogram", "etc."]},
"Annotations": {
"base_type": ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.