astrophot.models.mixins package#
Submodules#
astrophot.models.mixins.brightness module#
- class astrophot.models.mixins.brightness.RadialMixin[source]#
Bases:
objectThis model defines its
brightness(x,y)function using a radial model. Thus the brightness is instead defined asradial_model(R)More specifically the function is:
\[x, y = {\rm transform\_coordinates}(x, y)\]\[R = {\rm radius\_metric}(x, y)\]\[I(x, y) = {\rm radial\_model}(R)\]The
transform_coordinatesfunction depends on the model. In its simplest form it simply subtracts the center of the model to re-center the coordinates.The
radius_metricfunction is also model dependent, in its simplest form this is just \(R = \sqrt{x^2 + y^2}\).- brightness(x: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], y: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
Calculate the brightness at a given point (x, y) based on radial distance from the center.
- class astrophot.models.mixins.brightness.RayMixin(*args, symmetric: bool = True, segments: int = 2, **kwargs)[source]#
Bases:
objectDefines a model with multiple profiles along rays projected from the center.
model which defines multiple radial models separately along some number of rays projected from the center. These rays smoothly transition from one to another along angles theta. The ray transition uses a cosine smoothing function which depends on the number of rays, for example with two rays the brightness would be:
\[I(R,\theta) = I_1(R)*\cos(\theta \% \pi) + I_2(R)*\cos((\theta + \pi/2) \% \pi)\]For \(\theta = 0\) the brightness comes entirely from
I_1while for \(\theta = \pi/2\) the brightness comes entirely fromI_2.- Parameters:
symmetric – If True, the model will have symmetry for rotations of pi radians and each ray will appear twice on the sky on opposite sides of the model. If False, each ray is independent.
segments – The number of segments to divide the model into. This controls how many rays are used in the model. The default is 2
- brightness(x: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], y: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- polar_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], T: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.brightness.WedgeMixin(*args, symmetric: bool = True, segments: int = 2, **kwargs)[source]#
Bases:
objectDefines a model with multiple profiles that form wedges projected from the center.
model which defines multiple radial models separately along some number of wedges projected from the center. These wedges have sharp transitions along boundary angles theta.
- Parameters:
symmetric – If True, the model will have symmetry for rotations of pi radians and each ray will appear twice on the sky on opposite sides of the model. If False, each ray is independent.
segments – The number of segments to divide the model into. This controls how many rays are used in the model. The default is 2
- polar_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], T: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
astrophot.models.mixins.exponential module#
- class astrophot.models.mixins.exponential.ExponentialMixin[source]#
Bases:
objectExponential radial light profile.
An exponential is a classical radial model used in many contexts. The functional form of the exponential profile is defined as:
\[I(R) = I_e \exp\left(- b_1\left(\frac{R}{R_e} - 1\right)\right)\]Ie is the brightness at the effective radius, and Re is the effective radius. \(b_1\) is a constant that ensures \(I_e\) is the brightness at \(R_e\).
- Parameters:
Re – effective radius in arcseconds
Ie – effective surface density in flux/arcsec^2
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Re: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ie: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.exponential.ExponentialPSFMixin[source]#
Bases:
objectExponential radial light profile.
An exponential is a classical radial model used in many contexts. The functional form of the exponential profile is defined as:
\[I(R) = I_e \exp\left(- b_1\left(\frac{R}{R_e} - 1\right)\right)\]Ie is the brightness at the effective radius, and Re is the effective radius. \(b_1\) is a constant that ensures \(I_e\) is the brightness at \(R_e\).
- Parameters:
Re – effective radius in pixels
Ie – effective surface density in flux/pix^2
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Re: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ie: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.exponential.iExponentialMixin[source]#
Bases:
objectExponential radial light profile.
An exponential is a classical radial model used in many contexts. The functional form of the exponential profile is defined as:
\[I(R) = I_e \exp\left(- b_1\left(\frac{R}{R_e} - 1\right)\right)\]\(I_e\) is the brightness at the effective radius, and \(R_e\) is the effective radius. \(b_1\) is a constant that ensures \(I_e\) is the brightness at \(R_e\).
ReandIeare batched by their first dimension, allowing for multiple exponential profiles to be defined at once.- Parameters:
Re – effective radius in arcseconds
Ie – effective surface density in flux/arcsec^2
- iradial_model(i: int, R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Re: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ie: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
astrophot.models.mixins.ferrer module#
- class astrophot.models.mixins.ferrer.FerrerMixin[source]#
Bases:
objectModified Ferrer radial light profile (Binney & Tremaine 1987).
This model has a relatively flat brightness core and then a truncation. It is used in specialized circumstances such as fitting the bar of a galaxy. The functional form of the Modified Ferrer profile is defined as:
\[I(R) = I_0 \left(1 - \left(\frac{R}{r_{\rm out}}\right)^{2-\beta}\right)^{\alpha}\]where
routis the outer truncation radius,alphacontrols the steepness of the truncation,betacontrols the shape, andI0is the intensity at the center of the profile.- Parameters:
rout – Outer truncation radius in arcseconds.
alpha – Inner slope parameter.
beta – Outer slope parameter.
I0 – Intensity at the center of the profile in flux/arcsec^2
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], rout: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], beta: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.ferrer.FerrerPSFMixin[source]#
Bases:
objectModified Ferrer radial light profile (Binney & Tremaine 1987).
This model has a relatively flat brightness core and then a truncation. It is used in specialized circumstances such as fitting the bar of a galaxy. The functional form of the Modified Ferrer profile is defined as:
\[I(R) = I_0 \left(1 - \left(\frac{R}{r_{\rm out}}\right)^{2-\beta}\right)^{\alpha}\]where
routis the outer truncation radius,alphacontrols the steepness of the truncation,betacontrols the shape, andI0is the intensity at the center of the profile.- Parameters:
rout – Outer truncation radius in pixels.
alpha – Inner slope parameter.
beta – Outer slope parameter.
I0 – Intensity at the center of the profile in flux/pix^2
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], rout: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], beta: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.ferrer.iFerrerMixin[source]#
Bases:
objectModified Ferrer radial light profile (Binney & Tremaine 1987).
This model has a relatively flat brightness core and then a truncation. It is used in specialized circumstances such as fitting the bar of a galaxy. The functional form of the Modified Ferrer profile is defined as:
\[I(R) = I_0 \left(1 - \left(\frac{R}{r_{\rm out}}\right)^{2-\beta}\right)^{\alpha}\]where
routis the outer truncation radius,alphacontrols the steepness of the truncation,betacontrols the shape, andI0is the intensity at the center of the profile.rout,alpha,beta, andI0are batched by their first dimension, allowing for multiple Ferrer profiles to be defined at once.- Parameters:
rout – Outer truncation radius in arcseconds.
alpha – Inner slope parameter.
beta – Outer slope parameter.
I0 – Intensity at the center of the profile in flux/arcsec^2
- iradial_model(i: int, R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], rout: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], beta: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
astrophot.models.mixins.gaussian module#
- class astrophot.models.mixins.gaussian.GaussianMixin[source]#
Bases:
objectGaussian radial light profile.
The Gaussian profile is a simple and widely used model for extended objects. The functional form of the Gaussian profile is defined as:
\[I(R) = \frac{{\rm flux}}{\sqrt{2\pi}\sigma} \exp(-R^2 / (2 \sigma^2))\]where
I_0is the intensity at the center of the profile andsigmais the standard deviation which controls the width of the profile.- Parameters:
sigma – Standard deviation of the Gaussian profile in arcseconds.
flux – Total flux of the Gaussian profile.
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], sigma: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], flux: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.gaussian.GaussianPSFMixin[source]#
Bases:
objectGaussian radial light profile.
The Gaussian profile is a simple and widely used model for extended objects. The functional form of the Gaussian profile is defined as:
\[I(R) = \frac{{\rm flux}}{\sqrt{2\pi}\sigma} \exp(-R^2 / (2 \sigma^2))\]where
I_0is the intensity at the center of the profile andsigmais the standard deviation which controls the width of the profile.- Parameters:
sigma – Standard deviation of the Gaussian profile in pixels.
flux – Total flux of the Gaussian profile.
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], sigma: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], flux: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.gaussian.iGaussianMixin[source]#
Bases:
objectGaussian radial light profile.
The Gaussian profile is a simple and widely used model for extended objects. The functional form of the Gaussian profile is defined as:
\[I(R) = \frac{{\rm flux}}{\sqrt{2\pi}\sigma} \exp(-R^2 / (2 \sigma^2))\]where
sigmais the standard deviation which controls the width of the profile andfluxgives the total flux of the profile (assuming no perturbations).sigmaandfluxare batched by their first dimension, allowing for multiple Gaussian profiles to be defined at once.- Parameters:
sigma – Standard deviation of the Gaussian profile in arcseconds.
flux – Total flux of the Gaussian profile.
- iradial_model(i: int, R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], sigma: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], flux: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
astrophot.models.mixins.king module#
- class astrophot.models.mixins.king.KingMixin[source]#
Bases:
objectEmpirical King radial light profile (Elson 1999).
Often used for star clusters. By default the profile has
alpha = 2but we allow the parameter to vary freely for fitting. The functional form of the Empirical King profile is defined as:\[I(R) = I_0\left[\frac{1}{(1 + (R/R_c)^2)^{1/\alpha}} - \frac{1}{(1 + (R_t/R_c)^2)^{1/\alpha}}\right]^{\alpha}\left[1 - \frac{1}{(1 + (R_t/R_c)^2)^{1/\alpha}}\right]^{-\alpha}\]where
R_cis the core radius,R_tis the truncation radius, andI_0is the intensity at the center of the profile.alphais the concentration index which controls the shape of the profile.- Parameters:
Rc – core radius
Rt – truncation radius
alpha – concentration index which controls the shape of the brightness profile
I0 – intensity at the center of the profile
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rc: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rt: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.king.KingPSFMixin[source]#
Bases:
objectEmpirical King radial light profile (Elson 1999).
Often used for star clusters. By default the profile has
alpha = 2but we allow the parameter to vary freely for fitting. The functional form of the Empirical King profile is defined as:\[I(R) = I_0\left[\frac{1}{(1 + (R/R_c)^2)^{1/\alpha}} - \frac{1}{(1 + (R_t/R_c)^2)^{1/\alpha}}\right]^{\alpha}\left[1 - \frac{1}{(1 + (R_t/R_c)^2)^{1/\alpha}}\right]^{-\alpha}\]where
R_cis the core radius,R_tis the truncation radius, andI_0is the intensity at the center of the profile.alphais the concentration index which controls the shape of the profile.- Parameters:
Rc – core radius [pix]
Rt – truncation radius [pix]
alpha – concentration index which controls the shape of the brightness profile
I0 – intensity at the center of the profile [flux/pix^2]
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rc: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rt: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.king.iKingMixin[source]#
Bases:
objectEmpirical King radial light profile (Elson 1999).
Often used for star clusters. By default the profile has
alpha = 2but we allow the parameter to vary freely for fitting. The functional form of the Empirical King profile is defined as:\[I(R) = I_0\left[\frac{1}{(1 + (R/R_c)^2)^{1/\alpha}} - \frac{1}{(1 + (R_t/R_c)^2)^{1/\alpha}}\right]^{\alpha}\left[1 - \frac{1}{(1 + (R_t/R_c)^2)^{1/\alpha}}\right]^{-\alpha}\]where
R_cis the core radius,R_tis the truncation radius, andI_0is the intensity at the center of the profile.alphais the concentration index which controls the shape of the profile.Rc,Rt,alpha, andI0are batched by their first dimension, allowing for multiple King profiles to be defined at once.- Parameters:
Rc – core radius
Rt – truncation radius
alpha – concentration index which controls the shape of the brightness profile
I0 – intensity at the center of the profile
- iradial_model(i: int, R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rc: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rt: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
astrophot.models.mixins.moffat module#
- class astrophot.models.mixins.moffat.MoffatMixin[source]#
Bases:
objectMoffat radial light profile (Moffat 1969).
The moffat profile gives a good representation of the general structure of PSF functions for ground based data. It can also be used to fit extended objects. The functional form of the Moffat profile is defined as:
\[I(R) = \frac{I_0}{(1 + (R/R_d)^2)^n}\]nis the concentration index which controls the shape of the profile.- Parameters:
n – Concentration index which controls the shape of the brightness profile
Rd – Scale length radius
I0 – Intensity at the center of the profile
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], n: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rd: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.moffat.MoffatPSFMixin[source]#
Bases:
objectMoffat radial light profile (Moffat 1969).
The moffat profile gives a good representation of the general structure of PSF functions for ground based data. It can also be used to fit extended objects. The functional form of the Moffat profile is defined as:
\[I(R) = \frac{I_0}{(1 + (R/R_d)^2)^n}\]nis the concentration index which controls the shape of the profile.- Parameters:
n – Concentration index which controls the shape of the brightness profile
Rd – Scale length radius [pix]
I0 – Intensity at the center of the profile [flux/pix^2]
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], n: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rd: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.moffat.iMoffatMixin[source]#
Bases:
objectMoffat radial light profile (Moffat 1969).
The moffat profile gives a good representation of the general structure of PSF functions for ground based data. It can also be used to fit extended objects. The functional form of the Moffat profile is defined as:
\[I(R) = \frac{I_0}{(1 + (R/R_d)^2)^n}\]nis the concentration index which controls the shape of the profile.n,Rd, andI0are batched by their first dimension, allowing for multiple Moffat profiles to be defined at once.- Parameters:
n – Concentration index which controls the shape of the brightness profile
Rd – Scale length radius
I0 – Intensity at the center of the profile
- iradial_model(i: int, R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], n: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rd: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
astrophot.models.mixins.nuker module#
- class astrophot.models.mixins.nuker.NukerMixin[source]#
Bases:
objectNuker radial light profile (Lauer et al. 1995).
This is a classic profile used widely in galaxy modelling. The functional form of the Nuker profile is defined as:
\[I(R) = I_b2^{\frac{\beta - \gamma}{\alpha}}\left(\frac{R}{R_b}\right)^{-\gamma}\left[1 + \left(\frac{R}{R_b}\right)^{\alpha}\right]^{\frac{\gamma-\beta}{\alpha}}\]It is effectively a double power law profile. \(\gamma\) gives the inner slope, \(\beta\) gives the outer slope, \(\alpha\) is somewhat degenerate with the other slopes.
- Parameters:
Rb – scale length radius
Ib – intensity at the scale length
alpha – sharpness of transition between power law slopes
beta – outer power law slope
gamma – inner power law slope
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rb: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ib: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], beta: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], gamma: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.nuker.NukerPSFMixin[source]#
Bases:
objectNuker radial light profile (Lauer et al. 1995).
This is a classic profile used widely in galaxy modelling. The functional form of the Nuker profile is defined as:
\[I(R) = I_b2^{\frac{\beta - \gamma}{\alpha}}\left(\frac{R}{R_b}\right)^{-\gamma}\left[1 + \left(\frac{R}{R_b}\right)^{\alpha}\right]^{\frac{\gamma-\beta}{\alpha}}\]It is effectively a double power law profile. \(\gamma\) gives the inner slope, \(\beta\) gives the outer slope, \(\alpha\) is somewhat degenerate with the other slopes.
- Parameters:
Rb – scale length radius [pix]
Ib – intensity at the scale length [flux/pix^2]
alpha – sharpness of transition between power law slopes
beta – outer power law slope
gamma – inner power law slope
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rb: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ib: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], beta: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], gamma: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.nuker.iNukerMixin[source]#
Bases:
objectNuker radial light profile (Lauer et al. 1995).
This is a classic profile used widely in galaxy modelling. The functional form of the Nuker profile is defined as:
\[I(R) = I_b2^{\frac{\beta - \gamma}{\alpha}}\left(\frac{R}{R_b}\right)^{-\gamma}\left[1 + \left(\frac{R}{R_b}\right)^{\alpha}\right]^{\frac{\gamma-\beta}{\alpha}}\]It is effectively a double power law profile. \(\gamma\) gives the inner slope, \(\beta\) gives the outer slope, \(\alpha\) is somewhat degenerate with the other slopes.
Rb,Ib,alpha,beta, andgammaare batched by their first dimension, allowing for multiple Nuker profiles to be defined at once.- Parameters:
Rb – scale length radius
Ib – intensity at the scale length
alpha – sharpness of transition between power law slopes
beta – outer power law slope
gamma – inner power law slope
- iradial_model(i: int, R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rb: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ib: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], beta: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], gamma: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
astrophot.models.mixins.sample module#
- class astrophot.models.mixins.sample.GradMixin[source]#
Bases:
object- Parameters:
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
- gradient(params: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None, likelihood: Literal['gaussian', 'poisson'] = 'gaussian') Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
Compute the gradient of the model likelihood with respect to its parameters.
- jacobian(pass_jacobian: JacobianImage | None = None, params: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None) JacobianImage[source]#
- jacobian_maxparams = 10#
- class astrophot.models.mixins.sample.SampleMixin(*args, sampling_mode='auto', integrate_mode='bright', **kwargs)[source]#
Bases:
object- Parameters:
sampling_mode – The method used to sample the model in image pixels. Options are: auto: Automatically choose the sampling method based on the image size (default). midpoint: Use midpoint sampling, evaluate the brightness at the center of each pixel. simpsons: Use Simpson’s rule for sampling integrating each pixel. upsample:x upsample the pixel in a regular grid of size x (odd positive integer), generally less accurate than quad:x. quad:x: Use quadrature sampling with order x, where x is an odd positive integer to integrate each pixel.
integrate_mode – The method used to select pixels to integrate further where the model varies significantly. Options are: none: No extra integration is performed (beyond the sampling_mode). bright: Select the brightest pixels for further integration (default). threshold: Select pixels which show signs of significant higher order derivatives.
integrate_fraction – The fraction of the pixels to super sample during integration (default: 0.05).
integrate_max_depth – The maximum depth of the integration method (default: 2).
integrate_gridding – The gridding used for the integration method to super-sample a pixel at each iteration (default: 5).
integrate_quad_order – The order of the quadrature used for the integration method on the super sampled pixels (default: 3).
- integrate_fraction = 0.05#
- integrate_gridding = 5#
- integrate_max_depth = 2#
- property integrate_mode#
- integrate_quad_order = 3#
- property sampling_mode#
astrophot.models.mixins.sersic module#
- class astrophot.models.mixins.sersic.SersicMixin[source]#
Bases:
objectSersic radial light profile (Sersic 1963).
This is a classic profile used widely in galaxy modelling. It can be a good starting point for many extended objects. The functional form of the Sersic profile is defined as:
\[I(R) = I_e \exp(- b_n((R/R_e)^{1/n} - 1))\]It is a generalization of a gaussian, exponential, and de-Vaucouleurs profile. The Sersic index
ncontrols the shape of the profile, withn=1being an exponential profile,n=4being a de-Vaucouleurs profile, andn=0.5being a Gaussian profile.- Parameters:
n – Sersic index which controls the shape of the brightness profile
Re – half light radius [arcsec]
Ie – intensity at the half light radius [flux/arcsec^2]
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], n: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Re: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ie: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.sersic.SersicPSFMixin[source]#
Bases:
objectSersic radial light profile (Sersic 1963).
This is a classic profile used widely in galaxy modelling, though it is simply a generalization of a Gaussian. It can be a good starting point for many objects. The functional form of the Sersic profile is defined as:
\[I(R) = I_e \exp(- b_n((R/R_e)^{1/n} - 1))\]It includes the gaussian, exponential, and de-Vaucouleurs profiles. The Sersic index
ncontrols the shape of the profile, withn=1being an exponential profile,n=4being a de-Vaucouleurs profile, andn=0.5being a Gaussian profile.- Parameters:
n – Sersic index which controls the shape of the brightness profile
Re – half light radius [pix]
Ie – intensity at the half light radius [flux/pix^2]
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], n: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Re: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ie: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.sersic.iSersicMixin[source]#
Bases:
objectSersic radial light profile (Sersic 1963).
This is a classic profile used widely in galaxy modelling. It can be a good starting point for many extended objects. The functional form of the Sersic profile is defined as:
\[I(R) = I_e \exp(- b_n((R/R_e)^{1/n} - 1))\]It is a generalization of a gaussian, exponential, and de-Vaucouleurs profile. The Sersic index
ncontrols the shape of the profile, withn=1being an exponential profile,n=4being a de-Vaucouleurs profile, andn=0.5being a Gaussian profile.n,Re, andIeare batched by their first dimension, allowing for multiple Sersic profiles to be defined at once.- Parameters:
n – Sersic index which controls the shape of the brightness profile
Re – half light radius [arcsec]
Ie – intensity at the half light radius [flux/arcsec^2]
- iradial_model(i: int, R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], n: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Re: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ie: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
astrophot.models.mixins.spline module#
- class astrophot.models.mixins.spline.SplineMixin[source]#
Bases:
objectSpline radial model for brightness.
The
radial_modelfunction for this model is defined as a spline interpolation from the parameterI_R. TheI_Rparameter is a tensor that contains the radial profile of the brightness in units of flux/arcsec^2. The radius of each node is determined fromI_R.prof.- Parameters:
I_R – Tensor of radial brightness values in units of flux/arcsec^2.
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I_R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.spline.SplinePSFMixin[source]#
Bases:
objectSpline radial model for brightness.
The
radial_modelfunction for this model is defined as a spline interpolation from the parameterI_R. TheI_Rparameter is a tensor that contains the radial profile of the brightness in units of flux/pix^2. The radius of each node is determined fromI_R.prof.- Parameters:
I_R – Tensor of radial brightness values in units of flux/pix^2.
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I_R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.spline.iSplineMixin[source]#
Bases:
objectBatched spline radial model for brightness.
The
radial_modelfunction for this model is defined as a spline interpolation from the parameterI_R. TheI_Rparameter is a tensor that contains the radial profile of the brightness in units of flux/arcsec^2. The radius of each node is determined fromI_R.prof.Both
I_RandI_R.profare batched by their first dimension, allowing for multiple spline profiles to be defined at once. Each individual spline model is thenI_R[i]andI_R.prof[i]whereiindexes the profiles.- Parameters:
I_R – Tensor of radial brightness values in units of flux/arcsec^2.
- iradial_model(i: int, R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I_R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
astrophot.models.mixins.transform module#
- class astrophot.models.mixins.transform.FourierEllipseMixin(*args, modes: Tuple[int] = (3, 4), **kwargs)[source]#
Bases:
objectSine wave perturbation of the elliptical radius metric.
This allows for the expression of arbitrarily complex isophotes instead of pure ellipses. This is a common extension of the standard elliptical representation. The form of the Fourier perturbations is:
\[R' = R * \exp\left(\sum_m(a_m * \cos(m * \theta + \phi_m))\right)\]where R’ is the new radius value, R is the original radius (typically computed as \(\sqrt{x^2+y^2}\)), m is the index of the Fourier mode, a_m is the amplitude of the m’th Fourier mode, theta is the angle around the ellipse (typically \(\arctan(y/x)\)), and phi_m is the phase of the m’th fourier mode.
One can create extremely complex shapes using different Fourier modes, however usually it is only low order modes that are of interest. For intuition, the first Fourier mode is roughly equivalent to a lopsided galaxy, one side will be compressed and the opposite side will be expanded. The second mode is almost never used as it is nearly degenerate with ellipticity. The third mode is an alternate kind of lopsidedness for a galaxy which makes it somewhat triangular, meaning that it is wider on one side than the other. The fourth mode is similar to a boxyness/diskyness parameter of a superelllipse which tends to make more pronounced peanut shapes since it is more rounded than a superellipse representation. Modes higher than 4 are only useful in very specialized situations. In general one should consider carefully why the Fourier modes are being used for the science case at hand.
- Parameters:
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode.
phim – Tensor of phases for the Fourier modes, adjusts the orientation of the mode perturbation relative to the major axis. It is cyclically defined in the range [0,2pi)
modes – Tuple of integers indicating which Fourier modes to use.
- radius_metric(x: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], y: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], am: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], phim: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.transform.InclinedMixin[source]#
Bases:
objectA model which defines a position angle and axis ratio.
PA and q operate on the coordinates to transform the model. Given some x,y the updated values are:
\[x', y' = {\rm rotate}(-PA + \pi/2, x, y)\]\[y'' = y' / q\]where x’ and y’’ are the final transformed coordinates. The \(\pi/2\) is included such that the position angle is defined with 0 at north. The -PA is such that the position angle increases to the East. Thus, the position angle is a standard East of North definition assuming the WCS of the image is correct.
Note that this means radii are defined with \(R = \sqrt{x^2 + \left(\frac{y}{q}\right)^2}\) rather than the common alternative which is \(R = \sqrt{qx^2 + \frac{y^2}{q}}\)
- Parameters:
q – Axis ratio of the model, defined as the ratio of the semi-minor axis to the semi-major axis. A value of 1.0 is circular.
PA – Position angle of the model, defined as the angle between the semi-major axis and North, measured East of North. A value of 0.0 is North, a value of pi/2 is East.
- transform_coordinates(x: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], y: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], PA: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], q: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Tuple[Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']][source]#
- class astrophot.models.mixins.transform.SuperEllipseMixin[source]#
Bases:
objectUses a generalized definition of radius to make boxy/disky models.
A superellipse transformation allows for the expression of “boxy” and “disky” modifications to traditional elliptical isophotes. This is a common extension of the standard elliptical representation, especially for early-type galaxies. The functional form for this is:
\[R = (|x|^C + |y|^C)^{1/C}\]where \(R\) is the new distance metric, \(X\) and \(Y\) are the coordinates, and \(C\) is the coefficient for the superellipse. \(C\) can take on any value greater than zero where \(C = 2\) is the standard distance metric, \(0 < C < 2\) creates disky or pointed perturbations to an ellipse, and \(C > 2\) transforms an ellipse to be more boxy.
- Parameters:
C – Superellipse distance metric parameter, controls the shape of the isophotes. A value of 2.0 is a standard elliptical distance metric, values less than 2.0 create disky or pointed perturbations to an ellipse, and values greater than 2.0 create boxy perturbations to an ellipse.
- radius_metric(x: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], y: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], C: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.transform.TruncationMixin(*args, outer_truncation: bool = True, **kwargs)[source]#
Bases:
objectTruncated model with radial brightness profile.
This model will smoothly truncate the radial brightness profile at Rt. The truncation is centered on Rt and thus two identical models with the same Rt (and St) where one is inner truncated and the other is outer truncated will reproduce nearly the same as a single un-truncated model.
By default the St parameter is set fixed to 1.0, giving a relatively smooth truncation. This can be set to a smaller value for sharper truncations or a larger value for even more gradual truncation. It can be set dynamic to be optimized in a model, though it is possible for this parameter to be unstable if there isn’t a clear truncation signal in the data.
- Parameters:
Rt – The truncation radius in arcseconds.
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius.
outer_truncation – If True, the model will truncate the brightness beyond the truncation radius. If False, the model will truncate the brightness within the truncation radius.
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rt: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], St: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.transform.WarpMixin[source]#
Bases:
objectWarped model with varying PA and q as a function of radius.
This works by warping the coordinates using the same transform for a global PA, q except applied to each pixel individually based on its unwarped radius value. In the limit that PA and q are a constant, this recovers a basic model with global PA, q. However, a linear PA profile will give a spiral appearance, variations of PA, q profiles can create complex galaxy models. The form of the coordinate transformation for each pixel looks like:
\[R = \sqrt{x^2 + y^2}\]\[x', y' = \rm{rotate}(-PA(R) + \pi/2, x, y)\]\[y'' = y' / q(R)\]Note that now PA and q are functions of radius R, which is computed from the original coordinates X, Y. This is achieved by making PA and q a spline profile.
- Parameters:
q_R – Tensor of axis ratio values for axis ratio spline
PA_R – Tensor of position angle values as input to the spline
- transform_coordinates(x: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], y: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], q_R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], PA_R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Tuple[Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']][source]#
Module contents#
- class astrophot.models.mixins.ExponentialMixin[source]#
Bases:
objectExponential radial light profile.
An exponential is a classical radial model used in many contexts. The functional form of the exponential profile is defined as:
\[I(R) = I_e \exp\left(- b_1\left(\frac{R}{R_e} - 1\right)\right)\]Ie is the brightness at the effective radius, and Re is the effective radius. \(b_1\) is a constant that ensures \(I_e\) is the brightness at \(R_e\).
- Parameters:
Re – effective radius in arcseconds
Ie – effective surface density in flux/arcsec^2
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Re: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ie: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.ExponentialPSFMixin[source]#
Bases:
objectExponential radial light profile.
An exponential is a classical radial model used in many contexts. The functional form of the exponential profile is defined as:
\[I(R) = I_e \exp\left(- b_1\left(\frac{R}{R_e} - 1\right)\right)\]Ie is the brightness at the effective radius, and Re is the effective radius. \(b_1\) is a constant that ensures \(I_e\) is the brightness at \(R_e\).
- Parameters:
Re – effective radius in pixels
Ie – effective surface density in flux/pix^2
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Re: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ie: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.FerrerMixin[source]#
Bases:
objectModified Ferrer radial light profile (Binney & Tremaine 1987).
This model has a relatively flat brightness core and then a truncation. It is used in specialized circumstances such as fitting the bar of a galaxy. The functional form of the Modified Ferrer profile is defined as:
\[I(R) = I_0 \left(1 - \left(\frac{R}{r_{\rm out}}\right)^{2-\beta}\right)^{\alpha}\]where
routis the outer truncation radius,alphacontrols the steepness of the truncation,betacontrols the shape, andI0is the intensity at the center of the profile.- Parameters:
rout – Outer truncation radius in arcseconds.
alpha – Inner slope parameter.
beta – Outer slope parameter.
I0 – Intensity at the center of the profile in flux/arcsec^2
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], rout: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], beta: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.FerrerPSFMixin[source]#
Bases:
objectModified Ferrer radial light profile (Binney & Tremaine 1987).
This model has a relatively flat brightness core and then a truncation. It is used in specialized circumstances such as fitting the bar of a galaxy. The functional form of the Modified Ferrer profile is defined as:
\[I(R) = I_0 \left(1 - \left(\frac{R}{r_{\rm out}}\right)^{2-\beta}\right)^{\alpha}\]where
routis the outer truncation radius,alphacontrols the steepness of the truncation,betacontrols the shape, andI0is the intensity at the center of the profile.- Parameters:
rout – Outer truncation radius in pixels.
alpha – Inner slope parameter.
beta – Outer slope parameter.
I0 – Intensity at the center of the profile in flux/pix^2
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], rout: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], beta: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.FourierEllipseMixin(*args, modes: Tuple[int] = (3, 4), **kwargs)[source]#
Bases:
objectSine wave perturbation of the elliptical radius metric.
This allows for the expression of arbitrarily complex isophotes instead of pure ellipses. This is a common extension of the standard elliptical representation. The form of the Fourier perturbations is:
\[R' = R * \exp\left(\sum_m(a_m * \cos(m * \theta + \phi_m))\right)\]where R’ is the new radius value, R is the original radius (typically computed as \(\sqrt{x^2+y^2}\)), m is the index of the Fourier mode, a_m is the amplitude of the m’th Fourier mode, theta is the angle around the ellipse (typically \(\arctan(y/x)\)), and phi_m is the phase of the m’th fourier mode.
One can create extremely complex shapes using different Fourier modes, however usually it is only low order modes that are of interest. For intuition, the first Fourier mode is roughly equivalent to a lopsided galaxy, one side will be compressed and the opposite side will be expanded. The second mode is almost never used as it is nearly degenerate with ellipticity. The third mode is an alternate kind of lopsidedness for a galaxy which makes it somewhat triangular, meaning that it is wider on one side than the other. The fourth mode is similar to a boxyness/diskyness parameter of a superelllipse which tends to make more pronounced peanut shapes since it is more rounded than a superellipse representation. Modes higher than 4 are only useful in very specialized situations. In general one should consider carefully why the Fourier modes are being used for the science case at hand.
- Parameters:
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode.
phim – Tensor of phases for the Fourier modes, adjusts the orientation of the mode perturbation relative to the major axis. It is cyclically defined in the range [0,2pi)
modes – Tuple of integers indicating which Fourier modes to use.
- radius_metric(x: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], y: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], am: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], phim: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.GaussianMixin[source]#
Bases:
objectGaussian radial light profile.
The Gaussian profile is a simple and widely used model for extended objects. The functional form of the Gaussian profile is defined as:
\[I(R) = \frac{{\rm flux}}{\sqrt{2\pi}\sigma} \exp(-R^2 / (2 \sigma^2))\]where
I_0is the intensity at the center of the profile andsigmais the standard deviation which controls the width of the profile.- Parameters:
sigma – Standard deviation of the Gaussian profile in arcseconds.
flux – Total flux of the Gaussian profile.
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], sigma: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], flux: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.GaussianPSFMixin[source]#
Bases:
objectGaussian radial light profile.
The Gaussian profile is a simple and widely used model for extended objects. The functional form of the Gaussian profile is defined as:
\[I(R) = \frac{{\rm flux}}{\sqrt{2\pi}\sigma} \exp(-R^2 / (2 \sigma^2))\]where
I_0is the intensity at the center of the profile andsigmais the standard deviation which controls the width of the profile.- Parameters:
sigma – Standard deviation of the Gaussian profile in pixels.
flux – Total flux of the Gaussian profile.
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], sigma: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], flux: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.GradMixin[source]#
Bases:
object- Parameters:
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
- gradient(params: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None, likelihood: Literal['gaussian', 'poisson'] = 'gaussian') Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
Compute the gradient of the model likelihood with respect to its parameters.
- jacobian(pass_jacobian: JacobianImage | None = None, params: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None) JacobianImage[source]#
- jacobian_maxparams = 10#
- class astrophot.models.mixins.InclinedMixin[source]#
Bases:
objectA model which defines a position angle and axis ratio.
PA and q operate on the coordinates to transform the model. Given some x,y the updated values are:
\[x', y' = {\rm rotate}(-PA + \pi/2, x, y)\]\[y'' = y' / q\]where x’ and y’’ are the final transformed coordinates. The \(\pi/2\) is included such that the position angle is defined with 0 at north. The -PA is such that the position angle increases to the East. Thus, the position angle is a standard East of North definition assuming the WCS of the image is correct.
Note that this means radii are defined with \(R = \sqrt{x^2 + \left(\frac{y}{q}\right)^2}\) rather than the common alternative which is \(R = \sqrt{qx^2 + \frac{y^2}{q}}\)
- Parameters:
q – Axis ratio of the model, defined as the ratio of the semi-minor axis to the semi-major axis. A value of 1.0 is circular.
PA – Position angle of the model, defined as the angle between the semi-major axis and North, measured East of North. A value of 0.0 is North, a value of pi/2 is East.
- transform_coordinates(x: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], y: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], PA: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], q: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Tuple[Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']][source]#
- class astrophot.models.mixins.KingMixin[source]#
Bases:
objectEmpirical King radial light profile (Elson 1999).
Often used for star clusters. By default the profile has
alpha = 2but we allow the parameter to vary freely for fitting. The functional form of the Empirical King profile is defined as:\[I(R) = I_0\left[\frac{1}{(1 + (R/R_c)^2)^{1/\alpha}} - \frac{1}{(1 + (R_t/R_c)^2)^{1/\alpha}}\right]^{\alpha}\left[1 - \frac{1}{(1 + (R_t/R_c)^2)^{1/\alpha}}\right]^{-\alpha}\]where
R_cis the core radius,R_tis the truncation radius, andI_0is the intensity at the center of the profile.alphais the concentration index which controls the shape of the profile.- Parameters:
Rc – core radius
Rt – truncation radius
alpha – concentration index which controls the shape of the brightness profile
I0 – intensity at the center of the profile
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rc: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rt: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.KingPSFMixin[source]#
Bases:
objectEmpirical King radial light profile (Elson 1999).
Often used for star clusters. By default the profile has
alpha = 2but we allow the parameter to vary freely for fitting. The functional form of the Empirical King profile is defined as:\[I(R) = I_0\left[\frac{1}{(1 + (R/R_c)^2)^{1/\alpha}} - \frac{1}{(1 + (R_t/R_c)^2)^{1/\alpha}}\right]^{\alpha}\left[1 - \frac{1}{(1 + (R_t/R_c)^2)^{1/\alpha}}\right]^{-\alpha}\]where
R_cis the core radius,R_tis the truncation radius, andI_0is the intensity at the center of the profile.alphais the concentration index which controls the shape of the profile.- Parameters:
Rc – core radius [pix]
Rt – truncation radius [pix]
alpha – concentration index which controls the shape of the brightness profile
I0 – intensity at the center of the profile [flux/pix^2]
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rc: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rt: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.MoffatMixin[source]#
Bases:
objectMoffat radial light profile (Moffat 1969).
The moffat profile gives a good representation of the general structure of PSF functions for ground based data. It can also be used to fit extended objects. The functional form of the Moffat profile is defined as:
\[I(R) = \frac{I_0}{(1 + (R/R_d)^2)^n}\]nis the concentration index which controls the shape of the profile.- Parameters:
n – Concentration index which controls the shape of the brightness profile
Rd – Scale length radius
I0 – Intensity at the center of the profile
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], n: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rd: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.MoffatPSFMixin[source]#
Bases:
objectMoffat radial light profile (Moffat 1969).
The moffat profile gives a good representation of the general structure of PSF functions for ground based data. It can also be used to fit extended objects. The functional form of the Moffat profile is defined as:
\[I(R) = \frac{I_0}{(1 + (R/R_d)^2)^n}\]nis the concentration index which controls the shape of the profile.- Parameters:
n – Concentration index which controls the shape of the brightness profile
Rd – Scale length radius [pix]
I0 – Intensity at the center of the profile [flux/pix^2]
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], n: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rd: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.NukerMixin[source]#
Bases:
objectNuker radial light profile (Lauer et al. 1995).
This is a classic profile used widely in galaxy modelling. The functional form of the Nuker profile is defined as:
\[I(R) = I_b2^{\frac{\beta - \gamma}{\alpha}}\left(\frac{R}{R_b}\right)^{-\gamma}\left[1 + \left(\frac{R}{R_b}\right)^{\alpha}\right]^{\frac{\gamma-\beta}{\alpha}}\]It is effectively a double power law profile. \(\gamma\) gives the inner slope, \(\beta\) gives the outer slope, \(\alpha\) is somewhat degenerate with the other slopes.
- Parameters:
Rb – scale length radius
Ib – intensity at the scale length
alpha – sharpness of transition between power law slopes
beta – outer power law slope
gamma – inner power law slope
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rb: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ib: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], beta: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], gamma: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.NukerPSFMixin[source]#
Bases:
objectNuker radial light profile (Lauer et al. 1995).
This is a classic profile used widely in galaxy modelling. The functional form of the Nuker profile is defined as:
\[I(R) = I_b2^{\frac{\beta - \gamma}{\alpha}}\left(\frac{R}{R_b}\right)^{-\gamma}\left[1 + \left(\frac{R}{R_b}\right)^{\alpha}\right]^{\frac{\gamma-\beta}{\alpha}}\]It is effectively a double power law profile. \(\gamma\) gives the inner slope, \(\beta\) gives the outer slope, \(\alpha\) is somewhat degenerate with the other slopes.
- Parameters:
Rb – scale length radius [pix]
Ib – intensity at the scale length [flux/pix^2]
alpha – sharpness of transition between power law slopes
beta – outer power law slope
gamma – inner power law slope
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rb: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ib: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], beta: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], gamma: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.RadialMixin[source]#
Bases:
objectThis model defines its
brightness(x,y)function using a radial model. Thus the brightness is instead defined asradial_model(R)More specifically the function is:
\[x, y = {\rm transform\_coordinates}(x, y)\]\[R = {\rm radius\_metric}(x, y)\]\[I(x, y) = {\rm radial\_model}(R)\]The
transform_coordinatesfunction depends on the model. In its simplest form it simply subtracts the center of the model to re-center the coordinates.The
radius_metricfunction is also model dependent, in its simplest form this is just \(R = \sqrt{x^2 + y^2}\).- brightness(x: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], y: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
Calculate the brightness at a given point (x, y) based on radial distance from the center.
- class astrophot.models.mixins.RayMixin(*args, symmetric: bool = True, segments: int = 2, **kwargs)[source]#
Bases:
objectDefines a model with multiple profiles along rays projected from the center.
model which defines multiple radial models separately along some number of rays projected from the center. These rays smoothly transition from one to another along angles theta. The ray transition uses a cosine smoothing function which depends on the number of rays, for example with two rays the brightness would be:
\[I(R,\theta) = I_1(R)*\cos(\theta \% \pi) + I_2(R)*\cos((\theta + \pi/2) \% \pi)\]For \(\theta = 0\) the brightness comes entirely from
I_1while for \(\theta = \pi/2\) the brightness comes entirely fromI_2.- Parameters:
symmetric – If True, the model will have symmetry for rotations of pi radians and each ray will appear twice on the sky on opposite sides of the model. If False, each ray is independent.
segments – The number of segments to divide the model into. This controls how many rays are used in the model. The default is 2
- brightness(x: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], y: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- polar_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], T: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.SampleMixin(*args, sampling_mode='auto', integrate_mode='bright', **kwargs)[source]#
Bases:
object- Parameters:
sampling_mode – The method used to sample the model in image pixels. Options are: auto: Automatically choose the sampling method based on the image size (default). midpoint: Use midpoint sampling, evaluate the brightness at the center of each pixel. simpsons: Use Simpson’s rule for sampling integrating each pixel. upsample:x upsample the pixel in a regular grid of size x (odd positive integer), generally less accurate than quad:x. quad:x: Use quadrature sampling with order x, where x is an odd positive integer to integrate each pixel.
integrate_mode – The method used to select pixels to integrate further where the model varies significantly. Options are: none: No extra integration is performed (beyond the sampling_mode). bright: Select the brightest pixels for further integration (default). threshold: Select pixels which show signs of significant higher order derivatives.
integrate_fraction – The fraction of the pixels to super sample during integration (default: 0.05).
integrate_max_depth – The maximum depth of the integration method (default: 2).
integrate_gridding – The gridding used for the integration method to super-sample a pixel at each iteration (default: 5).
integrate_quad_order – The order of the quadrature used for the integration method on the super sampled pixels (default: 3).
- integrate_fraction = 0.05#
- integrate_gridding = 5#
- integrate_max_depth = 2#
- property integrate_mode#
- integrate_quad_order = 3#
- property sampling_mode#
- class astrophot.models.mixins.SersicMixin[source]#
Bases:
objectSersic radial light profile (Sersic 1963).
This is a classic profile used widely in galaxy modelling. It can be a good starting point for many extended objects. The functional form of the Sersic profile is defined as:
\[I(R) = I_e \exp(- b_n((R/R_e)^{1/n} - 1))\]It is a generalization of a gaussian, exponential, and de-Vaucouleurs profile. The Sersic index
ncontrols the shape of the profile, withn=1being an exponential profile,n=4being a de-Vaucouleurs profile, andn=0.5being a Gaussian profile.- Parameters:
n – Sersic index which controls the shape of the brightness profile
Re – half light radius [arcsec]
Ie – intensity at the half light radius [flux/arcsec^2]
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], n: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Re: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ie: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.SersicPSFMixin[source]#
Bases:
objectSersic radial light profile (Sersic 1963).
This is a classic profile used widely in galaxy modelling, though it is simply a generalization of a Gaussian. It can be a good starting point for many objects. The functional form of the Sersic profile is defined as:
\[I(R) = I_e \exp(- b_n((R/R_e)^{1/n} - 1))\]It includes the gaussian, exponential, and de-Vaucouleurs profiles. The Sersic index
ncontrols the shape of the profile, withn=1being an exponential profile,n=4being a de-Vaucouleurs profile, andn=0.5being a Gaussian profile.- Parameters:
n – Sersic index which controls the shape of the brightness profile
Re – half light radius [pix]
Ie – intensity at the half light radius [flux/pix^2]
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], n: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Re: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ie: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.SplineMixin[source]#
Bases:
objectSpline radial model for brightness.
The
radial_modelfunction for this model is defined as a spline interpolation from the parameterI_R. TheI_Rparameter is a tensor that contains the radial profile of the brightness in units of flux/arcsec^2. The radius of each node is determined fromI_R.prof.- Parameters:
I_R – Tensor of radial brightness values in units of flux/arcsec^2.
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I_R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.SplinePSFMixin[source]#
Bases:
objectSpline radial model for brightness.
The
radial_modelfunction for this model is defined as a spline interpolation from the parameterI_R. TheI_Rparameter is a tensor that contains the radial profile of the brightness in units of flux/pix^2. The radius of each node is determined fromI_R.prof.- Parameters:
I_R – Tensor of radial brightness values in units of flux/pix^2.
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I_R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.SuperEllipseMixin[source]#
Bases:
objectUses a generalized definition of radius to make boxy/disky models.
A superellipse transformation allows for the expression of “boxy” and “disky” modifications to traditional elliptical isophotes. This is a common extension of the standard elliptical representation, especially for early-type galaxies. The functional form for this is:
\[R = (|x|^C + |y|^C)^{1/C}\]where \(R\) is the new distance metric, \(X\) and \(Y\) are the coordinates, and \(C\) is the coefficient for the superellipse. \(C\) can take on any value greater than zero where \(C = 2\) is the standard distance metric, \(0 < C < 2\) creates disky or pointed perturbations to an ellipse, and \(C > 2\) transforms an ellipse to be more boxy.
- Parameters:
C – Superellipse distance metric parameter, controls the shape of the isophotes. A value of 2.0 is a standard elliptical distance metric, values less than 2.0 create disky or pointed perturbations to an ellipse, and values greater than 2.0 create boxy perturbations to an ellipse.
- radius_metric(x: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], y: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], C: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.TruncationMixin(*args, outer_truncation: bool = True, **kwargs)[source]#
Bases:
objectTruncated model with radial brightness profile.
This model will smoothly truncate the radial brightness profile at Rt. The truncation is centered on Rt and thus two identical models with the same Rt (and St) where one is inner truncated and the other is outer truncated will reproduce nearly the same as a single un-truncated model.
By default the St parameter is set fixed to 1.0, giving a relatively smooth truncation. This can be set to a smaller value for sharper truncations or a larger value for even more gradual truncation. It can be set dynamic to be optimized in a model, though it is possible for this parameter to be unstable if there isn’t a clear truncation signal in the data.
- Parameters:
Rt – The truncation radius in arcseconds.
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius.
outer_truncation – If True, the model will truncate the brightness beyond the truncation radius. If False, the model will truncate the brightness within the truncation radius.
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rt: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], St: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.WarpMixin[source]#
Bases:
objectWarped model with varying PA and q as a function of radius.
This works by warping the coordinates using the same transform for a global PA, q except applied to each pixel individually based on its unwarped radius value. In the limit that PA and q are a constant, this recovers a basic model with global PA, q. However, a linear PA profile will give a spiral appearance, variations of PA, q profiles can create complex galaxy models. The form of the coordinate transformation for each pixel looks like:
\[R = \sqrt{x^2 + y^2}\]\[x', y' = \rm{rotate}(-PA(R) + \pi/2, x, y)\]\[y'' = y' / q(R)\]Note that now PA and q are functions of radius R, which is computed from the original coordinates X, Y. This is achieved by making PA and q a spline profile.
- Parameters:
q_R – Tensor of axis ratio values for axis ratio spline
PA_R – Tensor of position angle values as input to the spline
- transform_coordinates(x: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], y: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], q_R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], PA_R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Tuple[Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']][source]#
- class astrophot.models.mixins.WedgeMixin(*args, symmetric: bool = True, segments: int = 2, **kwargs)[source]#
Bases:
objectDefines a model with multiple profiles that form wedges projected from the center.
model which defines multiple radial models separately along some number of wedges projected from the center. These wedges have sharp transitions along boundary angles theta.
- Parameters:
symmetric – If True, the model will have symmetry for rotations of pi radians and each ray will appear twice on the sky on opposite sides of the model. If False, each ray is independent.
segments – The number of segments to divide the model into. This controls how many rays are used in the model. The default is 2
- polar_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], T: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.iExponentialMixin[source]#
Bases:
objectExponential radial light profile.
An exponential is a classical radial model used in many contexts. The functional form of the exponential profile is defined as:
\[I(R) = I_e \exp\left(- b_1\left(\frac{R}{R_e} - 1\right)\right)\]\(I_e\) is the brightness at the effective radius, and \(R_e\) is the effective radius. \(b_1\) is a constant that ensures \(I_e\) is the brightness at \(R_e\).
ReandIeare batched by their first dimension, allowing for multiple exponential profiles to be defined at once.- Parameters:
Re – effective radius in arcseconds
Ie – effective surface density in flux/arcsec^2
- iradial_model(i: int, R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Re: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ie: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.iFerrerMixin[source]#
Bases:
objectModified Ferrer radial light profile (Binney & Tremaine 1987).
This model has a relatively flat brightness core and then a truncation. It is used in specialized circumstances such as fitting the bar of a galaxy. The functional form of the Modified Ferrer profile is defined as:
\[I(R) = I_0 \left(1 - \left(\frac{R}{r_{\rm out}}\right)^{2-\beta}\right)^{\alpha}\]where
routis the outer truncation radius,alphacontrols the steepness of the truncation,betacontrols the shape, andI0is the intensity at the center of the profile.rout,alpha,beta, andI0are batched by their first dimension, allowing for multiple Ferrer profiles to be defined at once.- Parameters:
rout – Outer truncation radius in arcseconds.
alpha – Inner slope parameter.
beta – Outer slope parameter.
I0 – Intensity at the center of the profile in flux/arcsec^2
- iradial_model(i: int, R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], rout: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], beta: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.iGaussianMixin[source]#
Bases:
objectGaussian radial light profile.
The Gaussian profile is a simple and widely used model for extended objects. The functional form of the Gaussian profile is defined as:
\[I(R) = \frac{{\rm flux}}{\sqrt{2\pi}\sigma} \exp(-R^2 / (2 \sigma^2))\]where
sigmais the standard deviation which controls the width of the profile andfluxgives the total flux of the profile (assuming no perturbations).sigmaandfluxare batched by their first dimension, allowing for multiple Gaussian profiles to be defined at once.- Parameters:
sigma – Standard deviation of the Gaussian profile in arcseconds.
flux – Total flux of the Gaussian profile.
- iradial_model(i: int, R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], sigma: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], flux: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.iKingMixin[source]#
Bases:
objectEmpirical King radial light profile (Elson 1999).
Often used for star clusters. By default the profile has
alpha = 2but we allow the parameter to vary freely for fitting. The functional form of the Empirical King profile is defined as:\[I(R) = I_0\left[\frac{1}{(1 + (R/R_c)^2)^{1/\alpha}} - \frac{1}{(1 + (R_t/R_c)^2)^{1/\alpha}}\right]^{\alpha}\left[1 - \frac{1}{(1 + (R_t/R_c)^2)^{1/\alpha}}\right]^{-\alpha}\]where
R_cis the core radius,R_tis the truncation radius, andI_0is the intensity at the center of the profile.alphais the concentration index which controls the shape of the profile.Rc,Rt,alpha, andI0are batched by their first dimension, allowing for multiple King profiles to be defined at once.- Parameters:
Rc – core radius
Rt – truncation radius
alpha – concentration index which controls the shape of the brightness profile
I0 – intensity at the center of the profile
- iradial_model(i: int, R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rc: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rt: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.iMoffatMixin[source]#
Bases:
objectMoffat radial light profile (Moffat 1969).
The moffat profile gives a good representation of the general structure of PSF functions for ground based data. It can also be used to fit extended objects. The functional form of the Moffat profile is defined as:
\[I(R) = \frac{I_0}{(1 + (R/R_d)^2)^n}\]nis the concentration index which controls the shape of the profile.n,Rd, andI0are batched by their first dimension, allowing for multiple Moffat profiles to be defined at once.- Parameters:
n – Concentration index which controls the shape of the brightness profile
Rd – Scale length radius
I0 – Intensity at the center of the profile
- iradial_model(i: int, R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], n: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rd: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.iNukerMixin[source]#
Bases:
objectNuker radial light profile (Lauer et al. 1995).
This is a classic profile used widely in galaxy modelling. The functional form of the Nuker profile is defined as:
\[I(R) = I_b2^{\frac{\beta - \gamma}{\alpha}}\left(\frac{R}{R_b}\right)^{-\gamma}\left[1 + \left(\frac{R}{R_b}\right)^{\alpha}\right]^{\frac{\gamma-\beta}{\alpha}}\]It is effectively a double power law profile. \(\gamma\) gives the inner slope, \(\beta\) gives the outer slope, \(\alpha\) is somewhat degenerate with the other slopes.
Rb,Ib,alpha,beta, andgammaare batched by their first dimension, allowing for multiple Nuker profiles to be defined at once.- Parameters:
Rb – scale length radius
Ib – intensity at the scale length
alpha – sharpness of transition between power law slopes
beta – outer power law slope
gamma – inner power law slope
- iradial_model(i: int, R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Rb: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ib: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], alpha: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], beta: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], gamma: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.iSersicMixin[source]#
Bases:
objectSersic radial light profile (Sersic 1963).
This is a classic profile used widely in galaxy modelling. It can be a good starting point for many extended objects. The functional form of the Sersic profile is defined as:
\[I(R) = I_e \exp(- b_n((R/R_e)^{1/n} - 1))\]It is a generalization of a gaussian, exponential, and de-Vaucouleurs profile. The Sersic index
ncontrols the shape of the profile, withn=1being an exponential profile,n=4being a de-Vaucouleurs profile, andn=0.5being a Gaussian profile.n,Re, andIeare batched by their first dimension, allowing for multiple Sersic profiles to be defined at once.- Parameters:
n – Sersic index which controls the shape of the brightness profile
Re – half light radius [arcsec]
Ie – intensity at the half light radius [flux/arcsec^2]
- iradial_model(i: int, R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], n: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Re: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], Ie: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- class astrophot.models.mixins.iSplineMixin[source]#
Bases:
objectBatched spline radial model for brightness.
The
radial_modelfunction for this model is defined as a spline interpolation from the parameterI_R. TheI_Rparameter is a tensor that contains the radial profile of the brightness in units of flux/arcsec^2. The radius of each node is determined fromI_R.prof.Both
I_RandI_R.profare batched by their first dimension, allowing for multiple spline profiles to be defined at once. Each individual spline model is thenI_R[i]andI_R.prof[i]whereiindexes the profiles.- Parameters:
I_R – Tensor of radial brightness values in units of flux/arcsec^2.
- iradial_model(i: int, R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], I_R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#