Skip to content

Core fixes#383

Open
rozyczko wants to merge 5 commits into
developfrom
core_fixes
Open

Core fixes#383
rozyczko wants to merge 5 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

❌ Patch coverage is 68.42105% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 31.66%. Comparing base (a472411) to head (5cb7b9d).

Files with missing lines Patch % Lines
src/easyreflectometry/fitting.py 33.33% 6 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##           develop     #383       +/-   ##
============================================
+ Coverage     0.00%   31.66%   +31.66%     
============================================
  Files           42       48        +6     
  Lines         3578     3840      +262     
============================================
+ Hits             0     1216     +1216     
+ Misses        3578     2624      -954     
Flag Coverage Δ
integration 31.66% <68.42%> (+31.66%) ⬆️
unittests 0.00% <0.00%> (ø)

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%) ⬆️
...rc/easyreflectometry/calculators/refl1d/wrapper.py 63.72% <ø> (ø)
src/easyreflectometry/calculators/refnx/wrapper.py 80.64% <100.00%> (ø)
...rc/easyreflectometry/model/resolution_functions.py 80.39% <100.00%> (+80.39%) ⬆️
src/easyreflectometry/fitting.py 17.33% <33.33%> (+17.33%) ⬆️

... and 38 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 3 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
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