Skip to content

Core fixes - #383

Merged
rozyczko merged 10 commits into
developfrom
core_fixes
Jul 30, 2026
Merged

Core fixes#383
rozyczko merged 10 commits into
developfrom
core_fixes

Conversation

@rozyczko

Copy link
Copy Markdown
Member

This pull request refactors the MCMC sampling interface in easyreflectometry to use the new core Sampler class instead of the older MultiFitter.mcmc_sample() method. The migration improves API clarity and aligns with upstream changes in the easyscience dependency. The tests have been updated to mock and verify the new Sampler-based workflow, ensuring parameter forwarding, result handling, and proper integration. Documentation has also been updated to reflect these changes.

Core API migration

  • Updated the MCMC sampling implementation in fitting.py to use the core Sampler class for sampling, replacing direct calls to MultiFitter.mcmc_sample(). The new approach constructs a Sampler and calls its sample() method, forwarding all relevant parameters and returning a standardized result dictionary.
  • Updated the dependency in pyproject.toml to use the bayesian_extend branch of easyscience, which provides the new Sampler API.

Documentation updates

  • Updated docstrings in bayesian.py to reference the new Sampler API and its methods for extending chains, instead of the deprecated MultiFitter.mcmc_sample().

Test suite modernization

  • Refactored tests in test_fitting.py to mock and patch the new Sampler class, verifying that parameters are correctly forwarded and results are handled as expected. Removed mocks and references to the old mcmc_sample method, and added helpers to simulate Sampler behavior.
  • Added import for patch from unittest.mock to facilitate mocking of the Sampler class in tests.

API surface

  • Added direct import of Sampler in fitting.py to support the new sampling workflow.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request does not contain a valid label. Please add one of the following labels: ['chore', 'fix', 'bugfix', 'bug', 'enhancement', 'feature', 'dependencies', 'documentation']

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.13%. Comparing base (90fed4f) to head (c50fd8b).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##           develop     #383       +/-   ##
============================================
+ Coverage     0.00%   51.13%   +51.13%     
============================================
  Files           42       48        +6     
  Lines         3573     3849      +276     
============================================
+ Hits             0     1968     +1968     
+ Misses        3573     1881     -1692     
Flag Coverage Δ
integration 31.61% <27.39%> (+31.61%) ⬆️
unittests 50.01% <95.89%> (+50.01%) ⬆️

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

Files with missing lines Coverage Δ
src/easyreflectometry/analysis/bayesian.py 13.80% <ø> (+13.80%) ⬆️
...c/easyreflectometry/calculators/calculator_base.py 87.80% <100.00%> (+87.80%) ⬆️
src/easyreflectometry/calculators/factory.py 88.23% <100.00%> (+88.23%) ⬆️
...rc/easyreflectometry/calculators/refl1d/wrapper.py 63.72% <ø> (ø)
src/easyreflectometry/calculators/refnx/wrapper.py 85.48% <100.00%> (ø)
src/easyreflectometry/fitting.py 52.38% <100.00%> (+52.38%) ⬆️
src/easyreflectometry/limits.py 96.15% <100.00%> (+96.15%) ⬆️
src/easyreflectometry/model/model.py 68.46% <100.00%> (+68.46%) ⬆️
...rc/easyreflectometry/model/resolution_functions.py 82.35% <100.00%> (+82.35%) ⬆️
src/easyreflectometry/project.py 49.45% <100.00%> (+49.45%) ⬆️
... and 4 more

... and 32 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rozyczko rozyczko added [scope] bug Bug report or fix (major.minor.PATCH) bugfix Fix to known bug [priority] high Should be prioritized soon labels Jun 19, 2026
rozyczko added 8 commits July 16, 2026 12:42
* fixed issue #367

* disable automatic parallelization for windows

* Changes after code review

* added test

* arviz fix

* try to fix prettier issues
* fixed pointwise treatment on file load
@rozyczko
rozyczko merged commit 01c07d5 into develop Jul 30, 2026
57 of 64 checks passed
@rozyczko
rozyczko deleted the core_fixes branch August 14, 2026 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fix to known bug [priority] high Should be prioritized soon [scope] bug Bug report or fix (major.minor.PATCH)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant