Skip to content

Project load path silently discards measured per-point resolution (always PercentageFwhm(5.0)) #368

@rozyczko

Description

@rozyczko

Summary

Project._apply_resolution_function (src/easyreflectometry/project.py:517-531) has a docstring saying the resolution function is chosen "based on variance data in experiment", but the body unconditionally executes:

model.resolution_function = PercentageFwhm(5.0)

The .ort loader reads the sQz column into xe (orso_utils.py:227-232, measurement.py:42) and the Pointwise resolution class exists precisely to use it — but no code path connects them.

Evidence this is a regression, not a decision

tests/test_project.py:669 is still named test_load_experiment_sets_resolution_function_pointwise_when_xe_present, but its body now asserts isinstance(..., PercentageFwhm) with the comment "Resolution is always set to PercentageFwhm". Same for the LinearSpline sibling test (:688). The assertions were weakened to make the suite pass instead of the behavior being fixed. The most recent commit on develop is "Pointwise update (#362)", suggesting an in-flight feature regressed.

Impact

Any user loading reduced data with per-point dQ through Project fits with a flat 5% FWHM resolution regardless of what the instrument delivered. This biases all structural parameters; for high-resolution instruments the model is over-smeared, for relaxed collimation it is under-smeared.

Suggested fix

Restore the variance-driven choice (Pointwise when xe present, LinearSpline/percentage fallback otherwise), and re-strengthen the two tests to assert the resolution type matching their names. Coordinate with the sigma/FWHM convention fix (companion issue).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    [priority] highShould be prioritized soon[scope] bugBug report or fix (major.minor.PATCH)
    No fields configured for issues without a type.

    Projects

    Status
    Bugs

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions