ParametricModel

class paintbox.ParametricModel(wave, params, templates)[source] [edit on github]

Bases: paintbox.sed.PaintboxBase

Interpolation of SED model templates parametrically.

This class allows the linear interpolation of SED templates, such as SSP models, based on a table of parameters and their SEDs.

Warning: The linear interpolation is currently based on scipy.RegularGridInterpolator for better performance with large number of input models, thus the input data must be in the form of a regular grid.

Parameters
wave: ndarray, astropy.units.Quantity

Wavelenght array of the model.

params: astropy.table.Table

Table with parameters of the models.

templates: 2D ndarray

The SED templates with dimensions (len(params), len(wave))

Attributes Summary

limits

Lower and upper limits of the parameters.

parnames

List with names of the parameters of the model.

Methods Summary

__call__(theta)

Call for interpolated model at a given point theta.

constrain_duplicates()

Constrain the parameters with the same name to have the same value during calling.

fix(fixed_vals)

Fix a set of parameters in parnames using a dictionary.

gradient(theta)

Gradient of models at a given point theta.

plot(theta[, ax, plottype])

Plot the model for a given set of parameters.

Attributes Documentation

limits

Lower and upper limits of the parameters.

parnames

List with names of the parameters of the model.

Methods Documentation

__call__(theta)[source] [edit on github]

Call for interpolated model at a given point theta.

Parameters
theta: ndarray

Point where the model is computed, with parameters in the same order of parnames. Points outside of the convex hull of the models (as defined in the limits) are set to zero.

Returns
SED model at location theta.
constrain_duplicates() [edit on github]

Constrain the parameters with the same name to have the same value during calling.

fix(fixed_vals) [edit on github]

Fix a set of parameters in parnames using a dictionary.

gradient(theta)[source] [edit on github]

Gradient of models at a given point theta.

Gradients are computed with simple finite difference. If the input point is among the points used for interpolation, the gradient is not defined, returning zero instead.

Parameters
theta: ndarray

Point where the gradient of the model is computed, with parameters in the same order of parnames. Points outside of the convex hull of the models are set to zero.

eps: float or ndarray, optional

Step used in the finite difference calculation. Default is 1e-6.

plot(theta, ax=None, plottype=None, **kwargs) [edit on github]

Plot the model for a given set of parameters.