Skip to content

HTML summary goodness-of-fit is always 'N/A' — Project._last_fit_results is never written #375

@rozyczko

Description

@rozyczko

Summary

src/easyreflectometry/summary/summary.py:317 reads getattr(self._project, '_last_fit_results', None), but nothing in the codebase ever sets _last_fit_results (verified by grep over src/). _compute_goodness_of_fit therefore always returns 'N/A' in the generated report. The fit results live on Project.fitter / MultiFitter but were never wired to the attribute the summary reads.

Even if wired, the single-result branch reads .reduced_chi2, while fitting.py:152 deliberately probes both reduced_chi and reduced_chi2 because the attribute name varies across minimizers — the summary needs the same dual probe.

Suggested fix

Have the fit path store results on the project (or have the summary read them from project.fitter), apply the dual attribute probe, and add a test asserting a non-'N/A' goodness-of-fit after a successful fit.

Related cosmetic: template token num_constriants (sic) in summary/html_templates.py:144 / summary.py:312.

Found during deep code review (DEEP_ANALYSIS.md §5.9).

Metadata

Metadata

Assignees

No one assigned

    Labels

    [priority] mediumNormal/default priority[scope] bugBug report or fix (major.minor.PATCH)
    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions