Skip to main content

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

Release files for openmc-data-to-json 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openmc-data-to-json 0.1.4
File Size Uploaded
openmc_data_to_json-0.1.4.tar.gz 7.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openmc-data-to-json 0.1.4
File Interpreter ABI Platform
openmc_data_to_json-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size:15.7 kB

Release files / openmc_data_to_json-0.1.4.tar.gz

Download URL openmc_data_to_json-0.1.4.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9277a82a4fee24c1c92104539d8cf567035ada6cda03f0439116eead01ba0502
BLAKE2b-256 checksum
How to use checksums
29b9c019f9b2e53a0a98969f1340074fc4dc9c750d590503bf14e8e8a7feabc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

Release files / openmc_data_to_json-0.1.4-py3-none-any.whl

Download URL openmc_data_to_json-0.1.4-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
575882443b89c3d345c3dc8f92450bad26f01497bbdaea3e31bf64ac0d7cee60
BLAKE2b-256 checksum
How to use checksums
2db2901b279bfe6f94becc18ddec23411fe382f88c6951bc30ac1f74aafbc82e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.8

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page