sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
da280f9f23b13af905e360bd7573b3d713ca7ccc8c5b4a44b431cc543be58f23
Python
12,576
409
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Oct 12 14:08:23 2018 @author: johan """ import mne import numpy as np import matplotlib.pyplot as plt import copy import pdb import scipy import struct import json import re def convert_eeg_marker_meta_to_mne(fbase): fhe=open(fbase + '.eeg'...
87f3880c260e828791b48f5e101b52678ede1fd543cf8e2cfbd2352d32e1ca25
Python
12,577
301
import torch import torch.nn as nn import torch.nn.functional as F from ..modules.module import Module class StandardUNet(Module): """ Standard UNet based on Paper https://arxiv.org/abs/1505.04597 . :param in_channels: number of input channels (1 in standard configuration) :param out_channels: numbe...
9b337da31039be7c12776281a7f8f550ffced3e1c0206569d04965f201f7cce9
Python
12,577
259
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
9f570506a4e72c873100e0a564c80e06a10b8c48f280304f67dcfe43b834a954
Python
12,580
346
from __future__ import absolute_import import logging import os.path import re from pip._vendor.packaging.version import parse as parse_version from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._vendor.six.moves.urllib import request as urllib_request from pip._internal.exceptions import BadCom...
df6f2b9368aa78fb04fd7aa33bbdcb2f67442f9a0616510e73ed171561a8f8d3
Python
12,588
348
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Confound matrix selection based on Ciric et al. 2007.""" import os import warnings from pathlib import Path import numpy as np import pandas as pd from nipype import logging from scipy.signal import bu...
cff44774ce6a137b40171420aacbd79bfd6d8e74711362a52f8f12d041699767
Python
12,593
402
""" FormDefinition and field factories """ # TODO: A FormDefinitionField is closely linked to a form_builder result. # Can this functionality be further abstracted and merged with form_builder? from galaxy.model import ( FormDefinition, FormDefinitionCurrent, ) from galaxy.util import string_as_bool FORM_TYPE...
19bbe54806872ccce78f637abc505b022506dcb112d43daf676eb5a38853478e
Python
12,594
266
import json import numpy as np import os, sys from collections import Counter from sklearn import preprocessing from sklearn.metrics import f1_score from sklearn.metrics import confusion_matrix import torch import torch.nn as nn import torch.nn.utils.rnn as rnn_utils import torch.nn.functional as F from torch.utils.dat...
08f808dcfe954a31730d13b5131bc1f4cd2321c3978c3ef2cd6af66efe8ef6c6
Python
12,596
305
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created in April 2022 @author: Simon Delarue <sdelarue@enst.fr> """ from typing import Iterable, Optional, Union from collections import defaultdict import numpy as np from scipy import sparse from sknetwork.classification.metrics import get_accuracy_score from sknet...
1cfc86e8b77f4fd32f74dca0cff951c83a4ba287c19ee4e07ef3d5b7263db252
Python
12,597
321
"""Regression tests for r18l viz-plots + rank layout + graph caption findings. Covers: - H10 caption ``[:-2]`` left ``</FONT`` unterminated -> GraphvizRenderError on any ``_has_direct_writes=True`` trace. - M4 rank ``_compute_topological_layout`` sibling order depended on set/hash iteration -> nondete...
493665c0e466396d053f6f424bdf1c5c3fa19b8c4fc447d22d6f3abbecfcd192
Python
12,600
339
# SPDX-License-Identifier: LGPL-2.1-or-later from __future__ import print_function, division, absolute_import import unittest from collections import OrderedDict import numpy as np from pyEcoHAB import cage_visits as cv from pyEcoHAB import sample_data, data_path from pyEcoHAB import Loader from pyEcoHAB import Timeli...
f3df53c6dac16ab89546103ff5251a5f052497b1610e066331cddabb8b7b5677
Python
12,600
326
# 2020.11.06-Changed for building GhostNetV2 # Huawei Technologies Co., Ltd. <foss@huawei.com> """ Creates a GhostNet Model as defined in: GhostNet: More Features from Cheap Operations By Kai Han, Yunhe Wang, Qi Tian, Jianyuan Guo, Chunjing Xu, Chang Xu. https://arxiv.org/abs/1911.11907 Modified from https:/...
ca09b33d72bd774fe25575803e8024c5a54f8ef21ccfdceba5a02950d4e591aa
Python
12,601
514
"""Miscellaneous compact reimplementations for dependency-gated targets.""" from __future__ import annotations import torch import torch.nn as nn import torch.nn.functional as F class FedProxCNN(nn.Module): """Small MNIST CNN commonly used with FedProx/FedAvg experiments.""" def __init__(self, classes: int...
649dd6be66e5f29591a170121b604018d50c45af9b8e23dbdc9a0d52d3866c50
Python
12,603
302
"""AUD-CODE 2.12 (lane W051-SEMANTIC): half-precision norm reconstruction. The shared norm linearization (``torchlens.semantic._norm_reconstruction``) recomputed a norm in the PAYLOAD dtype -- five bf16 roundings -- while the reconstruction tolerance model (``torchlens.semantic.tolerances``, ``RECONSTRUCTION_ULP_HEADR...
22c7979d3e839a50574e20945939ac6844600ab195a9bb20515fa67bebcc96c9
Python
12,604
348
# -*- coding: utf-8 -*- # Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl> # All rights reserved. """ Module providing generic info file proxy. Author: Mateusz Kruszyński <mateusz.kruszynski@gmail.com> """ import xml.dom.minidom from . import signal_exceptions from . import signal_l...
e43ea8bff3a98953f6c0d783fadfbbd3bf9c7a24858eed07e66f1893eabbdbd6
Python
12,605
265
import json import numpy as np import os, sys from collections import Counter from sklearn import preprocessing from sklearn.metrics import f1_score from sklearn.metrics import confusion_matrix import torch import torch.nn as nn import torch.nn.utils.rnn as rnn_utils import torch.nn.functional as F from torch.utils.dat...
08fe1003befd877fc1e51b3d58c8b92e1d6eb96106c219d691abe13c0ea60446
Python
12,606
310
"""A set of functions for checking an environment details. This file is originally from the Stable Baselines3 repository hosted on GitHub (https://github.com/DLR-RM/stable-baselines3/) Original Author: Antonin Raffin It also uses some warnings/assertions from the PettingZoo repository hosted on GitHub (https://github...
606b297b26e593be7f44ce8e035401e8fc41c75d3a14126386e15deb06eca2e0
Python
12,609
347
#! /usr/bin/env python # -*- coding: utf-8 -*- """ controllers: arm_controller : 7 joints, arm1: 0.07-2.67, arm2: -1.5-1.02, arm3: -3.46-1.5 arm4: -0.32-2.28, arm5: -2.07-2.07, arm6: -1.39-1.39 arm7: -2.07-2.07 ...
4e5e065fd83abcdc08b5ebed66936e0c29e2c1d5015a68d951546b8ee75f0f69
Python
12,612
370
# 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...
a710eca47ce09df082fc387c6a05cacf41113569505c87ad276ff42417ac5a1c
Python
12,615
287
# pylint: disable=line-too-long,too-many-lines,missing-docstring,arguments-differ,unused-argument import mxnet as mx from mxnet import init from mxnet.gluon import nn from mxnet.gluon.nn import HybridBlock from gluoncv.model_zoo.googlenet import googlenet __all__ = ['inceptionv1_ucf101', 'inceptionv1_hmdb51', 'incepti...
0a5d1822f82c3225b9533d9cd8ae2c380a356999a1e9360539a443a628465134
Python
12,617
235
from src.cfg import * sys.path.append('') from src.utils import * from src.neuron_morphology import NeuronMorphology import src.convertAllenSpace as CAS class NeuronPopulation: """Class to manage and extract statistics from a population of neurons.""" def __init__(self, data_path: str, res: int): "...
95966a5dabf12f3a3804ec790b038e9e559d2ef72b65a867bb79421e4a9a7898
Python
12,618
343
""" This module is an adapted version of the spiking neural network model of the saccade generator in the reticular formation, originally developed by Anno Kurthwith support from Sacha van Albada. The original work can be found at https://github.com/ccnmaastricht/spiking_saccade_generator. Adaptations were made to i...
062276d388b97aaa57105e2f08d13136d864ee82a4562aa44f3f0241b489e079
Python
12,619
333
# -*- coding: utf-8 -*- import logging import os import tempfile import numpy as np from dipy.io.stateful_tractogram import StatefulTractogram from dipy.io.streamline import load_tractogram from scilpy import SCILPY_HOME from scilpy.io.fetcher import fetch_data, get_testing_files_dict from scilpy.tractograms.streaml...
7683715a8a5bc8815e0108c61b5cafdef3ec9146981358ab6831ee7ca1cf7b1c
Python
12,619
344
"""``tl.validate`` save options: ``output_device`` and ``save_budget``. The validator capture saves every activation; these keywords give it the capture API's own save options (same names, values, and defaults as ``CaptureOptions``) so a GPU model can validate with its activations held in host memory. The CUDA tests a...
5d072ed5355bd08cc81ca75842869d1e7b836720e3dadeb067266c6847bf9157
Python
12,624
316
#!/usr/bin/env python3 """plot_matches.py Top level command-line interface for generating plots related to the wafer section order solving. Copyright (C) 2018-2026 Max Planck Institute for Neurobiology of Behavior This program is free software: you can redistribute it and/or modify it under the terms of the GNU Ge...
8afc00118d24afcd536ce283b2aa7fe0bbd85fa5af803e5e2be7eec2dbf9edc9
Python
12,626
272
from typing import Literal, List import numpy as np import pandas as pd from difflib import get_close_matches import tensorflow as tf # print("tf.version: ", tf.version.VERSION) # print("tf.keras.version: ", tf.keras.__version__) # print("tf.config.devices: ", tf.config.list_physical_devices()) # # Check that GPU is ...
e728165e7b5526f21ee4950151986897d76e77d74f11eebef59e66fc2261202a
Python
12,626
316
"""FIXD03-F12 regressions: the four D03-returned defects in the F12 lens territory (browser-packet reserved prefix; evidence in the D03 themes packet). - D03-R1: the transformer subject probe on a trace with a REUSED module refuses ``lens_attention_subject_absent`` (factual absence of SUBJECT), never the accessor'...
efdcaafdbeddf570b2eb3e241b344329892ab7ba07ccee80a1c37408a40680c9
Python
12,627
356
"""Patching-helper honesty fixes (A03: WT1 A-I items 1 and 4; mikit F7/F8). Three defect classes pinned here: * attribution patching crashed on ANY model WITH parameters -- the counterfactual guard's unconditional in-place restore bumped autograd version counters of params consumed by the captured forwards (the w...
b7b58ef56152079ed1214270371ca95eb1a004a16c69a26da295ac28bd4e265b
Python
12,631
261
#结论:当模型进行ensemble的时候性能会明显提升。 import json import numpy as np import os, sys import random from collections import Counter from sklearn import preprocessing from sklearn.metrics import f1_score from sklearn.metrics import confusion_matrix import torch import torch.nn as nn import torch.nn.utils.rnn as rnn_utils import to...
493b74e6c50f5b6d08b92d3aa56c3a5699b7c72f3ca0da640f5685a506b23fc3
Python
12,636
305
''' PSNR methods check author : obanmarcos ''' import wandb import torch import os import os, sys from config import * sys.path.append(where_am_i()) import lightning as pl import argparse import numpy as np import matplotlib.pyplot as plt import pandas as pd from utilities import dataloading_utilities as dlutils f...
c0702a83beb04e8a7fcfa009477d3c74ab8e94a8dfbbf916a04f69080f52bda6
Python
12,639
306
''' PSNR methods check author : obanmarcos ''' import wandb import torch import os import os, sys from config import * sys.path.append(where_am_i()) import pytorch_lightning as pl import argparse import numpy as np import matplotlib.pyplot as plt import pandas as pd from utilities import dataloading_utilities as d...
b58cca18eea43b13861d68ea690936d345bc0e5415f5bf425e7067004e9c59ab
Python
12,645
351
# -*- coding: utf-8 -*- from functools import partial from itertools import repeat import torch from torchtext.data import Field, RawField from bioseq2seq.constants import DefaultTokens from bioseq2seq.inputters.datareader_base import DataReaderBase from bioseq2seq.utils.misc import split_corpus class TextDataReade...
dbb7fe3daa31cf36b7f22e67979e9b4c860c73060ba730fdb7664b5f3a4264e5
Python
12,645
385
#!/usr/bin/env python # # Copyright 2008, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
1f6c981cbad07fda6e06f454e83dba8a0ffa0b37622be43f09e6193a09619566
Python
12,655
276
# import time import numpy as np import torch import torch.nn as nn import torch.nn.modules.loss import torch.nn.functional as F from progress.bar import Bar from sklearn.cluster import KMeans from src.model import conST from torch_geometric.utils import dropout_adj from torch_sparse import SparseTensor def drop_feat...
b28033a9132ece5d811eda6f8e4eee30de5fad4960b04a717a5a939dad5f13f0
Python
12,659
405
#!/usr/bin/env python # encoding: utf-8 from __future__ import absolute_import, division, print_function, unicode_literals import os import sys import argparse import subprocess import shlex import logging import re import math import glob sys.path.insert( 0, os.path.sep.join( [os.path.dirname(os.pat...
117330ce3e0a74d0774b9af5a359bb3204410e32645a84f8292c93588c9d2028
Python
12,666
238
""" =========== Config file =========== Configuration parameters for the study. """ import os from socket import getfqdn from fnames import FileNames import pandas as pd ############################################################################### # Determine which user is running the scripts on which machine and s...
6521a4533bff9d450fc3d2d1353ce4eaed0618347a7230f98cc5c26c982f7c90
Python
12,666
349
"""F06: provocation rows for every attribution refusal code (S-17 coverage). Every stable code the lane introduced ships PROVOKED (error-code coverage gate): each test genuinely reaches its raise site and branches on ``exc.fields["code"]``, never message text. Codes provoked in the feature suites are not duplicated he...
7babe05581e89d7ee90561004a56076c5f6b92c855c812a1fdbb428cc8f76825
Python
12,669
373
# Copyright (c) 2025, Wentao Guo, Ted Zadouri, Tri Dao. import math from typing import Optional, Type, Callable import cutlass import cutlass.cute as cute from cutlass import Float32, Int32, const_expr from cutlass.cute.nvgpu import cpasync import cutlass.utils.blackwell_helpers as sm100_utils from cutlass.cutlass_ds...
4716a3193f3407c747ad123792d40c49ab95d4eb96b1204988dc77ccf01fb169
Python
12,673
237
# !/usr/bin/env python ## created by Yun Hao @MooreLab 2021 ## This script contains deep learning functions used in the DTox model construction ## Module import sys import numpy as np import pandas as pd import torch from sklearn.metrics import roc_auc_score from sklearn.metrics import balanced_accuracy_score from sk...
845cd452d4e1d4b4efb0e14710a5da7f8e00c4afc78ce206c75312118f7fe44a
Python
12,676
302
''' Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands 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 requir...
c219375b25e75f5fe09e84d0a4f3ad118d358e023534a32bb1c4e8cb1193cc8b
Python
12,678
323
"""Regression tests for the per-draw collapse-rolling suffix memo. Root cause (SPEEDENING wave 19): ``_collapsed_module_rolling_suffix`` is a pure function of the captured graph, but the renderer re-entered it once per collapsed-module NODE (``_render_nodes``, ``_render_dot``, ``render_ir``, and ``_single_op_module_sh...
4c4a417bd438342738f90c424687448400620e06e9ab686860a59c634f161321
Python
12,679
352
#!/usr/bin/env python import argparse import sys import openbabel from openbabel import pybel openbabel.obErrorLog.StopLogging() """ Based on a script from TJ O'Donnell https://gist.github.com/95387 Modified by B. Gruening and Hitesh Patel Copyright 2009-2012 TJ O'Donnell, B.Gruening """ class Fragmenter: def...
2436687d4122a903536d142365f1ed391517d3d14c8d009e5c22bc4c47b33676
Python
12,680
285
""" Tools to tailor a lookup table to a particular dataset. Functions: compute_splines: Computes the likelihood for a set of configs from a precomputed lookup table. """ from __future__ import division import numpy as np from numba import njit from pyrho.utility import get_table_idx, log_mult_coef def ...
3559e7a1012829b10f042cc3b4c5b8fe8bf471990dc98e27267d3a872a78077b
Python
12,682
355
import numpy as np import pytorch_lightning as pl import torch from monai.networks.blocks import UnetOutBlock, UnetrBasicBlock,\ UnetrUpBlock, UnetrPrUpBlock from monai.losses import DiceLoss from survival_plus_x.models.vit import ViT3D def proj_feat(x, hidden_size, feat_size): """ Reconvert the Attenti...
2c1b045109ecaccc579b9464256a6cce8e04d7e8134b5e31f90927007e377946
Python
12,685
403
import itertools from mock import Mock, patch import numpy as np from numpy import testing as npt from tns.astrocyte import space_colonization as tested PCLOUD_POINTS = np.array([ [0.0, 0.0, 0.0], [0.1, 0.1, 0.1], [0.2, 0.2, 0.2], [0.3, 0.3, 0.3], [0.5, 0.5, 0.5], [0.6, 0.6, 0.6] ]) def _po...
5a4db9fd35c30f5280680f6af943e7528bda390a88b00de3ae4814b92a33ea50
Python
12,687
463
# 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...
b553305532c96d694d6039bbaf5b8366fa035c166e78ee1692e97d3a052780b2
Python
12,691
292
import os, qt, ctk, slicer, sys import numpy as np import vtk from vtk.util.numpy_support import numpy_to_vtk from SegmentEditorCommon.Helper import Helper current_dir = os.path.dirname(os.path.abspath(__file__)) root_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) sys.path.append(root_dir) from bi...
dc3b64b397cb71aa779127f9c4e3c0bae37d8da8857ae3c8d5c410e057425315
Python
12,692
344
#!/usr/bin/env python3 """ File: create_upsetplot.py Created: 2021/05/10 Last Changed: 2022/02/10 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 ...
50108c9eed7b34053cdd71b4ae79d39153832c77b848b60c90f3b379060f7ae5
Python
12,694
359
"""Generate the checked-in per-class StorageBinding tables. One declared schema, generated artifacts (docs/reference/trace_core_design.md section 3.4): this tool derives one ``StorageBinding`` per declared field for all 12 record classes and writes ``torchlens/data_classes/_schema_bindings.py`` as reviewable, determin...
60ee43675884fb0f7dee22b32f239b1ad08b8393c869e0e9bc7767d6a3fdba7f
Python
12,700
317
########################################################################## ## ## ## Copyright (c) 2019 Philipp Lösel. All rights reserved. ## ## ## ## This file is par...
e1ef7c2cfe77fcb8e61b14c98d1bded060b50caea5ceda5efb3cda4067815398
Python
12,701
378
#!/usr/bin/env python # # Copyright 2009 Google Inc. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of...
82b61d30f62d6eddd81ff63b43146fd4f7be93be767ae5561b74a99951c24eca
Python
12,703
387
"""Hierarchy of format OME-Zarr implementations.""" import logging from abc import ABC, abstractmethod from collections.abc import Iterator, Mapping from typing import Any from zarr.storage import FsspecStore, LocalStore LOGGER = logging.getLogger("ome_zarr.format") def format_from_version(version: str) -> "Format...
3259e972cdf8892137a5b4bb92e8f215952e96000e14ae96e590ca0c2986db21
Python
12,706
343
""" ComposedStimulator — configurable trigger + action stimulator. Replaces the flat list of monolithic stimulator classes with a two-step selection model: users choose a trigger condition (WHEN to stimulate) and a stimulus action (WHAT to deliver), and this class wires them together. All mAGO-based hardware uses the...
9d024b142daba63b3210ba692263a6a22990a9995c120641cdf65c0c8d711483
Python
12,710
289
""" Manager and Serializers for Quotas. For more information about quotas: https://galaxyproject.org/admin/disk-quotas/ """ import logging from typing import ( cast, ) from sqlalchemy import ( and_, select, ) from galaxy import ( model, util, ) from galaxy.exceptions import ActionInputError from...
32309cf72d01f76a7a853578454a356fe6658561bda8d60155a41bf329aac76d
Python
12,712
348
from __future__ import annotations import argparse from pathlib import Path import numpy as np import pandas as pd from autotransop import ( AdversaryConfig, AutoTransOP, AutoTransOPConfig, AutoTransOPTrainer, DomainConfig, DomainEffectConfig, DomainTensorData, HeadConfig, MLPConf...
556748a3ee5ccb5deccbacf4a825b5a79bf42441815e7d86a1a63e90a8eeb28e
Python
12,714
355
import os import platform #The API is not snake case which triggers linter errors #pylint: disable=invalid-name if platform.system().lower() == "windows": dslib_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'lib') # On Windows, we can't rely on RPATH being set to $ORIGIN/lib/ or on # @...
85f0e7e86c9c775cb6d15e1088b3609a3e3833b80d3f00d67864e774c1d78457
Python
12,716
301
""" 08: Fitting Groups of Spectra ============================= Using the group model object to run fit models across multiple power spectra. """ ################################################################################################### # Import the group model object from specparam import SpectralGroupMode...
24e4c5356afbed9c4a50a8f0f1349b37ed9d93ee98c26a8dd8e72b36487b2557
Python
12,717
250
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """tests for parse.py""" import unittest from os import remove import numpy as np from sknetwork.data import parse class TestParser(unittest.TestCase): def test_unlabeled_unweighted(self): self.stub_data_1 = 'stub_1.txt' with open(self.stub_data_1...
8d33f6f04390948e51d9521f26766fdf45a98862387d3a13c85f9b6becbe48e2
Python
12,720
293
"""Round-36 security regression: module-less tensor-method smuggling under trust. r35 fixed the ``__module__``-missing / ``or <trusted-module>`` fallback loophole on the intervention resolver's **torchlens-walk** foreign branch (by routing the resolved object through ``is_pure_forward_callable`` on its REAL identity)....
507827d396a869afc86462b8fbfc33f6a0ea15dd00df26224883b940fa23c2e8
Python
12,726
309
"""Plots for annotating power spectrum fittings and models.""" import numpy as np from specparam.utils.select import nearest_ind from specparam.data.periodic import get_band_peak, sort_peaks from specparam.params.periodic import compute_fwhm from specparam.params.aperiodic import compute_knee_frequency from specparam...
cc83f694defda0960305fc2c309bac3209abb89b60d25da562f89d2b05bc0109
Python
12,728
305
from keras.src import activations from keras.src import constraints from keras.src import initializers from keras.src import ops from keras.src import regularizers from keras.src.api_export import keras_export from keras.src.layers.input_spec import InputSpec from keras.src.layers.layer import Layer from keras.src.quan...
d5e61bd1df2a968ac2101de28861e266e3489b1de1bc1c8f7f10beacc44c7113
Python
12,728
272
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import types from pathlib import Path from typing import Any import torch from torch import nn from ultralytics.nn.modules import Detect from ultralytics.utils import LOGGER from ultralytics.utils.checks import ch...
a6eae94d6ac50e7d9b757913a8d422f8dd8e045ba5cee6dcf60af5f6e5007f67
Python
12,732
338
"""Implementation of a space that represents closed boxes in euclidean space.""" from typing import Dict, List, Optional, Sequence, SupportsFloat, Tuple, Type, Union import numpy as np import gym.error from gym import logger from gym.spaces.space import Space def _short_repr(arr: np.ndarray) -> str: """Create a...
b248db533d796d6f638b047a5b74fe90ab7bdc21a32492baf9a54fd451330e4e
Python
12,739
307
import torch import torch.nn as nn import torch.nn.functional as F from opt_einsum import contract as einsum import torch.utils.checkpoint as checkpoint from util import get_tips from util_module import Dropout, create_custom_forward, rbf, init_lecun_normal from Attention_module import Attention, FeedForwardLayer, Atte...
3b55d1fa5f2505c2ad705e37d4edd7a88fbf9356465a16054072ebbee912b83d
Python
12,740
360
import numpy as np from utils import Q_nak from mitosfns import spike_quanta, run_sim from steady_state import get_steady_state from gates import ros_inf import figure_properties as fp import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from matplotlib import patches from matplotlib.ticker import F...
881ed5c68cef7789c5f5c3b1c23b0af4635a45e4b66ae78a547d363fed299f01
Python
12,740
385
"""Internal worker state (global). This includes the currently active and reserved tasks, statistics, and revoked tasks. """ import os import platform import shelve import sys import weakref import zlib from collections import Counter from kombu.serialization import pickle, pickle_protocol from kombu.utils.objects im...
2db89488ff38475b8ec933770db167f6f19f0a5bfba8bbc566b46206859d6f5b
Python
12,743
375
"""Shared code for working with workbook data. Module was developed for sample sheet work but extracted for reuse with fetch workbooks. """ import base64 from collections.abc import Generator from csv import ( Dialect, reader, Sniffer, ) from dataclasses import dataclass from io import ( BytesIO, ...
7a4fba082453eb87a7b5535204e5b5aec6830bebd6141199ec723ea6a446587d
Python
12,746
358
"""Google Cloud Storage result store backend for Celery.""" from concurrent.futures import ThreadPoolExecutor from datetime import datetime, timedelta, timezone from os import getpid from threading import RLock from kombu.utils.encoding import bytes_to_str from kombu.utils.functional import dictfilter from kombu.utils...
b9a4c0bae77453c7b191eb73b6f052edaea308e312901689f4940364a0c62ba5
Python
12,755
288
""" calibration.py — per-microphone UMIK-1 SPL calibration. Every miniDSP UMIK-1 ships with a unique, factory-measured frequency- response correction curve (and an overall "Sens Factor" offset) keyed to that specific physical unit's serial number. This module parses that file and applies it to compute a calibrated, pe...
64e9ef591979ad553f96bcc71a6756193b559871c218ea9a80305e9b99d473a9
Python
12,756
351
"""Tangent space functions.""" import numpy as np from sklearn.base import BaseEstimator, TransformerMixin from .utils.utils import check_version from .utils.mean import mean_covariance from .utils.tangentspace import tangent_space, untangent_space if check_version('sklearn', '0.17'): from sklearn.discriminant_an...
273a85559cb2aa97c83cd9fd0058415ee43194c72adfa0c2ff56729bc32ef5dd
Python
12,758
318
# Python from timeit import default_timer as timer # 3rd party import torch # NITorch from nitorch.spatial import (affine_grid, grid_pull, voxel_size) from nitorch.core.optim import (get_gain, plot_convergence) from nitorch.plot.volumes import show_slices from nitorch.core._linalg_expm import _expm # UniRes from ._proj...
719235b7b283b3f252e3535671b09c06db570c2d326cf2bb9a1d55a665038e13
Python
12,758
319
#!/usr/bin/env python3 """ Dx Z+++ — test two candidate fixes for the brainlat noise problem. c1: Drop the 4 most-distorted features (fooof_off, fooof_exp, dfa, a_asym_front) from the canonical 15-feature pool. Re-run with all 4 AD cohorts. If those features were the noise source, including brainlat should...
b64caaa1df2d287916933ba0cef0a0cdd91e1027b730bff355e2998d3538fed8
Python
12,761
362
# 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...
02eee5c6940aeec995242c735305e88dee8a94eb8a9e1be45ac81817931cef90
Python
12,762
370
import os import sys from typing import Any, Dict, Generic, List, Literal, Optional, Type, Union, cast import dask.array as da import dask_ml as dml import numpy as np import seqpro as sp import xarray as xr from sklearn.preprocessing import StandardScaler bin_dir = os.path.dirname(sys.executable) os.environ["PATH"] ...
ae4c41f93bf3330714c4dcde55df7e3a9a1174381a96f714d45a35804015ca01
Python
12,763
411
# SOURCE: vendored from clovaai/ext_portrait_segmentation @ master # https://raw.githubusercontent.com/clovaai/ext_portrait_segmentation/master/models/SINet.py # # Park, Hong, Roh, Ha, Han 2020 "SINet: Extreme Lightweight Portrait Segmentation # Networks with Spatial Squeeze Module and Information Blocking Decoder" (WA...
c5ec8d541646763747571f3aac7942162bdd5a98b458109ea340b16b4ac6f74f
Python
12,767
359
# --- 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 Button(_BaseLayoutHierarchyType): _parent_path_str = "layout.updatemenu" ...
5029869f5146ff8ebba5ffab9604a1a629622f584f39090282fb3546ae0ea078
Python
12,769
332
#!/usr/bin/env python3 """ Diagnostic S — incremental evaluation of three new feature families. Features added to the Dx P canonical pool: - Sub-alpha: 8-10 Hz vs 10-12 Hz band powers + ratio (global + posterior) - DMN-proxy connectivity: midline (Fz-Pz) and lateral (F3-P7 / F4-P8) iPLV and dPLI in alpha and t...
9d8f8e6753be79455b7ab2f6d9a4b6a653b7f17b1e6e82affdbee398d79a6b1c
Python
12,769
299
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
799479ed4d610de21d953e27e39d253e0108bca2da9005bb1e0e71b34b461206
Python
12,771
264
import json import numpy as np import os, sys from collections import Counter from sklearn import preprocessing from sklearn.metrics import f1_score from sklearn.metrics import confusion_matrix import torch import torch.nn as nn import torch.nn.utils.rnn as rnn_utils import torch.nn.functional as F from torch.utils.dat...
e3eb3392422d2d44deedbca9591d001e975dd713da4ab420226fdf5fb1c328e0
Python
12,772
321
''' PSNR methods check author : obanmarcos ''' from cgi import test import wandb import torch import os import os, sys from config import * sys.path.append(where_am_i()) import lightning as pl import argparse import numpy as np import matplotlib.pyplot as plt import pandas as pd from utilities import dataloading_u...
d8f1ce380158cd993a0632ec494b35b50c02d911068593fceb140a216f791f67
Python
12,775
267
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
4be583ffae6f8490533ee118d178e8dc5a2d98f6f626c9ce95a205d892d3d8b3
Python
12,776
323
''' PSNR methods check author : obanmarcos ''' from cgi import test import wandb import torch import os import os, sys from config import * sys.path.append(where_am_i()) import pytorch_lightning as pl import argparse import numpy as np import matplotlib.pyplot as plt import pandas as pd from utilities import datal...
82f32047a936bffa127c897bdac5a0114099c28df6f502ab53bed35d0e137157
Python
12,779
351
"""L3 trailing-lane gates for detachable CUDA kernel telemetry.""" from __future__ import annotations import ast import importlib import re from pathlib import Path import pytest import torch from _source_corpus import module_ast from torch import nn import torchlens as tl from torchlens import kernel_telemetry as ...
43cdec3993d4122404bc070c1715a16d512ecff282f3739210b232f274990137
Python
12,780
364
"""Preview-backend teardown contract: guaranteed cleanup + settle-after-cleanup. R17-1/R50-1 (b5 parity lane): MLX and Paddle previously stamped COMPLETE/HALTED inside the capture ``try`` and ran fallible teardown in ``finally`` -- a teardown raise propagated with the stamp intact, and a raising session cleanup skippe...
3556b81c0b617a1e91098c1ecf825de9de79c8751b62f66d11df7be7786c986d
Python
12,782
362
# SOURCE: vendored from https://github.com/awslabs/gluonts (PR #1617, "Adding NCAD # (Neural Contextual Anomaly Detection for Time Series) to nursery") # @ 396192e17e99a881a9b95229f9ff11ad2e685008 # (src/gluonts/nursery/ncad/src/ncad/model/tcn_encoder.py::Chomp1d/TCNBlock/TCN/ # TCNEncoder + contrastive_clasifier.py::...
adbe35f2be6afd5c12a35ac4953c84c9b173a321fdf491ee51b3e33361b5471e
Python
12,782
274
import csv import hashlib import json import unittest from pathlib import Path ROOT = Path(__file__).resolve().parents[1] def read_normalized_markdown(relative): return " ".join((ROOT / relative).read_text().split()) class RepositoryContractTest(unittest.TestCase): ASSET_HASHES = { "src/models/sta...
3e29115bd8150dab935607df26acb5a190d9101d67dd59cc71a6d30e1f46830b
Python
12,785
484
#!/usr/bin/env python3 import os import sys import numpy as np from htmd.ui import * from moleculekit.tools.voxeldescriptors import getVoxelDescriptors,getCenters, rotateCoordinates from moleculekit.tools.atomtyper import prepareProteinForAtomtyping from Bio.PDB import PDBParser, NeighborSearch import subprocess impor...
a32c36fd3eabe5924c7ad473d22cd012bd84872ad686092ac3689d83ab7672b8
Python
12,787
278
"""P1-9 · MDC95 的层级纠正:个体层阈值 vs 组均值层阈值。 为什么这个脚本必须存在 ---------------------- 稿件 3.9(a) 的核心论断是"没有任何位移越过它自己的噪声底",论据是 肺时钟位移 2.17 clock units vs 自身 MDC95 3.78 → 比值 0.57(未达) 这个比较**把两个不同层级的量放在了一起**。MDC95 = 1.96·√2·SD_within 是 **个体**层面的最小可检出变化 —— 它回答"同一个人两次测量要差多少才算真变了"。 而 2.17 是**九个人的组均值**位移。组均值的噪声底不是 SD_within,而是它的 标...
fa166ada7d0016dfc95f3a6186e519dd7ce35ffebf566db455554889920b02d6
Python
12,788
303
from src.cfg import * def load_useful_variables(data_repository): data_repository = os.path.abspath(data_repository) try: with open(os.path.join(data_repository, 'ccf3_acr2id.json')) as fp: acr2id = json.load(fp) with open(os.path.join(data_repository,'ancestorsById.j...
14935bc367f16d37cd343edf711ba1f22a403a1c514b263ccbe8026f52df5825
Python
12,791
365
import pickle import numpy as np from numpy.testing import assert_array_equal import pytest from pytest import approx from sklearn.dummy import DummyClassifier from conftest import get_distances, get_means, get_metrics from pyriemann.estimation import Covariances from pyriemann.utils.kernel import kernel from pyriema...
3d0175cee68a360981bb4a66d67950663bbd51c89a982cedc2847ffa73346836
Python
12,793
315
"""A05 escrow-spill fix: the four-panel red tests (leverage B2, brainpipe 2, transforms P7, tvscope B13). Root cause (review T3, conceded 3-0): deferred final-numbering selectors (op labels, positive ordinals, ``output``) escrow every candidate payload and spill past the 64 MiB RAM budget via ``torch.save``; a capture...
88e5863d9fe1da0e4a461ffebf237372e2471aced5485c3a6cb0d65142659c88
Python
12,799
404
""" Utility Routines for Working with Matplotlib Objects ==================================================== """ import itertools import io import base64 import numpy as np import warnings import matplotlib from matplotlib.colors import colorConverter from matplotlib.path import Path from matplotlib.markers import...
81cdd0a18aa42555b865a479c7fb4775bad9f9f8724ec23adc9862a989a94b14
Python
12,802
473
""" https://fastapi.tiangolo.com/tutorial/sql-databases/ To avoid confusion between the SQLAlchemy models and the Pydantic models, we will have the file models.py with the SQLAlchemy models, and the file schemas.py with the Pydantic models. These Pydantic models define more or less a "schema" (a valid data shape). S...
38091a29852252ed13f2cf26391d8d90c8e25dad42b9d099d20ab59998e645ef
Python
12,805
336
"""Static FIELD_ORDER / FieldPolicy / portable-state contract tests.""" from __future__ import annotations from collections.abc import Collection from dataclasses import dataclass from typing import Any from torchlens import constants from torchlens._io import FieldPolicy from torchlens.data_classes.buffer import Bu...
9f3106395760917406dca9e86f715a60a0b47095d8bf67b755b218006d2639dc
Python
12,805
429
# -*- coding: utf-8 -*- # # Time-frequency analysis with superlets # Based on 'Time-frequency super-resolution with superlets' # by Moca et al., 2021 Nature Communications # # Implementation by Gregor Mönke: github.com/tensionhead # import numpy as np from scipy.signal import fftconvolve def superlet( data_arr,...
f8302a2256f1a88628119ed19ea44f8b34773366478d101ee405d4295bd21c22
Python
12,810
264
import json import numpy as np import os, sys from collections import Counter from sklearn import preprocessing from sklearn.metrics import f1_score from sklearn.metrics import confusion_matrix import torch import torch.nn as nn import torch.nn.utils.rnn as rnn_utils import torch.nn.functional as F from torch.utils.dat...
94a091eeb19ef2ee2833577224720a2f64043387b6df4dc976fc97b05400cc08
Python
12,813
265
#结论:当模型进行ensemble的时候性能会明显提升。 import json import numpy as np import os, sys import random from collections import Counter from sklearn import preprocessing from sklearn.metrics import f1_score from sklearn.metrics import confusion_matrix import torch import torch.nn as nn import torch.nn.utils.rnn as rnn_utils import to...
91756b3e16318c2023eca21ffbf44a22bb788b1270a1a2b0c01b0c508f8c07a7
Python
12,815
303
"""Manager and Serializer for library datasets.""" import logging from typing import ( Any, ) from sqlalchemy import select from galaxy import util from galaxy.exceptions import ( InsufficientPermissionsException, InternalServerError, ObjectNotFound, RequestParameterInvalidException, ) from galax...
9ebe3b4e86bc7be492f7ed89507f0921317da82678e5aeec3aac1c0aabba693d
Python
12,820
289
"""tviz real-model corpus rows (tviz memo section 7, R1-R6). All rows run offline against locally cached checkpoints, eval mode, fixed prompts. The headline acceptance test is R1-vs-R2: the eager OBSERVED pattern and the SDPA RECONSTRUCTED pattern come from the same weights and must agree within dtype tolerance, each ...
ea33ea4d3dee4703751288e5145fc8be54ec99f6c57e8de2c8dcc32d3312a597
Python
12,825
344
import os import numpy as np import json import h5py import random import pandas as pd import tensorflow as tf binary_ce = tf.keras.losses.BinaryCrossentropy() binary_acc = tf.keras.metrics.BinaryAccuracy() categorical_ce = tf.keras.metrics.CategoricalCrossentropy(from_logits=True) def read_saved_file(file_path): ...
7d218445047f89fd863777ce4ca72c864824908d0cd3b18a150a6cd12a0f13d6
Python
12,826
308
""" Author: Derek van Tilborg -- TU/e -- June 2022 Inspired by: Moret, M., Grisoni, F., Katzberger, P. & Schneider, G. Perplexity-based molecule ranking and bias estimation of chemical language models. ChemRxiv (2021) doi:10.26434/chemrxiv-2021-zv6f1-v2. - LSTM: LSTM model class -...