mpylab.env.tem.verification_report module

Create reports for GTEM/TEM-mode verification results.

exception mpylab.env.tem.verification_report.VerificationReportError

Bases: ValueError

Raised when a verification report cannot be created.

mpylab.env.tem.verification_report.collect_verification_report_data(tem, description, include_related_e0y=True)

Collect renderer-neutral data for a TEM-mode verification report.

include_related_e0y preserves the standalone report’s historical e0y overview. Modular history reports disable it because e0y has its own section there.

Parameters:
  • tem (TEMCell) – Measurement history containing evaluated verification data.

  • description (str) – Key in tem.processedData_Verification.

  • include_related_e0y (bool, optional) – Include summaries of all separately evaluated e0y datasets. Set this to false when e0y is rendered as an independent history-report section.

Returns:

Renderer-neutral report mapping containing summary, target, geometry, uniform-area, per-frequency, per-point, exception, immunity-reference, AM-headroom, and optional measured-e0y data.

Return type:

dict

Raises:

VerificationReportError – If description is unavailable or its evaluated result contains no frequency data.

mpylab.env.tem.verification_report.iter_verification_pdf_figures(report)

Yield figures forming a verification PDF section.

Parameters:

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

Yields:

matplotlib.figure.Figure – Summary page followed by the verification plots in report order. The caller owns each yielded figure and must close it.

mpylab.env.tem.verification_report.write_verification_figures(report, figures_dir, formats=('svg',))

Write standalone verification figures.

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

  • figures_dir (path-like) – Destination directory. It is created when necessary.

  • formats (iterable of str, optional) – Requested image formats. Only "svg" and "png" create files; other values are ignored by this image writer.

Returns:

Mapping from stable figure names to lists of created paths, one per supported requested format. All Matplotlib figures are closed before this function returns.

Return type:

dict

mpylab.env.tem.verification_report.write_verification_html(report, output_dir, figure_paths, table_paths)

Write the standalone static HTML verification report.

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

  • output_dir (path-like) – Existing report directory in which index.html is written.

  • figure_paths (mapping) – Figure-name mapping returned by write_verification_figures(). Paths must be located below output_dir.

  • table_paths (mapping) – Table-name mapping returned by write_verification_tables(). Paths must be located below output_dir.

Returns:

Path to the generated index.html file.

Return type:

pathlib.Path

mpylab.env.tem.verification_report.write_verification_pdf(report, pdf_path)

Write a multi-page standalone verification PDF.

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

  • pdf_path (path-like) – Destination PDF. Missing parent directories are created.

Returns:

Path to the generated PDF. Figures yielded during generation are closed after being written.

Return type:

pathlib.Path

mpylab.env.tem.verification_report.write_verification_report(tem, description='cal', output_dir=None, formats=('pdf', 'html', 'svg'))

Collect and write a standalone TEM-mode verification report.

Parameters:
  • tem (TEMCell) – Measurement history containing evaluated verification data.

  • description (str, optional) – Key in tem.processedData_Verification.

  • output_dir (path-like or None, optional) – Package destination. None derives a safe directory name from the description.

  • formats (iterable of str, optional) – Requested output formats accepted by write_verification_report_data().

Returns:

Paths and metadata for the generated standalone report package.

Return type:

dict

Raises:

VerificationReportError – If the selected verification result is unavailable or empty.

mpylab.env.tem.verification_report.write_verification_report_data(report, output_dir, formats=('pdf', 'html', 'svg'))

Write a complete package from collected verification report data.

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

  • output_dir (path-like) – Package destination. The function creates tables and figures subdirectories below it.

  • formats (iterable of str, optional) – Any combination of "pdf", "html", "svg", and "png". Tables are always written. HTML or PDF without an explicit image format additionally produces SVG assets.

Returns:

Generated output_dir, table paths, and figure paths, plus html and pdf paths when those formats were requested.

Return type:

dict

mpylab.env.tem.verification_report.write_verification_tables(report, tables_dir)

Write the verification report’s machine-readable TSV tables.

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

  • tables_dir (path-like) – Destination directory. It is created when necessary.

Returns:

Mapping from stable table names to written pathlib.Path objects. Tables cover the summary, reference data, exceptions, immunity references, AM headroom, e0y comparisons, and point data.

Return type:

dict