fit_psf_to_image_model

romancal.lib.psf.fit_psf_to_image_model(image_model=None, data=None, error=None, dq=None, photometry_cls=<class 'photutils.psf.photometry.PSFPhotometry'>, psf_model=None, grouper=None, fitter=None, localbkg_estimator=None, finder=None, x_init=None, y_init=None, progress_bar=False, error_lower_limit=None, fit_shape=(15, 15), exclude_out_of_bounds=True)[source]

Fit PSF models to an ImageModel.

Parameters:
  • image_model (roman_datamodels.datamodels.ImageModel) – Image datamodel. If image_model is supplied, data,error,dq should be None.

  • data (astropy.units.Quantity) – Fit a PSF model to the rate image data. If data,error,dq are supplied, image_model should be None.

  • error (astropy.units.Quantity) – Uncertainties on fluxes in data. Should be None if image_model is supplied.

  • dq (numpy.ndarray) – Data quality bitmask for data. Should be None if image_model is supplied.

  • photometry_cls ({photutils.psf.PSFPhotometry,) – photutils.psf.IterativePSFPhotometry} Choose a photutils PSF photometry technique (default or iterative).

  • psf_model (astropy.modeling.Fittable2DModel) – The 2D PSF model to fit to the rate image. Usually this model is an instance of photutils.psf.GriddedPSFModel.

  • grouper (photutils.psf.SourceGrouper) –

    Specifies rules for attempting joint fits of multiple PSFs when

    there are nearby sources at small separations.

  • fitter (astropy.modeling.fitting.Fitter, optional) – Modeling class which optimizes the PSF fit. Default is astropy.modeling.fitting.LevMarLSQFitter(calc_uncertainties=True).

  • localbkg_estimator (photutils.background.LocalBackground, optional) – Specifies inner and outer radii for computing flux background near a source. Default has inner_radius=10, outer_radius=30.

  • finder (subclass of photutils.detection.StarFinderBase, optional) – When photutils_cls is photutils.psf.IterativePSFPhotometry, the finder is called to determine if sources remain in the rate image after one PSF model is fit to the observations and removed. Default was extracted from the DAOStarFinder call in the Source Detection step.

  • x_init (numpy.ndarray, optional) – Initial guesses for the x pixel coordinates of each source to fit.

  • y_init (numpy.ndarray, optional) – Initial guesses for the y pixel coordinates of each source to fit.

  • progress_bar (bool, optional) – Render a progress bar via photutils. Default is False.

  • error_lower_limit (astropy.units.Quantity, optional) – Since some synthetic images may have bright sources with very small statistical uncertainties, the error can be clipped at error_lower_limit to prevent over-confident fits.

  • fit_shape (int, or tuple of length 2, optional) – Rectangular shape around the center of a star that will be used to define the PSF-fitting data. See docs for photutils.psf.PSFPhotometry for details. Default is (16, 16).

  • exclude_out_of_bounds (bool, optional) – If True, do not attempt to fit stars which have initial centroids that fall outside the pixel limits of the SCA. Default is False.

Returns:

  • results_table (astropy.table.QTable) – PSF photometry results.

  • photometry (instance of class photutils_cls) – PSF photometry instance with configuration settings and results.