docs: def do_photometry(self, image, init_guesses=None):
          """
          Perform PSF photometry in ``image``.
  
          This method assumes that ``psf_model`` has centroids and flux
          parameters which will be fitted to the data provided in
          ``image``. A compound model, in fact a sum of ``psf_model``,
          will be fitted to groups of stars automatically identified by
          ``group_maker``. Also, ``image`` is not assumed to be background
          subtracted.  If ``init_guesses`` are not ``None`` then this
          method uses ``init_guesses`` as initial guesses for the
          centroids. If the centroid positions are set as ``fixed`` in the
          PSF model ``psf_model``, then the optimizer will only consider
          the flux as a variable.
  
          Parameters
          ----------
          image : 2D array-like, `~astropy.io.fits.ImageHDU`, `~astropy.io.fits.HDUList`
              Image to perform photometry.
          init_guesses: `~astropy.table.Table`
              Table which contains the initial guesses (estimates) for the
              set of parameters. Columns 'x_0' and 'y_0' which represent
              the positions (in pixel coordinates) for each object must be
              present.  'flux_0' can also be provided to set initial
              fluxes.  If 'flux_0' is not provided, aperture photometry is
              used to estimate initial values for the fluxes. Additional
              columns of the form '<parametername>_0' will be used to set
              the initial guess for any parameters of the ``psf_model``
              model that are not fixed.
  
          Returns
          -------
          output_tab : `~astropy.table.Table` or None
              Table with the photometry results, i.e., centroids and
              fluxes estimations and the initial estimates used to start
              the fitting process. Uncertainties on the fitted parameters
              are reported as columns called ``<paramname>_unc`` provided
              that the fitter object contains a dictionary called
              ``fit_info`` with the key ``param_cov``, which contains the
              covariance matrix. If ``param_cov`` is not present,
              uncertanties are not reported.
          """
  
          if self.bkg_estimator is not None:
              image = image - self.bkg_estimator(image)
  
          if self.aperture_radius is None:
              if hasattr(self.psf_model, 'fwhm'):
                  self.aperture_radius = self.psf_model.fwhm.value
              elif hasattr(self.psf_model, 'sigma'):
                  self.aperture_radius = (self.psf_model.sigma.value *
                                          gaussian_sigma_to_fwhm)
  
          if init_guesses is not None:
              # make sure the code does not modify user's input
              init_guesses = init_guesses.copy()
              if self.aperture_radius is None:
                  if 'flux_0' not in init_guesses.colnames:
                      raise ValueError('aperture_radius is None and could not '
                                       'be determined by psf_model. Please, '
                                       'either provided a value for '
                                       'aperture_radius or define fwhm/sigma '
                                       'at psf_model.')
  
              if self.finder is not None:
                  warnings.warn('Both init_guesses and finder are different '
                                'than None, which is ambiguous. finder is '
                                'going to be ignored.', AstropyUserWarning)
  
              if 'flux_0' not in init_guesses.colnames:
                  apertures = CircularAperture((init_guesses['x_0'],
                                                init_guesses['y_0']),
                                               r=self.aperture_radius)
  
                  init_guesses['flux_0'] = aperture_photometry(
                      image, apertures)['aperture_sum']
          else:
              if self.finder is None:
                  raise ValueError('Finder cannot be None if init_guesses are '
                                   'not given.')
              sources = self.finder(image)
              if len(sources) > 0:
                  apertures = CircularAperture((sources['xcentroid'],
                                                sources['ycentroid']),
                                               r=self.aperture_radius)
  
                  sources['aperture_flux'] = aperture_photometry(
                      image, apertures)['aperture_sum']
  
                  init_guesses = Table(names=['x_0', 'y_0', 'flux_0'],
                                       data=[sources['xcentroid'],
                                             sources['ycentroid'],
                                             sources['aperture_flux']])
  
          self._define_fit_param_names()
          for p0, param in self._pars_to_set.items():
              if p0 not in init_guesses.colnames:
                  init_guesses[p0] = (len(init_guesses) *
                                      [getattr(self.psf_model, param).value])
  
          star_groups = self.group_maker(init_guesses)
          output_tab, self._residual_image = self.nstar(image, star_groups)
  
          star_groups = star_groups.group_by('group_id')
          output_tab = hstack([star_groups, output_tab])
  
          return output_tab