get_profilemodel#
- get_profilemodel(name, position=(0, 0), normalized=True, **kwargs)[source]#
Get a 2D profile model from
astropy.modeling.functional_models.- Parameters:
name (
str) –Name of the 2D astropy model. Shortcuts:
"airy","airydisk":"AiryDisk2D""gaussian","gauss","normal":"Gaussian2D""moffat":"Moffat2D""sersic":"Sersic2D""ricker","mexican","mexicanhat":"RickerWavelet2D""lorentz":"Lorentz2D"
position (
tupleoffloat, optional) – Location(x, y)of the centroid. Default is (0, 0).normalized (
bool, optional) – If True, set the model amplitude such that the profile integrates to 1. Only implemented forAiryDisk2DandGaussian2D. Default is True.**kwargs –
Additional arguments passed to the astropy model initializer, see https://docs.astropy.org/en/latest/modeling/predef_models2D.html. Model defaults are amplitude=1 and:
AiryDisk2D: radius=1
Gaussian2D: x_stddev=None, y_stddev=None, theta=None, cov_matrix=None. For convenience,
sigma(orradius) can be given to set bothx_stddevandy_stddev.Moffat2D: gamma=1, alpha=1
Sersic2D: r_eff=1, n=4, ellip=0, theta=0.0
RickerWavelet2D: sigma=1
Lorentz2D: fwhm=1
- Returns:
astropy.modeling.Fittable2DModel– The requested astropy model with its parameters set; call it asmodel(x, y).- Raises:
ValueError – If
normalizedis True for a model other thanAiryDisk2DorGaussian2D.
Examples
>>> sigmas = 2 # or array of shape (M, 1, 1) >>> airy = get_profilemodel("airy", position=(0.4, 1.2), radius=sigmas) >>> xx = np.r_[-7:7:50j] >>> yy = np.r_[-7:7:49j] # different dim for example >>> airy(xx[None, :], yy[:, None]).shape # (M, 49, 50) for M radii (49, 50)