A tool for selectively extracting cross sections from OpenMC h5 files.
Project description
This is a minimal Python package that provides both command line and API interfaces for converting OpenMC h5 nuclear data files into JSON files for each reaction.
This is useful for building a nuclear data database where JSON files are commonly accepted inputs. This tool is used for the generation of the xsplot.com database.
Python API usage
Extracting a single reaction from the h5 file using the API and saving as a CSV or JSON file.
import openmc_data_to_json as odj
odj.cross_section_from_h5_to_file(
input='Li6.h5',
output='tritium_production.json',
reaction='(n,Xt)',
format='json' # csv is also acceptable
)
It is also possible to return the h5 info as a dictionary with keys for 'cross section', 'energy', 'element' and other info on the nuclius
import openmc_data_to_json as odj
reaction = odj.cross_section_from_h5_to_dict(
input='Be9.h5',
reaction='(n,2n)'
)
A h5 file can be checked for reactions to see if particular reactions exist
import openmc_data_to_json as odj
reaction = odj.reactions_in_h5(
input='Fe56.h5',
reaction='(n,g)'
)
Command line usage
Another use of this program is to extract reactions using the command line tool.
openmc-data-to-json -i Be9.h5 -r (n,2n) -o my_reaction.json
- the
-i
or--input
argument specifies the input h5 file - the
-o
or--output
argument specifies the output json filename - the
-r
or--reaction
argument specifies the reactions to extract.
Installation
The easiest way to install is to use the PyPi distribution.
pip install openmc_data_to_json
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
Hashes for openmc_data_to_json-0.0.8.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a304e0080e4fcba95236ac21392da623c33012e5d2b0bde34d69983c66629043 |
|
MD5 | ded5f985d59c2d2cecce3297b976cb46 |
|
BLAKE2b-256 | 534a7c76297881f853dcdabc4581b4d79aceb7c37abde3d65b114a6223fee4c0 |
Hashes for openmc_data_to_json-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 27bd6c4289eeb151773362a5b8d678b1f6725cb22abcb35c7bc563af5c38104f |
|
MD5 | f73d5707f83fc23f24e31597dc815ef7 |
|
BLAKE2b-256 | 59243b28f50ef6e5934621413aee158b3cefda13d0d25c3d347d0caac398f225 |