mpylab.env.tem.immunity_report module¶
Report collection and rendering for evaluated TEM/GTEM immunity data.
- exception mpylab.env.tem.immunity_report.ImmunityReportError
Bases:
ValueErrorRaised when an immunity report section cannot be created.
- mpylab.env.tem.immunity_report.collect_immunity_report_data(tem, description)
Collect renderer-neutral immunity exposure or preflight data.
- Parameters:
tem (TEMCell) – Measurement history containing immunity results, preflight data, and optional raw measurement metadata.
description (str) – Dataset key shared by the immunity mappings.
- Returns:
Report mapping containing summary and generic disturbance metadata, reference selection, exposure attempts, effective EUT assessments, incomplete exposures, monitor diagnostics, measurement metadata, and frequency-specific preflight results. Disturbance values retain their stored quantity kind, uncertainty, and unit and are not restricted to electric field strength.
- Return type:
dict
- Raises:
ImmunityReportError – If the dataset is unavailable or contains neither exposure, incomplete-exposure, nor preflight status data.
- mpylab.env.tem.immunity_report.iter_immunity_pdf_figures(report)
Yield figures for the immunity section of a combined PDF.
- Parameters:
report (mapping) – Renderer-neutral immunity report data.
- Yields:
matplotlib.figure.Figure – Summary page followed by available disturbance, power, EUT assessment, leveling, and preflight plots. The caller owns and must close every yielded figure.
- mpylab.env.tem.immunity_report.write_immunity_figures(report, figures_dir, formats=('svg',))
Write standalone immunity figures.
- Parameters:
report (mapping) – Renderer-neutral immunity 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.
- Returns:
Mapping from stable figure names to lists of generated paths. A disturbance plot is produced only when effective values use one common unit. All Matplotlib figures are closed before returning.
- Return type:
dict
- mpylab.env.tem.immunity_report.write_immunity_html(report, output_dir, figure_paths, table_paths)
Write the standalone HTML page for one immunity section.
- Parameters:
report (mapping) – Renderer-neutral immunity report data.
output_dir (path-like) – Existing section directory in which
index.htmlis written.figure_paths (mapping) – Figure-name mapping returned by
write_immunity_figures(). Paths must be located belowoutput_dir.table_paths (mapping) – Table-name mapping returned by
write_immunity_tables(). Paths must be located belowoutput_dir.
- Returns:
Path to the generated
index.htmlpage.- Return type:
pathlib.Path
- mpylab.env.tem.immunity_report.write_immunity_report_data(report, output_dir, formats=('html', 'svg'))
Write one collected immunity report section.
- Parameters:
report (mapping) – Renderer-neutral data returned by
collect_immunity_report_data().output_dir (path-like) – Section destination with generated
tablesandfiguressubdirectories.formats (iterable of str, optional) – Section formats
"html","svg", and"png". HTML without an explicit image format adds SVG assets. A combined PDF is assembled separately fromiter_immunity_pdf_figures().
- Returns:
Generated output directory, table paths, and figure paths, plus the HTML path when requested.
- Return type:
dict
- mpylab.env.tem.immunity_report.write_immunity_tables(report, tables_dir)
Write machine-readable TSV tables for one immunity section.
- Parameters:
report (mapping) – Renderer-neutral data returned by
collect_immunity_report_data().tables_dir (path-like) – Destination directory. It is created when the first table is written.
- Returns:
Mapping from stable table names to paths for summary, exposure attempts, assessments, incomplete exposures, monitor diagnostics, metadata, and preflight results.
- Return type:
dict