/new-aglae-data-converter

Primary LanguagePythonGNU Affero General Public License v3.0AGPL-3.0

New AGLAE Data Converter

This project is a tool to convert data files from the New AGLAE particle accelerator to HDF5 format. The tool supports the conversion of imagery analysis data in LST format and spectrum/standards data for punctual analysis. The tool consists of a command-line interface (CLI) and a graphical user interface (GUI) written with Qt.

Prerequisites

  • Python 3.10
  • Rust 2021
  • Poetry

Installation

  1. Clone the repository to your local machine:

    git clone https://github.com/your-username/new-aglae-data-converter.git
    
  2. cd new-aglae-data-converter

    cd new-aglae-data-converter
    
  3. Install the required packages: It will install the rust library and the python dependencies

    make build_rs
    poetry install
    

Usage

GUI

To use the GUI, run the following command:

poetry run python gui.py

Follow the prompts in the GUI to select the source and destination folders and start the conversion process.

CLI

To use the CLI, run the following command:

poetry run python new_aglae_data_converter/converter.py -e <type to parse> -d <source_folder> -o <destination_folder>

Get some help with the command:

poetry run python new_aglae_data_converter/converter.py --help

Development

CI

Opening or editing a pull request will trigger a GitHub action. It downloads a zip file containing test data and HDF5 files that were generated by the latest version of the converter from an Azure Blob Storage bucket. The updated code is then run to produce new HDF5 files, which are compared to the saved ones using h5diff. If there are any differences between the old and new HDF5 files, the CI will fail. If your pull request modifies the structure of the HDF5 files, you must upload a new zip file to the storage bucket to update the HDF5 files that are used to run these tests.

Packaging

To package the project for sharing, you can use the tool nuitka. For example, to package the GUI, you can run the following command:

nuitka --onefile --plugin-enable=pyside6 --plugin-enable=numpy --clang ./main.py

Optimization

We're using flamegraph to debug optimization issues, with the py-spy package. To run it: Go into a poetry shell

poetry shell

Run the py-spy command for flamegraph:

py-spy record -- python converter.py -e lst -d ./data -o ./out

Using speedscope:

py-spy record -o output.speedscope.json --format speedscope -- python converter.py -e lst -d ./data -o ./out

On Windows this will create a single excutable file that you can share with others.

License

This project is licensed under the GNU AFFERO GENERAL PUBLIC LICENSE.

Acknowledgments