sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
a061047cd55391f176de3ed143db2f65331a8f79b21177de30d283f25cd42065 | Python | 4,375 | 177 | # -*- coding: utf-8 -*-
import sys
import os
import re
from sphinx.locale import _
from pycobi import __version__ as version
# Prefer to use the version of the theme in this repo
# and not the installed version of the theme.
sys.path.insert(0, os.path.abspath('../../'))
sys.path.append(os.path.abspath('sphinxext'))
... |
a5fc45a74672985208f74cfd5dd87a2b092415f2de1292be3012e489a59e0f6d | Python | 4,375 | 144 | """Append rerun state semantics regression tests."""
from __future__ import annotations
from pathlib import Path
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.intervention.errors import AppendBatchDependenceError, ControlFlowDivergenceWarning
from torchlens.io import load_int... |
b5033654a818f5a9de714905a3d372b5f4c9340a6291fc4794355173c55ffa48 | Python | 4,375 | 112 | """
Contains implementations for authentication and authorization against an
OpenID Connect (OIDC) Identity Provider (IdP).
This package follows "authorization code flow" authentication protocol to authenticate
Galaxy users against third-party identity providers.
Additionally, this package implements functionalist's ... |
f884a640dd1254e9274688458f46a2e6fd6ae35e199e0f0aafc10b939a780a03 | Python | 4,375 | 105 | import pathlib
import os
import shutil
# Local dependencies
import callbacks
import model_builder
import data_generator
import basics
import srgan
def determine_training_strategy(model, output_dir):
print('=== Determining Training Strategy -----------------------------------')
if not os.path.exists(output_di... |
6898069a4604a9298e7da234bc8900e0a93b92927a054d2acf3749a363d324d8 | Python | 4,376 | 150 | import json
import logging
import os
import re
import time
import pytest
from celery.contrib.pytest import celery_app, celery_session_app, celery_session_worker
from celery.contrib.testing.manager import Manager
from celery.exceptions import TimeoutError
from t.integration.tasks import get_redis_connection
# we have... |
da6ed06863182ad4d40f41a3b914228edeb412bb8813213b5176664246823486 | Python | 4,376 | 126 | """ MLP module w/ dropout and configurable activation layer
Hacked together by / Copyright 2020 Ross Wightman
"""
from torch import nn as nn
from .helpers import to_2tuple
class Mlp(nn.Module):
""" MLP as used in Vision Transformer, MLP-Mixer and related networks
"""
def __init__(self, in_features, hidd... |
d9205f76c978dad70724cf220a1c02b3d2d7a481a4c81df1cae1468fc7c4c27d | Python | 4,378 | 142 | #!/usr/bin/env python3
import argparse as ap
import pandas as pd
import xml.etree.ElementTree as ET
import sys
import os
import io
import json
import logging
import warnings
__version__ = "0.5.2"
def parse_params(__version__):
p = ap.ArgumentParser(
prog=sys.argv[0], description=f"Omics Pathway Viewer (... |
e8c6772d6756049f5e06bf6d713cae64a2a8aa091dc941d53faa4476efaeaa33 | Python | 4,378 | 99 | import sys
import os
from robustness.datasets import ImageNet
from robustness import train
from cox.utils import Parameters
from cox import store
from robustness import model_utils, datasets, train, defaults
import torch as ch
import numpy as np
import argparse
import importlib.util
def run_word_in_noise_natural_... |
9b336a941cf48a52c7abdf8f0ae5c57c16807e623a88d2a410de971770cd2df1 | Python | 4,380 | 164 | # --- 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 Pad(_BaseLayoutHierarchyType):
_parent_path_str = "layout.title"
_path_... |
b7fba3e3ac350c08e28bde7105c8aa08e1557ffa3c10ca541f0231dc1fb82140 | Python | 4,380 | 126 | """Vizmech wave-2 item 17: backward-view polish (D30).
Pins:
- uniform constant rows are suppressed: ``grad N/A`` on every node (the
memo's x36), ``order 1`` when no node exceeds order 1, ``bwd 1`` on
single-pass captures -- ink, not information;
- a mixed render KEEPS its rows (order rows return the moment a seco... |
73adaca40e7c2b4657b51f7cee1d16a9b7fe909b954235194e699961d7983637 | Python | 4,381 | 125 | """GitHub repository file source plugin using fsspec.
Each instance exposes a single repository (at a branch or commit) for browsing and download,
and optionally for upload: writes commit the uploaded file to the branch through the GitHub
Contents API with an automatic commit message. Users who need several repositori... |
9a6539d5c9b0d170612ed11115be111b1094170d5ce551fd8eb6bb5d38a65600 | Python | 4,381 | 158 | __author__ = "quentin"
class BaseIntVariable(int):
"""
Template class for defining arbitrary variable types.
Each class derived from this one should at least define the three following attributes:
* `sql_data_type`, The MySQL data type. This allows to use minimal space to save data points.
* `hea... |
d59f513112abf174e1ab578031e789d4b6908673118aadf11896dc8affa2f3c8 | Python | 4,381 | 117 | import os
from typing import (
NamedTuple,
)
from galaxy.datatypes import (
data,
sniff,
)
from galaxy.util.checkers import is_single_file_zip
class UploadProblemException(Exception):
pass
class HandleUploadResponse(NamedTuple):
stdout: str | None
ext: str
datatype: data.Data
is_bin... |
14b3a4ae48ada289e0f39250f1af7cc82c8491cb8c943da37f7a6711b8244f59 | Python | 4,383 | 145 | # Copyright 2023 DeepMind Technologies Limited
#
# 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 agree... |
2ce06cf1502d4282d6076175799e6e027ecbc2900406b37484b7529295323537 | Python | 4,383 | 133 | #!/bin/python3
import matplotlib.pyplot as plt
import torch
import numpy as np
from torch.utils.data import DataLoader
from torch import nn
from torch import optim
from NNucleate.dataset import GNNDataset
from NNucleate.models import GNNCV_mult
from NNucleate.training import train_gnn_unified, test_gnn_unified, evalu... |
437e5a8b81d65fbef9b7028c6dd83b5a33eb6f203af80cb46c4e3b954defc422 | Python | 4,383 | 118 | """AUD-CODE 4.3 regression: the admitted-meta forward's scoped torch swaps.
(a) The W1-AC null-autocast shim replaced ``torch.autocast`` (a class) with
a FUNCTION for the duration of an admitted forward, so ``isinstance(ctx,
torch.autocast)`` / ``inspect.isclass`` / decorator use broke inside the
scope. The shim is no... |
6834d9dc7709b58550055f07c46ec58f13b5a4d30a5a97b0a64c1199c5cf578e | Python | 4,383 | 130 | import logging
from galaxy.files.models import (
AnyRemoteEntry,
FilesSourceRuntimeContext,
RemoteDirectory,
)
from galaxy.files.sources._fsspec import (
CacheOptionsDictType,
FsspecBaseFileSourceConfiguration,
FsspecBaseFileSourceTemplateConfiguration,
FsspecFilesSource,
)
from galaxy.util... |
6eb93e575e041c0be90848968bf2e11d2f6f652249bc4d50f03fe6112cd535df | Python | 4,383 | 114 | from __future__ import annotations
import logging
import threading
import time
from collections import deque
from grpc import RpcError
from bream4.device_interfaces.devices.base_device import BaseDeviceInterface
from bream4.toolkit.procedure_components.data_extraction.read_statistics import get_channel_read_classifi... |
55d383e8f4f902e43c8527312a4188549b9c3ce95ef4c0076fc530ae2298902a | Python | 4,385 | 149 | import keras # isort: skip, keep it on top for torch test
import sys
import numpy as np
import tf_keras
from keras.src.backend import SUPPORTS_GRADIENT
keras.backend.set_image_data_format("channels_last")
tf_keras.backend.set_image_data_format("channels_last")
NUM_CLASSES = 10
BATCH_SIZE = 32
EPOCHS = 1
def bui... |
5bea144d3ff3eec1ffa4e4083618dfb815c70b7fb647a8778dc28c0c145ceb2e | Python | 4,385 | 138 | # !/usr/bin/env python
"""
Insert note tag into the ncbi tbl file
"""
import argparse
import copy
import os
import shutil
import tempfile
tbl_file = "STAFG.tbl"
discrep_file = "discrep.report"
def test():
import filecmp
tmp = tempfile.NamedTemporaryFile(delete=False)
main("./tests/STAFG.tbl", "./t... |
ee3280731d0993a3a340ef27e9e795fef8b4360be5940f625b8c0a56a5122b35 | Python | 4,386 | 122 | #!/usr/bin/env python
import argparse
import json
from cp_common_functions import (get_json_value,
get_pipeline_lines,
get_total_number_of_modules,
INDENTATION, update_module_count,
... |
dbe3be6ff9cd5c573973876a1b2152af12f6e4621bb03a1b17f90128a8d5f945 | Python | 4,387 | 101 | """Option receipt oracles (compo row 0.5): requested / effective / explicit / reason.
The receipt is M3's generic oracle substrate: effective-only reporting would
bless silently-discarded options (SG#18/19), so every public field carries
its requested value, effective value, explicitness, and a machine-readable
reason... |
d93724c6bf5665b45b38d78813b46d510ab8f9635aa08e37c5c6c07122eb0a10 | Python | 4,388 | 124 | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 14 15:01:41 2023
@author: longzheng
"""
from ECCdataset import Ecc_DataSet
from spektral.data import BatchLoader
from spektral.layers import ECCConv, GlobalSumPool, GraphMasking
from tensorflow.keras.callbacks import ReduceLROnPlateau
import numpy as np
import tensorflow... |
d245a4636463f333d81810c36a7c46805ee2e22577d994ccc88b9cc1281b6688 | Python | 4,390 | 135 | from __future__ import annotations
from concurrent.futures import ThreadPoolExecutor
from threading import Event
from unittest.mock import Mock
import pytest
from pytest_celery import CeleryTestSetup, CeleryTestWorker, CeleryWorkerCluster
from celery import Celery
from celery.app.base import set_default_app
from cel... |
b223cdf36887f3f8de93d18caf8bab683b97e41cc9fea313f4119f75e427acf9 | Python | 4,391 | 104 | from keras.src import backend
from keras.src.api_export import keras_export
from keras.src.layers.attention.attention import Attention
@keras_export("keras.layers.AdditiveAttention")
class AdditiveAttention(Attention):
"""Additive attention layer, a.k.a. Bahdanau-style attention.
Inputs are a list with 2 or ... |
817ee7614c120a2fe6fef4940785938fac04c1592df03b393afa10ab26d29cec | Python | 4,392 | 126 | import os
import numpy as np
import pandas as pd
from rdkit.Chem.rdchem import Conformer
from typing import Tuple
from tqdm import tqdm
from .conf_ensemble_dataset import ConfEnsembleDataset
from bioconfpred.data.split.data_split import DataSplit
class RDKitMolDataset(ConfEnsembleDataset):
def __init__(self,... |
d67514988fc61cbcfacddaa42230f09d15a11c1bd6d7cac4bf50273dbf206b32 | Python | 4,392 | 129 | """Data stores to store data related information.
Notes on data objects:
- these data objects are NamedTuples, immutable data types with attribute labels
- the namedtuples are wrapped as classes (they are still immutable when doing this)
- wrapping in objects helps to be able to render well formed documentation for th... |
2ca8f2fa80a5e2cebc37e2d6778fb0efdc54dbc7c7bdbef5b7e56680521d35e7 | Python | 4,393 | 103 | import torch
import numpy as np
import os
from inference.density import *
from src.MODEL import *
class PES(torch.nn.Module):
def __init__(self,nlinked=1):
super(PES, self).__init__()
#========================set the global variable for using the exec=================
global nblock, nl, dro... |
d3c9f9d64c82e718e044cc8d37897ac87121b537a83edc699a11f284547d6897 | Python | 4,393 | 82 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2022 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
8af369903897e06f10c58abdde648043a19dfc8610a4412a44d95ec94f991018 | Python | 4,394 | 117 | """grind-r5 b7 R21 / P4: persisted keys must be address-free and seed-stable.
``_append_arg_hash``'s tail stringified default-repr objects (a memory
address) into ``equivalence_class``, so cross-process keys diverged for any
op holding an object arg (``torch.randn(..., generator=g)``), colliding for
distinct objects a... |
c190eda5c1bb7b3cef3d05ba3d455f699651b6060420d4eb986452585fe92de9 | Python | 4,394 | 123 | # This example requires the following dependencies to be installed:
# pip install lightly
# 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_lightning as p... |
084c1c9950950e84472a657b56073c00332d227f99fdbe5cbf7ad17fbbb1ddeb | Python | 4,395 | 127 | from typing import Optional
import pytest
import torch
from pytest_mock import MockerFixture
from torch.nn import Parameter
from lightly.utils import dependency
if not dependency.torchvision_vit_available():
# We do not use pytest.importorskip on module level because it makes mypy unhappy.
pytest.skip(
... |
65fb214f125dd5b776e9857f4c276fca69227bfaccb20c6de15c36e9f9fe237e | Python | 4,395 | 131 | import numpy as np
import tqdm.auto as tqdm
from permacache import permacache, stable_hash
from modular_splicing.dataset.datafile_object import SpliceAIDatafile
from modular_splicing.utils.arrays import Sparse
from .cassette_exons import locate_cassette_exon
from modular_splicing.legacy.hash_model import hash_model
f... |
d0fd2dfaf065117f1df1847941ad029d276031b4c998e0056a5b8625c1ae78a6 | Python | 4,395 | 145 | #!/usr/bin/env python3
"""Build ``usa_emissions.json`` from the EPA eGRID data workbook.
Download the workbook from https://www.epa.gov/egrid/download-data, then run:
uv run --with openpyxl python codecarbon/data/private_infra/update_usa_emissions.py \\
egrid2023_data_rev2.xlsx --year 2023
The state rate... |
e0789ef67e818d569ae3e5b5e3c5150ba56b5ab271e145a5346b588ecaa3b0a5 | Python | 4,397 | 82 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2022 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
a253fda9fd435c668c4f37d85380810c1299ceb090d1d6a95272274a6a42e2be | Python | 4,398 | 78 | import time
import torch
from options.train_options import TrainOptions
from data import create_dataset
from models import create_model
from util.visualizer import Visualizer
if __name__ == '__main__':
opt = TrainOptions().parse() # get training options
dataset = create_dataset(opt) # create a dataset give... |
5d903ae514a9aec34393e77a0efaa4c6248a81eb1f1fb23eda8adb30f5a9d8ec | Python | 4,399 | 82 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
eb9dbbcee74614b25a1156e6536c66277414a3f3fca3aec3ab4cff4c26cdeed9 | Python | 4,399 | 82 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
f6316f02e8bc6653ecd91e396bf7cb980a91f15cf1f34ae8562a3fbbc7deb86a | Python | 4,399 | 155 | import numpy as np
try:
from skimage.measure import label
except ImportError:
print('Caught Import Error while importing some function from scipy or skimage. '
'Please use a newer version of gcc.')
def remove_small_connected_components(lb, min_vol, spacing=None):
'''
Parameters
--------... |
72bacfd4fa28cf459db4fe2a62e33cf469b52e51b4c670c8e7d3f7f2d3649eaf | Python | 4,400 | 178 | import numpy as np
from scipy.misc import logsumexp
# from sklearn.neighbors import KernelDensity
# from sklearn.grid_search import GridSearchCV
def shannon_entropy(p):
"""Calculates shannon entropy in bits.
Parameters
----------
p : np.array
array of probabilities
Returns
-------
... |
505a862da4668b784e73f24816f5e11b5f4384c5092b707f0bc1ffbcb7e01b8b | Python | 4,402 | 114 | """Keep tests/known_failures.py the single, accurate source of tracked xfails.
Two things can silently drift once a ledger exists: a row can go STALE (the
test it names was renamed, removed, or never existed under that id -- the
strict xfail would then just vanish, un-noticed, since pytest cannot resolve
it to anythin... |
591969723cab6840d675600ff86f04782e67d3f0e8b58fd85ad1f16d8298974b | Python | 4,402 | 142 | '''Trains a simple convnet on a custom dataset'''
from __future__ import print_function
from datetime import datetime
import keras
from keras.models import Sequential, Model, load_model
from keras.layers import Dense, Dropout, Flatten, Input, BatchNormalization,Activation
from keras.layers import Conv2D, MaxPooling2... |
bec99801b7243621cda1d80c59c0fe7876d6528ff22da3e4ce88de9b2888322f | Python | 4,402 | 107 | """Pin our aux-tensor cache keys to CuTe's own layout identity.
``get_aux_tensor_metadata`` reproduces CuTe's leading-dimension deduction from
torch metadata, because the launch path hands torch tensors straight to TVM-FFI
and reading ``__cache_key__`` would force a DLPack conversion on every call. A
DSL upgrade that ... |
cd1940f49040fc14eb8fc01fbba2ae640f191d0dc4e8a52ebd291ad7343b3b42 | Python | 4,402 | 107 | import torch
import torch.nn as nn
from torch_geometric.nn import GATv2Conv
MAX_LOGSTD = 10
class VariationalGNN(nn.Module):
"""
My adaption of the model from http://arxiv.org/abs/1912.03761
I rewrote to be used with standard layers from pytorch geometric. It's quite a bit faster.
"""
def __init... |
01782a8bdf17d6e6da20c4f4757a3867692299fcec7f0ec942415668567463b8 | Python | 4,403 | 110 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import sys
import textwrap as _textwrap
from .fix_small_exon_multiproc import run_multiprocess
from .version import VERSION
class CustomHelpFormatter(argparse.ArgumentDefaultsHelpFormatter):
def _format_action_invocation(self, action):
if not ... |
4594160decfb1446229780cead25e9b5b9b57c867c2e923c4e828b7d639b46e5 | Python | 4,403 | 122 | # LICENSE
#
# _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._
#
# BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License");
#
# - you may not use this software except in compl... |
e4862e1ef7bc92902539f7ff68da797796f6b3bc511c6692cc4621eb18c07d4f | Python | 4,404 | 108 | """
BASIL GUI for Oxford ASL - Calibration options
Copyright (C) 2020 University of Oxford
"""
from .widgets import TabPage
class DistCorrTab(TabPage):
"""
Tab page containing distortion correction options
"""
# Distortion correction choices
FIELDMAP, CALIB_IMAGE = 0, 1
DISTCORR_CHOICES = ["... |
3787e7f0e41721b17d4f65340da223c8d937c50b1b14cb64ad767d0dcb964b69 | Python | 4,405 | 154 | from decimal import Decimal
import matplotlib.pyplot as plt
from anndata import AnnData
def transition_markers_plot(
adata: AnnData,
trajectory: str,
top_genes: int = 10,
dpi: int = 150,
output: str | None = None,
name: str | None = None,
) -> AnnData | None:
"""\
Plot transition mark... |
bf5a420768f0783c3a4593ca6bf7ed6ddeb3725625254b3c85243146817baa6d | Python | 4,405 | 132 | import pandas as pd
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import pylab as pl
import seaborn as sns
matplotlib.rcParams['pdf.fonttype'] = 42
sns.set(
style='ticks',
font='Helvetica',
font_scale=1,
rc={
'axes.labelsize': 7,
'axes.titlesize': 7,
'xti... |
da5f478ae6d38c5dc527e81144c411153f5d9648e8732e07a280ff9346289d21 | Python | 4,406 | 126 | import logging
from galaxy.exceptions import ConfigurationError
from galaxy.util.resources import Traversable
from galaxy.util.yaml_util import ordered_load
log = logging.getLogger(__name__)
OPTION_DEFAULTS = {
"type": "str",
"unknown_option": False,
"default": None,
"desc": None,
}
UNKNOWN_OPTION =... |
6efa3f8988b828c7d8c2122e32acf501521e246c6536715cd38ab49e39c05742 | Python | 4,407 | 96 | """3. Getting Started with Pre-trained I3D Models on Kinetcis400
================================================================
`Kinetics400 <https://deepmind.com/research/open-source/kinetics>`_ is an action recognition dataset
of realistic action videos, collected from YouTube. With 306,245 short trimmed videos
f... |
c6673f303bd377efbb4751cdf55a390321ac81d4d36c0fa374e4c23c6d550c9f | Python | 4,407 | 136 | import logging
import socket
import time
from threading import Thread
from autouri import AutoURI
logger = logging.getLogger(__name__)
class ServerHeartbeatTimeoutError(Exception):
pass
class ServerHeartbeat:
DEFAULT_SERVER_HEARTBEAT_FILE = '~/.caper/default_server_heartbeat'
DEFAULT_HEARTBEAT_TIMEOUT... |
eb2973383003c686ab64441ae1a88138c21f2a767ef3339165c8e74558b2dee7 | Python | 4,407 | 149 | from __future__ import annotations
import threading
from typing import Generic, TypeVar
from typing_extensions import TypeAlias
K = TypeVar("K")
V = TypeVar("V")
T = TypeVar("T")
class StateMap(Generic[K, V]):
"""This is a class used for maintaining a map of up to date items
in a thread safe way.
Pop_... |
00d9d2c0e9e0675465dc209966fb5ca08d344a094ba4dd67bc63f9a45a6a78eb | Python | 4,408 | 125 | import pandas as pd
from rdkit import Chem
from rdkit.Chem import AllChem, Descriptors
from tqdm import tqdm
import pickle
import torch
import os
import random
import numpy as np
def getProp(mol):
mw = Descriptors.MolWt(mol)
logp = Descriptors.MolLogP(mol)
# print('mw:', mw)
# print('logp... |
34d6e12cc2311b58009d6516bebddc25d832f5cd0a69ea6c5862282e7dedd9d3 | Python | 4,408 | 82 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
b0588df9f7c5854dab3350bcf6da2f09aba93e3e5f869cbf64a105257653b58a | Python | 4,408 | 154 | """Celery Signals.
This module defines the signals (Observer pattern) sent by
both workers and clients.
Functions can be connected to these signals, and connected
functions are called whenever a signal is called.
.. seealso::
:ref:`signals` for more information.
"""
from .utils.dispatch import Signal
__all__ ... |
bef5395c4d7ab2fedd432ddf582db3507e8c9a93d10b2f0c29dcff15612d593c | Python | 4,408 | 82 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
c60788cdbf203a467308213e2e21a75dd0cf25651073aa9839f33b6ce168aa2f | Python | 4,408 | 126 | #!/usr/bin/env python
"""Defacing utility for MRI images."""
import argparse
from nibabel import load, Nifti1Image
from pkg_resources import require
import pydeface.utils as pdu
import sys
import shutil
import numpy as np
def is_interactive():
"""Return True if all in/outs are tty"""
# TODO: check on windows... |
ffd2e07b971629aa372378f0cf75d8b00f8b84c8d5c2bd3cb0d32e093211a772 | Python | 4,408 | 82 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
93cfaf3f74cb71e2719d2da13c82e9608b22d8a6f97ed4f008c82e8d98d90354 | Python | 4,409 | 127 | """Private MLX payload codec tests."""
from __future__ import annotations
from typing import Any
import numpy as np
import pytest
from torchlens._io.payload_codec import get_payload_codec
from torchlens._io.tensor_policy import FailReason, Ok
from torchlens.backends import BackendRuntimeCompatibilityError
mlx = py... |
e55b344153d3f6d07633d2feaba5b48a5fb7db7d67fa3f75f8414bacf05f9372 | Python | 4,411 | 129 | # coding=utf-8
# Copyright 2025 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... |
31634c72c088eff86c762a6de0ad7fb6882f2e2dd95e0c1705dde65fff9366f8 | Python | 4,412 | 82 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
6b3333ca0f77d5cee26e6c28609d4497be928f7ff7184c89b5ce4ae896db9b72 | Python | 4,412 | 160 | import pytest
import numpy as np
from numpy.testing import assert_array_almost_equal
from pyriemann.utils.base import (
expm,
invsqrtm,
logm,
powm,
sqrtm,
nearest_sym_pos_def,
)
from pyriemann.utils.mean import mean_riemann
from pyriemann.utils.test import is_pos_def, is_sym_pos_def
n_channel... |
b8299cd2bb4189f1756518fa505137dc7d879fac3082e1acb78cbcceb5dad747 | Python | 4,412 | 82 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
15725d8cb5469812e8545032f985d5afc2fa8c517a9a21d535ed54ebe208c8d7 | Python | 4,413 | 129 | # coding=utf-8
# Copyright 2025 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... |
a62b5cfd1a2c158dca2aaeb10400fd9f8b9281cb7fd17b4494225865b118bff1 | Python | 4,414 | 133 | """Shared fixture builders for the W051-AGENT regression suites (no tests here).
Every builder is DETERMINISTIC (explicit seeds, eval mode). ``MiniTransformer``
is the REALISTIC fixture AUD-CODE 4.9 asked for: the registry/dump/query
fixtures were all <= 9 ops, so paging, backstop, and fold behaviour past a
handful of... |
f2e6ddccd60862c1eb7a7a860e79aee7547e26ab78f9d444f82d415eabe06bb5 | Python | 4,415 | 103 | """Lazy capability latches: registry completeness, restore, and un-poisoning.
The ``_torch_compat`` lazy ``HAS_*`` probes latch on first use, which makes
them the one capability class a test can POISON: a probe fired while
``sys.modules`` is stubbed latches the wrong verdict for the whole process
(the recorded ``b7fe9... |
65569329f6d08058c4feef279bc71ea08a0263e59277d43e6b6afa2402ba9976 | Python | 4,416 | 123 | """grind-p3 T11.6: hybrid registered containers keep one kind vocabulary.
The runtime structure-witness kind (``_container_kind``) checked the generic
kinds (dataclass / namedtuple / tuple / list / dict) BEFORE the registered
lookup, while the capture-side ``ContainerSpec`` builder checks the
registration FIRST. A HYB... |
72f22d986939ff63cc74ecbaf233bdd76841aa3c6e6a6e8c69a3eba42feb7b55 | Python | 4,418 | 128 | """Tools for KITTI Dataset
Code partially borrowed from
https://github.com/nianticlabs/monodepth2/blob/master/kitti_utils.py
"""
from __future__ import absolute_import, division, print_function
import os
from collections import Counter
import numpy as np
import mxnet as mx
def load_velodyne_points(filename):
""... |
b9c96c6037c2d5ebce2cc927496d359518df9f2b56acb7bbcfb6e46130417502 | Python | 4,418 | 123 | from flask_restplus import Namespace, Resource, reqparse
from flask_login import login_required, current_user
from database import AnnotationModel
from ..util import query_util
import datetime
import logging
logger = logging.getLogger('gunicorn.error')
api = Namespace('annotation', description='Annotation related op... |
54c2caf9fd66135b1dceb96191b7d2f0955b17ed329f6ecee539db2675206c59 | Python | 4,419 | 133 | import fire
import numpy as np
from permacache import permacache, stable_hash
from working.synthetic_data.codon_table import CodonTable
from working.synthetic_data.linear_approx_mcmc import (
linear_approx_mcmc,
multiple_try_linear_approx_mcmc,
)
from working.synthetic_data.splicing_length_pattern_distributio... |
8e92b90e9f4808b866760c620d241aeb1c5cc02809653aba64db65449b549490 | Python | 4,419 | 274 | #!/usr/bin/env python
'''Generate models for affinity predictions'''
# variables:
# GAP(0)
# PENALTY (0)
# HUBER (false)
# DELTA (0)
# RANKLOSS (0)
basemodel = '''layer {
name: "data"
type: "MolGridData"
top: "data"
top: "label"
top: "affinity"
include {
phase: TEST
}
molgrid_data_param {
s... |
9cfc499262a3be5526f64ecd66bc8ef014c4f65444d6e66d864b608f79f9f3c0 | Python | 4,419 | 151 | #!/usr/bin/env python3
"""
strip_asm.py - Cleanup ASM output for the specified file
"""
from argparse import ArgumentParser
import sys
import os
import re
def find_used_labels(asm):
found = set()
label_re = re.compile("\s*j[a-z]+\s+\.L([a-zA-Z0-9][a-zA-Z0-9_]*)")
for l in asm.splitlines():
m = la... |
132706f20d3222c7f8cf9e456e65c69fee6d8fb5dc9aaf4add2662aeabe60c3f | Python | 4,420 | 126 | import random
from pathlib import Path
from typing import List, Dict, Union, Optional, Callable
import nibabel as nib
import numpy as np
import torch
from torch.utils.data import Dataset
from Transform.src import Noiser
class CESTDataset(Dataset):
"""A Dataset class for handling CEST MRI data."""
def __ini... |
8a22c73a6a52c0fa3b98642f14c93e80af34a6df19c048d48502e73767858717 | Python | 4,421 | 135 | """
Methods for extracting exons from the test data.
"""
import tqdm.auto as tqdm
import numpy as np
from modular_splicing.data_for_experiments.standardized_sample import (
standardized_sample,
)
from modular_splicing.evaluation.predict_splicing import predict_splicepoints_cached
from .data import dataset_for_spe... |
c31a7a2eeafcaf32fb32cdd31263db404739a3725e048c57dabd07494e306258 | Python | 4,421 | 116 | """Red-capability plants for the floor script's PASSED modes (memo A6/D4).
``--min-passed`` and ``--passed-ids`` exist because ``executed = total -
skipped`` counts failures as executed -- unsound on any non-blocking leg.
Every capability here is proven in BOTH directions: green on an honest
junit, red on each planted... |
b165304bc7e81e938449e1883ac584545f9aaf9cfa476692c5497688204a5231 | Python | 4,422 | 133 | # ---
# jupyter:
# jupytext:
# formats: ipynb,py:light
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.14.5
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
# # Prerequi... |
23a1c2984511e052787f2677ed9b0339a8bf26724f649293f209ffe6f7a2367a | Python | 4,423 | 96 | #----------------fireann interface is for FIREANN package-------------------------
import numpy as np
import os
import torch
import re
#from gpu_sel import *
from ase.data import chemical_symbols, atomic_numbers
from ase.units import Bohr
from ase.stress import full_3x3_to_voigt_6_stress
from ase.calculators.calculat... |
8d938ed1a752599126bf2531dc3e1d7b7011822fc3e29ea826736ce72114e30b | Python | 4,423 | 121 | __author__ = 'quentin'
import urllib.request, urllib.error, urllib.parse
import logging
import optparse
import traceback
import subprocess
import json
from ethoscope_node.utils.backups_helpers import GenericBackupWrapper
from ethoscope_node.utils.configuration import EthoscopeConfiguration
class WGetERROR(Exception)... |
6d5fd91aec20b709241fc8408e3a2bedf2ee03445b1cc83969a24d690c7eb9c5 | Python | 4,424 | 145 | import re
from statistics import mean
import pysam
import argparse
import pandas as pd
import numpy as np
from collections import defaultdict
def split_cs_string(cs_string):
return list(
zip(
re.sub('[0-9a-z]', ' ', cs_string).split(),
re.sub('[:*\-+~]', ' ', cs_string).... |
72b6ac5a1b0c7012828c68c722970cf72f142abfeb67e12a837b64f8695a4597 | Python | 4,424 | 116 | #!/home/ubuntu/miniconda2/bin/python
from __future__ import print_function
import glob, os, gc, sys
import os.path
import csv
import numpy as np
np.random.seed(1337) # for reproducibility
from time import time
from subprocess import (call, Popen, PIPE)
from itertools import product
from IPython.display import display... |
dea26163b6eff47e55e20d721b8c37620a66e9a83bfb7810a049e734e73bb713 | Python | 4,425 | 112 | """Persistence honesty: streamed bundles enter settlement.
WT1 A-IV item 18 (lane A08): ``tl.trace(storage=tl.to_disk(...))`` finalized
AND published its bundle at postprocess step 18 -- BEFORE the capture settled
-- so (a) a live COMPLETE capture's artifact carried no outcome attestation
and loaded UNATTESTED, and (b... |
b27a69dc9cabc2b9be10900c687541e3e8869efc3033176be95eebb822347bc4 | Python | 4,426 | 179 | # -*- coding: utf-8 -*-
import sys
import os
import re
from sphinx.locale import _
from rectipy import __version__ as version
# Prefer to use the version of the theme in this repo
# and not the installed version of the theme.
sys.path.insert(0, os.path.abspath('../../'))
sys.path.append(os.path.abspath('sphinxext'))... |
ec2e62f08626e336f898031d100a0aea436f9d90d51aea001d2c68947f65b177 | Python | 4,427 | 133 | """Tests for memoized ``TargetSpec.freeze`` and dedup-scan equivalence."""
from __future__ import annotations
import pickle
import torch
import torchlens as tl
from torchlens.intervention.types import (
FrozenTargetSpec,
InterventionSpec,
TargetSpec,
TensorSliceSpec,
)
def test_freeze_cache_hit_is... |
d3fa1701f6facfcd47b63953e1dc36aeb147d6ce3877792bf035d5865e795859 | Python | 4,429 | 202 | # 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... |
18f2e7a20dd80db821bfe71cbca50926dc28a2a99732326c2b2a7de54d5708f3 | Python | 4,430 | 124 | import numpy as np
import pytest
from keras.src import backend
from keras.src import ops
from keras.src import testing
from keras.src.layers import Dense
from keras.src.layers import Embedding
from keras.src.layers import Input
from keras.src.models import Sequential
from keras.src.optimizers.muon import Muon
class ... |
5c343b5f81c0e5903306120565ec3305e7b6b00f5227c3858eb8a47bfb459520 | Python | 4,431 | 82 | # This file contains a pipeline specification. The pipeline is defined as a subclass of TRFExperiment, and adds information about the specific paradigm and data. TRFExperiment is a subclass of eelbrain.MneExperiment, which is documented extensively on the Eelbrain website.
from eelbrain.pipeline import *
from trftools.... |
b8e9524cda1ea817db27885b0f5649fa5e1df88e8bd9390831c5d82aaf104df3 | Python | 4,431 | 87 | import os
import sys
import erdantic as erd
sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, os.pardir, "lib")))
from galaxy.files.templates.models import (
AzureFileSourceConfiguration,
AzureFileSourceTemplateConfiguration,
DropboxFileSourceConfiguration,
... |
864f1458c75fbdd1fd167a009f37a78f75ff77d765b5147242a77f5cd48ea974 | Python | 4,432 | 132 | # 05/19/2023 Fengyao Yan
# train single tissue classification model
# plot ROC curve
import pickle
import matplotlib
import numpy as np
import pandas as pd
import tensorflow as tf
import matplotlib.pyplot as plt
from sklearn.utils import shuffle
from imblearn.over_sampling import SMOTE
from sklearn.preprocessing im... |
82598ca8a2cb440a89fcb6a512f5f9c448556e138612f3358ac3d34b3fc514c8 | Python | 4,433 | 148 | """DGMR: Deep Generative Model of Radar.
Paper: "Skillful precipitation nowcasting using deep generative models of
radar", Ravuri et al., Nature 2021.
The compact reconstruction keeps DGMR's load-bearing structure: a context
conditioning stack, a latent conditioning stack, a recurrent ConvGRU generator,
and separate ... |
be5a759ed7556613f32c1e1c0663f9111a64988695eab60ce767846825ac811d | Python | 4,433 | 175 | """
Plotting facade providing lazy access to submodules to keep imports lightweight.
Public usage remains the same: symbols are available under
`larvaworld.lib.plot.<submodule>` and are loaded on first access.
"""
from __future__ import annotations
__displayname__ = "Plotting"
__all__: list[str] = [
"util",
... |
d8d1fd7238ebd898bd9c8ea3f0e27dfcdda705d8834c462aa498c21ad2950ad7 | Python | 4,433 | 109 | 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 ... |
dbbb343b79bafb157636ae84e0b5ee173f05aff0d644162506290e793a367878 | Python | 4,433 | 118 | #install library
!pip install tensorflow-addons==0.16.1
import tensorflow as tf
import os
import glob
import shutil
import matplotlib.pyplot as plt
import random
import numpy as np
import cv2
import tensorflow_addons as tfa
from keras import regularizers
from google.colab import drive
from sklearn.metrics import ... |
1c072baef7f6a98e7028c74cb3e958ab703d227a8f24b242fc530dfbaa1c15bf | Python | 4,434 | 82 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
c47c21408f642a3aacaff8494d77de12bd9603cac952c968c7ee169160a1850a | Python | 4,434 | 82 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
c48cb33280fbab0b3330dbea285d3a2270c89675421d3798a05e9c18fb6e5be3 | Python | 4,434 | 152 | import matplotlib.pyplot as plt
from decimal import Decimal
from anndata import AnnData
from typing import Optional, Union
def transition_markers_plot(
adata: AnnData,
top_genes: int = 10,
trajectory: str = None,
dpi: int = 150,
output: str = None,
name: str = None,
) -> Optional[AnnData]:
... |
c8d648f4b8820befdb565ff14b81eb97e11cb8b58f25b4b925bc15a189c84045 | Python | 4,434 | 82 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
16056d7274e0ec2e245ed4dc3bb6b4d8e154f40e3749544f7bf040ce092fff10 | Python | 4,435 | 126 | import torch
from tqdm import tqdm
import csv
import pickle as pkl
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import find_peaks
from interpretability.utils import (
get_attentions_map_simple,
set_hook_to_get_attention_map,
load_sequences,
load_model_and_vocab,
)
@torch.no_gr... |
9367aa30dc8c6d4ec225533f04706394ab74072173e884d2113a92d6625af3d8 | Python | 4,436 | 109 | # Copyright (c) 2023, Tri Dao.
import math
import re
from collections import OrderedDict
import torch
import torch.nn.functional as F
from transformers import GPT2Config, GPTJConfig
def remap_state_dict_hf_gptj(state_dict, config):
def key_mapping_layers(key):
return re.sub(r"^transformer.h.", "transfor... |
0aaa9a5215b019bd012d9bb870225a4fd48c3f9bd1055e6309b78e2361bdc3e3 | Python | 4,437 | 119 | """
Unit tests for Video Helper utilities.
Tests video file indexing and management functionality.
"""
import os
import tempfile
import unittest
from unittest.mock import patch
from ethoscope_node.utils.video_helpers import list_local_video_files
class TestListLocalVideoFiles(unittest.TestCase):
"""Test suite ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.