astrophot.utils.conversions package#

Submodules#

astrophot.utils.conversions.functions module#

astrophot.utils.conversions.functions.moffat_I0_to_flux(I0: float, n: float, rd: float, q: float) float[source]#

Compute the total flux integrated to infinity for a moffat profile.

Args: - I0: central intensity (flux/arcsec^2) - n: moffat curvature parameter (unitless) - rd: scale radius - q: axis ratio

astrophot.utils.conversions.functions.sersic_I0_to_flux_np(I0: ndarray, n: ndarray, R: ndarray, q: ndarray) ndarray[source]#

Compute the total flux integrated to infinity for a 2D elliptical sersic given the $I_0,n,R_s,q$ parameters which uniquely define the profile ($I_0$ is the central intensity in flux/arcsec^2). Note that $R_s$ is not the effective radius, but in fact the scale radius in the more straightforward sersic representation:

$$I(R) = I_0e^{-(R/R_s)^{1/n}}$$

Args: - I0: central intensity (flux/arcsec^2) - n: sersic index - R: Scale radius - q: axis ratio (b/a)

astrophot.utils.conversions.functions.sersic_I0_to_flux_torch(I0: 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.'], R: 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]#

Compute the total flux integrated to infinity for a 2D elliptical sersic given the $I_0,n,R_s,q$ parameters which uniquely define the profile ($I_0$ is the central intensity in flux/arcsec^2). Note that $R_s$ is not the effective radius, but in fact the scale radius in the more straightforward sersic representation:

$$I(R) = I_0e^{-(R/R_s)^{1/n}}$$

Args: - I0: central intensity (flux/arcsec^2) - n: sersic index - R: Scale radius - q: axis ratio (b/a)

astrophot.utils.conversions.functions.sersic_Ie_to_flux_np(Ie: ndarray, n: ndarray, R: ndarray, q: ndarray) ndarray[source]#

Compute the total flux integrated to infinity for a 2D elliptical sersic given the $I_e,n,R_e,q$ parameters which uniquely define the profile ($I_e$ is the intensity at $R_e$ in flux/arcsec^2). Note that $R_e$ is the effective radius in the sersic representation:

$$I(R) = I_ee^{-b_n[(R/R_e)^{1/n}-1]}$$

Args: - Ie: intensity at the effective radius (flux/arcsec^2) - n: sersic index - R: Scale radius - q: axis ratio (b/a)

astrophot.utils.conversions.functions.sersic_Ie_to_flux_torch(Ie: 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.'], R: 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]#

Compute the total flux integrated to infinity for a 2D elliptical sersic given the $I_e,n,R_e,q$ parameters which uniquely define the profile ($I_e$ is the intensity at $R_e$ in flux/arcsec^2). Note that $R_e$ is the effective radius in the sersic representation:

$$I(R) = I_ee^{-b_n[(R/R_e)^{1/n}-1]}$$

Args: - Ie: intensity at the effective radius (flux/arcsec^2) - n: sersic index - R: Scale radius - q: axis ratio (b/a)

astrophot.utils.conversions.functions.sersic_flux_to_I0_np(flux: ndarray, n: ndarray, R: ndarray, q: ndarray) ndarray[source]#

Compute the central intensity (flux/arcsec^2) for a 2D elliptical sersic given the $F,n,R_s,q$ parameters which uniquely define the profile ($F$ is the total flux integrated to infinity). Note that $R_s$ is not the effective radius, but in fact the scale radius in the more straightforward sersic representation:

$$I(R) = I_0e^{-(R/R_s)^{1/n}}$$

Args: - flux: total flux integrated to infinity (flux) - n: sersic index - R: Scale radius - q: axis ratio (b/a)

astrophot.utils.conversions.functions.sersic_flux_to_I0_torch(flux: 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.'], R: 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]#

Compute the central intensity (flux/arcsec^2) for a 2D elliptical sersic given the $F,n,R_s,q$ parameters which uniquely define the profile ($F$ is the total flux integrated to infinity). Note that $R_s$ is not the effective radius, but in fact the scale radius in the more straightforward sersic representation:

$$I(R) = I_0e^{-(R/R_s)^{1/n}}$$

Args: - flux: total flux integrated to infinity (flux) - n: sersic index - R: Scale radius - q: axis ratio (b/a)

astrophot.utils.conversions.functions.sersic_flux_to_Ie_np(flux: ndarray, n: ndarray, R: ndarray, q: ndarray) ndarray[source]#

Compute the intensity at $R_e$ (flux/arcsec^2) for a 2D elliptical sersic given the $F,n,R_e,q$ parameters which uniquely define the profile ($F$ is the total flux integrated to infinity). Note that $R_e$ is the effective radius in the sersic representation:

$$I(R) = I_ee^{-b_n[(R/R_e)^{1/n}-1]}$$

Args: - flux: flux integrated to infinity (flux) - n: sersic index - R: Scale radius - q: axis ratio (b/a)

astrophot.utils.conversions.functions.sersic_flux_to_Ie_torch(flux: 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.'], R: 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]#

Compute the intensity at $R_e$ (flux/arcsec^2) for a 2D elliptical sersic given the $F,n,R_e,q$ parameters which uniquely define the profile ($F$ is the total flux integrated to infinity). Note that $R_e$ is the effective radius in the sersic representation:

$$I(R) = I_ee^{-b_n[(R/R_e)^{1/n}-1]}$$

Args: - flux: flux integrated to infinity (flux) - n: sersic index - R: Scale radius - q: axis ratio (b/a)

astrophot.utils.conversions.functions.sersic_inv_np(I: ndarray, n: ndarray, Re: ndarray, Ie: ndarray) ndarray[source]#

Invert the sersic profile. Compute the radius corresponding to a given intensity for a pure sersic profile.

astrophot.utils.conversions.functions.sersic_inv_torch(I: 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]#

Invert the sersic profile. Compute the radius corresponding to a given intensity for a pure sersic profile.

astrophot.utils.conversions.functions.sersic_n_to_b(n: float | ndarray | Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) float | ndarray | Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][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.utils.conversions.units module#

astrophot.utils.conversions.units.flux_to_mag(flux: float, zeropoint: float, fluxe: float | None = None) float[source]#

Converts a flux total into logarithmic magnitude units.

$$m = -2.5log_{10}(flux) + z.p.$$

where $z.p.$ is the zeropoint.

astrophot.utils.conversions.units.flux_to_sb(flux: float, pixel_area: float, zeropoint: float) float[source]#

Conversion from flux units to logarithmic surface brightness units.

$$mu = -2.5log_{10}(flux) + z.p. + 2.5log_{10}(A)$$

where $z.p.$ is the zeropoint and $A$ is the area of a pixel.

astrophot.utils.conversions.units.mag_to_flux(mag: float, zeropoint: float, mage: float | None = None) float[source]#

converts logarithmic magnitude units into a flux total.

$$flux = 10^{-(m - z.p.)/2.5}$$

where $z.p.$ is the zeropoint.

astrophot.utils.conversions.units.mag_to_magperarcsec2(m: float, a: float | None = None, b: float | None = None, R: float | None = None, A: float | None = None) float[source]#

Converts mag to mag/arcsec^2

Args: - m: mag - a: semi major axis radius (arcsec) - b: semi minor axis radius (arcsec) - A: pre-calculated area (arcsec^2)

$$mu = m + 2.5log_{10}(A)$$

where $A$ is an area in arcsec^2.

astrophot.utils.conversions.units.magperarcsec2_to_mag(mu: float, a: float | None = None, b: float | None = None, A: float | None = None) float[source]#

Converts mag/arcsec^2 to mag

Args: - mu: mag/arcsec^2 - a: semi major axis radius (arcsec) - b: semi minor axis radius (arcsec) - A: pre-calculated area (arcsec^2)

$$m = mu -2.5log_{10}(A)$$

where $A$ is an area in arcsec^2.

astrophot.utils.conversions.units.sb_to_flux(sb: float, pixel_area: float, zeropoint: float) float[source]#

Converts logarithmic surface brightness units into flux units.

$$flux = A 10^{-(mu - z.p.)/2.5}$$

where $z.p.$ is the zeropoint and $A$ is the area of a pixel.

Module contents#

astrophot.utils.conversions.flux_to_mag(flux: float, zeropoint: float, fluxe: float | None = None) float[source]#

Converts a flux total into logarithmic magnitude units.

$$m = -2.5log_{10}(flux) + z.p.$$

where $z.p.$ is the zeropoint.

astrophot.utils.conversions.flux_to_sb(flux: float, pixel_area: float, zeropoint: float) float[source]#

Conversion from flux units to logarithmic surface brightness units.

$$mu = -2.5log_{10}(flux) + z.p. + 2.5log_{10}(A)$$

where $z.p.$ is the zeropoint and $A$ is the area of a pixel.

astrophot.utils.conversions.mag_to_flux(mag: float, zeropoint: float, mage: float | None = None) float[source]#

converts logarithmic magnitude units into a flux total.

$$flux = 10^{-(m - z.p.)/2.5}$$

where $z.p.$ is the zeropoint.

astrophot.utils.conversions.mag_to_magperarcsec2(m: float, a: float | None = None, b: float | None = None, R: float | None = None, A: float | None = None) float[source]#

Converts mag to mag/arcsec^2

Args: - m: mag - a: semi major axis radius (arcsec) - b: semi minor axis radius (arcsec) - A: pre-calculated area (arcsec^2)

$$mu = m + 2.5log_{10}(A)$$

where $A$ is an area in arcsec^2.

astrophot.utils.conversions.magperarcsec2_to_mag(mu: float, a: float | None = None, b: float | None = None, A: float | None = None) float[source]#

Converts mag/arcsec^2 to mag

Args: - mu: mag/arcsec^2 - a: semi major axis radius (arcsec) - b: semi minor axis radius (arcsec) - A: pre-calculated area (arcsec^2)

$$m = mu -2.5log_{10}(A)$$

where $A$ is an area in arcsec^2.

astrophot.utils.conversions.moffat_I0_to_flux(I0: float, n: float, rd: float, q: float) float[source]#

Compute the total flux integrated to infinity for a moffat profile.

Args: - I0: central intensity (flux/arcsec^2) - n: moffat curvature parameter (unitless) - rd: scale radius - q: axis ratio

astrophot.utils.conversions.sb_to_flux(sb: float, pixel_area: float, zeropoint: float) float[source]#

Converts logarithmic surface brightness units into flux units.

$$flux = A 10^{-(mu - z.p.)/2.5}$$

where $z.p.$ is the zeropoint and $A$ is the area of a pixel.

astrophot.utils.conversions.sersic_I0_to_flux_np(I0: ndarray, n: ndarray, R: ndarray, q: ndarray) ndarray[source]#

Compute the total flux integrated to infinity for a 2D elliptical sersic given the $I_0,n,R_s,q$ parameters which uniquely define the profile ($I_0$ is the central intensity in flux/arcsec^2). Note that $R_s$ is not the effective radius, but in fact the scale radius in the more straightforward sersic representation:

$$I(R) = I_0e^{-(R/R_s)^{1/n}}$$

Args: - I0: central intensity (flux/arcsec^2) - n: sersic index - R: Scale radius - q: axis ratio (b/a)

astrophot.utils.conversions.sersic_I0_to_flux_torch(I0: 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.'], R: 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]#

Compute the total flux integrated to infinity for a 2D elliptical sersic given the $I_0,n,R_s,q$ parameters which uniquely define the profile ($I_0$ is the central intensity in flux/arcsec^2). Note that $R_s$ is not the effective radius, but in fact the scale radius in the more straightforward sersic representation:

$$I(R) = I_0e^{-(R/R_s)^{1/n}}$$

Args: - I0: central intensity (flux/arcsec^2) - n: sersic index - R: Scale radius - q: axis ratio (b/a)

astrophot.utils.conversions.sersic_Ie_to_flux_np(Ie: ndarray, n: ndarray, R: ndarray, q: ndarray) ndarray[source]#

Compute the total flux integrated to infinity for a 2D elliptical sersic given the $I_e,n,R_e,q$ parameters which uniquely define the profile ($I_e$ is the intensity at $R_e$ in flux/arcsec^2). Note that $R_e$ is the effective radius in the sersic representation:

$$I(R) = I_ee^{-b_n[(R/R_e)^{1/n}-1]}$$

Args: - Ie: intensity at the effective radius (flux/arcsec^2) - n: sersic index - R: Scale radius - q: axis ratio (b/a)

astrophot.utils.conversions.sersic_Ie_to_flux_torch(Ie: 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.'], R: 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]#

Compute the total flux integrated to infinity for a 2D elliptical sersic given the $I_e,n,R_e,q$ parameters which uniquely define the profile ($I_e$ is the intensity at $R_e$ in flux/arcsec^2). Note that $R_e$ is the effective radius in the sersic representation:

$$I(R) = I_ee^{-b_n[(R/R_e)^{1/n}-1]}$$

Args: - Ie: intensity at the effective radius (flux/arcsec^2) - n: sersic index - R: Scale radius - q: axis ratio (b/a)

astrophot.utils.conversions.sersic_flux_to_I0_np(flux: ndarray, n: ndarray, R: ndarray, q: ndarray) ndarray[source]#

Compute the central intensity (flux/arcsec^2) for a 2D elliptical sersic given the $F,n,R_s,q$ parameters which uniquely define the profile ($F$ is the total flux integrated to infinity). Note that $R_s$ is not the effective radius, but in fact the scale radius in the more straightforward sersic representation:

$$I(R) = I_0e^{-(R/R_s)^{1/n}}$$

Args: - flux: total flux integrated to infinity (flux) - n: sersic index - R: Scale radius - q: axis ratio (b/a)

astrophot.utils.conversions.sersic_flux_to_I0_torch(flux: 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.'], R: 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]#

Compute the central intensity (flux/arcsec^2) for a 2D elliptical sersic given the $F,n,R_s,q$ parameters which uniquely define the profile ($F$ is the total flux integrated to infinity). Note that $R_s$ is not the effective radius, but in fact the scale radius in the more straightforward sersic representation:

$$I(R) = I_0e^{-(R/R_s)^{1/n}}$$

Args: - flux: total flux integrated to infinity (flux) - n: sersic index - R: Scale radius - q: axis ratio (b/a)

astrophot.utils.conversions.sersic_flux_to_Ie_np(flux: ndarray, n: ndarray, R: ndarray, q: ndarray) ndarray[source]#

Compute the intensity at $R_e$ (flux/arcsec^2) for a 2D elliptical sersic given the $F,n,R_e,q$ parameters which uniquely define the profile ($F$ is the total flux integrated to infinity). Note that $R_e$ is the effective radius in the sersic representation:

$$I(R) = I_ee^{-b_n[(R/R_e)^{1/n}-1]}$$

Args: - flux: flux integrated to infinity (flux) - n: sersic index - R: Scale radius - q: axis ratio (b/a)

astrophot.utils.conversions.sersic_flux_to_Ie_torch(flux: 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.'], R: 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]#

Compute the intensity at $R_e$ (flux/arcsec^2) for a 2D elliptical sersic given the $F,n,R_e,q$ parameters which uniquely define the profile ($F$ is the total flux integrated to infinity). Note that $R_e$ is the effective radius in the sersic representation:

$$I(R) = I_ee^{-b_n[(R/R_e)^{1/n}-1]}$$

Args: - flux: flux integrated to infinity (flux) - n: sersic index - R: Scale radius - q: axis ratio (b/a)

astrophot.utils.conversions.sersic_inv_np(I: ndarray, n: ndarray, Re: ndarray, Ie: ndarray) ndarray[source]#

Invert the sersic profile. Compute the radius corresponding to a given intensity for a pure sersic profile.

astrophot.utils.conversions.sersic_inv_torch(I: 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]#

Invert the sersic profile. Compute the radius corresponding to a given intensity for a pure sersic profile.

astrophot.utils.conversions.sersic_n_to_b(n: float | ndarray | Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.']) float | ndarray | Annotated[Tensor, 'One of: torch.Tensor or jax.numpy.ndarray depending on the chosen backend.'][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.