Skip to content

Commit

Permalink
Catchall PR for minor formatting/typo updates to docstrings (#1634)
Browse files Browse the repository at this point in the history
* Fixing settings table dump
* Fixing various things in API docs
* Fixing typos

---------

Co-authored-by: zachmprince <zachmprince@gmail.com>
Co-authored-by: jyang <jyang@terrapower.com>
  • Loading branch information
3 people authored Jan 29, 2024
1 parent f15d00e commit c374838
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 66 deletions.
4 changes: 2 additions & 2 deletions armi/materials/thU.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"""
Thorium Uranium metal.
Data is from [#IAEA-TECDOCT-1450]_.
Data is from [IAEA-TECDOCT-1450]_.
.. [#IAEA-TECDOCT-1450] Thorium fuel cycle -- Potential benefits and challenges, IAEA-TECDOC-1450 (2005).
.. [IAEA-TECDOCT-1450] Thorium fuel cycle -- Potential benefits and challenges, IAEA-TECDOC-1450 (2005).
https://www-pub.iaea.org/mtcd/publications/pdf/te_1450_web.pdf
"""

Expand Down
4 changes: 2 additions & 2 deletions armi/materials/thorium.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"""
Thorium Metal.
Data is from [#IAEA-TECDOCT-1450]_.
Data is from [IAEA-TECDOCT-1450]_.
.. [#IAEA-TECDOCT-1450] Thorium fuel cycle -- Potential benefits and challenges, IAEA-TECDOC-1450 (2005).
.. [IAEA-TECDOCT-1450] Thorium fuel cycle -- Potential benefits and challenges, IAEA-TECDOC-1450 (2005).
https://www-pub.iaea.org/mtcd/publications/pdf/te_1450_web.pdf
"""
from armi.materials.material import FuelMaterial
Expand Down
4 changes: 2 additions & 2 deletions armi/materials/thoriumOxide.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"""
Thorium Oxide solid ceramic.
Data is from [#IAEA-TECDOCT-1450]_.
Data is from [IAEA-TECDOCT-1450]_.
.. [#IAEA-TECDOCT-1450] Thorium fuel cycle -- Potential benefits and challenges, IAEA-TECDOC-1450 (2005).
.. [IAEA-TECDOCT-1450] Thorium fuel cycle -- Potential benefits and challenges, IAEA-TECDOC-1450 (2005).
https://www-pub.iaea.org/mtcd/publications/pdf/te_1450_web.pdf
"""
from armi import runLog
Expand Down
70 changes: 35 additions & 35 deletions armi/nucDirectory/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,41 +90,41 @@
<Element LR (Z=103), Lawrencium, ChemicalGroup.ACTINIDE, ChemicalPhase.SOLID>]
For specific data on nuclides within each element, refer to the
:ref:`nuclide bases summary table <nuclide-bases-table>`.
.. exec::
from tabulate import tabulate
from armi.nucDirectory import elements
attributes = ['z',
'name',
'symbol',
'phase',
'group',
'is naturally occurring?',
'is heavy metal?',
'num. nuclides',]
def getAttributes(element):
return [
f'``{element.z}``',
f'``{element.name}``',
f'``{element.symbol}``',
f'``{element.phase}``',
f'``{element.group}``',
f'``{element.isNaturallyOccurring()}``',
f'``{element.isHeavyMetal()}``',
f'``{len(element.nuclides)}``',
]
sortedElements = sorted(elements.byZ.values())
return create_table(tabulate(tabular_data=[getAttributes(elem) for elem in sortedElements],
headers=attributes,
tablefmt='rst'),
caption='List of elements')
.. only:: html
For specific data on nuclides within each element, refer to the
:ref:`nuclide bases summary table <nuclide-bases-table>`.
.. exec::
from tabulate import tabulate
from armi.nucDirectory import elements
attributes = ['z',
'name',
'symbol',
'phase',
'group',
'is naturally occurring?',
'is heavy metal?',
'num. nuclides',]
def getAttributes(element):
return [
f'``{element.z}``',
f'``{element.name}``',
f'``{element.symbol}``',
f'``{element.phase}``',
f'``{element.group}``',
f'``{element.isNaturallyOccurring()}``',
f'``{element.isHeavyMetal()}``',
f'``{len(element.nuclides)}``',
]
sortedElements = sorted(elements.byZ.values())
return create_table(tabulate(tabular_data=[getAttributes(elem) for elem in sortedElements],
headers=attributes,
tablefmt='rst'),
caption='List of elements')
"""

import os
Expand Down
4 changes: 2 additions & 2 deletions armi/nuclearDataIO/cccc/cccc.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
container data types, e.g. list or matrix, relying on the child
implementation of the literal types that the container possesses. The binary
conversion is implemented in :py:class:`BinaryRecordReader` and
:py:class`BinaryRecordWriter`. The ASCII conversion is implemented in
:py:class:`BinaryRecordWriter`. The ASCII conversion is implemented in
:py:class:`AsciiRecordReader` and :py:class:`AsciiRecordWriter`.
These :py:class`IORecord` classes are used within :py:class:`Stream` objects
These :py:class:`IORecord` classes are used within :py:class:`Stream` objects
for the data conversion. :py:class:`Stream` is a context manager that opens
a file for reading or writing on the ``__enter__`` and closes that file upon
``__exit__``. :py:class:`Stream` is an abstract base class that is
Expand Down
2 changes: 1 addition & 1 deletion armi/nuclearDataIO/xsCollections.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ def computeMacroscopicGroupConstants(
This function computes the macroscopic cross sections of a specified
reaction type from inputted microscopic cross sections and number
densities. The ``constantName`` parameter specifies what type of
reaction is requested. The ``numberDensities`` parameter is dictionary
reaction is requested. The ``numberDensities`` parameter is a dictionary
mapping the nuclide to its number density. The ``lib`` parameter is a library
object like :py:class:`~armi.nuclearDataIO.xsLibraries.IsotxsLibrary` or
:py:class:`~armi.nuclearDataIO.xsLibraries.CompxsLibrary` that holds the
Expand Down
2 changes: 1 addition & 1 deletion armi/reactor/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1713,7 +1713,7 @@ def createHomogenizedCopy(self, pinSpatialLocators=False):
This method creates and returns a homogenized representation of itself in the form of a new Block.
The homogenization occurs in the following manner. A single Hexagon Component is created
add added to the new Block. This Hexagon Component is given the
and added to the new Block. This Hexagon Component is given the
:py:class:`armi.materials.mixture._Mixture` material and a volume averaged temperature
(``getAverageTempInC``). The number densities of the original Block are also stored on
this new Component (:need:`I_ARMI_CMP_GET_NDENS`). Several parameters from the original block
Expand Down
2 changes: 1 addition & 1 deletion armi/reactor/components/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class ComponentType(composites.CompositeModelType):
system.
"""

