Metadata-Version: 2.4
Name: SimbioReader
Version: 1.0.5
Summary: Python Reader for the data from SIMBIO-SYS instrument suite on-board the ESA mission BepiColombo
Keywords: data reader,Space Mission,BepiColombo,SIMBIO-SYS
Author: Romolo Politi
Author-email: Romolo Politi <Romolo.Politi@inaf.it>
License-File: LICENSE
Classifier: Programming Language :: Python :: 3.14
Classifier: Development Status :: 5 - Production/Stable
Requires-Dist: numpy>=2.3.3,<3.0.0
Requires-Dist: rich-click>=1.8.9,<2.0.0
Requires-Dist: importlib-metadata>=8.7.0,<9.0.0
Requires-Dist: pillow>=12.0.0,<13.0.0
Requires-Dist: packaging>=26.0,<27.0
Requires-Dist: requests>=2.32.5,<3.0.0
Requires-Dist: semantic-version-tools>=1.4.1,<2.0.0
Requires-Dist: loguru>=0.7.3
Requires-Dist: pds4-tools>=1.4
Requires-Dist: lxml>=6.1.1
Requires-Dist: python-dateutil>=2.9,<3
Requires-Python: >=3.14, <4.0
Project-URL: Repository, https://github.com/SIMBIO-SYS/SimbioReader
Description-Content-Type: text/markdown

![Version 1.0.5](https://img.shields.io/badge/version-1.0.5-blue?style=plastic)
![Language Python 3.14](https://img.shields.io/badge/python-3.14-orange?style=plastic&logo=python)
![BepiColombo SIMBIO-SYS](https://img.shields.io/badge/BepiColombo-SIMBIO--SYS-blue?style=plastic)
[![SimbioReader Test](https://github.com/SIMBIO-SYS/SimbioReader/actions/workflows/test.yml/badge.svg)](https://github.com/SIMBIO-SYS/SimbioReader/actions/workflows/test.yml)
[![Documentation Status](https://readthedocs.org/projects/simbioreader/badge/?version=latest)](https://simbioreader.readthedocs.io/en/latest/?badge=latest)

# SimbioReader

SimbioReader is the official Python reader for products generated by the
Spectrometer and Imagers for MPO BepiColombo Integrated Observatory System
(SIMBIO-SYS) aboard ESA's BepiColombo mission.

The reader loads PDS4 labels and their observational arrays and tables. It
models SIMBIO-SYS metadata for STC, HRIC, and VIHI together with the Display,
Imaging, Geometry, and Reference discipline areas.

For mission information, see the
[ESA SIMBIO-SYS page](https://www.cosmos.esa.int/web/bepicolombo/simbio-sys).

## Requirements and installation

SimbioReader 1.0 requires Python 3.14.

```console
python3 -m pip install SimbioReader
```

With uv:

```console
uv add SimbioReader
```

## Python usage

Pass a PDS4 label, one of its associated data files, or a product directory:

```python
from pathlib import Path

from SimbioReader import SimbioReader

product = SimbioReader(
    Path("sim_raw_sc_stc_winx_internal_cruise_ico4b_2021-04-24_001__0_1.lblx")
)

print(product.channel)
print(product.simbio.stc.housekeeping)
print(product.imaging)
print(product.geometry)
```

The principal metadata attributes are:

- `simbio`, containing the channel-specific `stc`, `hric`, or `vihi` model;
- `display`, `imaging`, and `geometry`;
- `reference`, containing internal and external references;
- `data_arrays`, plus `image_data`, `cube_data`, and `csv_data` when present;
- `time_coordinates`, `target`, and `software_context`.

### Compression metadata

From version 1.0.1, `product.simbio.compression.box` is a string preserving
`compression_box` from the label, including `"128x128"`, `"64x128"`, or `"1"`.
It describes a compression block and must not be treated as a scalar float.
`compression.rate` remains a float and `compression.ratio` remains an integer.
Code that previously used a numeric `box` must handle the textual value.

This fixes a reader error that stopped SimCal before calibration and label
updates. See [the 1.0.1 release notes](CHANGELOG.md) for validation details.

`savePreview()` is retained only as an obsolete compatibility stub. Calling it
prints a deprecation message and raises `DeprecatedMethodError`.

## Command-line interface

The package installs one command, `simbioReader`, with five subcommands:

```console
simbioReader version
simbioReader about
simbioReader phases --kind all
simbioReader filters
simbioReader filters STC --name pan-l
simbioReader info product.lblx --all
```

- `version` reports the code version and compatible PSA and SIMBIO-SYS data
  models;
- `about` reports package and author metadata;
- `phases` displays mission phases, subphases, and test campaigns;
- `filters` displays HRIC and STC filter definitions. Names are
  case-insensitive and accept forms such as `PAN-L`, `pan-l`, and `panl`;
- `info` reads a product and displays selected metadata.

With `info`, use `--hk` for instrument and CSV housekeeping tables,
`--detector` for detector metadata, `--data-structure` for observational
structures, `--filters` for the optical filter, and `--all` for every modeled
section. Units are rendered as symbols by default; `--no-symbols` preserves
the XML unit names.

Use `--imaging`, `--display`, `--geometry`, or `--references` to add the
selected sections to the general product and target information. These flags
can be combined, for example `simbioReader info product.lblx --imaging --references`.

Run `simbioReader --help` or `simbioReader COMMAND --help` for all options.

## Development

```console
uv sync --all-groups
uv run pytest
uv run ruff check src tests
uv run sphinx-build -W -M html docs/source docs/build
uv build
```

The tests use the PDS4 fixtures under `tests/data`.

## Documentation

The Sphinx sources are under `docs/source`. Additional maintenance documents:

- [class composition map](docs/source/class-map.rst);
- [XML model coverage audit](docs/model-coverage-audit.md);
- [unused-code audit](docs/unused-code-audit.md);
- [handoff](handoff/HANDOFF.md);
- [changelog](CHANGELOG.md).

## 1.0.2 dependency and runtime update

Use Python 3.14 (`uv sync --locked`) with the refreshed dependency lockfile.
PDS4 generated product versions remain `0.1`; software versions are independent.

## Release 1.0.5

This release adds imaging, display, geometry and reference panels to
`simbioReader info` and summarizes multi-row housekeeping tables with the
first, middle and last samples. The reader accepts unnamed imaging subframes
and exposes the compression initial bit rate as `compression.ibr`, with
`compression.ratio` retained as an alias.

See the [release notes](RELEASE_NOTES.md) for the full list of changes.
