Skip to content

report

Project report facade.

Modules:

Name Description
data_context

Build shared data for report renderers.

enums

Enumeration types used by report components.

fit_plot

Shared report styling for fit-quality figures.

html_renderer

Render project reports as HTML.

pdf_compiler

Compile LaTeX report bundles into PDF reports.

style

Shared visual constants for generated reports.

tex_renderer

Render project reports as LaTeX source bundles.

Functions:

Name Description
__getattr__

Load report objects that would otherwise form import cycles.

Functions

__getattr__(name)

Load report objects that would otherwise form import cycles.

Modules

data_context

Build shared data for report renderers.

Classes:

Name Description
ReportDataContext

Build renderer-neutral report data from a project.

Functions:

Name Description
build_report_data_context

Build renderer-neutral report data from a project.

Classes

ReportDataContext(project)

Build renderer-neutral report data from a project.

Parameters:

Name Type Description Default
project object

Project facade that owns structures, experiments, and analysis.

required

Methods:

Name Description
build

Return the full report data context.

Functions
build()

Return the full report data context.

Returns:

Type Description
dict[str, object]

Renderer-neutral data consumed by terminal, HTML, TeX, and GUI report surfaces.

Functions

build_report_data_context(project)

Build renderer-neutral report data from a project.

Parameters:

Name Type Description Default
project object

Project facade to summarize.

required

Returns:

Type Description
dict[str, object]

Data context shared by all report renderers.

enums

Enumeration types used by report components.

Classes:

Name Description
ReportFormatEnum

Report output format.

Classes

ReportFormatEnum

Report output format.

fit_plot

Shared report styling for fit-quality figures.

Functions:

Name Description
fit_plot_styles

Return Plotly-derived series styles for report figures.

fit_plot_ranges

Return explicit x and main-intensity y ranges for fit figures.

fit_plot_geometry

Return Plotly-matched pgfplots axis geometry.

fit_bragg_tick_styles

Return Plotly-derived Bragg tick colors for pgfplots.

fit_plot_axis_styles

Return Plotly-derived axis colors for report figures.

fit_scatter_geometry

Return pgfplots geometry for the single-crystal scatter plot.

fit_scatter_ranges

Return the shared x/y range, tick step, and y=x diagonal span.

fit_scatter_style

Return the marker style for the single-crystal scatter plot.

Functions

fit_plot_styles()

Return Plotly-derived series styles for report figures.

fit_plot_ranges(fit_data)

Return explicit x and main-intensity y ranges for fit figures.

fit_plot_geometry(fit_data)

Return Plotly-matched pgfplots axis geometry.

Row heights are anchored to the reference three-row layout so the main and residual panels keep a fixed centimetre height; the axis stack grows or shrinks with the rows shown, matching the interactive composite figure.

fit_bragg_tick_styles()

Return Plotly-derived Bragg tick colors for pgfplots.

fit_plot_axis_styles()

Return Plotly-derived axis colors for report figures.

fit_scatter_geometry()

Return pgfplots geometry for the single-crystal scatter plot.

fit_scatter_ranges(fit_data)

Return the shared x/y range, tick step, and y=x diagonal span.

The x and y axes share one range (computed across the calculated values and the measured values widened by their uncertainties) so the diagonal is a true y=x line and the ticks can match.

fit_scatter_style()

Return the marker style for the single-crystal scatter plot.

html_renderer

Render project reports as HTML.

Functions:

Name Description
html_report_path

Return the target HTML report path for a project.

render_html_report

Render a report data context as HTML.

save_html_report

Write an HTML report and any required local assets.

Classes

Functions

html_report_path(project, path=None)

Return the target HTML report path for a project.

Parameters:

Name Type Description Default
project object

Project instance.

required
path str | pathlib.Path | None

Explicit report path.

None

Returns:

Type Description
pathlib.Path

Resolved report path.

Raises:

Type Description
FileNotFoundError

If no path is supplied and the project has not been saved.

render_html_report(context, *, offline=False, project=None)

Render a report data context as HTML.

Parameters:

Name Type Description Default
context dict[str, object]

Data returned by Report.data_context().

required
offline bool

Whether Plotly figures should embed JavaScript assets.

False
project object | None

Live project used to build interactive 3D structure figures. When None, the report omits structure views.

None

Returns:

Type Description
str

Complete HTML document.

save_html_report(project, context, *, offline=False, path=None)

Write an HTML report and any required local assets.

Parameters:

Name Type Description Default
project object

Project instance.

required
context dict[str, object]

Data returned by Report.data_context().

required
offline bool

Whether local HTML assets should be copied next to the report.

False
path str | pathlib.Path | None

Explicit report path.

None

Returns:

Type Description
pathlib.Path

Path of the written HTML report.

pdf_compiler

Compile LaTeX report bundles into PDF reports.

Functions:

Name Description
save_pdf_report

Write a TeX bundle and compile it to PDF when possible.

compile_pdf_report

Compile an existing TeX report bundle into a PDF report.

Functions

save_pdf_report(project, context)

Write a TeX bundle and compile it to PDF when possible.

Parameters:

Name Type Description Default
project object

Project instance.

required
context dict[str, object]

Data returned by Report.data_context().

required

Returns:

Type Description
pathlib.Path

Path of the PDF report, or the intended PDF path when no TeX engine is available.

compile_pdf_report(tex_path)

Compile an existing TeX report bundle into a PDF report.

TeX compilation failures propagate from the lower-level compiler helper as RuntimeError.

Parameters:

Name Type Description Default
tex_path pathlib.Path

Path of the written main TeX document.

required

Returns:

Type Description
pathlib.Path

Path of the PDF report, or the intended PDF path when no TeX engine is available.

style

Shared visual constants for generated reports.

Functions:

Name Description
report_style_context

Return shared visual constants for report templates.

Functions

report_style_context()

Return shared visual constants for report templates.

tex_renderer

Render project reports as LaTeX source bundles.

Functions:

Name Description
tex_report_path

Return the target TeX report path for a project.

render_tex_report

Render a report data context as LaTeX.

save_tex_report

Write a TeX report bundle.

Functions

tex_report_path(project, path=None)

Return the target TeX report path for a project.

Parameters:

Name Type Description Default
project object

Project instance.

required
path str | pathlib.Path | None

Explicit report path.

None

Returns:

Type Description
pathlib.Path

Resolved report path.

Raises:

Type Description
FileNotFoundError

If no path is supplied and the project has not been saved.

render_tex_report(context)

Render a report data context as LaTeX.

Parameters:

Name Type Description Default
context dict[str, object]

Data returned by Report.data_context().

required

Returns:

Type Description
str

Complete LaTeX document.

save_tex_report(project, context, *, path=None)

Write a TeX report bundle.

Parameters:

Name Type Description Default
project object

Project instance.

required
context dict[str, object]

Data returned by Report.data_context().

required
path str | pathlib.Path | None

Explicit report path.

None

Returns:

Type Description
pathlib.Path

Path of the written main TeX document.