Skip to main content

Calibration, output-building, and data preparation utilities for BrightEyes MCS HDF5 files.

Project description

BrightEyes-MCS-DataPrep

Calibration and data-preparation utilities for BrightEyes MCS HDF5 files.

brighteyes-mcs-dataprep contains the writer-side and processing helpers for BrightEyes MCS data. It calibrates FLIM histograms, estimates channel skew, creates schema-compatible /output groups, appends derived analysis products, and provides plotting and HDF5 inspection helpers.

Reader functionality is intentionally kept in BrightEyes-MCS-Reader and is imported from brighteyes_mcs_reader where needed.

Install

pip install brighteyes-mcs-dataprep

For local development:

pip install -e .
pytest

Usage

Calibrate a file

from brighteyes_mcs_dataprep import calibrate_h5_file

calibrated_path = calibrate_h5_file(
    "measurement.h5",
    "reference.h5",
    data_key=("data", "data_channels_extra"),
    reference_key=None,
    reference_type="ref",
    period_ns=12.5,
)

By default the calibrated copy is written next to the input file with a _calib.h5 suffix. Calibration results are stored under /calibration/results/<product>/, and the /output group is created unless create_output=False is passed.

Build standard outputs

from brighteyes_mcs_dataprep import build_h5_output

build_h5_output(
    "measurement_calib.h5",
    create_virtual_channels=True,
    create_sum_channels=True,
    create_sum_channels_with_skew_correction=True,
)

The output builder creates virtual per-channel datasets and summed SPAD/AUX products under /output. It reads current schema paths such as /raw/spad and /raw/aux by default. Legacy root-level datasets can be selected explicitly, for example spad_data_key="data" or aux_data_key="data_channels_extra".

Append analysis products

import numpy as np

from brighteyes_mcs_dataprep import H5OutputProduct, write_h5_output_run

written_path, run_id = write_h5_output_run(
    "measurement_calib.h5",
    "apr_001",
    [
        H5OutputProduct(
            "spad",
            np.ones((256, 256)),
            attrs={
                "data_role": "image",
                "axis_order": "y,x",
                "source_data_path": "/raw/spad",
                "units": "counts",
            },
        )
    ],
    tool_name="APR reassignment",
    algorithm_name="adaptive_pixel_reassignment",
    set_default=True,
)

Existing run IDs are versioned automatically, so a second write to apr_001 becomes apr_002 unless output_key_overwrite=True is passed.

Public API

Common imports are exposed directly from brighteyes_mcs_dataprep:

from brighteyes_mcs_dataprep import (
    H5DataCalibrator,
    H5OutputBuilder,
    H5OutputProduct,
    build_h5_output,
    calibrate_h5_file,
    estimate_channel_skew,
    show_h5_structure,
    write_h5_output_run,
)

Alignment and plotting helpers are also available through Alignment or as lazy top-level exports.

HDF5 Schema Notes

Current BrightEyes files store measured data under /raw, metadata under /raw/metadata, calibration artifacts under /calibration, and derived analysis runs under /output/<run_id>. The data-preparation helpers preserve this layout and add provenance attributes, source-file hashes, and default output pointers where appropriate.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brighteyes_mcs_dataprep-0.1.0.tar.gz (416.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brighteyes_mcs_dataprep-0.1.0-py3-none-any.whl (91.3 kB view details)

Uploaded Python 3

File details

Details for the file brighteyes_mcs_dataprep-0.1.0.tar.gz.

File metadata

  • Download URL: brighteyes_mcs_dataprep-0.1.0.tar.gz
  • Upload date:
  • Size: 416.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for brighteyes_mcs_dataprep-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f61092abb44a9c0d622e0e352adec9bbd0db45adccde62429059e00ba62450ae
MD5 9dcdfb32acfb08662d6f28fed08c3dea
BLAKE2b-256 1e264002c6bc68ba773476c3263a69a904760e8ef38ae6c8f757d43761e0ddc7

See more details on using hashes here.

Provenance

The following attestation bundles were made for brighteyes_mcs_dataprep-0.1.0.tar.gz:

Publisher: release.yml on VicidominiLab/BrightEyes-MCS-DataPrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brighteyes_mcs_dataprep-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for brighteyes_mcs_dataprep-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02de7b110a85d0b13631312e07de653804fe93eaa93ec0741a883b1e22ca0c4f
MD5 0f50acc24557a6ea7a311c245938867a
BLAKE2b-256 e3a90ff902915a0d896a29f93514c621a3349c8b716f1e04096e94c7f44b8f31

See more details on using hashes here.

Provenance

The following attestation bundles were made for brighteyes_mcs_dataprep-0.1.0-py3-none-any.whl:

Publisher: release.yml on VicidominiLab/BrightEyes-MCS-DataPrep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page