Skip to content

Commit

Permalink
Don't write zero mass fractions to xml.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bradley Meyer committed Feb 25, 2023
1 parent bdafa1f commit de35f28
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
8 changes: 8 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ Changelog
All notable changes to this project will be documented in this file. This
project adheres to `Semantic Versioning <http://semver.org/spec/v2.0.0.html>`_.

Version 2.7.1
--------------

Fix:

* The XML write function no longer outputs zone mass fractions if they are
zero.

Version 2.7.0
--------------

Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'English'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
2 changes: 1 addition & 1 deletion wnutils/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

__title__ = "wnutils"
__summary__ = "Python project to read and plot webnucleo files"
__version__ = "2.7.0"
__version__ = "2.7.1"
__author__ = "Clemson University"
__copyright__ = "Clemson University, 2018-2023"
11 changes: 6 additions & 5 deletions wnutils/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1710,11 +1710,12 @@ def _set_xml_data_for_zone(self, zone_element, zone):

mass_fracs = etree.SubElement(zone_element, "mass_fractions")
for nuc in zone["mass fractions"]:
nuclide = etree.SubElement(mass_fracs, "nuclide")
nuclide.set("name", nuc[0])
etree.SubElement(nuclide, "z").text = str(nuc[1])
etree.SubElement(nuclide, "a").text = str(nuc[2])
etree.SubElement(nuclide, "x").text = str(zone["mass fractions"][nuc])
if zone["mass fractions"][nuc] != 0:
nuclide = etree.SubElement(mass_fracs, "nuclide")
nuclide.set("name", nuc[0])
etree.SubElement(nuclide, "z").text = str(nuc[1])
etree.SubElement(nuclide, "a").text = str(nuc[2])
etree.SubElement(nuclide, "x").text = str(zone["mass fractions"][nuc])

def set_zone_data(self, zones):
"""Method to set the zone data.
Expand Down

0 comments on commit de35f28

Please sign in to comment.