python parser and usefull script related to the saclay format
Project description
Saclay_format (v0.2.17)
This repository defines a data standard to describe parts of the inputs/outputs of mean-field theory codes in the nuclear physics and astrophysics communities. 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)".
It also defines and implements two storage formats for the data:
-
A format relying on a series of custom binary files containing the raw data along with a YAML header containing metadata. This format ensures compatibility with the wdata format, requires a YAML library and is not 100% portable.
-
A HDF5 format. This requires the HDF5 library and ensures portability.
Content
src/saclay_format— Python3 package to parse and visualize the data standarddocs— documentation on this package and specification of the data content and formatsexamples— nuclear mean-field outputs in this formattests— unit tests of the package
Requirements
numpy— Python3 package for linear algebrapyyaml— Python3 package for YAML parsingh5py— Python3 package for HDF5 parsing
Installation via PyPI
The parser is available as a PyPI package: https://pypi.org/project/saclay-format/
Install it using pip:
pip install saclay-format
This also installs several command-line scripts:
saclay_format_ev8_to_ev1saclay_format_ev1_to_cr1saclay_format_hdf5_yaml_convertersaclay_format_compute_densitiessaclay_format_visualisation_rhosaclay_format_visualisation_rho_TDsaclay_format_visualisation_ascii
Running the parser
From a Python terminal, import the package and use its read() and write() methods.
Example:
import saclay_format
data = saclay_format.read('file.yml')
# Modify or inspect data...
saclay_format.write(data, 'file_out.h5')
To run the unit tests:
cd tests/
python3 test_saclay_format.py
Examples
Example structure
examples/20Ne_bcs_hdf5/
├── state.h5
├── fields.h5
└── 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 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
- Should we stick to a constant rank for the numpy arrays returned by the read method ?
- Should we clarify the Python dictionary returned by read ?
- Change
t0andframetotminandnt - Should we stick to [ix,iy,iz...] with column-major storage or go back to the numpy native storage and a [...,iz,iy,ix] order for the indices ?
Project layout
This project follows the structure recommended by the Hitchhiker’s Guide to Python: https://docs.python-guide.org/writing/structure
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file saclay_format-0.2.17.tar.gz.
File metadata
- Download URL: saclay_format-0.2.17.tar.gz
- Upload date:
- Size: 33.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f77d096acda0dbfd1ea07c22fddc2893355b3bd2314a5b824534b7d815c58fef
|
|
| MD5 |
4f3f4a596cc9f5cf63e8a439b192dac5
|
|
| BLAKE2b-256 |
8d9a690e3bdf41be38ecc68b803f8423792e95a69bfac18b49b1945069f1ce96
|
File details
Details for the file saclay_format-0.2.17-py3-none-any.whl.
File metadata
- Download URL: saclay_format-0.2.17-py3-none-any.whl
- Upload date:
- Size: 34.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24493a7a1dba612474c9f0e5715506ecf9cd2ab585eeee2275ce833b30b0e61f
|
|
| MD5 |
c72586d0a85467c9a1cf7d5a9dc3981c
|
|
| BLAKE2b-256 |
e96cc9a2e0d5b57cca755e1b0e23168583f4a09ff16aee998373a42d6cabebf8
|