Skip to content

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.

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 56.52174% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
bec_widgets/widgets/plots/waveform/waveform.py 55.55% 13 Missing and 7 partials ⚠️

📢 Thoughts on this report? Let us know!

@wyzula-jan wyzula-jan force-pushed the fix/dap-custom-params branch from 6713321 to e2262dd Compare December 16, 2025 09:48
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.

2 participants