qudi.util.fit_models.helpers

This file contains helper methods to find and estimate multiple peaks/dips for fit models.

Functions

correct_offset_histogram(data[, bin_width])

Subtracts a constant offset from a copy of given data array and returns it.

find_highest_peaks(data, peak_count[, ...])

Find peaks using scipy.signal.find_peaks().

estimate_double_peaks(data, x[, ...])

estimate_triple_peaks(data, x[, ...])

sort_check_data(data, x)

smooth_data(data[, filter_width])

qudi.util.fit_models.helpers.correct_offset_histogram(data, bin_width=None)[source]

Subtracts a constant offset from a copy of given data array and returns it. The offset is assumed to be the most common value in data. This value is determined by creating a histogram of <data> with bin width <bin_width> and taking the value with the most occurrences. If no bin width has been specified, assume bin width of 1/50th of data length (min. 1).

For best results, make sure to filter noisy data beforehand. The used smoothing filter width is a good estimate for optimal bin_width.

Parameters:
dataiterable

Peak data to correct offset for. Must be convertible using numpy.asarray.

bin_widthint, optional

Bin width in samples to use for histogram creation. Default is None, which sets bin width to 1/50th of data length (minimum 1).

Returns:
numpy.ndarray, float

New array with offset-corrected data, the offset value.

qudi.util.fit_models.helpers.estimate_double_peaks(data, x, minimum_distance=None)[source]
qudi.util.fit_models.helpers.estimate_triple_peaks(data, x, minimum_distance=None)[source]
qudi.util.fit_models.helpers.find_highest_peaks(data, peak_count, allow_borders=True, **kwargs)[source]

Find peaks using scipy.signal.find_peaks(). ToDo: Document

qudi.util.fit_models.helpers.smooth_data(data, filter_width=None)[source]
qudi.util.fit_models.helpers.sort_check_data(data, x)[source]