astrophot.models.func package#

Submodules#

astrophot.models.func.base module#

astrophot.models.func.base.all_subclasses(cls)[source]#
astrophot.models.func.base.downsample(img: ArrayLike, scale: int = 1)[source]#
astrophot.models.func.base.downsample_mean(img: ArrayLike, scale: int = 1)[source]#

astrophot.models.func.convolution module#

astrophot.models.func.convolution.convolve(image: ArrayLike, psf: ArrayLike) ArrayLike[source]#
astrophot.models.func.convolution.curvature_kernel(dtype, device)[source]#

astrophot.models.func.exponential module#

astrophot.models.func.exponential.exponential(R: ArrayLike, Re: ArrayLike, Ie: ArrayLike) ArrayLike[source]#

Exponential 1d profile function, specifically designed for pytorch operations.

Args: - R: Radius tensor at which to evaluate the exponential function - Re: Effective radius in the same units as R - Ie: Effective surface density

astrophot.models.func.ferrer module#

astrophot.models.func.ferrer.ferrer(R: ArrayLike, rout: ArrayLike, alpha: ArrayLike, beta: ArrayLike, I0: ArrayLike) ArrayLike[source]#

Modified Ferrer profile.

Args: - R: Radius tensor at which to evaluate the modified Ferrer function - rout: Outer radius of the profile - alpha: Power-law index - beta: Exponent for the modified Ferrer function - I0: Central intensity

astrophot.models.func.gaussian module#

astrophot.models.func.gaussian.gaussian(R: ArrayLike, sigma: ArrayLike, flux: ArrayLike) ArrayLike[source]#

Gaussian 2d profile function.

Args: - R: Radii array at which to evaluate the gaussian function - sigma: Standard deviation of the gaussian in the same units as R - flux: Total flux of the Gaussian

astrophot.models.func.gaussian_ellipsoid module#

astrophot.models.func.gaussian_ellipsoid.euler_rotation_matrix(alpha: ArrayLike, beta: ArrayLike, gamma: ArrayLike) ArrayLike[source]#

Compute the rotation matrix from Euler angles.

See the Z_alpha X_beta Z_gamma convention for the order of rotations here: https://en.wikipedia.org/wiki/Euler_angles

astrophot.models.func.integration module#

astrophot.models.func.integration.bright_integrate(z: ArrayLike, i: ArrayLike, j: ArrayLike, brightness_ij: callable, bright_frac: float, scale: float = 1.0, quad_order: int = 3, gridding: int = 5, max_depth: int = 2)[source]#
astrophot.models.func.integration.pixel_center_integrator(Z: ArrayLike) ArrayLike[source]#
astrophot.models.func.integration.pixel_quad_integrator(Z: ArrayLike, w: ArrayLike = None, order: int = 3) ArrayLike[source]#

Integrate the pixel values using quadrature weights.

Args: - Z: The tensor containing pixel values. - w: The quadrature weights. - order: The order of the quadrature.

astrophot.models.func.integration.pixel_simpsons_integrator(Z: ArrayLike) ArrayLike[source]#
astrophot.models.func.integration.recursive_quad_integrate(i: ArrayLike, j: ArrayLike, brightness_ij: callable, curve_frac: float, scale: float = 1.0, quad_order: int = 3, gridding: int = 5, _current_depth: int = 0, max_depth: int = 1) ArrayLike[source]#
astrophot.models.func.integration.single_quad_integrate(i: ArrayLike, j: ArrayLike, brightness_ij, scale: float, quad_order: int = 3) Tuple[ArrayLike, ArrayLike][source]#
astrophot.models.func.integration.upsample(i: ArrayLike, j: ArrayLike, order: int, scale: float) Tuple[ArrayLike, ArrayLike][source]#

astrophot.models.func.king module#

astrophot.models.func.king.king(R: ArrayLike, Rc: ArrayLike, Rt: ArrayLike, alpha: ArrayLike, I0: ArrayLike) ArrayLike[source]#

Empirical King profile.

Args: - R: Radial distance from the center of the profile. - Rc: Core radius of the profile. - Rt: Truncation radius of the profile. - alpha: Power-law index of the profile. - I0: Central intensity of the profile.

astrophot.models.func.moffat module#

astrophot.models.func.moffat.moffat(R: ArrayLike, n: ArrayLike, Rd: ArrayLike, I0: ArrayLike) ArrayLike[source]#

Moffat 1d profile function

Args: - R: Radii tensor at which to evaluate the moffat function - n: concentration index - Rd: scale length in the same units as R - I0: central surface density

astrophot.models.func.nuker module#

