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. Ifimage_model
is supplied,data,error,dq
should beNone
.data (
astropy.units.Quantity
) – Fit a PSF model to the rate imagedata
. Ifdata,error,dq
are supplied,image_model
should beNone
.error (
astropy.units.Quantity
) – Uncertainties on fluxes indata
. Should beNone
ifimage_model
is supplied.dq (
numpy.ndarray
) – Data quality bitmask fordata
. Should beNone
ifimage_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 ofphotutils.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 isastropy.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 hasinner_radius=10, outer_radius=30
.finder (subclass of
photutils.detection.StarFinderBase
, optional) – Whenphotutils_cls
isphotutils.psf.IterativePSFPhotometry
, thefinder
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 theDAOStarFinder
call in the Source Detection step.x_init (
numpy.ndarray
, optional) – Initial guesses for thex
pixel coordinates of each source to fit.y_init (
numpy.ndarray
, optional) – Initial guesses for they
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, theerror
can be clipped aterror_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.