TYPES = dict()
TYPES = dict() #: :meta hide-value:

NON_DIMENSION_NAMES = (
"Tinput",
Expand Down
6 changes: 5 additions & 1 deletion armi/reactor/composites.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,12 @@ class CompositeModelType(resolveCollections.ResolveParametersMeta):
collection of all defined subclasses, called TYPES.
"""

# Dictionary mapping class name -> class object for all subclasses
TYPES: Dict[str, Type] = dict()
"""
Dictionary mapping class name to class object for all subclasses.
:meta hide-value:
"""

def __new__(cls, name, bases, attrs):
newType = resolveCollections.ResolveParametersMeta.__new__(
Expand Down
31 changes: 19 additions & 12 deletions armi/reactor/converters/blockConverters.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ def radiiFromHexSides(sideLengths):


def radiiFromRingOfRods(distToRodCenter, numRods, rodRadii, layout="hexagon"):
"""
r"""
Return list of radii from ring of rods.
Parameters
Expand All @@ -778,17 +778,24 @@ def radiiFromRingOfRods(distToRodCenter, numRods, rodRadii, layout="hexagon"):
Notes
-----
There are two assumptions when making circles:
1) the rings are concentric about the radToRodCenter;
2) the ring area of the fuel rods are distributed to the inside and outside rings with the same thickness.
thicknessOnEachSide (t) is calculated as follows:
r1 = inner rad that thickness is added to on inside
r2 = outer rad that thickness is added to on outside
radToRodCenter = (r1 + r2) / 2.0 due to being concentric;
Total Area = Area of annulus 1 + Area of annulus 2
Area of annulus 1 = pi * r1 ** 2 - pi * (r1 - t) ** 2
Area of annulus 2 = pi * (r2 + t) ** 2 - pi * r2 ** 2
Solving for thicknessOnEachSide(t):
t = Total Area / (4 * pi * radToRodCenter)
#. The rings are concentric about the ``radToRodCenter``.
#. The ring area of the fuel rods are distributed to the inside and outside
rings with the same thickness. ``thicknessOnEachSide`` (:math:`t`) is calculated
as follows:
.. math::
:nowrap:
\begin{aligned}
r_1 &\equiv \text{inner rad that thickness is added to on inside} \\
r_2 &\equiv \text{outer rad that thickness is added to on outside} \\
\texttt{radToRodCenter} &= \frac{r_1 + r_2}{2} \text{(due to being concentric)} \\
\text{Total Area} &= \text{Area of annulus 1} + \text{Area of annulus 2} \\
\text{Area of annulus 1} &= \pi r_1^2 - \pi (r_1 - t)^2 \\
\text{Area of annulus 2} &= \pi (r_2 + t)^2 - \pi r_2^2 \\
t &= \frac{\text{Total Area}}{4\pi\times\texttt{radToRodCenter}}
\end{aligned}
"""
if layout == "polygon":
alpha = 2.0 * math.pi / float(numRods)
Expand Down
6 changes: 3 additions & 3 deletions armi/reactor/reactors.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,10 @@ class Core(composites.Composite):
A :py:class:`Core <armi.reactor.reactors.Core>` object is typically a
child of a :py:class:`Reactor <armi.reactor.reactors.Reactor>` object.
A Reactor can contain multiple objects of the Core type. The instance
attribute name ``r.core`` is reserved for the object representating the
attribute name ``r.core`` is reserved for the object representing the
active core. A reactor may also have a spent fuel pool instance
attribute, ``r.sfp``, which is also of type
:py:class:`core <armi.reactor.reactors.Core>`.
:py:class:`Core <armi.reactor.reactors.Core>`.
Most of the operations to retrieve information from the ARMI reactor
data model are mediated through Core objects. For example,
Expand Down Expand Up @@ -832,7 +832,7 @@ def getNumRings(self, indexBased=False):
This method determines the number of rings in the reactor. If the
setting ``circularRingMode`` is enabled (by default it is false), the
assemblies will be grouped into roughly circular rings based on
their positions and the number of circular rings is reteurned.
their positions and the number of circular rings is returned.
Otherwise, the number of hex rings is returned. This parameter is
mostly used to facilitate certain fuel management strategies where
the fuel is categorized and moved based on ring indexing.
Expand Down
6 changes: 2 additions & 4 deletions doc/user/inputs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1548,9 +1548,7 @@ through ``self.cs``.

def looks_like_path(s):
"""Super quick, not robust, check if a string looks like a file path."""
if s.startswith("\\\\") or s.startswith("//"):
return True
elif s[1:].startswith(":\\")
if s.startswith("\\\\") or s.startswith("//") or s[1:].startswith(":\\"):
return True
return False

Expand All @@ -1568,7 +1566,7 @@ through ``self.cs``.
content += ' - {}\n'.format(' '.join(wrapper.wrap(str(setting.description) or '')))
default = str(getattr(setting, 'default', None)).split("/")[-1]
options = str(getattr(setting,'options','') or '')
if looks_like_path(defaults):
if looks_like_path(default):
# We don't want to display default file paths in this table.
default = ""
options = ""
Expand Down

0 comments on commit c374838

Please sign in to comment.