mpylab.env.tem.emission_report module¶
Report collection and rendering for evaluated TEM/GTEM emission data.
- exception mpylab.env.tem.emission_report.EmissionReportError
Bases:
ValueErrorRaised when an emission report section cannot be created.
- mpylab.env.tem.emission_report.collect_emission_report_data(tem, description)
Collect renderer-neutral emission evaluation or preflight data.
- Parameters:
tem (TEMCell) – Measurement history containing emission evaluation, preflight, and optional raw detector data.
description (str) – Dataset key shared by the emission mappings.
- Returns:
Report mapping containing summary, e0y source provenance, correlated results, prescreen decisions, detector measurements, and preflight rows. Missing limits remain represented as unassessed results rather than report errors.
- Return type:
dict
- Raises:
EmissionReportError – If neither evaluation nor preflight data exist, or if evaluation data contain no frequency results and no preflight status is available.
- mpylab.env.tem.emission_report.iter_emission_pdf_figures(report)
Yield figures for the emission section of a combined PDF.
- Parameters:
report (mapping) – Renderer-neutral emission report data.
- Yields:
matplotlib.figure.Figure – Summary page followed by available correlated-field, limit-margin, radiated-power, and detector-comparison plots. The caller owns and must close each yielded figure.
- mpylab.env.tem.emission_report.write_emission_figures(report, figures_dir, formats=('svg',))
Write standalone emission figures.
- Parameters:
report (mapping) – Renderer-neutral emission 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. Plots without source data are omitted, and all Matplotlib figures are closed before returning.
- Return type:
dict
- mpylab.env.tem.emission_report.write_emission_html(report, output_dir, figure_paths, table_paths)
Write the standalone HTML page for one emission section.
- Parameters:
report (mapping) – Renderer-neutral emission report data.
output_dir (path-like) – Existing section directory in which
index.htmlis written.figure_paths (mapping) – Figure-name mapping returned by
write_emission_figures(). Paths must be located belowoutput_dir.table_paths (mapping) – Table-name mapping returned by
write_emission_tables(). Paths must be located belowoutput_dir.
- Returns:
Path to the generated
index.htmlpage.- Return type:
pathlib.Path
- mpylab.env.tem.emission_report.write_emission_report_data(report, output_dir, formats=('html', 'svg'))
Write one collected emission report section.
- Parameters:
report (mapping) – Renderer-neutral data returned by
collect_emission_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_emission_pdf_figures().
- Returns:
Generated output directory, table paths, and figure paths, plus the HTML path when requested.
- Return type:
dict
- mpylab.env.tem.emission_report.write_emission_tables(report, tables_dir)
Write machine-readable TSV tables for one emission section.
- Parameters:
report (mapping) – Renderer-neutral data returned by
collect_emission_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, correlated results, prescreen decisions, detector measurements, e0y sources, and preflight data.
- Return type:
dict