sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
04bcfa845232d797692e68789ab3f20580432a9f64c6cdf409fd1aabde096bd9
Python
8,290
268
"""Tests of NPZ file functions""" import shutil import warnings from pathlib import Path import numpy as np import pandas as pd import pytest import pynapple as nap # look for tests folder path = Path(__file__).parent if path.name == "pynapple": path = path / "tests" path = path / "npzfilestest" # Recursively ...
d1222d47cccbe12511fed50e368426d9cdcbc64b69d7f96fec07261eb58ad3bb
Python
8,290
203
''' This is a wrapper script that combines several functions: - Picking loci from sumstats files based on Zscores and number of SNPs - Generating LD matrices for these loci based on 1000 Genomes - LD pruning those loci and intersecting the SNPs between the studies - Running MsCAVIAR on all those loci Essentially, the i...
0a6ab68c96797e781221f7d59cb2700acba553d797fc83de08edbfe1900afa1f
Python
8,291
247
"""Vendored code from scikit-image in order to limit the number of dependencies Extracted from scikit-image/skimage/exposure/exposure.py """ import numpy as np from warnings import warn _integer_types = ( np.byte, np.ubyte, # 8 bits np.short, np.ushort, # 16 bits np.intc, np.uintc, # 16 or...
e041c85568aa34d0b11f12e77df460985f3aa7d558f76152651c4416d29fb7b4
Python
8,293
216
"""DeviceContext injection must work under ACTIVE logging, not just the fast path. Bug DEVICE-CONTEXT-LOGGING: when a ``TorchFunctionMode`` device context (e.g. ``with torch.device("meta"):``, used internally by HuggingFace ``from_pretrained``) is active, factory functions like ``torch.zeros`` must produce tensors on ...
22efbcae288d69c301a849818249da596e5b4ee07e33d4e62cb682b170fc2da9
Python
8,294
236
from unittest import mock import pytest from api.mocks import FakeAuthContext, FakeUserWithAuthDependency from dependency_injector import providers from fastapi import FastAPI, status from fastapi.testclient import TestClient from carbonserver.api.errors import UserException, get_http_exception from carbonserver.api....
fb7377fa245512153bfaf4e48504616853708d1d78ef63d3a885145fbd313f56
Python
8,296
218
"""Fake quantization with learnable ranges, for quantization-aware training.""" from keras.src import backend from keras.src import ops from keras.src.api_export import keras_export from keras.src.backend import KerasTensor from keras.src.backend import any_symbolic_tensors from keras.src.backend.common import standar...
32bedd662415d060ddae79ff06fa4169022ce15d26e25c10faca806c7447404f
Python
8,297
245
from __future__ import annotations from typing import Optional, Sequence import torch import torch.nn.functional as F def activation_from_name(name: str) -> torch.nn.Module: table = { "ELU": torch.nn.ELU(), "ReLU": torch.nn.ReLU(), "LeakyReLU": torch.nn.LeakyReLU(0.01), "GELU": t...
c36af284f9cadecf818deb64c73a1468ceb66519645dd1c30b23c067bd78c768
Python
8,298
225
"""Echo narration benchmark rows (lane F28; snoop memo build row 9). Measures, on real architectures (torchvision resnet18 with pretrained weights; the real HF gpt2 checkpoint when cached, else the config-built architecture), for SUCCESS and CRASH paths: - baseline raw forward; - the record substrate (no echo) and re...
1687f6e04c60730cc0e2ea0878083292282ba4999891702bb5c5c54dce92f969
Python
8,299
221
# Copyright (c) 2024 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...
d9126c8546ef1813b64fce1d323c0d76582d9061acae0adfcb7de7f5524ebc50
Python
8,302
301
""" Copyright (c) 2022 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE BLUE BRAIN PROJE...
8c5424f592f5874f9b16e63cfdf3144dcf6f6a0dbbe1f2bc2ceb53fb88554797
Python
8,303
200
import platform import numpy as np import vtk, slicer import vtk.util.numpy_support as vtk_np from slicer import vtkMRMLScalarVolumeNode from slicer import vtkMRMLLabelMapVolumeNode from Logic.BiomedisaParameter import BiomedisaParameter from SegmentEditorCommon.Helper import Helper import subprocess import tempfile fr...
f7daa10d3e4f714fe8f4a0af13d0827c58349b0a49041ddd454a8a9e3a35f78a
Python
8,307
226
import numpy as np import scipy from scipy.cluster import hierarchy from scipy.spatial.distance import squareform import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt from scipy.spatial import distance Z1_COLOR = (234.0/255, 29.0/255, 37.0/255) Z5_COLOR = (43.0/255, 61.0/255, 150.0/255) def read_le...
38b355d72211267be844406127a45e2f2ae9f25f96bd3402499b436a778b30ac
Python
8,308
203
import numpy as np import pickle import matplotlib.pyplot as plt from utilities import dataloading_utilities as dlutils from utilities.folders import * from torch.utils.data import DataLoader from training import train_utilities as trutils import os, sys from config import * sys.path.append(where_am_i()) from mode...
2eb131b8da8e7c4b20f7c4e7cd7f46324f6717572511fe367ae93e5bb87392d3
Python
8,310
211
"""Wrapper for recording videos.""" import os from typing import Callable, Optional import gym from gym import logger from gym.wrappers.monitoring import video_recorder def capped_cubic_video_schedule(episode_id: int) -> bool: """The default episode trigger. This function will trigger recordings at the epis...
5d28e8a7a28acd17f0c9ff75c80f78d29100c16bc186833c3b1ce645c2c3fae7
Python
8,310
198
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from ultralytics.utils import TESTS_RUNNING from ultralytics.utils.torch_utils import model_info_for_loggers try: assert not TESTS_RUNNING # do not log pytest import wandb as wb assert hasattr(wb, "__version__") # verify package is not...
45bc7702487cdcf5f74c04bb63cb877ea396843a2834d4aac0f2da6b99f23fd5
Python
8,315
149
"""Протокол B: «Когда выгодно учиться». Единая точка правды для конфигурации. Мир B отличается от мира A ровно тремя вещами, и все три записаны здесь: 1. два типа еды, роли которых меняются в непредсказуемые моменты; 2. мир богаче (patch_threshold 0.0 и regrowth 0.008 вместо 0.35 и 0.004), чтобы питательная п...
ffd5ef89e264edf6dd71ed7cb76b9a7b5ff1a2f3643fca84558ebec9cdd50cb9
Python
8,317
216
import pickle import torch import torch.nn.functional as F from trainingUtils import NBLoss,_convert_mean_disp_to_counts_logits #,MultipleOptimizer, MultipleScheduler, compute_kernel, compute_mmd from models import Encoder,Decoder,GaussianDecoder,VAE,CellStateEncoder,\ CellStateDecoder, CellStateVAE,...
ab2497c8c3165f5d16e91a94049a7ea0337a5f7906fc52c8e871181d73bbd7e8
Python
8,318
168
"""Pascal ADE20K Semantic Segmentation Dataset.""" import os from PIL import Image import numpy as np import mxnet as mx from ..segbase import SegmentationDataset class ADE20KSegmentation(SegmentationDataset): """ADE20K Semantic Segmentation Dataset. Parameters ---------- root : string Path to...
08aab8a956daeddc3920c0bc922389fffd531239787b5b236955d341667a2103
Python
8,319
267
from pathlib import Path import os import numpy as np import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import torch import torchvision.transforms as transforms import torch.nn.functional as F from tqdm import tqdm from torchvision.models.resnet import resnet18 as Net import warnings warnings.f...
d155b23da1638b0c09e9cfad91f134c7ddf456fa009513433ad1936becf74cf4
Python
8,321
334
from sys import argv def update_map_dic(line, map_dic, reg_nom_dex, regulator_type_dex, targ_nom_dex, targ_type_dex): if line[reg_nom_dex] in map_dic[line[regulator_type_dex]]: if line[targ_nom_dex] not in map_dic[line[regulator_type_dex]][line[reg_nom_dex]][line[targ_type_dex]]: map_dic[lin...
4a924c5f408e95a7710c5625338fe1211cd2d6a130d7f1c06b50f7b26730e757
Python
8,324
228
import pickle as pkl import networkx as nx import numpy as np import scipy.sparse as sp import torch from sklearn.metrics import roc_auc_score, average_precision_score def sample_mask(idx, l): """Create mask.""" mask = np.zeros(l) mask[idx] = 1 return np.array(mask, dtype=np.bool) def load_data(dat...
93b351c4068228cdbffa007f613e088d71c817bb5391f998703f2c59822f3e57
Python
8,324
180
from operator import imod import os import torch import torch.nn as nn from torch.autograd import Variable from torch.utils.data import DataLoader import argparse import time import datetime import os import math import tifffile as tiff import numpy as np import random #################################################...
9b8cbf9a3579ad0af1e1d96f306b65cee69a59380cbd3cc490348b8ff4401b9b
Python
8,325
284
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> from itertools import chain, repeat from math import ceil, pi, sin import random import numpy as np from .._data_obj import NDVar, Var, NestedEffect from .._utils import intervals from . import vector # Keep local RNG independent of public RNG RNG = random.Ra...
b125b17ce2b244131fe6e924bb3b3260c147960175cf978c4c60a01c2846b27e
Python
8,327
208
#!/usr/bin/env python3 """ Diagnostic J — two-model ensemble (decision-score averaging). Two complementary LDA classifiers are trained per fold: - Model A (LOO winner): 7D + aperiodic + topographic IAF + frontal asymmetry - Model B (LOCO winner): 7D + alpha/theta peaks + topographic IAF + posterior asymmetry For ...
aee0972a6783bd7ce375a0913726b552f7418f0d0ed1a2babd5aa7e76d64b8d3
Python
8,328
189
""" 09: Fitting Models over Time ============================ Use extensions of the model object to fit power spectra across time. """ ################################################################################################### # sphinx_gallery_thumbnail_number = 2 # Import the time & event model objects fro...
23c07a1d1b5570b2300c8afa50b67544eed0119675a26986924da974be9ff6a6
Python
8,333
242
""" =============================================================================== Compare covariance and kernel estimators with different time windows =============================================================================== Comparison of covariance estimators for different EEG signal lengths and their impact ...
2a55a121bcfc4b88591c03691bc7bd8f2ec9a9577e6ba199f44bca1d67ce0d47
Python
8,335
146
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
b6d754fce09ebd68af2ff971eff25a9cfdca4a8f3ff09b7a6fdef8942a0845dd
Python
8,336
185
import os import pandas as pd from interfile import Interfile import seaborn as sns import matplotlib.pyplot as plt from matplotlib import font_manager palette = ["#0f8b8d", "#a3f3f5", "#a8201a", "#f6c9c6", "#ec9a29", "#f7d3a1", "#662e9b", "#c3a0e3"] ecat_dir = r"E:\preclinical_data\raw_pet\headers" if not os.path.i...
c309272872872fea064711801dc312385b80926d031077933e1d4b820d5c0f6a
Python
8,336
419
""" Color sequences and scales from CARTO's CartoColors Learn more at https://github.com/CartoDB/CartoColor CARTOColors are made available under a Creative Commons Attribution license: https://creativecommons.org/licenses/by/3.0/us/ """ from ._swatches import _swatches def swatches(template=None): return _swat...
03917ee597af22103da86baa147af0b35ef31cdd0811aa5d3a759828c2db85d2
Python
8,337
200
import numpy as np import torch as ch import sys class EnvelopeExtraction(ch.nn.Module): """ Base class for envelope extraction functions. Extracts the envelope of a time-signal. """ def __init__(self, signal_size, sr, use_rfft, pad_factor): """ Base class for eac...
ae93891a70c2a7ebc90cc038ad21d11b7f6b360991f5f11bd120cecd0d89a10f
Python
8,337
279
import ctypes import logging import os import re from datetime import datetime, timedelta import numpy as np from .exceptions import OTFError from .util import load_lib logger = logging.getLogger(__name__) try: import pathlib as plib plib.Path() except (ImportError, AttributeError): import pathlib2 as...
d3cc382825989ea6b5f7ba12b734c6dc7ff08f57a3bd92394baf5f2fe0443856
Python
8,337
277
#!/usr/bin/env python3 """ axtToSyn.py Generates elongated synteny blocks from a pairwise alignment .axt file. You can specify a min lastz alignment score to filter .axt file by the last filed. The min block length only considers elongated blocks larger than this length. Jake VanCampen vancampen@ohsu.edu """ import...
2081afb16c25de6eac2b2a9827fcc49698682a0834a92e4ff3445809897abc26
Python
8,338
208
"""Manager for a user's favorites: tools, curated tool tags, and EDAM operations/topics, plus the user-visible ordering across all of them. The favorites payload is persisted as a JSON document inside ``user.preferences["favorites"]`` (a Text column). This manager owns its schema — validation, deduplication, and the `...
33ad01e696d21a666f71ce7b26bf417b2423618f9419a975ce04089d9991709e
Python
8,338
253
#!/usr/bin/ python import numpy as np import re import gridData, glob, struct import sys, argparse, os, subprocess def parse_args(argv=None): parser=argparse.ArgumentParser(description='Script for generating the jobs that need to be run for visualization. Generates types files & a text file that needs to be run. Can...
bcb7603fe432ea15d6393e02642308576cd9e9ea37bb977c8ca53f2a0188e705
Python
8,340
223
#!/usr/bin/env python3 import argparse import os import subprocess """ Install deseq-clip ================== conda install -c bioconda pysam conda install -c bioconda htseq pip install htseq-clip Or directly by: conda install -c bioconda htseq-clip Test call ========= python htsc_create_sliding_windows.py --gff...
5f726a4564140143ee2b7e1627486cf6a73eb49bae97b79672424706b8955321
Python
8,342
205
""" amplification_03.py - adaptive signal amplification for impaired EEG deficit = (baseline_rms - trial_rms) / baseline_rms factor = clip(1.0 + deficit * GAIN, AMP_MIN, AMP_MAX) Only trials below the baseline are amplified. Labels are never touched. Two reference modes ------------------- population The b...
fdd400c9b4742530fdc046278a691f1b35ab72ebdc279a5ee341d4a4ffb5f75b
Python
8,342
256
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf import pandas as pd import argparse import os import sys import pwd import pdb import grp INPUT_PATH = "SimBoost/data/davis_cv2.csv" LOG_DIR = "logs/" uid = pwd.getp...
b27a8664d1bf85bb2ae831af651e10ca87c15c28796f4c44977ed5909676de97
Python
8,343
200
# --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.14.5 # kernelspec: # display_name: Python 3 (ipykernel) # language: python # name: python3 # --- # + from pat...
1ee988a90f7a02d1bd3d526ba9232eafe2bbb782d0884ae6e382df85f54501e0
Python
8,344
221
"""Segment-run prefix search tests for the v2 collapse optimizer. Moved verbatim from ``tests/test_collapse_optimizer.py`` (at its size cap). The linearized ``_longest_legal_segment_prefix`` search is checked against the naive forward prefix scan it replaced (a differential oracle kept verbatim), and its probe/recount...
8821c4a3f2c6dd71cd42b41c242b88cfe7085cd4449db27e64483ce0f0ea814a
Python
8,344
205
import pickle import torch import numpy as np import matplotlib.pyplot as plt import networkx as nx from torch_geometric.data import Data from torch_geometric.utils import to_networkx from model import EMGNN from gnn_explainer import GNNExplainer from captum.attr import Saliency, IntegratedGradients from captum_custom ...
4e5ae2b1e96898ca500d9a53014870664f9709d6db4ba910d468ce3181e857f3
Python
8,345
198
################################################################################################################################################################# ####################### Training MulitRBP ####################################################################################################################...
797c0430a79c152e98cf052318112344a4d22378f759602454842e80a5a89fb9
Python
8,349
176
# -*- coding: utf-8 -*- """ Created on 23/09/2022 at 17:47 This is the Updated Version for easy access for multiple choses. 23/09/22 -> Possible To Choose to record detected events. -> "_ImpPlot=True" Plots the Impedance Plot -> "_SRT_Plot=True" Plots the Semi Real Time Data different cl...
1496ef655360666ed9190c53ecd5e18b197d5e10155ef94c8f783b9038c1675f
Python
8,353
211
from __future__ import absolute_import import os import numpy as np import tensorflow as tf import argparse from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser import sys import h5py import time import threading from tqdm import tqdm from tensorflow.python.platform import resource_loader from .utils_dna...
138f9d479673e9f92584741c1ae623357edb1c451adc5fb794e3bbe592bd5db7
Python
8,355
207
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np import tensorflow as tf import pandas as pd import argparse import os import sys import pwd import pdb import csv import re import math import time de...
8136006f834a796bc05bcc20844b953e7fc035c35dc3ba38ccad1874399f0129
Python
8,358
268
# -*- coding: utf-8 -*- # # mord documentation build configuration file, created by # sphinx-quickstart on Tue Jan 6 09:55:06 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All ...
1dce826964a16eb7894a7494ca98f80565dc7ac6e7d0ed437bbed039f7ea4d4e
Python
8,361
176
# -*- coding: utf-8 -*- """ Created on 23/09/2022 at 17:47 This is the Updated Version for easy access for multiple choses. 23/09/22 -> Possible To Choose to record detected events. -> "_ImpPlot=True" Plots the Impedance Plot -> "_SRT_Plot=True" Plots the Semi Real Time Data different cl...
6ab49863e856d943037186149abd2e65c963ae9a14c7f6d48c1c05cd0dbf2dd0
Python
8,361
201
"""Hypothesis/discharge battery (L7a memo sec 3/9.4). Covers: corroboration on identical geometry, refutation on a planted shape divergence, the graph-mismatch verdict without row comparison, typed precondition refusals, the POSITIONAL-JOIN pins (repeated identical ops and recurrent passes under digest equality), G4 n...
8c920d9e07a232ad7e276d056e60438abb9ee81a88cf4e459884977b725d99ef
Python
8,363
273
"""Regression tests for two-pass logging with in-place operations.""" import pytest import torch import torch.nn as nn import torchlens as tl from torchlens.backends.torch.aliasing import detect_torch_alias_contract from torchlens.ir.intervention import FunctionEventInput from torchlens.options import CaptureOptions ...
c9cacb0a1442c82388ee2b4e0f9aa4367f1aba503ad60c206b38b990b3f9e9b7
Python
8,363
210
"""Module that contain iterator used for dynamic data.""" from itertools import cycle from torchtext.data import batch as torchtext_batch from bioseq2seq.inputters import str2sortkey, max_tok_len, OrderedIterator from bioseq2seq.inputters.corpus import get_corpora, build_corpora_iters,\ DatasetAdapter from bioseq2...
0f9dd6558a9c80a492bd5f8ca3996138ead2fb99b0f024374733fbef828e6391
Python
8,366
243
"""Tests for built-in attention recipe behavior.""" from __future__ import annotations import pytest import torch from torch import nn import torchlens as tl from torchlens import trace as trace_fn from torchlens.semantic import MissingFacetError pytest.importorskip("transformers") class DistilBertSdpaAttention(n...
b109936e3339f9d1307a789dafddcd5ebf89d2b5eb481115bf94fac598f7ec75
Python
8,366
230
"""C03: tl.site() structural selector + live site-key minting (Build 0a/0c). The address law's structural lane: a ``site`` WHERE term is valid in EVERY lane -- post hoc against ``op.site_key``, and during a live capture against the streaming minter armed by the ``tl.trace`` entry. The parity pin is the verification su...
8b624dd103307c6eabc67cba3b6a2b70b50608330dc471e1be4501a570227417
Python
8,367
215
"""Spec rule identity follows the full, current content of tensor arguments (F4). Rule ids, ``action_repr`` and ``spec_digest`` used to render tensor arguments through ``repr``, which torch truncates above 1000 elements and which was computed once at construction. Two model-width steering vectors differing in one elem...
9590349e4e27d33114652bd85da6e631a11aebb7e4204f239b66e5daa2105ba2
Python
8,367
277
import numpy as np #import time, sys #from swan import pycwt import itertools as itt import operator as op from functools import partial from scipy import ndimage from . import core from .core import ifnot, coords from functools import reduce def locations(shape): """locations from a given shape (Cartesian prod...
1d82488fe5db260068fe7406a89be4193637c571e005e8e0b0a86addb68075c5
Python
8,370
241
""" =============================================================================== Compare covariance and kernel estimators =============================================================================== Comparison of covariance estimators for different EEG signal lengths and their impact on classification [1]_. Kern...
7e5179519c8e5d57db463577aa50c659c3e68156130f01fe06cb23584baaacce
Python
8,370
274
"""Tests for the provisional public structural-hash API.""" from __future__ import annotations import subprocess import sys import textwrap import pytest import torch from torch import nn import torchlens as tl from torchlens.options import CaptureOptions class _ResidualModel(nn.Module): """Small model with a...
c241dddf83e61671973e94bd4b71227481642c4837aa26831090b090eb7283b5
Python
8,374
201
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Aug 3 10:25:08 2020 @author: Audrey Mazancieux This script performes analyses of pupil dilation during the local global task. Ii includes: - preprocess the data - epoch data around event of interest - plot the result gathering all sess...
f34024d09c3d35f985545aa6287e8a8bf1d54062c4b54aacaba0f8dad05cfbbd
Python
8,375
180
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license """Shared helpers for operating on lists of track objects across trackers. These functions are intentionally generic: they only touch attributes that every track implementation exposes (`track_id`, `frame_id`, `start_frame`, `xyxy`, `mean`, `covarianc...
d5da667423a10e8249e1628fbfdbb18cb281f2b38a50c7bffb166de30eec65b9
Python
8,378
237
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> from pathlib import Path from pickle import dump, HIGHEST_PROTOCOL, Unpickler from itertools import chain import os from typing import Any from .._data_obj import Dataset, NDVar, Var, SourceSpaceBase, ismodelobject from .._types import PathArg from .._utils impo...
6fe0e283e35ab328fc2f1d1b2f2a423b88de16a53cdcbb92667b3cb1d6d48ab1
Python
8,384
214
"""LIFECYCLE PURITY -- the C06 row gate. The chassis contracts (checks 4.2), each tested as evidence, not style: - every hook handle is removed on EVERY exit path (success, exception, context-manager unwind); - zero user-RNG consumption: a bitwise same-seed observed run equals the unobserved control (losses, para...
a51da6862c23291a1c61d9901eedd648452a39ffb194d0f2202fba42eb53069a
Python
8,384
465
from typing import List import math from matplotlib.patches import Rectangle import matplotlib.pyplot as plt import matplotlib.colors as mcolors # * matplot color introduction # https://matplotlib.org/stable/tutorials/colors/colormaps.html # https://matplotlib.org/stable/tutorials/colors/colormapnorms.html # * color...
d48110766d65ae2c6b837f018c6cfac09d358b144a0af3cfb1da14784916a1b2
Python
8,384
265
from __future__ import annotations from typing import Callable, Type, Any, Iterable, TypeVar, Generic from typing_extensions import Annotated, ParamSpec from collections import defaultdict from functools import wraps _P = ParamSpec("_P") _Unused = Annotated[None, "unused"] def _is_unused(fn: Callable) -> bool: ...
dd692bf5a74fc7a6790fd686c1ae726b0b67fa420473fbade42e7c720474aea1
Python
8,384
195
''' TNS class : Grower object that contains the grower functionality. ''' import logging from copy import deepcopy import numpy as np from scipy.spatial import cKDTree from morphio import SectionType from tns.generate.grower import NeuronGrower from tns.morphmath import sample from tns.astrocyte.tree import TreeGrow...
2f407d92c3e350962c86cdbcc82435147b6f31de0fe756b5bb60f4c271b0fcf0
Python
8,387
325
import itertools from typing import Optional import anndata from matplotlib import cm, colors from .scatters import scatters from .utils import _convert_to_geo_dataframe # DEFAULT COLORS from # https://github.com/scikit-image/scikit-image/blob/8faf62d677e73f5911cfc5232d5de02f1da7486b/skimage/color/colorlabel.py DEFA...
04b98438398d5b4876be66ff0f7f082c37f200dd958b0d6fc0e12e151aab35d6
Python
8,388
222
"""PointNet++ with Multi-Scale Grouping (MSG). Qi, Yi, Su & Guibas (Stanford), NeurIPS 2017, arXiv:1706.02413. Source: https://github.com/charlesq34/pointnet2 PointNet++ MSG is a variant of PointNet++ where each Set Abstraction (SA) layer groups neighbors at MULTIPLE radii simultaneously and concatenates the per-scal...
7c4710be0dd0ff25f397b02669a7cabbc5163d5c3233c4bec327be945afbf429
Python
8,388
269
"""Tests for the xcp_d.cli.parser_utils module.""" from argparse import ArgumentParser, ArgumentTypeError from pathlib import Path import pytest from xcp_d.cli import parser_utils def test_int_or_auto(): """Test parser_utils._int_or_auto.""" with pytest.raises( ArgumentTypeError, match="Arg...
aef182538f2d79e4e6855761863c24539931d263d2fd4a263fe556e00e56be63
Python
8,388
282
import datetime import errno import os import time from collections import defaultdict, deque import torch import torch.distributed as dist class SmoothedValue: """Track a series of values and provide access to smoothed values over a window or the global series average. """ def __init__(self, window...
d57f93e5a7550f4e4a72dae933d5ca14d5e87e56d2ca00b2e3cdf15eb4de6343
Python
8,388
153
# -*- coding: utf-8 -*- """Собрать docs/ для GitHub Pages: страницы + SEO + разрешение ИИ-ботов. Главная (index): ЖИВОЙ эксперимент (live.html, использует engine.js + ancestors.json). about.html: объяснение проекта. sim.html: точная запись Python-движка. Кросс-ссылки относительные; в каждую страницу вставляется богаты...
69f08ec90f1d7592e27dd9ecd5e550f49272d0e8bc118cc770877759788fdcfc
Python
8,390
231
#!/usr/bin/env python3 """ File: plot_sample_size_simulations.py Created: 2023/07/15 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...
f34b4a82ed13f638f5d1362c11243a1bc7a8a1632cada246e131e51675c5cd09
Python
8,390
215
import logging from urllib.parse import unquote_plus from pydantic import BaseModel from galaxy.datatypes.display_applications.util import ( decode_dataset_user, encode_dataset_user, ) from galaxy.datatypes.registry import Registry from galaxy.exceptions import MessageException from galaxy.managers.context im...
61af07e15a25cbb50c74efe80f9f4258e1b6b7d8fa073605aab8733020ef312a
Python
8,391
211
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf import pandas as pd import argparse import os import sys import pwd import pdb import grp INPUT_PATH = "SimBoost/data/davis_cv.csv" LOG_DIR = "logs2/" PATIENCE = 3 #...
2776c482664ccb2a9f869a25529d0e7c2f107f7134ac1d49dfaac75f847871f9
Python
8,393
222
# -*- coding: utf-8 -*- """ Created on Fri May 12 15:23:40 2017 @author: Rong Chen # """ import os import gc import logging from reportlab.lib import colors from Bio.SeqFeature import SeqFeature, FeatureLocation from Bio.Graphics import GenomeDiagram from Bio.Graphics.GenomeDiagram import CrossLink from PyPDF2 impor...
aeebb3c0736fe87336fdbb116d92a40819ee01c8f91fdca05199dd1f283a9f78
Python
8,393
212
import csv import os from collections import namedtuple from typing import Any, Callable, List, Optional, Type, Union, Tuple import PIL from sklearn import datasets import torch import numpy as np import pandas as pd from torchvision.datasets.utils import download_file_from_google_drive, check_integrity, verify_str_a...
235b940dc9253268391896901887ba02acfdd54aeb337b61d624bb647a870810
Python
8,394
219
"""Tests for collect_confounds using simulated BIDS derivatives.""" import os from pathlib import Path import pytest import yaml from bids.layout import BIDSLayout from niworkflows.utils.testing import generate_bids_skeleton import xcp_d.utils.bids as xbids from xcp_d.data import load as load_data def _load_confou...
7c5ec5492031c926d99f05dec045c9601cb890b8280fac865c773c688417ff90
Python
8,396
201
#!/usr/bin/python3 #-*-coding:utf-8-*- # 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...
e68a1785c91a23f0d0b323e24d0e1ad23cd3c3849bf8c99325ca6a4fd055ab6b
Python
8,397
162
import tensorflow as tf from tensorflow.keras.metrics import Accuracy, CategoricalAccuracy, Precision, Recall, Mean from tensorflow_addons.metrics import F1Score, CohenKappa from tensorflow.python.keras import backend class ComplexAccuracy(Accuracy): def __init__(self, name='complex_accuracy', dtype=tf.complex64...
85ce81cd59317056170795882d908910a58b0c84d4ac4d5eea3426e85bb9eff6
Python
8,398
205
"""Producer-side SSE helper: fans events out across Galaxy processes. Kept in its own module (separate from ``galaxy.managers.sse``) because the dispatcher depends on ``galaxy.queue_worker`` and ``galaxy.queues``, while ``queue_worker`` in turn depends on the connection types in ``sse``. Splitting the producer (``SSEE...
9ff07c2290496012d90fb259b6074d24ea8d90bd946bc70f6dfef747c6a8dc10
Python
8,400
153
# -*- coding: utf-8 -*- """Собрать docs/ для GitHub Pages: страницы + SEO + разрешение ИИ-ботов. Главная (index) — ЖИВОЙ эксперимент (live.html, использует engine.js + ancestors.json). about.html — объяснение проекта. sim.html — точная запись Python-движка. Кросс-ссылки относительные; в каждую страницу вставляется бог...
84ecac82961eb233db8d65c8e86336ec834dc3a043494b85450bd52cfca0769c
Python
8,401
237
import os import json import rclpy from rclpy.node import Node from rclpy.parameter import Parameter from std_msgs.msg import Bool, Int32, Float32MultiArray, String import torch import numpy as np import pandas as pd from scene_classifier_code import SceneClassificationModel from retinal_sampling.sampling_code impor...
778c58ff8f0a443ef25d6a48989d9ac1210072b95a699b6682605a527b93750b
Python
8,402
184
""" Author: Derek van Tilborg -- TU/e -- 22-05-2022 A collection of data-prepping functions - split_data(): split ChEMBL csv into train/test taking similarity and cliffs into account. If you want to process your own data, use this function - process_data(): ...
edad543b25ea9d63af7e4d546f88cf0ddeeb552c9da3ad9929ee4828ae983c43
Python
8,403
234
import numpy as np from scipy import stats from sklearn.metrics import r2_score, mean_squared_error def common_part_of_commuters(values1, values2): """ Compute the common part of commuters for two pairs of fluxes. :param values1: the values for the first array :type values1: numpy array :param v...
fcd3f70ef34f67a90d86d01c439460df4d627f1c10ffed66efad293daf2703e0
Python
8,403
194
"""int4 handlers for the projection family (`Dense`, `EinsumDense`).""" import math from keras.src import ops from keras.src.quantizers.modes.common import apply_bias_activation from keras.src.quantizers.modes.int4.block_size import int4_scheme from keras.src.quantizers.modes.int4.block_size import is_grouped from ke...
3bfcae98c0c03bbec54ebad966f7f32e387e9086abd0be7b70d85a45021ede94
Python
8,404
205
''' Script to run the model from commandline to be used on biolib. ''' import argparse import torch import utils from write_markdown_output import write_fancy_output from concurrent.futures import ProcessPoolExecutor import os import json from tqdm.auto import tqdm MODEL_LIST_ESM1B = [ 'checkpoints_esm1b/0/1/model...
9404e6ffc17726d313fce32f8ea6caa051424018f9a73f69ef7fda72e1a43482
Python
8,407
234
import itertools from pathlib import Path import numpy as np from numpy.random import default_rng _eps = 10 ** (-5) class DCBM: def __init__(self, n=None, model_order_K=None, p_in=None, p_out=None, seed=0): assert isinstance(n, int) and n > 1 assert isinstance(model_order_K, int) and model_order...
0515781be85942751b86279a4dce8a0bc90efe2d57318c5146655d092a301d79
Python
8,408
264
""" Process-level cache for hardware detection and setup. Reuses the outcome of the first tracker hardware probe so additional runs on the same device (same process) skip repeated powermetrics, cpuinfo, and GPU detection work. """ from __future__ import annotations import threading from dataclasses import dataclass,...
5ae36df92f67e44e7b83ee4d9377814d88d828d28c37c178af13e8c6d73cffe4
Python
8,409
224
import os import random import torch import json import itertools from collections import defaultdict import numpy as np from src.utils.util import device from src.data.tokenize import tokenize_pet_txt, tokenize_pet_mlm_txt class MultiRCReader(object): ''' MultiRC reads MultiRC dataset ''' def __ini...
7fa03d4fd3111d60560620d21bc06daccbc58fa880b3c1a326a9c8c1ddf22544
Python
8,411
244
#!/usr/bin/env python3 """ File: plot_start_vs_end.py Created: 2021/05/18 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. """ ...
a5dab251c7993e5b8e375cdca5f51ad6e35b2ba6f45fc920e097496a82cde092
Python
8,411
241
model = dict( type='FasterRCNN', 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=d...
e6ff91d016e25cd215bf998e12a878371ef3045e0733d9121f738f444962de63
Python
8,412
252
""" Use to easily handle various plugin UI components. Can be inherited to customize the class. Use with the plugin_form, plugin_table, and plugin_popup modules. SimplyFire - Customizable analysis of electrophysiology data Copyright (C) 2022 Megumi Mori This program comes with ABSOLUTELY NO WARRANTY This program is f...
932e5691af0af936972d83b3a834d6e83e3a55ec71aaa123c865e3d96794b427
Python
8,413
253
""" Computing in the thymic Q framework. """ import os import tempfile import click import delegator import numpy as np import pandas as pd # These are our "lvj" columns, which are the most common indices for # probabilities and sequences in what follows. lvj = ['length', 'v_gene', 'j_gene'] def bound(x, m): "...
875e988c75bfebb7af1b59001eb53b7c8e129cb51758903998365c777472f796
Python
8,415
212
#!/usr/bin/env python import argparse import json from cp_common_functions import (get_json_value, get_pipeline_lines, get_total_number_of_modules, INDENTATION, update_module_count, ...
bb9b56234a6e985fa5c464752ea590b5119050f3c56a5203e7dc9c8c218df431
Python
8,415
226
from typing import Dict, List, Optional, Tuple, Union from PIL.Image import Image from torch import Tensor from lightly.transforms.gaussian_blur import GaussianBlur from lightly.transforms.multi_view_transform import MultiViewTransform from lightly.transforms.rotation import random_rotation_transform from lightly.tra...
c59702b74fa5ff80d0bfc9ff07456ce46509365e93d838078e2d5114bb42678d
Python
8,415
239
"""Capture-floor release-at-emission oracles (F20 W1a, brainpipe memo s3.3). The brainpipe panel's central discovery: an instrumented forward that saves nothing peaked at 27x the bare forward because capture bookkeeping pinned every live intermediate for the whole pass. These oracles pin the fix at the mechanism level...
40e05bbc028bd874a0751d6d90474c906d5f6003e38c252aa928d769cf23401f
Python
8,417
202
import tensorflow from tensorflow.keras.models import Sequential from tensorflow.keras.models import Model from tensorflow.keras.layers import BatchNormalization from tensorflow.keras.layers import Conv2D from tensorflow.keras.layers import MaxPooling2D from tensorflow.keras.layers import Activation from tensorflow.ke...
725b082ddc4782c3b51c5ae88ffdd45a202e044f7b5a71970ad1e4f417ef3017
Python
8,418
240
import numpy as np import scipy from scipy.cluster import hierarchy from scipy.spatial.distance import squareform import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt from scipy.spatial import distance import pandas as pd # used to plot heatmap in Supp Figure 2D # input is matrix of Hi-C contacts or...
c2db3023cd2e449e6776e4e9a882014503ada04485ebf160ae664d1b7d4dac31
Python
8,419
230
import os import json import random import numpy as np import itertools import torch from collections import defaultdict from src.data.tokenize import tokenize_pet_txt, tokenize_pet_mlm_txt from src.utils.util import device class RTEReader(object): ''' RTEReader reads BoolQ dataset ''' def __init__(s...
3d0029e5c9113c4878f1163f2371b9be3f31cdfdf417967e6911d2629c18e8a6
Python
8,420
256
import math import numpy as np import pickle import time from manfit_our import manfit_our from manfit_cf18 import manfit_cf18 from manfit_km17 import manfit_km17 import matplotlib.pyplot as plt import scipy.io from torusUnif import torusUnif from pdtorus import pdtorus # xiayq @ 12/01/2022 # xiayq0121@zu...
065445879aebbf1ef0b656e7b489cf6804ab157329500acb5a9b11142bd8357c
Python
8,425
253
# -*- coding: utf-8 -*- """ This file preprocesses data to speed up regression. Specifically, it creates columns of exogeneous variables that will later get used in fitting other units. ------------------ Instead of doing an exhaustive search over Markov parameters, we will specify a single mapping of past values t...
fd8f1048b9c6569ce3df91a784cca3651589590322d263d235c8cdf0e29ba9be
Python
8,427
180
""" BASIL GUI for Oxford ASL - Input data/acquisition options Copyright (C) 2020 University of Oxford """ import wx import wx.grid from . import get_nvols, OptionError from .widgets import TabPage, NumberChooser, NumberList class AslInputOptions(TabPage): """ Tab page containing input data options """ ...
1a7d5eac1c90107c180056676204a7d1a4702a38dcf343aa295cf5f4cb68dfad
Python
8,429
173
"""08. Finetune a pretrained detection model ============================================ Fine-tuning is commonly used approach to transfer previously trained model to a new dataset. It is especially useful if the targeting new dataset is relatively small. Finetuning from pre-trained models can help reduce the risk o...
ac55577d9a6132cd2a5079a1533f8362f78cdfd1f8580cdc36745acddc9be391
Python
8,429
217
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/Uniprot_integration.ipynb (unless otherwise specified). __all__ = ['extract_note', 'extract_note_end', 'resolve_unclear_position', 'extract_positions', 'preprocess_uniprot', 'uniprot_feature_dict'] # Cell import re import pandas as pd import numpy as np # C...