get_fwhm

sherpa.utils.get_fwhm(y: ndarray, x: ndarray, xhi: ndarray | None = None) float[source] [edit on github]

Estimate the width of the data.

This is only valid for positive data values (y).

Parameters:
y, xarray_like

The data points. The x array must be in ascending order.

xhiNone or array_like, optional

If given then the x array is taken to be the low-edge of each bin. This is unused.

Returns:
ansscalar

An estimate of the full-width half-maximum of the peak. If the data is negative, or no edge is found then half the X range is returned.

Notes

If there are multiple peaks of the same height then the first peak is used.

The approach is to find the maximum position and then extend out to the first bins which fall below half the height. The difference of the two points is used. If only one side falls below the value then twice this separation is used. If the half-height is not reached then the value is set to be half the width of the x array. In all cases the upper-edge of the x arrays is ignored, if given.