observables: honor documented LBVelocityProfile optional defaults (bug-sweep #52)#5375
Draft
RudolfWeeber wants to merge 1 commit into
Draft
Conversation
…g-sweep #52) LBProfileObservable::do_construct built the core observable via make_shared_from_args, which resolves every parameter with get_value and throws "Parameter '...' is missing." when an optional one is omitted. The sampling_delta_*/sampling_offset_*/allow_empty_bins parameters are documented as optional with concrete defaults (1.0/0.0/False), so following the documented API (e.g. LBVelocityProfile(n_x_bins=..., min_x=..., max_x=..., ...)) raised a RuntimeError instead of constructing the observable. Construct the observable explicitly with std::make_shared, using get_value_or to supply the documented defaults for the seven optional parameters while keeping get_value for the required n_*_bins / min_* / max_*. This mirrors the convention already used by the cylindrical profile observables. Added a regression test in testsuite/python/observables.py that constructs LBVelocityProfile relying on the defaults and asserts the read-only getters return them, plus a round-trip check with explicit values. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LBProfileObservable::do_construct built the core observable via
make_shared_from_args, which resolves every parameter with get_value and
throws "Parameter '...' is missing." when an optional one is omitted. The
sampling_delta_/sampling_offset_/allow_empty_bins parameters are documented
as optional with concrete defaults (1.0/0.0/False), so following the documented
API (e.g. LBVelocityProfile(n_x_bins=..., min_x=..., max_x=..., ...)) raised a
RuntimeError instead of constructing the observable.
Construct the observable explicitly with std::make_shared, using get_value_or
to supply the documented defaults for the seven optional parameters while
keeping get_value for the required n_bins / min / max_*. This mirrors the
convention already used by the cylindrical profile observables. Added a
regression test in testsuite/python/observables.py that constructs
LBVelocityProfile relying on the defaults and asserts the read-only getters
return them, plus a round-trip check with explicit values.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
🤖 Generated with Claude Code