armi.bookkeeping.report.newReports module

class armi.bookkeeping.report.newReports.ReportContent(title)[source]

Bases: object

Holds the report contents.

writeReports()[source]

Renders each report into a document for viewing.

get(section, default=None)[source]
tableOfContents()[source]

Creates a Table of Contents at the top of the document that links to later Sections.

Parameters:

elements (ReportContent) – Contains sections of subsections that make up the report.

class armi.bookkeeping.report.newReports.ReportNode[source]

Bases: ABC

levelDict = {0: <htmltree.htmltree.HtmlElement object>, 1: <htmltree.htmltree.HtmlElement object>, 2: <htmltree.htmltree.HtmlElement object>, 3: <htmltree.htmltree.HtmlElement object>}
abstract render(level, idPrefix)[source]

Renders the section to a htmltree element for inserting into HTML document tree.

Parameters:
  • level (int) – level of the nesting for this section, determines the size of the heading title for the Section (The higher the level, the smaller the title font-size). Ranges from H1 - H4 in html terms.

  • idPrefix (String) – Used for href/id referencing for the left hand side table of contents to be paired with the item that render() is called upon.

Returns:

HtmlElement – after it is rendered within writeReports().

Return type:

an html representation of this Nodes report content. Appended into the report

class armi.bookkeeping.report.newReports.Section(title)[source]

Bases: ReportNode

A grouping of objects within the report. These items can be either of type ReportNode (Table, Image, Section, etc) of, HtmlElements as defined by htmltree.

addChildElement(element, heading='', subheading=None)[source]

Add an element to the group of Sections.

Parameters:

element (ReportNode, or an HtmlElement as defined by htmltree) – Item to be added as child to this Section.

get(title, default=None)[source]
items()[source]
render(level, idPrefix='') HtmlElement[source]

Renders a Section into the appropriate html representation.

Parameters:
  • level (int) – level of the nesting for this section, determines the size of the heading title for the Section (The higher the level, the smaller the title font-size). Ranges from H2 - H5 in html terms.

  • idPrefix (String) – used for href/id referencing for the left hand side table of contents to be paired with the item that render() is called upon.

Returns:

HtmlElement – after it is rendered within writeReports().

Return type:

an html representation of this Nodes report content. Appended into the report

class armi.bookkeeping.report.newReports.Image(caption, imagePath, title=None, encode=True)[source]

Bases: ReportNode

For Images within the report (such as Hexplots premade and not time dependent) (For time dependent images see TimeSeries).

Parameters:
  • title (String) –

  • caption (String) –

  • imagePath (String) – .png or .img image name to reference later

  • encode (boolean) – Default true, will result in an encoded file path when rendered to html.

render(level, idPrefix='') HtmlElement[source]

Wraps an image file into an html Img tag. (With caption included in the figure).

class armi.bookkeeping.report.newReports.Table(title, caption='', header=None)[source]

Bases: ReportNode

For Table Objects that are then later converted to htmltree tables.

Parameters:
  • title (String) – for Table Title

  • caption (String) – for Table Caption

  • header (List) – a list of column headings, optional, for when tables have columns with headings.

addRow(row)[source]
render(level, idPrefix='') HtmlElement[source]

Converts a TableSection object into a html table representation htmltree element with header as heading if not None.

class armi.bookkeeping.report.newReports.TimeSeries(title, rName, labels, yaxis, fName, caption='', encode=True)[source]

Bases: ReportNode

Handles storing new data point values for use in graphing later.

Parameters:
  • title (String) – Title for eventual graph

  • caption (String) – Eventual graph’s title caption, “” default.

  • labels (List) – list of stored labels where length = number of lines within graph

  • yaxis (String) – label for the y-axis

  • fName (String) – identifier for the resulting image file name (i.e. rName.[fName], where key may be peakDPA.img or Keff.png)

  • rName (Reactor Name for graphs title and file name) –

  • encode (boolean) – Default true, whether to encode the resulting file path in the html.

Example

>>> series = TimeSeries("Plot of K-effective", "plot", ["k-effective"], "k-eff", "keff.png")
>>> time = r.p.time                     # The current time node of the reactor.
>>> data = r.core.p.keff                # The parameter k-effective value at that time.
>>> uncertainty = r.core.p.keffUnc      # The keff-uncontrolled at the current time.
>>> series.add("k-effective", time, data, uncertainty)   # Adds this point to be plotted later.
>>> # Adding to a plot with multiple lines for fuel Burn-Up Plot.
>>> labels = [] # Start collecting labels for the lines to plot...
>>> for a in r.core.getAssemblies(Flags.FUEL):
>>>     if a.p.type not in labels:
>>>         labels.append(a.p.type)
>>> series = TimeSeries("Plot of Burn-Up", r.name, labels, "PeakBU", "bu.png")
>>> maxValue = defaultdict(float)
>>> for a in r.core.getAssemblies(Flags.FUEL):
>>>     maxValue[a.p.type] = max(maxValue[a.p.type], a.p.maxPercentBu)
>>> # Add this data for each assembly type (which will each be it's own line)
>>> for a in r.core.getAssemblies(Flags.FUEL):
>>>     series.add(a.p.type, r.p.time, maxValue[a.p.type], None)
>>>    # (Adding a point for line labeled for this type of fuel,
>>>    # at this time, with the found maxValue, and no uncertainty...)
add(lineToAddTo, time, data, uncertainty=None)[source]

To add a point to our data collection.

Parameters:
  • lineToAddTo (String) – Label associated with the line we are adding ths point to

  • time (float) – time value for the point

  • data (float) – data value for the point

  • uncertainty (float) – uncertainty associated with the point

plot(ymin=None)[source]

To plot a collected TimeSeries.

Parameters:
  • ext (String) – The extension to use on the graph.

  • ymin (float) – The minimum y-value for the graph.

render(level, idPrefix='') HtmlElement[source]

Renders the Timeseries into a graph and places that Image into an html Img tag and returns a div containing that image and the images caption if it has one stored.

class armi.bookkeeping.report.newReports.ReportStage(value)[source]

Bases: Enum

An enumeration.

Begin = 1
Standard = 2
End = 3
armi.bookkeeping.report.newReports.encode64(file_path)[source]

Encodes the contents of the file indicated by the path.

Return type:

String that is the embedded HTML src attribute for an image in base64