sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
780a1d959dc0ac7d242432a8fe73f26a8e06bad05094da4506dbd70a336b5b8b
Python
8,430
185
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt from scipy.signal import welch import matplotlib matplotlib.rcParams['path.simplify'] = True matplotlib.rcParams['path.simplify_threshold'] = 1.0 matplotlib.rcParams['agg.path.chunksize'] = 10000 # import matplotlib.style as mplstyle # mplstyle....
5bd0302c4cd4cd2c3b7e8b1d01eb49d546475d06897678f5543ea2e0172aae84
Python
8,431
243
"""Shared benchmark utilities: attention_ref, cuDNN helpers, flops calculation.""" import math import torch try: import cudnn except ImportError: cudnn = None # ── FLOPS calculation ──────────────────────────────────────────────────────── def flops( batch, nheads, seqlen_q, seqlen_k, h...
0f94f07a9adb0c51b4953db059aae7d9f47fa0cd40286085cec7ca1cc23e9757
Python
8,433
237
"""Interactive plotting functions for aggregated UMI counts. """ from typing import List, Optional, Tuple, Union import anndata import cv2 import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import plotly.graph_objects as go from anndata import AnnData from matplotlib.axes import Axes from matp...
46c4e7ee9319394d52dd5d947ae36496f1fa9f189b66c016f1a54c516c9c7e2e
Python
8,433
201
"""Anti-recurrence tests for the shared preview-backend finalizer (cert10). Covers two bugs in ``torchlens/backends/_finalize.py::finalize_single_pass_trace``: FIX 1 (BLOCKER): ``Op._tracing_finished`` was never flipped to ``True`` for any preview (non-torch) backend. Only the trace-level flag was set. Every finalize...
320d3c5653c23836420c6cbf6e2436ee0b9a5560a6be4a0e4263d9950e379501
Python
8,434
201
import numpy as np def detect_synaptic_contacts(axonal_points, target_neurons_dict, annotation_volume=None, id2acr=None, threshold=5.0, probability_factor=0.1): """ Determine potential synaptic contacts between axonal arborization and dendritic arbors of multiple target neurons. Parameters: - axon...
e5c7b9522ec87f74ed7d1ce76026ed58d712401089ed1d55a91e50dcff0c3db0
Python
8,434
211
"""W051 (AUD-CODE 2.17): the Python / NumPy GLOBAL-engine state surface is witnessed. The seed-replayable global engines were witnessed only by a before/after state snapshot at the capture boundary, so an owner-thread ``getstate -> draw -> setstate`` (or a ``seed``/``set_state`` from a pre-window value) left the compa...
bae1612a8b6c928400d2e646c8350b759231d33672d8a934da300ae90452ad8e
Python
8,435
177
#!/usr/bin/python3 ########################################################################## ## ## ## Copyright (c) 2019 Philipp Lösel. All rights reserved. ## ## ## #...
f05213bb275e08d354bf9750eb3a37aeb8fc713a8beee7edcdd3078d11af9d60
Python
8,436
295
import pytest from werkzeug.exceptions import Forbidden from werkzeug.exceptions import HTTPException from werkzeug.exceptions import InternalServerError from werkzeug.exceptions import NotFound import flask def test_error_handler_no_match(app, client): class CustomException(Exception): pass @app.er...
b4b71d37d70fc222adb98bc084c0a76e63f8d568ed07c06f3a2019d66a97ada6
Python
8,440
246
"""Tests for seqpro.rag.reverse_complement (flat-buffer ragged kernel).""" from __future__ import annotations import numpy as np import pytest import seqpro as sp from seqpro.rag import Ragged, lengths_to_offsets from seqpro.rag._ops import reverse_complement # ------------------------------------------------------...
4ac87b705a9533e7b23391b4a948b03ccebca1315b6aa7a09dce6a63f636b0d3
Python
8,441
276
""" Methods for importing data in lab-specific formats """ from __future__ import annotations from typing import Any, Dict, Tuple, Callable, List import glob import os from ... import vprint from ..process.import_aux import ( PER_PARAMETER_TXT_SUFFIXES, constrain_selected_tracks, convert_spine_files_to_p...
727d4b1ffc7fe05cd7faedd0fc73da8f95ea57df543ea623bc2fdc16eb0c5177
Python
8,441
218
# coding: utf-8 # 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...
c2e228d53783e4d4753645b760fbf0ff28ba849ec42dda7fa8c829fc215fc27b
Python
8,441
174
from . import InvertibleModule import torch import torch.nn.functional as F class GaussianMixtureModel(InvertibleModule): '''An invertible Gaussian mixture model. The weights, means, covariance parameterization and component index must be supplied as conditional inputs to the module and can come from an ...
1e0057f22607f5d4782e9ce810404b3b4b8d8e8f52c46f1c00bcb9a87f59e6e1
Python
8,443
219
import argparse import json import sys from pathlib import Path def _parser(): """The parser of the ``pyrosm`` command's arguments (see :func:`main`).""" parser = argparse.ArgumentParser( prog="pyrosm", description="Run or check a pyrosm recipe, find the extracts of an area, describe " ...
41878cd8e73bd2ab5e093cf27c81eaace14393d6a7b9c6d1506dffc8747c0a34
Python
8,444
209
"""Shared building blocks for the built-in quantization modes. The helpers here are pure code motion: each one emits exactly the op sequence its call sites emitted inline, so modes that adopt them keep producing identical traced programs. """ from keras.src import ops from keras.src.backend.common import standardize_...
7ee0189a772b4501895b54457a797fa019011cfbeb53f05b51c2bc4b452e6b12
Python
8,444
213
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...
b97cf001e55ad0db814b47ca69e81fa97310c443f1cc66c3b0dd7d54fd10027f
Python
8,444
235
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """Tools for generating Reports. This is adapted from fMRIPost-AROMA. """ import stat from pathlib import Path from bids.layout import Query from nireports.assembler.report import Report from xcp_d impo...
2ebc8f5265074461a0ec3254b22bea3b7b8797a28dab27945429ff747c0b8856
Python
8,445
263
""" K-Folding script author: obanmarcos """ import os import os, sys from config import * sys.path.append(where_am_i()) import lightning as pl import argparse import numpy as np import matplotlib.pyplot as plt import pandas as pd from utilities import dataloading_utilities as dlutils from utilities.folders import * ...
8f477d44bf8097f0584181150c777afa9a3e72b00396cc5e6b69fdffb16a8f75
Python
8,445
235
"""Narrow ownership seam between ``Trace`` and sparse runnable internals.""" from __future__ import annotations from collections.abc import Mapping, MutableMapping from dataclasses import dataclass, field, replace from typing import TYPE_CHECKING, Any, Protocol import torch if TYPE_CHECKING: from .runnable impo...
967a5b86867946055d4bcb0a75402d0e2523c1cc6d037f9988b61ea6ea4df783
Python
8,445
219
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Nov 5 16:22:54 2021 @author: fcheng """ import glob import os import numpy as np import pandas as pd from eval.image_process import img_process from eval.identify_line_orientation import principalOrient_Radon_var # save dirs save_dir = "./results...
fab53917ba4bde49ed3aef01a4705036fa74ece446dc84e7279d4dade8235627
Python
8,445
186
# Copyright (c) ByteDance, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # Main import datetime import math import sys import time from functools import partial from typing import List import to...
55e047b38777a374f1990140900a6ca616288150794e22b7a9ec9ea674b2911e
Python
8,446
180
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import itertools from pathlib import Path from typing import Any import torch from ultralytics.data import build_yolo_dataset from ultralytics.engine.trainer import BaseTrainer from ultralytics.models.yolo.detect ...
7085391b73d586fa4cdf5d0f3478b4a665b2735f3352f5265c78214a3b6c88ef
Python
8,447
202
from model import common import torch import torch.nn as nn import torch.nn.functional as F from thop import profile from util.tools import extract_image_patches,\ reduce_mean, reduce_sum, same_padding, reverse_patches from util.position import PositionEmbeddingLearned, PositionEmbeddingSine import pdb import math ...
614a047f7d230f4cbdce66edf9ab2134c6262fffdf7c56e744182e07a48a6927
Python
8,448
205
# FIXME: check the rpc-interface.js version and warn if incompatible # support python 2.7+ and 3 from src.cfg import * def JS(s): print("Javascript injection requested (copy this to browser console if needed):") print(s) # The RPC Interface talks to a web-based app, hosted at `remoteUrl` # The communication is m...
55669fdbe879e42c598af035730c25d421a513553590d2a40aa5acf5a91aa3e8
Python
8,449
194
try: import unittest from spitfire import BetaPDF, DoubleDeltaPDF, DeltaPDF, apply_mixing_model, PDFSpec, Library, Dimension, compute_pdf_max_integration_errors import numpy as np from pytabprops import LagrangeInterpolant1D from scipy.interpolate import interp1d from numpy.testing import assert...
c2f77f45ef1cd84837ae557b1ec58e48f8f5d7a99e4865f7dff43a708f0d6268
Python
8,451
265
"""Tests for repr of all objects""" import inspect import os import re import warnings from contextlib import contextmanager from unittest.mock import patch import numpy as np import pytest import pynapple as nap from pynapple.core.metadata_class import _Metadata @contextmanager def mock_terminal_size(size): c...
6c365d69b2059ca5cc2e47713a88d2122ad93b71a1fb4e3862e893f18bf65227
Python
8,453
226
"""Tests for the TorchLens doctor utility.""" from __future__ import annotations import importlib.metadata import pytest from packaging.requirements import Requirement import torchlens as tl from torchlens import _state from torchlens.backends.tf._tf_compat import get_tf_capability_snapshot from torchlens.backends....
5134019ffeb658cb0c7e4b4d55d5a86055fab86c7d20e832a22ff022d55c3c71
Python
8,455
135
########################################################################## ## ## ## Copyright (c) 2019 Philipp Lösel. All rights reserved. ## ## ## ## This file is par...
610c49ef8ea512bbe5a5cba6bf120016760e8dde44837d35fa14b63f00542dd9
Python
8,455
239
import logging from pathlib import Path, PosixPath from collections import defaultdict import tqdm from ..dataset import GluonCVMotionDataset, get_vis_thumb_location from ..utils.ingestion_utils import get_chunked_id_map _log = logging.getLogger() _log.setLevel(logging.DEBUG) def get_data_gen(image_files=None): ...
3a6fa87a6454f7944d5de6214755825b2d36747081acb71b04378aac56dad932
Python
8,456
213
import numpy as np import matplotlib.pyplot as plt import argparse from sklearn.metrics import confusion_matrix, balanced_accuracy_score, precision_recall_fscore_support from sklearn.metrics import roc_auc_score import itertools from matplotlib import colorbar import json from pathlib import Path import pandas as pd fr...
041c9ec559bc9707213e9388397287dd813b18e200cd3fd756c326bffa15415d
Python
8,457
258
import math from typing import List, Callable, Union from sklearn.metrics import accuracy_score, mean_squared_error, roc_auc_score, mean_absolute_error, r2_score, \ precision_recall_curve, auc, recall_score, precision_score, confusion_matrix, matthews_corrcoef, \ balanced_accuracy_score, f1_score from scipy.st...
415fd020a00594fd7ac5fffc9475dd3b57497020210514328712737126ce1c06
Python
8,458
192
"""This module processes the result of running probabilistic 20/20 by converting lists into a formatted dataframe.""" import prob2020.python.utils as utils import prob2020.python.p_value as mypval import numpy as np import pandas as pd def handle_tsg_results(permutation_result): """Handles result from TSG results....
7a31c6bd524ec630c36bab9a65f71ad8803a6ce7bd6008aee7aaaaf268515780
Python
8,458
206
from __future__ import annotations from collections.abc import Callable from PySide6 import QtCore from PySide6 import QtGui from PySide6 import QtWidgets from .. import _ai_models from .. import _automation from .._utils import new_icon from ._info_button import InfoButton from ._integer_slider import IntegerSlider...
461c1e74faef1d7217aa049ea8b914264dadf51d4b1d2a10d3e2f4f2a80b61b9
Python
8,460
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=dict(type='Pretra...
84a979ce9bfabfa1f4f9398b499db92de0292e8d8a1a372520e54a0c3a5adc72
Python
8,461
217
# -*- coding: utf-8 -*- """ General framework regrouping various compression methods to be performed on the data. =================================================== A Compressor instanciation requires: - n_components_list: list regrouping the number of components to keep for each model representations dimensio...
d5edcfea8fbbdf7309ebcdf1bf97b9de6c64b8004739c1d8034f610131c2a894
Python
8,462
244
#!/usr/bin/env python '''Train a random forest on model performance from an sql database and then run a genetic algorithm to propose new, better models to run. ''' import sys, re, MySQLdb, argparse, os, json, subprocess import pandas as pd import makemodel import numpy as np from MySQLdb.cursors import DictCursor ...
350676fc5595ed6bf4b60faa5f838759540cc2ce3f9d953cdcb1ff76009f169c
Python
8,463
192
################################################### ### This code simulates vesicle motility and ### ### presynapse capture during axonal motion. ### ### ### ### This is the subroutine that generates a ### ### single SV track following parameters given ### ##...
698893ebf0086a0a448b2213261e51dc3b97bb1b7495d82ca8a92d686d15aa52
Python
8,465
197
import torch from torch import nn import torch.nn.functional as F import numpy as np from ovseg.training.loss_functions import cross_entropy, dice_loss from ovseg.training.loss_functions import __dict__ as loss_functions_dict def to_one_hot_encoding(yb, n_ch): yb = yb.long() yb_oh = torch.cat([(yb == c) for c...
f6673d7d231c3d5a45e952ee6d425c3e1fdcf6a77dc9215d6bb4fd74deee8f66
Python
8,465
226
''' Performs PLS on brain activation and behavioural data in the OCDbaseline project. Due to the relatively small sample size (N=~90) the data input into the PLSC undergoes dimensionality reduction (PCA). However, the number of components to use is abitrary. We've chosen four per side, resulting in slighty more than 1...
93e5f6ce28631dbd6bb294f8e23281f57190e1e8419dfc29372c16e895c00abc
Python
8,466
221
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Helper functions for multigrid training.""" import numpy as np import slowfast.utils.logging as logging logger = logging.get_logger(__name__) class MultigridSchedule: """ This class defines multigrid training ...
0150e55775798cbcd1df851da7797b3da59cfbf50c64f095447590b4dd055c22
Python
8,472
265
""" Todo: * @Xiaojieqiu: update with Google style documentation, function typings, tests """ import math from typing import List, Optional, Tuple, Union import anndata import numpy as np import pandas as pd import shapely import shapely.geometry as geometry from sklearn.decomposition import PCA from ..configurati...
a5ae797d68655ec9dcbb89c77794e84c29773ab8b8acf628624b08895eb68fdc
Python
8,472
282
"""R23 runnable regressions for torch structseq outputs and unary invert.""" from __future__ import annotations import dataclasses from pathlib import Path from typing import Any import pytest import torch from torch import nn import torchlens as tl from torchlens.errors import PathDivergenceError from torchlens.op...
b398af20972e13ca0589fe67dc0042f2095174f161fb1cb0b17deddf106e4e4c
Python
8,473
252
""" Crawler modules generating forward peristaltic motion. Provides the crawler interface and its alternative waveform implementations, which differ in how the stride cycle shapes the instantaneous forward velocity: a constant stride, a Gaussian or square velocity profile, or an explicit phase-dependent one. """ from...
bebbcee1c78b564da874f1ca60fbb25b56835505e2041780341d260f71274ea0
Python
8,473
227
#!/usr/bin/env python3 """ File: overlap_pic_interactions_with_ct_interactions.py Created: 2021/12/13 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 r...
d5edd6d1ed0b217489ec0b1a46f4ceca4df1eeacb4d385471a4dd7aed5fae641
Python
8,473
216
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...
762f40ec456325e5566c6a39655782377661c9a8de60c046d71b4fbdf87e57e7
Python
8,474
249
# -*- coding: utf-8 -*- """ Created on Tue Mar 3 10:56:35 2020 @author: KEPetousakis """ import os.path import numpy as np import matplotlib.pyplot as plt import Code_General_utility_spikes_pickling as util import warnings from copy import deepcopy as dcp import Code_General_Nassi_functions as nf impo...
1cfd0e62c00a31775e725bc2f290e542266f74d3d45228e0361d9dd9ab0a116c
Python
8,475
216
"""Galaxy file source plugin for Aspera ascp transfers. This plugin provides download-only functionality using the Aspera ascp command-line tool. It is designed as a configured plugin (not stock) requiring explicit configuration with embedded SSH keys. Architecture: - ascp.py (this file): Galaxy plugin configuration ...
fac640b491cdccfa17fc66718b65c275f12e7ec2f15d2211163b643bd7b4fdb7
Python
8,475
217
# 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...
9168b9309273bbcbe31f12795e597c233592999ab092675a355b3a191ce57cc8
Python
8,476
292
import torch import torch.nn as nn import torch.nn.functional as F __all__ = ['forward_hook', 'Clone', 'Add', 'Cat', 'ReLU', 'GELU', 'Dropout', 'BatchNorm2d', 'Linear', 'MaxPool2d', 'AdaptiveAvgPool2d', 'AvgPool2d', 'Conv2d', 'Sequential', 'safe_divide', 'einsum', 'Softmax', 'IndexSelect', 'Layer...
9b851a1658b826c8b5d6acf1a28c2761e740dca7d161bd7248cff4330a217dff
Python
8,476
184
# Copyright (c) 2025, Jay Shah, Ganesh Bikshandi, Ying Zhang, Vijay Thakkar, Pradeep Ramani, Tri Dao. from typing import Tuple, Optional from dataclasses import dataclass import cutlass import cutlass.cute as cute from cutlass import Int32, const_expr from flash_attn.cute.seqlen_info import SeqlenInfoQK, SeqlenInfoQK...
4ca557088f3056c5c8721f3fa04c8220f148bae11c1b897516f2b53cd5a7b79b
Python
8,477
213
#!/usr/bin/env python3 """Diagnostic M — Tier 3.1: state-axis projection features. For each subject's 5D vector, project onto three pre-specified axes from Paper 5's canonical z-space: proj_cambridge: projection onto Cambridge propofol BL→Mod direction proj_sleep: projection onto Sleep W→N3 direction proj_d...
08df09975a37b049e9a644fc41a34eea4751ee6541cf5609172d6481180742c5
Python
8,478
208
import re from pydantic import ( BaseModel, ConfigDict, model_validator, RootModel, ValidationError, ) from typing_extensions import Self from galaxy.exceptions import RequestParameterInvalidException from galaxy.tool_util_models.parameter_validators import AnySafeValidatorModel from galaxy.tool_u...
633df11c9d445bd359cd324331f7add6dc29b2de439dcfb7ab07f4c49364d67e
Python
8,478
235
"""Convolutional Occupancy Networks (ConvONet). Peng, Niemeyer, Mescheder, Pollefeys & Geiger, ECCV 2020. Paper: https://arxiv.org/abs/2003.04618 Source: https://github.com/autonomousvision/convolutional_occupancy_networks ConvONet extends occupancy networks with *spatially structured* latent representations. The ke...
32b0686f91bc4e0d29133b55e401417429e675da6ad456c92438621e745c57a8
Python
8,479
266
import sys, os from tifffile import imread, imwrite from biomedisa.features.biomedisa_helper import * from biomedisa.interpolation import smart_interpolation import numpy as np #from asd import ASSD def Dice(ground_truth, result): dice = 2 * np.logical_and(ground_truth==result, (ground_truth+result)>0).sum() / \ ...
4ebf266e9c268cbb4583d6b4b3673575dbdfae6a722799cd0aa83f90774c036e
Python
8,479
228
#!/usr/bin/env python '''Checks an sql database to determine what jobs to run next for hyperparameter optimization. Works incrementally by taking a prioritized order for evaluating parameters. It is assumed the database is already populated with at least one good model. The best model is identified according to som...
639cc258da69b688fdf3c7b2ec68db184325feb8eda8760b047907fc0da420da
Python
8,479
210
#!/usr/bin/env python3 """Diagnostic L — Tier 2.2: connectivity features (iPLV + dPLI).""" from __future__ import annotations import os, sys, json, time from collections import Counter import numpy as np HERE = os.path.dirname(os.path.abspath(__file__)) OUT_DIR = os.path.join(os.path.dirname(HERE), "outputs") TOOL_AUD...
ac1bdee9da00907c691d1c820552f12590de9cab1e041fabb3e0146fcd55e9ea
Python
8,479
144
import argparse import os from util import util import torch import models import data class BaseOptions(): """This class defines options used during both training and test time. It also implements several helper functions such as parsing, printing, and saving the options. It also gathers additional opti...
3a47cc57a1aea162c8f405dd81bc0b89fb9e348b31aa691b40d191b37fb02d0e
Python
8,480
219
import logging from typing import ( Any, NamedTuple, ) from galaxy.exceptions import RequestParameterInvalidException from galaxy.files.models import ( BaseFileSourceConfiguration, BaseFileSourceTemplateConfiguration, FilesSourceRuntimeContext, RemoteDirectory, RemoteFile, ) from galaxy.fil...
78ad1c9cd96a15ce1e9b9cb0ef390781b615ba290d870ae4d5858fa2e8f30dd2
Python
8,482
219
''' K-Folding script author: obanmarcos ''' import os import os, sys from config import * sys.path.append(where_am_i()) import pytorch_lightning as pl import argparse import numpy as np import matplotlib.pyplot as plt import pandas as pd from utilities import dataloading_utilities as dlutils from utilities.folders i...
b0d60935a5ef5eb69f694358c63b39e3473042b1ed305bf634c5147c8c2152c3
Python
8,484
229
"""Instrumented consumer ledger for the producer migration (P0, four sources). Sources (design-of-record section 7): 1. Static AST scan — every ``<expr>.<field>`` and ``getattr(<expr>, "<field>" [, default])`` site over ``torchlens/`` where ``<field>`` is an OpEvent field name. Over-approximates by name (conser...
37eedb8fb86d2b2389114c69057e98ebdab89088ce0618ebe53073359845a4c5
Python
8,490
254
import numpy as np import scipy.stats as stats from sklearn.cross_decomposition import CCA from natsort import natsorted # My modules import data import image # Get correlation between two one-dimensional variables # Can be either Pearson's r or Spearman's r # Do this instead of np.corrcoef to get stats and eliminat...
da8ebedda2b5dcaa99527da51a3dd54ba34d378aac90c1ee623a3dabd07cad33
Python
8,490
208
#!/usr/bin/env python """ # Author: ChangXu # Created Time : Mon 23 Apr # File Name: cal_graph.py # Description:` """ import os,sys import numpy as np import torch from scipy import stats import scipy.sparse as sp from scipy.spatial import distance from torch_sparse import SparseTensor import networkx...
578a96791adcdbe6364f89c3604747d46480b8236c93fe9b97630f11495a1fb3
Python
8,491
156
import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import numpy as np class Fingerprint(nn.Module): def __init__(self, radius, T, input_feature_dim, input_bond_dim,\ fingerprint_dim, output_units_num, p_dropout): super(Fingerprint, self).__init__() ...
67087a9bce2ed20172877853a384fd750064ac5b2590cc7a255002f28958c840
Python
8,492
194
import numpy as np class SequenceTools(object): dna2gray_ = {'c': (0, 0), 't': (1, 0), 'g': (1, 1), 'a': (0, 1)} gray2dna_ = {(0, 0): 'c', (1, 0): 't', (1, 1): 'g', (0, 1): 'a'} codon2protein_ = {'ttt': 'f', 'ttc': 'f', 'tta': 'l', 'ttg': 'l', 'tct': 's', 'tcc': 's', 'tca': 's', 'tc...
9cb8cf501070ed14d3c7a3b8449679780306823246f1b7a20db9055c36692ee3
Python
8,493
260
import os import socket import atexit import re import functools from setuptools.extern.six.moves import urllib, http_client, map, filter from pkg_resources import ResolutionError, ExtractionError try: import ssl except ImportError: ssl = None __all__ = [ 'VerifyingHTTPSHandler', 'find_ca_bundle', 'is_a...
fc34f17f774373af202ef61d07e19ce39e4a41d791f12c6bfe71c617cf067aa4
Python
8,494
195
""" File: cmd_line_arguments.py Created: 2020/11/16 Last Changed: 2023/08/21 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. """ # Standard ...
7934a661a408a20ee8d62441b517eeff2ab55970fee91d60f59a2b40fd3a0fe5
Python
8,495
262
"""Module for regression functions.""" import functools import numpy as np from sklearn.metrics import r2_score from sklearn.svm import SVR as sklearnSVR from sklearn.utils.extmath import softmax from .utils.kernel import kernel from .classification import MDM, _check_metric from .utils.mean import mean_covariance ...
64a7926f70c8de74aef3293be04f034a6b82a269c1bda2530da32844dd9a3ddb
Python
8,497
230
# coding=utf-8 # Copyright 2024 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...
7dd12df6131c747aa87bfb78c7172867cccd4186048d6d980138c04d378a66c6
Python
8,499
289
from functools import partial import math from array_api_compat import array_namespace as get_namespace, device from array_api_extra import create_diagonal import numpy as np import pytest from pytest import approx from scipy.linalg import eigvalsh from conftest import assert_array_almost_equal from pyriemann.geometr...
d2c0065d6460fdac96dbf0a8da26dc405ecb7cae92f1b27766d4c6a7cf750033
Python
8,499
255
""" stim_plots.py This script contains functions for plotting stimulus comparison analyses. Authors: Colleen Gillon Date: January, 2021 Note: this code uses python 3.7. """ import numpy as np from util import logger_util, plot_util from sess_util import sess_plot_util from analysis import misc_analys from plot_fc...
0b427a75ba33e5655640895a67655a1643bfd4b7e862e6c2009d231c0ba8dff8
Python
8,500
239
import itertools import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import statsmodels.api as sm from matplotlib import colors from tqdm import tqdm from angorapy import register_model from angorapy.agent import PPOAgent from dexterity.model import build_fpn_models, build_fpn...
14a840dc12db8e250d646c9884495523d9a92b65323165e8935597e9e3c60730
Python
8,500
252
import os import sys import logging from pathlib import Path from typing import Dict, List, Tuple from multiprocessing import Pool import pickle import numpy as np import pandas as pd from scipy.sparse import csr_matrix import snapatac2 as sa2 import anndata # import scanpy as sc import pyprojroot import pyreadr p...
cb246a86d89a778f889b155e66a982dee0b9c266a0050bdfb01499dd5c726735
Python
8,500
151
import argparse import os from util import util import torch import models import data class BaseOptions(): def __init__(self): self.initialized = False def initialize(self, parser): """This class defines options used during both training and test time. It also implements several hel...
a35b87d112787b1a4cf0513ebd31f098c7d14ddfd40bfe6a0216028eee247fc9
Python
8,504
220
try: from typing import Any, List, Literal, Tuple, Union except ImportError: from typing_extensions import Literal from itertools import chain from typing import List, Optional, Tuple, Union import numpy as np import pyvista as pv from anndata import AnnData from scipy.spatial import ConvexHull, Delaunay fro...
e22f6d93ecab49db8d90daf160f86927eb19d51ab160b3f1af280d368699ffff
Python
8,505
266
import os from argparse import ArgumentParser import torch from pytorch_lightning import LightningModule, Trainer from torch import nn from pl_bolts.models.vision.image_gpt.gpt2 import GPT2 def _shape_input(x): """shape batch of images for input into GPT2 model.""" x = x.view(x.shape[0], -1) # flatten imag...
1905dcf1c88630150f25454fca35a0fe809e7895945d23395490d9cc039e3059
Python
8,510
231
"""Feature processing logic for multimer data pipeline.""" from absl import logging from typing import Iterable, MutableMapping, List from helixfold.common import residue_constants from helixfold.data import msa_pairing_a3m from helixfold.data import pipeline_a3m import numpy as np REQUIRED_FEATURES = frozenset({ ...
31d4c6f0a5a344edda66a641ce11949fe5599dd91def0e812e2b22f816c924a3
Python
8,513
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=dict(type='Pretra...
5029a37f55eeb9145533045822611f9dbfa9df628b5d3a83737005316f3a13f0
Python
8,513
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=dict(type='Pretra...
c308398f3f48e9b5c3cd49fce58a7a545a60847988b05d22c850f667dc0f64f4
Python
8,513
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=dict(type='Pretra...
1ad73b0ca0a6af34c53192d29e8485e07f0ea9ae51552880c78be84e82855c99
Python
8,515
355
import sys from importlib.util import find_spec from unittest.mock import Mock import pytest from celery.local import PromiseProxy, Proxy, maybe_evaluate, try_import class test_try_import: def test_imports(self): assert try_import(__name__) def test_when_default(self): default = object() ...
32195c15e2240645392982b92c7208b848023e744b38c560120e9d3dc90dcdce
Python
8,515
241
# --- 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 Tickformatstop(_BaseTraceHierarchyType): _parent_path_str = "carpet.baxis" ...
6dd21c5b8600df6c13675222d4411967144732928d221b69032ce121ee9420fd
Python
8,515
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=dict(type='Pretra...
c96820c4d7407929f39b71da30ccfd97fca67980df41759353b81d212f5fe1e3
Python
8,515
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=dict(type='Pretra...
e378d24d5da8df3574d133d8028cce1d388387860af654123d7b761c1eda02b8
Python
8,515
193
"""Written by @Jinerhal, adapted by @Xiaojieqiu. """ from typing import Tuple import numpy as np from anndata import AnnData from ..configuration import SKM from ..logging import logger_manager as lm from .utils import * @SKM.check_adata_is_type(SKM.ADATA_UMI_TYPE) def digitize( adata: AnnData, ctrs: Tuple...
f23e743963bb7efea577281a43814279ffc892c306a054f883f89fc133ace113
Python
8,515
241
# --- 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 Tickformatstop(_BaseTraceHierarchyType): _parent_path_str = "carpet.aaxis" ...
1b755698f17d69d9be47959d6deec197d8ece21763f901d19717cfc2bb678035
Python
8,516
181
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
2db1d5670e859b1eff8488c01fc71a7e63f39e4a37597c604cb360216cbdb9d4
Python
8,517
196
"""Save-level payload policy: include-flag resolution + write-side coherence. Lane A08 (WT1 A-IV items 19 + 22; weightsfree W3), split out of ``_io/bundle.py`` per the file-size ratchet's split-preferred rule. Owns the per-level include-flag defaults/requirements tables, the explicit-conflict refusals (``save_payload_...
3b2454e5161734d15514e0a527d5db38db744384ef447552fafcfebc2a5572ca
Python
8,517
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=dict(type='Pretra...
4d97154acfbe74533b309523e8c0e8ab7a19540591f37b3e85acc4ec6c7f490c
Python
8,517
190
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from copy import copy from typing import Any import torch from ultralytics.data import ClassificationDataset, build_dataloader from ultralytics.engine.trainer import BaseTrainer from ultralytics.models import yolo...
6e747062cf04eb42780d77a8830be0b0862361cbdd94b980b3eed9c7effc8e7b
Python
8,518
241
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType import copy as _copy class Tickformatstop(_BaseLayoutHierarchyType): _parent_path_str = "layout.xaxis"...
c6a01d1d9bc5c7622f14da499f5567eff87f8638668ad7396961b3b715496f10
Python
8,518
241
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType import copy as _copy class Tickformatstop(_BaseLayoutHierarchyType): _parent_path_str = "layout.yaxis"...
ddbfca4301567f37a888f21953c62c7a12932a392b6659a167ea1f94da235b29
Python
8,520
264
"""Regression coverage for tensor replacement during active TorchLens captures. These tests cover a reported bug where user replacement tensors lacked TorchLens raw-label metadata and broke the next module boundary. The audited access sites fall into two groups: output/module-exit paths now repair missing labels, whil...
e3654efd1fdb2bc15856061b21ce3c8e49028e7e8611cda6b7e8d00c59ac749c
Python
8,520
241
# --- 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 Tickformatstop(_BaseTraceHierarchyType): _parent_path_str = "cone.colorbar" ...
946929f166bbeac8f20343964d7a334a4e176895dc14b1f4945f576c6a7b7c69
Python
8,521
200
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Automate the execution of peak calling on .bam files. # Originally designed for ATAC-seq data, but will work with any directory of .bam files. # # By default, this runs both macs14 and macs2 for comparison. # # # Copyright (c) 2014-2016 Nick Semenkovich <semenko@alum.mi...
c485baaf58bc83750c8dce76ac888011eb8dd294971b1de5204a0504ab7abc73
Python
8,526
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=dict(type='Pretra...
2a1f58ff9465a331d00dc4aed9ab73b44d203814e331d2cd65fd80c94e4f5321
Python
8,529
284
"""AcademiCodec SoundStream: convolutional encoder, RVQ, decoder audio codec. Source: SoundStream (Zeghidour et al., 2021) and the AcademiCodec toolkit. The architecture is an end-to-end neural audio codec with a fully convolutional encoder/decoder and residual vector quantizer. """ from __future__ import annotations...
ba61bcbc5c401b2a3b640ce70d2b8d9f35a029d624afdddfbc763cafc40437db
Python
8,530
217
""" Run ridge regression to learn mapping between brain response and feature vectors. """ import sys sys.path.append('..') import argparse import subprocess from scipy.io import loadmat from brain_semspace_map import brain_semspace_map_loo from pathlib import Path from scipy.io import savemat import numpy as np print(...
4da1a36172d47a15d877a3c265bdeae126f3c109c9d106b6b698e19e3b24ffbc
Python
8,531
241
# --- 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 Tickformatstop(_BaseTraceHierarchyType): _parent_path_str = "mesh3d.colorbar"...
b401d5bb280bd63c110da071efaf665eb5676b808710b07d30ae91ca6ebcea0c
Python
8,531
241
# --- 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 Tickformatstop(_BaseTraceHierarchyType): _parent_path_str = "volume.colorbar"...
64a041b5158b462e038e278c5a56c83337b7e2906c6795b5a77470f67a28a466
Python
8,532
244
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...
776b4ecb59348a75945ffea90ed0f2080c8578c9e399c2501e74b16a2d576f0b
Python
8,535
235
from collections import defaultdict from torch.utils import _pytree as torch_tree def register_tree_node_class(cls): torch_tree.register_pytree_node( cls, flatten_fn=lambda x: x.torchtree_flatten(), unflatten_fn=cls.torchtree_unflatten, serialized_type_name=f"{cls.__name__}", ...