Merge pull request #1489 from SamPUG/develop

Fixed bug which prevents creating photon data with no atomic relax
This commit is contained in:
Paul Romano 2020-02-20 11:32:33 -06:00 committed by GitHub
commit e7514e1122
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View file

@ -784,8 +784,9 @@ class IncidentPhoton(EqualityMixin):
sub_group = shell_group.create_group(key)
# Write atomic relaxation
if key in self.atomic_relaxation.subshells:
self.atomic_relaxation.to_hdf5(sub_group, key)
if self.atomic_relaxation is not None:
if key in self.atomic_relaxation.subshells:
self.atomic_relaxation.to_hdf5(sub_group, key)
else:
continue

View file

@ -2,6 +2,7 @@
from collections.abc import Mapping, Callable
import os
from pathlib import Path
import numpy as np
import pandas as pd
@ -144,3 +145,9 @@ def test_export_to_hdf5(tmpdir, element):
element2.bremsstrahlung['electron_energy']).all()
# Export to hdf5 again
element2.export_to_hdf5(filename, 'w')
def test_photodat_only(run_in_tmpdir):
endf_dir = Path(os.environ['OPENMC_ENDF_DATA'])
photoatomic_file = endf_dir / 'photoat' / 'photoat-001_H_000.endf'
data = openmc.data.IncidentPhoton.from_endf(photoatomic_file)
data.export_to_hdf5('tmp.h5', 'w')