sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
2f03133a2f4bbe8d03dfd28125c6d5e89f176693fc44c019dfc64f828e2c12dd | Python | 6,777 | 196 | model = dict(
type='RetinaNet',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=0,
norm_cfg=dict(type='SyncBN', requires_grad=True),
norm_eval=False,
style='pytorch',
init_cfg=dict(type='Pretrai... |
89f87510a4029d0421d3abfd5c18ce89bc6bc0573d7274f57450e2bd82ed89c3 | Python | 6,777 | 159 | """Tests for spiketools.utils.epoch"""
import numpy as np
from spiketools.utils.epoch import *
###################################################################################################
###################################################################################################
def test_epoch_spikes... |
ce31dc0fe6fa0488a0b43c8b2fa5bf8bbe333fb64534c368b590b872a10d6cbe | Python | 6,779 | 196 | model = dict(
type='RetinaNet',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=0,
norm_cfg=dict(type='SyncBN', requires_grad=True),
norm_eval=False,
style='pytorch',
init_cfg=dict(type='Pretrai... |
d26a8a36bca15fdb240b54d1cf0538afd8ed418c9f4b738c3bbbb164b676e8dc | Python | 6,779 | 204 | # Copyright 2023 DeepMind Technologies Limited
#
# 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 agree... |
1f0e40b6fb1e00d1f8cb28951863f8df4d47cc5140ddb603edf6b0a92f940e82 | Python | 6,781 | 165 | #!usr/bin/env python
import os
import pandas as pd
from tqdm import tqdm
import argparse
from sqlalchemy import create_engine
from sqlalchemy_utils import create_database, database_exists
import sys
import time
import gzip
import sqlite3
def create_db(db_auth, db_url, tblspace):
if tblspace and db_auth.startswith(... |
d0ce2204319ed017c4b491a2e10057af8c89314961f3fba76031b674b66da751 | Python | 6,781 | 187 | #!/usr/bin/env python3
import multiprocessing
import regex as re
import logging
import matplotlib.pyplot as plt
import scipy
import seaborn as sns
import pints
import argparse
from MarkovModels import common
from MarkovModels.BeattieModel import BeattieModel
from MarkovModels.ClosedOpenModel import ClosedOpenModel
fro... |
7eb3a178de4532789f42c201fef9af0642af12c5511ae8304041dab5ffdd4c77 | Python | 6,784 | 197 | # Copyright 2023 Blue Brain Project, EPFL.
# See the top-level LICENSE file for details.
#
# SPDX-License-Identifier: Apache-2.0
"""Parser for parsing abstract NMODL language definition file
Abstract definition file of NMODL has custom syntax for defining language
constructs. This module provides basic YAML parsing u... |
9a1d072abea91caa4ff5912d22aae114967f8d3ced96c7755f8a64fc283ba5a6 | Python | 6,784 | 172 | """
12: Reporting & Referencing
===========================
This section covers how to access reporting info and reference use of the module.
This page is a hands-on example of the reporting and referencing information on the
`Reference page <https://specparam-tools.github.io/reference.html>`_.
"""
#################... |
ce49339a12a70e73ad25b0715ebde3c9577fcc25c90804ec8f7356470c4d17ea | Python | 6,784 | 213 | import pickle
import pandas as pd
import tqdm.auto as tqdm
import numpy as np
from modular_splicing.models.modules.lssi_in_model import BothLSSIModelsJustSplicepoints
from modular_splicing.models_for_testing.main_models import AM, FM
from shelved.hsmm.gene_dataset import run_on_all_genes_binarized
from modular_splici... |
0d2c1b636be2de5b58054c9065ebf32baf266daa82387a36d64940ead5611030 | Python | 6,785 | 194 | """ANOVA related helper functions."""
import numpy as np
import pandas as pd
from spiketools.utils.base import flatten
from spiketools.utils.checks import check_param_options
from spiketools.modutils.dependencies import safe_import, check_dependency
sm = safe_import('.api', 'statsmodels')
smf = safe_import('.formula... |
15f2b7d561886b070aea0a345b0ee86045c845b0b11eee46cf4d87e168a72c4f | Python | 6,786 | 192 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""
This implementation is based on
https://github.com/rwightman/pytorch-image-models/blob/master/timm/data/mixup.py,
published under an Apache License 2.0.
COMMENT FROM ORIGINAL:
Mixup and Cutmix
Papers:
mixup: Beyond Empirical Risk Minimization... |
36699750c81f7649a947315a9b42f0515e09bc3b923d064beb7e91c8b44a5841 | Python | 6,787 | 193 | """Behavioral tests for dep-light bridge adapters and shared bridge helpers.
Grad-CAM and SAE Lens semantics run against minimal in-test stand-ins for the
optional packages, so the TorchLens-side resolution, dispatch, and refusal
logic executes on every environment; missing-dependency ImportError contracts
are asserte... |
e9b5d9459716ab2e60c9c7a7544bc56b875a8a70115c20e5570de42e7fe179c4 | Python | 6,787 | 180 | import time
import logging
import os
from ethoscope import trackers
from ethoscope.roi_builders.target_roi_builder import SleepMonitorWithTargetROIBuilder
from ethoscope.hardware.input.cameras import OurPiCameraAsync
from ethoscope.trackers.adaptive_bg_tracker import AdaptiveBGModel
from ethoscope.utils.io import Resu... |
f0eb3c53976877cc1050eee0565e0ca783759a1e8ceaeead92626b94129f0d2b | Python | 6,787 | 227 | """R44: closed-surface lockstep for the LiveOpView field->getter table.
The 253-line requested-column if-chain in ``_event_live_field`` was rewritten to
a closed module-level field->getter table (disputed-r2 b5 #1; both labs measured
the table neutral-to-faster on the real capture access mix). These tests pin the
sema... |
14d0a9c69ef8282d1cab9b7466dec8337bbc8e07003bf60af705bb2ffcbb5d4b | Python | 6,788 | 168 | # SOURCE: vendored from kdmsit/crysgnn @ main (crysgnn/model.py: ConvLayer, CrysGNN)
#
# CrysGNN (Das et al., AAAI 2023, "CrysGNN: Distilling Pre-trained Knowledge to Enhance
# Property Prediction for Crystalline Materials") is a self-supervised pretraining encoder
# for crystal graphs. Atom features are embedded and p... |
d6d87749a35fa91b09505a27e903ad3b84ab871994cb7f6b17a615d84f635bd8 | Python | 6,788 | 196 | model = dict(
type='RetinaNet',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=0,
norm_cfg=dict(type='SyncBN', requires_grad=True),
norm_eval=False,
style='pytorch',
init_cfg=dict(type='Pretrai... |
6bd3c20baa13055a0a243e384ccced026e78ab8e4702cd8a37088ca346f885b5 | Python | 6,790 | 208 | from collections import defaultdict
import io
import json
from itertools import repeat
from multiprocessing import Pool
import numpy as np
import pandas as pd
from tqdm import tqdm
from google.cloud import bigquery
from omop_learn.backends.backend import OMOPDatasetBackend
from omop_learn.data.common import ConceptTo... |
0f293c0adb31cdd3cbfc895c03416ba395dcf32908be7324efdee1ce51aad063 | Python | 6,791 | 209 | 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, transfer_probability
from causal_optoconnectics.generator import simulate_simple_conditional_response, generate_poisso... |
8e7d96b3ff0f1f060d4ba5274181d2127295ecce60c4124b854a769925eace8d | Python | 6,791 | 192 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
A PyTorch stateful batch sampler that can be used to correctly resume training mid-epoch.
See documentation of ... |
aebbf862f2b90d13f3b1c50ee79ef49ce7babec7f61d37cfcd426bf2ab113a09 | Python | 6,795 | 181 | from typing import Callable, Optional
import cuda.bindings.driver as cuda
import cutlass
import cutlass.cute as cute
from cutlass import Int32, const_expr
from flash_attn.cute.utils import get_batch_from_cu_tensor
class CuSeqlensToBlocksKernel:
def __init__(
self,
tile: int = 128,
num_t... |
edf9f0bcddddc325298c3422539ccbd612fedfee2879d5f5486376c4f0ec0742 | Python | 6,795 | 190 | """Cheap universal-property sweep bundles (compo memo stratum 2; F36 waves A-D).
Each bundle is one universal property driven over the shared fixtures:
container-protocol agreement, refusal transactionality, post-success
contamination, and sink hygiene. Measured asymmetries are pinned as ledgered
cells (the fix must f... |
30ce2255a396c9badad32f27b19f44c3712aa875188bad3d1eeebd4e08fd691d | Python | 6,797 | 199 | model = dict(
type='RetinaNet',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=0,
norm_cfg=dict(type='SyncBN', requires_grad=True),
norm_eval=False,
style='pytorch',
init_cfg=None),
neck=di... |
dc54171268155ce05eea7664d4492fa3a482c7c36c4145fe47f86a0cfc7b08ef | Python | 6,797 | 192 | from typing import Optional, Tuple, Union
import numpy as np
import pyvista as pv
from pyvista import PolyData
try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
from ....logging import logger_manager as lm
from ..utilities import add_model_labels
def _construct_arrow... |
c9c2aa8cc53f4e967a8700d6f58b9faae244b3d8eec7912349f038a8a0f4f1ae | Python | 6,798 | 190 | import numpy
import logging
from matplotlib import pyplot as plt
info_log = logging.getLogger(__file__)
class BarycentricCoordinates(object):
def __init__(self, *args):
"""
:param args: x, y and z coordinates of three points, i.e. cls(x, y, z)
or x and y coordinates in the two-dimensiona... |
7f2e89b6fc91f8191356b3cf0313841e1a7e09120364c487d3050c42337c6229 | Python | 6,799 | 173 | """Multigrid support to speed up training of video models"""
from functools import reduce
import numpy as np
from torch.utils.data import Sampler
_int_classes = int
__all__ = ['multiGridHelper', 'MultiGridBatchSampler']
sq2 = np.sqrt(2)
class multiGridHelper(object):
"""
A Multigrid Method for Efficiently ... |
a532c783bfd8a0d203b6bb10bbb60581e673a66d73eae84ffbeb150aa79f4332 | Python | 6,800 | 162 | import importlib.resources
from nanite import preproc
from PyQt6 import uic, QtCore, QtWidgets
from .widget_preprocess_item import WidgetPreprocessItem
class TabPreprocess(QtWidgets.QWidget):
def __init__(self, *args, **kwargs):
super(TabPreprocess, self).__init__(*args, **kwargs)
ref = importli... |
523f37325a164c8590bd747af7b0987903d4753602d9f19f5f14c3babde0a63e | Python | 6,801 | 207 | import numpy as np
import pytest
from sklearn.neighbors import NearestCentroid
from pyriemann.datasets import make_gaussian_blobs
from pyriemann.embedding import (
SpectralEmbedding,
LocallyLinearEmbedding,
TSNE,
barycenter_weights,
locally_linear_embedding,
)
from pyriemann.geometry.kernel import ... |
45ffd2963c7ef8e077404aa0b57b64b1da92a667103589984591c13c3e5ac861 | Python | 6,805 | 211 | import os
import numpy as np
import pandas as pd
from collections import Counter
import cv2
from tensorflow.keras.applications.vgg19 import VGG19
from tensorflow.keras.applications.vgg19 import preprocess_input, decode_predictions
from tensorflow.keras.preprocessing.image import smart_resize
from tensorflow.keras.model... |
a5456307a35cfe176a62c285e21af5994ce92fc7cf25139e92ab9d0b8b73cdb7 | Python | 6,805 | 195 | import numpy as np
import os
from os.path import join, exists
import time
import pickle
import sys
from ovseg.utils.path_utils import maybe_create_path
class TrainingBase():
'''
Basic class for Trainer. Inherit this one for your training needs.
Overload all classes like
def function(...):
sup... |
19c93a46ab5d9e47120e6093e7c2add458618aab50069522e481fdb2091572ab | Python | 6,808 | 176 | import unittest
from unittest import skipIf
from carbontracker import loggerutil
from carbontracker.loggerutil import Logger, convert_to_timestring
import unittest.mock
from unittest.mock import MagicMock, patch
import tempfile
import os
import logging
from datetime import datetime
import time
class TestLoggerUtil(un... |
418cfed52effbd4892ef0557998f101d1ea65f13b90fbb0a79d6a46b7612ae4d | Python | 6,808 | 156 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import argparse
import cv2
import numpy as np
import onnxruntime as ort
import torch
from ultralytics.engine.results import Results
from ultralytics.utils import ASSETS, ROOT, YAML, nms, ops
class YOLOv8Seg:
... |
7fe6a873f19c47b0a462b8bfbf1c2b602cc6017a8a5ae169c6fb8c07ceaaba5f | Python | 6,808 | 174 | import numpy as np
import tensorflow as tf
from tensorflow import keras # use tf.keras
from tensorflow.keras.layers import ( # UpSampling2D, Conv2DTranspose
Activation, BatchNormalization, Conv2D, Dense, Dropout, Flatten, Input,
Layer, MaxPool2D, Reshape)
from tensorflow.keras.losses import binary_cross... |
7f3aa3d0628b263a9cb9c49505ffea1b2a74ea49bc73b3c6be2fd6058661b319 | Python | 6,810 | 159 | """ROS to OpenCV image converter
This script can be imported as a module and contains the following public methods:
* `check_for_type`
* `decode_CompressedImage_depth`
* `decode_Image_depth`
* `decode_Image_RGB`
* `decode_CompressedImage_RGB`
"""
import cv2
import struct
import numpy as np
import rospy
from sensor... |
1b1b4d90897b480d2bf2600291b0dc4823759b6fd63e9a4af606572664128a8c | Python | 6,811 | 196 | import io
import os
import hashlib
import getpass
from base64 import standard_b64encode
from distutils import log
from distutils.command import upload as orig
from distutils.spawn import spawn
from distutils.errors import DistutilsError
from setuptools.extern.six.moves.urllib.request import urlopen, Request
from se... |
dca75d3ed00a43d6a37ef0ee9969809934a531f7b21a845f2530fb9bd471d3ea | Python | 6,811 | 132 | from pathlib import Path
import numpy as np
from torch.utils.data import Dataset
# import torch.utils.data as data
from torchvision import transforms as T
from helpers.configurations import OR_4D_DATA_ROOT_PATH
from helpers.utils import load_cam_infos
from scene_graph_prediction.scene_graph_helpers.dataset.augmentatio... |
baf1abc46f5de75e3c915689d09a06f5f2f92dd199e608a245777cd929517178 | Python | 6,812 | 169 | from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import range, zip, map, reduce, filter
# import warnings
import numpy as np
import pytest
from tifffile import imread
try:
from tifffile import imwrite as imsave
except ImportError:
from tifffile import imsave
fro... |
70c24b5b45829e047cfbc5cc4d2377d0ef893b8fcea72b05212d1228f010a00c | Python | 6,814 | 168 | """CAPI cross-attention predictor.
- [0]: CAPI: Cluster and Predict Latent Patches for Improved Masked Image Modeling, 2025, https://arxiv.org/abs/2502.08769
- [1]: https://github.com/facebookresearch/capi
- [2]: RoFormer: Rotary Position Embedding, 2021, https://arxiv.org/abs/2104.09864
"""
from __future__ import an... |
3f47bf0e04bca22a9c9079622277e235f9ed95c0c37cf317e7281e3f64bc4965 | Python | 6,815 | 211 | """Gradient-boosted decision-tree ensembles as TorchLens inference op graphs.
Paper: Chen and Guestrin 2016, XGBoost; Ke et al. 2017, LightGBM.
RecBole exposes LightGBM and XGBoost as external-library recommenders, so there
is no native ``torch.nn.Module`` graph to trace. This module implements the
shared inference s... |
d0b9d22ad55d71379822241110fd99d2bbafe8e6fdede0e82f44b7017b8edf36 | Python | 6,815 | 205 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test objects and function in the module tfep.nn.flow.centroid.
"""
# =========================================... |
280651d1b9b6b47a24b78e65eb18f56a870cc84242c796884adafff0f5b16ff5 | Python | 6,819 | 160 | import pkg_resources
from nanite import preproc
from PyQt5 import uic, QtCore, QtWidgets
from .widget_preprocess_item import WidgetPreprocessItem
class TabPreprocess(QtWidgets.QWidget):
def __init__(self, *args, **kwargs):
super(TabPreprocess, self).__init__(*args, **kwargs)
path_ui = pkg_resour... |
6a4be511490ab2a7a715e9a7716dd84aaa5f47466ae0b6203510a6cd4fa67386 | Python | 6,819 | 210 | # Copyright 2019 Novartis Institutes for BioMedical Research Inc. 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... |
72a2d8030c6f8239e324c6a4da7aeb3a4504c84b47d770e0b2313f812f28563d | Python | 6,821 | 178 | """End-to-end tests for the ETA/countdown fix for #5321.
These tests exercise :mod:`celery.worker.strategy`,
:mod:`celery.worker.state`, :mod:`celery.worker.control` and
:mod:`celery.worker.consumer.consumer` together, the way a real worker
would use them, instead of asserting on each module in isolation. They
verify ... |
0e784378545723bbc4b91824f45cc741812d24885de4741768715e08172401eb | Python | 6,824 | 186 | #Keras modules
from keras.layers import Input, Dense, Conv2D, MaxPool2D, UpSampling2D, Flatten, Reshape, Lambda, Dropout
from keras.models import Model, Sequential, load_model
from keras import backend as K
from keras import optimizers
from keras.preprocessing.image import ImageDataGenerator
from keras.utils import mul... |
34746574b5f87e767d16b7eb120414123cb1622beeeeb22a4c6762143a62a70b | Python | 6,827 | 205 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created in July 2020
@author: Nathan de Lara <nathan.delara@polytechnique.org>
@author: Thomas Bonald <thomas.bonald@telecom-paris.fr>
"""
from typing import Union, Tuple
import numpy as np
from scipy import sparse
from sknetwork.utils.check import check_vector_forma... |
5ddc8914dcb522f25e32867e4abe9b8b040bbd0ba4182cdd21d2ad294800f74d | Python | 6,827 | 234 | """
behav_figs.py
This script contains functions defining running and pupil figure panel analyses.
Authors: Colleen Gillon
Date: January, 2021
Note: this code uses python 3.7.
"""
from util import gen_util, logger_util
from sess_util import sess_ntuple_util
from analysis import behav_analys
from paper_fig_util im... |
00faabd9528fe48fa9bfa44ffc4c96cdc6d80ed458a2d9fce786ba3923e883f1 | Python | 6,828 | 159 | # -*- coding: utf-8 -*-
"""
Tests scripts/tune_servo.py's config-writing logic in isolation, without
needing real servo/pigpio hardware -- that's the part with real risk
(reading/writing a live box's panel_config.json) and the part this
session's redesign changed twice: first from regex-editing
local_pi_revd.py directl... |
0ac6f8ca2d6fadbee0bfc3d2cbefb19c67d085d9f22dd02cf8a74d6cc500d9f5 | Python | 6,829 | 197 | import io
import os
import pytest
import sys
import rpy2.robjects as robjects
import rpy2.robjects.help
import rpy2.robjects.packages as packages
import rpy2.robjects.packages_utils
from rpy2.rinterface_lib.embedded import RRuntimeError
rinterface = robjects.rinterface
class TestPackage(object):
def tests_p... |
af4abd27f14b1ad129425664baf28322305c74ba8b126fb20f2bbfbdd9f281bd | Python | 6,829 | 131 | import matplotlib.pyplot as plt
import numpy as np
plt.rcParams['font.sans-serif'] = 'Helvetica'
fig = plt.figure(figsize=(12,3))
legend_font = {
'family': 'Helvetica', # 字体
'style': 'normal',
'size': 'small', # 字号
'weight': "bold"}
ax1 = fig.add_axes([0.1, 0.2, 0.8, 0.6])
# RMSE
RMSE_bj = [0.44... |
f7afda2ad0dbc202c454d80d69b393f06ac509864400279da22b9ca94e5c720f | Python | 6,829 | 202 | """Cache Management
"""
import errno
import hashlib
import logging
import os
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.download import path_to_url
from pip._internal.models.link import Link
from pip._internal.utils.compat import expanduser
from pip._internal.utils.temp_dir import T... |
15d10a144b9bb05ecb19bf476be87a01deaae53cbf65553b91ffa644b34f662f | Python | 6,831 | 176 | import tensorflow as tf
import pathlib
import keras as keras
from tqdm.keras import TqdmCallback as _TqdmCallback
import warnings
import functools
from tqdm.utils import IS_WIN
import tqdm
import os
from matplotlib import pyplot as plt
from IPython.display import clear_output
# Local dependencies
from basics import is... |
2aab69675b0376f04d46bdaf88f87ce0b4390ab03e19111aa9ba3ea48ce6e599 | Python | 6,831 | 187 | # coding: utf-8
import time
import re
import sys
import logging
import zipfile
import os
import mechanicalsoup
from datetime import datetime
from datetime import datetime
from random import randrange
from collections import defaultdict
# Disable warning
import urllib3
urllib3.disable_warnings(urllib3.exceptions.Inse... |
724879a4e5a770bd687989d2784dcb6207197221625f33bc8f1f93f4f31c94e9 | Python | 6,831 | 180 | # -*- coding: utf-8 -*-
"""
General framework regrouping the different tasks possible to integrate in the
regression analysis pipeline.
===================================================
A Task instanciation requires:
- functions: a list of functions to be executed sequentially on each input,
- input_dependen... |
e9b037724d6b58837ad83ab590bac96d057cdc77ad6cfcccf26195e6b2881c0b | Python | 6,831 | 186 | """F08 config grammar: typed refusals, typed conflicts, nothing silent.
Summary memo 3.10: unknown names teach with a nearest match; contradictory
axes raise ``summary_option_conflict``; the removed legacy spellings refuse
typed naming their successor (pinned in test_summary_removed_spellings.py);
the fma1 convention ... |
1a0eca0c321429ca95687bc07dee70cd53de746befc8a15cb15806e15015e8e3 | Python | 6,832 | 206 | # 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... |
ce96b5699400f8b48e12035a809a1f04a9aed760f2ba7b03c0f43db8efdb210f | Python | 6,833 | 188 | #!/usr/bin/env python3
"""
File: force_normalise_matrix.py
Created: 2021/11/03
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the root directory of this source tree.... |
a8b1ba6aa22dc8cc185783a87bbf2bad76de4504de51e011b24d1b4447ab575d | Python | 6,835 | 164 | # SOURCE: vendored from zshihang/MemN2N @ ef5cf330c764daa6069121c46c8defd6130486f3
# https://raw.githubusercontent.com/zshihang/MemN2N/ef5cf330c764daa6069121c46c8defd6130486f3/model.py
#
# Sukhbaatar, Szlam, Weston & Fergus 2015 "End-To-End Memory Networks"
# (https://arxiv.org/abs/1503.08895). Real architecture: input... |
ffb59a76e16d10a93914f4cec9049c08c209d95774114fc80e22abf13cf2842d | Python | 6,836 | 173 | """
Plot Power Spectrum Models
==========================
Plotting power spectrum models, directly from specparam objects.
In order to the get a qualitative sense of if the model is fitting well, and what
the results look like, it can be useful to visualize power spectrum model reconstructions.
This example dives de... |
af89a155797e1365787de1e55b656c7e1753826278329a9664e23c975f6da6b2 | Python | 6,837 | 194 | """
End-to-end test for the temperature alert pipeline.
Simulates a sensor update reporting an over-threshold temperature and asserts
the full chain fires: Sensor._update_info() -> temperature callback ->
TemperatureAlertMonitor.check_temperature() -> NotificationManager ->
EmailNotificationService.send_temperature_al... |
da0dbbcc00bcd2d09149f10ee287d09dc23df57f90bdbc9f67bb4a8ba6582c20 | Python | 6,837 | 223 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 22 10:10:25 2022
@author: fcheng
"""
import glob
import os
import numpy as np
import pandas as pd
from eval.image_process import img_process
from eval.make_regressor import MakeRegressor
# save dirs
save_dir = "./results/evaluation"
if not os.... |
0e3ee325ff60633e39288ab4427786e780643b8dea83e752894bd8ef0ba777d4 | Python | 6,838 | 171 | import copy
import warnings
import torch
from keras.src import layers
from keras.src import tree
from keras.src.export.export_utils import convert_spec_to_tensor
from keras.src.export.export_utils import make_tf_tensor_spec
from keras.src.export.saved_model_export_archive import (
BaseSavedModelExportArchive,
)
f... |
80e562f9849e5f5d7582b06812b7ae15ba076b5e5a510fd26f990e9f47c68767 | Python | 6,838 | 195 | """
These tests ensure the ABF object contains the expected contents.
It also tests sweep setting and stimulus waveform generation on all ABFs.
"""
import sys
from numpy.core.numeric import array_equal
import pytest
import datetime
import numpy as np
import glob
try:
# this ensures pyABF is imported from this spe... |
93dafc82f7e0ae274bec26d11ee1bf368abb2b5b77bebdc5e3f852a83f7134d5 | Python | 6,839 | 169 | #!/usr/bin/python
import random, os, logging
from pyoperant import utils, components
from pyoperant.behavior import two_alt_choice, shape
class ThreeACMatchingExp(two_alt_choice.TwoAltChoiceExp):
"""docstring for ThreeACMatchingExp"""
def __init__(self, *args, **kwargs):
super(ThreeACMatchingExp, self... |
9fd7d9e9aa8d27628f911c1ea0f3d9a5a622e95ae982552cf189abcae099d24d | Python | 6,839 | 250 |
from pyexpat import model
import numpy as np
import statsmodels.api as sm
from scipy.stats import multivariate_normal
import matplotlib.pyplot as plt
def prepare_Y_X(Ydict, fitting_times, Xmat=None, nobs=None):
Yvec = Ydict['spike_vec']
Past = Ydict['past_filt'][:,:2] #first variable is for past tw... |
ac1a7be22c4c0e2d37a705abe0c8314f9931448131e5a0d25f538a2191885fa0 | Python | 6,839 | 169 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import matplotlib.pyplot as plt
import slowfast.datasets.utils as data_utils
import torch
import torch.nn.functional as F
from slowfast.visualization.utils import get_layer
class GradCAM:
"""
GradCAM class helps cr... |
68dab7d8bedc1a82bea504b3ceadcb152119d6cf0154899903441860780633b7 | Python | 6,841 | 159 | import numpy as np
import tensorflow_probability as tfp
from spektral.layers import GraphAttention, TAGConv
from tensorflow.keras.initializers import GlorotUniform
from tensorflow.keras.layers import Dense, Dropout, Input, Lambda
from tensorflow.keras.losses import MSE, KLD
from tensorflow.keras.models import Model
fr... |
940bb4cda0f605b712eaf0a131fd66b04b1202465e8df4451cfc8735ac17078c | Python | 6,842 | 215 | """F08 result API: detached lifetime, raw-numbers pin, projections, HTML.
Summary memo 3.8 + composition rows 11/14/16: the result survives model
and trace teardown; every numeric field is a plain int or None; renderer
and projection values agree; HTML is escaped and dependency-free;
``Trace.provenance()`` serves the ... |
934aa23751a75a112bd1316bba22698a0dd0a27f21b6d607223b80bc61ee24a7 | Python | 6,843 | 202 | ###############################################################################
# Perform clustering the identified SVGs from the AKI kidney and 3dst RA
# Figure 3D, Supplementary 25
###############################################################################
import numpy as np
import pandas as pd
import matplotli... |
f7bd22978a32423f66a8806d743522c1c030d623d6687f7d12c8522aea22465b | Python | 6,843 | 183 | #!/usr/bin/env python3
"""
Dx AU — Bootstrap CIs on the v0.78 load-bearing numbers
========================================================
Adds 95% bootstrap CIs to:
R1: In-pool LOCO BA on selection cohorts (deployment + strict modes)
R2: Held-out figshare BA + AUC (deployment + strict modes)
R3: Per-cohort BA ... |
f7b915e7176f276bc22f2923cbf1ef7c04c17d9c90e8a948cc9fd30f9ac1c91a | Python | 6,846 | 199 | model = dict(
type='RetinaNet',
backbone=dict(
type='ResNet',
depth=50,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=0,
norm_cfg=dict(type='SyncBN', requires_grad=True),
norm_eval=False,
style='pytorch',
init_cfg=dict(type='Pretrai... |
d778c1ab72d47703a95753c53a64ff2cdf49a17a17b7c824fe97866a4f55eddb | Python | 6,847 | 164 | import os
import gdown
import numpy as np
import pandas as pd
from tqdm import tqdm
from irnlm.data.text_tokenizer import tokenize
def load_model_and_tokenizer(trained_model='data/glove.6B.300d.txt'):
"""Load a GloVe model given its name.
Download Glove weights from URL if not already done.
Args:
... |
c9f52f5faeeb61d26170e016c4efcbfc2a7c0db99c0a88478fd881afc2af8d90 | Python | 6,849 | 175 | from argparse import ArgumentParser
from typing import Any, Optional, Union
import torch
from pytorch_lightning import LightningModule, Trainer, seed_everything
from pl_bolts.models.detection.faster_rcnn import create_fasterrcnn_backbone
from pl_bolts.utils import _TORCHVISION_AVAILABLE
from pl_bolts.utils.warnings i... |
bd4c192e78ff2ebd4692cb1465594fb5343e7f6c7e6951107ac78d29c3337059 | Python | 6,851 | 194 | #!/usr/bin/env python
# mushu.py
# Copyright (C) 2013 Bastian Venthur
#
# This program 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 2
# of the License, or (at your option) any later version... |
49305bcf33dd8f263748cddf545e8c04daacc27c7943c71a0f8ea0bea2101a45 | Python | 6,853 | 201 | # coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
d2ed8ca1008c2a16903252bbaf8fb51182a8ed93fd4f3d9f78b80547b5dc6ee6 | Python | 6,859 | 169 | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/Preprocessing.ipynb (unless otherwise specified).
__all__ = ['extract_uniprot_id', 'expand_protein_ids', 'pep_position_helper', 'get_peptide_position', 'get_ptm_sites',
'get_modifications', 'format_input_data']
# Cell
import pandas as pd
def extract_uniprot_i... |
b85893f2479ca529441bad5e63d0128640d22b57d2faa811fc3b918487c6dd9a | Python | 6,861 | 220 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Provide utility functions to read output files generated by PLUMED.
"""
# ====================================... |
d62d5c1cc92ab2c93cb96f835d69b40b1a525bdd99256235f793024b893f8b7b | Python | 6,863 | 201 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# This tool is intended to process resource ZIPs generated by
# opencc_resources_zip. It assumes that all .txt entries are OpenCC text
# dictionaries and that config JSON files only use "type": "text" / "file":
# "*.txt" for dictionary references.
import argparse
import ... |
2449f4472dbd1d984cf131ec56d318737a626a34f326f878558a0fe06f838a77 | Python | 6,864 | 147 | """
Network Observer
================
The `rectipy.observer.Observer` can be used to record neuron state variables during numerical simulations or
training/testing procedures performed with `rectipy.Network` instances. It is used by the methods `Network.run` and
`Network.test`, for example, which return a `rectipy.obs... |
e34165e40e5e5ad6a1c290bd30a6db7c88c7491f884921b40f207458b025c95b | Python | 6,866 | 183 | """Deployment envelope (lane F37): accelerate CPU/disk offload capture.
The population TorchLens targets loads big models through accelerate; these
tests pin the CPU-verified slice of the envelope: offloaded models are
ADMITTED with weights_map evidence, capture is pollution-free (op parity with
the plain model), weig... |
5a18a8d313b9671fcb0771fbc0f3fcec38dfab18c019c43f0dda3cd4e76b6951 | Python | 6,868 | 168 | """The module describes the ``pulsar`` job metrics plugin.
Unlike every other plugin here, this one injects nothing into the job script. What it
reports happens either side of the job script, so its files are written by Pulsar and by
Galaxy's Pulsar runner, and this plugin only reads them. Each is a JSON object named ... |
a59d1b2bf44efb7f1f6adf0563359a361202440eb8591e2bec719458e2ae76e1 | Python | 6,871 | 167 | from locale import normalize
import os
import random
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # Code suppressing TF warnings and messages.
#os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
import sys
import bm3d
import argparse
import numpy as np
import cv2
from skimage.restoration import denoise_tv_chambolle
import matplotli... |
df90d132f64ef999548ca1d4987da049f9dd25ea41cca1b824468adefbc54897 | Python | 6,872 | 193 | """
Collect code here which may be useful to simulate patch-clamp-like recordings
from scratch. This will be useful when generating data to practice exporting
into different formats (e.g., ABF1) or when performing/testing various event
detection or curve fitting routines.
This script was used to create the NPY file co... |
da903aa7168648a62a24146f1a2cf5b16aca72fd3235f3932126c20d3abfa43e | Python | 6,873 | 198 | ''' Point annotator
ex
python point_annotator.py ../visium_data/Merfish_S2_R3.npz ../visium_data/tissue_hires_image.npz
'''
import argparse
from os.path import split,join,splitext
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.transforms as mtransforms
from glob import glob
if __name__ == '__m... |
22fc96f624bacd6b0c2db6285ad9eb772208ce8b443f0e0cf3334d4363254aa0 | Python | 6,875 | 168 | """Plotting functions for creating the bounding box.
"""
from typing import Dict, List, Optional, Tuple, Union
import matplotlib.pyplot as plt
import numpy as np
from descartes import PolygonPatch
from matplotlib.axes import Axes
from matplotlib.collections import LineCollection
from matplotlib.figure import Figure
f... |
7bc7d4f0d83699cf3b2fbd6f16b2b3d1d0f1902ab5da8b15d9b56cbb4e83bfc9 | Python | 6,875 | 221 | """Security-focused tests for portable TorchLens bundle loading."""
from __future__ import annotations
import json
import shutil
from dataclasses import replace
from pathlib import Path
from typing import Any
import pytest
import safetensors # noqa: F401
import torch
from torch import nn
import torchlens as tl
fro... |
1367a59905ebe05fad63eb93e339dac0ffd71ae9435ee2874fb5e46f115b37c5 | Python | 6,876 | 162 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2022 VB Index Team
#
# Created by The BOBLab
#
# Distributed under terms of the GNU license.
from . import vol_pipe
import argparse
import multiprocessing
import nibabel
import numpy as np
import textwrap as _textwrap
import sys
class Mu... |
a3f970af716e684c525a7c71ecb57275db4a19161173b59148ecd645d7d64dec | Python | 6,879 | 224 | """ tracking Data augmentation
Code adapted from https://github.com/STVIR/pysot
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
from gluoncv.utils.filesystem import try_import_cv2
from gluoncv.m... |
2651026980e4fc625c529b95917e595ac011fca50880cc316073941648574064 | Python | 6,880 | 207 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (leoxiaobin@gmail.com)
# Modified by Bowen Cheng (bcheng9@illinois.edu)
# ------------------------------------------------------------------------------
fro... |
9861a9a0ccbce0062bcc588c083578c998bcaed8bdb41fdf5907c3e3520dbda7 | Python | 6,880 | 180 | """
Author: Curtis Huttenhower
Description: Used to create tree structures to hierarchically normalize abundance tables.
"""
#####################################################################################
#Copyright (C) <2012>
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of
#th... |
efda939de5a3b5d5b62f0ebddfb25873f4d806ac34281a1b6f23f3c2a9bbe6d8 | Python | 6,882 | 205 | """Functions to compute trial-related measures."""
import numpy as np
from spiketools.utils.extract import get_range
from spiketools.utils.options import get_avg_func
from spiketools.utils.checks import check_time_bins
from spiketools.utils.timestamps import create_bin_times
from spiketools.measures.spikes import com... |
d1cc26a7cf74e8a2b75b44a54960006503126d66bb721e377b8649339e47556c | Python | 6,884 | 201 | # 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... |
14f3be78df3e9558e93332521f6a63b2dcaaf410d31bef9e0d1671dbddce1c67 | Python | 6,885 | 236 | import numpy as np
from numpy import array, dot, diag, zeros
from numpy.linalg import eig, eigh, inv, norm, svd
from numpy.random import randn
try:
from scipy.stats import skew
_skew_loaded = True
from scipy.linalg import orth
_orth_loaded = True
from scipy import signal
except ImportError:
_or... |
5b87c480f9e32c658cdd6621d37259e8ad1bca1faece2359818035445a7a3a6f | Python | 6,886 | 152 | """Prepare the UCF101 dataset
=============================
`UCF101 <https://www.crcv.ucf.edu/data/UCF101.php>`_ is an action recognition dataset
of realistic action videos, collected from YouTube. With 13,320 short trimmed videos
from 101 action categories, it is one of the most widely used dataset in the research
c... |
5dbf952a6b1816d1feb376b24a267d91b25c9b07af14ae006d3de458e339cc83 | Python | 6,888 | 206 | """Worker <-> Worker communication Bootstep."""
from collections import defaultdict
from functools import partial
from heapq import heappush
from operator import itemgetter
from kombu import Consumer
from kombu.asynchronous.semaphore import DummyLock
from kombu.exceptions import ContentDisallowed, DecodeError
from ce... |
f6720b8679673a448a160185839c778ee42fded37a3b52c0335398dd9f2a6379 | Python | 6,888 | 191 | """
Unit tests for core/roi.py.
Tests ROI class including initialization, properties, image cropping,
feature extraction, and boundary handling.
"""
import unittest
import cv2
import numpy as np
from ethoscope.core.roi import ROI
from ethoscope.utils.debug import EthoscopeException
class TestROIInit(unittest.Test... |
c2779f5a85b47a1ed75a7f18e1dc6383e894d63108d75aa5f518e4964b84f1d2 | Python | 6,889 | 199 | """Run the commit-level smoke gate in the environment of CI's enforcing smoke row.
A plain ``pytest tests/ -m smoke`` on a development box does not give the
same answer as the GitHub Tests workflow, for two environment reasons:
* CI installs the ``dev``, ``tabular`` and ``viz`` extras on every row. A venv
built fro... |
aa8ffd55ff3927c7b6b65e8340267199c1d68015ae3c88ab5ad3af587c643640 | Python | 6,890 | 197 | #!/usr/bin/env python3
"""
File: covariate_selection_lineplot.py
Created: 2021/12/06
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 ... |
28b6f4882c7aa1a9f432cab78574750634bdd8de95fd4dc624a2101e6a6dcbf7 | Python | 6,892 | 186 | """Model identity for extraction artifacts (extract memo D6 + item 6).
``model_identity: "measured" (DEFAULT) | "asserted" | "none"``:
* ``measured`` — a CRYPTOGRAPHIC digest (blake2b default, sha256 selectable)
over the COMPLETE ORDERED MODEL STATE: every parameter AND persistent
buffer, including integer, bool,... |
9e8ae5256249f1a47d0986c69d9e001902e6cb5f7b1706c14071f516ea79ed42 | Python | 6,892 | 169 | """r35 stage-0 regression: v2 REQUIRED-explicit context records and legacy-v1 posture.
Decision A: v2 context records are REQUIRED and EXPLICIT -- the parser REJECTS
absence, so an absent record can only mean a legacy v1 artifact, which loads
analysis-only with a typed readiness refusal (decision G). No absent context... |
3011970c862dd7fc773a76b2c8d65f08cb317ab661bb04c12dac18a95892b4d1 | Python | 6,893 | 182 | from __future__ import annotations
import random
import numpy as np
import pytest
from larvaworld.lib import util
from larvaworld.portal.models_architecture import module_inspector_data as data
from larvaworld.portal.models_architecture.module_inspector_models import (
ModuleInspectorError,
Module... |
68c8b31f6584d54de3f728c110e7c844ae9503e6812c796eab89e89bdcf65eb1 | Python | 6,893 | 203 | from tempfile import NamedTemporaryFile
import tqdm.auto as tqdm
from permacache import permacache
import h5py
import numpy as np
import pandas as pd
import scipy.sparse
from modular_splicing.dataset.datafile_object import SpliceAIDatafile
from modular_splicing.data_pipeline.create_dataset import create_dataset
from... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.