sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
cf5c6882f518797c87f588ee92387719feaba69a0f7b5c46a2083e7a234efb00
Python
10,080
302
import argparse import json import re import sys import time import zlib from time import sleep from urllib.parse import ( parse_qs, urlencode, urlparse, ) from xml.etree import ElementTree import requests from requests.adapters import ( HTTPAdapter, Retry, ) BATCH_SIZE = 50000 # Limit at UniPro...
54d90b9e3674164b568367d83e1c55d7ca1bff0ca55838c1a2f891e72a6d2237
Python
10,081
241
import torch import torch.nn as nn from tqdm import tqdm import argparse import os import PIL import cv2 as cv from PIL import Image import numpy as np import functools from torchvision.models import squeezenet1_1 class StainNet(nn.Module): def __init__(self, input_nc=3, output_nc=3, n_layer=3, n_channel=32, kerne...
f82fd0b432ed742215c3584d8668e48d1a72b2745df5bb8f15d7b1672925746b
Python
10,081
234
# SPDX-License-Identifier: LGPL-2.1-or-later #!/usr/bin/env python #-*- coding: utf-8 -*- import numpy as np import os from collections import OrderedDict from .utils import general as utils from .write_to_file import save_data_cvs, save_visit_duration from .plotting_functions import make_visit_duration_histogram def...
3a3136b0e1c7819ace670bef71ce47a34fce31dc3e1b87a27140a19abdd9e28e
Python
10,082
273
# Run test with: # torchrun --no_python --nproc_per_node=8 pytest -q -s tests/modules/test_block_parallel.py import math from functools import partial import pytest import torch import torch.nn as nn import torch.nn.functional as F from apex.transformer import parallel_state, tensor_parallel from einops import rearra...
402bd38484fcade795d8fb56b8fb5c9b45c717ff120fbebfaae267c194440a12
Python
10,086
276
# -*- coding: utf-8 -*- # Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl> # All rights reserved. """Raw analysis.""" import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl def test_signal(T=100, fs=1): """Return a test signal.""" dt = 1 / fs x = np.arang...
0d9c5790a603adfd5a9b7550edade27e8e0e7dcdb5e7965fca539ec160af4640
Python
10,088
277
#!/usr/bin/env python """Refresh the vendored extract indexes in ``pyrosm/data``. Run this to update the extract lists used by ``pyrosm.get_data_by_bbox`` and the area extract lookup:: python scripts/update_extract_indexes.py # both python scripts/update_extract_indexes.py geofabrik # or: bbbike, ...
a15b9d7eba8c0e72805209c0484412eb841116131819c062d6891893fa677eb8
Python
10,088
301
"""This module handles indels and frameshift mutations. Indels and frameshifts are detected from the allele columns of the mutation input. """ import prob2020.python.utils as utils import numpy as np import pandas as pd def simulate_indel_counts(indel_df, bed_dict, num_permutations=1, ...
5e7a1beb2b00889f3896ea565050813130f884c07f66cf351d3cb020131cfc93
Python
10,089
202
# -*- coding: utf-8 -*- """ Created on Fri Jul 15 15:26:39 2022 @author: 8 """ import os import torch import copy import utils import json import warnings import numpy as np import pandas as pd import tgan_utils import time, operator import matplotlib.pyplot as plt import torch.optim as optim # from MSCNN.MSCNN_uk impo...
f93133bd174f481118998146f67a554d2b949fe03ae05083db399c07b98f2e27
Python
10,090
271
from collections import OrderedDict import copy import pkg_resources import numpy as np from PyQt6 import uic, QtCore, QtWidgets class Visualize(QtWidgets.QWidget): image_changed = QtCore.pyqtSignal(np.ndarray) def __init__(self, *args, **kwargs): """Everything concerning image visualization""" ...
ccdfd8d44fd0616e592bd9b6eb851d767abe50187c553e0e20acdc296ad8773b
Python
10,091
407
r"""Functions that can be used for model fitting. Conventions: - Each function in this file should be named as `{LABEL}_function` - Each function takes as input: - `xs` : the input frequency vector - `*params` : a variable number of input parameters - For aperiodic functions, this is the number of inpu...
ea3d2de145e76ae40ee51eed78f96e179714da806f754eca175350efc22c8f87
Python
10,092
228
# coding: utf-8 import glob import pandas as pd import os import nolds import numpy as np import matplotlib.pyplot as plt import scipy.stats from helper_functions import get_total_number_of_epochs from create_histograms import _get_histogram_values_in_sec from nolds.measures import logarithmic_n, poly_fit, plot_reg ...
cb82b86830f07f76c15b5f5bdc702454075ed13956b0132ac0b0c280d9d78b3f
Python
10,103
279
""" Unit tests for database metadata caching (io/cache.py). Tests SQLiteDatabaseMetadataCache operations including: - Cache file creation and management - Metadata querying and caching - Experiment info storage and retrieval - Cache listing and summarization """ import json import os import shutil import sqlite3 impo...
f8caf30623821a3254d73731b7c7184354b77780a78a52148b4db4b90c1e2aef
Python
10,104
276
# 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...
707456789e426fc54c09816cbdca68e9b98dec9917d5ff09d4d2ecfd096117cb
Python
10,105
333
"""T-CALLABLE-IDENTITY: the D8 classifier battery (lane F18, item 15). The merged acceptance shape: legitimate transforms classify COMPLETE with zero false refusals, collision pairs SEPARATE (defaults, kw-only defaults, bound methods differing only in instance state, closure tensors with identical repr), must-refuse c...
e1f9a17a8fc5cbf6faef57155b5fca742eaf6215ff05805458c9fa31c271b2a2
Python
10,106
274
'''Test for bdpy.vstack''' import unittest import numpy as np from bdpy import BData from bdpy.bdata.utils import vstack, metadata_equal class TestVstack(unittest.TestCase): def test_vstack(self): x0_data = np.random.rand(10, 20) x0_label = np.random.rand(10, 1) x1_data = np.random.r...
457b14eb475e0ad9fa1ee04db066d97107fc4d61b76997057d8f3d0e28ff553e
Python
10,108
312
import time import logging import numpy as np import pylsl import ipdb from libmushu.amplifier import Amplifier logger = logging.getLogger(__name__) logger.info('Logger started.') class LSLAmp(Amplifier): """Pseudo Amplifier for lab streaming layer (lsl). This amplifier connects to an arbitrary EEG dev...
0f4f85e59eb0bd6ae0fe24ddb56039ef2befd947902269f14a4ce91cfd4259eb
Python
10,110
238
import subprocess import pkg_resources def install_required_packages(): # List of required packages required_packages = ['spams', 'staintools'] installed_packages = [pkg.key for pkg in pkg_resources.working_set] missing_packages = [pkg for pkg in required_packages if pkg not in installed_packages] ...
75c0b4f2aa7bbfd00e6d8b5d0bb10d17c588f0331ab29e8206c3d1659cc3f0f7
Python
10,120
388
""" This module contain all tools """ import numpy as np from scipy.linalg import norm from scipy.optimize import minimize_scalar from .core import Connectivity def histogram(val, bins, density=False): """Fast histogram Parameters ---------- val : array Values to be counted in bins. bin...
d0b8f440c45e0708c75d618d4ed9e2b76c1fcaed003d4083740c4d3e58ac0f6a
Python
10,120
272
import fnmatch import logging import os import os.path as osp import time import numpy as np from qtpy import QtCore import llspy from llspy.gui import workers from llspy.gui.helpers import ( newWorkerThread, shortname, wait_for_file_close, wait_for_folder_finished, ) _watchdog = False ActiveWatcher ...
f376849f3510202470e9dc8b2852eab2816289348ecf9e82ebfd41e88dcddf4d
Python
10,121
259
"""Golden receptive-field tests for the built-in T5 rule pack.""" from __future__ import annotations from collections.abc import Iterator import pytest import torch import torch.nn.functional as functional from support.rf_isolation import preserved_rf_registry from torch import nn import torchlens as tl from torchl...
579267c0a6c42f3fc349f5ce78259b9a2cf0193622cefe8278e457c207b05efb
Python
10,122
316
"""TensorFlow static-label intervention preview tests.""" from __future__ import annotations from typing import Any import numpy as np import pytest from conftest import tensorflow_backend_modules import torchlens as tl from torchlens.backends import BackendUnsupportedError from torchlens.backends.tf.backend import...
83eaa774c2dc1fdce1d78af4372a6c0a57b98b0299833312c17040a54708f74c
Python
10,123
264
""" Framework Phi computation — single source of truth. The Consciousness Potential is computed as a product of channels: Phi = I_A · (1 - H_norm) · I_R · I_P (canonical, 2026-06-13) C100 = 100 * Phi / (Phi + PHI_REF) Channels: I_A — directed-coupling-weighted activity (∑_i n_i · D_i) org ...
adf4f439cdef638414c31289e5ea8dfb47434dec95978e1d5e9219c4530ce2ac
Python
10,123
232
from aud_dnn.resources import d_layer_reindex, d_randnetw import numpy as np import pickle import pandas as pd def load_rsa_scores_across_layers_across_models(source_models, target='NH2015', value_of_interest='all_data_rsa_for_best_layer', roi=None, randnetw='False', ...
540a396a137f8357d61b26869dfe02d7e66bbd268f29da5e3bea5aa36e6453a1
Python
10,127
326
"""Tests for TorchLens stack introspection helpers.""" import os from types import FrameType import pytest import torch from torch import nn import torchlens import torchlens as tl from torchlens.data_classes import FuncCallLocation from torchlens.utils import introspection class RecursiveStackModel(nn.Module): ...
08e7b39b3b22938da9ff5ba76f640917518894803eac08e6615c917be21edf33
Python
10,128
283
import time from datetime import datetime, timedelta from datetime import timezone as datetime_timezone import pytest import requests from pytest_celery import CeleryTestSetup from requests.auth import HTTPBasicAuth from celery import Celery, chain from t.smoke.tasks import add, noop from t.smoke.tests.quorum_queues....
bb1852ce9728abdd9b7f8bfb2ab03b6bb46880982d5be1c80f1524a3dc6af612
Python
10,128
253
# flake8: noqa import numpy as np import pytest import tensorflow as tf from absl.testing import parameterized from tensorflow.python.eager import context from keras.src import backend from keras.src import testing from keras.src.optimizers.sgd import SGD @pytest.mark.skipif( backend.backend() != "tensorflow", ...
57bf3aed21059ef604f1e6db4eec8f6069f3416f245dd9b09cda188c2f716074
Python
10,132
280
"""L6 stage 4a: cross-run selection alignment (``ResolvedSelection.align_to``). Pins the cross-run door: alignment keys on the L1 structural site keys each ACT entry records (the bridging relation), SAME-POLICY captures only per the L1 cross-stamp rule (healthy, agreeing grouping stamps on both sides), masks travel un...
41688b6b86efe568f856a06a83115b7b5172bc2bce2c98744be812c88875b00f
Python
10,134
240
import os import subprocess import logging import tempfile import json import time from pathlib import Path from getpass import getuser import pytest def _get_gpu_ids(): visible = os.environ.get("CUDA_VISIBLE_DEVICES") if visible: return [g.strip() for g in visible.split(",")] try: resul...
629d481658aaec7076a55913eda38c270ec45d430b34b2f9d38b2eec2b0ad3da
Python
10,134
298
from __future__ import annotations import importlib.metadata import typing as t from contextlib import contextmanager from contextlib import ExitStack from copy import copy from types import TracebackType from urllib.parse import urlsplit import werkzeug.test from click.testing import CliRunner from click.testing imp...
d39574de085e78ad90ad03433b5b8bf331d0553a730456521707dc5bc9b9ebed
Python
10,135
243
import glob import pickle import numpy as np import figure_properties as fp import matplotlib.pyplot as plt from matplotlib import gridspec, colors, cm def fetch_parameter(path, seed, case): try: ff = open(path + '/' + str(seed) + '_' + case + '.npz') ff.close() print(path + '/' + str(see...
24910382dc7d42ba4fb443b0b333b2dc989997dcab3d58d3d21d48b3562d6b4b
Python
10,137
251
from abc import ABC, abstractmethod from typing import List, Optional, Tuple from torch import Tensor from torch.nn import Module, Parameter from lightly.models import utils class MaskedVisionTransformer(ABC, Module): """Abstract base class for Masked Vision Transformer models. Defines the interface for a ...
318597a7d1496ae65f64a914804a6700746866e15168c6656632febfb776c6e3
Python
10,137
289
''' load the RBNS data ''' import csv import re import h5py import urllib3 import urllib import gzip from io import StringIO import requests import numpy as np import time from utils_rbns import create_datapoints rbns_data = 'metadata_rbns.csv' encode_dir = 'encode/' data_dir = 'data/' protein_idx_map_txt = 'protein...
dcb4ac58dc2a1ff76e6a28726ce40e97c1e204d4fa64c5fd9b94ace414eafae1
Python
10,138
246
"""Error-refusal contract doc <-> code LOCKSTEP (grind B1-11 / matrix R64+R11). ``docs/reference/error_refusal_contract.md`` is the public vocabulary of stable refusal codes, and its closing sentence makes adding or renaming a code a documented public change. Until this module existed nothing enforced that: the doc's ...
f35754d4e6ce4352026cf8b15738b7e288e64df7c066e8fd7fcda072f7eaea3c
Python
10,138
243
''' Functions to compute performance metrics. Note that these functions are much slower than your usual performance metrics. Due to overlap and window scoring. ''' import pandas as pd import numpy as np import os import pickle from typing import List, Tuple from tqdm.auto import tqdm PEPTIDE_START_STATE, PEPTIDE_EN...
1052767ffbf08fc113801e0d3358d2c0d03a3d59648c0b3bfd40a4271f62cefc
Python
10,139
308
import re from multiprocessing import TimeoutError import numpy as np import pytest from gym.error import AlreadyPendingCallError, ClosedEnvironmentError, NoAsyncCallError from gym.spaces import Box, Discrete, MultiDiscrete, Tuple from gym.vector.async_vector_env import AsyncVectorEnv from tests.vector.utils import (...
258537f9fb6327b7e6562663455c024a05e53ef0d0d5cb631dffa75f68ae23d0
Python
10,141
287
from keras.src import ops from keras.src.api_export import keras_export from keras.src.backend.common import standardize_dtype from keras.src.initializers.initializer import Initializer from keras.src.saving import serialization_lib from keras.src.utils.module_utils import scipy @keras_export(["keras.initializers.Con...
a417bb0e8a99a6a722fcf25a5a97a1ecd86a8436c501b7d608f8521f1510f129
Python
10,142
292
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Utilities to read and write nifiti and cifti data.""" import os import shutil import nibabel as nb import numpy as np from isal import igzip from nilearn import masking from nipype import logging from ...
91c90e761d952f1026be1e983628bc02c095eb1ffbfc40e54d61868bdfcf87ee
Python
10,144
210
from __future__ import division from __future__ import print_function import sys import argparse import logging logging.basicConfig(level=logging.INFO) import time import numpy as np import mxnet as mx from tqdm import tqdm from mxnet import nd from mxnet import gluon import gluoncv as gcv gcv.utils.check_version('0.6...
ad4c4f62751563f04d28d788c03cd81f512d4f84dda98088331c7d736cee1da3
Python
10,146
295
import torch import torch.nn as nn from modular_splicing.models.modules.constant import Constant from modular_splicing.models.modules.positional_encoding import PositionalEncoding from modular_splicing.utils.construct import construct class TanhConvolvedAttnLayer(nn.Module): def __init__( self, e...
e66f8dac2fa2f1a3d6f4e96efa0c56e06d7a5b7040f33de9f93156325f9fb85c
Python
10,147
266
"""Tests for structured replay-failure diagnostics (sprint bucket B1). These cover the ADD-ONLY diagnostics side-channel that lets a forward-validation mismatch carry the ACTUAL reason (divergent op, shapes/dtypes, max abs/rel diff, which check fired) instead of the bare ``repr(False) == "False"`` that previously reac...
ce062e2e85e9bf2695abcd801f5acdc77535e8b5f22849d1a4b5d9ed8861c4ff
Python
10,151
281
# SOURCE: vendored from Nablax/ACLnet-Pytorch @ master # (https://github.com/Nablax/ACLnet-Pytorch/blob/master/models_pt.py, # https://github.com/Nablax/ACLnet-Pytorch/blob/master/ConvLSTM.py) # # The queue's listed repo (wenguanwang/DHF1K) is the *dataset* repo for Wang et al.'s # original ACLNet paper and contains n...
254e4de2da21e91bfd4a81106dc2e183f90225d9e3ca2cfd29be1eb347ead229
Python
10,153
296
"""Staged intervention hooks never accumulate across repeated runs. Regression pin: after ``tl.trace(model, x, intervene=spec)`` every legacy rerun ``trace.run(model, x)`` merged the hook plan it had normalized FROM the trace's own spec back INTO that same spec object, so the staged hooks doubled per rerun (1, 2, 4, 8...
338e03de7ce74e166cc82e9e47fc14de7339076c3ed7e97a3b36800ba1358ae8
Python
10,153
254
import torch import pandas as pd from transformers import BertModel, BertConfig import pdb from omop_learn.utils.date_utils import to_unixtime eps = 1e-8 class OnehotModel(torch.nn.Module): def __init__(self, featdim, outdim): super().__init__() self.featdim = featdim self.outdim = outd...
4f4934898fb86aa03b0dcbf24c19c8286a1bc8f28081e4bb7d63c251c276adfd
Python
10,153
231
# 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 ..vgg import vgg16 __all__ = ['vgg16_ucf101', 'vgg16_hmdb51', 'vgg16_kinetics400', 'vgg16_sthsthv2'] class ...
a9703123a20af03ecf83b8876c0537868320de80aefdfde992156197cb0b8b0f
Python
10,153
318
""".. _lightly-simclr-tutorial-3: Tutorial 3: Train SimCLR on Clothing ============================================== In this tutorial, we will train a SimCLR model using lightly. The model, augmentations and training procedure is from `A Simple Framework for Contrastive Learning of Visual Representations <https://ar...
61293aa17e9c30d1d6dd3bdf127c5dcce98c25b6607c193641264db982dd5f5c
Python
10,156
251
import pytest import torch from torch.nn import Linear 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("TIMM vision transformer is not available", allow_...
184e54948794d6cb16d554d8fa3a73c65b4001b7c7c52ce9ac119a59f17490d7
Python
10,157
287
""" Functions for annotating spots as cell types. """ import os import numpy as np import scanpy as sc import stlearn.tl.cci.r_helpers as rhs def run_label_transfer( st_data, sc_data, sc_label_col, r_path, st_label_col=None, n_highly_variable=2000 ): """Runs Seurat label transfer.""" st_label_col = sc_...
2aab5d37aa3d4af11ed94c037061ccd3c1505538f5021769a33baaa0b8a1c486
Python
10,157
286
"""The completeness backstop counts a stale torch call inside a wrapped submodule. A torch function bound before TorchLens wraps torch (a module-global ``from torch import f`` alias, as in legacy ``torch.nn.utils.weight_norm``) reaches the dispatcher with no torch-function wrapper. At the top level the witness records...
294e98e112ffb165b09282d02dcf00f652b9ba3ef7ff62a4932e005fac65e459
Python
10,160
387
"""Compact faithful scientific neural architecture classics. Paper: Deep Ritz Method, Deep Galerkin Method, Behler-Parrinello HDNNP, HIP-NN. """ from __future__ import annotations import torch import torch.nn as nn import torch.nn.functional as F class ResidualMLP(nn.Module): """Residual multilayer perceptron ...
61a89dd951fdcca8663408cdbf326abecab541de46631ef5985de3db3d424875
Python
10,160
256
import wandb import numpy as np import os from tqdm import tqdm import torch from torch.utils.data import DataLoader import argparse from sklearn import metrics import torch.nn.functional as F from datasets.openmic import get_test_set, get_training_set from models.mn.model import get_model as get_mobilenet from models...
2085cb73fac517b3fb057a2838b94b3ec61526087282802275abee01d7e6a72f
Python
10,164
293
"""Functions related to visualization of RDMs. Authors ------- Marijn van Vliet <marijn.vanvliet@aalto.fi> Takao Shimizu <tshimizu.midd@gmail.com> """ import types from functools import partial import matplotlib.pyplot as plt import numpy as np import mne from mne.fixes import _compare_version from mne.viz import Br...
9045faf417d4167b0b566c7cbccc1b2b51df782f33cd0185e8119f1a7746469e
Python
10,167
291
"""Hypergraph Neural Network (HGNN) and Cellular Sheaf Neural Network. HGNN: Feng et al., "Hypergraph Neural Networks." arXiv:1809.09401 (AAAI 2019). Source: https://github.com/iMoonLab/HGNN Cellular Sheaf Neural Network (SheafNN): Bodnar et al., "Neural Sheaf Diffusion: A Topological Perspective on Heterophi...
9c6a376d00aaa6ba85ce0b92bd469806c6083a229390ae7865a6e254fa54d66d
Python
10,168
245
# 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...
c39f2c61112a5baaad65e249cec186874623b94a95327a7f03d346c038b9d635
Python
10,170
287
import os import argparse import random import yaml import logging from functools import partial import numpy as np import dgl import torch import torch.nn as nn from torch import optim as optim from tensorboardX import SummaryWriter logging.basicConfig(format="%(asctime)s - %(levelname)s - %(message)s", level=log...
472e4c2248f8cb9b789a58af93379e8aa8764b7e2c312f5cc83323eac14b16ee
Python
10,171
227
import os import torch from collections import OrderedDict from abc import ABC, abstractmethod from . import networks class BaseModel(ABC): """This class is an abstract base class (ABC) for models. To create a subclass, you need to implement the following five functions: -- <__init__>: ...
50a7c758afff7982bc8c4d8b5a198240543dae1fc5de4c22136d44fdf853829f
Python
10,172
218
# 均匀采样效果较差 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 torc...
57cba50341139787402245aced1ef550f2d3ce0e6f9373cef37cf6130eb3447a
Python
10,172
183
import os import pandas as pd import numpy as np import pdb from sklearn import linear_model import scipy import regression_funcs as rf usage = "regression_model_sliding_window_beta_slope.py [options] <cluster>" long_help = """ Computes regression model for slope of beta lateralization dependent on bias and stimulus ...
764aaeea4a3323567ba6076fd0c85ad211bebf7294ac6101a76c39dccb34f35a
Python
10,172
265
"""Module-granularity netron export (lane F14, netron memo D-11/D-12, ruling N2). Per-call FunctionProtos with recursive nesting, depth-1 interim default, single-op inlining with FunctionProto DELETION, non-empty root, per-function valueInfo, signature-style formal input names, per-call keying on reused modules (compo...
bfe7eaca567595e4e2c7ef76b5e2df3bd791f661bf7deb394bf4014edd47e27c
Python
10,174
224
#!/usr/bin/env python3 """ File: simulate_expression2.py Created: 2023/07/13 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. "...
cc88cfe42f13d5471410491a88cf923d1148686acaa0a7b9f2363f265b446c61
Python
10,177
334
#from ..cython import cutils import numpy as np import os import prob2020.python.mymath as mymath import sys # import pickle module try: import cPickle as pickle except: if sys.version_info < (3,): print('Falling back to regular pickle module') import pickle as pickle def retrieve_scores(gname, sd...
492869b7b8bd0b958521a73e59d492105b7ffabd2d986be8507905b9cb744825
Python
10,179
272
import os import pandas as pd import numpy as np import pdb import scipy from sklearn import linear_model import regression_funcs as rf usage = "regression_model_motor_beta_dB_new.py [options] <cluster>" long_help = """ Computes regression model for beta lateralization dependent on bias and stimulus strength """ fr...
d6b457a969f108a132ba22c6af40673b6c91ecc2de855241699029602c6956bc
Python
10,181
271
"""Correlation-ID join correctness on synthetic fixtures (torchnative W2.2). The join's correctness properties are proven on synthetic normalized-event fixtures with hand-set thread ids -- the ONLY sanctioned cross-thread negative control: torch's profiler records nothing on a plain Python thread, so a live Python-thr...
7df2d8d7dbcdf55444c904cc76ff65ce716788679fbe03e836436702b1cb397a
Python
10,183
294
"""Quality control metrics.""" import nibabel as nb import numpy as np from nipype import logging LOGGER = logging.getLogger('nipype.utils') def compute_registration_qc( bold_mask_anatspace, anat_mask_anatspace, bold_mask_stdspace, template_mask, ): """Compute quality of registration metrics. ...
058f92c48b29c9fe41056721f56b364d99e9e4368a21527a51e6ac9b92cf1908
Python
10,185
235
import time import sys import os import functools import importlib import multiprocessing as mp import deepdish as dd from brian2.only import * import brian2genn # for the IDE: import numpy_ as np import spatial, model, inputs, readout from util import brian_cleanup from digest import get_voltage_histograms def run...
8fea3866ec5e4aef981233390d21fe58844a329cb76adf98752f356db95e6906
Python
10,187
275
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Test that the AMBER DFTB implementation of AMBER and CHARMM using 3ob-3-1 parameters are equivalent. """ # ===...
dcdbdf6de143d86b6a15267245fb874b1b135713e27039ebcdcad1aa45307122
Python
10,188
279
# -*- coding: utf-8 -*- """ Created on Mon May 11 12:21:33 2020 @author: Sergio Marconi and Dylan Stewart """ from parameters import evaluation_parameters from RandCrowns import RandNeon import time from tqdm import tqdm """ Created on Tue May 5 10:28:41 2020 input variables: GroundTruthBox - numpy arra...
4389a330db10d2f5c785f49bb3eeccc98c743d58a47e085ad7076f1397cdf2b6
Python
10,191
240
import ipdb import torch import numpy as np from pandas import read_csv import os from tqdm import tqdm import torch.utils.data as dat class Dataloader: def __init__(self, database_wdir, nums, time_step, tw): self.database_wdir = database_wdir self.nums = nums self.time_step = time_step ...
45f2e444d86c2b477181d77ce3124c21c17ce5afda6113949884e7a5259311a2
Python
10,191
306
import threading from types import SimpleNamespace import pytest from celery import states, uuid from celery.app.task import Context from celery.result import AsyncResult, GroupResult from t.integration.conftest import get_active_redis_channels from t.integration.tasks import identity @pytest.mark.celery( resul...
e619b9d0db06c714aad07bfbde24ec6c5d294d4bc05350049b2aaf00fc647249
Python
10,191
301
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Hoverlabel(_BaseTraceHierarchyType): _parent_path_str = "ohlc" _path_str ...
0bd9b28874cfb4bfd0f6697f40614160f462d7d4e365585c9eaf3f82d3678890
Python
10,192
242
# Copyright 2006, 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 conditions and the f...
3011baf76160fefb11140069e51a83adfbbd654aadaa084ebfb5464c5be55d47
Python
10,193
251
from library.shared_vars import sim_results_dir, plots_dir from os.path import join import numpy as np import matplotlib.pyplot as plt import os import pandas as pd from library.utils import load_pickle import matplotlib as mpl for analysis_tag in ['', '_NoRecurrence']: print('Analysis Tag = ', analysis_tag) ...
8febc14098f7b97f57074d1d974d9e82d7136239499f1959d1c3cdfbbe3b156b
Python
10,193
269
import numpy as np import pytest import torch from conftest import ( dataset_options_factory, get_mapping_idx_to_euler_angles, model_options_factory, network_factory, ) from e3nn import o3 from e3nn.util.test import assert_equivariant from torch_geometric.data import Data from torch_geometric.loader imp...
22539b991ad414247a8edac79744cf370d3961c6db50b16c7d943fb1268ab665
Python
10,194
252
from __future__ import annotations from typing import Any, cast import awkward as ak import numpy as np from awkward.contents import ( EmptyArray, IndexedArray, IndexedOptionArray, ListArray, ListOffsetArray, NumpyArray, RecordArray, RegularArray, ) from awkward.index import Index fro...
11d01790971dd4f635b8ef0dae4bb2d191a7d095339a2b14fb61caf4a111d15e
Python
10,195
335
import argparse import json import sys from copy import deepcopy from pathlib import Path def parse_ids(raw): ids = set() for token in raw.split(","): token = token.strip() if not token: continue if "-" in token: a, b = token.split("-", 1) ids.update...
b26b57de715ec019c83249d07b7a6042defd604129f9977ce0508365d009d167
Python
10,196
312
# 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...
f5443ecbd1effce4486f77064c0245722d7e5659f7404a62314f5e25597451a7
Python
10,196
274
"""A02 refusal + tripwire rows: anchors refuse rather than guess. Planted-wrong and refusal rows for the residual/lm-head dataflow anchors (mikit gate 1 item 7 discipline: every wrong implementation must FAIL typed, never return a plausible tensor): - resid_pre refuses on ambiguity (two matching streams) and on no-ma...
841db902c5dbf24b1e986bd2bc97d210ad36b58fff99c559e36d40d48a1c072d
Python
10,202
324
""" some ordinal regression algorithms This implements the margin-based ordinal regression methods described in http://arxiv.org/abs/1408.2327 """ import numpy as np from scipy import optimize from sklearn import base, metrics from sklearn.utils.validation import check_X_y def sigmoid(t): # sigmoid function, 1 /...
3a4ddf8963045d345bc1a1e8d9df372e01aaac93e4a34e2ad60adb03e326d023
Python
10,203
254
import awkward as ak import numpy as np import pytest from seqpro.rag import Ragged from seqpro.rag import zip as rag_zip from seqpro.rag._ops import to_packed def _to_list(rag): """Awkward nested-list view of a _core.Ragged for value comparisons. _core.Ragged is not an ak.Array, so ``ak.to_list(rag)`` cann...
c6703483260ccbda91e4ab43f5315bda322ceda9ed9b970874d1cc7c1bea2981
Python
10,203
223
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import ast import contextlib import json from abc import ABC, abstractmethod from pathlib import Path from typing import Any import torch from ultralytics.utils import YAML def _read_proto_map(file: Path, path: ...
111d07229e12840da40cc14368e99edecf2dfd24b30e1b7be5c8b7859c99a95d
Python
10,206
318
#!/usr/bin/env python3 import numpy as np import pandas as pd import sqlite3 import os import logging class DbAccess(): """ This is the class to create sqlite3 db for KEGG pathway and records """ def __init__(self, db): self.db = db self.conn = None self.c = None def init_...
d1673fce6315f5e582c301f7c3e294288667601527ad4f5154c0ea04870ca19a
Python
10,207
265
""" The GROVER trainer. """ import os import time from tqdm import tqdm from logging import Logger from typing import List, Tuple from collections.abc import Callable import torch from torch.nn import Module from torch.utils.data import DataLoader from BatmanNet.model.models import MyGMAE_Task from BatmanNet.util.mult...
d0fe1d7a77ec251476d4747921418f53fd0a8bcc4ddad156e222089792abad28
Python
10,208
253
#!/usr/bin/env python3 """ File: correlate_components_with_genes.py Created: 2021/05/25 Last Changed: 2022/05/17 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 ...
3a0100ce4863f63b95b2443a41f8f0703e59914a3072c0a6845354d9be1e1cc5
Python
10,210
218
# 均匀采样效果较差 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 torc...
9274593d15ad3f7ee1e37bac3733414da6cc26825d91a1dfa369828b6352146e
Python
10,211
312
# 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...
a690280c9d0eb494563010922390f61303573749ffb795faefa69015a4b6f344
Python
10,211
279
from __future__ import print_function import random from copy import deepcopy import numpy as np from .ZIFA import checkNoNans, Estep, Mstep, initializeParams """ Block zero-inflated factor analysis (ZIFA). Performs dimensionality reduction on zero-inflated data. Faster than ZIFA: uses block subsampling to increas...
68e72b30d118b89f2b58ceecadc571032987b0fb109eaecca6b828e10d2431c3
Python
10,212
262
"""F12 pins: N16 view-aware source families and the N10 budget resolver. Covers the memo's composition-test rows 5 (the resolver lands the band, discloses the dial by name, deterministic) and 11 (the view x source pairing four-cell matrix), plus the zero-coverage refusal in the F12 row gate. """ from __future__ impor...
f4cc5a132f001e223a8f5eef1779b0090205871458706dd5ae8a9c453dab26fa
Python
10,218
222
import os import torch import pandas as pd import numpy as np import scanpy as sc from sklearn import metrics import multiprocessing as mp from sklearn.metrics.cluster import adjusted_rand_score, normalized_mutual_info_score from sklearn.metrics.cluster import ( v_measure_score, homogeneity_score, completeness_scor...
58661175b2465aea6457723b96e5b76c7304fb8be76ee70718a6b22cb38280a9
Python
10,219
215
import os import sys import time import argparse import logging import math import gc import json import numpy as np import mxnet as mx from mxnet import nd from mxnet.gluon.data.vision import transforms from gluoncv.data.transforms import video from gluoncv.model_zoo import get_model from gluoncv.data import VideoCls...
be5b84cfd74af4f6f7570a26fcf05110facd3c28d8c3d3d2761b9531aeb94623
Python
10,219
267
# Prototype of Kohonen's Self-Organizing Maps import numpy as np import itertools as itt from . import metrics from .metrics import euclidean import sys from .utils import _sorted_memberships from .utils import sort_clusters_by_size def neigh_gauss(x1,x2, r): return np.exp(-euclidean(x1,x2)**2/r**2) def vorono...
6d73e3cf8d86924b4d41758e4489f18db28a7a37ebacdae506cf08b15469d60d
Python
10,221
349
''' Plotly graphs used for results visualization. ''' import os import copy import dash import pandas as pd import plotly.graph_objects as go ################################################### ## GLOBAL SETTINGS MY_COLORS = { 'fontColor':'rgb(60, 60, 60)', 'boxesColor': "#F9F9F9", 'backgroundColor':...
3cb7744eb05f0e920d8d1926073ad80357100b692eb893120fe24ad6c0f36038
Python
10,222
274
import pickle import numpy as np from absl.testing import parameterized from keras.src import backend from keras.src import dtype_policies from keras.src import losses as losses_module from keras.src import ops from keras.src import testing from keras.src.backend.common import set_keras_mask from keras.src.backend.co...
e3e06d335649d02fe609f5cbe8b7b0eca10f10d67af36b5426b664bb6ea9bc1a
Python
10,223
271
"""Checks kit item 1: scan kernel, audit_params, ParamAudit, JSON export. Pins the checks memo 4.4 contract: mapping-only door, tied-alias dedup, skip-with-reason, unknown-name refusals, severity mapping, the versioned export, knob parity with dtype_range_audit, and the fp16 peak-allocated- bytes regression (NO whole-...
cdca775a608c8c9ada8dfafd4a04b52f71f8172caea7df5fe53c89414f79ed8f
Python
10,231
246
"""Functions to segment regions of a slice by UMI density. """ from collections import Counter from typing import Dict, Optional, Tuple, Union import cv2 import numpy as np from anndata import AnnData from kneed import KneeLocator from scipy.sparse import csr_matrix, issparse, lil_matrix, spmatrix from sklearn import ...
a87e64f54adf948a17b9ab5372827630461d46ddf9e8fe95f2fcb53125741d68
Python
10,233
354
"""Test eFEL io module""" import os from pathlib import Path import numpy as np import pytest from efel.io import load_ascii_input testdata_dir = Path(__file__).parent / 'testdata' neo_test_files_dir = Path(__file__).parent / 'neo_test_files' meanfrequency1_filename = testdata_dir / 'basic' / 'mean_frequency_1.txt...
71eb35738c9149aa5cd550ee4d6de85a2a55dc22c8637a960ddbdd6895caa0c8
Python
10,235
260
# SOURCE: vendored from Huage001/AdaAttN @ main (models/networks.py) from __future__ import annotations import torch import torch.nn as nn import functools from torch.nn import init from torch.optim import lr_scheduler def get_scheduler(optimizer, opt): """Return a learning rate scheduler Parameters: ...
2a506cc966e79f23fcfb927310d6a0ed7dc99a5fbfa8a611769080f96fe20e79
Python
10,236
279
"""Native delayed delivery functionality for Celery workers. This module provides the DelayedDelivery bootstep which handles setup and configuration of native delayed delivery functionality when using quorum queues. """ import sys from typing import Iterator, List, Optional, Set, Union, ValuesView if sys.version_info...
f8075c19e49e2ed0405a910fc1e2eb0bfea038114ed5254535b02efd139a4167
Python
10,237
87
import torch from src import datasets, models def get_dataset(root, name, split, ntau, idx, normalise=True, scale=1): if name == "single_pvc1": dataset = datasets.SinglePVC1Dataset(root, split, ntau, normalise, scale) elif name == "multi_pvc1": dataset = datasets.MultiPVC1Dataset(roo...
70c7c68d9610e7c9a2376b61a183792b92b89b31f38f60031fcbcabb830f5c42
Python
10,240
279
""" Integration tests for the backup system. This module contains tests for the backup and data synchronization functionality in the node package. """ import os import shutil import tempfile from pathlib import Path from unittest.mock import MagicMock, Mock, patch import pytest # Note: Actual imports would need to ...
a24e1d3d32491f6825d37b09f7cd7954b9dba91889d834310d8292a2b2fbe59c
Python
10,240
275
from typing import List, Optional, Union import numpy as np import torch from anndata import AnnData from spateo.alignment.methods.backend import NumpyBackend, TorchBackend, get_backend # from .methods.morpho import con_K from .methods import ( _chunk, _data, _dot, _mul, _pi, _power, _pro...
b21e648e2c6a82f12c7f189d7f10006548c841119a4af0e81b5f1d1b86de2006
Python
10,240
301
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Hoverlabel(_BaseTraceHierarchyType): _parent_path_str = "candlestick" _pa...