astrophot.models package#
Subpackages#
- astrophot.models.func package
- Submodules
- astrophot.models.func.base module
- astrophot.models.func.convolution module
- astrophot.models.func.exponential module
- astrophot.models.func.ferrer module
- astrophot.models.func.gaussian module
- astrophot.models.func.gaussian_ellipsoid module
- astrophot.models.func.integration module
- astrophot.models.func.king module
- astrophot.models.func.moffat module
- astrophot.models.func.nuker module
- astrophot.models.func.sersic module
- astrophot.models.func.spline module
- astrophot.models.func.transform module
- astrophot.models.func.zernike module
- Module contents
all_subclasses()bright_integrate()convolve()curvature_kernel()downsample()downsample_mean()euler_rotation_matrix()exponential()ferrer()gaussian()king()moffat()nuker()pixel_center_integrator()pixel_quad_integrator()pixel_simpsons_integrator()quad_table()recursive_quad_integrate()rotate()sersic()sersic_n_to_b()single_quad_integrate()spline()upsample()zernike_basis()zernike_n_m_list()zernike_n_m_modes()
- astrophot.models.mixins package
- Submodules
- astrophot.models.mixins.brightness module
- astrophot.models.mixins.exponential module
- astrophot.models.mixins.ferrer module
- astrophot.models.mixins.gaussian module
- astrophot.models.mixins.king module
- astrophot.models.mixins.moffat module
- astrophot.models.mixins.nuker module
- astrophot.models.mixins.sample module
- astrophot.models.mixins.sersic module
- astrophot.models.mixins.spline module
- astrophot.models.mixins.transform module
- Module contents
ExponentialMixinExponentialPSFMixinFerrerMixinFerrerPSFMixinFourierEllipseMixinGaussianMixinGaussianPSFMixinGradMixinInclinedMixinKingMixinKingPSFMixinMoffatMixinMoffatPSFMixinNukerMixinNukerPSFMixinRadialMixinRayMixinSampleMixinSersicMixinSersicPSFMixinSplineMixinSplinePSFMixinSuperEllipseMixinTruncationMixinWarpMixinWedgeMixiniExponentialMixiniFerrerMixiniGaussianMixiniKingMixiniMoffatMixiniNukerMixiniSersicMixiniSplineMixin
Submodules#
astrophot.models.airy module#
- class astrophot.models.airy.AiryPSF(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
RadialMixin,PSFModelThe Airy disk is an analytic description of the diffraction pattern for a circular aperture.
The diffraction pattern is described exactly by the configuration of the lens system under the assumption that all elements are perfect. This expression goes as:
\[I(\theta) = I_0\left[\frac{2J_1(x)}{x}\right]^2\]\[x = ka\sin(\theta) = \frac{2\pi a r}{\lambda R}\]where \(I(\theta)\) is the intensity as a function of the angular position within the diffraction system along its main axis, \(I_0\) is the central intensity of the airy disk, \(J_1\) is the Bessel function of the first kind of order one, \(k = \frac{2\pi}{\lambda}\) is the wavenumber of the light, \(a\) is the aperture radius, \(r\) is the radial position from the center of the pattern, \(R\) is the distance from the circular aperture to the observation plane.
In the
Airy_PSFclass we combine the parameters \(a,R,\lambda\) into a single ratio to be optimized (or fixed by the optical configuration).RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]I0 – The central intensity of the airy disk in flux/arcsec^2. [model param]
aRL – The ratio of the aperture radius to the product of the wavelength and the distance from the aperture to the observation plane, \(\frac{a}{R \lambda}\). [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- radial_model(R: 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.'], aRL: 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]#
- usable = True#
astrophot.models.base module#
- class astrophot.models.base.Model(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ModuleBase class for all AstroPhot models.
- gaussian_log_likelihood() Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
Compute the negative log likelihood of the model wrt the target image in the appropriate window.
- model_type = 'model'#
- options = {'softening'}#
- parameter_specs = {}#
- poisson_log_likelihood() Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
Compute the negative log likelihood of the model wrt the target image in the appropriate window.
- softening = 0.001#
- to(dtype=None, device=None)[source]#
Moves and/or casts the values of the
Nodeto a particular device and/or dtype.Parameters#
- device: (Optional[torch.device], optional)
The device to move the values to. Defaults to None.
- dtype: (Optional[torch.dtype], optional)
The desired data type. Defaults to None.
- total_flux() Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- total_flux_uncertainty() Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- total_magnitude() Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
Compute the total magnitude of the model in the given window.
- total_magnitude_uncertainty() Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
Compute the uncertainty in the total magnitude of the model in the given window.
- usable = False#
- property window: Window | None#
The window defines a region on the sky in which this model will be optimized and typically evaluated. Two models with non-overlapping windows are in effect independent of each other. If there is another model with a window that spans both of them, then they are tenuously connected.
If not provided, the model will assume a window equal to the target it is fitting. Note that in this case the window is not explicitly set to the target window, so if the model is moved to another target then the fitting window will also change.
astrophot.models.basis module#
- class astrophot.models.basis.BasisModel(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ComponentModelModel described by a set of basis images.
This model is composed of a set of basis images (think eigen decomposition or zernike polynomials) that are linearly combined with some weights to form the model image. The basis images are defined on a grid of coordinates, and the brightness at any point is determined by bilinear interpolation of the basis images. This is a very flexible model that can represent a wide range of sources, but depending on the number of basis elements it can become computationally expensive to optimize.
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
weights – The weights of the basis set of images in units of flux. [model param]
PA – the position angle of the model, in radians. [model param]
scale – the scale of the model, in arcsec per grid unit. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- property basis#
The basis set of images used to form the model.
- 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.'], weights: 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]#
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- 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.'], scale: 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]#
- usable = True#
astrophot.models.basis_psf module#
- class astrophot.models.basis_psf.PixelBasisPSF(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
PSFModelpoint source model which uses multiple images as a basis for the PSF as its representation for point sources. Using bilinear interpolation it will shift the PSF within a pixel to accurately represent the center location of a point source. There is no functional form for this object type as any image can be supplied. Bilinear interpolation is very fast and accurate for smooth models, so it is possible to do the expensive interpolation before optimization and save time.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]weights – The weights of the basis set of images in units of flux. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- property basis#
The basis set of images used to form the eigen point source.
- 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.'], weights: 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]#
- usable = True#
astrophot.models.batch_model_object module#
- class astrophot.models.batch_model_object.BatchModel(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
GradMixin,SampleMixin,ModelA batch of models that all share the same window/target.
This can for example be used to model a crowded area of the sky with many overlapping sources, or to model a single object that is represented by many components (consider this a generalization of the Multi-gaussian expansion model). If you want to model the same object in multiple images, see the BatchSceneModel instead.
- Note: any model parameters that you wish to batch over must be set to
dynamic=True. See [caskade hierarchical models](https://caskade.readthedocs.io/en/latest/notebooks/HierarchicalModels.html) for more details.
- property mask#
- property target: TargetImage | None#
- usable = True#
- property window: Window | None#
The window defines a region on the sky in which this model will be optimized and evaluated. Two models with non-overlapping windows are in effect independent of each other. If there is another model with a window that spans both of them, then they are tenuously connected.
If not provided, the model will assume a window equal to the target it is fitting. Note that in this case the window is not explicitly set to the target window, so if the model is moved to another target then the fitting window will also change.
- class astrophot.models.batch_model_object.BatchSceneModel(*, filename=None, model_type=None, **kwargs)[source]#
-
A single model as viewed in multiple images.
This model is quite restrictive in its use, but can provide a significant speedup by vectorizing the evaluation of the model. Some key things to keep in mind:
All model parameters that you wish to batch over must be set to dynamic=True. See [caskade hierarchical models](https://caskade.readthedocs.io/en/latest/notebooks/HierarchicalModels.html) for more details.
You must use a TargetImageBatch as the target, meaning that all the images must be the same number of pixels.
You must use a WindowBatch as the window (or none to just use the full images), meaning that the windows must all be the same shape in pixels.
The model you provide must have a TargetImage target and Window window, and these must have the same number of pixels as the batched versions.
If the base model has a PSFModel as its PSF then you cannot override it (that’s part of the model), otherwise the PSF from the TargetImageBatch will override the model PSF for all images.
- property target: TargetImageBatch | None#
- usable = True#
- property window: WindowBatch#
The window defines a region on the sky in which this model will be optimized and typically evaluated. Two models with non-overlapping windows are in effect independent of each other. If there is another model with a window that spans both of them, then they are tenuously connected.
If not provided, the model will assume a window equal to the target it is fitting. Note that in this case the window is not explicitly set to the target window, so if the model is moved to another target then the fitting window will also change.
astrophot.models.bilinear_sky module#
- class astrophot.models.bilinear_sky.BilinearSky(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
SkyModelSky background model using a coarse bilinear grid for the sky flux.
SkyModel
Prototype class for any sky background model.
This base class imposes that the
centeris a locked parameter not involved in the fit. Sky models also have no PSF convolution or integration mode by default, since sky backgrounds vary on spatial scales much larger than the PSF or pixel size.ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
I – sky brightness grid [model param]
PA – position angle of the sky grid in radians. [model param]
scale – scale of the sky grid in arcseconds per grid unit. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- 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.'], I: 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]#
- initialize()[source]#
Initialize the sky model, this is called after the model is created and before it is used. This is where we can set the center to be a locked parameter.
- 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.'], I: 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.'], scale: 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]#
- usable = True#
astrophot.models.edgeon module#
- class astrophot.models.edgeon.EdgeonIsothermal(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
EdgeonSechA self-gravitating locally-isothermal edgeon disk. This comes from van der Kruit & Searle 1981.
EdgeonSech
An edgeon profile where the vertical distribution is a sech^2 profile, subclasses define the radial profile.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
PA – Position angle of the edgeon disk in radians. [model param]
I0 – The central intensity of the sech^2 profile in flux/arcsec^2. [model param]
hs – The scale height of the sech^2 profile in arcseconds. [model param]
rs – Scale radius of the isothermal disk in arcseconds. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], rs: 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]#
- usable = True#
- class astrophot.models.edgeon.EdgeonModel(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ComponentModelGeneral Edge-On galaxy model to be subclassed for any specific representation such as radial light profile or the structure of the galaxy on the sky. Defines an edgeon galaxy as an object with a position angle, no inclination information is included.
- Parameters:
PA – Position angle of the edgeon disk in radians.
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- 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.']) 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]#
- usable = False#
- class astrophot.models.edgeon.EdgeonSech(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
EdgeonModelAn edgeon profile where the vertical distribution is a sech^2 profile, subclasses define the radial profile.
- Parameters:
I0 – The central intensity of the sech^2 profile in flux/arcsec^2.
hs – The scale height of the sech^2 profile in arcseconds.
- 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.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], hs: 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]#
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- usable = False#
astrophot.models.flatsky module#
- class astrophot.models.flatsky.FlatSky(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
SkyModelModel for the sky background in which all values across the image are the same.
SkyModel
Prototype class for any sky background model.
This base class imposes that the
centeris a locked parameter not involved in the fit. Sky models also have no PSF convolution or integration mode by default, since sky backgrounds vary on spatial scales much larger than the PSF or pixel size.ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
I0 – brightness for the sky, represented as the log of the brightness over pixel scale squared, this is proportional to a surface brightness [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- 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.'], 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]#
- initialize()[source]#
Initialize the sky model, this is called after the model is created and before it is used. This is where we can set the center to be a locked parameter.
- usable = True#
astrophot.models.galaxy_model_object module#
- class astrophot.models.galaxy_model_object.GalaxyModel(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
InclinedMixin,ComponentModelIntended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = False#
astrophot.models.gaussian_ellipsoid module#
- class astrophot.models.gaussian_ellipsoid.GaussianEllipsoid(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ComponentModelModel that represents a galaxy as a 3D Gaussian ellipsoid.
The model is triaxial, meaning it has three different standard deviations along the three axes. The orientation of the ellipsoid is defined by Euler angles.
If all three Euler angles are set to zero, the ellipsoid is aligned with the image axes meaning sigma_a gives the std along the x axis of the tangent plane, sigma_b gives the std along the y axis of the tangent plane, and sigma_z gives the std into the tangent plane. We use the ZXZ convention for the Euler angles. This means that for a disk galaxy, one can naturally consider sigma_c as the disk thickness and sigma_a=sigma_b as the disk radius; setting the Euler angles to zero would leave the disk face-on in the x-y tangent plane.
- Note:
the model is highly degenerate, meaning that it is not possible to uniquely determine the parameters from the data. The model is useful if one already has a 3D model of the galaxy in mind and wants to produce mock data. Alternately, if one applies some constraints on the parameters, such as sigma_a = sigma_b and alpha=0, then the model will be better determined. In that case, beta is related to the inclination of the disk and gamma is related to the position angle of the disk. The initialization for this model assumes exactly this interpretation with a disk thickness of sigma_c = 0.2 *sigma_a.
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
sigma_a – Standard deviation of the Gaussian along the alpha axis in arcseconds. [model param]
sigma_b – Standard deviation of the Gaussian along the beta axis in arcseconds. [model param]
sigma_c – Standard deviation of the Gaussian along the gamma axis in arcseconds. [model param]
alpha – Euler angle representing the rotation around the alpha axis in radians. [model param]
beta – Euler angle representing the rotation around the beta axis in radians. [model param]
gamma – Euler angle representing the rotation around the gamma axis in radians. [model param]
flux – Total flux of the galaxy in arbitrary units. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- 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.'], sigma_a: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], sigma_b: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], sigma_c: 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.'], 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]#
Brightness of the Gaussian ellipsoid.
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- usable = True#
astrophot.models.group_model_object module#
- class astrophot.models.group_model_object.GroupModel(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ModelModel object which represents a list of other models. For each general AstroPhot model method, this calls all the appropriate models from its list and combines their output into a single summed model. This class should be used when describing any system more complex than makes sense to represent with a single light distribution.
- Args:
name (str): unique name for the full group model target (Target_Image): the target image that this group model is trying to fit to models (Optional[Sequence[AstroPhot_Model]]): list of AstroPhot_Model objects which will combine for the group model locked (bool): if the whole group of models should be locked
- deblend() Sequence[TargetImage][source]#
Generate deblended images for each sub-model in this group model. Each deblended image contains for each pixel, the fraction of the total flux at that pixel which is contributed by that sub-model.
- Returns:
Sequence[TargetImage]: List of deblended TargetImage objects for each sub-model.
- initialize()[source]#
Initialize each model in this group. Does this by iteratively initializing a model then subtracting it from a copy of the target.
- jacobian(pass_jacobian: JacobianImage | JacobianImageList | None = None, params=None) JacobianImage[source]#
Compute the jacobian for this model. Done by first constructing a full jacobian (Npixels * Nparameters) of zeros then call the jacobian method of each sub model and add it in to the total.
Args: - pass_jacobian (Optional[JacobianImage]): A Jacobian image pre-constructed to be passed along instead of constructing new Jacobians - window (Optional[Window]): A window within which to evaluate the jacobian. If not provided, the model’s window will be used. - params (Optional[Sequence[Param]]): Parameters to use for the jacobian. If not provided, the model’s parameters will be used.
- sample(_CD: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None, _crtan: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None, _crpix: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None, _psf: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None) ModelImage | ModelImageList[source]#
Sample the group model on an image. Produces the flux values for each pixel associated with the models in this group. Each model is called individually and the results are added together in one larger image.
Args: - image (Optional[ModelImage]): Image to sample on, overrides the windows for each sub model, they will all be evaluated over this entire image. If left as none then each sub model will be evaluated in its window.
- segmentation_map() Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
Generate a segmentation map for this group model. Each pixel in the segmentation map is assigned an integer value corresponding to the index of the sub-model that corresponds to that pixel. The pixels are assigned based on “relative importance”, meaning that for each pixel, the sub-model which contributes the largest fraction of its own total flux to that pixel is assigned to it.
- Returns:
ArrayLike: Segmentation map with the same shape as the target image as windowed by the group model window.
- property target: TargetImage | TargetImageList | None#
- usable = True#
- property window: Window | WindowList | None#
The window defines a region on the sky in which this model will be optimized and typically evaluated. Two models with non-overlapping windows are in effect independent of each other. If there is another model with a window that spans both of them, then they are tenuously connected.
If not provided, the model will assume a window equal to the target it is fitting. Note that in this case the window is not explicitly set to the target window, so if the model is moved to another target then the fitting window will also change.
astrophot.models.group_psf_model module#
astrophot.models.model_object module#
- class astrophot.models.model_object.ComponentModel(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
GradMixin,SampleMixin,ModelComponent of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- internal_psf = False#
- pixel_brightness(i, j, _CD=None, _crtan=None, _crpix=None)[source]#
Evaluate the model at the pixel coordinates defined by i and j (of the target image).
- property psf#
- psf_convolve = True#
- sample(I_: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], J_: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], psf: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] = None, crop: int = 0, downsample: int = 1, _CD: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None, _crtan: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None, _crpix: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None)[source]#
- property target#
- usable = False#
astrophot.models.multi_gaussian_expansion module#
- class astrophot.models.multi_gaussian_expansion.MultiGaussianExpansion(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ComponentModelModel that represents a galaxy as a sum of multiple Gaussian profiles. The model is defined as:
\[I(R) = \sum_i {\rm flux}_i * \exp(-0.5*(R_i / \sigma_i)^2) / (2 * \pi * q_i * \sigma_i^2)\]where \(R_i\) is a radius computed using \(q_i\) and \(PA_i\) for that component. All components share the same center.
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
q – axis ratio to scale minor axis from the ratio of the minor/major axis b/a, this parameter is unitless, it is restricted to the range (0,1) [model param]
PA – position angle of the semi-major axis relative to the image positive x-axis in radians, it is a cyclic parameter in the range [0,pi) [model param]
sigma – standard deviation of each Gaussian [model param]
flux – amplitude of each Gaussian [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- 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.'], flux: 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.'], q: 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]#
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- 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: 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.']) 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]#
- usable = True#
astrophot.models.pixelated_model module#
- class astrophot.models.pixelated_model.Pixelated(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ComponentModelModel described by a grid of pixels on the sky (bilinear interpolation)
This model represents an extended source on the sky as a grid of pixels with some brightness. The brightness at any point is determined by bilinear interpolation of the grid values. This is a very flexible model that can represent any source, but it is also computationally expensive to optimize the large number of free parameters.
The PA and scale are also parameters of this model, so one could alternately fix the pixels to some image and just fit the PA and scale.
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
I – the total flux within each pixel, represented as the log of the flux. [model param]
PA – the position angle of the model, in radians. [model param]
scale – the scale of the model, in arcsec per grid unit. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- 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.'], I: 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]#
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- 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.'], scale: 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]#
- usable = True#
astrophot.models.pixelated_psf module#
- class astrophot.models.pixelated_psf.PixelatedPSF(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
PSFModelpoint source model which uses an image of the PSF as its representation for point sources. Using bilinear interpolation it will shift the PSF within a pixel to accurately represent the center location of a point source. There is no functional form for this object type as any image can be supplied. The image pixels will be optimized as individual parameters. This can very quickly result in a large number of parameters and a near impossible fitting task, ideally this should be restricted to a very small area likely at the center of the PSF.
To initialize the PSF image will by default be set to the target PSF_Image values, thus one can use an empirical PSF as a starting point. Since only bilinear interpolation is performed, it is recommended to provide the PSF at a higher resolution than the image if it is near the nyquist sampling limit. Bilinear interpolation is very fast and accurate for smooth models, so this way it is possible to do the expensive interpolation before optimization and save time. Note that if you do this you must provide the PSF as a PSF_Image object with the correct pixelscale (essentially just divide the pixelscale by the upsampling factor you used).
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]pixels – the total flux within each pixel, represented as the log of the flux. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- 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.'], pixels: 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]#
- usable = True#
astrophot.models.planesky module#
- class astrophot.models.planesky.PlaneSky(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
SkyModelSky background model using a tilted plane for the sky flux. The brightness for each pixel is defined as:
\[I(X, Y) = I_0 + X*\delta_x + Y*\delta_y\]where \(I(X,Y)\) is the brightness as a function of image position \(X, Y\), \(I_0\) is the central sky brightness value, and \(\delta_x, \delta_y\) are the slopes of the sky brightness plane.
SkyModel
Prototype class for any sky background model.
This base class imposes that the
centeris a locked parameter not involved in the fit. Sky models also have no PSF convolution or integration mode by default, since sky backgrounds vary on spatial scales much larger than the PSF or pixel size.ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
I0 – central sky brightness value [model param]
delta – Tensor for slope of the sky brightness in each image dimension [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- 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.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], delta: 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]#
- initialize()[source]#
Initialize the sky model, this is called after the model is created and before it is used. This is where we can set the center to be a locked parameter.
- usable = True#
astrophot.models.point_source module#
- class astrophot.models.point_source.PointSource(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ComponentModelDescribes a point source in the image, this is a delta function at some position in the sky. This is typically used to describe stars, supernovae, very small galaxies, quasars, asteroids or any other object which can essentially be entirely described by a position and total flux (no structure).
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
flux – The total flux of the point source [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- property integrate_mode#
- internal_psf = True#
- property psf_convolve#
bool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
- sample(I_: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], J_: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], psf: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] = None, crop: int = 0, downsample: int = 1, center=None, flux=None, _CD=None, _crtan=None, _crpix=None)[source]#
- usable = True#
astrophot.models.psf_model_object module#
- class astrophot.models.psf_model_object.PSFModel(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
GradMixin,SampleMixin,ModelPrototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit.normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- normalize_psf = True#
- property pad#
- pixel_brightness(i, j)[source]#
Evaluate the model at the pixel coordinates defined by i and j (of the target image). For a PSF model, this is the same as the brightness since it is defined in pixel units.
- sample(i: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], j: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], *args, **kwargs) PSFImage[source]#
Sample the PSF model on the pixel grid defined by i and j.
Depending on the model specification, this may involve supersampling for higher precision, or it may just be a direct evaluation of the model at the pixel centers. The output is the flux evaluated over the pixel grid at native resolution (for the PSFImage associated with this model.)
- Parameters:
i – 2D array of x-coordinates of pixel centers (or pre-upsampled according to the
sampling_mode) in pixel units.j – 2D array of y-coordinates of pixel centers (or pre-upsampled according to the
sampling_mode) in pixel units.
- Returns:
2D array (
Z) of flux values at each pixel center, representing the PSF model evaluated at those coordinates.
- property target#
- 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.'], center: 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]#
- property upsample#
- usable = False#
astrophot.models.radial module#
- class astrophot.models.radial.ExponentialFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialMixin,RadialMixin,FourierEllipseMixin,GalaxyModelExponentialMixin
Exponential 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\).
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
Re – effective radius in arcseconds [model param]
Ie – effective surface density in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.radial.ExponentialGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialMixin,RadialMixin,GalaxyModelExponentialMixin
Exponential 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\).
RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Re – effective radius in arcseconds [model param]
Ie – effective surface density in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.ExponentialRay(*, filename=None, model_type=None, **kwargs)#
Bases:
iExponentialMixin,RayMixin,GalaxyModeliExponentialMixin
Exponential 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.RayMixin
Defines 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.GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Re – effective radius in arcseconds [model param]
Ie – effective surface density in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.radial.ExponentialSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialMixin,RadialMixin,SuperEllipseMixin,GalaxyModelExponentialMixin
Exponential 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\).
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
Re – effective radius in arcseconds [model param]
Ie – effective surface density in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.ExponentialWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialMixin,RadialMixin,WarpMixin,GalaxyModelExponentialMixin
Exponential 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\).
RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
Re – effective radius in arcseconds [model param]
Ie – effective surface density in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.ExponentialWedge(*, filename=None, model_type=None, **kwargs)#
Bases:
iExponentialMixin,WedgeMixin,GalaxyModeliExponentialMixin
Exponential 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.WedgeMixin
Defines 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Re – effective radius in arcseconds [model param]
Ie – effective surface density in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.radial.FerrerFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerMixin,RadialMixin,FourierEllipseMixin,GalaxyModelFerrerMixin
Modified 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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
rout – Outer truncation radius in arcseconds. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.radial.FerrerGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerMixin,RadialMixin,GalaxyModelFerrerMixin
Modified 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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
rout – Outer truncation radius in arcseconds. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.FerrerRay(*, filename=None, model_type=None, **kwargs)#
Bases:
iFerrerMixin,RayMixin,GalaxyModeliFerrerMixin
Modified 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.RayMixin
Defines 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.GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
rout – Outer truncation radius in arcseconds. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.radial.FerrerSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerMixin,RadialMixin,SuperEllipseMixin,GalaxyModelFerrerMixin
Modified 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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
rout – Outer truncation radius in arcseconds. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.FerrerWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerMixin,RadialMixin,WarpMixin,GalaxyModelFerrerMixin
Modified 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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
rout – Outer truncation radius in arcseconds. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.FerrerWedge(*, filename=None, model_type=None, **kwargs)#
Bases:
iFerrerMixin,WedgeMixin,GalaxyModeliFerrerMixin
Modified 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.WedgeMixin
Defines 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
rout – Outer truncation radius in arcseconds. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.radial.GaussianFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianMixin,RadialMixin,FourierEllipseMixin,GalaxyModelGaussianMixin
Gaussian 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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
sigma – Standard deviation of the Gaussian profile in arcseconds. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.radial.GaussianGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianMixin,RadialMixin,GalaxyModelGaussianMixin
Gaussian 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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in arcseconds. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.GaussianRay(*, filename=None, model_type=None, **kwargs)#
Bases:
iGaussianMixin,RayMixin,GalaxyModeliGaussianMixin
Gaussian 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.RayMixin
Defines 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.GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in arcseconds. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.radial.GaussianSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianMixin,RadialMixin,SuperEllipseMixin,GalaxyModelGaussianMixin
Gaussian 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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in arcseconds. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.GaussianWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianMixin,RadialMixin,WarpMixin,GalaxyModelGaussianMixin
Gaussian 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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
sigma – Standard deviation of the Gaussian profile in arcseconds. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.GaussianWedge(*, filename=None, model_type=None, **kwargs)#
Bases:
iGaussianMixin,WedgeMixin,GalaxyModeliGaussianMixin
Gaussian 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.WedgeMixin
Defines 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in arcseconds. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.radial.KingFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
KingMixin,RadialMixin,FourierEllipseMixin,GalaxyModelKingMixin
Empirical 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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
Rc – core radius [model param]
Rt – truncation radius [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.radial.KingGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
KingMixin,RadialMixin,GalaxyModelKingMixin
Empirical 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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Rc – core radius [model param]
Rt – truncation radius [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.KingRay(*, filename=None, model_type=None, **kwargs)#
Bases:
iKingMixin,RayMixin,GalaxyModeliKingMixin
Empirical 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.RayMixin
Defines 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.GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Rc – core radius [model param]
Rt – truncation radius [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.radial.KingSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
KingMixin,RadialMixin,SuperEllipseMixin,GalaxyModelKingMixin
Empirical 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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
Rc – core radius [model param]
Rt – truncation radius [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.KingWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
KingMixin,RadialMixin,WarpMixin,GalaxyModelKingMixin
Empirical 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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
Rc – core radius [model param]
Rt – truncation radius [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.KingWedge(*, filename=None, model_type=None, **kwargs)#
Bases:
iKingMixin,WedgeMixin,GalaxyModeliKingMixin
Empirical 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.WedgeMixin
Defines 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Rc – core radius [model param]
Rt – truncation radius [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.radial.MoffatFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatMixin,RadialMixin,FourierEllipseMixin,GalaxyModelMoffatMixin
Moffat 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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [model param]
I0 – Intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.radial.MoffatGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatMixin,RadialMixin,GalaxyModelMoffatMixin
Moffat 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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [model param]
I0 – Intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.MoffatRay(*, filename=None, model_type=None, **kwargs)#
Bases:
iMoffatMixin,RayMixin,GalaxyModeliMoffatMixin
Moffat 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.RayMixin
Defines 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.GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [model param]
I0 – Intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.radial.MoffatSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatMixin,RadialMixin,SuperEllipseMixin,GalaxyModelMoffatMixin
Moffat 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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [model param]
I0 – Intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.MoffatWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatMixin,RadialMixin,WarpMixin,GalaxyModelMoffatMixin
Moffat 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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [model param]
I0 – Intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.MoffatWedge(*, filename=None, model_type=None, **kwargs)#
Bases:
iMoffatMixin,WedgeMixin,GalaxyModeliMoffatMixin
Moffat 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.WedgeMixin
Defines 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [model param]
I0 – Intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.radial.NukerFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerMixin,RadialMixin,FourierEllipseMixin,GalaxyModelNukerMixin
Nuker 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.
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
Rb – scale length radius [model param]
Ib – intensity at the scale length [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.radial.NukerGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerMixin,RadialMixin,GalaxyModelNukerMixin
Nuker 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.
RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Rb – scale length radius [model param]
Ib – intensity at the scale length [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.NukerRay(*, filename=None, model_type=None, **kwargs)#
Bases:
iNukerMixin,RayMixin,GalaxyModeliNukerMixin
Nuker 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.RayMixin
Defines 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.GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Rb – scale length radius [model param]
Ib – intensity at the scale length [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.radial.NukerSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerMixin,RadialMixin,SuperEllipseMixin,GalaxyModelNukerMixin
Nuker 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.
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
Rb – scale length radius [model param]
Ib – intensity at the scale length [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.NukerWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerMixin,RadialMixin,WarpMixin,GalaxyModelNukerMixin
Nuker 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.
RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
Rb – scale length radius [model param]
Ib – intensity at the scale length [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.NukerWedge(*, filename=None, model_type=None, **kwargs)#
Bases:
iNukerMixin,WedgeMixin,GalaxyModeliNukerMixin
Nuker 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.WedgeMixin
Defines 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Rb – scale length radius [model param]
Ib – intensity at the scale length [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.radial.SersicFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicMixin,RadialMixin,FourierEllipseMixin,GalaxyModelSersicMixin
Sersic 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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [arcsec] [model param]
Ie – intensity at the half light radius [flux/arcsec^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.radial.SersicGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicMixin,RadialMixin,GalaxyModelSersicMixin
Sersic 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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [arcsec] [model param]
Ie – intensity at the half light radius [flux/arcsec^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.SersicRay(*, filename=None, model_type=None, **kwargs)#
Bases:
iSersicMixin,RayMixin,GalaxyModeliSersicMixin
Sersic 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.RayMixin
Defines 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.GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [arcsec] [model param]
Ie – intensity at the half light radius [flux/arcsec^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.radial.SersicSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicMixin,RadialMixin,SuperEllipseMixin,GalaxyModelSersicMixin
Sersic 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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [arcsec] [model param]
Ie – intensity at the half light radius [flux/arcsec^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.SersicWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicMixin,RadialMixin,WarpMixin,GalaxyModelSersicMixin
Sersic 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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [arcsec] [model param]
Ie – intensity at the half light radius [flux/arcsec^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.SersicWedge(*, filename=None, model_type=None, **kwargs)#
Bases:
iSersicMixin,WedgeMixin,GalaxyModeliSersicMixin
Sersic 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.WedgeMixin
Defines 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [arcsec] [model param]
Ie – intensity at the half light radius [flux/arcsec^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.radial.SplineFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SplineMixin,RadialMixin,FourierEllipseMixin,GalaxyModelSplineMixin
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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
I_R – Tensor of radial brightness values in units of flux/arcsec^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.radial.SplineGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
SplineMixin,RadialMixin,GalaxyModelSplineMixin
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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/arcsec^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.SplineRay(*, filename=None, model_type=None, **kwargs)#
Bases:
iSplineMixin,RayMixin,GalaxyModeliSplineMixin
Batched 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.RayMixin
Defines 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.GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/arcsec^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.radial.SplineSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SplineMixin,RadialMixin,SuperEllipseMixin,GalaxyModelSplineMixin
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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/arcsec^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.SplineWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
SplineMixin,RadialMixin,WarpMixin,GalaxyModelSplineMixin
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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
I_R – Tensor of radial brightness values in units of flux/arcsec^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.radial.SplineWedge(*, filename=None, model_type=None, **kwargs)#
Bases:
iSplineMixin,WedgeMixin,GalaxyModeliSplineMixin
Batched 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.WedgeMixin
Defines 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/arcsec^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.radial.TExponentialFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,ExponentialMixin,RadialMixin,FourierEllipseMixin,GalaxyModelTruncationMixin
Truncated 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.
ExponentialMixin
Exponential 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\).
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
Re – effective radius in arcseconds [model param]
Ie – effective surface density in flux/arcsec^2 [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
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.
- usable = True#
- class astrophot.models.radial.TExponentialGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,ExponentialMixin,RadialMixin,GalaxyModelTruncationMixin
Truncated 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.
ExponentialMixin
Exponential 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\).
RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Re – effective radius in arcseconds [model param]
Ie – effective surface density in flux/arcsec^2 [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TExponentialSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,ExponentialMixin,RadialMixin,SuperEllipseMixin,GalaxyModelTruncationMixin
Truncated 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.
ExponentialMixin
Exponential 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\).
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
Re – effective radius in arcseconds [model param]
Ie – effective surface density in flux/arcsec^2 [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TExponentialWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,ExponentialMixin,RadialMixin,WarpMixin,GalaxyModelTruncationMixin
Truncated 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.
ExponentialMixin
Exponential 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\).
RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
Re – effective radius in arcseconds [model param]
Ie – effective surface density in flux/arcsec^2 [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TFerrerFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,FerrerMixin,RadialMixin,FourierEllipseMixin,GalaxyModelTruncationMixin
Truncated 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.
FerrerMixin
Modified 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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
rout – Outer truncation radius in arcseconds. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/arcsec^2 [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
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.
- usable = True#
- class astrophot.models.radial.TFerrerGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,FerrerMixin,RadialMixin,GalaxyModelTruncationMixin
Truncated 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.
FerrerMixin
Modified 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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
rout – Outer truncation radius in arcseconds. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/arcsec^2 [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TFerrerSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,FerrerMixin,RadialMixin,SuperEllipseMixin,GalaxyModelTruncationMixin
Truncated 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.
FerrerMixin
Modified 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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
rout – Outer truncation radius in arcseconds. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/arcsec^2 [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TFerrerWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,FerrerMixin,RadialMixin,WarpMixin,GalaxyModelTruncationMixin
Truncated 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.
FerrerMixin
Modified 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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
rout – Outer truncation radius in arcseconds. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/arcsec^2 [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TGaussianFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,GaussianMixin,RadialMixin,FourierEllipseMixin,GalaxyModelTruncationMixin
Truncated 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.
GaussianMixin
Gaussian 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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
sigma – Standard deviation of the Gaussian profile in arcseconds. [model param]
flux – Total flux of the Gaussian profile. [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
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.
- usable = True#
- class astrophot.models.radial.TGaussianGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,GaussianMixin,RadialMixin,GalaxyModelTruncationMixin
Truncated 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.
GaussianMixin
Gaussian 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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in arcseconds. [model param]
flux – Total flux of the Gaussian profile. [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TGaussianSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,GaussianMixin,RadialMixin,SuperEllipseMixin,GalaxyModelTruncationMixin
Truncated 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.
GaussianMixin
Gaussian 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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in arcseconds. [model param]
flux – Total flux of the Gaussian profile. [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TGaussianWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,GaussianMixin,RadialMixin,WarpMixin,GalaxyModelTruncationMixin
Truncated 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.
GaussianMixin
Gaussian 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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
sigma – Standard deviation of the Gaussian profile in arcseconds. [model param]
flux – Total flux of the Gaussian profile. [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TKingFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,KingMixin,RadialMixin,FourierEllipseMixin,GalaxyModelTruncationMixin
Truncated 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.
KingMixin
Empirical 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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
Rc – core radius [model param]
Rt – The truncation radius in arcseconds. [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
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.
- usable = True#
- class astrophot.models.radial.TKingGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,KingMixin,RadialMixin,GalaxyModelTruncationMixin
Truncated 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.
KingMixin
Empirical 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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Rc – core radius [model param]
Rt – The truncation radius in arcseconds. [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TKingSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,KingMixin,RadialMixin,SuperEllipseMixin,GalaxyModelTruncationMixin
Truncated 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.
KingMixin
Empirical 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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
Rc – core radius [model param]
Rt – The truncation radius in arcseconds. [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TKingWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,KingMixin,RadialMixin,WarpMixin,GalaxyModelTruncationMixin
Truncated 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.
KingMixin
Empirical 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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
Rc – core radius [model param]
Rt – The truncation radius in arcseconds. [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TMoffatFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,MoffatMixin,RadialMixin,FourierEllipseMixin,GalaxyModelTruncationMixin
Truncated 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.
MoffatMixin
Moffat 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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [model param]
I0 – Intensity at the center of the profile [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
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.
- usable = True#
- class astrophot.models.radial.TMoffatGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,MoffatMixin,RadialMixin,GalaxyModelTruncationMixin
Truncated 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.
MoffatMixin
Moffat 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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [model param]
I0 – Intensity at the center of the profile [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TMoffatSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,MoffatMixin,RadialMixin,SuperEllipseMixin,GalaxyModelTruncationMixin
Truncated 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.
MoffatMixin
Moffat 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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [model param]
I0 – Intensity at the center of the profile [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TMoffatWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,MoffatMixin,RadialMixin,WarpMixin,GalaxyModelTruncationMixin
Truncated 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.
MoffatMixin
Moffat 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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [model param]
I0 – Intensity at the center of the profile [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TNukerFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,NukerMixin,RadialMixin,FourierEllipseMixin,GalaxyModelTruncationMixin
Truncated 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.
NukerMixin
Nuker 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.
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
Rb – scale length radius [model param]
Ib – intensity at the scale length [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
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.
- usable = True#
- class astrophot.models.radial.TNukerGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,NukerMixin,RadialMixin,GalaxyModelTruncationMixin
Truncated 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.
NukerMixin
Nuker 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.
RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Rb – scale length radius [model param]
Ib – intensity at the scale length [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TNukerSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,NukerMixin,RadialMixin,SuperEllipseMixin,GalaxyModelTruncationMixin
Truncated 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.
NukerMixin
Nuker 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.
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
Rb – scale length radius [model param]
Ib – intensity at the scale length [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TNukerWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,NukerMixin,RadialMixin,WarpMixin,GalaxyModelTruncationMixin
Truncated 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.
NukerMixin
Nuker 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.
RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
Rb – scale length radius [model param]
Ib – intensity at the scale length [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TSersicFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,SersicMixin,RadialMixin,FourierEllipseMixin,GalaxyModelTruncationMixin
Truncated 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.
SersicMixin
Sersic 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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [arcsec] [model param]
Ie – intensity at the half light radius [flux/arcsec^2] [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
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.
- usable = True#
- class astrophot.models.radial.TSersicGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,SersicMixin,RadialMixin,GalaxyModelTruncationMixin
Truncated 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.
SersicMixin
Sersic 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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [arcsec] [model param]
Ie – intensity at the half light radius [flux/arcsec^2] [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TSersicSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,SersicMixin,RadialMixin,SuperEllipseMixin,GalaxyModelTruncationMixin
Truncated 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.
SersicMixin
Sersic 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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [arcsec] [model param]
Ie – intensity at the half light radius [flux/arcsec^2] [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TSersicWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,SersicMixin,RadialMixin,WarpMixin,GalaxyModelTruncationMixin
Truncated 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.
SersicMixin
Sersic 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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [arcsec] [model param]
Ie – intensity at the half light radius [flux/arcsec^2] [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TSplineFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,SplineMixin,RadialMixin,FourierEllipseMixin,GalaxyModelTruncationMixin
Truncated 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.
SplineMixin
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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
I_R – Tensor of radial brightness values in units of flux/arcsec^2. [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
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.
- usable = True#
- class astrophot.models.radial.TSplineGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,SplineMixin,RadialMixin,GalaxyModelTruncationMixin
Truncated 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.
SplineMixin
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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/arcsec^2. [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TSplineSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,SplineMixin,RadialMixin,SuperEllipseMixin,GalaxyModelTruncationMixin
Truncated 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.
SplineMixin
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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/arcsec^2. [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
- class astrophot.models.radial.TSplineWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
TruncationMixin,SplineMixin,RadialMixin,WarpMixin,GalaxyModelTruncationMixin
Truncated 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.
SplineMixin
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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
I_R – Tensor of radial brightness values in units of flux/arcsec^2. [model param]
Rt – The truncation radius in arcseconds. [model param]
St – The steepness of the truncation profile, controlling how quickly the brightness drops to zero at the truncation radius. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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.
- usable = True#
astrophot.models.radial_psf module#
- class astrophot.models.radial_psf.ExponentialPSF(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialPSFMixin,RadialMixin,PSFModelExponentialPSFMixin
Exponential 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\).
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]Re – effective radius in pixels [model param]
Ie – effective surface density in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.ExponentialPSFEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialPSFMixin,EllipseMixin,RadialMixin,PSFModelExponentialPSFMixin
Exponential 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\).
EllipseMixin
PSF model with elliptical isophotes defined by a position angle and axis ratio.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
Re – effective radius in pixels [model param]
Ie – effective surface density in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.ExponentialPSFFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialPSFMixin,InclinedMixin,RadialMixin,FourierEllipseMixin,PSFModelExponentialPSFMixin
Exponential 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\).
InclinedMixin
A 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}}\)
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
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. [model param]
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. [model param]
Re – effective radius in pixels [model param]
Ie – effective surface density in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.radial_psf.ExponentialPSFSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialPSFMixin,InclinedMixin,RadialMixin,SuperEllipseMixin,PSFModelExponentialPSFMixin
Exponential 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\).
InclinedMixin
A 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}}\)
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
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. [model param]
Re – effective radius in pixels [model param]
Ie – effective surface density in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.ExponentialPSFWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialPSFMixin,InclinedMixin,RadialMixin,WarpMixin,PSFModelExponentialPSFMixin
Exponential 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\).
InclinedMixin
A 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}}\)
RadialMixin
This 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}\).WarpMixin
Warped 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
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. [model param]
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. [model param]
Re – effective radius in pixels [model param]
Ie – effective surface density in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.FerrerPSF(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerPSFMixin,RadialMixin,PSFModelFerrerPSFMixin
Modified 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.RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]rout – Outer truncation radius in pixels. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.FerrerPSFEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerPSFMixin,EllipseMixin,RadialMixin,PSFModelFerrerPSFMixin
Modified 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.EllipseMixin
PSF model with elliptical isophotes defined by a position angle and axis ratio.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
rout – Outer truncation radius in pixels. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.FerrerPSFFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerPSFMixin,InclinedMixin,RadialMixin,FourierEllipseMixin,PSFModelFerrerPSFMixin
Modified 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
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. [model param]
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. [model param]
rout – Outer truncation radius in pixels. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.radial_psf.FerrerPSFSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerPSFMixin,InclinedMixin,RadialMixin,SuperEllipseMixin,PSFModelFerrerPSFMixin
Modified 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
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. [model param]
rout – Outer truncation radius in pixels. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.FerrerPSFWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerPSFMixin,InclinedMixin,RadialMixin,WarpMixin,PSFModelFerrerPSFMixin
Modified 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).WarpMixin
Warped 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
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. [model param]
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. [model param]
rout – Outer truncation radius in pixels. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.GaussianPSF(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianPSFMixin,RadialMixin,PSFModelGaussianPSFMixin
Gaussian 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.RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]sigma – Standard deviation of the Gaussian profile in pixels. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.GaussianPSFEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianPSFMixin,EllipseMixin,RadialMixin,PSFModelGaussianPSFMixin
Gaussian 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.EllipseMixin
PSF model with elliptical isophotes defined by a position angle and axis ratio.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in pixels. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.GaussianPSFFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianPSFMixin,InclinedMixin,RadialMixin,FourierEllipseMixin,PSFModelGaussianPSFMixin
Gaussian 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in pixels. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.radial_psf.GaussianPSFSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianPSFMixin,InclinedMixin,RadialMixin,SuperEllipseMixin,PSFModelGaussianPSFMixin
Gaussian 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in pixels. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.GaussianPSFWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianPSFMixin,InclinedMixin,RadialMixin,WarpMixin,PSFModelGaussianPSFMixin
Gaussian 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).WarpMixin
Warped 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in pixels. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.KingPSF(*, filename=None, model_type=None, **kwargs)#
Bases:
KingPSFMixin,RadialMixin,PSFModelKingPSFMixin
Empirical 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.RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]Rc – core radius [pix] [model param]
Rt – truncation radius [pix] [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.KingPSFEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
KingPSFMixin,EllipseMixin,RadialMixin,PSFModelKingPSFMixin
Empirical 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.EllipseMixin
PSF model with elliptical isophotes defined by a position angle and axis ratio.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
Rc – core radius [pix] [model param]
Rt – truncation radius [pix] [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.KingPSFFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
KingPSFMixin,InclinedMixin,RadialMixin,FourierEllipseMixin,PSFModelKingPSFMixin
Empirical 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
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. [model param]
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. [model param]
Rc – core radius [pix] [model param]
Rt – truncation radius [pix] [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.radial_psf.KingPSFSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
KingPSFMixin,InclinedMixin,RadialMixin,SuperEllipseMixin,PSFModelKingPSFMixin
Empirical 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
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. [model param]
Rc – core radius [pix] [model param]
Rt – truncation radius [pix] [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.KingPSFWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
KingPSFMixin,InclinedMixin,RadialMixin,WarpMixin,PSFModelKingPSFMixin
Empirical 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).WarpMixin
Warped 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
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. [model param]
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. [model param]
Rc – core radius [pix] [model param]
Rt – truncation radius [pix] [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.MoffatPSF(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatPSFMixin,RadialMixin,PSFModelMoffatPSFMixin
Moffat 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.RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [pix] [model param]
I0 – Intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.MoffatPSFEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatPSFMixin,EllipseMixin,RadialMixin,PSFModelMoffatPSFMixin
Moffat 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.EllipseMixin
PSF model with elliptical isophotes defined by a position angle and axis ratio.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [pix] [model param]
I0 – Intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.MoffatPSFFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatPSFMixin,InclinedMixin,RadialMixin,FourierEllipseMixin,PSFModelMoffatPSFMixin
Moffat 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [pix] [model param]
I0 – Intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.radial_psf.MoffatPSFSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatPSFMixin,InclinedMixin,RadialMixin,SuperEllipseMixin,PSFModelMoffatPSFMixin
Moffat 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [pix] [model param]
I0 – Intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.MoffatPSFWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatPSFMixin,InclinedMixin,RadialMixin,WarpMixin,PSFModelMoffatPSFMixin
Moffat 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).WarpMixin
Warped 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [pix] [model param]
I0 – Intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.NukerPSF(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerPSFMixin,RadialMixin,PSFModelNukerPSFMixin
Nuker 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.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]Rb – scale length radius [pix] [model param]
Ib – intensity at the scale length [flux/pix^2] [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.NukerPSFEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerPSFMixin,EllipseMixin,RadialMixin,PSFModelNukerPSFMixin
Nuker 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.
EllipseMixin
PSF model with elliptical isophotes defined by a position angle and axis ratio.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
Rb – scale length radius [pix] [model param]
Ib – intensity at the scale length [flux/pix^2] [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.NukerPSFFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerPSFMixin,InclinedMixin,RadialMixin,FourierEllipseMixin,PSFModelNukerPSFMixin
Nuker 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.
InclinedMixin
A 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}}\)
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
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. [model param]
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. [model param]
Rb – scale length radius [pix] [model param]
Ib – intensity at the scale length [flux/pix^2] [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.radial_psf.NukerPSFSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerPSFMixin,InclinedMixin,RadialMixin,SuperEllipseMixin,PSFModelNukerPSFMixin
Nuker 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.
InclinedMixin
A 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}}\)
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
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. [model param]
Rb – scale length radius [pix] [model param]
Ib – intensity at the scale length [flux/pix^2] [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.NukerPSFWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerPSFMixin,InclinedMixin,RadialMixin,WarpMixin,PSFModelNukerPSFMixin
Nuker 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.
InclinedMixin
A 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}}\)
RadialMixin
This 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}\).WarpMixin
Warped 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
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. [model param]
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. [model param]
Rb – scale length radius [pix] [model param]
Ib – intensity at the scale length [flux/pix^2] [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.SersicPSF(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicPSFMixin,RadialMixin,PSFModelSersicPSFMixin
Sersic 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.RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [pix] [model param]
Ie – intensity at the half light radius [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.SersicPSFEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicPSFMixin,EllipseMixin,RadialMixin,PSFModelSersicPSFMixin
Sersic 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.EllipseMixin
PSF model with elliptical isophotes defined by a position angle and axis ratio.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [pix] [model param]
Ie – intensity at the half light radius [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.SersicPSFFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicPSFMixin,InclinedMixin,RadialMixin,FourierEllipseMixin,PSFModelSersicPSFMixin
Sersic 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [pix] [model param]
Ie – intensity at the half light radius [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.radial_psf.SersicPSFSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicPSFMixin,InclinedMixin,RadialMixin,SuperEllipseMixin,PSFModelSersicPSFMixin
Sersic 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [pix] [model param]
Ie – intensity at the half light radius [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.SersicPSFWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicPSFMixin,InclinedMixin,RadialMixin,WarpMixin,PSFModelSersicPSFMixin
Sersic 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).WarpMixin
Warped 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [pix] [model param]
Ie – intensity at the half light radius [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.SplinePSF(*, filename=None, model_type=None, **kwargs)#
Bases:
SplinePSFMixin,RadialMixin,PSFModelSplinePSFMixin
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/pix^2. The radius of each node is determined fromI_R.prof.RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]I_R – Tensor of radial brightness values in units of flux/pix^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.SplinePSFEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SplinePSFMixin,EllipseMixin,RadialMixin,PSFModelSplinePSFMixin
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/pix^2. The radius of each node is determined fromI_R.prof.EllipseMixin
PSF model with elliptical isophotes defined by a position angle and axis ratio.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/pix^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.SplinePSFFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SplinePSFMixin,InclinedMixin,RadialMixin,FourierEllipseMixin,PSFModelSplinePSFMixin
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/pix^2. The radius of each node is determined fromI_R.prof.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/pix^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.radial_psf.SplinePSFSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SplinePSFMixin,InclinedMixin,RadialMixin,SuperEllipseMixin,PSFModelSplinePSFMixin
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/pix^2. The radius of each node is determined fromI_R.prof.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/pix^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.radial_psf.SplinePSFWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
SplinePSFMixin,InclinedMixin,RadialMixin,WarpMixin,PSFModelSplinePSFMixin
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/pix^2. The radius of each node is determined fromI_R.prof.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).WarpMixin
Warped 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/pix^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
astrophot.models.sky_model_object module#
- class astrophot.models.sky_model_object.SkyModel(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ComponentModelPrototype class for any sky background model.
This base class imposes that the
centeris a locked parameter not involved in the fit. Sky models also have no PSF convolution or integration mode by default, since sky backgrounds vary on spatial scales much larger than the PSF or pixel size.ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- initialize()[source]#
Initialize the sky model, this is called after the model is created and before it is used. This is where we can set the center to be a locked parameter.
- property psf_convolve: bool#
bool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
- usable = False#
Module contents#
- class astrophot.models.AiryPSF(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
RadialMixin,PSFModelThe Airy disk is an analytic description of the diffraction pattern for a circular aperture.
The diffraction pattern is described exactly by the configuration of the lens system under the assumption that all elements are perfect. This expression goes as:
\[I(\theta) = I_0\left[\frac{2J_1(x)}{x}\right]^2\]\[x = ka\sin(\theta) = \frac{2\pi a r}{\lambda R}\]where \(I(\theta)\) is the intensity as a function of the angular position within the diffraction system along its main axis, \(I_0\) is the central intensity of the airy disk, \(J_1\) is the Bessel function of the first kind of order one, \(k = \frac{2\pi}{\lambda}\) is the wavenumber of the light, \(a\) is the aperture radius, \(r\) is the radial position from the center of the pattern, \(R\) is the distance from the circular aperture to the observation plane.
In the
Airy_PSFclass we combine the parameters \(a,R,\lambda\) into a single ratio to be optimized (or fixed by the optical configuration).RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]I0 – The central intensity of the airy disk in flux/arcsec^2. [model param]
aRL – The ratio of the aperture radius to the product of the wavelength and the distance from the aperture to the observation plane, \(\frac{a}{R \lambda}\). [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- radial_model(R: 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.'], aRL: 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]#
- usable = True#
- class astrophot.models.BasisModel(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ComponentModelModel described by a set of basis images.
This model is composed of a set of basis images (think eigen decomposition or zernike polynomials) that are linearly combined with some weights to form the model image. The basis images are defined on a grid of coordinates, and the brightness at any point is determined by bilinear interpolation of the basis images. This is a very flexible model that can represent a wide range of sources, but depending on the number of basis elements it can become computationally expensive to optimize.
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
weights – The weights of the basis set of images in units of flux. [model param]
PA – the position angle of the model, in radians. [model param]
scale – the scale of the model, in arcsec per grid unit. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- property basis#
The basis set of images used to form the model.
- 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.'], weights: 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]#
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- 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.'], scale: 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]#
- usable = True#
- class astrophot.models.BatchModel(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
GradMixin,SampleMixin,ModelA batch of models that all share the same window/target.
This can for example be used to model a crowded area of the sky with many overlapping sources, or to model a single object that is represented by many components (consider this a generalization of the Multi-gaussian expansion model). If you want to model the same object in multiple images, see the BatchSceneModel instead.
- Note: any model parameters that you wish to batch over must be set to
dynamic=True. See [caskade hierarchical models](https://caskade.readthedocs.io/en/latest/notebooks/HierarchicalModels.html) for more details.
- property mask#
- property target: TargetImage | None#
- usable = True#
- property window: Window | None#
The window defines a region on the sky in which this model will be optimized and evaluated. Two models with non-overlapping windows are in effect independent of each other. If there is another model with a window that spans both of them, then they are tenuously connected.
If not provided, the model will assume a window equal to the target it is fitting. Note that in this case the window is not explicitly set to the target window, so if the model is moved to another target then the fitting window will also change.
- class astrophot.models.BilinearSky(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
SkyModelSky background model using a coarse bilinear grid for the sky flux.
SkyModel
Prototype class for any sky background model.
This base class imposes that the
centeris a locked parameter not involved in the fit. Sky models also have no PSF convolution or integration mode by default, since sky backgrounds vary on spatial scales much larger than the PSF or pixel size.ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
I – sky brightness grid [model param]
PA – position angle of the sky grid in radians. [model param]
scale – scale of the sky grid in arcseconds per grid unit. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- 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.'], I: 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]#
- initialize()[source]#
Initialize the sky model, this is called after the model is created and before it is used. This is where we can set the center to be a locked parameter.
- 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.'], I: 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.'], scale: 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]#
- usable = True#
- class astrophot.models.ComponentModel(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
GradMixin,SampleMixin,ModelComponent of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- internal_psf = False#
- pixel_brightness(i, j, _CD=None, _crtan=None, _crpix=None)[source]#
Evaluate the model at the pixel coordinates defined by i and j (of the target image).
- property psf#
- psf_convolve = True#
- sample(I_: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], J_: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], psf: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] = None, crop: int = 0, downsample: int = 1, _CD: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None, _crtan: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None, _crpix: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None)[source]#
- property target#
- usable = False#
- class astrophot.models.EdgeonIsothermal(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
EdgeonSechA self-gravitating locally-isothermal edgeon disk. This comes from van der Kruit & Searle 1981.
EdgeonSech
An edgeon profile where the vertical distribution is a sech^2 profile, subclasses define the radial profile.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
PA – Position angle of the edgeon disk in radians. [model param]
I0 – The central intensity of the sech^2 profile in flux/arcsec^2. [model param]
hs – The scale height of the sech^2 profile in arcseconds. [model param]
rs – Scale radius of the isothermal disk in arcseconds. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- radial_model(R: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], rs: 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]#
- usable = True#
- class astrophot.models.EdgeonModel(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ComponentModelGeneral Edge-On galaxy model to be subclassed for any specific representation such as radial light profile or the structure of the galaxy on the sky. Defines an edgeon galaxy as an object with a position angle, no inclination information is included.
- Parameters:
PA – Position angle of the edgeon disk in radians.
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- 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.']) 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]#
- usable = False#
- class astrophot.models.EdgeonSech(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
EdgeonModelAn edgeon profile where the vertical distribution is a sech^2 profile, subclasses define the radial profile.
- Parameters:
I0 – The central intensity of the sech^2 profile in flux/arcsec^2.
hs – The scale height of the sech^2 profile in arcseconds.
- 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.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], hs: 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]#
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- usable = False#
- class astrophot.models.ExponentialFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialMixin,RadialMixin,FourierEllipseMixin,GalaxyModelExponentialMixin
Exponential 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\).
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
Re – effective radius in arcseconds [model param]
Ie – effective surface density in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.ExponentialGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialMixin,RadialMixin,GalaxyModelExponentialMixin
Exponential 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\).
RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Re – effective radius in arcseconds [model param]
Ie – effective surface density in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.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.ExponentialPSF(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialPSFMixin,RadialMixin,PSFModelExponentialPSFMixin
Exponential 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\).
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]Re – effective radius in pixels [model param]
Ie – effective surface density in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.ExponentialPSFEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialPSFMixin,EllipseMixin,RadialMixin,PSFModelExponentialPSFMixin
Exponential 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\).
EllipseMixin
PSF model with elliptical isophotes defined by a position angle and axis ratio.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
Re – effective radius in pixels [model param]
Ie – effective surface density in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.ExponentialPSFFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialPSFMixin,InclinedMixin,RadialMixin,FourierEllipseMixin,PSFModelExponentialPSFMixin
Exponential 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\).
InclinedMixin
A 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}}\)
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
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. [model param]
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. [model param]
Re – effective radius in pixels [model param]
Ie – effective surface density in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.ExponentialPSFSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialPSFMixin,InclinedMixin,RadialMixin,SuperEllipseMixin,PSFModelExponentialPSFMixin
Exponential 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\).
InclinedMixin
A 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}}\)
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
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. [model param]
Re – effective radius in pixels [model param]
Ie – effective surface density in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.ExponentialPSFWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialPSFMixin,InclinedMixin,RadialMixin,WarpMixin,PSFModelExponentialPSFMixin
Exponential 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\).
InclinedMixin
A 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}}\)
RadialMixin
This 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}\).WarpMixin
Warped 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
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. [model param]
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. [model param]
Re – effective radius in pixels [model param]
Ie – effective surface density in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.ExponentialRay(*, filename=None, model_type=None, **kwargs)#
Bases:
iExponentialMixin,RayMixin,GalaxyModeliExponentialMixin
Exponential 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.RayMixin
Defines 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.GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Re – effective radius in arcseconds [model param]
Ie – effective surface density in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.ExponentialSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialMixin,RadialMixin,SuperEllipseMixin,GalaxyModelExponentialMixin
Exponential 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\).
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
Re – effective radius in arcseconds [model param]
Ie – effective surface density in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.ExponentialWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
ExponentialMixin,RadialMixin,WarpMixin,GalaxyModelExponentialMixin
Exponential 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\).
RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
Re – effective radius in arcseconds [model param]
Ie – effective surface density in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.ExponentialWedge(*, filename=None, model_type=None, **kwargs)#
Bases:
iExponentialMixin,WedgeMixin,GalaxyModeliExponentialMixin
Exponential 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.WedgeMixin
Defines 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Re – effective radius in arcseconds [model param]
Ie – effective surface density in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.FerrerFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerMixin,RadialMixin,FourierEllipseMixin,GalaxyModelFerrerMixin
Modified 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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
rout – Outer truncation radius in arcseconds. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.FerrerGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerMixin,RadialMixin,GalaxyModelFerrerMixin
Modified 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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
rout – Outer truncation radius in arcseconds. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.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.FerrerPSF(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerPSFMixin,RadialMixin,PSFModelFerrerPSFMixin
Modified 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.RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]rout – Outer truncation radius in pixels. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.FerrerPSFEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerPSFMixin,EllipseMixin,RadialMixin,PSFModelFerrerPSFMixin
Modified 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.EllipseMixin
PSF model with elliptical isophotes defined by a position angle and axis ratio.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
rout – Outer truncation radius in pixels. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.FerrerPSFFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerPSFMixin,InclinedMixin,RadialMixin,FourierEllipseMixin,PSFModelFerrerPSFMixin
Modified 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
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. [model param]
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. [model param]
rout – Outer truncation radius in pixels. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.FerrerPSFSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerPSFMixin,InclinedMixin,RadialMixin,SuperEllipseMixin,PSFModelFerrerPSFMixin
Modified 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
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. [model param]
rout – Outer truncation radius in pixels. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.FerrerPSFWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerPSFMixin,InclinedMixin,RadialMixin,WarpMixin,PSFModelFerrerPSFMixin
Modified 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).WarpMixin
Warped 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
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. [model param]
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. [model param]
rout – Outer truncation radius in pixels. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/pix^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.FerrerRay(*, filename=None, model_type=None, **kwargs)#
Bases:
iFerrerMixin,RayMixin,GalaxyModeliFerrerMixin
Modified 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.RayMixin
Defines 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.GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
rout – Outer truncation radius in arcseconds. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.FerrerSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerMixin,RadialMixin,SuperEllipseMixin,GalaxyModelFerrerMixin
Modified 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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
rout – Outer truncation radius in arcseconds. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.FerrerWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
FerrerMixin,RadialMixin,WarpMixin,GalaxyModelFerrerMixin
Modified 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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
rout – Outer truncation radius in arcseconds. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.FerrerWedge(*, filename=None, model_type=None, **kwargs)#
Bases:
iFerrerMixin,WedgeMixin,GalaxyModeliFerrerMixin
Modified 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.WedgeMixin
Defines 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
rout – Outer truncation radius in arcseconds. [model param]
alpha – Inner slope parameter. [model param]
beta – Outer slope parameter. [model param]
I0 – Intensity at the center of the profile in flux/arcsec^2 [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.FlatSky(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
SkyModelModel for the sky background in which all values across the image are the same.
SkyModel
Prototype class for any sky background model.
This base class imposes that the
centeris a locked parameter not involved in the fit. Sky models also have no PSF convolution or integration mode by default, since sky backgrounds vary on spatial scales much larger than the PSF or pixel size.ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
I0 – brightness for the sky, represented as the log of the brightness over pixel scale squared, this is proportional to a surface brightness [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- 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.'], 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]#
- initialize()[source]#
Initialize the sky model, this is called after the model is created and before it is used. This is where we can set the center to be a locked parameter.
- usable = True#
- class astrophot.models.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.GalaxyModel(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
InclinedMixin,ComponentModelIntended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = False#
- class astrophot.models.GaussianEllipsoid(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ComponentModelModel that represents a galaxy as a 3D Gaussian ellipsoid.
The model is triaxial, meaning it has three different standard deviations along the three axes. The orientation of the ellipsoid is defined by Euler angles.
If all three Euler angles are set to zero, the ellipsoid is aligned with the image axes meaning sigma_a gives the std along the x axis of the tangent plane, sigma_b gives the std along the y axis of the tangent plane, and sigma_z gives the std into the tangent plane. We use the ZXZ convention for the Euler angles. This means that for a disk galaxy, one can naturally consider sigma_c as the disk thickness and sigma_a=sigma_b as the disk radius; setting the Euler angles to zero would leave the disk face-on in the x-y tangent plane.
- Note:
the model is highly degenerate, meaning that it is not possible to uniquely determine the parameters from the data. The model is useful if one already has a 3D model of the galaxy in mind and wants to produce mock data. Alternately, if one applies some constraints on the parameters, such as sigma_a = sigma_b and alpha=0, then the model will be better determined. In that case, beta is related to the inclination of the disk and gamma is related to the position angle of the disk. The initialization for this model assumes exactly this interpretation with a disk thickness of sigma_c = 0.2 *sigma_a.
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
sigma_a – Standard deviation of the Gaussian along the alpha axis in arcseconds. [model param]
sigma_b – Standard deviation of the Gaussian along the beta axis in arcseconds. [model param]
sigma_c – Standard deviation of the Gaussian along the gamma axis in arcseconds. [model param]
alpha – Euler angle representing the rotation around the alpha axis in radians. [model param]
beta – Euler angle representing the rotation around the beta axis in radians. [model param]
gamma – Euler angle representing the rotation around the gamma axis in radians. [model param]
flux – Total flux of the galaxy in arbitrary units. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- 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.'], sigma_a: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], sigma_b: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], sigma_c: 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.'], 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]#
Brightness of the Gaussian ellipsoid.
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- usable = True#
- class astrophot.models.GaussianFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianMixin,RadialMixin,FourierEllipseMixin,GalaxyModelGaussianMixin
Gaussian 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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
sigma – Standard deviation of the Gaussian profile in arcseconds. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.GaussianGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianMixin,RadialMixin,GalaxyModelGaussianMixin
Gaussian 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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in arcseconds. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.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.GaussianPSF(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianPSFMixin,RadialMixin,PSFModelGaussianPSFMixin
Gaussian 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.RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]sigma – Standard deviation of the Gaussian profile in pixels. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.GaussianPSFEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianPSFMixin,EllipseMixin,RadialMixin,PSFModelGaussianPSFMixin
Gaussian 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.EllipseMixin
PSF model with elliptical isophotes defined by a position angle and axis ratio.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in pixels. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.GaussianPSFFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianPSFMixin,InclinedMixin,RadialMixin,FourierEllipseMixin,PSFModelGaussianPSFMixin
Gaussian 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in pixels. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.GaussianPSFSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianPSFMixin,InclinedMixin,RadialMixin,SuperEllipseMixin,PSFModelGaussianPSFMixin
Gaussian 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in pixels. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.GaussianPSFWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianPSFMixin,InclinedMixin,RadialMixin,WarpMixin,PSFModelGaussianPSFMixin
Gaussian 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).WarpMixin
Warped 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in pixels. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.GaussianRay(*, filename=None, model_type=None, **kwargs)#
Bases:
iGaussianMixin,RayMixin,GalaxyModeliGaussianMixin
Gaussian 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.RayMixin
Defines 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.GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in arcseconds. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.GaussianSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianMixin,RadialMixin,SuperEllipseMixin,GalaxyModelGaussianMixin
Gaussian 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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in arcseconds. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.GaussianWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
GaussianMixin,RadialMixin,WarpMixin,GalaxyModelGaussianMixin
Gaussian 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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
sigma – Standard deviation of the Gaussian profile in arcseconds. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.GaussianWedge(*, filename=None, model_type=None, **kwargs)#
Bases:
iGaussianMixin,WedgeMixin,GalaxyModeliGaussianMixin
Gaussian 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.WedgeMixin
Defines 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
sigma – Standard deviation of the Gaussian profile in arcseconds. [model param]
flux – Total flux of the Gaussian profile. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.GroupModel(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ModelModel object which represents a list of other models. For each general AstroPhot model method, this calls all the appropriate models from its list and combines their output into a single summed model. This class should be used when describing any system more complex than makes sense to represent with a single light distribution.
- Args:
name (str): unique name for the full group model target (Target_Image): the target image that this group model is trying to fit to models (Optional[Sequence[AstroPhot_Model]]): list of AstroPhot_Model objects which will combine for the group model locked (bool): if the whole group of models should be locked
- deblend() Sequence[TargetImage][source]#
Generate deblended images for each sub-model in this group model. Each deblended image contains for each pixel, the fraction of the total flux at that pixel which is contributed by that sub-model.
- Returns:
Sequence[TargetImage]: List of deblended TargetImage objects for each sub-model.
- initialize()[source]#
Initialize each model in this group. Does this by iteratively initializing a model then subtracting it from a copy of the target.
- jacobian(pass_jacobian: JacobianImage | JacobianImageList | None = None, params=None) JacobianImage[source]#
Compute the jacobian for this model. Done by first constructing a full jacobian (Npixels * Nparameters) of zeros then call the jacobian method of each sub model and add it in to the total.
Args: - pass_jacobian (Optional[JacobianImage]): A Jacobian image pre-constructed to be passed along instead of constructing new Jacobians - window (Optional[Window]): A window within which to evaluate the jacobian. If not provided, the model’s window will be used. - params (Optional[Sequence[Param]]): Parameters to use for the jacobian. If not provided, the model’s parameters will be used.
- sample(_CD: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None, _crtan: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None, _crpix: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None, _psf: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] | None = None) ModelImage | ModelImageList[source]#
Sample the group model on an image. Produces the flux values for each pixel associated with the models in this group. Each model is called individually and the results are added together in one larger image.
Args: - image (Optional[ModelImage]): Image to sample on, overrides the windows for each sub model, they will all be evaluated over this entire image. If left as none then each sub model will be evaluated in its window.
- segmentation_map() Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
Generate a segmentation map for this group model. Each pixel in the segmentation map is assigned an integer value corresponding to the index of the sub-model that corresponds to that pixel. The pixels are assigned based on “relative importance”, meaning that for each pixel, the sub-model which contributes the largest fraction of its own total flux to that pixel is assigned to it.
- Returns:
ArrayLike: Segmentation map with the same shape as the target image as windowed by the group model window.
- property target: TargetImage | TargetImageList | None#
- usable = True#
- property window: Window | WindowList | None#
The window defines a region on the sky in which this model will be optimized and typically evaluated. Two models with non-overlapping windows are in effect independent of each other. If there is another model with a window that spans both of them, then they are tenuously connected.
If not provided, the model will assume a window equal to the target it is fitting. Note that in this case the window is not explicitly set to the target window, so if the model is moved to another target then the fitting window will also change.
- class astrophot.models.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.KingFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
KingMixin,RadialMixin,FourierEllipseMixin,GalaxyModelKingMixin
Empirical 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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
Rc – core radius [model param]
Rt – truncation radius [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.KingGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
KingMixin,RadialMixin,GalaxyModelKingMixin
Empirical 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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Rc – core radius [model param]
Rt – truncation radius [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.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.KingPSF(*, filename=None, model_type=None, **kwargs)#
Bases:
KingPSFMixin,RadialMixin,PSFModelKingPSFMixin
Empirical 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.RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]Rc – core radius [pix] [model param]
Rt – truncation radius [pix] [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.KingPSFEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
KingPSFMixin,EllipseMixin,RadialMixin,PSFModelKingPSFMixin
Empirical 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.EllipseMixin
PSF model with elliptical isophotes defined by a position angle and axis ratio.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
Rc – core radius [pix] [model param]
Rt – truncation radius [pix] [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.KingPSFFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
KingPSFMixin,InclinedMixin,RadialMixin,FourierEllipseMixin,PSFModelKingPSFMixin
Empirical 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
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. [model param]
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. [model param]
Rc – core radius [pix] [model param]
Rt – truncation radius [pix] [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.KingPSFSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
KingPSFMixin,InclinedMixin,RadialMixin,SuperEllipseMixin,PSFModelKingPSFMixin
Empirical 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
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. [model param]
Rc – core radius [pix] [model param]
Rt – truncation radius [pix] [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.KingPSFWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
KingPSFMixin,InclinedMixin,RadialMixin,WarpMixin,PSFModelKingPSFMixin
Empirical 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).WarpMixin
Warped 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
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. [model param]
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. [model param]
Rc – core radius [pix] [model param]
Rt – truncation radius [pix] [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.KingRay(*, filename=None, model_type=None, **kwargs)#
Bases:
iKingMixin,RayMixin,GalaxyModeliKingMixin
Empirical 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.RayMixin
Defines 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.GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Rc – core radius [model param]
Rt – truncation radius [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.KingSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
KingMixin,RadialMixin,SuperEllipseMixin,GalaxyModelKingMixin
Empirical 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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
Rc – core radius [model param]
Rt – truncation radius [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.KingWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
KingMixin,RadialMixin,WarpMixin,GalaxyModelKingMixin
Empirical 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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
Rc – core radius [model param]
Rt – truncation radius [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.KingWedge(*, filename=None, model_type=None, **kwargs)#
Bases:
iKingMixin,WedgeMixin,GalaxyModeliKingMixin
Empirical 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.WedgeMixin
Defines 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Rc – core radius [model param]
Rt – truncation radius [model param]
alpha – concentration index which controls the shape of the brightness profile [model param]
I0 – intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.Model(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ModuleBase class for all AstroPhot models.
- gaussian_log_likelihood() Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
Compute the negative log likelihood of the model wrt the target image in the appropriate window.
- model_type = 'model'#
- options = {'softening'}#
- parameter_specs = {}#
- poisson_log_likelihood() Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
Compute the negative log likelihood of the model wrt the target image in the appropriate window.
- softening = 0.001#
- to(dtype=None, device=None)[source]#
Moves and/or casts the values of the
Nodeto a particular device and/or dtype.Parameters#
- device: (Optional[torch.device], optional)
The device to move the values to. Defaults to None.
- dtype: (Optional[torch.dtype], optional)
The desired data type. Defaults to None.
- total_flux() Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- total_flux_uncertainty() Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
- total_magnitude() Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
Compute the total magnitude of the model in the given window.
- total_magnitude_uncertainty() Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][source]#
Compute the uncertainty in the total magnitude of the model in the given window.
- usable = False#
- property window: Window | None#
The window defines a region on the sky in which this model will be optimized and typically evaluated. Two models with non-overlapping windows are in effect independent of each other. If there is another model with a window that spans both of them, then they are tenuously connected.
If not provided, the model will assume a window equal to the target it is fitting. Note that in this case the window is not explicitly set to the target window, so if the model is moved to another target then the fitting window will also change.
- class astrophot.models.MoffatFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatMixin,RadialMixin,FourierEllipseMixin,GalaxyModelMoffatMixin
Moffat 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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [model param]
I0 – Intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.MoffatGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatMixin,RadialMixin,GalaxyModelMoffatMixin
Moffat 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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [model param]
I0 – Intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.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.MoffatPSF(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatPSFMixin,RadialMixin,PSFModelMoffatPSFMixin
Moffat 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.RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [pix] [model param]
I0 – Intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.MoffatPSFEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatPSFMixin,EllipseMixin,RadialMixin,PSFModelMoffatPSFMixin
Moffat 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.EllipseMixin
PSF model with elliptical isophotes defined by a position angle and axis ratio.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [pix] [model param]
I0 – Intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.MoffatPSFFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatPSFMixin,InclinedMixin,RadialMixin,FourierEllipseMixin,PSFModelMoffatPSFMixin
Moffat 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [pix] [model param]
I0 – Intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.MoffatPSFSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatPSFMixin,InclinedMixin,RadialMixin,SuperEllipseMixin,PSFModelMoffatPSFMixin
Moffat 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [pix] [model param]
I0 – Intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.MoffatPSFWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatPSFMixin,InclinedMixin,RadialMixin,WarpMixin,PSFModelMoffatPSFMixin
Moffat 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).WarpMixin
Warped 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [pix] [model param]
I0 – Intensity at the center of the profile [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.MoffatRay(*, filename=None, model_type=None, **kwargs)#
Bases:
iMoffatMixin,RayMixin,GalaxyModeliMoffatMixin
Moffat 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.RayMixin
Defines 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.GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [model param]
I0 – Intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.MoffatSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatMixin,RadialMixin,SuperEllipseMixin,GalaxyModelMoffatMixin
Moffat 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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [model param]
I0 – Intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.MoffatWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
MoffatMixin,RadialMixin,WarpMixin,GalaxyModelMoffatMixin
Moffat 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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [model param]
I0 – Intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.MoffatWedge(*, filename=None, model_type=None, **kwargs)#
Bases:
iMoffatMixin,WedgeMixin,GalaxyModeliMoffatMixin
Moffat 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.WedgeMixin
Defines 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
n – Concentration index which controls the shape of the brightness profile [model param]
Rd – Scale length radius [model param]
I0 – Intensity at the center of the profile [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.MultiGaussianExpansion(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ComponentModelModel that represents a galaxy as a sum of multiple Gaussian profiles. The model is defined as:
\[I(R) = \sum_i {\rm flux}_i * \exp(-0.5*(R_i / \sigma_i)^2) / (2 * \pi * q_i * \sigma_i^2)\]where \(R_i\) is a radius computed using \(q_i\) and \(PA_i\) for that component. All components share the same center.
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
q – axis ratio to scale minor axis from the ratio of the minor/major axis b/a, this parameter is unitless, it is restricted to the range (0,1) [model param]
PA – position angle of the semi-major axis relative to the image positive x-axis in radians, it is a cyclic parameter in the range [0,pi) [model param]
sigma – standard deviation of each Gaussian [model param]
flux – amplitude of each Gaussian [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- 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.'], flux: 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.'], q: 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]#
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- 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: 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.']) 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]#
- usable = True#
- class astrophot.models.NukerFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerMixin,RadialMixin,FourierEllipseMixin,GalaxyModelNukerMixin
Nuker 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.
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
Rb – scale length radius [model param]
Ib – intensity at the scale length [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.NukerGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerMixin,RadialMixin,GalaxyModelNukerMixin
Nuker 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.
RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Rb – scale length radius [model param]
Ib – intensity at the scale length [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.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.NukerPSF(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerPSFMixin,RadialMixin,PSFModelNukerPSFMixin
Nuker 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.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]Rb – scale length radius [pix] [model param]
Ib – intensity at the scale length [flux/pix^2] [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.NukerPSFEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerPSFMixin,EllipseMixin,RadialMixin,PSFModelNukerPSFMixin
Nuker 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.
EllipseMixin
PSF model with elliptical isophotes defined by a position angle and axis ratio.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
Rb – scale length radius [pix] [model param]
Ib – intensity at the scale length [flux/pix^2] [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.NukerPSFFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerPSFMixin,InclinedMixin,RadialMixin,FourierEllipseMixin,PSFModelNukerPSFMixin
Nuker 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.
InclinedMixin
A 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}}\)
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
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. [model param]
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. [model param]
Rb – scale length radius [pix] [model param]
Ib – intensity at the scale length [flux/pix^2] [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.NukerPSFSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerPSFMixin,InclinedMixin,RadialMixin,SuperEllipseMixin,PSFModelNukerPSFMixin
Nuker 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.
InclinedMixin
A 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}}\)
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
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. [model param]
Rb – scale length radius [pix] [model param]
Ib – intensity at the scale length [flux/pix^2] [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.NukerPSFWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerPSFMixin,InclinedMixin,RadialMixin,WarpMixin,PSFModelNukerPSFMixin
Nuker 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.
InclinedMixin
A 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}}\)
RadialMixin
This 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}\).WarpMixin
Warped 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
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. [model param]
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. [model param]
Rb – scale length radius [pix] [model param]
Ib – intensity at the scale length [flux/pix^2] [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.NukerRay(*, filename=None, model_type=None, **kwargs)#
Bases:
iNukerMixin,RayMixin,GalaxyModeliNukerMixin
Nuker 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.RayMixin
Defines 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.GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Rb – scale length radius [model param]
Ib – intensity at the scale length [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.NukerSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerMixin,RadialMixin,SuperEllipseMixin,GalaxyModelNukerMixin
Nuker 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.
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
Rb – scale length radius [model param]
Ib – intensity at the scale length [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.NukerWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
NukerMixin,RadialMixin,WarpMixin,GalaxyModelNukerMixin
Nuker 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.
RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
Rb – scale length radius [model param]
Ib – intensity at the scale length [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.NukerWedge(*, filename=None, model_type=None, **kwargs)#
Bases:
iNukerMixin,WedgeMixin,GalaxyModeliNukerMixin
Nuker 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.WedgeMixin
Defines 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
Rb – scale length radius [model param]
Ib – intensity at the scale length [model param]
alpha – sharpness of transition between power law slopes [model param]
beta – outer power law slope [model param]
gamma – inner power law slope [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.PSFGroupModel(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
GroupModelA group of PSF models. Behaves similarly to a GroupModel, but specifically designed for PSF models.
- normalize_psf = True#
- property target#
- usable = True#
- class astrophot.models.PSFModel(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
GradMixin,SampleMixin,ModelPrototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit.normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- normalize_psf = True#
- property pad#
- pixel_brightness(i, j)[source]#
Evaluate the model at the pixel coordinates defined by i and j (of the target image). For a PSF model, this is the same as the brightness since it is defined in pixel units.
- sample(i: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], j: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], *args, **kwargs) PSFImage[source]#
Sample the PSF model on the pixel grid defined by i and j.
Depending on the model specification, this may involve supersampling for higher precision, or it may just be a direct evaluation of the model at the pixel centers. The output is the flux evaluated over the pixel grid at native resolution (for the PSFImage associated with this model.)
- Parameters:
i – 2D array of x-coordinates of pixel centers (or pre-upsampled according to the
sampling_mode) in pixel units.j – 2D array of y-coordinates of pixel centers (or pre-upsampled according to the
sampling_mode) in pixel units.
- Returns:
2D array (
Z) of flux values at each pixel center, representing the PSF model evaluated at those coordinates.
- property target#
- 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.'], center: 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]#
- property upsample#
- usable = False#
- class astrophot.models.PixelBasisPSF(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
PSFModelpoint source model which uses multiple images as a basis for the PSF as its representation for point sources. Using bilinear interpolation it will shift the PSF within a pixel to accurately represent the center location of a point source. There is no functional form for this object type as any image can be supplied. Bilinear interpolation is very fast and accurate for smooth models, so it is possible to do the expensive interpolation before optimization and save time.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]weights – The weights of the basis set of images in units of flux. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- property basis#
The basis set of images used to form the eigen point source.
- 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.'], weights: 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]#
- usable = True#
- class astrophot.models.Pixelated(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ComponentModelModel described by a grid of pixels on the sky (bilinear interpolation)
This model represents an extended source on the sky as a grid of pixels with some brightness. The brightness at any point is determined by bilinear interpolation of the grid values. This is a very flexible model that can represent any source, but it is also computationally expensive to optimize the large number of free parameters.
The PA and scale are also parameters of this model, so one could alternately fix the pixels to some image and just fit the PA and scale.
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
I – the total flux within each pixel, represented as the log of the flux. [model param]
PA – the position angle of the model, in radians. [model param]
scale – the scale of the model, in arcsec per grid unit. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- 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.'], I: 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]#
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- 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.'], scale: 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]#
- usable = True#
- class astrophot.models.PixelatedPSF(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
PSFModelpoint source model which uses an image of the PSF as its representation for point sources. Using bilinear interpolation it will shift the PSF within a pixel to accurately represent the center location of a point source. There is no functional form for this object type as any image can be supplied. The image pixels will be optimized as individual parameters. This can very quickly result in a large number of parameters and a near impossible fitting task, ideally this should be restricted to a very small area likely at the center of the PSF.
To initialize the PSF image will by default be set to the target PSF_Image values, thus one can use an empirical PSF as a starting point. Since only bilinear interpolation is performed, it is recommended to provide the PSF at a higher resolution than the image if it is near the nyquist sampling limit. Bilinear interpolation is very fast and accurate for smooth models, so this way it is possible to do the expensive interpolation before optimization and save time. Note that if you do this you must provide the PSF as a PSF_Image object with the correct pixelscale (essentially just divide the pixelscale by the upsampling factor you used).
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]pixels – the total flux within each pixel, represented as the log of the flux. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- 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.'], pixels: 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]#
- usable = True#
- class astrophot.models.PlaneSky(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
SkyModelSky background model using a tilted plane for the sky flux. The brightness for each pixel is defined as:
\[I(X, Y) = I_0 + X*\delta_x + Y*\delta_y\]where \(I(X,Y)\) is the brightness as a function of image position \(X, Y\), \(I_0\) is the central sky brightness value, and \(\delta_x, \delta_y\) are the slopes of the sky brightness plane.
SkyModel
Prototype class for any sky background model.
This base class imposes that the
centeris a locked parameter not involved in the fit. Sky models also have no PSF convolution or integration mode by default, since sky backgrounds vary on spatial scales much larger than the PSF or pixel size.ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
I0 – central sky brightness value [model param]
delta – Tensor for slope of the sky brightness in each image dimension [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- 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.'], I0: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], delta: 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]#
- initialize()[source]#
Initialize the sky model, this is called after the model is created and before it is used. This is where we can set the center to be a locked parameter.
- usable = True#
- class astrophot.models.PointSource(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ComponentModelDescribes a point source in the image, this is a delta function at some position in the sky. This is typically used to describe stars, supernovae, very small galaxies, quasars, asteroids or any other object which can essentially be entirely described by a position and total flux (no structure).
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
flux – The total flux of the point source [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- initialize()[source]#
Determine initial values for the center coordinates. This is done with a local center of mass search which iterates by finding the center of light in a window, then iteratively updates until the iterations move by less than a pixel.
- property integrate_mode#
- internal_psf = True#
- property psf_convolve#
bool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
- sample(I_: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], J_: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'], psf: Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'] = None, crop: int = 0, downsample: int = 1, center=None, flux=None, _CD=None, _crtan=None, _crpix=None)[source]#
- usable = True#
- class astrophot.models.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.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.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.SersicFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicMixin,RadialMixin,FourierEllipseMixin,GalaxyModelSersicMixin
Sersic 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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [arcsec] [model param]
Ie – intensity at the half light radius [flux/arcsec^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.SersicGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicMixin,RadialMixin,GalaxyModelSersicMixin
Sersic 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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [arcsec] [model param]
Ie – intensity at the half light radius [flux/arcsec^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.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.SersicPSF(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicPSFMixin,RadialMixin,PSFModelSersicPSFMixin
Sersic 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.RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [pix] [model param]
Ie – intensity at the half light radius [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.SersicPSFEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicPSFMixin,EllipseMixin,RadialMixin,PSFModelSersicPSFMixin
Sersic 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.EllipseMixin
PSF model with elliptical isophotes defined by a position angle and axis ratio.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [pix] [model param]
Ie – intensity at the half light radius [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.SersicPSFFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicPSFMixin,InclinedMixin,RadialMixin,FourierEllipseMixin,PSFModelSersicPSFMixin
Sersic 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [pix] [model param]
Ie – intensity at the half light radius [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.SersicPSFSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicPSFMixin,InclinedMixin,RadialMixin,SuperEllipseMixin,PSFModelSersicPSFMixin
Sersic 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [pix] [model param]
Ie – intensity at the half light radius [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.SersicPSFWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicPSFMixin,InclinedMixin,RadialMixin,WarpMixin,PSFModelSersicPSFMixin
Sersic 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.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).WarpMixin
Warped 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [pix] [model param]
Ie – intensity at the half light radius [flux/pix^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.SersicRay(*, filename=None, model_type=None, **kwargs)#
Bases:
iSersicMixin,RayMixin,GalaxyModeliSersicMixin
Sersic 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.RayMixin
Defines 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.GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [arcsec] [model param]
Ie – intensity at the half light radius [flux/arcsec^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.SersicSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicMixin,RadialMixin,SuperEllipseMixin,GalaxyModelSersicMixin
Sersic 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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [arcsec] [model param]
Ie – intensity at the half light radius [flux/arcsec^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.SersicWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
SersicMixin,RadialMixin,WarpMixin,GalaxyModelSersicMixin
Sersic 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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [arcsec] [model param]
Ie – intensity at the half light radius [flux/arcsec^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.SersicWedge(*, filename=None, model_type=None, **kwargs)#
Bases:
iSersicMixin,WedgeMixin,GalaxyModeliSersicMixin
Sersic 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.WedgeMixin
Defines 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
n – Sersic index which controls the shape of the brightness profile [model param]
Re – half light radius [arcsec] [model param]
Ie – intensity at the half light radius [flux/arcsec^2] [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.SkyModel(*, filename=None, model_type=None, **kwargs)[source]#
Bases:
ComponentModelPrototype class for any sky background model.
This base class imposes that the
centeris a locked parameter not involved in the fit. Sky models also have no PSF convolution or integration mode by default, since sky backgrounds vary on spatial scales much larger than the PSF or pixel size.ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- initialize()[source]#
Initialize the sky model, this is called after the model is created and before it is used. This is where we can set the center to be a locked parameter.
- property psf_convolve: bool#
bool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
- usable = False#
- class astrophot.models.SplineFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SplineMixin,RadialMixin,FourierEllipseMixin,GalaxyModelSplineMixin
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.RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
I_R – Tensor of radial brightness values in units of flux/arcsec^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.SplineGalaxy(*, filename=None, model_type=None, **kwargs)#
Bases:
SplineMixin,RadialMixin,GalaxyModelSplineMixin
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.RadialMixin
This 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}\).GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/arcsec^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.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.SplinePSF(*, filename=None, model_type=None, **kwargs)#
Bases:
SplinePSFMixin,RadialMixin,PSFModelSplinePSFMixin
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/pix^2. The radius of each node is determined fromI_R.prof.RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]I_R – Tensor of radial brightness values in units of flux/pix^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.SplinePSFEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SplinePSFMixin,EllipseMixin,RadialMixin,PSFModelSplinePSFMixin
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/pix^2. The radius of each node is determined fromI_R.prof.EllipseMixin
PSF model with elliptical isophotes defined by a position angle and axis ratio.
RadialMixin
This 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}\).PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/pix^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.SplinePSFFourierEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SplinePSFMixin,InclinedMixin,RadialMixin,FourierEllipseMixin,PSFModelSplinePSFMixin
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/pix^2. The radius of each node is determined fromI_R.prof.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).FourierEllipseMixin
Sine 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]am – Tensor of amplitudes for the Fourier modes, indicates the strength of each mode. [model param]
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) [model param]
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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/pix^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.modes – Tuple of integers indicating which Fourier modes to use.
- usable = True#
- class astrophot.models.SplinePSFSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SplinePSFMixin,InclinedMixin,RadialMixin,SuperEllipseMixin,PSFModelSplinePSFMixin
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/pix^2. The radius of each node is determined fromI_R.prof.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]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. [model param]
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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/pix^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.SplinePSFWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
SplinePSFMixin,InclinedMixin,RadialMixin,WarpMixin,PSFModelSplinePSFMixin
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/pix^2. The radius of each node is determined fromI_R.prof.InclinedMixin
A 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}}\)
RadialMixin
This 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}\).WarpMixin
Warped 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.
PSFModel
Prototype point source (typically a star) model, to be subclassed by other point source models which define specific behavior.
PSF models behave differently than component models. Their target image must be a
PSFImageobject instead of aTargetImageobject. PSF models do not fit a freecenterparameter; their center is always(0, 0)in pixel coordinates, matching the convention of aPSFImage. A PSF model is never convolved with another PSF model.- Parameters:
center – Center of the PSF in pixel coordinates
[x, y]. Fixed at(0, 0)by default and not included in the fit. [model param]q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/pix^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
normalize_psf – When
True(default) the sampled PSF is normalised so that its total flux within the fitting window equals 1.
- usable = True#
- class astrophot.models.SplineRay(*, filename=None, model_type=None, **kwargs)#
Bases:
iSplineMixin,RayMixin,GalaxyModeliSplineMixin
Batched 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.RayMixin
Defines 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.GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/arcsec^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.SplineSuperEllipse(*, filename=None, model_type=None, **kwargs)#
Bases:
SplineMixin,RadialMixin,SuperEllipseMixin,GalaxyModelSplineMixin
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.RadialMixin
This 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}\).SuperEllipseMixin
Uses 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/arcsec^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.SplineWarp(*, filename=None, model_type=None, **kwargs)#
Bases:
SplineMixin,RadialMixin,WarpMixin,GalaxyModelSplineMixin
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.RadialMixin
This 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}\).WarpMixin
Warped 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
q_R – Tensor of axis ratio values for axis ratio spline [model param]
PA_R – Tensor of position angle values as input to the spline [model param]
I_R – Tensor of radial brightness values in units of flux/arcsec^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
- usable = True#
- class astrophot.models.SplineWedge(*, filename=None, model_type=None, **kwargs)#
Bases:
iSplineMixin,WedgeMixin,GalaxyModeliSplineMixin
Batched 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.WedgeMixin
Defines 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.
GalaxyModel
Intended to represent a galaxy or extended component in an image.
InclinedMixin
A 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}}\)
ComponentModel
Component of a model for an object in an image.
This is a single component of an image model. It has a position on the sky determined by
centerand may or may not be convolved with a PSF to represent some data.Model
Base class for all AstroPhot models.
- Parameters:
center – The center of the component in arcseconds [x, y] defined on the tangent plane. [model param]
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. [model param]
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. [model param]
I_R – Tensor of radial brightness values in units of flux/arcsec^2. [model param]
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).
jacobian_maxparams – The maximum number of parameters before the Jacobian will be broken into smaller chunks to reduce memory consumption (int, default: 10).
psf_convolve – Whether to convolve the model with a PSF. (bool, default True)
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
- usable = True#
- class astrophot.models.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.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.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.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.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.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.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.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.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.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.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.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]#