sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
df08a4c32249d0be3cd6bac419917454edc8b3474b534e3b68a22915248ef7c1 | Python | 14,440 | 356 | from collections import Counter
from concurrent.futures import ThreadPoolExecutor
from typing import List, Union
from codecarbon.core import cpu, gpu, powermetrics, windows_emi
from codecarbon.core.config import normalize_gpu_ids
from codecarbon.core.hardware_cache import get_cached_tdp, get_or_run_setup
from codecarb... |
d328621586a6676243f0a0e7602702b25ccc3cf24fd1d6309388f9dc11cb9a16 | Python | 14,442 | 361 | from scipy.special import softmax
from sklearn.neural_network import MLPClassifier
import numpy as np
import pickle as pkl
import math
# Delete the padding in order to compare the prot
def delete_pad(sequence):
sequence = sequence.replace("p", "")
sequence = sequence.replace("c", "")
return sequence
def ... |
6f997e080c4aa74c99208825391fda35f84f6d5db424bdb72483cfc5d6f2302a | Python | 14,444 | 435 | # --- 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 Contours(_BaseTraceHierarchyType):
_parent_path_str = "contour"
_path_str... |
e3bf22460544d141da518527a9bfc27a5c08f5e39cc336a3401ef15c14b461ba | Python | 14,450 | 437 | from os import path
from typing import Optional, Union
import numpy as np
import gym
from gym import error, logger, spaces
from gym.spaces import Space
try:
import mujoco_py
except ImportError as e:
MUJOCO_PY_IMPORT_ERROR = e
else:
MUJOCO_PY_IMPORT_ERROR = None
try:
import mujoco
except ImportError ... |
cfa7fd966eb4ef2119198613683846480eccad4bc5395b464ec0bb3dc68aa5bc | Python | 14,455 | 424 | #!/usr/bin/env python
import argparse
import fileinput
import logging
import math
import os
import shutil
import subprocess
import sys
import tempfile
from glob import glob
def stop_err(logger, msg):
logger.critical(msg)
sys.exit(1)
def log_subprocess_output(logger, pipe):
for line in iter(pipe.readlin... |
31f40573ca0a7c82200f6830ddcddc865aa0022154cb0a7336f0d2fedf7631bb | Python | 14,457 | 409 | """
Module to manage datasets and loaders
"""
import os
import re
from functools import cache
from tqdm import tqdm
import cv2
import numpy as np
import pandas as pd
import torch
from torch.utils.data import Dataset, DataLoader
import pytorch_lightning as pl
import albumentations as A
from albumentations.pytorch impor... |
94fd1c05b86a4598aca604498c59c24fdd2e6391c23ef87f952cdfaf0fc647e4 | Python | 14,463 | 419 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"""Style specification"""
from __future__ import annotations
from collections.abc import Iterator
from dataclasses import dataclass, replace
from functools import reduce
from itertools import chain, product
from math import ceil
import operator
from typing impor... |
b12d4152ddf2cbcd4073b492e21a4748612687592586721d4d212287e262852e | Python | 14,463 | 423 | #!/usr/bin/env python
'''Take a huge number of options and create a model file. Some solver hyperparameters are included as well.
All models perform pose prediction and affinity prediction.
'''
import sys
import argparse
class Range():
'''represent a continuous numerical range'''
def __init__(self,lo,hi):
... |
1e5326fe8754e05c24a27b831b44ac8a5604e010afdc6e4ab0e7a589a5433a56 | Python | 14,465 | 357 | import os
import numpy as np
import json
from itertools import product
class Node():
'''
Class for representing a node in the ImageNet/WordNet hierarchy.
'''
def __init__(self, wnid, parent_wnid=None, name=""):
"""
Args:
wnid (str) : WordNet ID for synset represented by n... |
0e190da846f86ad5a6ebad91547958da67c6557cdcf1903976a3690a4542592e | Python | 14,466 | 353 | import sys
import numpy as np
sys.path.extend(["../TDNODE", "src"])
from pandas.core.frame import DataFrame
import pandas as pd
import torch
from torch.utils.data import Dataset
from typing import List, Tuple
import json
from prodict import Prodict
from utils import log_message
class TGIData(Dataset):
def __in... |
41a22ad1a015c40de7308343e0c54809dabe9e4d0461035391860e0ce5d5c26b | Python | 14,468 | 338 | import re,os
from Bio import SeqIO
from Bio.Seq import Seq
from Bio import AlignIO
from Bio.SeqRecord import SeqRecord
import pandas as pd
from utils import getLongestORF, parse_config,setup_fonts
import subprocess
def parse_needle_results(entry,save_dir):
#match_tscript = re.search('ID: (.*)',entry[0])
matc... |
9e043540ec32f226b6c784af3c78e057d919b97fdb34b868dbfa0b79694b7024 | Python | 14,470 | 380 | #!/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... |
c05d6b3c779faca77019ee98c29a1f308f4ef572ae63ec0f50f0d0e394990307 | Python | 14,472 | 356 | """
Custom Modes
============
This example covers defining and using custom fit modes.
"""
# sphinx_gallery_thumbnail_number = 3
# Import functionality used to define custom fit modes
from collections import OrderedDict
import numpy as np
# Import the model object
from specparam import SpectralModel
# Import funct... |
30ae6187059b5000ea1049fe9193a64e9566b95accd89006621e8d4e64b65a5f | Python | 14,475 | 361 | """Tests for xcp_d.ingression.hcpya."""
from pathlib import Path
from unittest.mock import patch
import nibabel as nb
import numpy as np
import pandas as pd
import pytest
from xcp_d.ingression import hcpya
# Small imaging grid: 5x5x5 = 125 voxels; 5x5x5x4 = 500 voxels (under limit)
_SHAPE_3D = (5, 5, 5)
_SHAPE_4D =... |
19cc11e0f52be65c2714a1a894c2ea000a87cea1c2f752539246edf59cb75187 | Python | 14,478 | 400 | from typing import Callable, Optional, Tuple, Union, Optional, List, Literal, Dict
import numpy as np
import torch
import torch.nn as nn
from pytorch_lightning import seed_everything
from pytorch_lightning.core import LightningModule
from pytorch_lightning.utilities.model_summary import ModelSummary
from tqdm.auto imp... |
a56be7f171020e69ca5a80d0ed7514275c4eb624370bc7c23905dfc4102bd698 | Python | 14,479 | 397 | """Tests for the func_config feature.
Verifies that func_config is correctly extracted for various operation types,
is empty for source/output nodes, survives the postprocessing pipeline, and
is accessible on both Op and Layer.
"""
import torch
import torch.nn as nn
import torchlens as tl
from torchlens.capture.sali... |
6979243b998942aae8beb00b4d9f5b3590596ba7f6423ecdd7224a067b935b93 | Python | 14,484 | 331 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import re
import sys
def change_according_reviewer(accession, note_line):
accession = accession.strip()
"""
putative D-malate dehydrogenase [decarboxylating] [gnl|PBUF|STVIR_0046:1-352] [gnl|PBUF|STVIR_0046: raw, aa len= 352]
Saccharopine dehyd... |
f853f2e1992c3a4584876ddaba194b57aa358aa0b079ca3c8dfc55cf0b33a150 | Python | 14,487 | 355 | """VISReg loss functions."""
from __future__ import annotations
from typing import NamedTuple
import torch
from torch import Tensor, nn
from torch import distributed as torch_dist
from torch.distributions import Normal
from lightly.loss import lejepa_loss
from lightly.utils import dist as lightly_dist
def visreg_... |
0ff023ea38c0857d3fb42edd3f1c5b89ef7560315ab4f94404bfd65c0e3cb592 | Python | 14,488 | 466 | from rpy2 import robjects
from rpy2.robjects.packages import (importr,
WeakPackage)
import warnings
with warnings.catch_warnings():
warnings.simplefilter("ignore")
dplyr_ = importr('dplyr', on_conflict="warn")
lazyeval = importr('lazyeval', on_conflict="warn")
rlang ... |
20121c55afc278d17fed46dab5929bbe980ebb2523ef1a4a545cbda83a37e6f1 | Python | 14,488 | 409 | #!/usr/bin/env python3
"""
STEPS reaction-diffusion simulation with volume-matched calcium injection
Last updated: 09.04.2026
Author: Laura Keto
Description
-----------
This script performs reaction-diffusion simulations in STEPS using a
tetrahedral intracellular mesh and a calcium-calmodulin reaction scheme.
It was ... |
eb88b3e95800c0770daabf3885166158d98903a2c5e1aaca6b664bfb83b75903 | Python | 14,488 | 376 | """StyleNeRF: A Style-based 3D-Aware Generator for High-resolution Image Synthesis.
Gu et al., ICLR 2022. arXiv:2110.08985.
Source: https://github.com/facebookresearch/StyleNeRF
StyleNeRF integrates Neural Radiance Fields (NeRF) volume rendering with StyleGAN2-style
modulation for 3D-aware high-resolution image gene... |
23f32bdacd3fc1e5c52e5bfeafe30f255b3fee66feb09b698ece610ac4dfe732 | Python | 14,489 | 445 | # --- 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 Rangeselector(_BaseLayoutHierarchyType):
_parent_path_str = "layout.xaxis"
... |
9df81f987aa4a133a71cf2aefc2697d24d343cb13f9aad81ad8b7ff748377116 | Python | 14,500 | 375 | """Checks kit item 4: parameter checks at optimizer DEFAULTS (memo D2-D5, D13).
Panel law: all seeded-failure tests run at optimizer DEFAULTS -- round 1's
plans configured around weight decay and would have shipped a check that
works only when the user disables the default. The vacuity is LOCKED IN
here so it cannot b... |
7ff8fc67c5a337316835cbb277d844b0644bfd480dd8a11ed02d7f0d5ed87e8a | Python | 14,503 | 378 | """
sweeps plugin - UI loading and handling
Easily select sweeps to display/hide in overlay mode
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 ... |
1e363d815954b4431b0c71ab4e582d1e858d37f729be7218660b89acf1db82d1 | Python | 14,505 | 346 | #!/usr/bin/env python3
"""
File: create_correlation_heatmap.py
Created: 2021/04/26
Last Changed: 2021/10/13
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 th... |
a3a378689aa7ff234c2c50c0e35e9d93801e582f53111c6221e81190bdf65083 | Python | 14,506 | 470 | """
After running nmf independently, we read the results and summize them
based on Yang's nmf script.
"""
import argparse
parser = argparse.ArgumentParser(description="Run NMF using sklearn.")
parser.add_argument("-i", "--inputPrefix", type=str, dest="input_prefix")
parser.add_argument("-r", "--rank", type=int, dest=... |
43fd1cf9c977065dd0e945e425dc179810aa6db857341869ca4e293249311512 | Python | 14,511 | 397 | """The functions for monodepth2 model and loss
Code partially borrowed from
https://github.com/nianticlabs/monodepth2/blob/master/layers.py.
"""
# pylint: disable=unused-argument, missing-function-docstring
# Copyright Niantic 2019. Patent Pending. All rights reserved.
#
# This software is licensed under the terms of t... |
ecebdbdc992c5003f190add8dfb2aacf8b003f4ae7c5104c21cc5654a644a352 | Python | 14,512 | 253 | # Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com)
# Some parts of the code were referenced from or inspired by below
# - Dong-Hyun Lee's code (https://github.com/dhlee347/pytorchic-bert)
# PLUS functions
""" PLUS config classes and functions """
import os
import sys
import json
import math
from ... |
a65d5285d82c9afad1bbaf876d9f7fc47a137dd57b487593f18b5fe841f93f47 | Python | 14,518 | 465 | """Phase 12a launch-tier bridge invariants."""
from __future__ import annotations
import builtins
import json
import sys
from pathlib import Path
from typing import Any
import numpy as np
import pytest
import torch
from torch import nn
import torchlens as tl
import torchlens.callbacks as tl_callbacks
import torchle... |
2e32bc00a9533e40dd0de7a9c1a2f7cd417d066a7dcbb8ce117be06cf4aae17f | Python | 14,521 | 435 | # --- 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 Contours(_BaseTraceHierarchyType):
_parent_path_str = "histogram2dcontour"
... |
30ab5ed11f0329b4f9d63a36f4aa4f8d4a4d78a7d87c6dd1405c1053fa72da0b | Python | 14,521 | 449 | import re
import numpy as np
import pytest
import pynapple as nap
############################################################
# Test for tensor building
############################################################
def get_group():
return nap.TsGroup(
{
0: nap.Ts(t=np.arange(0, 100)),
... |
61e27755e3e7bac2e05ebccf70380b158a9f1cf587bfc609bce78d68cf61ec47 | Python | 14,522 | 471 | import warnings
import numpy as np
import imageio
import rasterio
import rasterio.windows
import torch
import matplotlib.pyplot as plt
from ..utils.data import read_batch, rewrite_batch, get_rgb_from_tensor
from ..modules.transforms import select_channels, crop, get_random_window
class Dataset(torch.utils.data.Data... |
73729889ccd892e3d3c44c3efce0701ba6debaa15989712b76a94a927cb01084 | Python | 14,522 | 323 | #!/usr/bin/python3
##########################################################################
## ##
## Copyright (c) 2019-2025 Philipp Lösel. All rights reserved. ##
## ##
#... |
01e615433e79659809c69030dc8733c4de8cfc5e78320ae4cdf284b9ef938b23 | Python | 14,525 | 345 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
90a72a420482c168129f955e86c085ae70acfea68a330b3c9cdfe14c7531090b | Python | 14,526 | 406 | import math
from plotly import exceptions, optional_imports
from plotly.figure_factory import utils
from plotly.graph_objs import graph_objs
np = optional_imports.get_module("numpy")
def validate_streamline(x, y):
"""
Streamline-specific validations
Specifically, this checks that x and y are both evenl... |
dfbb2f39e4383df1721fd819b03f57add47833df25be60ccf513d6ac3a243d8f | Python | 14,529 | 382 | import os
import time
import glob
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 cxy_visual_dev.lib.predefine import proj_dir
from nibrain.util.plotfig import auto_bar_width
from magicbox.algorithm.plot import show_bar_value
work... |
d6a78e2908de932ab2f67787f57723be798e1efff88d7eba94f6aee73ef81c46 | Python | 14,530 | 381 | """aliases-v1: the identity and mutation-effect matrix for public records.
Each test is one row of the converged-design alias matrix
(docs/reference/trace_core_design.md section 6). These are direct behavioral
assertions rather than goldens because identity relations (``is``, weakref
liveness, mutation visibility) can... |
4731185d8034d6f221a27ef982200643445f1b8e1f84bba5d74c7060ea51e9c2 | Python | 14,535 | 376 | import torch
from icecream import ic
import random
import numpy as np
from kinematics import get_init_xyz
import torch.nn as nn
from util_module import ComputeAllAtomCoords
from util import *
from inpainting_util import MSAFeaturize_fixbb, TemplFeaturizeFixbb, lddt_unbin
from kinematics import xyz_to_t2d
def mask_inp... |
218ce3b7287e33bee22e7291dd101c5d4e49e23ec5de9be9576e53fa209a5a16 | Python | 14,539 | 442 | """
R help system.
"""
import os
from collections import namedtuple
import re
import sqlite3
import typing
import warnings
import rpy2.rinterface as rinterface
from rpy2.rinterface import StrSexpVector
from rpy2.robjects.packages_utils import (get_packagepath,
_libpaths,
... |
88c63dff985cf718c2c7e81de671ac6e561a71d3444b3b81d7abaa052ddf39fe | Python | 14,542 | 220 | try:
import unittest
from copy import copy
from numpy.testing import assert_allclose
import numpy as np
from spitfire.chemistry.mechanism import ChemicalMechanismSpec
from spitfire.chemistry.library import Library, Dimension
from spitfire.chemistry.flamelet import FlameletSpec
from spi... |
9acc591d7b541520542f71652eea13cae6e557cd3227563d4b6f081ffd3231f6 | Python | 14,552 | 329 | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, absolute_import, division
import datetime
import warnings
import sys
import numpy as np
from six import string_types, PY2
from functools import wraps
from .config import BaseConfig
from ..utils import _raise, load_json, save_json, axes_... |
9c81fde6c0ac059ccef6496c25ba01e5a4d68b25af026351fdb656cfad138752 | Python | 14,553 | 350 | """F06 B8: the token-attribution two-liner (attrib memo D22-D29) -- toy tier.
A tiny HF-shaped causal model + word-level fake tokenizer exercise the whole
contract without network: target resolution incl. the bare-int warn band,
task-aware baseline resolution and its named fallback, explicit baseline
spellings and ref... |
de5f150ca5506c70b900927992e37c347022ec93e24c0d6e1d83994b077439ac | Python | 14,558 | 418 | from __future__ import annotations
import traceback
import warnings
def warn_with_traceback(message, category, filename, lineno, file=None, line=None):
log = f"{filename}:{lineno}: {category.__name__}: {message}\n"
log += "".join(traceback.format_stack())
print(log)
warnings.showwarning = warn_with_tra... |
c38adad713093ec658190c8984d9d263110d6b45074251d6a0790434f42b30b5 | Python | 14,559 | 375 | import atexit
import errno
import signal
import threading
import unittest
from unittest.mock import mock_open, patch
from codecarbon.lock import LOCKFILE, Lock
class SignalSafeTestCase(unittest.TestCase):
"""acquire() installs process-wide handlers: put the originals back."""
def setUp(self):
self.o... |
7a0694d40041a92631c408475ccaab058e510e9ca255e16d9f1d57f09fd42d9c | Python | 14,560 | 362 | """Namespaced typed SIDECAR families: out-of-tree persistence at L1.
The persistence half of out-of-tree equal citizenship (architecture memo 6.3
seam 1, C01 item 14): an appliance -- in-tree or out-of-tree -- persists its
own data on a Trace WITHOUT editing ``Trace``/``Op`` schemas, through one
typed door. Each famil... |
e5476498cdec6625d991905b64e55bc0a30b0fcbbac67d1161459b8bfcd740ee | Python | 14,565 | 466 | """
Plot psychometric functions conditioned on previous
stimulus category for the three environments
"""
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# Compute Bayes Factors
import rpy2.robjects as robjects
import scipy
import seaborn as sns
from mpl_toolkits.axes_grid1.ins... |
d45a2a01c8c1cea2cbae46a68a808a3356396b41fafdef3815852f019db409e5 | Python | 14,569 | 305 | # This code loads Neuropixels data acquired by SpikeGLX and processed by:
# CatGT, Kilosort, Tprime, CWaves, and associated postprocessing from https://github.com/jenniferColonell/ecephys_spike_sorting
# Data is packaged into a numpy object providing convenient access to spike times, event times, and relevant cluster m... |
e617cb21275b1b8fbfd5f9c122855b0beac478b795c72b2c554d939f938432cf | Python | 14,573 | 434 | from __future__ import annotations
import sys
import pytest
import env
import pybind11_cross_module_tests as cm
import pybind11_tests
from pybind11_tests import exceptions as m
def test_std_exception(msg):
with pytest.raises(RuntimeError) as excinfo:
m.throw_std_exception()
assert msg(excinfo.value... |
1248a1122ba0a8398f31cf7dde2570c8d7d0485987a0bf14b9d8fd8b8e33591c | Python | 14,575 | 563 | """Measure retained TorchLens trace memory before and after Op slotting."""
from __future__ import annotations
import argparse
import gc
import json
import platform
import random
import sys
from collections.abc import Callable
from dataclasses import asdict, dataclass
from pathlib import Path
from typing import Any
... |
154b1815c07ba42316b681198d1b991aaf002641f818b16146450f910593de7a | Python | 14,575 | 391 | #!/usr/bin/env python3
"""
File: model_matrix_by_pics.py
Created: 2022/02/25
Last Changed: 2022/04/25
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 sou... |
b04087c5503757496db1e3b1ecefdb569507857066eb1791beae0077db871f47 | Python | 14,575 | 378 | """Regression tests for r18j -- recurrent-render multi-pass crash + identity class.
Covers the shared helper honesty guard (with a mutation proof) and every fixed
public visualization path exercised on a recurrent (multi-pass) model:
* helper -- MultiPassAmbiguityError / is_multipass_layer / get_multipass_attr
* H1 -... |
366de6f87f76a16220d655c169165afa1462be47edde586e0b7a553f899b4dda | Python | 14,578 | 441 | """
This module sets up the larvaworld registry where most functions, classes, and configurations are registered.
It is initialized automatically when importing the package and serves as an accessible database for all functionalities.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, Any
... |
b39958001b35ba4a9495f5d6ad2da529197f8a1508532da2fc232b9e1ab9663e | Python | 14,590 | 319 | import torch
import torch.nn.functional as F
from torch import Tensor
from torch import distributed as torch_dist
from torch.nn import Module
import lightly.utils.dist as lightly_dist
class DetConSLoss(Module):
"""Implementation of the DetConS loss. [2]_
The inputs are two-fold:
- Two latent representa... |
403f12c8e7809e4843fba6f74df990d48f91494395ef4f11d6830c3657fc8770 | Python | 14,595 | 409 | """Soft Actor Critic."""
import argparse
from typing import Dict, List, Tuple
import numpy as np
import torch
from pytorch_lightning import LightningModule, Trainer, seed_everything
from pytorch_lightning.callbacks import ModelCheckpoint
from torch import Tensor, optim
from torch.nn import functional as F
from torch.o... |
ae359f6bc5ab7ff719985507d5f349c46b1f1382748867c613e207471d28cfdf | Python | 14,595 | 394 | import numpy
import os
from scipy.spatial import distance
from projection_voxels.cached_projection import CachedProjections
def rotmat(angle):
return numpy.array([
[numpy.cos(angle), -numpy.sin(angle)],
[numpy.sin(angle), numpy.cos(angle)]
])
def angle_vector(angle):
return numpy.array([... |
e418d12f7910027b28505d96604874d09d5298fe7b8297cc10ea483b39b7f758 | Python | 14,596 | 314 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""核验发布归档:标签注记里写的三个数,必须能由本脚本从标签本身重算出来。
为什么需要这个脚本
------------------
`v1.0.0` 标签注记里写着树内文件数、产物条目数与**精确字节数**(精确值按设计只写在
注记里,因为 README 在树内、自指无不动点),并要求读者用一条 `git archive` 命令复测。
问题在于:这三个数的**核对方式**(zipfile 计数、与 `git ls-tree -r` 逐条比对、取体积)
此前只存在于会话里,没有落在仓库中——也就是说注记声称"可复测",但复测本身没有
可执... |
6dcf6b4849c5d9b6e7ef8036bda5145716b1b9e955587d6af091371f4538abd2 | Python | 14,600 | 411 | """Shared engine for bounded, watchable simulation runs in the portal.
The portal needs to show a simulation *while it happens* rather than block the
Bokeh document until it finishes. This module provides the three pieces that
make that possible and keeps them reusable across apps:
* :func:`build_bounded_launcher` - ... |
c3eff0c6c64ab015f2a216644eeeb589ddfb4b97edc3783b5c7d481f227cf965 | Python | 14,603 | 481 | ###########################################################
# LC analyses: spot-level deconvolution using cell2location
# Lukas Weber, Oct 2022
###########################################################
# references:
# - cell2location tutorial: https://cell2location.readthedocs.io/en/latest/notebooks/cell2location_tu... |
57e9ae4d92261895cfb9ad94e39e7fddde50cfaa8c1336fb28f89fd464ecf784 | Python | 14,604 | 411 | """D-RAGGED: refuse by default; trimmed is the only ragged carrier (D4).
The entry gate is ``ragged="refuse"`` (an enum, not a bool). On first width
drift the run refuses BEFORE committing the offending shard, in one typed
message naming the remedies (``pool=``, fixed-length collation — both
signature-changing and dis... |
0cf9cdcce899f03f91d6f6f78e86f0ff9d7de070e17a863c7f47305ee0b5f1e2 | Python | 14,607 | 412 | from argschema.schemas import DefaultSchema
from argschema import ArgSchema
from argschema.fields import InputFile, OutputDir, OutputFile
import marshmallow as mm
from marshmallow import fields
import logging
import json
logger = logging.getLogger(__name__)
class CellROISchema(DefaultSchema):
id = fields.Int(
... |
69b5ca921a423d54d7772bf1aa8572373355b80c84921ab534041a05ef5c9773 | Python | 14,608 | 179 | # pylint: disable=line-too-long,too-many-lines,missing-docstring
"""Kinetics400 video action recognition 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__ = ['Kinetics400']
class Kinetics... |
4cd5438b1ff347d3e9bce2220282d5658c8758aa6e9bee2d286464b2da4bfc76 | Python | 14,610 | 288 | #!/usr/bin/env python
# fix problems with pythons terrible import system
import sys
import os
file_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(file_dir, '../'))
sys.path.append(os.path.join(file_dir, '../../'))
# package imports
import prob2020
import prob2020.python.utils as utils
i... |
4c1f5f0e060dc46e32c3f7e07c860ad8064bd8a72804e259c099ce56bf2aba86 | Python | 14,612 | 367 | """W11-F1 -- a CPU capture must not touch a visible-but-unusable CUDA device.
``log_current_rng_states`` used to snapshot CUDA RNG state whenever
``torch.cuda.is_available()`` was True, for every logged operation, regardless of
where the model and inputs actually lived. ``torch.cuda.get_rng_state_all()``
reads one ge... |
50136057328bcda3c056e47e19faf5c55a1d62aafedb33f9b7a33f216b5f2ff7 | Python | 14,612 | 303 | """DataLoader utils."""
import io
import pickle
import multiprocessing
from multiprocessing.reduction import ForkingPickler
import numpy as np
from mxnet import nd
from mxnet import context
from mxnet.gluon.data.dataloader import DataLoader, _MultiWorkerIter
from mxnet.gluon.data.dataloader import default_mp_batchify_f... |
c5a9a8de9e46186c3b4e25d55b041273b6bee1027039c635b62e60b87b83a8ac | Python | 14,617 | 360 | """
features.py — Signal-processing feature extraction for birdsong detection.
All features operate on a single mono float32 numpy array (one audio chunk).
They are designed to be fast enough to run on every 100 ms chunk on a Pi 3B+.
Features computed
-----------------
rms Overall loudness. Near-zero ... |
33198fb05e98aa4d4811adf295cacfc45047191f61fd932db7d23bbafc7c7cf7 | Python | 14,619 | 254 | #!/usr/bin/env python3
"""
File: Correlate_correlations_with_sn_rnaseq.py
Created: 2021/05/25
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 th... |
b921c62bb88a808269c28c33967c6ed953618c7491550decb54df1260141da21 | Python | 14,619 | 397 | """Lifecycle coverage for conditional-label rename, cleanup, and export wiring."""
from collections.abc import Iterator
from types import SimpleNamespace
import pytest
import torch
import torch.nn as nn
pd = pytest.importorskip("pandas")
import torchlens as tl # noqa: E402
from torchlens.data_classes.cleanup impor... |
7b7cd0627894b6c5977384fa62af02fc75aebd2f2bfb61e7a205ca45a7a65b99 | Python | 14,622 | 373 | """A09 wave-0 report honesty: escape-free text, one-pass scan, log_value,
agent-guide triage, presenter refusals, poisoned/episode banners.
Covers listA rows 23 and 25a plus sumfam wave-0 items 1, 3, 4, and 6:
- ``first_nonfinite`` defaults to the plain-text register; report text never
carries ESC bytes or resolved-... |
7af34ec47d1d01fca14d4ed03c0230ec4704843ac9e8cf528e78ead2c340bba7 | Python | 14,623 | 352 | # Converting bam to read information
# Cell barcode, UMI, gene alignment, and counts
import os
import sys
from multiprocessing import Process
import pandas as pd
from collections import defaultdict
import gzip
#from pylab import *
import numpy as np
import pickle
#import HTSeq
import pysam
PATH = os.path.dirname(__... |
b68615f0a174592fb5cda73eaf8bb467e1ff78552e663af7890774a575407efa | Python | 14,623 | 502 | """
@author: Maziar Raissi
"""
import sys
sys.path.insert(0, "../PINNs/Utilities/")
import horovod.tensorflow as hvd
hvd.init()
import tensorflow.compat.v1 as tf
tf.compat.v1.disable_eager_execution()
tf.disable_v2_behavior()
import os
import numpy as np
import matplotlib.pyplot as plt
import scipy.io
from scip... |
9ff6c1af667a6379eaabb5c1ecb8a664df68ab222e94a9c0df8764736b3829f0 | Python | 14,627 | 329 | """Round-27 security regressions: dotted-name attribute-walk RCE + CVE-2025-32434.
Three confirmed findings on the DEFAULT (untrusting) ``tl.load(path)`` + ``.run()``
surface for an attacker-controlled ``.tlspec``:
E1 (CRITICAL, default-victim RCE) -- the ``SafeBundleUnpickler`` torch branch admitted
any resolved... |
8abaf2d925b4c6e9a27126a501ca0e95c4e53dab9f7976e7a93ef1c5c35ec75b | Python | 14,632 | 374 | """Test mne interaction"""
import os
import numpy as np
from numpy.testing import assert_array_equal, assert_allclose
import mne
from nibabel.freesurfer import read_annot
import pytest
from eelbrain import (
datasets, load, table, testnd,
Dataset, Factor,
concatenate, labels_from_clusters, morph_source_sp... |
255b710e3b985e7ee020fcb6a5320838c65fd9a4637c9fe0d715a10c4cdd28f0 | Python | 14,644 | 347 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... |
9cf1c6a0a1bdfa0e90c7e7bfe8bf4b029938560adcf6567e8c67033259d499a2 | Python | 14,652 | 325 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This script exists to convert .hdf5 files into counts tables readable by R.
#
# It is useful for performing differential accessibility analyses (e.g. with
# DESeq2) on hdf5 counts data from RIESLING, ROSE, or bamliquidator.
#
#
# Unfortunately, we can't use the rhdf5 pa... |
65a4e8e6d2fff604e897e65dc0fc14c10abeefd5e5d03b31c53f125ae72c4562 | Python | 14,655 | 448 | from __future__ import annotations
import re
import pytest
import env # noqa: F401
from pybind11_tests import PYBIND11_NUMPY_1_ONLY
from pybind11_tests import numpy_dtypes as m
np = pytest.importorskip("numpy")
@pytest.fixture(scope="module")
def simple_dtype():
ld = np.dtype("longdouble")
return np.dtyp... |
f245d45e594ad48f80ec80a744fa1f9fb8127951eb4864add92048328e3fee56 | Python | 14,659 | 339 | # 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 required by applic... |
299bd61649d66866aacf1f6b6e66bc6f4e1a7b986ce225834c3215dd3f9fa110 | Python | 14,662 | 344 | """modules for diffusion."""
import math
import paddle
import paddle.nn as nn
import numpy as np
from helixfold.model import geometry, all_atom, r3
from utils.igso3 import IGSO3
from scipy.spatial.transform import Rotation as scipy_R
import copy
def extract(v, t, x_shape):
"""
Extract some coefficients at spe... |
aa88518e8ff883d2b85018653a338a301620bad462e8ec30a419e8226785c1ae | Python | 14,665 | 322 | """
01: Model Description
=====================
A description of and introduction to the spectral parameterization module.
"""
###################################################################################################
# Introduction
# ------------
#
# Welcome to the tutorials!
#
# In this first tutorial, we ... |
706651a872d0b265060cf03a5b4b9db6ea0c41fe8a09b0260c0117a7c4d572c6 | Python | 14,667 | 405 | import numpy as np
class dotdict(dict):
"""dot.notation access to dictionary attributes"""
__getattr__ = dict.get
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
def __dir__(self):
return self.keys()
class DimensionManager:
# ('X',imageSize(2),pixelExtentInWorldX,pixe... |
6d19872d456ce1219f1f8ee51d50472d414980ae57a00d4900a52f41ff1d9072 | Python | 14,669 | 378 | #!/usr/bin/env python3
"""
Utility script to detect and remove duplicate rows from SQLite databases.
This script scans for SQLite database files and removes duplicate rows based on the 'id' column,
keeping only the first occurrence of each duplicate set.
Usage:
python cleanup_duplicate_db_rows.py [--directory /pa... |
15d6e626c4e12358fffb4936aa673c3b9453d4a3876637749b88a6d6b6b94df2 | Python | 14,670 | 356 | """
Rhythmicity of Time Series
==========================
Exploring the rhythmicity of time series and their frequency representations.
This example uses the
`neurodsp <https://neurodsp-tools.github.io/>`_
module for time series simulations & analyses.
"""
############################################################... |
e278fcd529cdc9cbde5263ab6da17e3b213ac5a33ec67cd6917c3c4344d87e7f | Python | 14,670 | 344 | """Plotting functions for aggregated UMI counts.
"""
import math
import warnings
from typing import Dict, Optional, Tuple, Union
import cv2
import matplotlib.pyplot as plt
import numpy as np
from anndata import AnnData
from matplotlib import patches
from matplotlib.axes import Axes
from matplotlib.figure import Figure... |
c430d602364a2148147116c6a25f5f9d9f18318e49b740123d2b706a7b6afc95 | Python | 14,677 | 272 | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from matplotlib import rcParams
import numpy as np
from scipy.cluster import hierarchy
from sklearn.preprocessing import StandardScaler
from sklearn.decomposition import PCA
plt.rcParams.update(plt.rcParamsDefault)
rcParams['f... |
cf7852ce69436557c16f53b40398066ca8f8dc0e42d44ad2099afaa0e9f65ad2 | Python | 14,683 | 396 | # --- 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 Coloraxis(_BaseLayoutHierarchyType):
_parent_path_str = "layout"
_path_... |
5bdb7b3062f7c9910f91fc42e9bb49db38d92a4d2244389addd7b44347f85143 | Python | 14,689 | 365 | """This script is largely borrowed from https://github.com/open-mmlab/mmaction.
"""
import argparse
import sys
import os
import os.path as osp
import glob
import fnmatch
import random
import zipfile
from pipes import quote
from multiprocessing import Pool, current_process
def dump_frames(vid_item):
from gluoncv.... |
ea44ccf7674f8d92fec87b350881daebf9812d20afe7d1179cc7b589401c233b | Python | 14,690 | 442 | """Tests for the python features of eFEL"""
"""
Copyright (c) 2015, Blue Brain Project/EPFL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copy... |
78c76e47926af435858409738cd9b03859553ae5a9a1c1d8dde0fe80f5d4ff56 | Python | 14,694 | 421 | """Teaching-refusal battery for structure-only capture (L7a memo sec 2/9.3).
Covers: provocations per consumer kind with exact user source lines,
DEVICE-NEUTRAL refusals (the sol r2 B1 contract — real tensors refuse like
meta ones), the lifted float-truthiness gate (in-mode only), the
missing-meta-kernel backstop with... |
4ffa96af118e072b9c198c96c99733161c81ef2c9180b1b6a48c088beee93754 | Python | 14,695 | 361 | """
TensorFlow 2 OscoNet code
"""
import argparse
import time
from typing import Tuple
from numba import njit,prange
import numpy as np
import scipy.stats
import tensorflow as tf
import tensorflow_probability as tfp
from OscopeBootstrap import qvalue
from OscopeBootstrap.SyntheticDataset import GetSimISyntheticData, ... |
6018614c780ecbeaa1b5258be6b753a25efa827e2325cd5d6c8a163eef303200 | Python | 14,698 | 343 | import unittest
import numpy as np
from os.path import join, abspath
import cantera as ct
from spitfire import ChemicalMechanismSpec as Mechanism, HomogeneousReactor
import spitfire.chemistry.analysis as sca
from spitfire.chemistry.ctversion import check as cantera_version_check
xml = abspath(join('tests', 'test_mecha... |
bd2be9c376f7c91271a4cd0afaef31fe84ec009d224cfec126c4b6fb73d60436 | Python | 14,698 | 428 | import warnings
import itertools
from contextlib import contextmanager
from packaging.version import Version
import numpy as np
import matplotlib as mpl
from matplotlib import transforms
from .. import utils
class Renderer(object):
@staticmethod
def ax_zoomable(ax):
return bool(ax and ax.get_navigat... |
7b96ffa9f89ab300c7018a1108d05de909a1b685ad35aa5b08e8dd58c03c08f4 | Python | 14,699 | 451 | import ctypes
import logging
import os
import sys
import numpy as np
from .exceptions import LibCUDAException
from .util import load_lib
logger = logging.getLogger(__name__)
cudaLib = load_lib("libcudaDecon")
if not cudaLib:
logger.error("Could not load libcudaDecon! Read docs for more info")
else:
try:
... |
8b5741e5d65129ba6a04b6edf5fd2d4fbe6d9f6223306bbc3f2a3ebfc3d783d7 | Python | 14,711 | 408 | import os
import random
import math
import argparse
import logging
import os.path as osp
from io import BytesIO
import lmdb
import numpy as np
from PIL import Image
from tqdm import tqdm
from mpl_toolkits.axes_grid1 import ImageGrid
import matplotlib.pyplot as plt
plt.switch_backend('agg')
import mxnet as mx
import m... |
7f5fe7f4a46ac5ab4043773c746258a920c4e8653f728537ffcc3763ab826244 | Python | 14,715 | 328 | import os
from paddle_code.data_loader import *
import time, argparse
import numpy as np
from collections import defaultdict as ddict
from ordered_set import OrderedSet
import paddle
import paddle.nn.functional as F
from paddle.io import DataLoader
from paddle_code.model import coatt
class Main(object):
def __ini... |
0a477d1198b85edc663504fa7f0d4501086c307322de9c473abd5c5456e47cff | Python | 14,716 | 396 | import numpy as np
import torch
import math
import torch.nn.functional as F
from torch import nn as nn
from torch.autograd import grad
import schnetpack
from schnetpack import nn as L, Properties
class ShiftedSoftplus(torch.nn.Module):
def __init__(self):
super().__init__()
self.shift = torch.log... |
027b3a9bc813c73ae08d60ad38085a72400812dae65da3cb77a373c3c4b2e42d | Python | 14,723 | 411 | #!/usr/bin/env python3
import multiprocessing
import regex as re
import logging
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from MarkovModels import common
from MarkovModels.BeattieModel import BeattieModel
from MarkovModels.ClosedOpenModel import ClosedOpenModel
from M... |
fb35ec37d0f4021953a85d3daa7a2eee4cb4c2f334ead1cd8a67a09e40b78248 | Python | 14,726 | 295 | # Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com)
""" Training classes and functions """
import sys
import numpy as np
import torch
from plus.utils import evaluate_result
class Trainer():
""" training helper class """
def __init__(self, models_list, get_loss, cfg, tasks_list, optim=N... |
07454e5a42c0e33e41b88081f0c18320cccf1439fb37d3caa6fafe8dfc73419a | Python | 14,728 | 401 | import pandas as pd
import yaml
import numpy as np
import scipy.ndimage
import time, os, sys
import skimage.io
import matplotlib.pyplot as plt
import matplotlib as mpl
mpl.rcParams['figure.dpi'] = 300
from cellpose import utils
from matplotlib import cm
from skimage.filters import threshold_otsu
from skimage.measure im... |
375d8d41064a83db81908b9be0f15d03f440fb7a7e53bc3a23d6e6970cb94382 | Python | 14,729 | 451 | """Phase 12b stretch-tier bridge contract tests."""
from __future__ import annotations
import builtins
import sys
from dataclasses import dataclass
from types import ModuleType
from typing import Any
import pytest
import torch
from torch import nn
from torch.fx import symbolic_trace
import torchlens as tl
import to... |
e32a191f46f8e62dff2d045264665ec0faae838837a8f49abbfff10e99037fa9 | Python | 14,729 | 363 | """
Utilities for encrypting sensitive headers using Galaxy's Vault system.
This module provides functionality to:
1. Identify sensitive headers that should be encrypted based on configuration
2. Encrypt/decrypt headers using the vault
3. Transform data structures to use vault references for sensitive headers
This ca... |
c9f883c5071d9e67e7a41185ae0323383f14e90912db81c6074b57842449d6aa | Python | 14,730 | 348 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.