Merge pull request #1366 from paulromano/check-ace-suffix

Make sure from_ace classmethods get correct type of ACE table
This commit is contained in:
Amanda Lund 2019-09-27 21:35:57 -05:00 committed by GitHub
commit a9c26c96ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View file

@ -588,6 +588,9 @@ class IncidentNeutron(EqualityMixin):
# If mass number hasn't been specified, make an educated guess
zaid, xs = ace.name.split('.')
if not xs.endswith('c'):
raise TypeError(
"{} is not a continuous-energy neutron ACE table.".format(ace))
name, element, Z, mass_number, metastable = \
get_metadata(int(zaid), metastable_scheme)

View file

@ -549,7 +549,9 @@ class IncidentPhoton(EqualityMixin):
ace = get_table(ace_or_filename)
# Get atomic number based on name of ACE table
zaid = ace.name.split('.')[0]
zaid, xs = ace.name.split('.')
if not xs.endswith('p'):
raise TypeError("{} is not a photoatomic transport ACE table.".format(ace))
Z = get_metadata(int(zaid))[2]
# Read each reaction

View file

@ -600,6 +600,8 @@ class ThermalScattering(EqualityMixin):
# Get new name that is GND-consistent
ace_name, xs = ace.name.split('.')
if not xs.endswith('t'):
raise TypeError("{} is not a thermal scattering ACE table.".format(ace))
name = get_thermal_name(ace_name)
# Assign temperature to the running list