From 4ad2ad3ab8c8812467d4318d4d2c82c8f6cc04f4 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 25 Mar 2020 06:45:03 -0500 Subject: [PATCH] Apply suggestions from @drewejohnson code review Co-Authored-By: Andrew Johnson --- openmc/checkvalue.py | 2 +- openmc/material.py | 6 +++--- openmc/tallies.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openmc/checkvalue.py b/openmc/checkvalue.py index 32d14c6f8f..a59b38a630 100644 --- a/openmc/checkvalue.py +++ b/openmc/checkvalue.py @@ -19,7 +19,7 @@ def check_type(name, value, expected_type, expected_iter_type=None, *, none_ok=F expected_iter_type : type or Iterable of type or None, optional Expected type of each element in value, assuming it is iterable. If None, no check will be performed. - none_ok : bool + none_ok : bool, optional Whether None is allowed as a value """ diff --git a/openmc/material.py b/openmc/material.py index 0e1ae8df7b..3babdf6435 100644 --- a/openmc/material.py +++ b/openmc/material.py @@ -794,10 +794,10 @@ class Material(IDManagerMixin): xml_element = ET.Element("nuclide") xml_element.set("name", nuclide[0]) - if nuclide[2] == 'ao': - xml_element.set("ao", str(nuclide[1])) + if nuclide.percent_type == 'ao': + xml_element.set("ao", str(nuclide.percent)) else: - xml_element.set("wo", str(nuclide[1])) + xml_element.set("wo", str(nuclide.percent)) return xml_element diff --git a/openmc/tallies.py b/openmc/tallies.py index e27b750a65..11f2fb0676 100644 --- a/openmc/tallies.py +++ b/openmc/tallies.py @@ -1097,7 +1097,7 @@ class Tally(IDManagerMixin): return np.arange(self.num_nuclides) # Determine the score indices from any of the requested scores - nuclide_indices = np.zeros(len(nuclides), dtype=int) + nuclide_indices = np.zeros_like(nuclides, dtype=int) for i, nuclide in enumerate(nuclides): nuclide_indices[i] = self.get_nuclide_index(nuclide) return nuclide_indices