Skip to content

observables: honor documented LBVelocityProfile optional defaults (bug-sweep #52)#5375

Draft
RudolfWeeber wants to merge 1 commit into
espressomd:pythonfrom
RudolfWeeber:fix/bug-52-lbvelocityprofile-defaults
Draft

observables: honor documented LBVelocityProfile optional defaults (bug-sweep #52)#5375
RudolfWeeber wants to merge 1 commit into
espressomd:pythonfrom
RudolfWeeber:fix/bug-52-lbvelocityprofile-defaults

Conversation

@RudolfWeeber

Copy link
Copy Markdown
Contributor

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

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant