CosmoSim is a simulator for gravitational lensing.
The reference points are calculated in the following order
updateApparentAbs() calculates inferred parameters when all
input parameters have been set.
lens-<updatePsi() to make the lens consistentreferenceXi) from lens->getXi($\chi\eta$)getXi() is implemented differently in
Lens, using raytrace logic
\xi = \chi\eta + \nabla\psi(\chi\eta)SampledLens which uses fix point iterationPointMass, but this needs review (TODO)To make the reconstruction work, we need the following geometrical points.
centreX,centreY).LensModel::getOffset$(\nu’)$
and stored in the CSV output from datagen.py as (offsetX,offsetY).LensModel::getRelativeEta$(\nu’)$,
and stored in the CSV output from datagen.py as
(reletaX,reletaY).Concepts in the original co-ordinate system centred at the lens.
| Concept (Ray) | Lens Plane | Source Plane | Data file |
|---|---|---|---|
| Apparent source position | $\xi$ | $\nu$ | |
| Actual source position | ($\chi\eta$) | $\eta$ | |
| Centre of light | $\xi’$ | $\nu’$ | (centreX,centreY) |
| Source of Centre of light | ($\chi\eta’$) | $\eta’$ | |
| Offset | $\Delta\eta=\eta’-\eta$ | (offsetX,offsetY) |
Concepts in the image co-ordinate system. We assume here that the image has been centred at $\nu’$. If the image is not centred, then $\nu’=(0,0)$ for the purpose of calculation.
| Concept (Ray) | Image Plane | Data file |
|---|---|---|
| Apparent source position | $\nu-\nu’$ | (xiX,xiY) |
| Actual source position | $\eta’’=\eta-\nu’$ | (reletaX,reletaY) |
Note that $\eta$ and $\eta’$ are defined in the source plane and $\xi$ and $\xi’$ in the lens plane. Working in the source image, which is also in scale with the images, we have $\nu=\xi/\chi$ and $\nu’=\xi’/\chi$.
The datagen.py script generates the data set.
getAlpha and getBetagetRelativeEta()getOffset()Reconstruction is different from the regular roulette simulation.
Both $\xi$ and $\eta$ are set explicitly and the lens location is unknown.
In theory the lens location could be inferred, but as a free variable it leaves
$\xi$ and $\eta$ to be set independently.
This is implemented in RouletteRegenerator which does not use a separate lens
model.
setCentre() method will
etaOffset to $\Delta\eta$ as read from the CSV filesetAlphaXi and setBetaXi.LensModel and RouletteModel.setLens()getDistortedPos(r,theta)distort() function is inherited from LensModel.
etaOffset + getDistortedPos(r,theta) to find the source pixelupdateApparentAbs()
setNu() which is inherited from LensModeletaOffset = 0setXi(xi1)
Special for resimulation from roulette amplitudes:
setXiEta() to be implementedMasking is important for the Roulette Simulator, because computation is expensive. The current code is wrangled with technical debt, and masking is done twice.
distort() function only calculates pixels
inside the convergence ring, if maskMode is set.
This speeds up calculation.maskImage() functions allows masking after calculation.
It takes an optional scale parameter, and the radius of the mask is
scale times the radius of the convergence ring.setMaskRadius(), which will
give masking as for other Roulette Models.maskImage() works
as it does for Roulette Models. This is done to facilitate comparison
between Raytrace and Roulette, and the mask is only meaningful in relation
to Roulette.