sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
245d72c99966749f571a3093fce52bb77dee5c2f7efc598cb3c2e47a4340c884 | Python | 16,121 | 389 | # -*- coding: utf-8 -*-
import itertools
import logging
import os
import numpy as np
from dipy.io.stateful_tractogram import StatefulTractogram
from dipy.tracking.streamlinespeed import length
from nibabel.streamlines import ArraySequence
from scilpy.io.hdf5 import construct_hdf5_group_from_streamlines
from scilpy.io... |
0e1250c1a4dcee7d976e5b82ab0209962f4d24ef68af2d058de86a7f719efd44 | Python | 16,123 | 464 | import math
from functools import partial
from typing import Callable, List, Optional
import numpy as np
import torch
import torch.nn as nn
from torchvision.models import vision_transformer
from torchvision.models.vision_transformer import ConvStemConfig
from lightly.models import utils
class IJEPAPredictor(vision_... |
450d31d9e2fc4f278811cc3221d43d340e1981fe0a910f7d75d042e4ea97834f | Python | 16,131 | 434 | from numpy.testing import assert_array_almost_equal
import numpy as np
from scipy.linalg import block_diag
from scipy.signal import welch, csd, coherence as coherence_sp
import pytest
from pyriemann.utils.covariance import (
covariances, covariances_EP, covariances_X, eegtocov,
cross_spectrum, cospectrum, cohe... |
22ecfd6d37bcbbf11d3d8190398c79aa68c60d0368b014ea2cf0938222f701d9 | Python | 16,132 | 396 | #!/usr/bin/env python3
from __future__ import annotations
import argparse
import html
import json
import re
import sys
from collections import Counter, defaultdict
from dataclasses import asdict, dataclass
from pathlib import Path
TRACE_RE = re.compile(
r"\[CLC\]\s+query\s+sm=(?P<sm>\d+)\s+cta=(?P<cta>\d+)\s+"
... |
03ca3174da77c64203a0883bf782666095cf268a450ab90a3e23223c2e4082de | Python | 16,133 | 385 | import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
class ResnetGenerator(nn.Module):
def __init__(self, input_nc, output_nc, ngf=64, n_blocks=6, img_size=256, light=False):
assert(n_blocks >= 0)
super(ResnetGenerator, self).__init__()
self.input_nc = input_nc
... |
567e1923d97dae06d99323cd8de0189536d390342fa2869116b04c411f47be66 | Python | 16,135 | 581 | """Base functions for SPD/HPD matrices."""
from functools import wraps
import math
from array_api_compat import array_namespace as get_namespace, device as xpd
def ctranspose(X):
"""Conjugate transpose operator.
Conjugate transpose operator for complex-valued array,
giving transpose operator for real-v... |
90a62c7769507fa15507e2f6410de41dba0453984e2238c1a35b55f4e881a8d3 | Python | 16,136 | 365 | import random
import numpy as np
from anndata import AnnData # type: ignore
try:
from typing import Any, Dict, List, Literal, Optional, Tuple, Union
except ImportError:
from typing_extensions import Literal
from typing import List, Optional, Tuple, Union
from pyvista import PolyData # type: ignore
from s... |
41e02c64b76ca60ba2bd75198f4406b8b9889c4d5d9c9cd66c3055dd04cc3c92 | Python | 16,141 | 327 | from __future__ import generators
import logging
import glob, os, functools
import sys
sys.path.append('../TM2_segmentation')
import SimpleITK as sitk
from scipy.signal import medfilt
import numpy as np
from numpy import median
import scipy
import nibabel as nib
import skimage
import matplotlib.pyplot as plt
import sci... |
da5c1db5d89038fda2052475cf157649f4018b03ed6c9c59e2c5e473d2e9d52d | Python | 16,144 | 456 | #!/usr/bin/env python3
"""
Validation Script for PRIMARY KEY Backup Implementation
This standalone script validates the PRIMARY KEY constraint preservation in the MySQL backup system.
It validates:
1. Proper schema detection and constraint preservation
2. Table migration for existing databases
3. Duplicate prevention ... |
8e5b26d82a56e7305cd44849e2d2c04908684ca75510aa7e0f2c0d8ba58096c5 | Python | 16,145 | 444 | """.. _lightly-custom-augmentation-5:
Tutorial 5: Custom Augmentations
==============================================
In this tutorial, we will train a model on chest X-ray images in a self-supervised manner.
In self-supervised learning, X-ray images can pose some problems: They are often more
than eight bits deep wh... |
92a10e597ac5e9078a29733a5d5659d65eff5e8777d7b252fa387e8380c5d322 | Python | 16,147 | 460 | """
Create main object for general training - Solve K-Folding
author: obanmarcos
"""
import os
import os, sys
from re import S
import names
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from utilities import dataloading_utilities as dlutils
from utilities.folders import *
from models import ... |
2ed6d7db4b19dc7026f180233a56ed8ed0758bdde69cc3b49b8d9cac81f9e998 | Python | 16,154 | 437 | """
utility and convenience functions for pytorch
"""
import os
import re
import time
from datetime import datetime
import torch
import torch.nn as nn
from tqdm import tqdm
OPTIMIZER_STATE_KEY = "optimizer_state"
SCHEDULER_STAT_KEY = "scheduler_state"
EPOCH_KEY = "epochs_trained"
STEPS_KEY = "steps_trained"
TRAINING... |
4f3a59d59e8d3633d796fc7e38509cabf93079233f7c56723ada9c9139b1f23f | Python | 16,164 | 410 | # Copyright 2017 The TensorFlow 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 applica... |
53b7af20ed14824159c1ff311d82c1e8a9ec3ab5a88e85570404345a5145310f | Python | 16,171 | 415 | from __future__ import annotations
from typing import Any
import pytest
import torch
from pytest_mock import MockerFixture
from torch import distributed as dist
from torch.distributions import Normal
from lightly.loss import VISRegLoss
from lightly.loss.lejepa_loss import lejepa_invariance_loss
from lightly.loss.vis... |
90b9d524065ac2767d113304bbcdfab9962991e15cdca4b04f4c3331325226a1 | Python | 16,174 | 406 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Modules and functions to compute semiempirical QM energies and gradients with tblite.
The function/classes in th... |
be1b7b8f8d5305294c1233d8fad336338f094a27e79bbfd5d93d14fad1f7bf49 | Python | 16,182 | 394 | # Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and rel... |
9faebfb0673daf0abec24b8a72f796ef174c7754c9d054430775259ddc5368d1 | Python | 16,200 | 441 | """Surgery visuals unit gates (lane F43): marks, wording, census, diff.
Every claim the renderer draws must cite a C03 audit entry: fire records,
transaction envelopes, region fact rows, injected-op records. These tests
pin the fact-vs-heuristic line-style law, the per-lane wording (one lane's
text is false in the oth... |
f294a06d5a3ae5993f33f6744670a88e5b53b79072c0056b62aa5b796500ec7a | Python | 16,214 | 487 | import argparse
import json
import os
import warnings
from itertools import chain
import joblib
import numpy as np
import pandas as pd
from galaxy_ml.model_persist import dump_model_to_h5, load_model_from_h5
from galaxy_ml.model_validations import train_test_split
from galaxy_ml.utils import (
clean_params,
ge... |
db0a18bacf88237c16df0bcfd014e1e98e800adfdd5671a1651ee63904dc40c5 | Python | 16,215 | 325 | """Customized dataloader for general video classification tasks."""
import os
import warnings
import numpy as np
try:
from decord import VideoReader, cpu
except ImportError:
VideoReader = None
cpu = None
import torch
from torch.utils.data import Dataset
from ..transforms.videotransforms import video_trans... |
6a700be69919c2affcebf1f09c04c95baf554b5fabed2edcc6e82c64cb238ac2 | Python | 16,216 | 449 | """The ``RPC`` result backend for AMQP brokers.
RPC-style result backend, using reply-to and one queue per client.
"""
import logging
import time
import kombu
from kombu.common import maybe_declare
from kombu.utils.compat import register_after_fork
from kombu.utils.objects import cached_property
from celery import s... |
1128e1708b48f9a83863b94ce9142f76edc1ba38eb9f151fe9e504d0682e70b8 | Python | 16,217 | 337 | #!/usr/bin/python
# coding=utf-8
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICEN... |
08d58d47bb0e551941a378594a741a26428e73ba06a31efe7b4eb3b87f9ea341 | Python | 16,220 | 367 | """
10: Tuning & Troubleshooting
============================
Tips & tricks for choosing algorithm settings, tuning fits, and troubleshooting.
"""
###################################################################################################
# General imports
import numpy as np
# Import the model objects
from ... |
1eb60d7ba570979530ddeb245ecc42167433f08f9a2b1ae1eed0288a04a33563 | Python | 16,229 | 465 | # --- 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 Dimension(_BaseTraceHierarchyType):
_parent_path_str = "parcoords"
_path_... |
7b451c5ae92664043166deda409b658482c2e1d508faa42437aac0f386ceac70 | Python | 16,233 | 399 | """
Train a diffusion model on images.
"""
import argparse
import json
import os
from argparse import ArgumentParser
import deepspeed
from config import cfg
from guided_diffusion import dist_util, logger
from guided_diffusion.image_datasets import load_data
from guided_diffusion.resample import create_named_schedule... |
3a8998a4ead905e26cc2cfedee390ac30222117cb186d95eacfa9f97f97be2e1 | Python | 16,234 | 520 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Workflows for calculating BOLD metrics (ALFF and ReHo)."""
from nipype.interfaces import utility as niu
from nipype.pipeline import engine as pe
from niworkflows.engine.workflows import LiterateWorkflow... |
260ed8fc38f48ee3340c6033ea360e8acfcfc07437eebb2cf3121259fa2aef5e | Python | 16,236 | 415 | import re
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint as cp
from torch import Tensor
from torch.jit.annotations import List
try:
from torch.hub import load_state_dict_from_url
except ImportError:
from torch.utils.model_zo... |
41c1ebba36e71464462b2a11722f6ab0b6cd86ed99326f51c524519d8b204bb1 | Python | 16,247 | 446 | """W1_F3: invisible host-escape observers must fail CLOSED (round7 B1/B2 class).
An observer that was never installed must never be mistaken for proof that no invisible
escape occurred. Two layers of coverage:
* FULL-INVENTORY structural tripwires over ``_observe_invisible_host_escapes``: every
install-loop ``conti... |
17405938ad1623af7ebc60b9ab084ccad6a4785f04c7b6c2722b0c4f1e592081 | Python | 16,249 | 448 | from pyControl.utility import *
import hardware_definition as hw
#-------------------------------------------------------------------------
# States and events.
#-------------------------------------------------------------------------
states= ['init_trial',
'choice_state',
'choose_left',
... |
eadcd653b4510aaa16eeffd4ba6564f8b925c879e7ddba2b0eaf559db3ece939 | Python | 16,254 | 477 | """Tests for native TorchLens layer attribution."""
from __future__ import annotations
import pytest
import torch
from torch import Tensor, nn
import torchlens.attribution as attribution
class TinyCnn(nn.Module):
"""Small CNN with deterministic layers for layer-attribution tests."""
def __init__(self) -> ... |
2dd7aab0e6ebc53548a37c2eb314f7286b3d43a140d28cd8ffa5189cffaac065 | Python | 16,258 | 392 | #!/usr/bin/env python3
"""
Dx AW — Phase B1 auxiliary re-runs under the proper per-fold pipeline
======================================================================
Re-runs three load-bearing auxiliary diagnostics under the corrected
per-fold per-cohort-deployment pipeline:
1. Operating points + calibration on h... |
c4e1f3f6f0a8022add89faa6a146d4b5a0430e03595a2d43e3726fcd727862b1 | Python | 16,261 | 201 | # pylint: disable=line-too-long,too-many-lines,missing-docstring
"""Something-something-v2 video action classification dataset.
Code adapted from https://github.com/open-mmlab/mmaction and
https://github.com/bryanyzhu/two-stream-pytorch"""
import os
from ..video_custom import VideoClsCustom
__all__ = ['SomethingSometh... |
34fb057dba83bce87233ac2267e22b94f1602c810f72653ca33528d761434958 | Python | 16,263 | 375 | """Round-41 security regression: make r39's "denied by SHAPE even when never
enumerated" claim TRUE for the callable-INVOKE and global-MUTATOR classes that
``is_pure_forward_callable`` still admitted (finding secE-r40-1).
r39 asserted the higher-order / callback-taking ops and the non-``set_`` process-global
mutators ... |
da06f78c35ab1abce16558da958756760bbc1d337640f09be67f0a5106016cd8 | Python | 16,264 | 415 | """Seeded generative property sweeps for the three R73 ungenerated surfaces.
R73 (4 hunt passes): the repo's strongest contracts were covered by
enumerated examples only —
1. **selector/predicate algebra**: 85 combinator uses, a fixed 278-cell
matrix, and ZERO generated ``&``/``|``/``~`` composition trees checked
... |
08e0772b0d0b8c36d0b298020b0f3a563dcff32799fef8e76b2d507bf2a54a95 | Python | 16,267 | 398 | import pytest
import torch
from lightly.loss import DINOLoss
from lightly.models.modules.heads import (
BarlowTwinsProjectionHead,
BYOLPredictionHead,
BYOLProjectionHead,
CAPIProjectionHead,
DenseCLProjectionHead,
DINOProjectionHead,
DINOv2ProjectionHead,
LeJEPAProjectionHead,
LeWMP... |
909a6f4c494005a0634ee4fe7a212a5684b8c170b6c89d74b077565d0a252b96 | Python | 16,269 | 488 | """LIT bridge contract tests that need NO lit-nlp install (lane F31).
Covers the import-inertness rule, the construction refusal family, the
pooling shape matrix (test-plan item 10 -- the one place toy tensors are the
right realism level: pure shape/mask contracts), blocks-preset discovery, and
the structural site res... |
76733ca5d59c1d8653d64aea6abbe6e6728dc2b166fa7aeea9e8198c10041f28 | Python | 16,276 | 493 | # 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... |
e97c4745573071e8df5390d8037b629eff5bba5a87761a99f909b30c08bec54b | Python | 16,277 | 367 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""A TFEP map using a masked autoregressive flow in Cartesian coordinates."""
# ==================================... |
3fec39b4be85810adcba2ef12100b731e742b58f9d8e359313a65e58ae895aae | Python | 16,283 | 407 | from typing import Dict, List, Optional, Tuple, Union
from PIL.Image import Image
from torch import Tensor
from lightly.transforms.amplitude_rescale_transform import AmplitudeRescaleTransform
from lightly.transforms.gaussian_blur import GaussianBlur
from lightly.transforms.gaussian_mixture_masks_transform import Gaus... |
e2d68ae98df7427a30456266a79eff7785a6eec44cf95f0e80f4d4abd9cde79a | Python | 16,283 | 493 | # 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... |
9e4edd04b567fb6eb3c5fe7831871a308d67a95c6ee5ebefb4dd0e175cdc3d84 | Python | 16,286 | 465 | #!/usr/bin/env python3
import argparse as ap
import os
import subprocess
import sys
import gplib
"""
TOOL DEPENDENCIES
=================
GraphProt 1.1.7
Best install via:
https://anaconda.org/bioconda/graphprot
Tested with: miniconda3, conda 4.7.12
Script: What's my job this time, master?
Author: It'll be a thou... |
088ca80eb19735f31c129813e08729529c286291fc4460e6413d7d3b034d820e | Python | 16,287 | 442 | """W3 capture-kernel hardening gates (round 26).
Guards the silent capture-emit gap class the W3 audit found on shipped
v2.32.4 -- traces that were wrong or incomplete yet validated True:
- F1: an in-place op through a VIEW never linked the mutation to consumers of
the BASE tensor (dead-end mutation node, stale par... |
00100bca1e04b9b6a75191c7c0c3e7621f6b08e7526ad8b5d53cc3a7a7c3aaf2 | Python | 16,294 | 452 | '''
Artifact detection on MEG data.
From Niklas Wilming et al. Nature Communications 2020
https://github.com/DonnerLab/2020_Large-scale-Dynamics-of-Perceptual-Decision-Information-across-Human-Cortex
'''
import glob
import logging
import mne
import numpy as np
import pandas as pd
from .tools import hilbert
def ann... |
7c4e2082944a4d7910dc225b750ac4b73b50fe16c4027cdead519177963e5a2f | Python | 16,296 | 359 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Implementation of the fibertube tracking environment using the
architecture of scil_local_tracking_dev.
Contrary to traditional white matter fiber tractography, fibertube
tractography does not rely on a discretized grid of fODFs or peaks. It
directly tracks and recon... |
cbfa1b7a0a3e9a5aa9f7a53ee21b3f698c1a68547ac7490abe544f11670825e4 | Python | 16,297 | 247 | #!/usr/bin/env python
# coding: utf8
__doc__ = """
Get history weights from logistic regression model. In order to run this file, you will need to first run the "analysis.py" script in this folder.
This will generate backup files in the folder sim_backup.
This code was adapted from Fründ, Wichmann, Macke (2014): Quan... |
5551bc11a1cc2153ea525ad059b5159dc61715c0d92a2c7eb0de56e983b74f55 | Python | 16,299 | 476 | """Extra models for the visual audit pack.
These extend the shared ``notebooks/audit/_models.py`` ZOO with architectures
needed to exercise the full TorchLens visual language: genuinely recurrent
models (cell-based loops that roll, fused RNN kernels that do not), deep
same-class stacks for ellipsis/repeat-fold demos, ... |
a07ccb4049f1aa5142ccc85829ab89e9cc0a4465763e23b3a1e4ef48a4f53766 | Python | 16,304 | 529 | import argparse
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
from cmkn import anchors_to_motifs, get_learned_motif, get_weight_distribution
from cmkn.data_utils import ALPHABETS
# MACROS
COLORS = [
"black",
"blue",
"yellow",
"green",
"red",
"brown",
... |
1575b5e102bce158400aecdf4104e054c0d9e581bcc6f5932743958218f67c37 | Python | 16,311 | 442 | import numpy as np
from steady_state import get_steady_state
from math import exp
from gates import ros_inf
import figure_properties as fp
from matplotlib.patches import Rectangle, ConnectionPatch
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from mpl_toolkits.axes_grid1.anchored_artists impo... |
6f3a49ab5ba52baef3ee8636866a03db8b4cc8ee22f74ca636e7a7ce4ddca0d4 | Python | 16,316 | 617 | #!/usr/bin/env python
__all__ = ["weights_max", "weights_mean", "weights_none", "default"]
import argparse
import os
import re
import sys
# General
from copy import deepcopy
from math import exp, log
from rdkit import Chem
# RDKit
from rdkit.Chem import Descriptors
class SilicosItError(Exception):
"""Base class... |
2c2cb53c28c155e889afdd41a738194263673f5ed41827536a917e398ad625c4 | Python | 16,317 | 432 | """
The dataset used in training GROVER.
"""
import math
import os
import csv
import pickle
import numpy as np
import torch
from torch.utils.data.dataset import Dataset
from rdkit import Chem
import random
from operator import itemgetter
import BatmanNet.util.utils as feautils
from BatmanNet.data.molgraph import mol2g... |
1fed7026b88f62691181eccdc648149a1067c3e2114d29bd7132f9acf002ac94 | Python | 16,318 | 485 | """Tigramite causal discovery for time series."""
# Author: Jakob Runge <jakob@jakob-runge.com>
#
# License: GNU General Public License v3.0
from __future__ import print_function
from scipy import stats, linalg
import numpy as np
import sys
import warnings
from tigramite.independence_tests.independence_tests_base im... |
d82b7da203b0cd2e9928a6845ca3765c38813a214731c7a39cdd4a336d662eb4 | Python | 16,319 | 509 | """Handles all VCS (version control) support"""
from __future__ import absolute_import
import errno
import logging
import os
import shutil
import sys
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._internal.exceptions import BadCommand
from pip._internal.utils.misc import (
display_path,... |
b1a27d8a6050432d0e1049516e19a9b82521ee8245f2da3e2dbbdc7fc093e1e1 | Python | 16,323 | 475 | """
===============================================================================
Riemannian Curvature of Sentence Trajectories
===============================================================================
Each sentence ("I love Alice", "I hate Bob", ...) is a trajectory of token
embeddings in a shared latent spac... |
a624a0d1c96a095f7eacb2304c905dd1f4c5ca7055777c67d6ef78da9de99db5 | Python | 16,326 | 460 | import dask.array as da
import numpy as np
import pytest
import zarr
from zarr.storage import MemoryStore, StorePath
from ome_zarr import OMEZarrImage, OMEZarrLabels, OMEZarrMultiscale
from ome_zarr.writer import _retuple
# (shape, axes, scale) for image data ranging from 2D to 5D
IMAGE_DIMS = [
((128, 128), "yx"... |
1922a7bb85c5013279aa71ebc1274f3b0c5a2ba1e4b58021cb184df8d3df4be6 | Python | 16,329 | 424 | """ Class-Attention in Image Transformers (CaiT)
Paper: 'Going deeper with Image Transformers' - https://arxiv.org/abs/2103.17239
Original code and weights from https://github.com/facebookresearch/deit, copyright below
Modifications and additions for timm hacked together by / Copyright 2021, Ross Wightman
"""
# Copy... |
6a0315165dcf329339dddeb1e0c52ab2fd048db857bfe6b7662cad6380e6d7b1 | Python | 16,330 | 401 | """
Utility functions to evaluate models on datasets.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import csv
import numpy as np
from deepchem.utils.save import log
from dcCustom.trans import undo_transforms
from dcCustom.metrics import from_one_hot
... |
9be3e5c77e846deaf13e87e2e5e8c251e3c011ac0eea56e937a1105fcac0c133 | Python | 16,330 | 397 | """Provocation coverage for previously test-orphaned ``RunnableErrorCode`` members (r25-3).
Every test drives a REAL production raise site through the public API (``tl.trace``,
``tl.save``, ``tl.load``, ``Trace.run``) and asserts the frozen code string on
``exc.fields["code"]`` (or on the surfaced report/diagnostics f... |
15baf54b343f5cf2f0b85f0ec59bf78809f323d0a41d05883bd524f835d506da | Python | 16,339 | 325 | import pydicom
import os
import fnmatch
from sklearn.decomposition import FastICA
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.cluster import KMeans
from sklearn.mixture import GaussianMixture
from sklearn.decomposition import PCA
from time import perf_counter
import nibabel as nib
import... |
77de0f1c356405180ad66b3ba49cf03a1406a64c2bf11e4af5cac5173ea98307 | Python | 16,339 | 399 | from enum import Enum
import cv2
from PyQt5 import QtCore
from PyQt5 import QtWidgets
import numpy as np
import logging
import datetime
from score_behavior.tracking.tracker import Tracker
from score_behavior.ObjectSpace.session_manager import ObjectSpaceSessionManager
from score_behavior.score_session_controller impor... |
2d4790bf4da4a0b5af09710ef9912c0a13426da8dc35ef0ea3645250aeaab289 | Python | 16,340 | 369 | import ntpath
import os
import shutil
from pathlib import Path
from typing import Optional, Tuple, Union
from urllib.request import urlretrieve
from anndata import AnnData, read_h5ad, read_loom
from .logging import logger_manager as lm
def download_data(url: str, file_path: Optional[str] = None, dir_name: str = "./... |
7802bf638934a5027d6218ecae612fda960dd8cf6d07e882cbf35d72db58e85c | Python | 16,355 | 481 | #!/usr/bin/env python3
#
# Open Chinese Convert
#
# Copyright 2026 Carbo Kuo and contributors
#
# 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... |
8b974b747e8a0218caf3a62452950da1878fec876a7fd856e05d4fe457d5070f | Python | 16,364 | 467 | #############################################
# This file contains scripts to perform the #
# Oligo Kernel SVM experiments. #
# #
# Author: Jonas Ditz #
#############################################
import argparse
import itertools
import os
... |
e9218b30ea85308812176cc274da685aac95a0dad6511a51d7166704aacbc253 | Python | 16,371 | 389 | from .CAST_Mark import *
from .CAST_Projection import *
from .CAST_Stack import *
from .model.model_GCNII import CCA_SSG, Args
from .utils import *
from .visualize import *
def CAST_MARK(
coords_raw_t,
exp_dict_t,
output_path_t,
task_name_t=None,
gpu_t=None,
args=None,
epoch_t=None,
if... |
35d145d6689d0c88190a8ba60a66891453b69aa9c08c2cdd9cb79387683be197 | Python | 16,377 | 495 | # %%
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import cv2
import os
from globals import path, sessions, subjects, folder_spots_noboth, threshold_distance, colors_session
from plotting import removeSpines, prettifySpinesTicks
ss = 25
transparency = 0.9
figure_paper_number = "4"
# load all_... |
207be92ffd7c679eef9aba06b6600e7c501da531840629116348128d4ca3b937 | Python | 16,381 | 525 | """
Plot component of action selective lateralization goverened by single-trial bias
"""
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pylab as pl
import seaborn as sns
from mne.stats import permutation_cluster_1samp_test
from scipy import stats
from stats import permu... |
8dea4b6b4097ed5396ab8b51198696928f3fa1440eb8161fb13da24f6bae725b | Python | 16,382 | 434 | import os
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
import sys
import time
import subprocess
import numpy as np
import pandas as pd
import h5py
import random
import json
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib.pyplot import figure
import tensorflow as tf
from tensorflow import keras
from ... |
32c884ba04e97b3b2e2e8e0bd3e3b2e558d043d09600784ea3f8b653d94c0516 | Python | 16,384 | 445 | """Episode evidence derivation on the DECLARED source and kind (lane F40b).
foldA D8: the derivation is declaration-driven, never root-output-shape
guessing. The four historical typed refusals (exactly-one output tensor,
retained output, integer dtype, axis length == row count) are this lane's
red tests: real ``genera... |
5c56187277f25d56bd2519a7838735c42dced1b0a4a59fe961e1a67fdf867cab | Python | 16,385 | 461 | import numpy as np
import pytest
from absl.testing import parameterized
from keras.src import backend
from keras.src import initializers
from keras.src import layers
from keras.src import ops
from keras.src import random
from keras.src import testing
from keras.src import utils
from keras.src.backend.common import Aut... |
08d4cae8736e24aeb68ac0ac05507f1ea4ee6adb5f0240ec0e31470b7f068cea | Python | 16,386 | 491 | """
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... |
0cf9038f7109eac1cbbd0bfdb553a1df637bdb4e2ab4c3f676d73805c789246f | Python | 16,388 | 351 | import math
import torch
import torch.nn as nn
import torch.distributions as D
import numpy as np
class gaussian():
'''
This is a simple Gaussian prior used for initializing mixture model means
'''
def __init__(self,dim,mean,stddev):
self.dim = dim
self.mean = mean
self.stddev =... |
e50b489c781e806ffeff34193b470d9dd369c59aa3835c871022cb2a5bd96231 | Python | 16,398 | 498 | """Living regression gate for TorchLens benchmark JSON payloads.
Tolerance policy (R28-2). The per-row tolerance is::
max(rel_tolerance * baseline_median_ms,
iqr_multiplier * baseline_iqr_ms,
floor_ms)
Only the BASELINE spread widens the tolerance: a noisy current run must never
widen the bar it ... |
4c4650627cba4c1893f2a88aa67b990c8b656fce3a69d867496627a09e2831b7 | Python | 16,405 | 480 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import json
import math
import os
from datetime import datetime
import numpy as np
import psutil
import slowfast.utils.logging as logging
import slowfast.utils.multiprocessing as mpu
import torch
import torchvision.io as io... |
6c36a1a7b648dd578369b070d7ebc404e252be0d2456979ba4163bda1f33482f | Python | 16,410 | 307 | import sys
import os
import gc
sys.path.append('../TM2_segmentation')
import SimpleITK as sitk
import numpy as np
import pandas as pd
import nibabel as nib
from skimage.transform import resize, rescale
from scipy.ndimage import rotate
from scipy import ndimage
import matplotlib.pyplot as plt
from numpy import median
i... |
ed14991c4890f74e0b1652c519d314b462acc8bd39d008c908095f4aab8603ad | Python | 16,411 | 382 | '''
The CRF state space models. Many parameters are hardcoded due to the complexity of the CRF configuration.
'''
import torch
import torch.nn as nn
from .multi_tag_crf import CRF
from .lstm_cnn import LSTMCNN
class CRFBaseModel(nn.Module):
'''Extend this model by defining a feature_extractor.'''
def __init_... |
bd55c795756d961c24d11902027610758ddd395b3c33e807e4ec7da1efc2ffe3 | Python | 16,421 | 349 | #!/usr/bin/env python
"""
backfill_urls.py — 把两个外部地址回填进仓库:**归档地址**(Zotero)与**仓库地址**(GitHub)。
历史
----
本脚本原名 `backfill_doi.py`,回填的是 Zenodo DOI。2026-09-13 归档渠道改为 Zotero 后,
这个仓库里**不再有任何 DOI**(Zotero 不铸造),所以脚本改名并只处理 URL。这次改名本身
就是"上游改了、下游不知道"的一次收尾:留着 `backfill_doi.py` 这个名字,等于在文档里留
一条指向不存在概念的线索。
为什么要脚本
------------
`CITATIO... |
460604865f05eedb5ed9dde21dd3551c62a346b7f7f46fca53d183596ad9459b | Python | 16,422 | 382 | from copy import deepcopy
import pytest
import numpy as np
from numpy.random import MT19937, SeedSequence
from tigramite.jpcmciplus import JPCMCIplus
from tigramite.toymodels import structural_causal_processes as toys
from tigramite.independence_tests.parcorr_mult import ParCorrMult
from tigramite.independence_tests.... |
6d2af7d248c6f55597aa647b02ba8619a10c04e45531b063e676a052e003aeb3 | Python | 16,424 | 349 | #!/usr/bin/env python3
import os,sys,matplotlib,argparse,string
# from io import StringIO
matplotlib.use('Agg')
from pylab import *
from lefse.lefse import *
import numpy as np
colors = ['r','g','b','m','c',[1.0,0.5,0.0],[0.0,1.0,0.0],[0.33,0.125,0.0],[0.75,0.75,0.75],'k']
dark_colors = [[0.4,0.0,0.0],[0.0,0.2,0.0],[... |
ea537cdadc6dc07bf04b618fa32fb80f51fae15ba2f0739fea1d6c0c5b171dd8 | Python | 16,434 | 296 | import sys
import os
import math
import copy
import numpy as np
import pandas as pd
import textwrap
import heapq
import matplotlib
from graph_tool.all import *
import graphviz as gz
def GetNetwork(CellType,GoType,NetworkPlotPrepare,PathwayInfor):
"""
This function generates a pathway network for a spec... |
ed7cc6d7faad54487d35b4536dbbbc14371fd1fe91e7268b6996fde74d4fb563 | Python | 16,437 | 291 | import unittest
from os.path import abspath, join
from spitfire import ChemicalMechanismSpec, Library, apply_mixing_model, PDFSpec, build_adiabatic_bs_library, build_adiabatic_slfm_library
from spitfire import tabulate_gas_radiation_model, tabulate_soot_source_coefficients, tabulate_soot_radiation_model
from spitfire i... |
d18e1614957f267ffd4e84c2e13f4963aeb78fdb43ad7781446a88043e659774 | Python | 16,441 | 433 | '''
Create main object for general training - Solve K-Folding
author: obanmarcos
'''
import os
import os, sys
from re import S
import names
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from utilities import dataloading_utilities as dlutils
from utilities.folders import *
from models import ... |
d84de50ab0cd5fd02d50fabf548db06e8ca9d9e6a0d6fd4667694cb8ddb481fd | Python | 16,445 | 421 | """Stage 4 sparse runnable state binding and initialization tests."""
from __future__ import annotations
from collections.abc import Iterator
from dataclasses import replace
from pathlib import Path
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens._runnabl... |
51b80dd6cfa041c96d05748962ddcbd013958e5d2c195aebb26d80a0e60fa315 | Python | 16,447 | 413 | '''
The setup of the adjacency matrices, atomic feature vectors, and reaction feature vectors.
BE SURE TO BE USING NETWORKX VER. 1.11!!
'''
import os
import numpy as np
import networkx as nx
import torch
from rdkit import Chem
from rdkit.Chem import ChemicalFeatures
from rdkit import RDConfig
from torch.utils.data im... |
e652d1e037749714d591911111df706cc24ae80cb3684b61cf58bc8d97aa900f | Python | 16,448 | 364 | """
Backup API Module
Handles backup system management by aggregating basic status information
from MySQL (port 8090) and rsync (port 8093) backup services.
"""
import json
import time
import urllib.request
from .base import BaseAPI, error_decorator
class BackupAPI(BaseAPI):
"""API endpoints for backup system ... |
f784bca5b610497bc2d6ba5b861e2e5656ed8413f0ed84081e0724157895309a | Python | 16,455 | 418 | """Storage codecs for sub-byte codes: two 4-bit or four 2-bit codes per byte
in bit fields, and five ternary codes per byte in base 3.
`pack_*` runs in NumPy once, at quantization time, and returns the packed
tensor with its shape and the original length of the packed axis.
`unpack_*` runs in backend ops, on every for... |
9e57f2943b30144c3df950ea34fe6141e781c5b09778017028c175bef2f9d3d4 | Python | 16,459 | 449 | """
Deals with abf file I/O and undo
SimplyFire - Customizable analysis of electrophysiology data
Copyright (C) 2022 Megumi Mori
This program comes with ABSOLUTELY NO WARRANTY
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published... |
ad8e4b17c7ae67f5a549ccd62e4285edb7b782799170513d4b5e4f2832ebc9a2 | Python | 16,462 | 414 | #coding=utf-8
# Copyright (c) 2020 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 requ... |
7dc0bcb5272c3c5675c8a4213c5c052054c978544872acb44adf59ec7cddc9ec | Python | 16,464 | 361 | # 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 complian... |
e7f686b2d1909fc19c0fa5e1fc9a22f610cde38bcd73a2bb81b7f7c8dc27933b | Python | 16,473 | 405 | import numpy as np
import torch
import torch.nn.functional as F
from scipy.sparse import coo_matrix
from sklearn.preprocessing import StandardScaler
from torch.utils.data import Dataset
from torch_geometric.data import InMemoryDataset, Data, Batch
from tqdm.auto import tqdm
from utils.data_utils import window_data_sor... |
bf499cd3890ec1e4629f33c4533fe3407cfd42a10faa6c0190a29c0e31eba050 | Python | 16,475 | 423 | """
Modify Yang's 02.nmfATAC.stat.py
- Add another input mat support:
h5 file (feature by cluster)
"""
import argparse
from os.path import dirname, abspath, join
from warnings import warn
import h5py
import numpy as np
from numpy import array, ravel
from scipy import sparse
import scipy as sp
from scipy import io
fro... |
30cb307ab16ebf1fd52207a4c2114482742655fc630bf7e9e605f9111d90cce6 | Python | 16,479 | 525 | import warnings
from contextlib import nullcontext as does_not_raise
import numpy as np
import pandas as pd
import pytest
from scipy import signal
import pynapple as nap
# @pytest.fixture
def sample_data():
# Create a sample Tsd data object
t = np.linspace(0, 1, 500)
d = np.sin(2 * np.pi * 10 * t) + np.... |
0a08074741009c1e3159a7a2b347c97333e4c1feef95620982e0fb30de5ddb88 | Python | 16,480 | 450 | import os
import numpy as np
import pandas as pd
import nibabel as nib
from os.path import join as pjoin
from matplotlib import pyplot as plt
from magicbox.io.io import CiftiReader, save2cifti
from cxy_visual_dev.lib.predefine import proj_dir,\
Atlas, get_rois, All_count_32k, LR_count_32k,\
mmp_map_file, s1200_... |
8436834102ae225c15ec501291fa3d4a51b0f1f00719c7c76c40b822a744f85a | Python | 16,480 | 462 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""Workflows for post-processing CIFTI-format BOLD data."""
from nipype import logging
from nipype.interfaces import utility as niu
from nipype.pipeline import engine as pe
from niworkflows.engine.workflow... |
ebd84d3934843a6588177fb929ca84bfd0b36fd0aac919113d22f95e81736199 | Python | 16,488 | 394 | from ovseg.training.TrainingBase import TrainingBase
import torch
import matplotlib.pyplot as plt
import numpy as np
from os.path import join, exists
from time import perf_counter
from torch.cuda import amp
from torch.optim import SGD, Adam, AdamW
default_SGD_params = {'momentum': 0.99, 'weight_decay': 3e-5, 'nesterov... |
8d1ae20f66dc23c241acfb68422634d763049a831e23f78be3c7bcf73ff98a92 | Python | 16,497 | 356 | # -*- coding: utf-8 -*-
"""
@author: Kaan Karas
Date: 16/11/2022
"""
import numpy as np
import pandas as pd
import math
from scipy.signal import find_peaks
import os
os.chdir("C:/Users/Lenovo/Desktop/Thesis_Blink_Kaan")
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style("darkgrid")... |
036e1fc7492445de8a777d5de02ad0c547471f9c9c89d19d5f84a8338bc14901 | Python | 16,500 | 296 | import numpy as np
from gym import utils
from gym.envs.mujoco import MujocoEnv
from gym.spaces import Box
DEFAULT_CAMERA_CONFIG = {
"trackbodyid": 2,
"distance": 4.0,
"lookat": np.array((0.0, 0.0, 1.15)),
"elevation": -20.0,
}
class Walker2dEnv(MujocoEnv, utils.EzPickle):
"""
### Description... |
559aa18f4d7cad7e08ff56f03b2ab99145cc4cff332788719dae8e42a78c754b | Python | 16,517 | 377 | # 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... |
82b4a4658da693639c5a33dac9ab0339fb74f6297afd19188653c1c11fff116c | Python | 16,519 | 426 | # A reimplementation of https://github.com/Dao-AILab/flash-attention/blob/main/hopper/flash_prepare_scheduler.cu
# from CUTLASS C++ to Cute-DSL.
from typing import Tuple, Optional, NamedTuple
import operator
import torch
import cuda.bindings.driver as cuda
import cutlass
import cutlass.cute as cute
from cutlass import... |
d829b8b095b7b25d9e19c8f1792af46a136fdae24d98f76f76adc0601506f1cd | Python | 16,523 | 445 | #!/usr/bin/env python3
"""
File: visualise_interaction_eqtl2.py
Created: 2020/11/09
Last Changed: 2021/11/10
Author: M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the root directory of t... |
203972340a4f5a3329ee7a3f21cf491feaf123540fcbfad2c14d73978c3afa0f | Python | 16,524 | 349 | import os
import logging
from tqdm import tqdm
import numpy as np
import argparse
import time
import sys
import mxnet as mx
from mxnet import gluon, ndarray as nd
from mxnet.gluon.data.vision import transforms
from mxnet.contrib.quantization import *
import gluoncv
gluoncv.utils.check_version('0.6.0')
from gluoncv.mo... |
4984366dd045b9985c64ee0603a8d4b27cdc80b8be96fa79d408b6aa4d34026d | Python | 16,525 | 508 | """Profiling report: measures TorchLens overhead vs raw forward pass.
Generates tests/test_outputs/profiling_report.txt with timing data for:
- Raw forward pass (baseline)
- trace (initial logging)
- save_new_outs (fast re-logging with new input)
- validate_forward_pass (perturbation validation)
Run: pytest ... |
686068d8f2799eb4ee2c1b45bdc1d784c56c68cd5a72d65daf88552fffa672fc | Python | 16,527 | 446 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Embedding layers for masked autoregressive flows (MAF).
"""
# ====================================... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.