Skip to main content

Read-only Python library for PTIR5 files (HDF5-based format from Photothermal Spectroscopy Corp.)

Project description

ptir5

CI PyPI version conda-forge version License: MIT

Read-only 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
  • 16 measurement types: O-PTIR spectra/images/hyperspectra, Raman spectra/hyperspectra, camera images, fluorescence images, FL-PTIR images, PTSRS spectra/images, and image stacks
  • 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
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, bpp) uint8
O-PTIR Hyperspectra OPTIRHyperspectra (points, height, width) float32
Raman Hyperspectra RamanHyperspectra (points, 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 rank-4 storage encodes one float32 per pixel as four uint8 bytes. Use m.read_image(i) or m.data_float32 to get canonical float32 imagery for either storage format; m.data returns the raw on-disk dataset. See docs/data_types.md for details.

Requirements

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

License

MIT

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

ptir5-0.1.1.tar.gz (3.3 MB view details)

Uploaded Source

Built Distribution

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

ptir5-0.1.1-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file ptir5-0.1.1.tar.gz.

File metadata

  • Download URL: ptir5-0.1.1.tar.gz
  • Upload date:
  • Size: 3.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ptir5-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f76e130c9a355f81e0393b08f5cd1bc6c5cbeef388388ac72284cdd5535063f2
MD5 fb41d6b1095cbc7c4676082a3f5217a9
BLAKE2b-256 9e98f59f81bae9e59fc4f0d23d8fb5fa4182861964af698af16709447eb40ad1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ptir5-0.1.1.tar.gz:

Publisher: publish.yml on photothermal/PTIR5-py

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

File details

Details for the file ptir5-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ptir5-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ptir5-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cc6f011c08d93dc2a4cf317a14d22a01e0fb2e15f2eb8f7e709c845ff6ce571d
MD5 f23e9a2a52327d816cf61f09b71d2803
BLAKE2b-256 8411e7f84239f9ee0bdcd5fe59532c4bd192c5de86e37a5973833233a6d2c5c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for ptir5-0.1.1-py3-none-any.whl:

Publisher: publish.yml on photothermal/PTIR5-py

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