Repository: terrapower/armi
Pull request #1752 (2024-06-27 14:36:41)

Cleaning up docstring and unused instance variable
## What is the change?
While doing a review of depletion capabilities I noticed that the docstring for the `Assembly` class was a bit out of date and that the instance variable `pinPeakingFactors` was unused. This PR cleans that out.

## Why is the change being made?

No need to keep stuff that's not used. 

---

## Checklist

- [x] This PR has only [one purpose or idea](https://terrapower.github.io/armi/developer/tooling.html#one-idea-one-pr).
- ~[Tests](https://terrapower.github.io/armi/developer/tooling.html#test-it) have been added/updated to verify any new/changed code.~

<!-- Check the code quality -->

- [x] The code style follows [good practices](https://terrapower.github.io/armi/developer/standards_and_practices.html).
- [x] The commit message(s) follow [good practices](https://terrapower.github.io/armi/developer/tooling.html).

<!-- Check the project-level cruft -->

- [x] The [release notes](https://terrapower.github.io/armi/developer/tooling.html#add-release-notes) have been updated if necessary.
- [x] The [documentation](https://terrapower.github.io/armi/developer/tooling.html#document-it) is still up-to-date in the `doc` folder.
- [x] The dependencies are still up-to-date in `pyproject.toml`.


Patch:
diff --git a/armi/physics/neutronics/crossSectionGroupManager.py b/armi/physics/neutronics/crossSectionGroupManager.py
index c0cfb808..2875f132 100644
--- a/armi/physics/neutronics/crossSectionGroupManager.py
+++ b/armi/physics/neutronics/crossSectionGroupManager.py
@@ -1235,12 +1235,12 @@ class CrossSectionGroupManager(interfaces.Interface):
 
             # create a new block collection that inherits all of the properties
             # and settings from oldBlockCollection.
-            if len(oldBlockCollection._validRepresentativeBlockTypes) > 0:
-                validBlockTypes = []
-                for flag in oldBlockCollection._validRepresentativeBlockTypes:
-                    validBlockTypes.append(flags._toString(Flags, flag))
-            else:
-                validBlockTypes = None
+            validBlockTypes = oldBlockCollection._validRepresentativeBlockTypes
+            if validBlockTypes is not None and len(validBlockTypes) > 0:
+                validBlockTypes = [
+                    flags._toString(Flags, flag)
+                    for flag in oldBlockCollection._validRepresentativeBlockTypes
+                ]
             newBlockCollection = oldBlockCollection.__class__(
                 oldBlockCollection.allNuclidesInProblem,
                 validBlockTypes=validBlockTypes,
diff --git a/armi/reactor/assemblies.py b/armi/reactor/assemblies.py
index 83237d31..bfe4ea8e 100644
--- a/armi/reactor/assemblies.py
+++ b/armi/reactor/assemblies.py
@@ -40,15 +40,6 @@ class Assembly(composites.Composite):
     """
     A single assembly in a reactor made up of blocks built from the bottom up.
     Append blocks to add them up. Index blocks with 0 being the bottom.
-
-    Attributes
-    ----------
-    pinNum : int
-        The number of pins in this assembly.
-
-    pinPeakingFactors : list of floats
-        The assembly-averaged pin power peaking factors. This is the ratio of pin
-        power to AVERAGE pin power in an assembly.
     """
 
     pDefs = assemblyParameters.getAssemblyParameterDefinitions()
@@ -82,7 +73,6 @@ class Assembly(composites.Composite):
         self.setType(typ)
         self._current = 0  # for iterating
         self.p.buLimit = self.getMaxParam("buLimit")
-        self.pinPeakingFactors = []  # assembly-averaged pin power peaking factors
         self.lastLocationLabel = self.LOAD_QUEUE
 
     def __repr__(self):
diff --git a/doc/release/0.3.rst b/doc/release/0.3.rst
index dbff151f..d857ac35 100644
--- a/doc/release/0.3.rst
+++ b/doc/release/0.3.rst
@@ -55,7 +55,7 @@ Bug Fixes
 ---------
 #. Fixed four bugs with "corners up" hex grids. (`PR#1649 <https://github.com/terrapower/armi/pull/1649>`_)
 #. Fixed ``safeCopy`` to work on both Windows and Linux with strict permissions (`PR#1691 <https://github.com/terrapower/armi/pull/1691>`_)
-#. When creating a new XS group, inherit settings from initial group. (`PR#1653 <https://github.com/terrapower/armi/pull/1653>`_)
+#. When creating a new XS group, inherit settings from initial group. (`PR#1653 <https://github.com/terrapower/armi/pull/1653>`_, `PR#1751 <https://github.com/terrapower/armi/pull/1751>`_)
 
 #. TBD
 


Test patch:
diff --git a/armi/physics/neutronics/tests/test_crossSectionManager.py b/armi/physics/neutronics/tests/test_crossSectionManager.py
index 9e857975..2437420a 100644
--- a/armi/physics/neutronics/tests/test_crossSectionManager.py
+++ b/armi/physics/neutronics/tests/test_crossSectionManager.py
@@ -816,16 +816,8 @@ class TestCrossSectionGroupManager(unittest.TestCase):
         self.assertIsNone(blocks[0].p.detailedNDens)
         self.assertIsNone(blocks[1].p.detailedNDens)
 
-    def test_createRepresentativeBlocksUsingExistingBlocks(self):
-        """
-        Demonstrates that a new representative block can be generated from an existing
-        representative block.
-
-        Notes
-        -----
-        This tests that the XS ID of the new representative block is correct and that the
-        compositions are identical between the original and the new representative blocks.
-        """
+    def _createRepresentativeBlocksUsingExistingBlocks(self, validBlockTypes):
+        """Reusable code used in multiple unit tests."""
         o, r = test_reactors.loadTestReactor(
             TEST_ROOT, inputFileName="smallestTestReactor/armiRunSmallest.yaml"
         )
@@ -843,7 +835,7 @@ class TestCrossSectionGroupManager(unittest.TestCase):
             }
         )
         o.cs[CONF_CROSS_SECTION].setDefaults(
-            crossSectionGroupManager.AVERAGE_BLOCK_COLLECTION, ["fuel"]
+            crossSectionGroupManager.AVERAGE_BLOCK_COLLECTION, validBlockTypes
         )
         aaSettings = o.cs[CONF_CROSS_SECTION]["AA"]
         self.csm.cs = copy.deepcopy(o.cs)
@@ -877,6 +869,30 @@ class TestCrossSectionGroupManager(unittest.TestCase):
                 continue
             self.assertEqual(baSettingValue, aaSettings.__dict__[setting])
 
+    def test_createRepresentativeBlocksUsingExistingBlocks(self):
+        """
+        Demonstrates that a new representative block can be generated from an existing
+        representative block.
+
+        Notes
+        -----
+        This tests that the XS ID of the new representative block is correct and that the
+        compositions are identical between the original and the new representative blocks.
+        """
+        self._createRepresentativeBlocksUsingExistingBlocks(["fuel"])
+
+    def test_createRepresentativeBlocksUsingExistingBlocksDisableValidBlockTypes(self):
+        """
+        Demonstrates that a new representative block can be generated from an existing
+        representative block with the setting `disableBlockTypeExclusionInXsGeneration: true`.
+
+        Notes
+        -----
+        This tests that the XS ID of the new representative block is correct and that the
+        compositions are identical between the original and the new representative blocks.
+        """
+        self._createRepresentativeBlocksUsingExistingBlocks(True)
+
     def test_interactBOL(self):
         """Test `BOL` lattice physics update frequency.