Skip to main content

ptir5

CI PyPI version conda-forge version License: MIT

Python library for PTIR5 files — the HDF5-based native format of Photothermal Spectroscopy Corp.'s PTIR Studio software (v5.0+).

Installation

From PyPI:

pip install ptir5

From conda-forge:

conda install -c conda-forge ptir5

For local development and testing:

pip install -e .[dev]
pytest -q

Quick Start

import ptir5

with ptir5.open("sample.ptir") as f:
    # List all measurements
    for m in f.measurements:
        print(m.label, m.measurement_type, m.data.shape)

    # Access a specific spectrum
    spec = f.measurements[0]
    x = spec.x_values        # wavenumber axis
    y = spec.data             # signal values

    # Navigate the document tree
    if f.tree:
        for node, folders, leaves in f.tree.walk():
            for leaf in leaves:
                if leaf.measurement is not None:
                    print(leaf.name, leaf.measurement.data.shape)

Features

  • Read-only access to all PTIR5 measurement types as numpy arrays
  • Derived O-PTIR stack output to a new document, preserving all source measurements
  • 18 measurement types: O-PTIR spectra/images/hyperspectra, Raman spectra/hyperspectra, time-domain bursts/cubes, camera images, fluorescence images, FL-PTIR images, PTSRS spectra/images, and image stacks
  • Side datasets (per-frame wavenumbers, per-pixel averages, completion markers) via m.auxiliary
  • Normalization settings for hyperspectral cubes and band images (reported, never applied)
  • Hierarchical tree navigation matching PTIR Studio's document structure
  • Flat measurement enumeration with type filtering and GUID lookup
  • Background spectra access
  • Generated data (ROI spectra, band images) from hyperspectral measurements
  • Lazy loading — data is read from disk only when accessed
  • Dict-like metadata with Python-native types

Data Types

Type Class Array Shape Dtype
O-PTIR Spectrum OPTIRSpectrum (points,) float32
Raman Spectrum RamanSpectrum (points,) float32
Generated Spectrum GeneratedSpectrum (points,) float32
PTSRS Spectrum PTSRSSpectrum (points,) float32
Time-Domain Burst TimeDomainBurst (samples,) float32
O-PTIR Image OPTIRImage (height, width) float32
Generated Image GeneratedImage (height, width) float32
PTSRS Image PTSRSImage (height, width) float32
Camera Image CameraImage (height, width, bpp) uint8
Fluorescence Image FluorescenceImage (height, width, bpp) uint8
FL-PTIR Image FLPTIRImage (height, width) float32 (uint16 or uint8 in older files)
FL-PTIR Image (legacy) FLPTIRImage (height, width, 4) ¹ uint8
O-PTIR Hyperspectra OPTIRHyperspectra (points, height, width) float32
Raman Hyperspectra RamanHyperspectra (points, height, width) float32
Time-Domain Cube TimeDomainCube (samples, height, width) float32
O-PTIR Image Stack OPTIRImageStack (images, height, width) float32
PTSRS Image Stack PTSRSImageStack (images, height, width) float32
Camera Image Stack CameraImageStack (images, height, width, bpp) uint8
FL-PTIR Image Stack (legacy) FLPTIRImageStack (images, height, width, 4) ¹ uint8
FL-PTIR Image Stack FLPTIRImageStack (images, height, width) float32

¹ Legacy FL-PTIR storage encodes one float32 per pixel as four uint8 bytes. Use m.data_float32 (and m.read_image(i) on stacks) to get canonical float32 imagery for any storage format; m.data returns the raw on-disk dataset. See docs/data_types.md for details.

Derived output

ptir5.open() remains read-only. The separate write_image_stack_result() API copies a source document and appends a labelled derived O-PTIR image stack with a new GUID and document-tree entry. It accepts finite float32 values covering a contiguous frame range and the full source image area. Source acquisition metadata is retained as context; generated children are cleared and extrema recalculated.

See derived output for usage, validation and restrictions.

Requirements

  • Python >= 3.11
  • h5py >= 3.9
  • numpy >= 1.24

License

MIT

Metadata

Release files for ptir5 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ptir5 0.2.0
File Size Uploaded Provenance Actions
ptir5-0.2.0.tar.gz 3.4 MB With provenance Details for ptir5-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ptir5 0.2.0
File Interpreter ABI Platform Actions
ptir5-0.2.0-py3-none-any.whl Python 3 none any Details for ptir5-0.2.0-py3-none-any.whl

Total release size: 3.4 MB

Release files / ptir5-0.2.0.tar.gz

Download URL ptir5-0.2.0.tar.gz
Size 3.4 MB
Tags Source
SHA-256 checksum
How to use checksums
c5143325122d6625f7f74a67bd97b25c70da2e1ea15ae14234eadc7e40e5fbca
BLAKE2b-256 checksum
How to use checksums
206b62ee4fc30314cb8f14169130c672bed65b31f00574c5bdf474a02624d30e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Release files / ptir5-0.2.0-py3-none-any.whl

Download URL ptir5-0.2.0-py3-none-any.whl
Size 27.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c2a692ba62808a167f4a2eabc31b19a4be93d7e0f2d53d82b842a7eb6f554429
BLAKE2b-256 checksum
How to use checksums
9efa53bb2e2b42f0de77544d6cbdcde251e5d7c29c2ff007f1c002af47c2db53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

Security for ptir5 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ptir5-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page