centroid_2dg

photutils.centroids.centroid_2dg(data, error=None, mask=None)[source]

Calculate the centroid of a 2D array by fitting a 2D Gaussian (plus a constant) to the array.

Non-finite values (e.g., NaN or inf) in the data or error arrays are automatically masked. These masks are combined.

Parameters
dataarray_like

The 2D data array.

errorarray_like, optional

The 2D array of the 1-sigma errors of the input data.

maskarray_like (bool), optional

A boolean mask, with the same shape as data, where a True value indicates the corresponding element of data is masked.

Returns
centroidndarray

The x, y coordinates of the centroid.