Skip to main content
`Ctrl`+`K`

# `BackgroundWidget`

This module provides a background configuration widget `BackgroundWidget` and a corresponding dialog window `BackgroundDialog`.

## API

class BackgroundWidget(parent=None)

  Background configuration widget, with a plot to preview the results.

  Strip and snip filters parameters can be adjusted using input widgets, and the computed backgrounds are plotted next to the original data to show the result.

  getParameters()

    Return dictionary of parameters defined in the GUI

    The returned dictionary contains following values:

    > - algorithm: “strip” or “snip”

    > - StripWidth: width of strip iterator

    > - StripIterations: number of iterations

    > - StripThreshold: strip curvature (currently fixed to 1.0)

    > - SnipWidth: width of snip algorithm

    > - SmoothingFlag: flag to enable/disable smoothing

    > - SmoothingWidth: width of Savitsky-Golay smoothing filter

    > - AnchorsFlag: flag to enable/disable anchors

    > - AnchorsList: list of anchors (X coordinates of fixed values)

  setParameters(ddict)

    Set values for all input widgets.

    Parameters:

      ddict (dict) – Input dictionary, must have the same keys as the dictionary output by `getParameters()`

  setData(x, y, xmin=None, xmax=None)

    Set data for the original curve, and _update strip and snip curves accordingly.

    Parameters:

      - x – Array or sequence of curve abscissa values

      - y – Array or sequence of curve ordinate values

      - xmin – Min value to be displayed on the X axis

      - xmax – Max value to be displayed on the X axis

class BackgroundDialog(parent=None)

  QDialog window featuring a `BackgroundWidget`

  output

    Configuration dictionary containing following fields:

    - SmoothingFlag

    - SmoothingWidth

    - StripWidth

    - StripIterations

    - StripThreshold

    - SnipWidth

    - AnchorsFlag

    - AnchorsList

  accept()

    Update `output`, then call `QDialog.accept()`

  sizeHint(self) → QSize
  setData(x, y, xmin=None, xmax=None)

    See `BackgroundWidget.setData()`

  getParameters()

    See `BackgroundWidget.getParameters()`

  setParameters(ddict)

    See `BackgroundWidget.setPrintGeometry()`

  setDefault(ddict)

    Alias for `setPrintGeometry()`