Skip to content

Core fixes#383

Open
rozyczko wants to merge 2 commits into
developfrom
core_fixes
Open

Core fixes#383
rozyczko wants to merge 2 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 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (a472411) to head (0f9e6e5).

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

Impacted file tree graph

@@           Coverage Diff           @@
##           develop    #383   +/-   ##
=======================================
  Coverage     0.00%   0.00%           
=======================================
  Files           42      42           
  Lines         3578    3581    +3     
=======================================
- Misses        3578    3581    +3     
Flag Coverage Δ
integration 0.00% <0.00%> (ø)
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 0.00% <ø> (ø)
src/easyreflectometry/fitting.py 0.00% <0.00%> (ø)
🚀 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
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