astrophot.models.func.nuker.nuker(R: ArrayLike, Rb: ArrayLike, Ib: ArrayLike, alpha: ArrayLike, beta: ArrayLike, gamma: ArrayLike) ArrayLike[source]#

Nuker 1d profile function

Args: - R: Radii tensor at which to evaluate the nuker function - Ib: brightness at the scale length, represented as the log of the brightness divided by pixel scale squared. - Rb: scale length radius - alpha: sharpness of transition between power law slopes - beta: outer power law slope - gamma: inner power law slope

astrophot.models.func.sersic module#

astrophot.models.func.sersic.sersic(R: ArrayLike, n: ArrayLike, Re: ArrayLike, Ie: ArrayLike) ArrayLike[source]#

Seric 1d profile function, specifically designed for pytorch operations

Args: - R: Radii tensor at which to evaluate the sersic function - n: sersic index restricted to n > 0.36 - Re: Effective radius in the same units as R - Ie: Effective surface density

astrophot.models.func.sersic.sersic_n_to_b(n: float) float[source]#

Compute the b(n) for a sersic model. This factor ensures that the $R_e$ and $I_e$ parameters do in fact correspond to the half light values and not some other scale radius/intensity.

astrophot.models.func.spline module#

astrophot.models.func.spline.cubic_spline_torch(x: ArrayLike, y: ArrayLike, xs: ArrayLike) ArrayLike[source]#

Compute the 1D cubic spline interpolation for the given data points using PyTorch.

Args: - x (Tensor): A 1D tensor representing the x-coordinates of the known data points. - y (Tensor): A 1D tensor representing the y-coordinates of the known data points. - xs (Tensor): A 1D tensor representing the x-coordinates of the positions where

the cubic spline function should be evaluated.

astrophot.models.func.spline.spline(R: ArrayLike, profR: ArrayLike, profI: ArrayLike, extend: str = 'zeros') ArrayLike[source]#

Spline 1d profile function, cubic spline between points up to second last point beyond which is linear

Args: - R: Radii tensor at which to evaluate the spline function - profR: radius values for the surface density profile in the same units as R - profI: surface density values for the surface density profile - extend: How to extend the spline beyond the last point. Options are ‘zeros’ or ‘const’.

astrophot.models.func.transform module#

astrophot.models.func.transform.rotate(theta: ArrayLike, x: ArrayLike, y: ArrayLike) Tuple[ArrayLike, ArrayLike][source]#

Applies a rotation matrix to the X,Y coordinates

astrophot.models.func.zernike module#

astrophot.models.func.zernike.coefficients(n: int, m: int) list[tuple[int, float]][source]#
astrophot.models.func.zernike.zernike_basis(order: int, N: int) ndarray[source]#
astrophot.models.func.zernike.zernike_n_m_list(n: int) list[tuple[int, int]][source]#
astrophot.models.func.zernike.zernike_n_m_modes(rho: ndarray, phi: ndarray, n: int, m: int) ndarray[source]#

Module contents#

astrophot.models.func.all_subclasses(cls)[source]#
astrophot.models.func.bright_integrate(z: ArrayLike, i: ArrayLike, j: ArrayLike, brightness_ij: callable, bright_frac: float, scale: float = 1.0, quad_order: int = 3, gridding: int = 5, max_depth: int = 2)[source]#
astrophot.models.func.convolve(image: ArrayLike, psf: ArrayLike) ArrayLike[source]#
astrophot.models.func.curvature_kernel(dtype, device)[source]#
astrophot.models.func.downsample(img: ArrayLike, scale: int = 1)[source]#
astrophot.models.func.downsample_mean(img: ArrayLike, scale: int = 1)[source]#
astrophot.models.func.euler_rotation_matrix(alpha: ArrayLike, beta: ArrayLike, gamma: ArrayLike) ArrayLike[source]#

Compute the rotation matrix from Euler angles.

See the Z_alpha X_beta Z_gamma convention for the order of rotations here: https://en.wikipedia.org/wiki/Euler_angles

astrophot.models.func.exponential(R: ArrayLike, Re: ArrayLike, Ie: ArrayLike) ArrayLike[source]#

Exponential 1d profile function, specifically designed for pytorch operations.

Args: - R: Radius tensor at which to evaluate the exponential function - Re: Effective radius in the same units as R - Ie: Effective surface density

astrophot.models.func.ferrer(R: ArrayLike, rout: ArrayLike, alpha: ArrayLike, beta: ArrayLike, I0: ArrayLike) ArrayLike[source]#

Modified Ferrer profile.

Args: - R: Radius tensor at which to evaluate the modified Ferrer function - rout: Outer radius of the profile - alpha: Power-law index - beta: Exponent for the modified Ferrer function - I0: Central intensity

