This directory contains some Python example code to read/write PETSIRD data.
Some python code is generated by yardl
and included in the PyPI distribution.
python3 -m venv ~/petsirdenv
source ~/petsirdenv/bin/activate
pip install petsird
(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.
cd ../model
yardl generate
pip install --editable ../python
The Python code shows piping the compact binary format to standard out and reading it from standard in. This can be used as follows:
- From the repo root
cd python
python petsird_generator.py | python petsird_analysis.py
There is also a very basic utility to plot the scanner geometry. For instance
python petsird_generator.py > test.bin
python petsird_plot_scanner.py < test.bin