docs: def centroid_2dg(data, error=None, mask=None):
      """
      Calculate the centroid of a 2D array by fitting a 2D Gaussian (plus
      a constant) to the array.
  
      Invalid values (e.g. NaNs or infs) in the ``data`` or ``error``
      arrays are automatically masked.  The mask for invalid values
      represents the combination of the invalid-value masks for the
      ``data`` and ``error`` arrays.
  
      Parameters
      ----------
      data : array_like
          The 2D data array.
  
      error : array_like, optional
          The 2D array of the 1-sigma errors of the input ``data``.
  
      mask : array_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
      -------
      centroid : `~numpy.ndarray`
          The ``x, y`` coordinates of the centroid.
      """
  
      gfit = fit_2dgaussian(data, error=error, mask=mask)
  
      return np.array([gfit.x_mean.value, gfit.y_mean.value])