Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Source Models

Source models

CosmoSim implements spherical and ellipsoid sources with sersic light profiles Graham & Driver, 2005. This is the most important source model for realistic scenarios.

The Sersic index

The parameter n is the key to the profile’s flexibility — since it controls the shape of the light distribution:

General Ellipsoid Model

We will define the formulæ for a general ellipsoid source. The spherical source is obtained by setting σ1=σ2\sigma_1=\sigma_2. We describe the ellipse centred at the origin in a Cartesian coordinate system, with the major axis along the yy-axis and the minor axis along the xx-axis. This image is then rotated for the desired orientation λS\lambda_S.

The pixel value (x,y)(x,y) is then given as

vx,y=Ieffexpbn((rreff)1ns1)v_{x,y} = I_{\mathrm{eff}}\cdot\exp -b_n\cdot\bigg( \big(\frac{r}{r_{\textrm{eff}}}\big)^{\frac{1}{n_s}} - 1\bigg)

where

Ieff=1000lb2ns2πσ1σ2nsebnΓ(2ns).I_{\mathrm{eff}} = 1000*l*\cdot \frac{b^{2n_s}}{2\pi\sigma_1\sigma_2\, n_s\cdot{e}^{b_n}\cdot \Gamma(2n_s)}.

Discussion and proof

Ellipsoid Source with Sersic profile

We have hardcoded an implementation of an elliptic profile, namely the de Vaucouleurs’ profile. In our implementation, this individual source is defined by two size parameters, σ1\sigma_1 and σ2\sigma_2, for the minor and major axes of the ellipsoid.

Additionally some parameters are currently hard-coded.

We define

The pixel value is given as

v=Ieffexpb((rreff)1n1)v = I_{\mathrm{eff}}\cdot\exp -b\cdot\bigg( \big(\frac{r}{r_{\textrm{eff}}}\big)^{\frac{1}{n}} - 1\bigg)

where, as in the spherical case but with σ2σ1σ2\sigma^2\to\sigma_1\sigma_2,

Ieff=Lb2n2πσ1σ2nebΓ(2n).I_{\mathrm{eff}} = L\cdot \frac{b^{2n}}{2\pi\sigma_1\sigma_2\, n\,\text{e}^{b}\cdot \Gamma(2n)}.

See General elliptical Sersic profile for the general recipe (arbitrary nn and position angle), including the proof that reffr_{\textrm{eff}} is the half-light radius for any axis ratio qq -- this holds for whatever value reffr_{\textrm{eff}} is actually given, including the current reff=10σ1r_{\textrm{eff}}=10\sigma_1; it just means the half-light ellipse currently has semi-axes (10σ2,10σ1)(10\sigma_2,10\sigma_1) rather than (σ1,σ2)(\sigma_1,\sigma_2).

The code is given as

auto q = sigma2/sigma1;
int n = 4;  // Sersic index
auto re = 10*sigma1; // effective radius
// CHECK: this factor of 10 means the half-light ellipse (where r==re)
// actually has semi-axes (10*sigma2, 10*sigma1), not (sigma1, sigma2).
// If sigma1/sigma2 are meant to *be* the half-light semi-axes, this
// looks like a bug or a leftover unit conversion -- kept as-is for now
// since it matches the current implementation; revisit once confirmed.
auto r = std::sqrt(std::pow(x/q, 2)+std::pow(y, 2));
auto bn = 1.992*n - 0.3271;
auto F = luminosity * std::pow(10, 3);
auto pi = 3.141592;
auto I_eff = F*std::pow(bn, 2.0*n)
           / (2*pi*sigma1*sigma2*n*std::exp(bn)*std::tgamma(2.0*n));
auto value = round(I_eff*std::exp(-bn*((std::pow(r/re, 1.0/n))-1.0)));
if (value > 255) { value = 255; }
dst.at<uchar>(row, col) = (uchar)value;

General elliptical Sersic profile

The hard-coded implementation above fixes n=4n=4 and only handles ellipses aligned with the (x,y)(x,y) axes. This section gives the general recipe: arbitrary Sersic index nsn_s, an arbitrary position angle, and a luminosity normalisation consistent with the spherical case.

Elliptical radius

Replace the circular radius r=x2+y2r=\sqrt{x'^2+y'^2} with an elliptical radius, using the axis ratio q=σ2/σ11q=\sigma_2/\sigma_1\le 1:

r~=x2+(y/q)2.\tilde r = \sqrt{x'^2+(y'/q)^2}.

This is exactly what the hard-coded code above already does for the axis-aligned case (with y=yy'=y playing the role of the unscaled axis). The pixel value is then given by the same 1D formula as the spherical case, with rr~r\to\tilde r and general nsn_s:

v(x,y)=Ieffebns((r~/reff)1/ns1),bns=1.992ns0.3271.v(x,y) = I_{\mathrm{eff}}\cdot \text{e}^{-b_{n_s}\left(\left(\tilde r/r_{\textrm{eff}}\right)^{1/n_s}-1\right)}, \qquad b_{n_s}=1.992\,n_s-0.3271.

Luminosity normalisation

An ellipse with semi-axes σ1,σ2\sigma_1,\sigma_2 has area πσ1σ2\pi\sigma_1\sigma_2, in place of the circle’s πσ2\pi\sigma^2. The IeffI_{\mathrm{eff}} normalisation therefore becomes

Ieff=Lbns2ns2πσ1σ2nsebnsΓ(2ns),I_{\mathrm{eff}} = L\cdot\frac{b_{n_s}^{2n_s}} {2\pi\,\sigma_1\sigma_2\, n_s\, \text{e}^{b_{n_s}}\,\Gamma(2n_s)},

i.e. literally the spherical-case formula with σ2σ1σ2=reff,circ2\sigma^2\to \sigma_1\sigma_2 = r_{\textrm{eff,circ}}^2. This is the I_eff used in the code above.

References
  1. Graham, A. W., & Driver, S. P. (2005). A Concise Reference to (Projected) Sérsic R1/n Quantities, Including Concentration, Profile Slopes, Petrosian Indices, and Kron Magnitudes. Publications of the Astronomical Society of Australia, 22(2), 118–127. 10.1071/as05001