GriddedPSFModel¶
- class photutils.psf.GriddedPSFModel(nddata, *, flux=1.0, x_0=0.0, y_0=0.0, fill_value=0.0)[source]¶
Bases:
ModelGridPlotMixin
,Fittable2DModel
A fittable 2D model containing a grid ePSF models.
The ePSF models are defined at fiducial detector locations and are bilinearly interpolated to calculate an ePSF model at an arbitrary (x, y) detector position.
When evaluating this model, it cannot be called with x and y arrays that have greater than 2 dimensions.
- Parameters:
- nddata
NDData
A
NDData
object containing the grid of reference ePSF arrays. The data attribute must contain a 3Dndarray
containing a stack of the 2D ePSFs with a shape of(N_psf, ePSF_ny, ePSF_nx)
.The meta attribute must be
dict
containing the following:'grid_xypos'
: A list of the (x, y) grid positions of each reference ePSF. The order of positions should match the first axis of the 3Dndarray
of ePSFs. In other words,grid_xypos[i]
should be the (x, y) position of the reference ePSF defined indata[i]
.'oversampling'
: The integer oversampling factor(s) of the ePSF. Ifoversampling
is a scalar then it will be used for both axes. Ifoversampling
has two elements, they must be in(y, x)
order.
The meta attribute may contain other properties such as the telescope, instrument, detector, and filter of the ePSF.
- nddata
Notes
Internally, the grid of ePSFs will be arranged and stored such that it is sorted first by y and then by x.
Methods
read(*args, **kwargs)
Class method to create a
GriddedPSFModel
instance from a STDPSF FITS file. This method usesstdpsf_reader()
with the provided parameters.Attributes Summary
Names of the parameters that describe models of this type.
Read and parse a FITS file into a
GriddedPSFModel
instance.Methods Summary
Clear the internal cache.
copy
()Return a copy of this model where only the model parameters are copied.
deepcopy
()Return a deep copy of this model.
evaluate
(x, y, flux, x_0, y_0)Evaluate the
GriddedPSFModel
for the input parameters.Attributes Documentation
- flux = Parameter('flux', value=1.0)¶
- param_names = ('flux', 'x_0', 'y_0')¶
Names of the parameters that describe models of this type.
The parameters in this tuple are in the same order they should be passed in when initializing a model of a specific type. Some types of models, such as polynomial models, have a different number of parameters depending on some other property of the model, such as the degree.
When defining a custom model class the value of this attribute is automatically set by the
Parameter
attributes defined in the class body.
- read¶
Read and parse a FITS file into a
GriddedPSFModel
instance.This class enables the astropy unified I/O layer for
GriddedPSFModel
. This allows easily reading a file in different supported data formats using syntax such as:>>> from photutils.psf import GriddedPSFModel >>> psf_model = GriddedPSFModel.read('filename.fits', format=format)
Get help on the available readers for
GriddedPSFModel
using thehelp()
method:>>> # Get help reading Table and list supported formats >>> GriddedPSFModel.read.help() >>> # Get detailed help on the STSPSF FITS reader >>> GriddedPSFModel.read.help('stdpsf') >>> # Get detailed help on the WebbPSF FITS reader >>> GriddedPSFModel.read.help('webbpsf') >>> # Print list of available formats >>> GriddedPSFModel.read.list_formats()
- Parameters:
- *argstuple, optional
Positional arguments passed through to data reader. If supplied the first argument is typically the input filename.
- formatstr
File format specifier.
- **kwargsdict, optional
Keyword arguments passed through to data reader.
- Returns:
- out
GriddedPSFModel
A gridded ePSF model corresponding to FITS file contents.
- out
- x_0 = Parameter('x_0', value=0.0)¶
- y_0 = Parameter('y_0', value=0.0)¶
Methods Documentation
- copy()[source]¶
Return a copy of this model where only the model parameters are copied.
All other copied model attributes are references to the original model. This prevents copying the ePSF grid data, which may contain a large array.
This method is useful if one is interested in only changing the model parameters in a model copy. It is used in the PSF photometry classes during model fitting.
Use the
deepcopy
method if you want to copy all of the model attributes, including the ePSF grid data.
- evaluate(x, y, flux, x_0, y_0)[source]¶
Evaluate the
GriddedPSFModel
for the input parameters.