sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
47f4abf56e2e75b129d20b1a3c0eb7e711e3d0328493237ad95cee1767c653bb
Python
4,745
163
# --- 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 Number(_BaseTraceHierarchyType): _parent_path_str = "indicator" _path_str...
b419c265fcc514fd9864b9ab8f0579653d41da5c5dced567e4ea0bac42b014a3
Python
4,745
82
import torch #import opt_einsum as oe class Neigh_List(torch.nn.Module): def __init__(self,cutoff:float,nlinked:int): # nliked used for the periodic boundary condition in cell linked list super(Neigh_List,self).__init__() self.cutoff=cutoff self.cell_list=self.cutoff/nlinked ...
eac8c8c12a77f993159525b2edb8268ef92ea3a1add0b825d82e3d4f2e5c8ff1
Python
4,745
99
"""Regression guards for the torch-2.13 arg-spec capture-gap fix (R18CG). Two related findings surfaced while reconciling ``tests/test_arg_spec_coverage.py`` against torch 2.13: * ``torch.align_as`` (the named-tensor ``Tensor.align_as`` method) was REMOVED in torch 2.13. It is therefore version-varying: still decor...
f0a01cd0b697d5826ffca47c6c0ac6843a86ec28c7c9743736bc9eb7f6fc1d00
Python
4,745
140
#!/usr/bin/env python """ Utilities to convert sleepsign output files. """ import numpy as np from somnotate._utils import convert_state_vector_to_state_intervals from data_io import ( ArgumentParser, load_dataframe, check_dataframe, export_hypnogram, ) SLEEPSIGN_KEY = dict([ ('w' , 'awake...
5b324c6632184b34818cd835d335800e49b95dce3f867ab4fe22b69fe5962df6
Python
4,746
126
import unittest from unittest.mock import patch from carbontracker.components.apple_silicon.powermetrics import ( AppleSiliconCPU, AppleSiliconGPU, PowerMetricsUnified, ) class TestAppleSiliconCPU(unittest.TestCase): def setUp(self): self.cpu_handler = AppleSiliconCPU(pids=[], devices_by_pid=F...
b7fcce72f56a64348838627ed8256ac232eac32416be5e04fa0456b93c3df73d
Python
4,746
135
"""Backend trace-option honesty checks.""" from __future__ import annotations from typing import Any import pytest from torchlens.backends import BackendSpec, BackendUnsupportedError, registered_backend_specs from torchlens.backends._options import ( JAX_PREVIEW_TRACE_OPTION_POLICY, MLX_PREVIEW_TRACE_OPTION...
d321d2f1b9804a53759eb6e944d9f53deb7fa2ba70b99307235519e399fa1d9a
Python
4,747
130
"""ArgSpec lookup table coverage test and usage report generation. This test runs LAST (via pytest_collection_modifyitems in conftest.py) so it can inspect the accumulated _function_call_counts from all other tests. """ import csv import os from os.path import join as opj import pytest from torchlens import _state ...
aaf62439bd1440300122a61f55cecc049f7b1d60825457eb0b4c83b64eb3decd
Python
4,748
142
import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers import numpy as np class Capsule_Mul(layers.Layer): def __init__(self, num_classes): super(Capsule_Mul, self).__init__() self.num_classes = num_classes def build(self, input_shape): # -*...
307a1a011c2cbd539263a636bb22bb838111dc2233e269d4542afae6c14dc988
Python
4,750
125
#!/usr/bin/python ########################################################### # eQTL file has to follow the following structure and tabixable # chr pos A1 A2 tested-allele statistics P FDR/corrected P # # A1/A2 are in arbitrary order # If alleles are provided but tested allele is not specified, # teste-allele column ...
77af5179fa915f87bd46574f9cb3e02c5b4bb06e592610d9eda839ed8c1c9e1d
Python
4,750
110
import sys # setting path sys.path.append('../TM2_segmentation') import os import SimpleITK as sitk import numpy as np import functools from skimage.transform import resize import nibabel as nib import numpy as np import pandas as pd from scripts.preprocess_utils import load_nii,find_file_in_path # helper function...
3cb29893a60d8ff2f7c7110fb30784941b89ef4bfd1ea87156a93548a696f665
Python
4,751
145
import os from importlib import import_module import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import torch import torch.nn as nn import torch.nn.functional as F class Loss(nn.modules.loss._Loss): def __init__(self, args, ckp): super(Loss, self).__init__() ...
9e7117c3dc5aebba9662a043c0c41c4d04a700906dcbe212b6894701bcb5b9de
Python
4,751
80
# Generated by Django 3.2.6 on 2022-05-18 16:06 import biomedisa_app.models from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ...
b836dbf368d42f7769a761ab4c46bca32f791e9fd17f83050cf74c79414ee993
Python
4,755
111
"""Блок B: валидация движка чужим предсказанием (Requejo & Camacho, 1312.3450). Аналитическое предсказание: при изобилии ресурса популяция однородно предательская, при падении ресурса ниже порога выживают безусловные кооператоры — у агентов БЕЗ памяти и БЕЗ узнавания (recognition=False). Ищем РЕЗКИЙ переход доли коопе...
d1437f84e8bd8870f6c3456b2dc9e5c689f48900e8be92419d2e5f187a51f88b
Python
4,755
150
#!/usr/bin/env python3 '''Read a line formated like a spearmint results.dat line, construct the corresponding model, run the model with cross validation, and print the results; dies with error if parameters are invalid''' import sys,os def get_script_path(): return os.path.dirname(os.path.realpath(sys.argv[0])) ...
4bb2318ada21a2921e9bf8869135bdcf6a2997a6efd43749a880a25a1af6605b
Python
4,756
144
#!/usr/bin/env python __author__ = "Bjoern Gruening" __version__ = "0.1" __date__ = "2012" __license__ = "GLP3+" import argparse import os import sys from multiprocessing import Pool import cheminfolib import GenericMoleculeDB import pybel from GenericMoleculeDB import build_database, create_indices from sqlalchemy....
6292f8cdb5c8469102785827c52590084fb1241884ba7dba752cf78dacc7a315
Python
4,756
116
"""Revoked ids received from another worker, on mingle or through ``hello``. They are stamped with the receiving worker's own clock, whatever stamps they come with (#4300): a set filled with stamps ahead of the local clock would otherwise purge every id revoked from then on the moment it is added, and the task would r...
c3edc421052db8d24b4b66005d6b4c8513f62c14d5709bd73e0fc5650869fd63
Python
4,756
123
"""The SG-regression manifest gate (compo memo stratum 3; F36 waves A-D). "No SG number without a node": all fifty DIGEST-AUDIT section-1 silent gaps are enumerated in ``data/sg_manifest.tsv``. Regression-node rows must name a test node that EXISTS on disk (file, or file::test verified against source); ledgered-open r...
f87567c2b15bbbd0d6568c116cc2e04e5b115a72e45491f75f48b40a1c941a73
Python
4,756
104
#The related files involved in tutorials are available at: http://www.cellgo.world from CellGO import Modeling import pandas as pd import numpy as np import scanpy as sc #####Step1 Importing the single-cell expression matrix and the cell identity list GeneExpMatrix=sc.read('Example_ExpressionMatrix.csv.gz') CellType=l...
b24281be8085f1edce2d6a05ad1499054b8612082793e8b002a14897dc550ccf
Python
4,758
152
# 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 app...
65289869cfb5e500d7593b50f11819e6598c7032897d1199f2e4a9a9c16f3aa5
Python
4,759
128
import os from pathlib import Path from pydantic import Field, field_validator from pydantic_settings import ( BaseSettings, PydanticBaseSettingsSource, TomlConfigSettingsSource, ) from neurogym.config.base import CONFIG_DIR, LOCAL_DIR, PKG_DIR, ROOT_DIR, ConfigBase from neurogym.config.components.agent i...
92f492eec1a9d54b2bf15cce44db19529d734a0643fb7c30ba37105334c37e97
Python
4,759
144
"""Premature stop codon, frameshift""" import logging import os.path from math import floor import re from Bio import SeqIO from .GeneCutter import submit_GC, process_GC # pylint: disable=C0103 # Invalid constant name logger = logging.getLogger('pipe.psc') def psc(configs, seqs): """Premature stop codon""" ...
d6e271bebf6ca2a67ed590b45071d697211ca40e8f95f5fe2c5ef5eb50a10660
Python
4,759
100
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
ed54487d4a28d0ee3870bf87d1abdda4a260d79fabf1da5303b9f32c49e79d3a
Python
4,760
156
import numpy as np import cv2 from xml.dom.minidom import parse import re from math import pow, sqrt, floor from PIL import Image import torchvision from torchvision.models.detection.faster_rcnn import FastRCNNPredictor from typing import List, Tuple, Dict, Optional from torch import nn, Tensor from torchvision.transfo...
f4fb975cb9cf948e6ebd6a5c4aa3aff1201866805863f76c0827514d77f55dc9
Python
4,760
148
from __future__ import annotations import collections import time from typing import TYPE_CHECKING from typing import Final import numpy as np from loguru import logger from numpy.typing import NDArray if TYPE_CHECKING: import osam def _elapsed_ms(*, t_start: float) -> float: return (time.perf_counter() - ...
f8aaa6dec9b485c1bbd75c5eaae7649c969866d892fc19cd19ffc1aee98d4abf
Python
4,760
135
"""IO functions for SeqScope technology. """ import os from typing import Optional import numpy as np import pandas as pd import scipy.io from anndata import AnnData from scipy.sparse import coo_matrix try: from typing import Literal except ImportError: from typing_extensions import Literal from ..configurat...
545f1dbfe612b0f8b41766d5cbb13e9cae229b1ea0e18ccf33e45fd629fdb2a0
Python
4,761
187
"""Load the classics corpus manifest and build its vendored models. The corpus is a coverage-chosen sample of hand-built, trace-verified "classics" (historical and unusual architectures written directly in PyTorch). Each model file under ``models/`` is vendored byte-identical to its source and pinned by sha256 in ``ma...
ab7c34434600eaff2867310ccd97ebacc56dc5c4d4f184e5e3a0b4078b67e109
Python
4,761
155
""" All classes supporting objects, agents and environment of the agent-based-modeling simulations, as well as the modules comprising the layered behavioral architecture modeling the nervous system, body and metabolism. """ from __future__ import annotations from typing import Any __displayname__ = "Modeling" # Pro...
e19d2e2004ff01adef73690542a4bde3e137a0295ea4c045e5f5b6a4b40c2049
Python
4,761
88
#==============================================================================# # Author: Dominik Müller # # Copyright: 2024 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
e55eb8d90b7f71fc410be27ec072b273707e6746af8d5493e0b938299aa1ee61
Python
4,761
135
"""Smoke tests for the RPC result backend. Regression coverage for https://github.com/celery/celery/issues/4830: polling the RPC backend for a completed task used to requeue the final result message instead of acking it, so final results recirculated on the reply queue on every state poll. These tests run against a re...
df897830f137d4a0bc08e955d881e834eb4574a27f06c6fb360052ec5aa452a0
Python
4,762
128
"""Example template for contributing new tasks.""" # noqa: INP001 import numpy as np from neurogym import spaces from neurogym.core import TrialEnv class YourTask(TrialEnv): def __init__(self, dt=100, rewards=None, timing=None, sigma=1) -> None: super().__init__(dt=dt) # Possible decisions at t...
b393619e6948a2918092b27456359d173b1225728646ef97b2fe5e2323d46eba
Python
4,763
136
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...
36ffb9d473e34735a13aa7c451b8d492b87547fc0442cab7e57068bb91f7d074
Python
4,764
157
#!/usr/bin/env python # encoding: utf-8 from __future__ import (absolute_import, division, print_function, unicode_literals) import os, sys, re import logging import argparse import collections logging.basicConfig(stream=sys.stderr, level=logging.INFO) logger = logging.getLogger(__file__) de...
cc150b60344b762cfcf5ab1dd110e0cbf876eae75b8dec3f1bcd13fd926bfe26
Python
4,764
149
import pytest from pyrosm import get_data @pytest.fixture def helsinki_pbf(): pbf_path = get_data("helsinki_pbf") return pbf_path @pytest.fixture def helsinki_region_pbf(): pbf_path = get_data("helsinki_region_pbf") return pbf_path REQUIRED_COLUMNS = [ "name", "admin_level", "boundary"...
86459a422f3653e49c64c0ad3f6f611d5bb0d0eb7d66c2d8f604bf6b0ffccdec
Python
4,765
138
from ._RL_agent import * from numba import njit @njit def latent_state_rewasym_session_value(choices, second_steps, outcomes, n_trials, transition_type, params): # Unpack parameters. p_r, weight_inf = params[:2] rew_good = 0.4 rew_bad = 0.1 non_rew = 0.5 V_s = np.zeros((n_trials, 2)) # Second step TD v...
58d1606beb93f6563e5112b9108cdeffda42657efe9918b7a6c2d3006a479d74
Python
4,766
88
#==============================================================================# # Author: Dominik Müller # # Copyright: 2022 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
adf824d542a1fc3f736d68ad7dbf62a5634cb0c633fcebd95d5d6a29737e18b8
Python
4,766
88
#==============================================================================# # Author: Dominik Müller # # Copyright: 2022 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
6261b34fcf691d190ba5a714953df37dc279d0fc1b18d7e20332ac9283e17fb6
Python
4,768
152
import click from dataclasses import dataclass import logging import multiprocessing import os from pathlib import Path import re from regression_data import EXPECTED_OUTPUT import shutil from subprocess import PIPE, Popen, TimeoutExpired import sys import time logging.basicConfig() logging.getLogger().setLevel(loggin...
68141c643c9a05e1d974d3ac86f723dde114311531289d6be1d90ab0cae34f00
Python
4,769
162
#!/usr/bin/env python """ Modified version of code examples from the chemfp project. http://code.google.com/p/chem-fingerprints/ Thanks to Andrew Dalke of Andrew Dalke Scientific! """ import argparse import os import subprocess import sys import tempfile import chemfp from chemfp import search def unix_...
16d2669bcc9ce8f71de163aee9a052e5eb34728461ae12727168ee7fa88e8ff8
Python
4,770
88
#==============================================================================# # Author: Dominik Müller # # Copyright: 2022 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
23df75150e74815621a99b36f63b9accadbb92c5c232ff749eec23e9193bb4ea
Python
4,770
144
#!/usr/bin/env python3 from GNNSubNet import GNNSubNet as gnn import ensemble_gnn as egnn import copy import random import time from sklearn.metrics import balanced_accuracy_score from sklearn.metrics import accuracy_score from sklearn.metrics import matthews_corrcoef RANDOM_SEED: int = 23215600 # location of the ...
048bf58d887cd80adc848b43ab02c5939276be227b4bdfbd2ea0f3c5f348b1de
Python
4,771
88
#==============================================================================# # Author: Dominik Müller # # Copyright: 2022 IT-Infrastructure for Translational Medical Research, # # University of Augsburg ...
d6347f25f19638a32b3e91cb72da1096ce1fd13d619463c1560cc38a4ba8f45c
Python
4,771
150
# 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...
a6ecc8e0aafebee31784b6c8672da6431e37ab7e4988a9d2f5e36ab890d9bb93
Python
4,773
148
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. # # 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...
b1eed0f461d8869e21abd8bfe12b58f7f13d772384bba52a1c0ce3cb8079513d
Python
4,773
135
"""Offline coverage of the Geofabrik / BBBike data-source accessors (#272). These walk the static source tables shipped with the package (no network I/O) and assert every region/city resolves to a real ``*.osm.pbf`` URL, exercising the per-region ``__getattr__`` / ``__call__`` accessors on every source class. """ imp...
2f66fab93f025e624f29596c0a6b76c062453812dc3204cf91f695f40797699b
Python
4,774
168
import abc import pathlib from typing import Optional, Sequence, Union from dm_control import mjcf class _Entity(abc.ABC): def __init__(self, root: mjcf.RootElement, name: str, position: Optional[Sequence[float]] = (0, 0, 0), rotation: Optional...
dd833f6a3efed5dbb9644ca96eed891caf71d68647a3a3f1b54b5859507663c3
Python
4,774
134
"""F02 backend refusal matrix (edits memo D36; row A6, structural half). The stochastic/population family executes on torch only. Construction, repr, equality, and pickle identity work backend-free; EXECUTION on a preview backend refuses at that backend's helper-resolution preflight, because the adapters resolve built...
de553b5d5ddf79275e6b92a35ac8d356514194986c78ef40681977e24ea9c77c
Python
4,774
131
"""Define common base objects.""" from copy import deepcopy from specparam.utils.checks import check_array_dim from specparam.modes.modes import Modes from specparam.reports.strings import gen_issue_str ################################################################################################### ##############...
2e27b1c94d2e99707a5cb3445d9c6da419876f73ff909cd783a50b427fefe435
Python
4,776
111
# SPDX-License-Identifier: LGPL-2.1-or-later #!/usr/bin/env python #-*- coding: utf-8 -*- import os import numpy as np from collections import OrderedDict from .utils import general as utils from .write_to_file import write_registrations_stats from .plotting_functions import single_timeline_heat_map def get_single_a...
374db6209d70269407ef05a8d2538a02cb718a67c1072401bedbc8c7975762c5
Python
4,776
165
"""Runtime handle accessors for live Torch objects.""" from __future__ import annotations import gc import weakref from pathlib import Path from typing import Any import torch from torch import nn import torchlens as tl class _HandleModel(nn.Module): """Small module with params, buffers, submodules, and autog...
455e24f208ab31d5915c9c25a2e43b4a859a1cd539d57052164937c084e98b07
Python
4,776
117
"""Utilities shared by the built-in datasets.""" import io import pickle import zipfile import numpy as np # A dataset npz member is rejected as a decompression bomb when its declared # size is above this floor and far larger than the bytes stored on disk. Genuine # dataset members store real data and should not app...
b0dd159ad1d0c661157eeeee12559d52dfc30a891c496886b2ae63ee03194396
Python
4,776
117
"""The per-symbol realism registry + PR closure gate (memo D5/E1; F36). Every live public symbol needs realism-graded test evidence and a docs reference, or a dated owner-carrying gap row -- checklists rot, so the registry is closure-checked against ``torchlens.__all__`` in BOTH directions on every run. Realism ratche...
03a210792b629ad369f3ac73fbe4d6c1b6e7198bb37a9656dfb5c1a058d18bd5
Python
4,777
117
import pathlib import sys import unittest import numpy as np from asmc.asmc import * data_dir = pathlib.Path(__file__).resolve().parent.parent / 'ASMC_data' if not data_dir.exists(): print(f'ERROR. {data_dir} does not exist. Did you clone ASMC recursively with submodules?') sys.exit() class TestASMCRegress...
18b2c27f186296dc5d34577395d66b7a21467dc11bf9203444bea71bf6f98d4c
Python
4,779
130
"""Tests for user-managed annotation dictionaries on TorchLens logs.""" from __future__ import annotations from pathlib import Path import numpy as np import torch from torch import nn import torchlens as tl from torchlens.constants import ( LAYER_LOG_FIELD_ORDER, LAYER_PASS_LOG_FIELD_ORDER, MODEL_LOG_F...
3c881866dac21906fe64fbf992787da793b143680ff6786e3000678cd2c94f27
Python
4,779
152
from functools import lru_cache import numpy as np import torch import torch.nn as nn import tqdm.auto as tqdm from permacache import permacache from modular_splicing.dataset.data_rewriter import DataRewriter from modular_splicing.evaluation.evaluation_criterion import EvaluationCriterion from modular_splicing.models...
89e9a43a51ca50df4ccf1656c84dbdf8d0bc02c1dca21d2f10da5c57a6411d32
Python
4,780
120
"""This script is for preprocessing something-something-v2 dataset. The code is largely borrowed from https://github.com/MIT-HAN-LAB/temporal-shift-module and https://github.com/metalbubble/TRN-pytorch/blob/master/process_dataset.py """ import os import sys import threading import argparse import json def parse_args(...
5cda1f88e25ab9475490d46b1d67aa0f6e20c53c01322531ab0c96f991c26b4b
Python
4,782
145
"""Random dot motion task.""" import numpy as np from neurogym.core import TrialEnv from neurogym.utils import spaces class ProbabilisticReasoning(TrialEnv): """Probabilistic reasoning. The agent is shown a sequence of stimuli. Each stimulus is associated with a certain log-likelihood of the correct re...
27674e6d0aa59540e2383bdb5012262c5532cab7d419413c614f3f56c051d73e
Python
4,784
112
#!/usr/bin/env python3 import os import sys import pandas as pd import random from random import shuffle import argparse # the following line is to deal with the case that self-defined module # in the submission directory are not found when submitted through sbatch, as in # https://stackoverflow.com/questions/46718...
78cb1a270ee18a100d9d88332fcb39249a963ae73fe55cb587dcf798af9e6823
Python
4,784
138
import torch as ch import numpy as np from torch import nn from robustness.audio_functions import audio_transforms from torch._jit_internal import _copy_to_script_wrapper import numpy as np from .layers.padding import pad_valid_time, pad_same class FakeReLU(ch.autograd.Function): @staticmethod def forward(ctx,...
9f746b68d9df2c64f67f4ac8d70b476826c29c2f8458950a3c4ac83182002b9b
Python
4,784
155
import pytest import nway.nway_matching as nway import os from jinja2 import Template import json import numpy as np import copy import contextlib import PIL.Image from pathlib import Path TEST_FILE_DIR = os.path.join( os.path.dirname(os.path.abspath(__file__)), 'test_files') @pytest.fixture(scope='...
e0bef5cb8dae81baee161ce8303822cf93d4cee41ff0120326652d96eab8e864
Python
4,784
131
#!/usr/bin/env python3 # coding: utf-8 """ Created in January 2021 @author: Thomas Bonald <bonald@enst.fr> """ from abc import ABC from typing import Union import numpy as np from scipy import sparse from sknetwork.embedding.base import BaseEmbedding from sknetwork.linalg import Regularizer, Normalizer, normalize fro...
23d2521bbb31baa42916759f57b51a75f7b01aa4746c62aa297c34680d33c853
Python
4,785
83
#### Modified from TAURUS Lee et al., Nat Methods 2019 (https://github.com/dixonlab/Taurus-MH) import sys fn=sys.argv[1] dfh=open(fn,'r') rfh=open('./'+fn.split('/')[-1]+'_2_contacts.txt','w') stat_rfh=open('./'+fn.split('/')[-1]+'_2_contacts.stats.txt','w') dfh.readline() def foo(x, y): return 0 if y == 0 else x...
3efc320a697e0b594580dfa2117ef5923a75fb539dfeab4f2abc3c1665c092bb
Python
4,786
133
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 00_bootstrap.py — 精简导入(不安装 torch) 为什么需要这个 ------------------------------------------------------------------ proteoclock 的 __init__.py 会无条件导入深度时钟(ipfP3GPT, Galkin 2025), 而深度时钟依赖 torch(约 250 MB)。但: · 深度时钟的权重已被 UK Biobank 要求下架,公开环境里【永远无法运行】; · 本方案只用简单时钟(OrganAge / P...
9261f696e66108974bb8ac98d951daca10e5c9f971ce54e120c7a60fba9fd828
Python
4,786
146
import numpy as np #import scipy.stats import random import sys def zscore(mat, return_unzvals=False): """Z-scores the rows of [mat] by subtracting off the mean and dividing by the standard deviation. If [return_unzvals] is True, a matrix will be returned that can be used to return the z-scored values...
96a7736b1e8b36ae6a3372cb4dcdebf55e5bf128f2bb878c07c55b948f1a1682
Python
4,787
134
import torch import torch.nn.functional as F from torchmetrics.functional import pairwise_cosine_similarity import numpy as np from metrics.losses import cosine_push_loss, uniform_loss, kl_divergence_to_standard_gaussian, \ sliced_wasserstein_distance_to_uniform_hypercube, sliced_wasserstein_distance_to_standard_g...
35797c5f64497056c27c7cf539126c7dc998626c8f4aa361d669efd0a3599773
Python
4,788
138
"""Generate the fish completion script for vsearch. Writes to stdout. Invoked from completion/Makefile.am: cd scripts && python3 gen_fish.py > ../completions/vsearch.fish """ from __future__ import annotations import sys import spec as spec_mod HEADER = """\ # vsearch completion for fish # Auto-generated from...
3d72c28eec2291dd5d7128e41da2bc1622e8cf64dea789f146174057a8d61eae
Python
4,788
109
from cProfile import label import pylustrator pylustrator.start() import os import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy.optimize import curve_fit initializers = ["const", "binned"] datasets = ["mnist", "mnist_with_brightness_offset", "fashion_mnist", "fashion_mnist_with_bright...
e10a698eeb0680267ab7f47ee346f3aee9d0a65d0711c61639441ddf7e12c682
Python
4,788
136
""" Unit tests for core/tracking_unit.py. Tests TrackingUnit class including initialization, tracker/stimulator binding, position retrieval, and the track pipeline. """ import unittest from unittest.mock import MagicMock, Mock, patch import numpy as np from ethoscope.core.data_point import DataPoint from ethoscope....
300c5b538a49e3c9498d77dcaa0a7d95360f68bb29514640effd04b463e134fb
Python
4,790
135
# Configuration file for the Sphinx documentation builder. # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/page/usage/configuration.html # -- Path setup -------------------------------------------------------------- import shutil ...
b8479126cca84bde75a3ad4c9adfe82f39bc6dfdb976cca12dc40fc1aa3faf95
Python
4,790
144
# -*- coding: utf-8 -*- import logging import os import subprocess from galaxy.datatypes.data import get_file_peek, Text from galaxy.datatypes.metadata import MetadataElement def count_special_lines(word, filename, invert=False): """ searching for special 'words' using the grep tool grep is...
4a4c0504ff1bdad2d8fa6057b4bba5c7ed3f6b153f6755c211f2b69089ba454e
Python
4,791
156
import sys import collections from collections import Counter def Merge(dict1, dict2): res = dict() for k,v in dict1.items(): if k in dict2: v = dict2[k] + v res[k] = v else: v = v res[k] = v return res def reverse_base(base): if base == 'A': rev_base = 'T' elif base == 'T': rev_base = '...
9ed2a3e3bff732686a50a82e6495d35b702dfc2f5092be2dd105211292b2e081
Python
4,791
109
""" @Time: 4/8/2023 下午1:48 @Author: Heng Cai @FileName: run_screening.py @Copyright: 2020-2023 CarbonSilicon.ai @Description: """ import argparse import os import numpy as np import pandas as pd import torch from rdkit import Chem import multiprocessing as mp from tqdm import tqdm from RTMScore.utils...
20b3b735c7c643c12e328f44dc688b3a07609c11a8f1e937a7fc5befafe91751
Python
4,792
142
"""Scoped, NON-attaching payload reads for analytics over lazy artifacts. The interactive ``op.out`` read on a lazily loaded trace MATERIALIZES the blob and ATTACHES it to the op (user semantics: read once, keep it). An analytics/agent layer that walks every site through that door turns one bounded question into a who...
3be41a58a063dd01a8c9f4ed6f72ad880fde38fdd207350e8af23f84e2090939
Python
4,797
143
"""Tier-(ii) edits COMPOSE and never silently revert (AUD-CODE 2.9b / 4.10). Before the fix EDGE-kind tier-(ii) entries were excluded from the cone re-splice, so any later recompute of the child (a second edge edit on another arg, an upstream act edit, a param edit reaching the child) silently reverted the substitutio...
c8e7e32d10f3202b227f0a511970eb84e804d1e8366e64383be05658cea8ad53
Python
4,797
146
# Copyright (c) Facebook, Inc. and its affiliates. import torch import torch.nn as nn class Mlp(nn.Module): def __init__( self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop_rate=0.0, ): super().__init__() self.dr...
cca86a983327ad7e4e4d2350e31070fa6379993195bbac2388d156f9a8d66042
Python
4,797
142
"""Build Environment used for isolation during sdist building """ import logging import os import sys from distutils.sysconfig import get_python_lib from sysconfig import get_paths from pip._vendor.pkg_resources import Requirement, VersionConflict, WorkingSet from pip._internal.utils.misc import call_subprocess from...
0ced9087f0f227adef8b6704ef1856a7cc25c374720e371fb8fd1c9b8933a8e5
Python
4,798
121
import SimpleITK as sitk import numpy as np from skimage.transform import resize def resize_image(image, old_spacing, new_spacing, order=3): new_shape = (int(np.round(old_spacing[0]/new_spacing[0]*float(image.shape[0]))), int(np.round(old_spacing[1]/new_spacing[1]*float(image.shape[1]))), ...
95f41295cb9ad25add639b0c8a92d9bc61663f0f1487bb4ed634d0bec5063bfe
Python
4,798
164
import os from .cromwell import Cromwell from .cromwell_backend import ( BACKEND_ALIAS_LOCAL, BACKEND_AWS, BACKEND_GCP, BACKEND_LOCAL, BACKEND_LSF, BACKEND_PBS, BACKEND_SGE, BACKEND_SLURM, ) CONF_CONTENTS_TMP_DIR = """ # Local directory for localized files and Cromwell's intermediate f...
0e5e2f14cd849a262d29eb0f0b5dfd79decb89dfa6ab330a99e471f24608709b
Python
4,799
150
"""Generate a .csv file with the points to validate the transform""" from time import strftime,localtime from os.path import join, dirname, abspath import SimpleITK as sitk import pathlib import glob import sys import os TRANSFORM_FILES = [] def main(argv): if len(sys.argv)<2: print('python generateValida...
eaf18e3aa4563d7ec6219ad4348976211cc95be37bdbe3d3b4175b3e780c52f9
Python
4,799
136
# SOURCE: vendored from autonlab/auton-survival @ master # # Files combined below (imports/paths adjusted only, architecture untouched): # auton_survival/models/dsm/dsm_torch.py (create_representation helper only) # auton_survival/models/dcm/dcm_torch.py -> DeepCoxMixturesTorch # # The queued candidate repo (chirag...
280d5a84c5fda7e4c7bf2852b156f725d74381824b350f948094a30558ac2935
Python
4,800
150
# coding=utf-8 # Copyright 2026 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...
9f82efb5a7bc13de5a45c5cfbeb074ae5272a98d9170b427d7fdbe02622f0bc9
Python
4,800
121
# General imports import os import glob import sys import torch import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import pytorch_lightning from tqdm.auto import tqdm # EUGENe imports and settings import eugene as eu from eugene import models, evaluate, settings from eugene.mo...
baad14e3d2442ee207612fe686fd1ebd82fd9e88b6e5fe711b48a42224020eb7
Python
4,803
144
import torch.nn as nn from modular_splicing.models.modules.spliceai import SpliceAIModule from modular_splicing.models.modules.sparsity_enforcer.sparsity_enforcer import ( sparsity_enforcer_types, ) from modular_splicing.models.motif_models.types import motif_model_types from modular_splicing.models.modules.lssi_in...
9ff4c08018a8e914c615886dfb4223e2cf5997284be02498b475951ccbb931ac
Python
4,804
142
import sys from scipy.fft import skip_backend sys.path.insert(1, '/u/home/r/ryo10244/Xiao_lab/dsRNA_pred/script/utils') import re import pysam import argparse as ap import pandas as pd import numpy as np from utils import * import random #import multiprocessing as mp #from functools import partial def...
fb036a73713767f6b26529ca1f7e7cb667995eb5f5aed3f38fa6177a0416671b
Python
4,804
139
# Copyright (c) 2024 PaddleHelix Authors. All Rights Reserved. # # Licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 # International License (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at # # http://creativecommo...
48b663b89cbe06356de5d78f1b1507d08736672bf5e02e56b1d971f01fc735ad
Python
4,805
175
from ast import ( parse, walk, ) AST_NODE_TYPE_ALLOWLIST = [ "Expr", "Load", "Str", "Num", "BoolOp", "Compare", "And", "Eq", "NotEq", "Or", "GtE", "LtE", "Lt", "Gt", "BinOp", "Add", "Div", "Sub", "Mult", "Mod", "Pow", "LShi...
a130c9087e841d58c98d29e695d93aca96cb78949cee3d1f086a93f72464e758
Python
4,805
156
from __future__ import annotations import dataclasses from typing import TYPE_CHECKING import numpy as np from loguru import logger from numpy.typing import NDArray from .._shape import Shape from ._geometry import round_bbox_to_int from ._osam_session import get_osam_session from ._shape_builders import Detection f...
c4bf5d895ce4bf46c5fbd66c2480a83ebcb348b4b885a1b8dc1daaf94ee3a198
Python
4,805
142
from typing import Union import torch import torch.distributed as dist from torch import Tensor from lightly.utils.dist import gather class TiCoLoss(torch.nn.Module): """Implementation of the Tico Loss from Tico[0] paper. This implementation takes inspiration from the code published by sayannag using L...
0eb2d917e53ac1025afe7451166ec508b3e37404a8d9c22d1c197d74e53ce3ee
Python
4,806
178
""" Methods for managing angular metrics """ from __future__ import annotations import math import numpy as np __all__: list[str] = [ "wrap_angle_to_0", "angles_between_vectors", "angle_dif", "rotationMatrix", "rotate_points_around_point", ] def wrap_angle_to_0(angle: float, in_deg: bool = Fal...
d063ce3b7a09b2c44f2805b6812062e0337d3852d82489a9046fc8b48559c17c
Python
4,806
128
"""Hand-pinned independent facts for the ``tests/golden/`` file suite. b9-opus R75-2: each ``tests/golden/*.json`` file is regenerated THROUGH torchlens, so its consuming test detects CHANGE, not correctness. These pins read the committed golden FILES as plain JSON and assert facts derived from first principles — the ...
2d7446197cc4b25aa1f61b00064162336b4aa4c3a41b363a0f54bdedda8786ae
Python
4,807
177
import os import tqdm.auto as tqdm import numpy as np import torch.nn as nn from permacache import permacache, drop_if_equal, stable_hash from modular_splicing.evaluation.evaluation_criterion import DefaultEvaluationCriterion from modular_splicing.utils.construct import construct from modular_splicing.evaluation.ru...
a1f3d2ac215e0473f082318396082fce3e5181ce6eba97d7d14f7ef4a4133012
Python
4,807
113
import sys import os import pandas as pd import numpy as np from nilearn import image from nilearn.masking import apply_mask # input/output paths fmri_prep = sys.argv[1] ROIs_dir = sys.argv[2] first_input = sys.argv[3] # contrast files location roi_out = sys.argv[4] # fixed effect output location # List of Subjects ...
2d6cd749990833d0bc44f419cca93d0ab1c80f0de228467a75a6bba01b88fb03
Python
4,809
94
import time import logging from svim.SVIM_intra import analyze_alignment_indel from svim.SVIM_inter import analyze_read_segments from svim.SVIM_COLLECT import retrieve_other_alignments def span_position_distance(candidate, signature, position_distance_normalizer): if candidate.type == "INS" or candidate.type == ...
ada72905c5315e45e6d00d817d92e2502d7a144fdc972ec2323b14c8503065ac
Python
4,809
140
""" Tractor module for SMOT """ # pylint: disable=arguments-differ from abc import ABC, abstractmethod import numpy as np import mxnet as mx from .utils import timeit from .general_detector import GeneralDetector class BaseAnchorBasedTracktor(ABC): """ BaseAnchorBasedTracktor """ @abstractmethod ...
ba6203c3926ac38bb9984348c325c1bad13daa0429a88bbf557e13aabd4caa76
Python
4,809
126
""" Measures the model activations for a set of sounds. Uses the layers specified in the build_network.py script. Set up to measure activations for the set of sounds used in Norman-Haignere et al. 2015. Please cite the assciated paper if you use these sounds. @article{norman2015distinct, title={Distinct cortic...
1b6239cb872b0c3ab6ccdc55f156bb4f8d26d9221e4f5b7a3e46a3b178bcd771
Python
4,810
124
"""Vizmech wave-2 item 13: one compact legend table in a dedicated rank (D28). The historical legend was six disconnected nodes dot packed BESIDE the model (366 -> 1048 pt page width, 2.86x, zero collisions -- the two-oracles worked example). Pins here: - the role legend renders as ONE plaintext HTML-table node, plac...
1e3d6939ee18bc196f9a29858186bf5084041e1f4d2a8fb0a4091f902258d519
Python
4,810
153
import re import numpy as np from rdkit import Chem from rdkit.Chem import rdchem from rdkit import RDLogger RDLogger.DisableLog('rdApp.info') from tqdm import tqdm def islower(self, s): lowerReg = re.compile(r'^[a-z]+$') return lowerReg.match(s) is not None def isupper(self, s): upperReg = re.compile(r'...
22543fb0e34174754e68622381be0834b773f693166ce0f244e477f8aaa3b443
Python
4,811
139
# This example requires the following dependencies to be installed: # pip install "lightly[timm]" # Note: The model and training settings do not follow the reference settings # from the paper. The settings are chosen such that the example can easily be # run on a small dataset with a single GPU. import pytorch_lightni...
43287de633fbff2a77a6f752e2d5bda4418609ff3c43178e4c220d4ba77d1c24
Python
4,812
100
import os import argparse from gluoncv.torch import model_zoo from gluoncv.torch.engine.config import get_cfg_defaults from gluoncv.torch.utils.model_utils import download from gluoncv.torch.utils.visualizer import ColorMode, Visualizer from gluoncv.torch.data.registry.catalog import MetadataCatalog from PIL import Ima...
fce729f57442d4e89421b0d3e3e98d769028be17dc1cc27a918f642cf4939b6c
Python
4,814
126
# Copyright 2022 Deepfold Team # 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 applicable law or agreed to in writing,...
5448866b1549ef5b5d22d2ee67134d7cf41e4c034bc2b9d7382f43b308955233
Python
4,815
115
""" Network Simulations =================== `RectiPy` provides basic support for numerical simulations of network dynamics. Neuron models of the RNN layer are governed by differential equation systems of the form .. math:: \\dot y = F(y, \\theta, t) With state-vector :math:`y`, parameter vector :math`\\theta`, ...