Skip to content

Comments

feat(curve, waveform): add dap_parameters for lmfit customization in DAP requests#987

Open
wyzula-jan wants to merge 2 commits intopre_release_v3from
fix/dap-custom-params
Open

feat(curve, waveform): add dap_parameters for lmfit customization in DAP requests#987
wyzula-jan wants to merge 2 commits intopre_release_v3from
fix/dap-custom-params

Conversation

@wyzula-jan
Copy link
Contributor

@wyzula-jan wyzula-jan commented Dec 15, 2025

Description

Extend the Waveform widget DAP integration to allow passing lmfit parameter overrides/fixed values from the GUI/API into the backend fit service. Waveform.plot() and Waveform.add_dap_curve() now accept dap_parameters (dict or lmfit.Parameters) which are serialized into the DAP request and applied server-side for any lmfit model (including SineModel). The server now merges partial overrides with model.make_params() so users can provide only a subset of parameters without triggering “Missing parameters” errors. Added server-side logging to make configuration and fit failures easier to debug, and expanded the Waveform demo launch script with examples of all supported parameter formats.

Has to be reviewed together with bec-project/bec#707

Type of Change

  • Add dap_parameters passthrough and storage on DAP curves (Waveform.plot/add_dap_curve → DAP
    request).
  • Generalize backend parameter handling to accept partial overrides for all lmfit models (merge with
    defaults, filter unknown names) and improve fit/config logging.
  • Multiple LMFitModels can be used for one DAP curve

How to test

  • Launch the Waveform demo (bec_widgets/bec_widgets/widgets/plots/waveform/waveform.py) and verify:
  • Gaussian fits work with no params, easy dict ({"amplitude": 1.0}), lmfit-style dict, and
    lmfit.Parameters.
  • Try to use the rpc to set dap_params

@wyzula-jan wyzula-jan self-assigned this Dec 15, 2025
Copilot AI review requested due to automatic review settings December 15, 2025 22:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for customizing lmfit parameters in DAP (Data Analysis Pipeline) requests, allowing users to override default fitting parameters when creating DAP curves for waveform plots.

Key changes:

  • Added dap_parameters parameter to plot() and add_dap_curve() methods, accepting dict or lmfit.Parameters
  • Implemented _normalize_dap_parameters() method to serialize various parameter formats for the DAP server
  • Modified request_dap() to include normalized parameters in DAP request messages
  • Extended DeviceSignal model to store dap_parameters

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
bec_widgets/widgets/plots/waveform/waveform.py Added dap_parameters support throughout the waveform plotting API, including parameter normalization logic and updated DAP request handling. Includes demo examples showing different parameter input formats.
bec_widgets/widgets/plots/waveform/curve.py Extended DeviceSignal model with optional dap_parameters field to store serialized parameters.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@wyzula-jan wyzula-jan force-pushed the fix/dap-custom-params branch from c3c2440 to 6713321 Compare December 15, 2025 22:06
@codecov
Copy link

codecov bot commented Dec 15, 2025

Codecov Report

❌ Patch coverage is 62.76596% with 35 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
bec_widgets/widgets/plots/waveform/waveform.py 61.95% 21 Missing and 14 partials ⚠️

📢 Thoughts on this report? Let us know!

@wyzula-jan wyzula-jan force-pushed the fix/dap-custom-params branch 2 times, most recently from e2262dd to a17e8d2 Compare December 16, 2025 10:32
@wyzula-jan wyzula-jan force-pushed the fix/dap-custom-params branch from a17e8d2 to 25ff1f5 Compare January 28, 2026 16:50
@wyzula-jan wyzula-jan changed the base branch from main to pre_release_v3 January 28, 2026 16:50
@wyzula-jan wyzula-jan marked this pull request as draft January 28, 2026 22:07
@wyzula-jan wyzula-jan force-pushed the fix/dap-custom-params branch from f5adf59 to 76053c3 Compare January 28, 2026 22:50
@wyzula-jan wyzula-jan marked this pull request as ready for review January 28, 2026 23:05
@wyzula-jan wyzula-jan force-pushed the fix/dap-custom-params branch from 76053c3 to 130d17e Compare January 30, 2026 11:04
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