mpylab.env.tem.history_report module

Build modular reports from the complete history stored in a TEMCell pickle.

class mpylab.env.tem.history_report.E0yReportModule

Bases: object

Expose evaluated e0y data through the modular report interface.

collect(tem, selection)

Collect selected e0y data for neutral rendering.

Parameters:
  • tem (TEMCell) – Measurement history containing the data set.

  • selection (ReportSelection) – E0y data set to collect.

Returns:

Renderer-neutral e0y report data.

Return type:

dict

discover(tem)

Return reportable e0y data sets in a TEM history.

Parameters:

tem (TEMCell) – Measurement history to inspect.

Returns:

Available e0y report sections.

Return type:

list of ReportSelection

key = 'e0y'
pdf_figures(report)

Return e0y figures for the combined PDF report.

Parameters:

report (mapping) – Renderer-neutral e0y report data.

Returns:

E0y figures in report order.

Return type:

iterable of matplotlib.figure.Figure

summary(report)

Return compact e0y fields for the report index.

Parameters:

report (mapping) – Renderer-neutral e0y report data.

Returns:

E0y source, method, and frequency range.

Return type:

dict

title = 'TEM/GTEM e0y field factor'
write(report, output_dir, formats)

Write e0y assets in the requested output formats.

Parameters:
  • report (mapping) – Renderer-neutral e0y report data.

  • output_dir (path-like) – Destination directory for the section.

  • formats (iterable of str) – Requested output formats.

Returns:

Paths and metadata for generated assets.

Return type:

dict

class mpylab.env.tem.history_report.EmissionReportModule

Bases: object

Expose evaluated TEM/GTEM emission data as a report section.

collect(tem, selection)

Collect selected emission data for neutral rendering.

Parameters:
  • tem (TEMCell) – Measurement history containing the data set.

  • selection (ReportSelection) – Emission data set to collect.

Returns:

Renderer-neutral emission report data.

Return type:

dict

discover(tem)

Return reportable emission data sets in a TEM history.

Parameters:

tem (TEMCell) – Measurement history to inspect.

Returns:

Available emission report sections.

Return type:

list of ReportSelection

key = 'emission'
pdf_figures(report)

Return emission figures for the combined PDF report.

Parameters:

report (mapping) – Renderer-neutral emission report data.

Returns:

Emission figures in report order.

Return type:

iterable of matplotlib.figure.Figure

summary(report)

Return compact emission fields for the report index.

Parameters:

report (mapping) – Renderer-neutral emission report data.

Returns:

Emission summary fields.

Return type:

dict

title = 'TEM/GTEM emission'
write(report, output_dir, formats)

Write emission assets in the requested output formats.

Parameters:
  • report (mapping) – Renderer-neutral emission report data.

  • output_dir (path-like) – Destination directory for the section.

  • formats (iterable of str) – Requested output formats.

Returns:

Paths and metadata for generated assets.

Return type:

dict

exception mpylab.env.tem.history_report.HistoryReportError

Bases: ValueError

Raised when a modular TEM history report cannot be created.

class mpylab.env.tem.history_report.ImmunityReportModule

Bases: object

Expose evaluated TEM/GTEM immunity data as a report section.

collect(tem, selection)

Collect selected immunity data for neutral rendering.

Parameters:
  • tem (TEMCell) – Measurement history containing the data set.

  • selection (ReportSelection) – Immunity data set to collect.

Returns:

Renderer-neutral immunity report data.

Return type:

dict

discover(tem)

Return reportable immunity data sets in a TEM history.

Parameters:

tem (TEMCell) – Measurement history to inspect.

Returns:

Available immunity report sections.

Return type:

list of ReportSelection

key = 'immunity'
pdf_figures(report)

Return immunity figures for the combined PDF report.

Parameters:

report (mapping) – Renderer-neutral immunity report data.

Returns:

Immunity figures in report order.

Return type:

iterable of matplotlib.figure.Figure

summary(report)

Return compact immunity fields for the report index.

Parameters:

report (mapping) – Renderer-neutral immunity report data.

Returns:

Immunity summary fields.

Return type:

dict

title = 'TEM/GTEM immunity'
write(report, output_dir, formats)

Write immunity assets in the requested output formats.

Parameters:
  • report (mapping) – Renderer-neutral immunity report data.

  • output_dir (path-like) – Destination directory for the section.

  • formats (iterable of str) – Requested output formats.

Returns:

Paths and metadata for generated assets.

Return type:

dict

class mpylab.env.tem.history_report.ReportModule(*args, **kwargs)

Bases: Protocol

Interface implemented by modular TEM history-report sections.

collect(tem, selection)

Collect one selected data set into a renderer-neutral mapping.

Parameters:
  • tem (TEMCell) – Measurement history containing the selected data set.

  • selection (ReportSelection) – Data set selected for reporting.

Returns:

Renderer-neutral report data.

Return type:

dict

discover(tem)

Return the module’s available report selections.

Parameters:

tem (TEMCell) – Measurement history to inspect.

Returns:

Reportable data sets owned by this module.

Return type:

list of ReportSelection

key: str
pdf_figures(report)

Return figures to append to the combined PDF.

Parameters:

report (mapping) – Renderer-neutral data returned by collect().

Returns:

Figures in report order.

Return type:

iterable of matplotlib.figure.Figure

summary(report)

Return compact fields for the report index and cover.

Parameters:

report (mapping) – Renderer-neutral data returned by collect().

Returns:

Module-specific summary fields.

Return type:

dict

title: str
write(report, output_dir, formats)

Write the module’s standalone report assets.

Parameters:
  • report (mapping) – Renderer-neutral data returned by collect().

  • output_dir (path-like) – Destination directory for this report section.

  • formats (iterable of str) – Requested output formats.

Returns:

Paths and metadata for the generated assets.

Return type:

dict

class mpylab.env.tem.history_report.ReportSelection(module_key: str, dataset_key: str, title: str)

Bases: object

Identify one reportable data set in a measurement history.

dataset_key: str
property identifier

Return the stable module:dataset selection identifier.

module_key: str
title: str
class mpylab.env.tem.history_report.VerificationReportModule

Bases: object

Adapter exposing verification reports through the modular interface.

collect(tem, selection)

Collect selected verification data for neutral rendering.

Parameters:
  • tem (TEMCell) – Measurement history containing the data set.

  • selection (ReportSelection) – Verification data set to collect.

Returns:

Renderer-neutral verification report data.

Return type:

dict

discover(tem)

Return reportable verification data sets in a TEM history.

Parameters:

tem (TEMCell) – Measurement history to inspect.

Returns:

Available verification report sections.

Return type:

list of ReportSelection

key = 'verification'
pdf_figures(report)

Return verification figures for the combined PDF report.

Parameters:

report (mapping) – Renderer-neutral verification report data.

Returns:

Verification figures in report order.

Return type:

iterable of matplotlib.figure.Figure

summary(report)

Return compact verification fields for the report index.

Parameters:

report (mapping) – Renderer-neutral verification report data.

Returns:

Verification status and frequency range.

Return type:

dict

title = 'TEM-mode verification'
write(report, output_dir, formats)

Write verification assets in the requested output formats.

Parameters:
  • report (mapping) – Renderer-neutral verification report data.

  • output_dir (path-like) – Destination directory for the section.

  • formats (iterable of str) – Requested output formats.

Returns:

Paths and metadata for generated assets.

Return type:

dict

mpylab.env.tem.history_report.discover_report_sections(tem, modules=(<mpylab.env.tem.history_report.VerificationReportModule object>, <mpylab.env.tem.history_report.E0yReportModule object>, <mpylab.env.tem.history_report.EmissionReportModule object>, <mpylab.env.tem.history_report.ImmunityReportModule object>))

Return all reportable sections discovered in a TEMCell history.

Parameters:
  • tem (TEMCell) – Measurement history to inspect.

  • modules (iterable of ReportModule, optional) – Report modules participating in discovery.

Returns:

Available report sections.

Return type:

list of ReportSelection

mpylab.env.tem.history_report.main(argv=None)

Run the TEM history report command.

Parameters:

argv (sequence of str, optional) – Arguments without the program name. sys.argv is used by default.

Returns:

Process exit code: zero on success, one for report input errors.

Return type:

int

mpylab.env.tem.history_report.parse_args(argv=None)

Parse command-line arguments for the modular TEM report generator.

Parameters:

argv (sequence of str, optional) – Arguments without the program name. sys.argv is used by default.

Returns:

Parsed command-line options.

Return type:

argparse.Namespace

mpylab.env.tem.history_report.select_report_sections(tem, identifiers=None, modules=(<mpylab.env.tem.history_report.VerificationReportModule object>, <mpylab.env.tem.history_report.E0yReportModule object>, <mpylab.env.tem.history_report.EmissionReportModule object>, <mpylab.env.tem.history_report.ImmunityReportModule object>))

Resolve optional module:dataset identifiers against the history.

Parameters:
  • tem (TEMCell) – Measurement history to inspect.

  • identifiers (iterable of str, optional) – Selection identifiers. All available sections are selected by default.

  • modules (iterable of ReportModule, optional) – Report modules participating in discovery.

Returns:

Selected report sections in requested order.

Return type:

list of ReportSelection

mpylab.env.tem.history_report.write_history_report(tem, output_dir='tem-history-report', formats=('pdf', 'html', 'svg'), section_identifiers=None, modules=(<mpylab.env.tem.history_report.VerificationReportModule object>, <mpylab.env.tem.history_report.E0yReportModule object>, <mpylab.env.tem.history_report.EmissionReportModule object>, <mpylab.env.tem.history_report.ImmunityReportModule object>), profile=None)

Create a modular report package from a TEMCell history object.

Parameters:
  • tem (TEMCell) – Measurement history to report.

  • output_dir (path-like, optional) – Destination directory for the report package.

  • formats (iterable of str, optional) – Any combination of "pdf", "html", "svg", and "png".

  • section_identifiers (iterable of str, optional) – module:dataset identifiers to include. All are included by default.

  • modules (iterable of ReportModule, optional) – Report modules available to the generator.

  • profile (path-like, mapping, or iterable, optional) – Report profile input accepted by resolve_report_profile().

Returns:

Generated section data, traceability information, and output paths.

Return type:

dict