Skip to content

Mighell transform#303

Open
rozyczko wants to merge 6 commits intodevelopfrom
mighell_transform
Open

Mighell transform#303
rozyczko wants to merge 6 commits intodevelopfrom
mighell_transform

Conversation

@rozyczko
Copy link
Member

This pull request introduces Mighell-based handling of zero-variance data points in the fitting routines. Instead of discarding zero-variance points, the new implementation allows for a hybrid objective that applies the Mighell substitution only to zero-variance points, while using standard weighted least squares elsewhere. The previous masking behavior remains available, and users can now select the objective mode via a new parameter on MultiFitter, fit(), and fit_single_data_set_1d().

New objective modes and Mighell handling:

  • Added new objective modes ('hybrid', 'mighell', 'legacy_mask', 'auto') for handling zero-variance points, with 'hybrid' as the default. The Mighell-based approach substitutes only zero-variance points or, if selected, all points, improving fitting robustness and flexibility. (src/easyreflectometry/fitting.py, [1] [2]
  • Implemented _prepare_fit_arrays to transform data according to the selected objective, and updated fitting routines to use this function. (src/easyreflectometry/fitting.py, [1] [2]
  • Added warnings to inform users when Mighell substitutions or masking are applied during fitting. (src/easyreflectometry/fitting.py, src/easyreflectometry/fitting.pyL35-R313)

Fit statistics and API improvements:

  • Added calculation and storage of both classical and objective-space chi-squared statistics, with new properties (classical_chi2, classical_reduced_chi, objective_chi2, objective_reduced_chi) for easy access. (src/easyreflectometry/fitting.py, src/easyreflectometry/fitting.pyR338-R364)
  • Extended fit() and fit_single_data_set_1d() methods to accept an objective parameter for per-call override of the zero-variance handling strategy. (src/easyreflectometry/fitting.py, src/easyreflectometry/fitting.pyL35-R313)

Documentation and workflow:

  • Added a detailed MIGHELL_IMPLEMENTATION.md documenting the Mighell objective, its mathematical basis, and its practical implications in reflectometry fitting. (MIGHELL_IMPLEMENTATION.md, MIGHELL_IMPLEMENTATION.mdR1-R113)
  • Updated the changelog to describe the new Mighell-based handling and API changes. (CHANGELOG.md, CHANGELOG.mdR1-R9)
  • Relaxed CI workflow to not fail on Codecov upload errors. (.github/workflows/python-ci.yml, .github/workflows/python-ci.ymlL64-R64)

@rozyczko rozyczko added [scope] enhancement Adds/improves features (major.MINOR.patch) [priority] medium Normal/default priority enhancement labels Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement [priority] medium Normal/default priority [scope] enhancement Adds/improves features (major.MINOR.patch)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant