Skip to content

added fit configuration owner #427 - #429

Merged
rozyczko merged 2 commits into
developfrom
427-add-fit-settings
Oct 9, 2026
Merged

rozyczko merged 2 commits into
developfrom
427-add-fit-settings

Conversation

@rozyczko

@rozyczko rozyczko commented Oct 8, 2026

Copy link
Copy Markdown
Member

This pull request refactors how fit configuration is managed in the project, centralizing all minimizer and fitting settings into a new FitSettings class.

Fit Configuration Refactor and Centralization:

  • Introduced FitSettings class in fit_settings.py to encapsulate all minimizer selection and configuration, including validation, serialization, and method-specific options.
  • Updated Project to store and use a single FitSettings instance (self._fit_settings) instead of separate minimizer fields. All access to minimizer and fit options now go through this object.
  • Added new property and setter for fit_settings in Project, ensuring any changes are validated and applied to the next fit.
  • Refactored minimizer property and setter in Project to delegate to fit_settings, simplifying the interface and ensuring consistency.

Project Serialization/Deserialization:

  • Changed project serialization to store the full fit configuration under fit_settings (with legacy support for fitter_minimizer), and updated loading to use FitSettings.from_dict, collecting any warnings for the user.
  • Removed the old DEFAULT_MINIMIZER definition from project.py and re-exported it from fit_settings.py for compatibility.

Public API and Fit Preparation:

  • Added a prepare_fit method to Project that prepares a fit using a snapshot of the current fit_settings, supporting advanced workflows and ensuring reproducibility.

@rozyczko rozyczko added [scope] enhancement Adds/improves features (major.MINOR.patch) [scope] maintenance Code/tooling cleanup, no feature or bugfix (major.minor.PATCH) [priority] high Should be prioritized soon enhancement labels Oct 8, 2026
@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.98489% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.13%. Comparing base (64b4f45) to head (f43a234).

Files with missing lines Patch % Lines
src/easyreflectometry/project.py 89.74% 4 Missing ⚠️
src/easyreflectometry/fit_settings.py 98.85% 2 Missing ⚠️
src/easyreflectometry/fitting.py 98.91% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #429      +/-   ##
===========================================
+ Coverage    95.05%   95.13%   +0.08%     
===========================================
  Files           55       56       +1     
  Lines         6006     6249     +243     
===========================================
+ Hits          5709     5945     +236     
- Misses         297      304       +7     
Flag Coverage Δ
integration 38.29% <45.34%> (+0.89%) ⬆️
unittests 95.13% <97.98%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/easyreflectometry/fit_settings.py 98.85% <98.85%> (ø)
src/easyreflectometry/fitting.py 99.09% <98.91%> (-0.40%) ⬇️
src/easyreflectometry/project.py 94.65% <89.74%> (-0.19%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rozyczko
rozyczko merged commit 2febb08 into develop Oct 9, 2026
55 checks passed
@rozyczko
rozyczko deleted the 427-add-fit-settings branch October 9, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement [priority] high Should be prioritized soon [scope] enhancement Adds/improves features (major.MINOR.patch) [scope] maintenance Code/tooling cleanup, no feature or bugfix (major.minor.PATCH)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant