Metadata-Version: 2.4
Name: sstcam-tio
Version: 2.0.1
Summary: Pure Python reader of SST camera waveform files.
Author-email: Jason Watson <jason.watson@desy.de>
License-Expression: BSD-3-Clause
Project-URL: repository, https://gitlab.cta-observatory.org/cta-array-elements/sst/camera/analysis/tio
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy~=1.20
Requires-Dist: numba~=0.63.1
Requires-Dist: fitsio~=1.3
Provides-Extra: dev
Requires-Dist: ipython; extra == "dev"
Requires-Dist: pre-commit~=4.1; extra == "dev"
Requires-Dist: mypy~=1.15; extra == "dev"
Requires-Dist: pytest~=8.3; extra == "dev"
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
Requires-Dist: coverage>=7.4.0; extra == "dev"
Dynamic: license-file

# <img align="right" src="https://gitlab.cta-observatory.org/cta-array-elements/sst/camera/analysis/tio/-/raw/main/misc/logo.jpg?ref_type=heads" height="200"></a>

# tio

[![pipeline status](https://gitlab.cta-observatory.org/cta-array-elements/sst/camera/analysis/tio/badges/master/pipeline.svg)](https://gitlab.cta-observatory.org/cta-array-elements/sst/camera/analysis/tio) [![coverage report](https://gitlab.cta-observatory.org/cta-array-elements/sst/camera/analysis/tio/badges/master/coverage.svg)](https://gitlab.cta-observatory.org/cta-array-elements/sst/camera/analysis/tio)

Python Reader for sstcam-waveform/TargetIO waveform files, utilising [fitsio](https://pypi.org/project/fitsio/) and [numba](https://numba.pydata.org/).

These files are FITS containing binary tables, which have been used as an
intermediate format to store waveforms from the SST (Small-Sized Telescope)
camera of CTAO (Cherenkov Telescope Array Observatory), and are generated
by the [sstcam-waveform](https://gitlab.cta-observatory.org/cta-array-elements/sst/camera/server/sstcam-server)
or the [TargetIO](https://gitlab.cta-observatory.org/cta-array-elements/common/targetlibraries/targetio) packages.

This package provides convenient read-only access to the waveform files, with support for both
R0 (uncalibrated) and R1 (calibrated) data, as full-camera and single-module files.
The reader is designed for efficient access to waveform data and event properties,
with support for iterating through events in a file.

* Supported Python versions: 3.10+
* Supported platforms: Linux, OSX
* Source: <https://gitlab.cta-observatory.org/cta-array-elements/sst/camera/analysis/tio>
* License: [BSD-3-Clause](LICENSE)

## Installation

This package is installable via pip from PyPI:
```
pip install sstcam-tio
```

This package is also installable via pip directly from this repository (via https or ssh), e.g.:
```
pip install 'git+https://gitlab.cta-observatory.org/cta-array-elements/sst/camera/analysis/tio.git'
```

## Optional Dependencies

Utilisation of Intel's short vector math library (SVML) for improved performance provided by numba:
```
conda install intel-cmplr-lib-rt
```

## Usage

```python
from tio import Reader
import numpy as np

path = "path/to/file_r0.tio"
event_index = 2
with Reader(path) as reader:

    # Read a single event
    event = reader[event_index]
    wfs = event.waveforms  # Access waveforms
    print(wfs.shape)  # Shape: (n_pixel, n_samples)
    first_cell_id = event.first_cell_id  # Access event properties

    # Iterate through file
    for event in reader:
        pass
```
