Openmc-ace-to-hdf5 error

Hi All,
I’m trying to convert ACE MCNP cross-sections into HDF5 format.
The command is the following:
openmc-ace-to-hdf5 -d ./ --xsdir …/mu2e_xsdata/xsdirendf80

Unfortunately, the script does not start returning the following error:
Traceback (most recent call last):
File “/usr/local/bin/openmc-ace-to-hdf5”, line 73, in
if not os.path.exists(path):
File “/usr/lib/python3.5/genericpath.py”, line 19, in exists
os.stat(path)
TypeError: argument should be string, bytes or integer, not PosixPath

I can’t figure out what’s the problem. I’m using the script released with version 0.12.0 of the code.
Let me know if more information is necessary.
Thanks
Valerio

It looks like the openmc-ace-to-hdf5 script does not support your Python version (3.5). The os.path.exists function started accepting path-like objects in Python 3.6. Are you able to use Python 3.6 or higher? If not, you can try copying the openmc-ace-to-hdf5 script somewhere else and modifying the problematic line (73) to:

if not os.path.exists(str(path)):

Thanks Paul,

that’s probably the problem, as the same script worked perfectly on a different machine with python 3.6.9.

Modifying row 73 let’s the script start but then new errors are appearing:

/home/debian/.local/lib/python3.5/site-packages/openmc/data/energy_distribution.py:1246: UserWarning: Interpolation scheme for continuous tabular distribution is not histogram or linear-linear.
warn("Interpolation scheme for continuous tabular distribution "
Converting 1001.710nc (ACE) to H1 (HDF5)
Converting 1001.711nc (ACE) to H1 (HDF5)
/home/debian/.local/lib/python3.5/site-packages/openmc/data/neutron.py:284: UserWarning: Tried to add cross sections for MT=1 at T=600K but this reaction doesn’t exist.
“reaction doesn’t exist.”.format(mt, strT))
/home/debian/.local/lib/python3.5/site-packages/openmc/data/neutron.py:284: UserWarning: Tried to add cross sections for MT=101 at T=600K but this reaction doesn’t exist.
“reaction doesn’t exist.”.format(mt, strT))
Traceback (most recent call last):
File “/usr/local/bin/openmc-ace-to-hdf5”, line 126, in
data.export_to_hdf5(converted[name] + ‘_1’, ‘w’, libver=args.libver)
TypeError: unsupported operand type(s) for +: ‘PosixPath’ and ‘str’

This is now less important as I was able to convert the cross section on the machine with python 3.6.9. Nevertheless, the warnings related to not existing reactions where appearing also there.

/home/debian/.local/lib/python3.5/site-packages/openmc/data/neutron.py:284: UserWarning: Tried to add cross sections for MT=1 at T=600K but this reaction doesn’t exist.
“reaction doesn’t exist.”.format(mt, strT))
/home/debian/.local/lib/python3.5/site-packages/openmc/data/neutron.py:284: UserWarning: Tried to add cross sections for MT=101 at T=600K but this reaction doesn’t exist.
“reaction doesn’t exist.”.format(mt, strT))

Is it something to be worried?

Thanks again

Valerio

No, in this case, I wouldn’t be worried about the messages about these missing reactions. MT=1 and MT=101 correspond to the total cross section and the total neutron disappearance cross section, respectively. Both of those are redundant reactions that are recalculated as needed anyway.

Thanks a lot.

Valerio