Skip to main content

python parser and usefull script related to the saclay format

Project description

Saclay_format (v0.2.6)

This repository contains a proposal format definition to exchange inputs/outputs between some mean-field theory codes in the nuclear physics and astrophysics communities. This format relies on a series of custom binary files containing the raw data along with a YAML header containing metadata. It adheres to the results of the 05/2025 and 10/2025 ESNT workshops entitled "Simulating dense matter on three-dimensional coordinate space meshes (part I and II)".

Content

  • saclay_format — Python3 package to parse and visualize this format
  • docs — documentation of the format (not yet up to date)
  • examples — nuclear mean-field outputs in this format
  • tests — unit tests of the package

Requirements

  • pyyaml — Python3 package for YAML parsing
  • h5py — Python3 package for HDF5 parsing

Running the parser

From a Python terminal, import the parser module and use its read() and write() methods. To see the expected structure of the data dictionary, check the create_dummy_data() function in tests/test_saclay_format.py.

Example:

cd tests/
python3 test_saclay_format.py

Examples

Example structure

examples/20Ne_bcs/
├── 20Ne_rho_n.wdat
├── 20Ne_state
├── 20Ne.h5
├── 20Ne.yaml
└── README.md

examples/alpha_alpha_3MeV/
├── reaction_alpha_alpha_3MeV_header.yml
├── reaction_alpha_alpha_3MeV_rho_n.bin
├── reaction_alpha_alpha_3MeV_rho_p.bin
├── README_visualisation_convert.md
└── script_test.convert.sh

examples/Ca40_ev8/
├── Ca40_HF_SLy4.yaml
├── Ca40_HF_SLy4_*.dat
└── README_test.md

Conversion test

python3 ../../src/saclay_format/hdf5_yaml_converter.py -h5 Ca40_HF_SLy4.yaml
python3 ../../src/saclay_format/ev8_to_ev1.py Ca40_HF_SLy4.h5 -o Ca40_HF_SLy4_ev1.h5
python3 ../../src/saclay_format/ev1_to_cr1.py Ca40_HF_SLy4_ev1.h5 -o Ca40_HF_SLy4_cr1.h5

Visualization test

Static:

python3 ../../src/saclay_format/visualisation_rho.py reaction_alpha_alpha_3MeV_header.yml

Dynamic:

python3 ../../src/saclay_format/visualisation_rho_TD.py -H reaction_alpha_alpha_3MeV_header.yml

Conversion and round-trip test:

python3 ../../src/saclay_format/hdf5_yaml_converter.py -h5 reaction_alpha_alpha_3MeV_header.yml
mv reaction_alpha_alpha_3MeV_header.h5 reaction_alpha_alpha_3MeV_converted.h5
python3 ../../src/saclay_format/visualisation_rho_TD.py reaction_alpha_alpha_3MeV_converted.h5
python3 ../../src/saclay_format/hdf5_yaml_converter.py -yaml reaction_alpha_alpha_3MeV_converted.h5
python3 ../../src/saclay_format/visualisation_rho_TD.py reaction_alpha_alpha_3MeV_converted.yaml
rm reaction_alpha_alpha_3MeV_converted*

Todo

  • Test the format
  • Add documentation
  • Update unit tests

Project layout

This project follows the structure recommended by the Hitchhiker’s Guide to Python:
https://docs.python-guide.org/writing/structure

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

saclay_format-0.2.6.tar.gz (28.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

saclay_format-0.2.6-py3-none-any.whl (29.0 kB view details)

Uploaded Python 3

File details

Details for the file saclay_format-0.2.6.tar.gz.

File metadata

  • Download URL: saclay_format-0.2.6.tar.gz
  • Upload date:
  • Size: 28.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.8

File hashes

Hashes for saclay_format-0.2.6.tar.gz
Algorithm Hash digest
SHA256 daad5a228f64b382b1e8ed0272cefb81e5fa5ebcea9e69dc9614f195dd277dad
MD5 7a5474749294136116c8443fc49d0706
BLAKE2b-256 cce574062d0dc1b8e2fc324c7c57afad468c4bd74c567a6d7f14f2e6829a0beb

See more details on using hashes here.

File details

Details for the file saclay_format-0.2.6-py3-none-any.whl.

File metadata

File hashes

Hashes for saclay_format-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 01cd2dbe0210566100f92769cc3baa2c326132a99604b520a4af3348a535f458
MD5 37d8a36c08ee5b12d6633d1f460f61c6
BLAKE2b-256 48b7237067ef8833f0436196341e65fece2dc8d833e6b4122dcd936d13104c2d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page