# PETSIRD basic Python example

This directory contains some Python example code to read/write PETSIRD data.

## Install

Some python code is generated by `yardl` and included in the PyPI distribution.

```sh
python3 -m venv ~/petsirdenv
source ~/petsirdenv/bin/activate
pip install petsird
```

## Local Development

(This option needs the `yardl` binary, either download it, or use our devcontainer or GitHub CodeSpace.)

You need to `yardl generate` in the `model` directory first. This will create the Python package files in a `petsird`
subfolder.

```sh
cd ../model
yardl generate
pip install --editable ../python
```

## Usage

The Python code shows piping the compact binary format to standard out and
reading it from standard in. This can be used as follows:

```sh
python -m petsird.helpers.generator | python -m petsird.helpers.analysis
```

There is also a very basic utility to plot the scanner geometry. For instance

```sh
python -m petsird.helpers.generator > test.petsird
python -m petsird.helpers.plot_scanner < test.petsird
```
