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

Calculate the centroid of a 2D array by fitting 1D Gaussians to the marginal x and y distributions of the array.

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

data2D ndarray

The 2D image data. The image should be a background-subtracted cutout image containing a single source.

error2D ndarray, optional

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

mask2D bool ndarray, optional

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


The x, y coordinates of the centroid.