sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
32e88ae587015c43d08aae9554b0d335f034b7ee96be4833eec143d18c90161f | Python | 4,664 | 93 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
4e4a1cd077590cfbe5580c91d4f787c2f75f5ca688bfafdfd88b3b01737f699e | Python | 4,664 | 133 | """IO functions for Slide-seq technology.
"""
from typing import NamedTuple, Optional
import numpy as np
import pandas as pd
from anndata import AnnData
from scipy.sparse import csr_matrix
from typing_extensions import Literal
from ..configuration import SKM
from ..logging import logger_manager as lm
from .utils impo... |
97cb649b91f67a96a56c2b2894befe37269daf89e7968f448c31d1941e2cda4e | Python | 4,665 | 133 | """F09 CP4: costreport items 18 + 22 -- the device-attribution docs wave
and the ladder generator's rung-name assertion.
D28: every python code block on docs/reference/device_attribution.md
executes in CI (this panel shipped a wrong emit_nvtx cite in its own
round 1 -- an untested docs page is a second source of truth... |
6cbd7466c8aa1924358b9482c3ce16e1aa65f567b624113aaee3ca940ccc3261 | Python | 4,667 | 119 | #!/usr/bin/env python3
"""
Dx BG — Feature ablation redo under proper per-fold
====================================================
Re-run §3.10 drop-one-out feature ablation under the proper per-fold
per-cohort-deployment pipeline. For each of the 15 features, drop it
from the pool and re-evaluate held-out figshare B... |
d362d4c54e2ed176bc6fb2b5a20b348b8e2b57491508991a89e76c14f668e743 | Python | 4,668 | 143 | import pytest
from rpy2 import robjects
from rpy2.robjects import packages
from rpy2.robjects import rl
try:
from rpy2.robjects import pandas2ri
cv_pandas2ri = robjects.default_converter + pandas2ri.converter
except ImportError:
cv_pandas2ri = None
try:
from rpy2.robjects.lib import ggplot2
has_g... |
5736fdfa225f288dfbd3e0ce4c2304a7783b463e637c1b3c3f70780c6f7baded | Python | 4,669 | 110 | import json
from uuid import uuid4
import pytest
from celery import chain, chord, group, signature
from celery.signals import before_task_publish
from t.integration.tasks import (ExpectedException, fail, get_redis_connection, identity, redis_echo, sum_and_record,
xsum)
class test_gr... |
c9e4784c7fc7608975b78a753e415c36e529190ac8774950a82a6e8f292d9198 | Python | 4,669 | 148 | from permacache import permacache, stable_hash
from modular_splicing.data_pipeline.spliceai_data_processing_pipeline import (
create_dataset_from_splice_table_no_sequence,
)
from modular_splicing.utils.arrays import Sparse
@permacache(
"dataset/alternative_dataset/get_alternative_dataset_2",
key_function... |
230a895939a4f11ccc804aeacef18856e9da6d09a743476ba6f5f9394ad83470 | Python | 4,671 | 112 | import torch
import numpy as np
from torch.utils.data import Dataset
import scipy.sparse
class scDataset(Dataset):
"""
"""
def __init__(self, sparse_mtrx, meta_data, label_type, scaling_type='max', gene_selection=None, subset=None, sparse=False):
"""
Args:
This is a custom data set ... |
e7a2dd954a6219605669d6a0ea9c01aa07e7acbf5d28d87098e6bfd209c6386d | Python | 4,673 | 133 | """
Implementation of "Attention is All You Need"
"""
import torch.nn as nn
import torch
from bioseq2seq.encoders.encoder import EncoderBase
from bioseq2seq.modules import MultiHeadedAttention
from bioseq2seq.modules.position_ffn import PositionwiseFeedForward
from bioseq2seq.utils.misc import sequence_mask
class Tr... |
a419ca8249061bc4cae187d526e5616dbfb4917db923e71900b786ab51b64746 | Python | 4,674 | 131 | import logging
import time
from ethoscope.hardware.interfaces.interfaces import SimpleSerialInterface
class LynxMotionInterface(SimpleSerialInterface):
_min_angle_pulse = (-90.0, 535.0)
_max_angle_pulse = (90.0, 2500.0)
_n_channels = 10
def __init__(self, port=115200, warmup=False, *args, **kwargs)... |
cc617f68a068cb5b374e8319f4f14cae43c123799bb17cbcd5bc01e91f66f5b5 | Python | 4,674 | 73 | """General-purpose training script for image-to-image translation.
This script works for various models (with option '--model': e.g., bicycle_gan, pix2pix, test) and
different datasets (with option '--dataset_mode': e.g., aligned, single).
You need to specify the dataset ('--dataroot'), experiment name ('--name'), and ... |
39cba42232494c1d62c92081aee46a6f97720529faebd3b07ee3c79f5e122b5a | Python | 4,675 | 139 | """Sphinx documentation plugin used to document tasks.
Introduction
============
Usage
-----
The Celery extension for Sphinx requires Sphinx 2.0 or later.
Add the extension to your :file:`docs/conf.py` configuration module:
.. code-block:: python
extensions = (...,
'celery.contrib.sphinx')
... |
616cde0ddd22ef282c628d73b5d1203596cf1461041dfe5c285719c37db96240 | Python | 4,675 | 128 | """
Mixins for Ratable model managers and serializers.
"""
import logging
from sqlalchemy import select
from sqlalchemy.sql.expression import func
from galaxy.model import ItemRatingAssociation
from . import base
log = logging.getLogger(__name__)
class RatableManagerMixin:
rating_assoc: type[ItemRatingAssocia... |
6fcfa334b4129339415f436cc33971f1365e330cdf3f1ff41789a97df6156c0b | Python | 4,675 | 102 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import tensorflow as tf
import tensorflow.keras as keras
from tensorflow.keras.layers import Reshape, Input, Flatten, concatenate, Dense, BatchNormalization ,Conv1D,Conv2D,Conv3D,MaxPool1D, MaxPool2D,MaxPool3D, GlobalMaxPool2D, Dropout
from tensorflow.keras.optimizers i... |
7e10f9fb1fc421b455a63021b68290489d6f93d54e58596ee8c5a3c9e4b0c57b | Python | 4,675 | 102 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import tensorflow as tf
import tensorflow.keras as keras
from tensorflow.keras.layers import Reshape, Input, Flatten, concatenate, Dense, BatchNormalization ,Conv1D,Conv2D,Conv3D,MaxPool1D, MaxPool2D,MaxPool3D, GlobalMaxPool2D, Dropout
from tensorflow.keras.optimizers i... |
976aa2e32b56d0c08687700b31b931c2e518d6a5145f070d69c16c5a6230a66c | Python | 4,675 | 102 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import tensorflow as tf
import tensorflow.keras as keras
from tensorflow.keras.layers import Reshape, Input, Flatten, concatenate, Dense, BatchNormalization ,Conv1D,Conv2D,Conv3D,MaxPool1D, MaxPool2D,MaxPool3D, GlobalMaxPool2D, Dropout
from tensorflow.keras.optimizers i... |
a29b9269ba50ce8d7d71fcebd7563a8bf5651ed0ba8496a04701b0a8aa904dc4 | Python | 4,675 | 102 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import tensorflow as tf
import tensorflow.keras as keras
from tensorflow.keras.layers import Reshape, Input, Flatten, concatenate, Dense, BatchNormalization ,Conv1D,Conv2D,Conv3D,MaxPool1D, MaxPool2D,MaxPool3D, GlobalMaxPool2D, Dropout
from tensorflow.keras.optimizers i... |
28b0c64b01ce852c0dcee584804459ad5844c4c62f8d366fff8fec489aadd0a1 | Python | 4,677 | 84 | """Анализ блока B: фазовый переход кооперации по изобилию + confound.
Читает runs/b_sweep.jsonl. Строит долю кооперации как функцию regrowth
(ищем РЕЗКИЙ переход, а не плавный тренд, Requejo & Camacho). Сравнивает
популяционную и внутриагентную корреляцию «голод vs кооперация».
"""
import json
import numpy as np
rows... |
bba444706eeb02fc226e5559eaa00e23345e0a1e67f5edfee364eac3609d6ea7 | Python | 4,677 | 118 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
def extract_clade_abundance(metaphlan_fp):
clade_abund = {}
with open(metaphlan_fp, "r") as metaphlan_f:
is_metaphlan_v4 = False
for line in metaphlan_f.readlines():
if 'SGB' in line:
# New versions of m... |
18c987b9e0390dd35278ccbafc4be8c67078a184f4fdfe81fe9270e0ea586636 | Python | 4,678 | 172 | import numpy as np
import pytest
try:
import torch
torch.set_grad_enabled(False)
HAS_TORCH = True
except ImportError:
HAS_TORCH = False
from pyriemann.datasets import make_masks, make_matrices
from pyriemann.geometry._backend import as_numpy
##########################################################... |
ea64df0eb714c29320c0a2b84777fbb10aed11ebf8091fa5bd5d44a9d63bafc6 | Python | 4,678 | 112 | import os
from .catalog import DatasetCatalog, MetadataCatalog
from .metadata import _get_builtin_metadata
from .mscoco import register_coco_instances, register_coco_panoptic_separated
# ==== Predefined datasets and splits for COCO ==========
_PREDEFINED_SPLITS_COCO = {}
_PREDEFINED_SPLITS_COCO["coco"] = {
"coco_... |
f2b1c434df81c4bfb06f9a263679e1a3fd56a83369a3370935384983c7176bce | Python | 4,678 | 127 | import io
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt5agg import (
FigureCanvasQTAgg as FigureCanvas)
import nanite.fit as nfit
import numpy as np
from PyQt6.QtWidgets import QApplication
from PyQt6 import QtCore
from .. import units
from ..head import custom_widgets
class MPLEDel... |
4ce3a0c3461a2ffcc2eb05915d8d9740444c7f6e070f51b99307603997933100 | Python | 4,683 | 138 | import numpy as np
def crop_and_pad_image(volume, coord, patch_size, padded_patch_size, mode='minimum'):
'''
crop_and_pad_image(volume, coord, patch_size, padded_patch_size)
crops from a volume with
Parameters
----------
volume : 4d tensor
coord : len 3
upper left coordinate of the... |
6b4119a4bfc0f3ae8a11d86271319bbb20ff4d8975b3291fcddaeb8becdacd3e | Python | 4,683 | 125 | from distutils.errors import DistutilsArgError
import inspect
import glob
import warnings
import platform
import distutils.command.install as orig
import setuptools
# Prior to numpy 1.9, NumPy relies on the '_install' name, so provide it for
# now. See https://github.com/pypa/setuptools/issues/199/
_install = orig.in... |
78fb482b3ea3c311f702cb72a395d77cb05cd316130cec1e901c3e55f339def0 | Python | 4,683 | 147 | # %%
'''
Extracts timeseries for roi masks, and spheres
Performs a single subject at time, designed to be used on the cluster
'''
import sys, os
import numpy as np
import pandas as pd
import h5py
import nibabel as nib
from nilearn.input_data import NiftiLabelsMasker, NiftiSpheresMasker
from time import time
sys.path.in... |
16de2b7cc9b6cd69544472c2c0eb01ab6c8ad487d3ee421bc837c3efb495d5f9 | Python | 4,684 | 133 | """
Contains and a class for converting a set of motif-specific matching model to
something that's compatible with functions expecting an end-to-end model
"""
from permacache import permacache, stable_hash, drop_if_equal
import numpy as np
import torch
import torch.nn as nn
import tqdm.auto as tqdm
from modular_spli... |
d5844791a7b55c67c4f781e3b38a527af208f8196dfc53b5125da4970e49be07 | Python | 4,684 | 133 | #!/usr/bin/env python
#=========================================================================
#
# Copyright NumFOCUS
#
# 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://... |
339904b78f1d2e31780525816e3e99f04f1c0202e4856e483e122f9e9dce61ae | Python | 4,685 | 96 | # FAITHFUL REIMPLEMENTATION from published architecture descriptions (no public code)
#
# "21cmBERT" (candidate queue name) has no distinct named repo (confirmed by GitHub repo/code search
# and web search: no "21cmBERT"-named project exists). The candidate's own triage note identifies it
# as the same attention-on-21c... |
6c567c18823562d48e4336231c9050429b80743473eb729d89f8d868ea67a7f7 | Python | 4,685 | 148 | # -*- coding: utf-8 -*-
import time
import argparse
import os.path
import sys
import brainpy_datasets as bd
import jax.numpy as jnp
import brainpy as bp
import brainpy.math as bm
import numpy as np
parser = argparse.ArgumentParser(description='LIF MNIST Training')
parser.add_argument('-T', default=100, type=int, h... |
7246e1e73769bbaa5f451f7e1b4bec91ab7f9504cebb42ac324ad58005b0392a | Python | 4,686 | 153 | """RCNN framewark Training Metrics."""
import mxnet as mx
try:
from mxnet.metric import EvalMetric
except ImportError:
from mxnet.gluon.metric import EvalMetric
class RPNAccMetric(EvalMetric):
""" RPN accuracy. """
def __init__(self):
super(RPNAccMetric, self).__init__('RPNAcc')
def upd... |
166542fd56cc3c430c0a7fa811e8f81ec16a3d1f69afc1243d2c054b9241953a | Python | 4,687 | 167 | __author__ = 'quentin'
import serial
from serial.tools import list_ports
import time
import logging
class NoValidPortError(serial.SerialException):
pass
class WrongSleepDepPortError(serial.SerialException):
pass
class SimpleLynxMotionConnection(object):
_baud = 115200
_min_angle_pulse = (0.,535.)
... |
9c162827600730cd34329287dab6d0f8822b879bf389b8e9c2f7cc5a86d4f1ef | Python | 4,687 | 103 | import glob
import h5py
import numpy as np
import os
import pandas as pd
from sklearn.linear_model import RidgeCV
from sklearn.model_selection import GroupKFold
from sklearn.linear_model import LinearRegression
from sklearn import preprocessing
import sys
from scipy.stats import pearsonr
"""
This script will run ridge... |
a977cd10e7ef49ed42fb7ff3801e8b5da8caf7be9a22de312f92b6944834f9a0 | Python | 4,687 | 149 | """Path validation helpers for portable TorchLens bundles."""
from __future__ import annotations
from pathlib import Path
from typing import TypeAlias
from . import TorchLensIOError
ExceptionType: TypeAlias = type[Exception]
def reject_symlink_path(
path: Path,
*,
context: str,
exc_type: Exception... |
01c58ab63632582aea4e9be6ce7b07219860a871b0a64ac0e75f6c052a668669 | Python | 4,688 | 123 | import logging
import re
import urllib.request
from contextlib import ExitStack
from urllib.parse import urlparse
from galaxy.files.models import (
BaseFileSourceConfiguration,
BaseFileSourceTemplateConfiguration,
FilesSourceRuntimeContext,
)
from galaxy.files.uris import (
get_reusable_http_session,
... |
309ae122e017608d7cb80dcb5783f91b263ef60bf3f950b083db93a7b8e9b29e | Python | 4,690 | 145 | from __future__ import annotations
import json
from pathlib import Path
import pytest
from larvaworld.portal.workspace import (
WorkspaceError,
clear_active_workspace_path,
get_known_workspaces,
get_active_workspace,
get_active_workspace_path,
get_notebook_workspace_dir,
get_workspace_dir... |
e89472aaa6fad8780e713a43a01e0fc07d188abff4d3968e196edf2b73e4d2e2 | Python | 4,690 | 127 | # %%
'''
Runs one-sample and between-group t-test on the activation betas
calculated in SPM.
'''
import sys
import numpy as np
import pandas as pd
import pingouin as pg
sys.path.insert(0, '..')
from functions.data_helpers import get_computer
# global variables
# paths and default settings
_, proj_dir = get_computer()... |
e552f8f52d51cf2dd601ff0c8740fce1b405ac5c378c901f22e498bf844b0b54 | Python | 4,691 | 86 | import matplotlib.pyplot as plt
import sklearn.metrics as metrics
import numpy as np
from constants import STANDARD_AMINO_ACIDS
class Plots:
def __init__(self, out_dir):
self.out_dir = out_dir
def learning_curve(self, epochs, accuracies, train_loss, validation_loss):
"""
P... |
21ae5aa6a04b13b082bdb988ba7b5b8a42bb21a4f7b554eecd7347dac7ea7fc3 | Python | 4,694 | 128 | """Tests for xcp_d.interfaces.utils module."""
import os
import nibabel as nb
import numpy as np
import pandas as pd
from xcp_d.interfaces.connectivity import NiftiParcellate
def test_nifti_parcellate(tmp_path_factory):
"""Convert nifti files to 32-bit."""
tmpdir = tmp_path_factory.mktemp('test_nifti_parce... |
800e706a997964c053532143bf14941fe340ffdb07a6ca6b5887ee455d5a03b8 | Python | 4,696 | 103 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import tensorflow as tf
import tensorflow.keras as keras
from tensorflow.keras.layers import Reshape, Input, Flatten, concatenate, Dense, BatchNormalization ,Conv1D,Conv2D,Conv3D,MaxPool1D, MaxPool2D,MaxPool3D, GlobalMaxPool2D, Dropout
from tensorflow.keras.optimizers i... |
b3d2e2c499f7b3c13a0adb154eb5b09e67e14edd61bb3c2e93d1419cf7a85356 | Python | 4,696 | 103 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import tensorflow as tf
import tensorflow.keras as keras
from tensorflow.keras.layers import Reshape, Input, Flatten, concatenate, Dense, BatchNormalization ,Conv1D,Conv2D,Conv3D,MaxPool1D, MaxPool2D,MaxPool3D, GlobalMaxPool2D, Dropout
from tensorflow.keras.optimizers i... |
e44eff73852081c107a593acc3f9a4b44c79826424c652b63b8cfca6cd3fca0a | Python | 4,697 | 149 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
def gaussian_form(t, sigma, mu):
return (1. / (np.sqrt(2. * np.pi * sigma ** 2))) * np.exp(-(t - mu) ** 2 / (2.0 * sigma ** 2))
def generate_ext_input(duration, N_e, n_excited, exc_drive_amplitude, dt, verbose=False, active_cells=None):
... |
97a1629b5a9855da14073ddf47d2a4b1f29597d262328c43db2e9e03e5ce29bd | Python | 4,698 | 142 | """Executable checks for functional migration examples."""
from __future__ import annotations
import ast
import importlib.util
import linecache
import re
from importlib.metadata import PackageNotFoundError, version
from pathlib import Path
from typing import Any
import pytest
import torch
MIGRATION_FILES = (
"f... |
f47a6eb675e04a55d0e7ef0c4ba7d1e6a1e7659ae3d9fcf06eb4cf8ae5d9a55b | Python | 4,698 | 153 | #!/usr/bin/env python
#
# Use this with the output of the sphinx linkchecker
# $ make linkcheck | tee links.txt
# $ python tools/link_consolidator.py links.txt
#
# It provides a markdown-formatted list of issues, that can be posted
# to an issue tracker.
#
# The following issues are recognized:
#
# - `redundant-trailin... |
c58cb9a7d74835320973ec6d02a23ac25f4bf9dc59442db166dee05ff9a23492 | Python | 4,699 | 146 | #vid_to_frames.py
import numpy as np
import cv2
from PIL import Image, ImageEnhance
import subprocess
import os
import sys
import shutil
import argparse
# import ffmpeg
from pathlib import Path
"""
-----------------
SUMMARY:
---------------
Takes a folder of videos and create a video frame folder for each video. G... |
d0836140bad3e7e3b4535266142a439a85d45eee6f2caaa1e2476df287ef9cc7 | Python | 4,699 | 123 | from __future__ import division
import unittest
import numpy as np
from wyrm.types import Data
from wyrm.processing import append
from wyrm.processing import swapaxes
class TestAppend(unittest.TestCase):
def setUp(self):
ones = np.ones((10, 5))
# cnt with 1, 2, 3
cnt = np.append(ones, ... |
d6250a3135cf038fcf429786990d09c9a363e3f9af34f9f0ba89028ac2e1f458 | Python | 4,699 | 148 | import os
import sys
import torch
import logging
import argparse
import pandas as pd
from PIL import Image
from transformers import ViTImageProcessor
from transformers import ViTForImageClassification
from RGS_functions import load_models, Average
#Check available device
device = torch.device('cuda' if tor... |
01020ab6736720bb52efb5614b202a68b7e0c99ef202a8e7fd6bab0e56d96282 | Python | 4,701 | 118 | """Persistence matrix (memo sec 8.1 item 9 / W3 / D21).
Real- and meta-substrate buffer traces round-trip with no payload; the
envelope survives; a loaded trace is HYPOTHESIS again (the discharge
registry is session-only); forged payloads still fail the M-C2/M-C3
coherence gates.
"""
from __future__ import annotation... |
bdd4add8083c8eb15699e249a05d7f70d87bdf053625405e2af35fddcf8c6782 | Python | 4,701 | 103 | # 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... |
23ce9b32b10725e75b6d59b23fc82b9cf3d9335e0a478267ac1ab5ac2648784e | Python | 4,702 | 108 | # SOURCE: vendored from https://github.com/fungtion/DANN @ master
# (models/model.py :: CNNModel + models/functions.py :: ReverseLayerF)
#
# DANN (Domain-Adversarial Neural Network; Ganin et al., 2016, "Domain-
# Adversarial Training of Neural Networks"): a CNN feature extractor feeds
# both a label classifier and a ... |
4d4d33dfccda6e13cd1bb848de7a45e6cb59481d83f1a3a7819d1549cd95adfb | Python | 4,702 | 138 | # type: ignore[override]
import os
from typing import Any, Callable, Optional
import torch
from pytorch_lightning import LightningDataModule
from torch.utils.data import DataLoader
from torch.utils.data.dataset import random_split
from pl_bolts.datasets import KittiDataset
from pl_bolts.utils import _TORCHVISION_AVAI... |
596130988ea334def7b6b440cc3cded1a1419a8e7a1096713688b20d3fe5c947 | Python | 4,702 | 152 | # -*- coding: utf-8 -*-
"""
Created on Tue Feb 14 14:43:07 2023
@author: longzheng
"""
from keras.models import Sequential, load_model
from keras.models import Sequential, load_model
from keras.layers import Conv2D, MaxPooling2D, Dropout, Dense, Flatten
from keras.optimizers import Adam
import pandas as pd
import de... |
06e763a19a90617c3f3bdadfcb910c16abe80cecea08e594a967bd7ea84d54c3 | Python | 4,706 | 153 | import numpy as np
import matplotlib.pyplot as plt
import scipy.stats
from .motifs import mean_subset_table_results
def produce_mean_difference_statistics(data, am, seeds, names):
"""
Produce mean difference statistics for the given data, for
donor, acceptor, and the mean of the two.
See produce... |
6ad38b0bdd0563bc21a3ffd3a2765ba5dd9ac1b3a29e48164b1de6d79320d562 | Python | 4,706 | 180 | """Base Execution Pool."""
import logging
import os
import sys
import time
from typing import Any, Dict
from billiard.einfo import ExceptionInfo
from billiard.exceptions import WorkerLostError
from kombu.utils.encoding import safe_repr
from celery.exceptions import WorkerShutdown, WorkerTerminate, reraise
from celery... |
cdf88dc0da04e69aee6344fb767566c8e1896ca27b38f6d3d5d9ae4197d707f1 | Python | 4,707 | 102 | """Журнал B2 (13 октября 2026): на синтетических строках страница собирается,
чисел до завершённого чтения не показывает, при полном чтении считает три
критерия и вердикт по PREREGISTRATION_B2_черновик.md §4-§5."""
import importlib.util
import json
import sys
from pathlib import Path
import numpy as np
ROOT = Path(__... |
ce889e4122ca36ed720eb37c418fe02063502cc30dd8e0e6365e13ea81995467 | Python | 4,707 | 95 | """Pin the three incident-hardened semantic-release config invariants (R86).
Each of these lines in ``pyproject.toml`` exists because a specific release
incident burned the project, and until fixwave-7 none had a test — a silent
edit (or a "cleanup" that reverts one to its library default) would only
fail AT RELEASE T... |
3f108ec1711aae13ac897b12428f9ad9b103b041de00eb022f44419427b671db | Python | 4,708 | 164 | # --- 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 Line(_BaseTraceHierarchyType):
_parent_path_str = "scattergl"
_path_str =... |
f60e54d0d953be53fd385c23c5fc9782285fcc3f8a93f7dccbb4038e192a6a9c | Python | 4,709 | 193 | """Utilities for debugging memory usage, blocking calls, etc."""
import os
import sys
import traceback
from contextlib import contextmanager
from functools import partial
from pprint import pprint
from celery.platforms import signals
from celery.utils.text import WhateverIO
try:
from psutil import Process
except ... |
00ee8c3aec6b9e505e39b9222db4f67204837c3796370abebefe1cc2c2959e37 | Python | 4,713 | 119 | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, absolute_import, division
from collections import OrderedDict
from warnings import warn
from ..utils import _raise
from ..utils.six import Path
from packaging.version import Version
from ..utils.tf import keras_import, v_keras
get_file =... |
59f894edc5dfbcbfce75629b5d062c4774dcacb576b0a90ce0b68b263ee3056a | Python | 4,713 | 136 | #!/usr/bin/env python3
"""
File: compare_conditional_vs_unconditional.py
Created: 2021/12/21
Last Changed: 2022/02/10
Author: M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the root direc... |
d05ebcd9b9848754c006055bbe799b7241f38080f5f9f1f0edc034bb4cdfc7eb | Python | 4,713 | 146 | from typing import Any
import numpy as np
import pandas as pd
import copy
from mirp._images.generic_image import GenericImage
from mirp._images.transformed_image import TransformedImage
from mirp.settings.generic import SettingsClass
from mirp._imagefilters.generic import GenericFilter
from mirp._imagefilters.utiliti... |
4583fed0f75eb531e7a8fab975d9acdb42b5b97445650da5fa089002e56330de | Python | 4,714 | 150 | import os
import torch
from torch.utils.data.sampler import RandomSampler
from torch.optim import Adam
import schnetpack as spk
from schnetpack.nn.cutoff import CosineCutoff
from moinn.nn.clustering_module import Clustering
from moinn.training.loss import clustering_loss_fn, cut_loss, ortho_loss, entropy_loss
from moi... |
996a73b5f0a4ff94969c5b03a3c1a3e375376ff26ce84c2d526466ccf0853eb0 | Python | 4,714 | 96 | # 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... |
0221b73ecf6b422cfb33a1b85af4b27e68adf1379bdb61fcdb13e422083e240e | Python | 4,716 | 111 | from PyQt5 import QtCore
from PyQt5 import QtWidgets
from PyQt5 import QtGui
from score_behavior.score_session_manager_control import SessionManagerControlWidget
from score_behavior.global_defs import DeviceState as State
import logging
logger = logging.getLogger(__name__)
class SessionController(QtCore.QAbstractTab... |
ecdb50a24e7ef47339c76c858c4f6c26e7a0416b900640956f23d40ac7d21ca6 | Python | 4,718 | 147 | """Popular Learning Rate Schedulers"""
# pylint: disable=missing-docstring
from __future__ import division
import warnings
from math import pi, cos
from mxnet import lr_scheduler
class LRSequential(lr_scheduler.LRScheduler):
r"""Compose Learning Rate Schedulers
Parameters
----------
schedulers: list... |
2a8f7b5b012dbf1035db0a21034ff98b320f3465a0736ca06c347a8039b8b503 | Python | 4,719 | 85 | import bottle
import json
import logging
import os
import datetime
FILESVERSION = "1.6"
FILESDATE = "2020-02-15"
app = bottle.Bottle()
STATIC_DIR = "../static"
PORT = 8001
sd_image = {'filename' : '20200507_ethoscope_000.img.zip',
'url' : 'https://imperialcollegelondon.box.com/shared/static/0tm8mbinrsq7o... |
ab96ef6005f6d639e044a0ee72d56423159f8c3652f6d15ea2c3d6fe6db9d7d8 | Python | 4,719 | 125 | """Static agent backend for deterministic testing without LLM calls.
Provides StaticAgent and StaticAgentRegistry that return canned responses
from YAML rules. Swap at the DI container level — no mocks, no pydantic-ai.
"""
import re
from typing import (
Any,
)
import yaml
from .base import (
ActionSuggestio... |
0c6ce51b119344b7baa3b09b8eb7bb052273ce71731ef306521d5098067b9016 | Python | 4,720 | 144 | import glob
import cv2
import numpy as np
import scipy.io as sio
class __AbstractDataset(object):
"""Abstract class for interface of subsequent classes.
Main idea is to encapsulate how each dataset should parse
their images and annotations.
"""
def load_img(self, path):
raise NotImpl... |
98d940c6baee7538b8a67bc052294ab9e60b3aa7bfa9b96e6a3e3571c2ba9387 | Python | 4,720 | 152 | """
audit_results.py — dump everything needed to resolve the open manuscript conflicts.
Makes no assumptions about column names. Run from the project root:
python audit_results.py
Writes the full output to outputs/audit.txt as well as printing it.
"""
import os
import glob
import sys
import pandas as pd
import n... |
00ae05e150626d2c9fdc17bea33ebd60eea5d048158f49f0abef5a075745126e | Python | 4,721 | 98 | """
This pipeline performs source reconstruction on stimulus data, and stores reconstructed ERs and
alpha rhythm envelopes.
Similar to p_read_erp_alpha_save.py but for source space.
"""
import os
import os.path as op
import numpy as np
import mne
from tools_general import load_json, load_pickle, save_pickle
from tools_... |
7f896241f4c9ea80ce8c4c8a6af2f4bf748e41af480efc1c0214562cc6062bf5 | Python | 4,722 | 147 | """Hierarchical Temporal Memory, 2004, Hawkins and George.
Paper: Hierarchical Temporal Memory / Cortical Learning Algorithm.
Sparse distributed representation model with a k-WTA spatial pooler and a
temporal memory that predicts next-step cell activations from distal segments.
"""
from __future__ import annotations
... |
c28bab4ab74d7e195044df8ccea64e3247e6f2875463e8261520b8d4da523f7b | Python | 4,722 | 138 | # Copyright 2022 Mayo Clinic. 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 applicable law or ... |
275bd1004f63856dcbab724ea12c96c9b58fdbd3d0ce5f047f4be79800fa11af | Python | 4,725 | 170 | """Guards against reintroducing Trace class-body method rebinding."""
import ast
import inspect
from types import ModuleType
import torchlens.data_classes.trace as trace_module
EXPECTED_MODELLOG_METHODS = {
"draw",
"render_dagua_graph",
"to_dagua_graph",
"visualization_field_audit",
"to_pandas",
... |
8afc9e728e40afbf3c2b758046544b50a78d837caa898252cad06c933f4635bc | Python | 4,725 | 119 | import torch
from torch import nn
import math
import time
from torch.nn import functional as F
from torch.nn.modules.batchnorm import BatchNorm1d
class GRUModel(nn.Module):
def __init__(self, model_config, device):
super(GRUModel,self).__init__()
# Debug
model_config['feature_size'] = 10
... |
ba8041ae41b535ae78b3fb8ab9d2cc23fe228c416c68cf418a7527c074e16d7b | Python | 4,725 | 111 | """SiamRPN Demo script.
Code adapted from https://github.com/STVIR/pysot"""
import os
import argparse
import matplotlib.pyplot as plt
import numpy as np
import mxnet as mx
from gluoncv import model_zoo, utils
from gluoncv.model_zoo.siamrpn.siamrpn_tracker import SiamRPNTracker as build_tracker
from gluoncv.model_zoo.si... |
f464395fdad9a6a888aec0faeba358871c4da8729152276de0eefc6e7bb89cac | Python | 4,725 | 177 | import binascii
import codecs
import marshal
import types as python_types
def default(method):
"""Decorates a method to detect overrides in subclasses."""
method._is_default = True
return method
def is_default(method):
"""Check if a method is decorated with the `default` wrapper."""
return getat... |
00be4f66bc6eb3776af43c2dd6f4c5c4841315b9c6a74ee7afefee4637a0b5b8 | Python | 4,727 | 105 | """
Periodic Parameters
===================
Exploring properties and topics related to peak parameters.
"""
###################################################################################################
from specparam import SpectralModel
from specparam.plts.spectra import plot_spectra
from specparam.plts.perio... |
b5fa8d7bda70f299910dc4703b65d108ad4a38020922cf31b92b14567bcdf225 | Python | 4,727 | 111 | # adapted from https://github.com/facebookresearch/detectron2/blob/master/detectron2/structures/image_list.py
from __future__ import division
from typing import Any, List, Sequence, Tuple, Union
import torch
from torch.nn import functional as F
class ImageList(object):
"""
Structure that holds a list of image... |
5254c66539d036611f97b2d84f3b5e748e22e8b4a8c2a177b3c1074219d34dc0 | Python | 4,728 | 141 | """
Methods to analyze cell morphology and protein localization in the cytoplasm
"""
import numpy as np
import pandas as pd
from skimage.measure import regionprops
from skimage.morphology import binary_erosion
from tqdm import tqdm
from .configs import configs
def mask_of_cell_cytoplasms(cell_masks, footprint):... |
afaf02da2d440fd753626865d8c3b5ba3d612b4ebfac75f8532111accfa7922e | Python | 4,728 | 137 | import numpy as np
def get_obj_grad(x, P, Ui, d, r, Ftype, beta):
# calculate the objective value f, that is, ||Pi_x F(x)||_2^2
# and the gradient G of ||Pi_x F(x)||_2^2
#
# input variables
# P : points for epsilon-net
# data : noisy samples
# x : point to be projected to the manif... |
b0b67d89c28c10419e907bf345164c893775cc214865e0e9b72c94d664026339 | Python | 4,728 | 135 | from __future__ import absolute_import
import logging
import sys
import textwrap
from collections import OrderedDict
from pip._vendor import pkg_resources
from pip._vendor.packaging.version import parse as parse_version
# NOTE: XMLRPC Client is not annotated in typeshed as on 2017-07-17, which is
# why we ignor... |
6ce847cf7f19a11fca2a6a9dd60f15280f0d731d27e583ed9e719182ed192cbd | Python | 4,729 | 257 | #!/usr/bin/env python
'''Generate models for affinity predictions'''
# initialization: gaussian, positive_unitball, uniform, xavier, msra, radial
# kernel size: 3, 5
modelstart = '''layer {
name: "data"
type: "MolGridData"
top: "data"
top: "label"
top: "affinity"
include {
phase: TEST
}
molgrid_d... |
7b4f777c49b1b7c56912fec516f9720270fba20537fbf9a3f43eb6deba6d5a56 | Python | 4,729 | 89 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
1f4192fd0b93b013e5e8d27787ddc4f0b7c7f8c98ce2c091260847dc112e4efd | Python | 4,730 | 156 | from __future__ import annotations
import argparse
import json
import random
import string
from pathlib import Path
COLORS = [
'r', 'g', 'm', 'y', 'teal', 'magenta',
'royalblue', 'lime', 'forestgreen',
]
def test_point(val):
try:
json_file, annotator = val.split(',')
return json_file, an... |
955b1d4e126a5475258e4f2159e8e63e195cd4d74cf3d632d24435a8e574f681 | Python | 4,730 | 115 | """VisDrone2019 object detection dataset."""
from __future__ import absolute_import
from __future__ import division
import os
import logging
import numpy as np
import mxnet as mx
from ..base import VisionDataset
class VisDroneDetection(VisionDataset):
"""VisDrone2019-DET Dataset.
Parameters
----------
... |
a80a71c17a529db5e2103c240e51202b377c052274df4980bae78f52b83c9e98 | Python | 4,730 | 155 | """Serialization with :mod:`pyarrow` (requires pyarrow to be installed)
Usage
-----
A context implements serialization of relevant Eelbrain objects, and can be
re-used indefinitely::
>>> context = pyarrow_context()
>>> s = context.serialize(ds).to_buffer()
>>> ds = context.deserialize(s)
"""
from inspect... |
41997d730eee6c58348b2eee25115ed6beedbe4d9424344e77cb2cc75e845bf4 | Python | 4,731 | 136 | """Tests the gym.wrapper.AutoResetWrapper operates as expected."""
from typing import Generator, Optional
from unittest.mock import MagicMock
import numpy as np
import pytest
import gym
from gym.wrappers import AutoResetWrapper
from tests.envs.utils import all_testing_env_specs
class DummyResetEnv(gym.Env):
"""... |
486bf99159741e10b7759fadce44c8533f95eb896b462d3fa12fcc353fabdde9 | Python | 4,731 | 136 | # SOURCE: vendored from passalis/dain @ master (dain.py)
# https://raw.githubusercontent.com/passalis/dain/master/dain.py
#
# Deep Adaptive Input Normalization (DAIN) for Time Series Forecasting
# (Passalis et al., IEEE TNNLS 2020). A single learnable normalization layer with
# three cascaded, parametrized steps -- ada... |
f5e1749ba2352a8abffcc876084f984adf3edf9b2a344d6300d0453355a2370b | Python | 4,731 | 143 | """This does not cover all CLI parameters defined in caper/caper_args.py.
gcp (Google Cloud Platform) backend is tested here with server/client functions.
"""
import os
import time
import pytest
from autouri import AutoURI
from caper.cli import main as cli_main
from caper.cromwell_rest_api import CromwellRestAPI
from... |
f1fa11569fd15d9a3a79208b345e479f5b53b44a92ef983e0a879048ea410463 | Python | 4,732 | 154 | import pandas as pd
import numpy as np
import random
import os
from torch.utils.data import Dataset
import numpy as np
from dtor.utilities.utils import expand_image
from dtor.utilities.utils import bbox3d, crop3d,pad_nd_image
from tqdm import tqdm
import pandas as pd
import torch
from sklearn.model_selection import KFo... |
136fe64eb49988e202879e74481f66b8d94ca0a95674070a4fe46a2ebeb71aa2 | Python | 4,733 | 151 | import gzip
import pickle
import random
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import KFold
from sklearn.preprocessing import MinMaxScaler
import keras
import tensorflow as tf
from keras.models import Model
from keras.callbacks import EarlyStopping, ModelCheckpoint, ReduceLROnPl... |
39c64dd712ae3dda0d69b10f92255a51acc763539933d9647eecaca01980e853 | Python | 4,733 | 150 | """Public ``Op.edge_uses`` accessor tests."""
from __future__ import annotations
from pathlib import Path
import pytest
import torch
import torchlens as tl
from torchlens.data_classes.op import Op
from torchlens.data_classes.trace import Trace
from torchlens.intervention.types import EdgeUseRecord, TupleIndex
cla... |
602fea03b89ca50fb773e455d19af4acfc0e85f8e4f7df048f770cd800925634 | Python | 4,734 | 143 | import csv
import enum
import string
import arguments.setting as setting
import datastructure.dataset as dataset
import os
from learning.construct_features import construct_features
from progress.bar import IncrementalBar
import learning.train
import learning.test
import getopt, sys
def run(data, setting, train=False... |
7b681dd6678da9dc5116ad430ac2c3a6a6aa8bbbf19b3a613da3f1b520c1cc51 | Python | 4,735 | 154 | """Issue #73: fixed axes between the leading axis and two ragged axes.
Shape ``(b, p, ~v, ~w)`` is the layout genvarloader's ``_FlatWindow.to_ragged()``
returns for variant windows. Indexing and ``to_ak()`` must honor the fixed ``p``
axis. The oracle is awkward indexing on the equivalent nested Python list.
"""
from ... |
c903eee3d226d0e00b2caa78a216387d6cb9b8209dd6c9d3a215267d896ca276 | Python | 4,735 | 174 | """
Widget for editing the food sources of an environment.
"""
from __future__ import annotations
import param
from .distribution_widget import build_distribution_widget
from .widget_base import (
classattr_section,
classdict_editor,
collapsible_family_box,
family_box,
parameterized_editor,
)
__... |
52b36b9a6aaf240266e99e4646b1552363cdcaadf19e864c449494e860745ea1 | Python | 4,736 | 144 | 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... |
ebe59f24d425227d62290f4d0a82d519b53c1f8e291225d648602e2543b72aff | Python | 4,736 | 131 | import os
import glob
from paddle.io import Dataset, DataLoader
import paddle
import numpy as np
import pgl
import numpy.linalg as LA
from sklearn.preprocessing import normalize
class GoTermDataset(Dataset):
def __init__(
self,
prot_chain_list,
n_feats,
prot_chain_data_path,
... |
a5d912a8715cc9cce3c4945de03a51d472c2d29a920a36423dd765c2a125f051 | Python | 4,740 | 93 | """Prepare COCO datasets
==============================
`COCO <http://cocodataset.org/#home>`_ is a large-scale object detection, segmentation, and captioning datasetself.
This tutorial will walk through the steps of preparing this dataset for GluonCV.
.. image:: http://cocodataset.org/images/coco-logo.png
.. hint::... |
c21ce8864d02632fcff272ef984fcb6c933be4fe0e3a95b8e677da55d68702f7 | Python | 4,741 | 129 | from typing import List, Optional
from pathlib import Path
import torch
import hydra
from omegaconf import OmegaConf, DictConfig
from pytorch_lightning import (
Callback,
LightningDataModule,
LightningModule,
Trainer,
seed_everything,
)
from pytorch_lightning.loggers import LightningLoggerBase
fr... |
a5481cd6e8f2ba2b158922f01d8032f8ec38866fbb976b594824f0cddc2877ff | Python | 4,742 | 138 | """Bounding box visualization functions."""
from __future__ import absolute_import, division
import numpy as np
import mxnet as mx
def expand_mask(masks, bboxes, im_shape, scores=None, thresh=0.5, scale=1.0, sortby=None):
"""Expand instance segmentation mask to full image size.
Parameters
----------
... |
44c61565d93937701578f7734f86add42ecc155d2546dd2b43076ca9fe867ab6 | Python | 4,744 | 153 | import math
from typing import Dict
import pytest
import torch
from lightly.loss.regularizer import DSERegularizer
class TestDSERegularizer:
def test_forward_pass(self) -> None:
torch.manual_seed(0)
regularizer = DSERegularizer(
local_clusters=2,
global_clusters=4,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.