params_table_to_models#

photutils.datasets.params_table_to_models(params_table, model)[source]#

Create a list of models from a table of model parameters.

Parameters:
params_tableTable

A table containing the model parameters for each source. Each row of the table corresponds to a different model whose parameters are defined by the column names. Model parameters not defined in the table will be set to the model default value. To attach units to model parameters, params_table must be input as a QTable. A column named ‘name’ can also be included in the table to assign a name to each model.

modelastropy.modeling.Model

The model whose parameters will be updated.

Returns:
modelslist of astropy.modeling.Model

A list of models created from the input table of model parameters.

Examples

>>> from astropy.table import QTable
>>> from photutils.datasets import params_table_to_models
>>> from photutils.psf import CircularGaussianPSF
>>> tbl = QTable()
>>> tbl['x_0'] = [1, 2, 3]
>>> tbl['y_0'] = [4, 5, 6]
>>> tbl['flux'] = [100, 200, 300]
>>> model = CircularGaussianPSF()
>>> models = params_table_to_models(tbl, model)
>>> models
[<CircularGaussianPSF(flux=100., x_0=1., y_0=4., fwhm=1.)>,
 <CircularGaussianPSF(flux=200., x_0=2., y_0=5., fwhm=1.)>,
 <CircularGaussianPSF(flux=300., x_0=3., y_0=6., fwhm=1.)>]