CosmoSim implements spherical and ellipsoid sources with
sersic light profiles Graham & Driver, 2005.
This is the most important source model for realistic scenarios.
We will define the formulæ for a general ellipsoid source.
The spherical source is obtained by setting σ1=σ2.
We describe the ellipse centred at the origin in a Cartesian coordinate system,
with the major axis along the y-axis and the minor axis along
the x-axis.
This image is then rotated for the desired orientation λS.
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 and σ2, for the minor
and major axes of the ellipsoid.
Additionally some parameters are currently hard-coded.
The Sersic index n=4
Coefficients b1=1.992, b0=−0.3271
We define
elliptic ratio q=σ1σ2
effective radius reff=10σ1 (see CHECK in the code below)
See General elliptical Sersic profile for the general recipe (arbitrary n
and position angle), including the proof that reff is the half-light
radius for any axis ratio q -- this holds for whatever value reff
is actually given, including the current reff=10σ1; it just
means the half-light ellipse currently has semi-axes
(10σ2,10σ1) rather than (σ1,σ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;
The hard-coded implementation above fixes n=4 and only handles
ellipses aligned with the (x,y) axes. This section gives the general
recipe: arbitrary Sersic index ns, an arbitrary position angle, and a
luminosity normalisation consistent with the spherical case.
This is exactly what the hard-coded code above already does for the
axis-aligned case (with y′=y playing the role of the unscaled axis).
The pixel value is then given by the same 1D formula as the
spherical case, with r→r~ and general ns:
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