mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Addressed suggestions by @paulromano
This commit is contained in:
parent
27870417ca
commit
7337d59e77
2 changed files with 6 additions and 11 deletions
|
|
@ -34,7 +34,7 @@ from openmc.mixin import EqualityMixin
|
|||
_RESONANCE_ENERGY_GRID = np.logspace(-3, 3, 61)
|
||||
|
||||
|
||||
def get_metadata(zaid, metastable_scheme='nndc'):
|
||||
def _get_metadata(zaid, metastable_scheme='nndc'):
|
||||
"""Return basic identifying data for a nuclide with a given ZAID.
|
||||
|
||||
Parameters
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ from itertools import chain
|
|||
from random import randint
|
||||
from shutil import move
|
||||
import xml.etree.ElementTree as ET
|
||||
import re
|
||||
|
||||
import openmc.data
|
||||
|
||||
|
|
@ -239,12 +238,6 @@ def update_geometry(geometry_root):
|
|||
|
||||
return was_updated
|
||||
|
||||
def replace_zaid(name):
|
||||
"""Replace a nuclide name in the ZAID notation with the correct name."""
|
||||
zaid = int(name.strip())
|
||||
name = openmc.data.neutron.get_metadata(zaid)[0]
|
||||
return name
|
||||
|
||||
def update_materials(root):
|
||||
"""Update the given XML materials tree. Return True if changes were made."""
|
||||
was_updated = False
|
||||
|
|
@ -254,9 +247,11 @@ def update_materials(root):
|
|||
if 'name' in nuclide.attrib:
|
||||
nucname = nuclide.attrib['name']
|
||||
nucname = nucname.replace('-', '')
|
||||
s = re.search("\s*(?<![A-z])\d{4,6}\s*", nucname)
|
||||
if s:
|
||||
nucname = replace_zaid(s.group(0))
|
||||
# If a nuclide name is in the ZAID notation (e.g., a number),
|
||||
# convert it to the proper nuclide name.
|
||||
if nucname.strip().isnumeric():
|
||||
nucname = \
|
||||
openmc.data.neutron._get_metadata(int(nucname))[0]
|
||||
nucname = nucname.replace('Nat', '0')
|
||||
if nucname.endswith('m'):
|
||||
nucname = nucname[:-1] + '_m1'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue