Note
This is the documentation for the current state of the development branch of Qiskit Experiments. The documentation or APIs here can change prior to being released.
constant_spectral_offset¶
- constant_spectral_offset(y, filter_window=5, filter_dim=2, ratio=0.1)[source]¶
Get constant offset of spectral baseline.
This function searches constant offset by finding a region where 1st and 2nd order differentiation are close to zero. A return value is an average y value of that region. To suppress the noise contribution to derivatives, this function also applies a Savitzky-Golay filter to y value.
This method is more robust to offset error than just taking median or average of y values especially when a peak width is wider compared to the scan range.
- Parameters:
y (ndarray) – Array of y values.
filter_window (int) – Window size of Savitzky-Golay filter. This should be odd number.
filter_dim (int) – Dimension of Savitzky-Golay filter.
ratio (float) – Threshold value to decide flat region. This value represent a ratio to the maximum derivative value.
- Returns:
Offset value.
- Return type:
float