astrophot.models.func.gaussian(R: ArrayLike, sigma: ArrayLike, flux: ArrayLike) ArrayLike[source]#

Gaussian 2d profile function.

Args: - R: Radii array at which to evaluate the gaussian function - sigma: Standard deviation of the gaussian in the same units as R - flux: Total flux of the Gaussian

astrophot.models.func.king(R: ArrayLike, Rc: ArrayLike, Rt: ArrayLike, alpha: ArrayLike, I0: ArrayLike) ArrayLike[source]#

Empirical King profile.

Args: - R: Radial distance from the center of the profile. - Rc: Core radius of the profile. - Rt: Truncation radius of the profile. - alpha: Power-law index of the profile. - I0: Central intensity of the profile.

astrophot.models.func.moffat(R: ArrayLike, n: ArrayLike, Rd: ArrayLike, I0: ArrayLike) ArrayLike[source]#

Moffat 1d profile function

Args: - R: Radii tensor at which to evaluate the moffat function - n: concentration index - Rd: scale length in the same units as R - I0: central surface density

astrophot.models.func.nuker(R: ArrayLike, Rb: ArrayLike, Ib: ArrayLike, alpha: ArrayLike, beta: ArrayLike, gamma: ArrayLike) ArrayLike[source]#

Nuker 1d profile function

Args: - R: Radii tensor at which to evaluate the nuker function - Ib: brightness at the scale length, represented as the log of the brightness divided by pixel scale squared. - Rb: scale length radius - alpha: sharpness of transition between power law slopes - beta: outer power law slope - gamma: inner power law slope

astrophot.models.func.pixel_center_integrator(Z: ArrayLike) ArrayLike[source]#
astrophot.models.func.pixel_quad_integrator(Z: ArrayLike, w: ArrayLike = None, order: int = 3) ArrayLike[source]#

Integrate the pixel values using quadrature weights.

Args: - Z: The tensor containing pixel values. - w: The quadrature weights. - order: The order of the quadrature.

astrophot.models.func.pixel_simpsons_integrator(Z: ArrayLike) ArrayLike[source]#
astrophot.models.func.quad_table(order, dtype, device)[source]#

Generate a meshgrid for quadrature points using Legendre-Gauss quadrature.

Parameters#

orderint

The number of quadrature points in each dimension.

Returns#

Tuple[ArrayLike, ArrayLike, ArrayLike]

The generated meshgrid as a tuple of Tensors.

astrophot.models.func.recursive_quad_integrate(i: ArrayLike, j: ArrayLike, brightness_ij: callable, curve_frac: float, scale: float = 1.0, quad_order: int = 3, gridding: int = 5, _current_depth: int = 0, max_depth: int = 1) ArrayLike[source]#
astrophot.models.func.rotate(theta: ArrayLike, x: ArrayLike, y: ArrayLike) Tuple[ArrayLike, ArrayLike][source]#

Applies a rotation matrix to the X,Y coordinates

astrophot.models.func.sersic(R: ArrayLike, n: ArrayLike, Re: ArrayLike, Ie: ArrayLike) ArrayLike[source]#

Seric 1d profile function, specifically designed for pytorch operations

Args: - R: Radii tensor at which to evaluate the sersic function - n: sersic index restricted to n > 0.36 - Re: Effective radius in the same units as R - Ie: Effective surface density

astrophot.models.func.sersic_n_to_b(n: float) float[source]#

Compute the b(n) for a sersic model. This factor ensures that the $R_e$ and $I_e$ parameters do in fact correspond to the half light values and not some other scale radius/intensity.

astrophot.models.func.single_quad_integrate(i: ArrayLike, j: ArrayLike, brightness_ij, scale: float, quad_order: int = 3) Tuple[ArrayLike, ArrayLike][source]#
astrophot.models.func.spline(R: ArrayLike, profR: ArrayLike, profI: ArrayLike, extend: str = 'zeros') ArrayLike[source]#

Spline 1d profile function, cubic spline between points up to second last point beyond which is linear

Args: - R: Radii tensor at which to evaluate the spline function - profR: radius values for the surface density profile in the same units as R - profI: surface density values for the surface density profile - extend: How to extend the spline beyond the last point. Options are ‘zeros’ or ‘const’.

astrophot.models.func.upsample(i: ArrayLike, j: ArrayLike, order: int, scale: float) Tuple[ArrayLike, ArrayLike][source]#
astrophot.models.func.zernike_basis(order: int, N: int) ndarray[source]#
astrophot.models.func.zernike_n_m_list(n: int) list[tuple[int, int]][source]#
astrophot.models.func.zernike_n_m_modes(rho: ndarray, phi: ndarray, n: int, m: int) ndarray[source]#