skg.ngauss_from_image¶
-
skg.
ngauss_from_image
(img, weights=None, scaling=True)[source]¶ Compute a Gaussian fit to an entire image.
Parameters: - img (array-like) – The image to process. Usually a segment of a 2D image. The data is expected to have been background subtracted and thresholded so that any low-SNR pixels are set to zero.
- weights (array-like or callable, optional) – A weighing function must be applied to the data to avoid having the low-SNR data dominate the fit. The default is to weight the measurements by their intensity, as per [Wan-Wang-Wei-Li-Zhang]. However, other schemes are possible, such as the one proposed by [Anthony-Granick]. weights can be passed in as an array with the same number of elements as y (it will be raveled), or a callable that accepts reshaped versions of x and y and returns an array of weights.
- scaling (bool, optional) – If True, scale and offset the data to a bounding box of -1 to +1 in each axis during computations for numerical stability. Default is True.
Returns: - a (float) – The amplitude of the Gaussian.
- mu (~numpy.ndarray) – The mean of the Gaussian, as an N-element array.
- sigma (~numpy.ndarray) – The covariance of the Gaussian, as an NxN positive definite matrix.