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.

CosmoSim Demo Part I

Preparation

We will use pandas to handle sets of lensing systems with different parameters, pyplot for plotting, PIL for images, as well as config files in TOML. Hence we import the following modules.

import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
import toml

From CosmoSim, we will use the main simulator CosmoSim and the data generator datagen.

from CosmoSim import CosmoSim
from CosmoSim.datagen import SimImage
import CosmoSim.Image as csimg
from CosmoSim import Parameters

Simulating an image

In this demo, we will use the following sample parameters, taken from a test by Ben David 6 May 2026. CosmoSim can take parameters in many different formats. CSV files are generally used for bulk processing, while TOML is more convenient for individual samples. The notation is not always harmonised, and is shown here for reference.

GUI NameParameterCSV nameTOML Name
Einstein RadiusRE=46R_E= 46einsteinRlens.einsteinR
Ellipticity0.34ellipseratiolens.ellipseratio
Lens Orientation107orientationlens.orientation
Distance Ratio (chi)χ=50%\chi=50\%chilens.chi
xx=11.01x= 11.01xposition.x
yy=0.31y= 0.31xposition.y
Source Sizeσ=20\sigma=20sigmasource.sigma
Source Rotation45°thetasource.theta

First test of the API

We can define the configuration as a dict using the nested (TOML) structure.

cfg = { 'lens': { 
            'einsteinR': 46,
            'ellipseratio': 0.34,
            'orientation': 107,
            'chi': 50}
      , 'source': {
            'mode': 'Spherical',
            'sigma': 20,
            'theta': 45,
            'position': 'cartesian'}
      , 'position': {'x': 11.01, 'y': 0.31}
      }

CosmoSim uses Parameters objects which store the parameters as a cascaded dictionary, incorporating defaults. This is instantiated using the dict that we just made.

param = Parameters( cfg )
print( param )
<{'lens': <{}, Ancestor: <{'einsteinR': 46, 'ellipseratio': 0.34, 'orientation': 107, 'chi': 50}, Ancestor: None>>, 'source': <{}, Ancestor: <{'mode': 'Spherical', 'sigma': 20, 'theta': 45, 'position': 'cartesian'}, Ancestor: None>>, 'position': <{}, Ancestor: <{}, Ancestor: <{'x': 11.01, 'y': 0.31}, Ancestor: None>>>, 'simulator': <{'configs': <{}, Ancestor: None>}, Ancestor: <{'configs': <{}, Ancestor: None>}, Ancestor: <{'configs': <{}, Ancestor: None>}, Ancestor: <{'configs': <{}, Ancestor: None>, 'imagesize': 512}, Ancestor: None>>>>, 'dataset': <{}, Ancestor: None>, 'annotation': <{}, Ancestor: None>, 'management': <{}, Ancestor: <{}, Ancestor: <{}, Ancestor: <{'maxcount': None, 'filename': 'test.png'}, Ancestor: None>>>>}, Ancestor: <{'lens': <{'einsteinR': 46, 'ellipseratio': 0.34, 'orientation': 107, 'chi': 50}, Ancestor: None>, 'source': <{'mode': 'Spherical', 'sigma': 20, 'theta': 45, 'position': 'cartesian'}, Ancestor: None>, 'position': <{}, Ancestor: <{'x': 11.01, 'y': 0.31}, Ancestor: None>>, 'simulator': <{'configs': <{}, Ancestor: None>}, Ancestor: <{'configs': <{}, Ancestor: None>}, Ancestor: <{'configs': <{}, Ancestor: None>, 'imagesize': 512}, Ancestor: None>>>, 'dataset': <{}, Ancestor: None>, 'annotation': <{}, Ancestor: None>, 'management': <{}, Ancestor: <{}, Ancestor: <{'maxcount': None, 'filename': 'test.png'}, Ancestor: None>>>}, Ancestor: <{'simulator': <{'configs': <{}, Ancestor: None>}, Ancestor: <{'configs': <{}, Ancestor: None>, 'imagesize': 512}, Ancestor: None>>, 'source': <{}, Ancestor: None>, 'lens': <{}, Ancestor: None>, 'dataset': <{}, Ancestor: None>, 'annotation': <{}, Ancestor: None>, 'management': <{}, Ancestor: <{'maxcount': None, 'filename': 'test.png'}, Ancestor: None>>}, Ancestor: None>>>

We can simulate the configuration by merely instantiating a SimImage object, as follows. The simulator runs as part of the instantiation.
It is rather verbose, with debug messages still left in.

imsim = SimImage( param )
[SimImage] init (verbose=1) ...
[SimImage] setParameters()
[initSim] type(row)=<class 'CosmoSim.CLI.Arguments.Parameters'>
[makeSource] src=Spherical, ltprf0=None, verbose=1
[makeSource] mode=SourceSpec.Sphere, ltprf=LightProfileSpec.Gaussian
[SphericalSource] constructor done
CosmoSim.makeSource() returns (verbose=1
[SphericalSource] GAUSS
CSIM_NOPSI_PM
CSIM_MODEL_POINTMASS_EXACT
[initLens] returning 
[PsiFunctionLens.initAlphasBetas] Amplitudes file nosuchfile
[CosmoSim.initLens] no sampling
[SimulatorModel::setMaskMode] 0
[SimulatorModel::setSource] setting source
[SimulatorModel::update] Lens: Lens (Superclass)
[SimulatorModel::update] CHI=0.5
[SimulatorModel::getSource()]
[setNu] etaOffset set to zero.
[SimulatorModel::update] Done updateApparentAbs()
[SimulatorModel::update] thread section
[SimulatorModel::parallelDistort] 6 threads (maskMode=0)
[SimulatorModel] No mask 
[SimulatorModel::parallelDistort] lower=0; rng=1024; rng1=171
[SimulatorModel::distort] begin=171; end=342
[SimulatorModel::distort] begin=684; end=855
[SimulatorModel::distort] begin=0; end=171
[SimulatorModel::distort] begin=342; end=513
[SimulatorModel::distort] begin=855; end=1024
[SimulatorModel::distort] begin=513; end=684
[Simulator] Centre Point (9.10,-0.14) (Centre of Luminence in Planar Co-ordinates)

Usually, this output is not interesting, but if we have relied heavily on defaults, we can read some of the values actually used from this output. We see GAUSS indicating that a Gaussian light profile has been used for the source. We also see POINTMASS_EXACT which refers to the point mass lens, which is simulated with an exact formula equivalent to raytracing. We will get back to this later.

The interesting part is the image, which we can retrieve with a second line.

im = imsim.getImage()
print( im )
print( type( im ) )
[[0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 ...
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]
 [0 0 0 ... 0 0 0]]
<class 'numpy.ndarray'>

The image is a numpy array, but we can view it as a proper image using matplotlib.

plt.imshow( im, cmap='gray')
plt.title( "First simulation test" )
plt.axis("off")
(np.float64(-0.5), np.float64(511.5), np.float64(511.5), np.float64(-0.5))
<Figure size 640x480 with 1 Axes>

More Complete configuration

For the second test, we will keep the configuration in a TOML file. This tends to be easier to read than the dict in python code. The file is Demo01.toml, and we read it thus:

import tomllib as tl
with open( "Demo01.toml", 'rb') as f:
            toml = tl.load(f)
print( toml )
{'simulator': {'config': 'raysie'}, 'lens': {'einsteinR': 46, 'ellipseratio': 0.34, 'orientation': 107, 'chi': 50}, 'source': {'mode': 'SersicSphere', 'sigma': 20, 'theta': 45, 'position': 'cartesian', 'n_sersic': 4, 'luminosity': 10}, 'position': {'x': 11.01, 'y': 0.31}}

The result is a nested python dict which we can import as we did before.

Most importantly, we are now defining simulator.config=raysie, which says raytrace simulation with a SIE lens, and source.mode=SersicSphere which says a spherical source with Sersic light profile. The sersic parameters (n_sersic and luminosity) match the current defaults in the GUI.

In the run below, we set verbose=2 which gives extra diagnostic output. This is just to demonstrate the feature. It is only needed for debugging.

param = Parameters( toml )
imsim = SimImage( param, verbose=2 )
im = imsim.getImage()
plt.imshow( im, cmap='gray')
plt.title( "Simulation from TOML" )
plt.axis("off")
[GenericSim] init (verbose=2) ...
[SimImage] init (verbose=2) ...
[CosmoSim] init (verbose=2) ...
[initSim] using row
[SimImage] setParameters()
[setParameters] XY 11.01 0.31
setConfigMode(raysie)
[setConfigMode] (<ModelSpec.Raytrace: 0>, <PsiSpec.SIE: 1>, False)
index None
[initSim] type(row)=<class 'CosmoSim.CLI.Arguments.Parameters'>
[initSim] item name: test
[makeSource] src=SersicSphere, ltprf0=None, verbose=2
[makeSource] Lightprofile: SersicSphere LightProfileSpec.Sersic
[makeSource] mode=SourceSpec.Sphere, ltprf=LightProfileSpec.Sersic
[makeSource] Spherical Source - n_sersic=4.0, luminosity=10.0
[SphericalSource] constructor done
makeSource() returns
CosmoSim.makeSource() returns (verbose=2
[GenericSim] ready for runSim()

[SphericalSource] SERSIC
setFile /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initLens] returning 
[PsiFunctionLens.initAlphasBetas] Amplitudes file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initAlphasBetas] opened file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[CosmoSim.initLens] no sampling
[SimulatorModel::setMaskMode] 0
[SimulatorModel::setSource] setting source
[SimulatorModel::update] Lens: Lens (Superclass)
[SimulatorModel::update] CHI=0.5
[SimulatorModel::getSource()]
[Lens::getXi] [5.505, 0.155]
[Lens] Fix pt it'n 0; xi0=[5.505, 0.155]; Delta eta = 36.6416, -9.08535
[Lens] Fix pt it'n 1; xi0=[42.1466, -8.93035]; Delta eta = 35.5485, -22.0062
[Lens] Fix pt it'n 2; xi0=[41.0535, -21.8512]; Delta eta = 31.7068, -32.7793
[Lens] Fix pt it'n 3; xi0=[37.2118, -32.6243]; Delta eta = 27.3886, -39.0702
[Lens] Fix pt it'n 4; xi0=[32.8936, -38.9152]; Delta eta = 24.2201, -42.1871
[Lens] Fix pt it'n 5; xi0=[29.7251, -42.0321]; Delta eta = 22.2814, -43.6881
[Lens] Fix pt it'n 6; xi0=[27.7864, -43.5331]; Delta eta = 21.1833, -44.4264
[Lens] Fix pt it'n 7; xi0=[26.6883, -44.2714]; Delta eta = 20.5823, -44.7992
[Lens] Fix pt it'n 8; xi0=[26.0873, -44.6442]; Delta eta = 20.2588, -44.9913
[Lens] Fix pt it'n 9; xi0=[25.7638, -44.8363]; Delta eta = 20.0859, -45.0914
[Lens] Fix pt it'n 10; xi0=[25.5909, -44.9364]; Delta eta = 19.994, -45.144
[Lens] Fix pt it'n 11; xi0=[25.499, -44.989]; Delta eta = 19.9452, -45.1717
[Lens] Fix pt it'n 12; xi0=[25.4502, -45.0167]; Delta eta = 19.9193, -45.1864
[Lens] Fix pt it'n 13; xi0=[25.4243, -45.0314]; Delta eta = 19.9056, -45.1941
[Lens] Good approximation: xi0=[25.4243, -45.0314]; xi1=[25.4106, -45.0391]
[setNu] etaOffset set to zero.
[SimulatorModel::update] Done updateApparentAbs()
[SimulatorModel::update] thread section
[GenericSim] runSim() completed

[SimulatorModel::updateInner()] R=11.0144; CHI=0.5
[calculateAlphaBeta] [[25.4106, -45.0391]] ... 
[PsiFunctionLens.calculateAlphaBeta()] 16; 46 - [25.4106, -45.0391]
Time to update(): 26 milliseconds
[Simulator] Centre Point (26.03,8.98) (Centre of Luminence in Planar Co-ordinates)
(np.float64(-0.5), np.float64(511.5), np.float64(511.5), np.float64(-0.5))
<Figure size 640x480 with 1 Axes>

Comparing simulation models

For the simulation of SIE lenses, CosmoSim provides a total of four different simulation models

  • Raytrace is the exact simulation, as used above.

  • Roulette uses the Roulette formalism, which approximates using a local description of the lens potential

Each of these can also be run in a sampled version, where the lens potential is sampled and differentiated numerically, instead of using algebraic functions derived analytically.

To test different models, we can set simulator.model, which will override simulator.config, while keeping the SIE lens.

param["simulator"]["model"] = "Roulette"
imsimRoulette = SimImage( param, verbose=0 )
imRoulette = imsimRoulette.getImage()
plt.imshow( imRoulette, cmap='gray')
plt.title( "Roulette Simulation" )
plt.axis("off")
[SimImage] setParameters()
setModelMode(Roulette)
[initSim] type(row)=<class 'CosmoSim.CLI.Arguments.Parameters'>
CosmoSim.makeSource() returns (verbose=0
[SphericalSource] SERSIC
setFile /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
Instantiating RouletteModel ... 
[initLens] returning 
[PsiFunctionLens.initAlphasBetas] Amplitudes file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initAlphasBetas] opened file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[CosmoSim.initLens] no sampling
[SimulatorModel::setMaskMode] 0
[SimulatorModel::setSource] setting source
[SimulatorModel::update] Lens: Lens (Superclass)
[SimulatorModel::update] CHI=0.5
[SimulatorModel::getSource()]
[Lens::getXi] [5.505, 0.155]
[Lens] Fix pt it'n 0; xi0=[5.505, 0.155]; Delta eta = 36.6416, -9.08535
[Lens] Fix pt it'n 1; xi0=[42.1466, -8.93035]; Delta eta = 35.5485, -22.0062
[Lens] Fix pt it'n 2; xi0=[41.0535, -21.8512]; Delta eta = 31.7068, -32.7793
[Lens] Fix pt it'n 3; xi0=[37.2118, -32.6243]; Delta eta = 27.3886, -39.0702
[Lens] Fix pt it'n 4; xi0=[32.8936, -38.9152]; Delta eta = 24.2201, -42.1871
[Lens] Fix pt it'n 5; xi0=[29.7251, -42.0321]; Delta eta = 22.2814, -43.6881
[Lens] Fix pt it'n 6; xi0=[27.7864, -43.5331]; Delta eta = 21.1833, -44.4264
[Lens] Fix pt it'n 7; xi0=[26.6883, -44.2714]; Delta eta = 20.5823, -44.7992
[Lens] Fix pt it'n 8; xi0=[26.0873, -44.6442]; Delta eta = 20.2588, -44.9913
[Lens] Fix pt it'n 9; xi0=[25.7638, -44.8363]; Delta eta = 20.0859, -45.0914
[Lens] Fix pt it'n 10; xi0=[25.5909, -44.9364]; Delta eta = 19.994, -45.144
[Lens] Fix pt it'n 11; xi0=[25.499, -44.989]; Delta eta = 19.9452, -45.1717
[Lens] Fix pt it'n 12; xi0=[25.4502, -45.0167]; Delta eta = 19.9193, -45.1864
[Lens] Fix pt it'n 13; xi0=[25.4243, -45.0314]; Delta eta = 19.9056, -45.1941
[Lens] Good approximation: xi0=[25.4243, -45.0314]; xi1=[25.4106, -45.0391]
[setNu] etaOffset set to zero.
[SimulatorModel::update] Done updateApparentAbs()
[SimulatorModel::update] thread section
[SimulatorModel::updateInner()] R=11.0144; CHI=0.5
[calculateAlphaBeta] [[25.4106, -45.0391]] ... 
[PsiFunctionLens.calculateAlphaBeta()] 16; 46 - [25.4106, -45.0391]
[SimulatorModel::parallelDistort] 6 threads (maskMode=0)
[SimulatorModel] No mask 
[SimulatorModel::parallelDistort] lower=0; rng=512; rng1=86
[SimulatorModel::distort] begin=0; end=86
[SimulatorModel::distort] begin=[SimulatorModel::distort] begin=86258; end=344
; end=172
[SimulatorModel::distort] begin=172; end=258
[SimulatorModel::distort] begin=344; end=430
[getDistortedPos] nu=[-2.13592, 2.45843] theta=2.50667 r=1.75201
Lens (Superclass)0.5[1.75201, 2.50667]->[-2.13592, 2.45843]
[getDistortedPos] nu=[-1.55329, 2.22841] theta=2.29035 r=1.38165
Lens (Superclass)0.5[1.38165, 2.29035]->[-1.55329, 2.22841]
[getDistortedPos] nu=[-0.965334, 1.99664] theta=1.94708 r=1.11731
Lens (Superclass)0.5[1.11731, 1.94708]->[-0.965334, 1.99664]
[getDistortedPos] nu=[-0.372072, 1.76323] theta=1.48495 r=1.04298
Lens (Superclass)0.5[1.04298, 1.48495]->[-0.372072, 1.76323]
[getDistortedPos] nu=[0.226464, 1.52829] theta=1.05483 r=1.19466
Lens (Superclass)0.5[1.19466, 1.05483]->[0.226464, 1.52829]
[getDistortedPos] nu=[0.830242, 1.29191] theta=0.761778 r=1.50554
Lens (Superclass)0.5[1.50554, 0.761778]->[0.830242, 1.29191]
[getDistortedPos] nu=[1.43923, 1.0542] theta=0.579029 r=1.89896
Lens (Superclass)0.5[1.89896, 0.579029]->[1.43923, 1.0542]
[SimulatorModel::distort] begin=430; end=512
[getDistortedPos] nu=[-2.48779, 1.80631] theta=2.86656 r=1.98519
Lens (Superclass)0.5[1.98519, 2.86656]->[-2.48779, 1.80631]
[getDistortedPos] nu=[-1.9086, 1.58173] theta=2.77652 r=1.5101
Lens (Superclass)0.5[1.5101, 2.77652]->[-1.9086, 1.58173]
[getDistortedPos] nu=[-1.32417, 1.35527] theta=2.60702 r=1.05822
Lens (Superclass)0.5[1.05822, 2.60702]->[-1.32417, 1.35527]
[getDistortedPos] nu=[-0.734505, 1.12706] theta=2.22165 r=0.677674
Lens (Superclass)0.5[0.677674, 2.22165]->[-0.734505, 1.12706]
[getDistortedPos] nu=[-0.139644, 0.897178] theta=1.40643 r=0.546502
Lens (Superclass)0.5[0.546502, 1.40643]->[-0.139644, 0.897178]
[getDistortedPos] nu=[0.460389, 0.665741] theta=0.74087 r=0.798803
Lens (Superclass)0.5[0.798803, 0.74087]->[0.460389, 0.665741]
[getDistortedPos] nu=[1.06556, 0.432844] theta=0.459545 r=1.21553
Lens (Superclass)0.5[1.21553, 0.459545]->[1.06556, 0.432844]
[getDistortedPos] nu=[1.67585, 0.198584] theta=0.327023 r=1.67837
Lens (Superclass)0.5[1.67837, 0.327023]->[1.67585, 0.198584]
[getDistortedPos] nu=[-2.26594, 0.922815] theta=3.12111 r=1.91098
Lens (Superclass)0.5[1.91098, 3.12111]->[-2.26594, 0.922815]
[getDistortedPos] nu=[-1.68483, 0.701745] theta=3.11386 r=1.41112
Lens (Superclass)0.5[1.41112, 3.11386]->[-1.68483, 0.701745]
[getDistortedPos] nu=[-1.09856, 0.47879] theta=3.09864 r=0.911418
Lens (Superclass)0.5[0.911418, 3.09864]->[-1.09856, 0.47879]
[getDistortedPos] nu=[-0.507182, 0.254055] theta=3.04656 r=0.412439
Lens (Superclass)0.5[0.412439, 3.04656]->[-0.507182, 0.254055]
[getDistortedPos] nu=[0.0892981, 0.02764] theta=0.412539 r=0.0976112
Lens (Superclass)0.5[0.0976112, 0.412539]->[0.0892981, 0.02764]
[getDistortedPos] nu=[0.690852, -0.200355] theta=0.0662998 r=0.59072
Lens (Superclass)0.5[0.59072, 0.0662998]->[0.690852, -0.200355]
[getDistortedPos] nu=[1.29745, -0.429834] theta=0.0359081 r=1.09012
Lens (Superclass)0.5[1.09012, 0.0359081]->[1.29745, -0.429834]
[getDistortedPos] nu=[1.90907, -0.660702] theta=0.0246178 r=1.5899
Lens (Superclass)0.5[1.5899, 0.0246178]->[1.90907, -0.660702]
[getDistortedPos] nu=[-2.04758, 0.0362229] theta=-2.9049 r=1.96538
Lens (Superclass)0.5[1.96538, -2.9049]->[-2.04758, 0.0362229]
[getDistortedPos] nu=[-1.46452, -0.181405] theta=-2.82581 r=1.48396
Lens (Superclass)0.5[1.48396, -2.82581]->[-1.46452, -0.181405]
[getDistortedPos] nu=[-0.876419, -0.40093] theta=-2.67306 r=1.02056
Lens (Superclass)0.5[1.02056, -2.67306]->[-0.876419, -0.40093]
[getDistortedPos] nu=[-0.283299, -0.62225] theta=-2.29855 r=0.617228
Lens (Superclass)0.5[0.617228, -2.29855]->[-0.283299, -0.62225]
[getDistortedPos] nu=[0.31482, -0.845267] theta=-1.37915 r=0.469459
Lens (Superclass)0.5[0.469459, -1.37915]->[0.31482, -0.845267]
[getDistortedPos] nu=[0.917916, -1.06988] theta=-0.663601 r=0.748207
Lens (Superclass)0.5[0.748207, -0.663601]->[0.917916, -1.06988]
[getDistortedPos] nu=[1.52596, -1.29601] theta=-0.400205 r=1.18289
Lens (Superclass)0.5[1.18289, -0.400205]->[1.52596, -1.29601]
[getDistortedPos] nu=[2.13893, -1.52354] theta=-0.282218 r=1.65489
Lens (Superclass)0.5[1.65489, -0.282218]->[2.13893, -1.52354]
[getDistortedPos] nu=[-1.24762, -1.06762] theta=-2.54361 r=1.70675
Lens (Superclass)0.5[1.70675, -2.54361]->[-1.24762, -1.06762]
[getDistortedPos] nu=[-0.657664, -1.28378] theta=-2.32933 r=1.32379
Lens (Superclass)0.5[1.32379, -2.32933]->[-0.657664, -1.28378]
[getDistortedPos] nu=[-0.0627903, -1.50175] theta=-1.97461 r=1.04491
Lens (Superclass)0.5[1.04491, -1.97461]->[-0.0627903, -1.50175]
[getDistortedPos] nu=[0.536986, -1.72143] theta=-1.478 r=0.965016
Lens (Superclass)0.5[0.965016, -1.478]->[0.536986, -1.72143]
[getDistortedPos] nu=[1.14164, -1.94274] theta=-1.02056 r=1.12724
Lens (Superclass)0.5[1.12724, -1.02056]->[1.14164, -1.94274]
[getDistortedPos] nu=[1.75116, -2.16556] theta=-0.722778 r=1.45262
Lens (Superclass)0.5[1.45262, -0.722778]->[1.75116, -2.16556]
[getDistortedPos] nu=[2.36551, -2.38982] theta=-0.543749 r=1.85729
Lens (Superclass)0.5[1.85729, -0.543749]->[2.36551, -2.38982]
[getDistortedPos] nu=[-0.442231, -2.16966] theta=-2.12818 r=1.72142
Lens (Superclass)0.5[1.72142, -2.12818]->[-0.442231, -2.16966]
[getDistortedPos] nu=[0.154409, -2.38434] theta=-1.84478 r=1.51746
Lens (Superclass)0.5[1.51746, -1.84478]->[0.154409, -2.38434]
[getDistortedPos] nu=[0.755857, -2.60076] theta=-1.50966 r=1.4636
Lens (Superclass)0.5[1.4636, -1.50966]->[0.755857, -2.60076]
[getDistortedPos] nu=[1.36209, -2.8188] theta=-1.1873 r=1.57529
Lens (Superclass)0.5[1.57529, -1.1873]->[1.36209, -2.8188]
[getDistortedPos] nu=[1.9731, -3.03839] theta=-0.930028 r=1.82235
Lens (Superclass)0.5[1.82235, -0.930028]->[1.9731, -3.03839]
[getDistortedPos] nu=[0.971497, -3.48313] theta=-1.52522 r=1.9629
Lens (Superclass)0.5[1.9629, -1.52522]->[0.971497, -3.48313]
[getDistortedPos] nu=[-1.78602, 3.09808] theta=2.10503 r=1.78832
Lens (Superclass)0.5[1.78832, 2.10503]->[-1.78602, 3.09808]
[getDistortedPos] nu=[-1.19974, 2.86269] theta=1.83148 r=1.59296
Lens (Superclass)0.5[1.59296, 1.83148]->[-1.19974, 2.86269]
[getDistortedPos] nu=[-0.60805, 2.62569] theta=1.51276 r=1.54173
Lens (Superclass)0.5[1.54173, 1.51276]->[-0.60805, 2.62569]
[getDistortedPos] nu=[-0.0109865, 2.38717] theta=1.20507 r=1.64814
Lens (Superclass)0.5[1.64814, 1.20507]->[-0.0109865, 2.38717]
[getDistortedPos] nu=[0.59142, 2.14725] theta=0.954845 r=1.88568
Lens (Superclass)0.5[1.88568, 0.954845]->[0.59142, 2.14725]
Time to update(): 176 milliseconds
(np.float64(-0.5), np.float64(511.5), np.float64(511.5), np.float64(-0.5))
<Figure size 640x480 with 1 Axes>

Because the source is small and provides little light, it is hard to distinguish the simulation models, but the critical point with Roulette is that it only provides a local description of the primary image. The secondary image on the far side of the lens will never appear in a roulette simulation.

Before we tamper with the source description, we will run sampled simulations as follows.

param["simulator"]["model"] = "Roulette"
param["simulator"]["sampled"] = True
imsimRouletteSampled = SimImage( param, verbose=0 )
imRouletteSampled = imsimRouletteSampled.getImage()

param["simulator"]["model"] = "Raytrace"
param["simulator"]["sampled"] = True
imsimRaytraceSampled = SimImage( param, verbose=0 )
imRaytraceSampled = imsimRaytraceSampled.getImage()
[SimImage] setParameters()
setModelMode(Roulette)
[initSim] type(row)=<class 'CosmoSim.CLI.Arguments.Parameters'>
CosmoSim.makeSource() returns (verbose=0
[SphericalSource] SERSIC
setFile /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
Instantiating RouletteModel ... 
[initLens] returning 
[PsiFunctionLens.initAlphasBetas] Amplitudes file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initAlphasBetas] opened file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[CosmoSim.initLens] ready to sample lens
[SampledPsiFunctionLens] updatePsi() returns
[CosmoSim.initLens] lens sampled
[SimulatorModel::setMaskMode] 0
[SimulatorModel::setSource] setting source
[SimulatorModel::update] Lens: Lens (Superclass)
[SimulatorModel::update] CHI=0.5
[SimulatorModel::getSource()]
[Lens::getXi] [5.505, 0.155]
[Lens] Fix pt it'n 0; xi0=[5.505, 0.155]; Delta eta = 36.2352, -10.4745
[Lens] Fix pt it'n 1; xi0=[41.7402, -10.3195]; Delta eta = 35.2898, -23.1337
[Lens] Fix pt it'n 2; xi0=[40.7948, -22.9787]; Delta eta = 31.3282, -33.4673
[Lens] Fix pt it'n 3; xi0=[36.8332, -33.3123]; Delta eta = 27.2145, -39.2647
[Lens] Fix pt it'n 4; xi0=[32.7195, -39.1097]; Delta eta = 24.2314, -42.1756
[Lens] Fix pt it'n 5; xi0=[29.7364, -42.0206]; Delta eta = 22.3891, -43.6097
[Lens] Fix pt it'n 6; xi0=[27.8941, -43.4547]; Delta eta = 21.3955, -44.2877
[Lens] Fix pt it'n 7; xi0=[26.9005, -44.1327]; Delta eta = 20.7681, -44.6843
[Lens] Fix pt it'n 8; xi0=[26.2731, -44.5293]; Delta eta = 20.1423, -45.057
[Lens] Fix pt it'n 9; xi0=[25.6473, -44.902]; Delta eta = 20.1423, -45.057
[Lens] Good approximation: xi0=[25.6473, -44.902]; xi1=[25.6473, -44.902]
[setNu] etaOffset set to zero.
[SimulatorModel::update] Done updateApparentAbs()
[SimulatorModel::update] thread section
[SimulatorModel::updateInner()] R=11.0144; CHI=0.5
[calculateAlphaBeta] [[25.6473, -44.902]] ... 
[SimulatorModel::parallelDistort] 6 threads (maskMode=0)
[SimulatorModel] No mask 
[SimulatorModel::parallelDistort] lower=0; rng=512; rng1=86
[SimulatorModel::distort] begin=0; end=86
[SimulatorModel::distort] begin=86; end=172
[SimulatorModel::distort] begin=172; end=258
[SimulatorModel::distort] begin=258; end=344
[SimulatorModel::distort] begin=344; end=430
[getDistortedPos] nu=[-2.37121, 2.32532] theta=2.64061 r=1.87812
Lens (Superclass)0.5[1.87812, 2.64061]->[-2.37121, 2.32532]
[getDistortedPos] nu=[-1.78448, 2.09482] theta=2.47532 r=1.45946
Lens (Superclass)0.5[1.45946, 2.47532]->[-1.78448, 2.09482]
[getDistortedPos] nu=[-1.19245, 1.86265] theta=2.19325 r=1.11027
Lens (Superclass)0.5[1.11027, 2.19325]->[-1.19245, 1.86265]
[getDistortedPos] nu=[-0.595165, 1.6289] theta=1.73269 r=0.913989
Lens (Superclass)0.5[0.913989, 1.73269]->[-0.595165, 1.6289]
[getDistortedPos] nu=[0.007357, 1.39368] theta=1.19809 r=0.968531
Lens (Superclass)0.5[0.968531, 1.19809]->[0.007357, 1.39368]
[getDistortedPos] nu=[0.61508, 1.1571] theta=0.813522 r=1.24126
Lens (Superclass)0.5[1.24126, 0.813522]->[0.61508, 1.1571]
[getDistortedPos] nu=[1.22797, 0.919239] theta=0.588133 r=1.62585
Lens (Superclass)0.5[1.62585, 0.588133]->[1.22797, 0.919239]
[SimulatorModel::distort] begin=430; end=512
[getDistortedPos] nu=[-2.14336, 1.4506] theta=2.90222 r=1.69567
Lens (Superclass)0.5[1.69567, 2.90222]->[-2.14336, 1.4506]
[getDistortedPos] nu=[-1.55489, 1.22363] theta=2.80455 r=1.21573
Lens (Superclass)0.5[1.21573, 2.80455]->[-1.55489, 1.22363]
[getDistortedPos] nu=[-0.961235, 0.994978] theta=2.58582 r=0.762013
Lens (Superclass)0.5[0.762013, 2.58582]->[-0.961235, 0.994978]
[getDistortedPos] nu=[-0.362416, 0.764729] theta=1.92205 r=0.428181
Lens (Superclass)0.5[0.428181, 1.92205]->[-0.362416, 0.764729]
[getDistortedPos] nu=[0.241539, 0.532987] theta=0.850711 r=0.534803
Lens (Superclass)0.5[0.534803, 0.850711]->[0.241539, 0.532987]
[getDistortedPos] nu=[0.850597, 0.299847] theta=0.44059 r=0.942703
Lens (Superclass)0.5[0.942703, 0.44059]->[0.850597, 0.299847]
[getDistortedPos] nu=[1.46473, 0.0654064] theta=0.288901 r=1.41116
Lens (Superclass)0.5[1.41116, 0.288901]->[1.46473, 0.0654064]
[getDistortedPos] nu=[2.0839, -0.170243] theta=0.213691 r=1.8958
Lens (Superclass)0.5[1.8958, 0.213691]->[2.0839, -0.170243]
[getDistortedPos] nu=[-1.91902, 0.572561] theta=-3.0822 r=1.65023
Lens (Superclass)0.5[1.65023, -3.0822]->[-1.91902, 0.572561]
[getDistortedPos] nu=[-1.3288, 0.34907] theta=-3.05642 r=1.1515
Lens (Superclass)0.5[1.1515, -3.05642]->[-1.3288, 0.34907]
[getDistortedPos] nu=[-0.733493, 0.123867] theta=-2.9914 r=0.654695
Lens (Superclass)0.5[0.654695, -2.9914]->[-0.733493, 0.123867]
[getDistortedPos] nu=[-0.133119, -0.10295] theta=-2.55479 r=0.176921
Lens (Superclass)0.5[0.176921, -2.55479]->[-0.133119, -0.10295]
[getDistortedPos] nu=[0.472292, -0.331283] theta=-0.270939 r=0.366028
Lens (Superclass)0.5[0.366028, -0.270939]->[0.472292, -0.331283]
[getDistortedPos] nu=[1.08271, -0.561036] theta=-0.114387 r=0.858284
Lens (Superclass)0.5[0.858284, -0.114387]->[1.08271, -0.561036]
[getDistortedPos] nu=[1.69811, -0.792118] theta=-0.072295 r=1.35622
Lens (Superclass)0.5[1.35622, -0.072295]->[1.69811, -0.792118]
[getDistortedPos] nu=[2.31846, -1.02444] theta=-0.052827 r=1.85526
Lens (Superclass)0.5[1.85526, -0.052827]->[2.31846, -1.02444]
[getDistortedPos] nu=[-1.69813, -0.308672] theta=-2.79339 r=1.75249
Lens (Superclass)0.5[1.75249, -2.79339]->[-1.69813, -0.308672]
[getDistortedPos] nu=[-1.10614, -0.52876] theta=-2.66115 r=1.2938
Lens (Superclass)0.5[1.2938, -2.66115]->[-1.10614, -0.52876]
[getDistortedPos] nu=[-0.509161, -0.750576] theta=-2.39581 r=0.881242
Lens (Superclass)0.5[0.881242, -2.39581]->[-0.509161, -0.750576]
[getDistortedPos] nu=[0.0927868, -0.974024] theta=-1.81236 r=0.615844
Lens (Superclass)0.5[0.615844, -1.81236]->[0.0927868, -0.974024]
[getDistortedPos] nu=[0.699677, -1.19901] theta=-1.03791 r=0.694218
Lens (Superclass)0.5[0.694218, -1.03791]->[0.699677, -1.19901]
[getDistortedPos] nu=[1.31148, -1.42544] theta=-0.611583 r=1.04145
Lens (Superclass)0.5[1.04145, -0.611583]->[1.31148, -1.42544]
[getDistortedPos] nu=[1.92818, -1.65322] theta=-0.416231 r=1.47895
Lens (Superclass)0.5[1.47895, -0.416231]->[1.92818, -1.65322]
[getDistortedPos] nu=[2.54973, -1.88226] theta=-0.312201 r=1.94678
Lens (Superclass)0.5[1.94678, -0.312201]->[2.54973, -1.88226]
[getDistortedPos] nu=[-1.48062, -1.193] theta=-2.5537 r=1.9797
Lens (Superclass)0.5[1.9797, -2.5537]->[-1.48062, -1.193]
[getDistortedPos] nu=[-0.886844, -1.40975] theta=-2.37818 r=1.58804
Lens (Superclass)0.5[1.58804, -2.37818]->[-0.886844, -1.40975]
[getDistortedPos] nu=[-0.288175, -1.62824] theta=-2.10351 r=1.27458
Lens (Superclass)0.5[1.27458, -2.10351]->[-0.288175, -1.62824]
[getDistortedPos] nu=[0.315365, -1.84838] theta=-1.70418 r=1.1078
Lens (Superclass)0.5[1.1078, -1.70418]->[0.315365, -1.84838]
[getDistortedPos] nu=[0.923755, -2.07008] theta=-1.26 r=1.15321
Lens (Superclass)0.5[1.15321, -1.26]->[0.923755, -2.07008]
[getDistortedPos] nu=[1.53697, -2.29324] theta=-0.910489 r=1.39017
Lens (Superclass)0.5[1.39017, -0.910489]->[1.53697, -2.29324]
[getDistortedPos] nu=[2.15498, -2.51778] theta=-0.681833 r=1.7422
Lens (Superclass)0.5[1.7422, -0.681833]->[2.15498, -2.51778]
[getDistortedPos] nu=[-0.670845, -2.29379] theta=-2.1935 r=1.96719
Lens (Superclass)0.5[1.96719, -2.1935]->[-0.670845, -2.29379]
[getDistortedPos] nu=[-0.070473, -2.50903] theta=-1.95569 r=1.7241
Lens (Superclass)0.5[1.7241, -1.95569]->[-0.070473, -2.50903]
[getDistortedPos] nu=[0.534677, -2.72593] theta=-1.66273 r=1.60474
Lens (Superclass)0.5[1.60474, -1.66273]->[0.534677, -2.72593]
[getDistortedPos] nu=[1.14459, -2.9444] theta=-1.35358 r=1.63642
Lens (Superclass)0.5[1.63642, -1.35358]->[1.14459, -2.9444]
[getDistortedPos] nu=[1.75923, -3.16435] theta=-1.08063 r=1.81123
Lens (Superclass)0.5[1.81123, -1.08063]->[1.75923, -3.16435]
[getDistortedPos] nu=[-1.07128, 3.34624] theta=1.6481 r=1.90773
Lens (Superclass)0.5[1.90773, 1.6481]->[-1.07128, 3.34624]
[getDistortedPos] nu=[-0.471543, 3.10388] theta=1.38746 r=1.93446
Lens (Superclass)0.5[1.93446, 1.38746]->[-0.471543, 3.10388]
[getDistortedPos] nu=[-2.01763, 2.96252] theta=2.25661 r=1.81165
Lens (Superclass)0.5[1.81165, 2.25661]->[-2.01763, 2.96252]
[getDistortedPos] nu=[-1.42721, 2.72675] theta=2.00334 r=1.54426
Lens (Superclass)0.5[1.54426, 2.00334]->[-1.42721, 2.72675]
[getDistortedPos] nu=[-0.831432, 2.48944] theta=1.67549 r=1.40976
Lens (Superclass)0.5[1.40976, 1.67549]->[-0.831432, 2.48944]
[getDistortedPos] nu=[-0.230316, 2.25069] theta=1.32436 r=1.44571
Lens (Superclass)0.5[1.44571, 1.32436]->[-0.230316, 2.25069]
[getDistortedPos] nu=[0.376101, 2.0106] theta=1.02439 r=1.64096
Lens (Superclass)0.5[1.64096, 1.02439]->[0.376101, 2.0106]
[getDistortedPos] nu=[0.98778, 1.76926] theta=0.803315 r=1.94819
Lens (Superclass)0.5[1.94819, 0.803315]->[0.98778, 1.76926]
Time to update(): 381 milliseconds
[SimImage] setParameters()
setModelMode(Raytrace)
[initSim] type(row)=<class 'CosmoSim.CLI.Arguments.Parameters'>
CosmoSim.makeSource() returns (verbose=0
[SphericalSource] SERSIC
setFile /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initLens] returning 
[PsiFunctionLens.initAlphasBetas] Amplitudes file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initAlphasBetas] opened file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[CosmoSim.initLens] ready to sample lens
[SampledPsiFunctionLens] updatePsi() returns
[CosmoSim.initLens] lens sampled
[SimulatorModel::setMaskMode] 0
[SimulatorModel::setSource] setting source
[SimulatorModel::update] Lens: Lens (Superclass)
[SimulatorModel::update] CHI=0.5
[SimulatorModel::getSource()]
[Lens::getXi] [5.505, 0.155]
[Lens] Fix pt it'n 0; xi0=[5.505, 0.155]; Delta eta = 36.2352, -10.4745
[Lens] Fix pt it'n 1; xi0=[41.7402, -10.3195]; Delta eta = 35.2898, -23.1337
[Lens] Fix pt it'n 2; xi0=[40.7948, -22.9787]; Delta eta = 31.3282, -33.4673
[Lens] Fix pt it'n 3; xi0=[36.8332, -33.3123]; Delta eta = 27.2145, -39.2647
[Lens] Fix pt it'n 4; xi0=[32.7195, -39.1097]; Delta eta = 24.2314, -42.1756
[Lens] Fix pt it'n 5; xi0=[29.7364, -42.0206]; Delta eta = 22.3891, -43.6097
[Lens] Fix pt it'n 6; xi0=[27.8941, -43.4547]; Delta eta = 21.3955, -44.2877
[Lens] Fix pt it'n 7; xi0=[26.9005, -44.1327]; Delta eta = 20.7681, -44.6843
[Lens] Fix pt it'n 8; xi0=[26.2731, -44.5293]; Delta eta = 20.1423, -45.057
[Lens] Fix pt it'n 9; xi0=[25.6473, -44.902]; Delta eta = 20.1423, -45.057
[Lens] Good approximation: xi0=[25.6473, -44.902]; xi1=[25.6473, -44.902]
[setNu] etaOffset set to zero.
[SimulatorModel::update] Done updateApparentAbs()
[SimulatorModel::update] thread section
[SimulatorModel::updateInner()] R=11.0144; CHI=0.5
[calculateAlphaBeta] [[25.6473, -44.902]] ... 
Time to update(): 231 milliseconds

To better compare, we will show the four images side by side.

fig = plt.figure(figsize=(10, 10))
fig.tight_layout(pad=0.0)
plt.subplots_adjust(hspace=0.1, wspace=0.1) 

fig.add_subplot(2, 2, 1)
plt.imshow( imRouletteSampled, cmap='gray')
plt.title( "Sampled Roulette Simulation" )
plt.axis("off")

fig.add_subplot(2, 2, 2)
plt.imshow( imRaytraceSampled, cmap='gray')
plt.title( "Sampled Raytrace Simulation" )
plt.axis("off")

fig.add_subplot(2, 2, 3)
plt.imshow( imRoulette, cmap='gray')
plt.title( "Roulette Simulation" )
plt.axis("off")

fig.add_subplot(2, 2, 4)
plt.imshow( im, cmap='gray')
plt.title( "Raytrace Simulation" )
plt.axis("off")
(np.float64(-0.5), np.float64(511.5), np.float64(511.5), np.float64(-0.5))
<Figure size 1000x1000 with 4 Axes>

A convenience function

The following function does the four simulations and plots above, for any given set of parameters param. When we fiddle with the source (or lens) description, we will use this to run all tests at once.

def quadSim( param ):
    param["simulator"]["model"] = "Roulette"
    param["simulator"]["sampled"] = True
    imsimRouletteSampled = SimImage( param, verbose=0 )
    imRouletteSampled = imsimRouletteSampled.getImage()

    param["simulator"]["sampled"] = False
    imsimRoulette = SimImage( param, verbose=0 )
    imRoulette = imsimRoulette.getImage()

    param["simulator"]["model"] = "Raytrace"
    param["simulator"]["sampled"] = True
    imsimRaytrace = SimImage( param, verbose=0 )
    imRaytrace = imsimRaytrace.getImage()

    param["simulator"]["sampled"] = False
    imsimRaytraceSampled = SimImage( param, verbose=0 )
    imRaytraceSampled = imsimRaytraceSampled.getImage()

    fig = plt.figure(figsize=(10, 10))
    fig.tight_layout(pad=0.0)
    plt.subplots_adjust(hspace=0.1, wspace=0.1) 

    fig.add_subplot(2, 2, 1)
    plt.imshow( imRouletteSampled, cmap='gray')
    plt.title( "Sampled Roulette Simulation" )
    plt.axis("off")

    fig.add_subplot(2, 2, 2)
    plt.imshow( imRaytraceSampled, cmap='gray')
    plt.title( "Sampled Raytrace Simulation" )

    plt.axis("off")

    fig.add_subplot(2, 2, 3)
    plt.imshow( imRoulette, cmap='gray')
    plt.title( "Roulette Simulation" )
    plt.axis("off")
    
    fig.add_subplot(2, 2, 4)
    plt.imshow( imRaytrace, cmap='gray')
    plt.title( "Raytrace Simulation" )
    plt.axis("off")

    return( imRaytrace, imRoulette, imRaytraceSampled, imRouletteSampled )

The triangle source

The triangle source is specially designed for visual comparison of lensing configurations. This is what we get.

param["source"]["mode"] = "Triangle"
(im1,im2,im3,im4) = quadSim( param )
[SimImage] setParameters()
setModelMode(Roulette)
[initSim] type(row)=<class 'CosmoSim.CLI.Arguments.Parameters'>
CosmoSim.makeSource() returns (verbose=0
setFile /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
Instantiating RouletteModel ... 
[initLens] returning 
[PsiFunctionLens.initAlphasBetas] Amplitudes file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initAlphasBetas] opened file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[CosmoSim.initLens] ready to sample lens
[SampledPsiFunctionLens] updatePsi() returns
[CosmoSim.initLens] lens sampled
[SimulatorModel::setMaskMode] 0
[SimulatorModel::setSource] setting source
[SimulatorModel::update] Lens: Lens (Superclass)
[SimulatorModel::update] CHI=0.5
[SimulatorModel::getSource()]
[Lens::getXi] [5.505, 0.155]
[Lens] Fix pt it'n 0; xi0=[5.505, 0.155]; Delta eta = 36.2352, -10.4745
[Lens] Fix pt it'n 1; xi0=[41.7402, -10.3195]; Delta eta = 35.2898, -23.1337
[Lens] Fix pt it'n 2; xi0=[40.7948, -22.9787]; Delta eta = 31.3282, -33.4673
[Lens] Fix pt it'n 3; xi0=[36.8332, -33.3123]; Delta eta = 27.2145, -39.2647
[Lens] Fix pt it'n 4; xi0=[32.7195, -39.1097]; Delta eta = 24.2314, -42.1756
[Lens] Fix pt it'n 5; xi0=[29.7364, -42.0206]; Delta eta = 22.3891, -43.6097
[Lens] Fix pt it'n 6; xi0=[27.8941, -43.4547]; Delta eta = 21.3955, -44.2877
[Lens] Fix pt it'n 7; xi0=[26.9005, -44.1327]; Delta eta = 20.7681, -44.6843
[Lens] Fix pt it'n 8; xi0=[26.2731, -44.5293]; Delta eta = 20.1423, -45.057
[Lens] Fix pt it'n 9; xi0=[25.6473, -44.902]; Delta eta = 20.1423, -45.057
[Lens] Good approximation: xi0=[25.6473, -44.902]; xi1=[25.6473, -44.902]
[setNu] etaOffset set to zero.
[SimulatorModel::update] Done updateApparentAbs()
[SimulatorModel::update] thread section
[SimulatorModel::updateInner()] R=11.0144; CHI=0.5
[calculateAlphaBeta] [[25.6473, -44.902]] ... 
[SimulatorModel::parallelDistort] 6 threads (maskMode=0)
[SimulatorModel] No mask 
[SimulatorModel::parallelDistort] lower=0; rng=512; rng1=86
[SimulatorModel::distort] begin=0; end=86
[SimulatorModel::distort] begin=[SimulatorModel::distort] begin=172; end=258
86; end=172
[SimulatorModel::distort] begin=344; end=430
[SimulatorModel::distort] begin=258; end=344
[getDistortedPos] nu=[-2.37121, 2.32532] theta=2.64061 r=1.87812
Lens (Superclass)0.5[1.87812, 2.64061]->[-2.37121, 2.32532]
[getDistortedPos] nu=[-1.78448, 2.09482] theta=2.47532 r=1.45946
Lens (Superclass)0.5[1.45946, 2.47532]->[-1.78448, 2.09482]
[getDistortedPos] nu=[-1.19245, 1.86265] theta=2.19325 r=1.11027
Lens (Superclass)0.5[1.11027, 2.19325]->[-1.19245, 1.86265]
[getDistortedPos] nu=[-0.595165, 1.6289] theta=1.73269 r=0.913989
Lens (Superclass)0.5[0.913989, 1.73269]->[-0.595165, 1.6289]
[getDistortedPos] nu=[0.007357, 1.39368] theta=1.19809 r=0.968531
Lens (Superclass)0.5[0.968531, 1.19809]->[0.007357, 1.39368]
[getDistortedPos] nu=[0.61508, 1.1571] theta=0.813522 r=1.24126
Lens (Superclass)0.5[1.24126, 0.813522]->[0.61508, 1.1571]
[getDistortedPos] nu=[1.22797, 0.919239] theta=0.588133 r=1.62585
Lens (Superclass)0.5[1.62585, 0.588133]->[1.22797, 0.919239]
[getDistortedPos] nu=[-2.14336, 1.4506] theta=2.90222 r=1.69567
Lens (Superclass)0.5[1.69567, 2.90222]->[-2.14336, 1.4506]
[getDistortedPos] nu=[-1.55489, 1.22363] theta=2.80455 r=1.21573
Lens (Superclass)0.5[1.21573, 2.80455]->[-1.55489, 1.22363]
[getDistortedPos] nu=[-0.961235, 0.994978] theta=2.58582 r=0.762013
Lens (Superclass)0.5[0.762013, 2.58582]->[-0.961235, 0.994978]
[getDistortedPos] nu=[-0.362416, 0.764729] theta=1.92205 r=0.428181
Lens (Superclass)0.5[0.428181, 1.92205]->[-0.362416, 0.764729]
[getDistortedPos] nu=[0.241539, 0.532987] theta=0.850711 r=0.534803
Lens (Superclass)0.5[0.534803, 0.850711]->[0.241539, 0.532987]
[getDistortedPos] nu=[0.850597, 0.299847] theta=0.44059 r=0.942703
Lens (Superclass)0.5[0.942703, 0.44059]->[0.850597, 0.299847]
[getDistortedPos] nu=[1.46473, 0.0654064] theta=0.288901 r=1.41116
Lens (Superclass)0.5[1.41116, 0.288901]->[1.46473, 0.0654064]
[getDistortedPos] nu=[2.0839, -0.170243] theta=0.213691 r=1.8958
Lens (Superclass)0.5[1.8958, 0.213691]->[2.0839, -0.170243]
[SimulatorModel::distort] begin=430; end=512
[getDistortedPos] nu=[-1.91902, 0.572561] theta=-3.0822 r=1.65023
Lens (Superclass)0.5[1.65023, -3.0822]->[-1.91902, 0.572561]
[getDistortedPos] nu=[-1.3288, 0.34907] theta=-3.05642 r=1.1515
Lens (Superclass)0.5[1.1515, -3.05642]->[-1.3288, 0.34907]
[getDistortedPos] nu=[-0.733493, 0.123867] theta=-2.9914 r=0.654695
Lens (Superclass)0.5[0.654695, -2.9914]->[-0.733493, 0.123867]
[getDistortedPos] nu=[-0.133119, -0.10295] theta=-2.55479 r=0.176921
Lens (Superclass)0.5[0.176921, -2.55479]->[-0.133119, -0.10295]
[getDistortedPos] nu=[0.472292, -0.331283] theta=-0.270939 r=0.366028
Lens (Superclass)0.5[0.366028, -0.270939]->[0.472292, -0.331283]
[getDistortedPos] nu=[1.08271, -0.561036] theta=-0.114387 r=0.858284
Lens (Superclass)0.5[0.858284, -0.114387]->[1.08271, -0.561036]
[getDistortedPos] nu=[1.69811, -0.792118] theta=-0.072295 r=1.35622
Lens (Superclass)0.5[1.35622, -0.072295]->[1.69811, -0.792118]
[getDistortedPos] nu=[2.31846, -1.02444] theta=-0.052827 r=1.85526
Lens (Superclass)0.5[1.85526, -0.052827]->[2.31846, -1.02444]
[getDistortedPos] nu=[-1.69813, -0.308672] theta=-2.79339 r=1.75249
Lens (Superclass)0.5[1.75249, -2.79339]->[-1.69813, -0.308672]
[getDistortedPos] nu=[-1.10614, -0.52876] theta=-2.66115 r=1.2938
Lens (Superclass)0.5[1.2938, -2.66115]->[-1.10614, -0.52876]
[getDistortedPos] nu=[-0.509161, -0.750576] theta=-2.39581 r=0.881242
Lens (Superclass)0.5[0.881242, -2.39581]->[-0.509161, -0.750576]
[getDistortedPos] nu=[0.0927868, -0.974024] theta=-1.81236 r=0.615844
Lens (Superclass)0.5[0.615844, -1.81236]->[0.0927868, -0.974024]
[getDistortedPos] nu=[0.699677, -1.19901] theta=-1.03791 r=0.694218
Lens (Superclass)0.5[0.694218, -1.03791]->[0.699677, -1.19901]
[getDistortedPos] nu=[1.31148, -1.42544] theta=-0.611583 r=1.04145
Lens (Superclass)0.5[1.04145, -0.611583]->[1.31148, -1.42544]
[getDistortedPos] nu=[1.92818, -1.65322] theta=-0.416231 r=1.47895
Lens (Superclass)0.5[1.47895, -0.416231]->[1.92818, -1.65322]
[getDistortedPos] nu=[2.54973, -1.88226] theta=-0.312201 r=1.94678
Lens (Superclass)0.5[1.94678, -0.312201]->[2.54973, -1.88226]
[getDistortedPos] nu=[-1.48062, -1.193] theta=-2.5537 r=1.9797
Lens (Superclass)0.5[1.9797, -2.5537]->[-1.48062, -1.193]
[getDistortedPos] nu=[-0.886844, -1.40975] theta=-2.37818 r=1.58804
Lens (Superclass)0.5[1.58804, -2.37818]->[-0.886844, -1.40975]
[getDistortedPos] nu=[-0.288175, -1.62824] theta=-2.10351 r=1.27458
Lens (Superclass)0.5[1.27458, -2.10351]->[-0.288175, -1.62824]
[getDistortedPos] nu=[0.315365, -1.84838] theta=-1.70418 r=1.1078
Lens (Superclass)0.5[1.1078, -1.70418]->[0.315365, -1.84838]
[getDistortedPos] nu=[0.923755, -2.07008] theta=-1.26 r=1.15321
Lens (Superclass)0.5[1.15321, -1.26]->[0.923755, -2.07008]
[getDistortedPos] nu=[1.53697, -2.29324] theta=-0.910489 r=1.39017
Lens (Superclass)0.5[1.39017, -0.910489]->[1.53697, -2.29324]
[getDistortedPos] nu=[2.15498, -2.51778] theta=-0.681833 r=1.7422
Lens (Superclass)0.5[1.7422, -0.681833]->[2.15498, -2.51778]
[getDistortedPos] nu=[-0.670845, -2.29379] theta=-2.1935 r=1.96719
Lens (Superclass)0.5[1.96719, -2.1935]->[-0.670845, -2.29379]
[getDistortedPos] nu=[-0.070473, -2.50903] theta=-1.95569 r=1.7241
Lens (Superclass)0.5[1.7241, -1.95569]->[-0.070473, -2.50903]
[getDistortedPos] nu=[0.534677, -2.72593] theta=-1.66273 r=1.60474
Lens (Superclass)0.5[1.60474, -1.66273]->[0.534677, -2.72593]
[getDistortedPos] nu=[1.14459, -2.9444] theta=-1.35358 r=1.63642
Lens (Superclass)0.5[1.63642, -1.35358]->[1.14459, -2.9444]
[getDistortedPos] nu=[1.75923, -3.16435] theta=-1.08063 r=1.81123
Lens (Superclass)0.5[1.81123, -1.08063]->[1.75923, -3.16435]
[getDistortedPos] nu=[-1.07128, 3.34624] theta=1.6481 r=1.90773
Lens (Superclass)0.5[1.90773, 1.6481]->[-1.07128, 3.34624]
[getDistortedPos] nu=[-0.471543, 3.10388] theta=1.38746 r=1.93446
Lens (Superclass)0.5[1.93446, 1.38746]->[-0.471543, 3.10388]
[getDistortedPos] nu=[-2.01763, 2.96252] theta=2.25661 r=1.81165
Lens (Superclass)0.5[1.81165, 2.25661]->[-2.01763, 2.96252]
[getDistortedPos] nu=[-1.42721, 2.72675] theta=2.00334 r=1.54426
Lens (Superclass)0.5[1.54426, 2.00334]->[-1.42721, 2.72675]
[getDistortedPos] nu=[-0.831432, 2.48944] theta=1.67549 r=1.40976
Lens (Superclass)0.5[1.40976, 1.67549]->[-0.831432, 2.48944]
[getDistortedPos] nu=[-0.230316, 2.25069] theta=1.32436 r=1.44571
Lens (Superclass)0.5[1.44571, 1.32436]->[-0.230316, 2.25069]
[getDistortedPos] nu=[0.376101, 2.0106] theta=1.02439 r=1.64096
Lens (Superclass)0.5[1.64096, 1.02439]->[0.376101, 2.0106]
[getDistortedPos] nu=[0.98778, 1.76926] theta=0.803315 r=1.94819
Lens (Superclass)0.5[1.94819, 0.803315]->[0.98778, 1.76926]
Time to update(): 387 milliseconds
[SimImage] setParameters()
setModelMode(Roulette)
[initSim] type(row)=<class 'CosmoSim.CLI.Arguments.Parameters'>
CosmoSim.makeSource() returns (verbose=0
setFile /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
Instantiating RouletteModel ... 
[initLens] returning 
[PsiFunctionLens.initAlphasBetas] Amplitudes file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initAlphasBetas] opened file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[CosmoSim.initLens] no sampling
[SimulatorModel::setMaskMode] 0
[SimulatorModel::setSource] setting source
[SimulatorModel::update] Lens: Lens (Superclass)
[SimulatorModel::update] CHI=0.5
[SimulatorModel::getSource()]
[Lens::getXi] [5.505, 0.155]
[Lens] Fix pt it'n 0; xi0=[5.505, 0.155]; Delta eta = 36.6416, -9.08535
[Lens] Fix pt it'n 1; xi0=[42.1466, -8.93035]; Delta eta = 35.5485, -22.0062
[Lens] Fix pt it'n 2; xi0=[41.0535, -21.8512]; Delta eta = 31.7068, -32.7793
[Lens] Fix pt it'n 3; xi0=[37.2118, -32.6243]; Delta eta = 27.3886, -39.0702
[Lens] Fix pt it'n 4; xi0=[32.8936, -38.9152]; Delta eta = 24.2201, -42.1871
[Lens] Fix pt it'n 5; xi0=[29.7251, -42.0321]; Delta eta = 22.2814, -43.6881
[Lens] Fix pt it'n 6; xi0=[27.7864, -43.5331]; Delta eta = 21.1833, -44.4264
[Lens] Fix pt it'n 7; xi0=[26.6883, -44.2714]; Delta eta = 20.5823, -44.7992
[Lens] Fix pt it'n 8; xi0=[26.0873, -44.6442]; Delta eta = 20.2588, -44.9913
[Lens] Fix pt it'n 9; xi0=[25.7638, -44.8363]; Delta eta = 20.0859, -45.0914
[Lens] Fix pt it'n 10; xi0=[25.5909, -44.9364]; Delta eta = 19.994, -45.144
[Lens] Fix pt it'n 11; xi0=[25.499, -44.989]; Delta eta = 19.9452, -45.1717
[Lens] Fix pt it'n 12; xi0=[25.4502, -45.0167]; Delta eta = 19.9193, -45.1864
[Lens] Fix pt it'n 13; xi0=[25.4243, -45.0314]; Delta eta = 19.9056, -45.1941
[Lens] Good approximation: xi0=[25.4243, -45.0314]; xi1=[25.4106, -45.0391]
[setNu] etaOffset set to zero.
[SimulatorModel::update] Done updateApparentAbs()
[SimulatorModel::update] thread section
[SimulatorModel::updateInner()] R=11.0144; CHI=0.5
[calculateAlphaBeta] [[25.4106, -45.0391]] ... 
[PsiFunctionLens.calculateAlphaBeta()] 16; 46 - [25.4106, -45.0391]
[SimulatorModel::parallelDistort] 6 threads (maskMode=0)
[SimulatorModel] No mask 
[SimulatorModel::parallelDistort] lower=0; rng=512; rng1=86
[SimulatorModel::distort] begin=0; end=86
[SimulatorModel::distort] begin=172; end=258
[SimulatorModel::distort] begin=344; end=430
[SimulatorModel::distort] begin=86; end=172
[SimulatorModel::distort] begin=258; end=344
[getDistortedPos] nu=[-2.13592, 2.45843] theta=2.50667 r=1.75201
Lens (Superclass)0.5[1.75201, 2.50667]->[-2.13592, 2.45843]
[getDistortedPos] nu=[-1.55329, 2.22841] theta=2.29035 r=1.38165
Lens (Superclass)0.5[1.38165, 2.29035]->[-1.55329, 2.22841]
[getDistortedPos] nu=[-0.965334, 1.99664] theta=1.94708 r=1.11731
Lens (Superclass)0.5[1.11731, 1.94708]->[-0.965334, 1.99664]
[getDistortedPos] nu=[-0.372072, 1.76323] theta=1.48495 r=1.04298
Lens (Superclass)0.5[1.04298, 1.48495]->[-0.372072, 1.76323]
[getDistortedPos] nu=[0.226464, 1.52829] theta=1.05483 r=1.19466
Lens (Superclass)0.5[1.19466, 1.05483]->[0.226464, 1.52829]
[getDistortedPos] nu=[0.830242, 1.29191] theta=0.761778 r=1.50554
Lens (Superclass)0.5[1.50554, 0.761778]->[0.830242, 1.29191]
[getDistortedPos] nu=[1.43923, 1.0542] theta=0.579029 r=1.89896
Lens (Superclass)0.5[1.89896, 0.579029]->[1.43923, 1.0542]
[SimulatorModel::distort] begin=430; end=512
[getDistortedPos] nu=[-2.48779, 1.80631] theta=2.86656 r=1.98519
Lens (Superclass)0.5[1.98519, 2.86656]->[-2.48779, 1.80631]
[getDistortedPos] nu=[-1.9086, 1.58173] theta=2.77652 r=1.5101
Lens (Superclass)0.5[1.5101, 2.77652]->[-1.9086, 1.58173]
[getDistortedPos] nu=[-1.32417, 1.35527] theta=2.60702 r=1.05822
Lens (Superclass)0.5[1.05822, 2.60702]->[-1.32417, 1.35527]
[getDistortedPos] nu=[-0.734505, 1.12706] theta=2.22165 r=0.677674
Lens (Superclass)0.5[0.677674, 2.22165]->[-0.734505, 1.12706]
[getDistortedPos] nu=[-0.139644, 0.897178] theta=1.40643 r=0.546502
Lens (Superclass)0.5[0.546502, 1.40643]->[-0.139644, 0.897178]
[getDistortedPos] nu=[0.460389, 0.665741] theta=0.74087 r=0.798803
Lens (Superclass)0.5[0.798803, 0.74087]->[0.460389, 0.665741]
[getDistortedPos] nu=[1.06556, 0.432844] theta=0.459545 r=1.21553
Lens (Superclass)0.5[1.21553, 0.459545]->[1.06556, 0.432844]
[getDistortedPos] nu=[1.67585, 0.198584] theta=0.327023 r=1.67837
Lens (Superclass)0.5[1.67837, 0.327023]->[1.67585, 0.198584]
[getDistortedPos] nu=[-2.26594, 0.922815] theta=3.12111 r=1.91098
Lens (Superclass)0.5[1.91098, 3.12111]->[-2.26594, 0.922815]
[getDistortedPos] nu=[-1.68483, 0.701745] theta=3.11386 r=1.41112
Lens (Superclass)0.5[1.41112, 3.11386]->[-1.68483, 0.701745]
[getDistortedPos] nu=[-1.09856, 0.47879] theta=3.09864 r=0.911418
Lens (Superclass)0.5[0.911418, 3.09864]->[-1.09856, 0.47879]
[getDistortedPos] nu=[-0.507182, 0.254055] theta=3.04656 r=0.412439
Lens (Superclass)0.5[0.412439, 3.04656]->[-0.507182, 0.254055]
[getDistortedPos] nu=[0.0892981, 0.02764] theta=0.412539 r=0.0976112
Lens (Superclass)0.5[0.0976112, 0.412539]->[0.0892981, 0.02764]
[getDistortedPos] nu=[0.690852, -0.200355] theta=0.0662998 r=0.59072
Lens (Superclass)0.5[0.59072, 0.0662998]->[0.690852, -0.200355]
[getDistortedPos] nu=[1.29745, -0.429834] theta=0.0359081 r=1.09012
Lens (Superclass)0.5[1.09012, 0.0359081]->[1.29745, -0.429834]
[getDistortedPos] nu=[1.90907, -0.660702] theta=0.0246178 r=1.5899
Lens (Superclass)0.5[1.5899, 0.0246178]->[1.90907, -0.660702]
[getDistortedPos] nu=[-2.04758, 0.0362229] theta=-2.9049 r=1.96538
Lens (Superclass)0.5[1.96538, -2.9049]->[-2.04758, 0.0362229]
[getDistortedPos] nu=[-1.46452, -0.181405] theta=-2.82581 r=1.48396
Lens (Superclass)0.5[1.48396, -2.82581]->[-1.46452, -0.181405]
[getDistortedPos] nu=[-0.876419, -0.40093] theta=-2.67306 r=1.02056
Lens (Superclass)0.5[1.02056, -2.67306]->[-0.876419, -0.40093]
[getDistortedPos] nu=[-0.283299, -0.62225] theta=-2.29855 r=0.617228
Lens (Superclass)0.5[0.617228, -2.29855]->[-0.283299, -0.62225]
[getDistortedPos] nu=[0.31482, -0.845267] theta=-1.37915 r=0.469459
Lens (Superclass)0.5[0.469459, -1.37915]->[0.31482, -0.845267]
[getDistortedPos] nu=[0.917916, -1.06988] theta=-0.663601 r=0.748207
Lens (Superclass)0.5[0.748207, -0.663601]->[0.917916, -1.06988]
[getDistortedPos] nu=[1.52596, -1.29601] theta=-0.400205 r=1.18289
Lens (Superclass)0.5[1.18289, -0.400205]->[1.52596, -1.29601]
[getDistortedPos] nu=[2.13893, -1.52354] theta=-0.282218 r=1.65489
Lens (Superclass)0.5[1.65489, -0.282218]->[2.13893, -1.52354]
[getDistortedPos] nu=[-1.24762, -1.06762] theta=-2.54361 r=1.70675
Lens (Superclass)0.5[1.70675, -2.54361]->[-1.24762, -1.06762]
[getDistortedPos] nu=[-0.657664, -1.28378] theta=-2.32933 r=1.32379
Lens (Superclass)0.5[1.32379, -2.32933]->[-0.657664, -1.28378]
[getDistortedPos] nu=[-0.0627903, -1.50175] theta=-1.97461 r=1.04491
Lens (Superclass)0.5[1.04491, -1.97461]->[-0.0627903, -1.50175]
[getDistortedPos] nu=[0.536986, -1.72143] theta=-1.478 r=0.965016
Lens (Superclass)0.5[0.965016, -1.478]->[0.536986, -1.72143]
[getDistortedPos] nu=[1.14164, -1.94274] theta=-1.02056 r=1.12724
Lens (Superclass)0.5[1.12724, -1.02056]->[1.14164, -1.94274]
[getDistortedPos] nu=[1.75116, -2.16556] theta=-0.722778 r=1.45262
Lens (Superclass)0.5[1.45262, -0.722778]->[1.75116, -2.16556]
[getDistortedPos] nu=[2.36551, -2.38982] theta=-0.543749 r=1.85729
Lens (Superclass)0.5[1.85729, -0.543749]->[2.36551, -2.38982]
[getDistortedPos] nu=[-0.442231, -2.16966] theta=-2.12818 r=1.72142
Lens (Superclass)0.5[1.72142, -2.12818]->[-0.442231, -2.16966]
[getDistortedPos] nu=[0.154409, -2.38434] theta=-1.84478 r=1.51746
Lens (Superclass)0.5[1.51746, -1.84478]->[0.154409, -2.38434]
[getDistortedPos] nu=[0.755857, -2.60076] theta=-1.50966 r=1.4636
Lens (Superclass)0.5[1.4636, -1.50966]->[0.755857, -2.60076]
[getDistortedPos] nu=[1.36209, -2.8188] theta=-1.1873 r=1.57529
Lens (Superclass)0.5[1.57529, -1.1873]->[1.36209, -2.8188]
[getDistortedPos] nu=[1.9731, -3.03839] theta=-0.930028 r=1.82235
Lens (Superclass)0.5[1.82235, -0.930028]->[1.9731, -3.03839]
[getDistortedPos] nu=[0.971497, -3.48313] theta=-1.52522 r=1.9629
Lens (Superclass)0.5[1.9629, -1.52522]->[0.971497, -3.48313]
[getDistortedPos] nu=[-1.78602, 3.09808] theta=2.10503 r=1.78832
Lens (Superclass)0.5[1.78832, 2.10503]->[-1.78602, 3.09808]
[getDistortedPos] nu=[-1.19974, 2.86269] theta=1.83148 r=1.59296
Lens (Superclass)0.5[1.59296, 1.83148]->[-1.19974, 2.86269]
[getDistortedPos] nu=[-0.60805, 2.62569] theta=1.51276 r=1.54173
Lens (Superclass)0.5[1.54173, 1.51276]->[-0.60805, 2.62569]
[getDistortedPos] nu=[-0.0109865, 2.38717] theta=1.20507 r=1.64814
Lens (Superclass)0.5[1.64814, 1.20507]->[-0.0109865, 2.38717]
[getDistortedPos] nu=[0.59142, 2.14725] theta=0.954845 r=1.88568
Lens (Superclass)0.5[1.88568, 0.954845]->[0.59142, 2.14725]
Time to update(): 181 milliseconds
[SimImage] setParameters()
setModelMode(Raytrace)
[initSim] type(row)=<class 'CosmoSim.CLI.Arguments.Parameters'>
CosmoSim.makeSource() returns (verbose=0
setFile /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initLens] returning 
[PsiFunctionLens.initAlphasBetas] Amplitudes file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initAlphasBetas] opened file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[CosmoSim.initLens] ready to sample lens
[SampledPsiFunctionLens] updatePsi() returns
[CosmoSim.initLens] lens sampled
[SimulatorModel::setMaskMode] 0
[SimulatorModel::setSource] setting source
[SimulatorModel::update] Lens: Lens (Superclass)
[SimulatorModel::update] CHI=0.5
[SimulatorModel::getSource()]
[Lens::getXi] [5.505, 0.155]
[Lens] Fix pt it'n 0; xi0=[5.505, 0.155]; Delta eta = 36.2352, -10.4745
[Lens] Fix pt it'n 1; xi0=[41.7402, -10.3195]; Delta eta = 35.2898, -23.1337
[Lens] Fix pt it'n 2; xi0=[40.7948, -22.9787]; Delta eta = 31.3282, -33.4673
[Lens] Fix pt it'n 3; xi0=[36.8332, -33.3123]; Delta eta = 27.2145, -39.2647
[Lens] Fix pt it'n 4; xi0=[32.7195, -39.1097]; Delta eta = 24.2314, -42.1756
[Lens] Fix pt it'n 5; xi0=[29.7364, -42.0206]; Delta eta = 22.3891, -43.6097
[Lens] Fix pt it'n 6; xi0=[27.8941, -43.4547]; Delta eta = 21.3955, -44.2877
[Lens] Fix pt it'n 7; xi0=[26.9005, -44.1327]; Delta eta = 20.7681, -44.6843
[Lens] Fix pt it'n 8; xi0=[26.2731, -44.5293]; Delta eta = 20.1423, -45.057
[Lens] Fix pt it'n 9; xi0=[25.6473, -44.902]; Delta eta = 20.1423, -45.057
[Lens] Good approximation: xi0=[25.6473, -44.902]; xi1=[25.6473, -44.902]
[setNu] etaOffset set to zero.
[SimulatorModel::update] Done updateApparentAbs()
[SimulatorModel::update] thread section
[SimulatorModel::updateInner()] R=11.0144; CHI=0.5
[calculateAlphaBeta] [[25.6473, -44.902]] ... 
Time to update(): 237 milliseconds
[SimImage] setParameters()
setModelMode(Raytrace)
[initSim] type(row)=<class 'CosmoSim.CLI.Arguments.Parameters'>
CosmoSim.makeSource() returns (verbose=0
setFile /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initLens] returning 
[PsiFunctionLens.initAlphasBetas] Amplitudes file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initAlphasBetas] opened file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[CosmoSim.initLens] no sampling
[SimulatorModel::setMaskMode] 0
[SimulatorModel::setSource] setting source
[SimulatorModel::update] Lens: Lens (Superclass)
[SimulatorModel::update] CHI=0.5
[SimulatorModel::getSource()]
[Lens::getXi] [5.505, 0.155]
[Lens] Fix pt it'n 0; xi0=[5.505, 0.155]; Delta eta = 36.6416, -9.08535
[Lens] Fix pt it'n 1; xi0=[42.1466, -8.93035]; Delta eta = 35.5485, -22.0062
[Lens] Fix pt it'n 2; xi0=[41.0535, -21.8512]; Delta eta = 31.7068, -32.7793
[Lens] Fix pt it'n 3; xi0=[37.2118, -32.6243]; Delta eta = 27.3886, -39.0702
[Lens] Fix pt it'n 4; xi0=[32.8936, -38.9152]; Delta eta = 24.2201, -42.1871
[Lens] Fix pt it'n 5; xi0=[29.7251, -42.0321]; Delta eta = 22.2814, -43.6881
[Lens] Fix pt it'n 6; xi0=[27.7864, -43.5331]; Delta eta = 21.1833, -44.4264
[Lens] Fix pt it'n 7; xi0=[26.6883, -44.2714]; Delta eta = 20.5823, -44.7992
[Lens] Fix pt it'n 8; xi0=[26.0873, -44.6442]; Delta eta = 20.2588, -44.9913
[Lens] Fix pt it'n 9; xi0=[25.7638, -44.8363]; Delta eta = 20.0859, -45.0914
[Lens] Fix pt it'n 10; xi0=[25.5909, -44.9364]; Delta eta = 19.994, -45.144
[Lens] Fix pt it'n 11; xi0=[25.499, -44.989]; Delta eta = 19.9452, -45.1717
[Lens] Fix pt it'n 12; xi0=[25.4502, -45.0167]; Delta eta = 19.9193, -45.1864
[Lens] Fix pt it'n 13; xi0=[25.4243, -45.0314]; Delta eta = 19.9056, -45.1941
[Lens] Good approximation: xi0=[25.4243, -45.0314]; xi1=[25.4106, -45.0391]
[setNu] etaOffset set to zero.
[SimulatorModel::update] Done updateApparentAbs()
[SimulatorModel::update] thread section
[SimulatorModel::updateInner()] R=11.0144; CHI=0.5
[calculateAlphaBeta] [[25.4106, -45.0391]] ... 
[PsiFunctionLens.calculateAlphaBeta()] 16; 46 - [25.4106, -45.0391]
Time to update(): 32 milliseconds
<Figure size 1000x1000 with 4 Axes>

Since we stored the four images in variables (im1 through im4), we can also compare them using difference images. However, we have to take the range (02550\ldots255) into account when we calculate the difference. The following function does this

def imageDiff(im1,im2):
    return ( (im1.astype(float) - im2.astype(float) + 256)/2 ).astype(np.uint8)

Armed with the function, we can plot diff images.

fig = plt.figure(figsize=(14,7))
fig.tight_layout(pad=0.0)
plt.subplots_adjust(hspace=0.1, wspace=0.1) 

fig.add_subplot(1, 3, 1)
plt.imshow( imageDiff( im1, im3 ), cmap='gray')
plt.title( "Raytrace Simulation" )
plt.axis("off")

fig.add_subplot(1, 3, 2)
plt.imshow( imageDiff( im2, im3 ), cmap='gray')
plt.title( "Roulette Simulation" )
plt.axis("off")
    
fig.add_subplot(1, 3, 3)
plt.imshow( imageDiff( im4, im3 ), cmap='gray')
plt.title( "Sampled Roulette Simulation" )
plt.axis("off")
(np.float64(-0.5), np.float64(511.5), np.float64(511.5), np.float64(-0.5))
<Figure size 1400x700 with 3 Axes>

We see that the two raytrace simulations perfectly match, except for the tiny anomilty in the centre, which is probably due to the singularity of the lens potential at the origin.

The roulette simulations match well within the convergence ring.

What should concern us at the minute is the very small convergence ring for the unsampled roulette simulation. This does look wrong.

The number of Roulette terms

The roulette simulation is based on a truncated series, but we did not pay attention to the number of terms retained above. A potential problem is that only five terms have been analytically computed for the SIE lens. This may explain the poor performance. Since numerical differentiation is fast, there is no issue in using many terms in the sampled version. We can set the number of terms as follows.

param["simulator"]["nterms"] = 5
param["simulator"]["model"] = "Roulette"
param["simulator"]["sampled"] = False
imsim = SimImage( param, verbose=0 )
imr = imsim.getImage()
plt.imshow( imr, cmap='gray')
plt.title( "Roulette with five terms" )
plt.axis("off")
[SimImage] setParameters()
setModelMode(Roulette)
[initSim] type(row)=<class 'CosmoSim.CLI.Arguments.Parameters'>
CosmoSim.makeSource() returns (verbose=0
setFile /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
Instantiating RouletteModel ... 
[initLens] returning 
[PsiFunctionLens.initAlphasBetas] Amplitudes file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initAlphasBetas] opened file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[CosmoSim.initLens] no sampling
[SimulatorModel::setMaskMode] 0
[SimulatorModel::setSource] setting source
[SimulatorModel::update] Lens: Lens (Superclass)
[SimulatorModel::update] CHI=0.5
[SimulatorModel::getSource()]
[Lens::getXi] [5.505, 0.155]
[Lens] Fix pt it'n 0; xi0=[5.505, 0.155]; Delta eta = 36.6416, -9.08535
[Lens] Fix pt it'n 1; xi0=[42.1466, -8.93035]; Delta eta = 35.5485, -22.0062
[Lens] Fix pt it'n 2; xi0=[41.0535, -21.8512]; Delta eta = 31.7068, -32.7793
[Lens] Fix pt it'n 3; xi0=[37.2118, -32.6243]; Delta eta = 27.3886, -39.0702
[Lens] Fix pt it'n 4; xi0=[32.8936, -38.9152]; Delta eta = 24.2201, -42.1871
[Lens] Fix pt it'n 5; xi0=[29.7251, -42.0321]; Delta eta = 22.2814, -43.6881
[Lens] Fix pt it'n 6; xi0=[27.7864, -43.5331]; Delta eta = 21.1833, -44.4264
[Lens] Fix pt it'n 7; xi0=[26.6883, -44.2714]; Delta eta = 20.5823, -44.7992
[Lens] Fix pt it'n 8; xi0=[26.0873, -44.6442]; Delta eta = 20.2588, -44.9913
[Lens] Fix pt it'n 9; xi0=[25.7638, -44.8363]; Delta eta = 20.0859, -45.0914
[Lens] Fix pt it'n 10; xi0=[25.5909, -44.9364]; Delta eta = 19.994, -45.144
[Lens] Fix pt it'n 11; xi0=[25.499, -44.989]; Delta eta = 19.9452, -45.1717
[Lens] Fix pt it'n 12; xi0=[25.4502, -45.0167]; Delta eta = 19.9193, -45.1864
[Lens] Fix pt it'n 13; xi0=[25.4243, -45.0314]; Delta eta = 19.9056, -45.1941
[Lens] Good approximation: xi0=[25.4243, -45.0314]; xi1=[25.4106, -45.0391]
[setNu] etaOffset set to zero.
[SimulatorModel::update] Done updateApparentAbs()
[SimulatorModel::update] thread section
[SimulatorModel::updateInner()] R=11.0144; CHI=0.5
[calculateAlphaBeta] [[25.4106, -45.0391]] ... 
[PsiFunctionLens.calculateAlphaBeta()] 5; 46 - [25.4106, -45.0391]
[SimulatorModel::parallelDistort] 6 threads (maskMode=0)
[SimulatorModel] No mask 
[SimulatorModel::parallelDistort] lower=0; rng=512; rng1=86
[SimulatorModel::distort] begin=0; end=86
[SimulatorModel::distort] begin=[SimulatorModel::distort] begin=172; end=258
86; end=172
[SimulatorModel::distort] begin=258; end=344
[SimulatorModel::distort] begin=344; end=430
[getDistortedPos] nu=[-2.13592, 2.45843] theta=2.50667 r=1.75201
[SimulatorModel::distort] begin=430; end=512
Lens (Superclass)0.5[1.75201, 2.50667]->[-2.13592, 2.45843]
[getDistortedPos] nu=[-1.55329, 2.22841] theta=2.29035 r=1.38165
Lens (Superclass)0.5[1.38165, 2.29035]->[-1.55329, 2.22841]
[getDistortedPos] nu=[-0.965334, 1.99664] theta=1.94708 r=1.11731
Lens (Superclass)0.5[1.11731, 1.94708]->[-0.965334, 1.99664]
[getDistortedPos] nu=[-0.372072, 1.76323] theta=1.48495 r=1.04298
Lens (Superclass)0.5[1.04298, 1.48495]->[-0.372072, 1.76323]
[getDistortedPos] nu=[0.226464, 1.52829] theta=1.05483 r=1.19466
Lens (Superclass)0.5[1.19466, 1.05483]->[0.226464, 1.52829]
[getDistortedPos] nu=[0.830242, 1.29191] theta=0.761778 r=1.50554
Lens (Superclass)0.5[1.50554, 0.761778]->[0.830242, 1.29191]
[getDistortedPos] nu=[1.43923, 1.0542] theta=0.579029 r=1.89896
Lens (Superclass)0.5[1.89896, 0.579029]->[1.43923, 1.0542]
[getDistortedPos] nu=[-2.48779, 1.80631] theta=2.86656 r=1.98519
Lens (Superclass)0.5[1.98519, 2.86656]->[-2.48779, 1.80631]
[getDistortedPos] nu=[-1.9086, 1.58173] theta=2.77652 r=1.5101
Lens (Superclass)0.5[1.5101, 2.77652]->[-1.9086, 1.58173]
[getDistortedPos] nu=[-1.32417, 1.35527] theta=2.60702 r=1.05822
Lens (Superclass)0.5[1.05822, 2.60702]->[-1.32417, 1.35527]
[getDistortedPos] nu=[-0.734505, 1.12706] theta=2.22165 r=0.677674
Lens (Superclass)0.5[0.677674, 2.22165]->[-0.734505, 1.12706]
[getDistortedPos] nu=[-0.139644, 0.897178] theta=1.40643 r=0.546502
Lens (Superclass)0.5[0.546502, 1.40643]->[-0.139644, 0.897178]
[getDistortedPos] nu=[0.460389, 0.665741] theta=0.74087 r=0.798803
Lens (Superclass)0.5[0.798803, 0.74087]->[0.460389, 0.665741]
[getDistortedPos] nu=[1.06556, 0.432844] theta=0.459545 r=1.21553
Lens (Superclass)0.5[1.21553, 0.459545]->[1.06556, 0.432844]
[getDistortedPos] nu=[1.67585, 0.198584] theta=0.327023 r=1.67837
Lens (Superclass)0.5[1.67837, 0.327023]->[1.67585, 0.198584]
[getDistortedPos] nu=[-2.26594, 0.922815] theta=3.12111 r=1.91098
Lens (Superclass)0.5[1.91098, 3.12111]->[-2.26594, 0.922815]
[getDistortedPos] nu=[-1.68482, 0.701745] theta=3.11386 r=1.41112
Lens (Superclass)0.5[1.41112, 3.11386]->[-1.68482, 0.701745]
[getDistortedPos] nu=[-1.09856, 0.47879] theta=3.09864 r=0.911418
Lens (Superclass)0.5[0.911418, 3.09864]->[-1.09856, 0.47879]
[getDistortedPos] nu=[-0.507182, 0.254055] theta=3.04656 r=0.412439
Lens (Superclass)0.5[0.412439, 3.04656]->[-0.507182, 0.254055]
[getDistortedPos] nu=[0.0892981, 0.02764] theta=0.412539 r=0.0976112
Lens (Superclass)0.5[0.0976112, 0.412539]->[0.0892981, 0.02764]
[getDistortedPos] nu=[0.690852, -0.200355] theta=0.0662998 r=0.59072
Lens (Superclass)0.5[0.59072, 0.0662998]->[0.690852, -0.200355]
[getDistortedPos] nu=[1.29745, -0.429834] theta=0.0359081 r=1.09012
Lens (Superclass)0.5[1.09012, 0.0359081]->[1.29745, -0.429834]
[getDistortedPos] nu=[1.90907, -0.660701] theta=0.0246178 r=1.5899
Lens (Superclass)0.5[1.5899, 0.0246178]->[1.90907, -0.660701]
[getDistortedPos] nu=[-2.04758, 0.0362229] theta=-2.9049 r=1.96538
Lens (Superclass)0.5[1.96538, -2.9049]->[-2.04758, 0.0362229]
[getDistortedPos] nu=[-1.46452, -0.181405] theta=-2.82581 r=1.48396
Lens (Superclass)0.5[1.48396, -2.82581]->[-1.46452, -0.181405]
[getDistortedPos] nu=[-0.876419, -0.40093] theta=-2.67306 r=1.02056
Lens (Superclass)0.5[1.02056, -2.67306]->[-0.876419, -0.40093]
[getDistortedPos] nu=[-0.283299, -0.62225] theta=-2.29855 r=0.617228
Lens (Superclass)0.5[0.617228, -2.29855]->[-0.283299, -0.62225]
[getDistortedPos] nu=[0.31482, -0.845267] theta=-1.37915 r=0.469459
Lens (Superclass)0.5[0.469459, -1.37915]->[0.31482, -0.845267]
[getDistortedPos] nu=[0.917916, -1.06988] theta=-0.663601 r=0.748207
Lens (Superclass)0.5[0.748207, -0.663601]->[0.917916, -1.06988]
[getDistortedPos] nu=[1.52596, -1.29601] theta=-0.400205 r=1.18289
Lens (Superclass)0.5[1.18289, -0.400205]->[1.52596, -1.29601]
[getDistortedPos] nu=[2.13893, -1.52354] theta=-0.282218 r=1.65489
Lens (Superclass)0.5[1.65489, -0.282218]->[2.13893, -1.52354]
[getDistortedPos] nu=[-1.24762, -1.06762] theta=-2.54361 r=1.70675
Lens (Superclass)0.5[1.70675, -2.54361]->[-1.24762, -1.06762]
[getDistortedPos] nu=[-0.657664, -1.28378] theta=-2.32933 r=1.32379
Lens (Superclass)0.5[1.32379, -2.32933]->[-0.657664, -1.28378]
[getDistortedPos] nu=[-0.0627903, -1.50175] theta=-1.97461 r=1.04491
Lens (Superclass)0.5[1.04491, -1.97461]->[-0.0627903, -1.50175]
[getDistortedPos] nu=[0.536986, -1.72143] theta=-1.478 r=0.965016
Lens (Superclass)0.5[0.965016, -1.478]->[0.536986, -1.72143]
[getDistortedPos] nu=[1.14164, -1.94274] theta=-1.02056 r=1.12724
Lens (Superclass)0.5[1.12724, -1.02056]->[1.14164, -1.94274]
[getDistortedPos] nu=[1.75116, -2.16556] theta=-0.722778 r=1.45262
Lens (Superclass)0.5[1.45262, -0.722778]->[1.75116, -2.16556]
[getDistortedPos] nu=[2.36551, -2.38982] theta=-0.543749 r=1.85729
Lens (Superclass)0.5[1.85729, -0.543749]->[2.36551, -2.38982]
[getDistortedPos] nu=[-0.442231, -2.16966] theta=-2.12818 r=1.72142
Lens (Superclass)0.5[1.72142, -2.12818]->[-0.442231, -2.16966]
[getDistortedPos] nu=[0.154409, -2.38434] theta=-1.84478 r=1.51746
Lens (Superclass)0.5[1.51746, -1.84478]->[0.154409, -2.38434]
[getDistortedPos] nu=[0.755857, -2.60076] theta=-1.50966 r=1.4636
Lens (Superclass)0.5[1.4636, -1.50966]->[0.755857, -2.60076]
[getDistortedPos] nu=[1.36209, -2.8188] theta=-1.1873 r=1.57529
Lens (Superclass)0.5[1.57529, -1.1873]->[1.36209, -2.8188]
[getDistortedPos] nu=[1.9731, -3.03839] theta=-0.930028 r=1.82235
Lens (Superclass)0.5[1.82235, -0.930028]->[1.9731, -3.03839]
[getDistortedPos] nu=[0.971497, -3.48313] theta=-1.52522 r=1.9629
Lens (Superclass)0.5[1.9629, -1.52522]->[0.971497, -3.48313]
[getDistortedPos] nu=[-1.78602, 3.09808] theta=2.10503 r=1.78832
Lens (Superclass)0.5[1.78832, 2.10503]->[-1.78602, 3.09808]
[getDistortedPos] nu=[-1.19974, 2.86269] theta=1.83148 r=1.59296
Lens (Superclass)0.5[1.59296, 1.83148]->[-1.19974, 2.86269]
[getDistortedPos] nu=[-0.60805, 2.62569] theta=1.51276 r=1.54173
Lens (Superclass)0.5[1.54173, 1.51276]->[-0.60805, 2.62569]
[getDistortedPos] nu=[-0.0109865, 2.38717] theta=1.20507 r=1.64814
Lens (Superclass)0.5[1.64814, 1.20507]->[-0.0109865, 2.38717]
[getDistortedPos] nu=[0.59142, 2.14725] theta=0.954845 r=1.88568
Lens (Superclass)0.5[1.88568, 0.954845]->[0.59142, 2.14725]
Time to update(): 47 milliseconds
(np.float64(-0.5), np.float64(511.5), np.float64(511.5), np.float64(-0.5))
<Figure size 640x480 with 1 Axes>

This looks a great deal better. The small triangles are obviously the spurious images forming around the convergence ring. To see better, we can add an axis cross, which also tells us exactly where the lens is, at the origin.

csimg.drawAxes( imr )
plt.imshow( imr, cmap="grey" )
<Figure size 640x480 with 1 Axes>

To see it all, we can plot all the four simulations.

param["source"]["mode"] = "Triangle"
(im1,im2,im3,im4) = quadSim( param )
[SimImage] setParameters()
setModelMode(Roulette)
[initSim] type(row)=<class 'CosmoSim.CLI.Arguments.Parameters'>
CosmoSim.makeSource() returns (verbose=0
setFile /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
Instantiating RouletteModel ... 
[initLens] returning 
[PsiFunctionLens.initAlphasBetas] Amplitudes file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initAlphasBetas] opened file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[CosmoSim.initLens] ready to sample lens
[SampledPsiFunctionLens] updatePsi() returns
[CosmoSim.initLens] lens sampled
[SimulatorModel::setMaskMode] 0
[SimulatorModel::setSource] setting source
[SimulatorModel::update] Lens: Lens (Superclass)
[SimulatorModel::update] CHI=0.5
[SimulatorModel::getSource()]
[Lens::getXi] [5.505, 0.155]
[Lens] Fix pt it'n 0; xi0=[5.505, 0.155]; Delta eta = 36.2352, -10.4745
[Lens] Fix pt it'n 1; xi0=[41.7402, -10.3195]; Delta eta = 35.2898, -23.1337
[Lens] Fix pt it'n 2; xi0=[40.7948, -22.9787]; Delta eta = 31.3282, -33.4673
[Lens] Fix pt it'n 3; xi0=[36.8332, -33.3123]; Delta eta = 27.2145, -39.2647
[Lens] Fix pt it'n 4; xi0=[32.7195, -39.1097]; Delta eta = 24.2314, -42.1756
[Lens] Fix pt it'n 5; xi0=[29.7364, -42.0206]; Delta eta = 22.3891, -43.6097
[Lens] Fix pt it'n 6; xi0=[27.8941, -43.4547]; Delta eta = 21.3955, -44.2877
[Lens] Fix pt it'n 7; xi0=[26.9005, -44.1327]; Delta eta = 20.7681, -44.6843
[Lens] Fix pt it'n 8; xi0=[26.2731, -44.5293]; Delta eta = 20.1423, -45.057
[Lens] Fix pt it'n 9; xi0=[25.6473, -44.902]; Delta eta = 20.1423, -45.057
[Lens] Good approximation: xi0=[25.6473, -44.902]; xi1=[25.6473, -44.902]
[setNu] etaOffset set to zero.
[SimulatorModel::update] Done updateApparentAbs()
[SimulatorModel::update] thread section
[SimulatorModel::updateInner()] R=11.0144; CHI=0.5
[calculateAlphaBeta] [[25.6473, -44.902]] ... 
[SimulatorModel::parallelDistort] 6 threads (maskMode=0)
[SimulatorModel] No mask 
[SimulatorModel::parallelDistort] lower=0; rng=512; rng1=86
[SimulatorModel::distort] begin=0; end=86
[SimulatorModel::distort] begin=86; end=172
[SimulatorModel::distort] begin=172; end=258
[SimulatorModel::distort] begin=258; end=344
[SimulatorModel::distort] begin=344; end=430
[getDistortedPos] nu=[-2.37121, 2.32532] theta=2.64061 r=1.87812
Lens (Superclass)0.5[1.87812, 2.64061]->[-2.37121, 2.32532]
[getDistortedPos] nu=[-1.78448, 2.09482] theta=2.47532 r=1.45946
Lens (Superclass)0.5[1.45946, 2.47532]->[-1.78448, 2.09482]
[getDistortedPos] nu=[-1.19245, 1.86265] theta=2.19325 r=1.11027
Lens (Superclass)0.5[1.11027, 2.19325]->[-1.19245, 1.86265]
[getDistortedPos] nu=[-0.595165, 1.6289] theta=1.73269 r=0.913989
Lens (Superclass)0.5[0.913989, 1.73269]->[-0.595165, 1.6289]
[getDistortedPos] nu=[0.007357, 1.39368] theta=1.19809 r=0.968531
Lens (Superclass)0.5[0.968531, 1.19809]->[0.007357, 1.39368]
[getDistortedPos] nu=[0.61508, 1.1571] theta=0.813522 r=1.24126
Lens (Superclass)0.5[1.24126, 0.813522]->[0.61508, 1.1571]
[getDistortedPos] nu=[1.22797, 0.919239] theta=0.588133 r=1.62585
Lens (Superclass)0.5[1.62585, 0.588133]->[1.22797, 0.919239]
[getDistortedPos] nu=[-2.14336, 1.4506] theta=2.90222 r=1.69567
Lens (Superclass)0.5[1.69567, 2.90222]->[-2.14336, 1.4506]
[getDistortedPos] nu=[-1.55489, 1.22363] theta=2.80455 r=1.21573
Lens (Superclass)0.5[1.21573, 2.80455]->[-1.55489, 1.22363]
[getDistortedPos] nu=[-0.961235, 0.994978] theta=2.58582 r=0.762013
Lens (Superclass)0.5[0.762013, 2.58582]->[-0.961235, 0.994978]
[getDistortedPos] nu=[-0.362416, 0.764729] theta=1.92205 r=0.428181
Lens (Superclass)0.5[0.428181, 1.92205]->[-0.362416, 0.764729]
[getDistortedPos] nu=[0.241539, 0.532987] theta=0.850711 r=0.534803
Lens (Superclass)0.5[0.534803, 0.850711]->[0.241539, 0.532987]
[getDistortedPos] nu=[0.850597, 0.299847] theta=0.44059 r=0.942703
Lens (Superclass)0.5[0.942703, 0.44059]->[0.850597, 0.299847]
[getDistortedPos] nu=[1.46473, 0.0654064] theta=0.288901 r=1.41116
Lens (Superclass)0.5[1.41116, 0.288901]->[1.46473, 0.0654064]
[getDistortedPos] nu=[2.0839, -0.170243] theta=0.213691 r=1.8958
Lens (Superclass)0.5[1.8958, 0.213691]->[2.0839, -0.170243]
[getDistortedPos] nu=[-1.91902, 0.572561] theta=-3.0822 r=1.65023
Lens (Superclass)0.5[1.65023, -3.0822]->[-1.91902, 0.572561]
[getDistortedPos] nu=[-1.3288, 0.34907] theta=-3.05642 r=1.1515
Lens (Superclass)0.5[1.1515, -3.05642]->[-1.3288, 0.34907]
[getDistortedPos] nu=[-0.733493, 0.123867] theta=-2.9914 r=0.654695
Lens (Superclass)0.5[0.654695, -2.9914]->[-0.733493, 0.123867]
[getDistortedPos] nu=[-0.133119, -0.10295] theta=-2.55479 r=0.176921
Lens (Superclass)0.5[0.176921, -2.55479]->[-0.133119, -0.10295]
[getDistortedPos] nu=[0.472292, -0.331283] theta=-0.270939 r=0.366028
Lens (Superclass)0.5[0.366028, -0.270939]->[0.472292, -0.331283]
[getDistortedPos] nu=[1.08271, -0.561036] theta=-0.114387 r=0.858284
Lens (Superclass)0.5[0.858284, -0.114387]->[1.08271, -0.561036]
[getDistortedPos] nu=[1.69811, -0.792118] theta=-0.072295 r=1.35622
Lens (Superclass)0.5[1.35622, -0.072295]->[1.69811, -0.792118]
[getDistortedPos] nu=[2.31846, -1.02444] theta=-0.052827 r=1.85526
Lens (Superclass)0.5[1.85526, -0.052827]->[2.31846, -1.02444]
[getDistortedPos] nu=[-1.69813, -0.308672] theta=-2.79339 r=1.75249
Lens (Superclass)0.5[1.75249, -2.79339]->[-1.69813, -0.308672]
[getDistortedPos] nu=[-1.10614, -0.52876] theta=-2.66115 r=1.2938
Lens (Superclass)0.5[1.2938, -2.66115]->[-1.10614, -0.52876]
[getDistortedPos] nu=[-0.509161, -0.750576] theta=-2.39581 r=0.881242
Lens (Superclass)0.5[0.881242, -2.39581]->[-0.509161, -0.750576]
[getDistortedPos] nu=[0.0927868, -0.974024] theta=-1.81236 r=0.615844
Lens (Superclass)0.5[0.615844, -1.81236]->[0.0927868, -0.974024]
[getDistortedPos] nu=[0.699677, -1.19901] theta=-1.03791 r=0.694218
Lens (Superclass)0.5[0.694218, -1.03791]->[0.699677, -1.19901]
[getDistortedPos] nu=[1.31148, -1.42544] theta=-0.611583 r=1.04145
Lens (Superclass)0.5[1.04145, -0.611583]->[1.31148, -1.42544]
[getDistortedPos] nu=[1.92818, -1.65322] theta=-0.416231 r=1.47895
Lens (Superclass)0.5[1.47895, -0.416231]->[1.92818, -1.65322]
[getDistortedPos] nu=[2.54973, -1.88226] theta=-0.312201 r=1.94678
Lens (Superclass)0.5[1.94678, -0.312201]->[2.54973, -1.88226]
[getDistortedPos] nu=[-1.48062, -1.193] theta=-2.5537 r=1.9797
Lens (Superclass)0.5[1.9797, -2.5537]->[-1.48062, -1.193]
[getDistortedPos] nu=[-0.886844, -1.40975] theta=-2.37818 r=1.58804
Lens (Superclass)0.5[1.58804, -2.37818]->[-0.886844, -1.40975]
[getDistortedPos] nu=[-0.288175, -1.62824] theta=-2.10351 r=1.27458
Lens (Superclass)0.5[1.27458, -2.10351]->[-0.288175, -1.62824]
[getDistortedPos] nu=[0.315365, -1.84838] theta=-1.70418 r=1.1078
Lens (Superclass)0.5[1.1078, -1.70418]->[0.315365, -1.84838]
[getDistortedPos] nu=[0.923755, -2.07008] theta=-1.26 r=1.15321
Lens (Superclass)0.5[1.15321, -1.26]->[0.923755, -2.07008]
[getDistortedPos] nu=[1.53697, -2.29324] theta=-0.910489 r=1.39017
Lens (Superclass)0.5[1.39017, -0.910489]->[1.53697, -2.29324]
[getDistortedPos] nu=[2.15498, -2.51778] theta=-0.681833 r=1.7422
Lens (Superclass)0.5[1.7422, -0.681833]->[2.15498, -2.51778]
[getDistortedPos] nu=[-0.670845, -2.29379] theta=-2.1935 r=1.96719
Lens (Superclass)0.5[1.96719, -2.1935]->[-0.670845, -2.29379]
[getDistortedPos] nu=[-0.070473, -2.50903] theta=-1.95569 r=1.7241
Lens (Superclass)0.5[1.7241, -1.95569]->[-0.070473, -2.50903]
[getDistortedPos] nu=[0.534677, -2.72593] theta=-1.66273 r=1.60474
Lens (Superclass)0.5[1.60474, -1.66273]->[0.534677, -2.72593]
[getDistortedPos] nu=[1.14459, -2.9444] theta=-1.35358 r=1.63642
Lens (Superclass)0.5[1.63642, -1.35358]->[1.14459, -2.9444]
[getDistortedPos] nu=[1.75923, -3.16435] theta=-1.08063 r=1.81123
Lens (Superclass)0.5[1.81123, -1.08063]->[1.75923, -3.16435]
[SimulatorModel::distort] begin=430; end=512
[getDistortedPos] nu=[-1.07128, 3.34624] theta=1.6481 r=1.90773
Lens (Superclass)0.5[1.90773, 1.6481]->[-1.07128, 3.34624]
[getDistortedPos] nu=[-0.471543, 3.10388] theta=1.38746 r=1.93446
Lens (Superclass)0.5[1.93446, 1.38746]->[-0.471543, 3.10388]
[getDistortedPos] nu=[-2.01763, 2.96252] theta=2.25661 r=1.81165
Lens (Superclass)0.5[1.81165, 2.25661]->[-2.01763, 2.96252]
[getDistortedPos] nu=[-1.42721, 2.72675] theta=2.00334 r=1.54426
Lens (Superclass)0.5[1.54426, 2.00334]->[-1.42721, 2.72675]
[getDistortedPos] nu=[-0.831432, 2.48944] theta=1.67549 r=1.40976
Lens (Superclass)0.5[1.40976, 1.67549]->[-0.831432, 2.48944]
[getDistortedPos] nu=[-0.230316, 2.25069] theta=1.32436 r=1.44571
Lens (Superclass)0.5[1.44571, 1.32436]->[-0.230316, 2.25069]
[getDistortedPos] nu=[0.376101, 2.0106] theta=1.02439 r=1.64096
Lens (Superclass)0.5[1.64096, 1.02439]->[0.376101, 2.0106]
[getDistortedPos] nu=[0.98778, 1.76926] theta=0.803315 r=1.94819
Lens (Superclass)0.5[1.94819, 0.803315]->[0.98778, 1.76926]
Time to update(): 78 milliseconds
[SimImage] setParameters()
setModelMode(Roulette)
[initSim] type(row)=<class 'CosmoSim.CLI.Arguments.Parameters'>
CosmoSim.makeSource() returns (verbose=0
setFile /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
Instantiating RouletteModel ... 
[initLens] returning 
[PsiFunctionLens.initAlphasBetas] Amplitudes file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initAlphasBetas] opened file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[CosmoSim.initLens] no sampling
[SimulatorModel::setMaskMode] 0
[SimulatorModel::setSource] setting source
[SimulatorModel::update] Lens: Lens (Superclass)
[SimulatorModel::update] CHI=0.5
[SimulatorModel::getSource()]
[Lens::getXi] [5.505, 0.155]
[Lens] Fix pt it'n 0; xi0=[5.505, 0.155]; Delta eta = 36.6416, -9.08535
[Lens] Fix pt it'n 1; xi0=[42.1466, -8.93035]; Delta eta = 35.5485, -22.0062
[Lens] Fix pt it'n 2; xi0=[41.0535, -21.8512]; Delta eta = 31.7068, -32.7793
[Lens] Fix pt it'n 3; xi0=[37.2118, -32.6243]; Delta eta = 27.3886, -39.0702
[Lens] Fix pt it'n 4; xi0=[32.8936, -38.9152]; Delta eta = 24.2201, -42.1871
[Lens] Fix pt it'n 5; xi0=[29.7251, -42.0321]; Delta eta = 22.2814, -43.6881
[Lens] Fix pt it'n 6; xi0=[27.7864, -43.5331]; Delta eta = 21.1833, -44.4264
[Lens] Fix pt it'n 7; xi0=[26.6883, -44.2714]; Delta eta = 20.5823, -44.7992
[Lens] Fix pt it'n 8; xi0=[26.0873, -44.6442]; Delta eta = 20.2588, -44.9913
[Lens] Fix pt it'n 9; xi0=[25.7638, -44.8363]; Delta eta = 20.0859, -45.0914
[Lens] Fix pt it'n 10; xi0=[25.5909, -44.9364]; Delta eta = 19.994, -45.144
[Lens] Fix pt it'n 11; xi0=[25.499, -44.989]; Delta eta = 19.9452, -45.1717
[Lens] Fix pt it'n 12; xi0=[25.4502, -45.0167]; Delta eta = 19.9193, -45.1864
[Lens] Fix pt it'n 13; xi0=[25.4243, -45.0314]; Delta eta = 19.9056, -45.1941
[Lens] Good approximation: xi0=[25.4243, -45.0314]; xi1=[25.4106, -45.0391]
[setNu] etaOffset set to zero.
[SimulatorModel::update] Done updateApparentAbs()
[SimulatorModel::update] thread section
[SimulatorModel::updateInner()] R=11.0144; CHI=0.5
[calculateAlphaBeta] [[25.4106, -45.0391]] ... 
[PsiFunctionLens.calculateAlphaBeta()] 5; 46 - [25.4106, -45.0391]
[SimulatorModel::parallelDistort] 6 threads (maskMode=0)
[SimulatorModel] No mask 
[SimulatorModel::parallelDistort] lower=0; rng=512; rng1=86
[SimulatorModel::distort] begin=86; end=172
[SimulatorModel::distort] begin=0; end=86
[SimulatorModel::distort] begin=172; end=258
[SimulatorModel::distort] begin=258; end=344
[SimulatorModel::distort] begin=344; end=430
[getDistortedPos] nu=[-2.13592, 2.45843] theta=2.50667 r=1.75201
Lens (Superclass)0.5[1.75201, 2.50667]->[-2.13592, 2.45843]
[getDistortedPos] nu=[-1.55329, 2.22841] theta=2.29035 r=1.38165
Lens (Superclass)0.5[1.38165, 2.29035]->[-1.55329, 2.22841]
[getDistortedPos] nu=[-0.965334, 1.99664] theta=1.94708 r=1.11731
Lens (Superclass)0.5[1.11731, 1.94708]->[-0.965334, 1.99664]
[getDistortedPos] nu=[-0.372072, 1.76323] theta=1.48495 r=1.04298
Lens (Superclass)0.5[1.04298, 1.48495]->[-0.372072, 1.76323]
[getDistortedPos] nu=[0.226464, 1.52829] theta=1.05483 r=1.19466
Lens (Superclass)0.5[1.19466, 1.05483]->[0.226464, 1.52829]
[getDistortedPos] nu=[0.830242, 1.29191] theta=0.761778 r=1.50554
Lens (Superclass)0.5[1.50554, 0.761778]->[0.830242, 1.29191]
[getDistortedPos] nu=[1.43923, 1.0542] theta=0.579029 r=1.89896
Lens (Superclass)0.5[1.89896, 0.579029]->[1.43923, 1.0542]
[getDistortedPos] nu=[-2.48779, 1.80631] theta=2.86656 r=1.98519
Lens (Superclass)0.5[1.98519, 2.86656]->[-2.48779, 1.80631]
[getDistortedPos] nu=[-1.9086, 1.58173] theta=2.77652 r=1.5101
Lens (Superclass)0.5[1.5101, 2.77652]->[-1.9086, 1.58173]
[getDistortedPos] nu=[-1.32417, 1.35527] theta=2.60702 r=1.05822
Lens (Superclass)0.5[1.05822, 2.60702]->[-1.32417, 1.35527]
[getDistortedPos] nu=[-0.734505, 1.12706] theta=2.22165 r=0.677674
Lens (Superclass)0.5[0.677674, 2.22165]->[-0.734505, 1.12706]
[getDistortedPos] nu=[-0.139644, 0.897178] theta=1.40643 r=0.546502
Lens (Superclass)0.5[0.546502, 1.40643]->[-0.139644, 0.897178]
[getDistortedPos] nu=[0.460389, 0.665741] theta=0.74087 r=0.798803
Lens (Superclass)0.5[0.798803, 0.74087]->[0.460389, 0.665741]
[getDistortedPos] nu=[1.06556, 0.432844] theta=0.459545 r=1.21553
Lens (Superclass)0.5[1.21553, 0.459545]->[1.06556, 0.432844]
[getDistortedPos] nu=[1.67585, 0.198584] theta=0.327023 r=1.67837
Lens (Superclass)0.5[1.67837, 0.327023]->[1.67585, 0.198584]
[getDistortedPos] nu=[-2.26594, 0.922815] theta=3.12111 r=1.91098
Lens (Superclass)0.5[1.91098, 3.12111]->[-2.26594, 0.922815]
[getDistortedPos] nu=[-1.68482, 0.701745] theta=3.11386 r=1.41112
Lens (Superclass)0.5[1.41112, 3.11386]->[-1.68482, 0.701745]
[getDistortedPos] nu=[-1.09856, 0.47879] theta=3.09864 r=0.911418
Lens (Superclass)0.5[0.911418, 3.09864]->[-1.09856, 0.47879]
[getDistortedPos] nu=[-0.507182, 0.254055] theta=3.04656 r=0.412439
Lens (Superclass)0.5[0.412439, 3.04656]->[-0.507182, 0.254055]
[getDistortedPos] nu=[0.0892981, 0.02764] theta=0.412539 r=0.0976112
Lens (Superclass)0.5[0.0976112, 0.412539]->[0.0892981, 0.02764]
[getDistortedPos] nu=[0.690852, -0.200355] theta=0.0662998 r=0.59072
Lens (Superclass)0.5[0.59072, 0.0662998]->[0.690852, -0.200355]
[getDistortedPos] nu=[1.29745, -0.429834] theta=0.0359081 r=1.09012
Lens (Superclass)0.5[1.09012, 0.0359081]->[1.29745, -0.429834]
[getDistortedPos] nu=[1.90907, -0.660701] theta=0.0246178 r=1.5899
Lens (Superclass)0.5[1.5899, 0.0246178]->[1.90907, -0.660701]
[getDistortedPos] nu=[-2.04758, 0.0362229] theta=-2.9049 r=1.96538
Lens (Superclass)0.5[1.96538, -2.9049]->[-2.04758, 0.0362229]
[getDistortedPos] nu=[-1.46452, -0.181405] theta=-2.82581 r=1.48396
Lens (Superclass)0.5[1.48396, -2.82581]->[-1.46452, -0.181405]
[getDistortedPos] nu=[-0.876419, -0.40093] theta=-2.67306 r=1.02056
Lens (Superclass)0.5[1.02056, -2.67306]->[-0.876419, -0.40093]
[getDistortedPos] nu=[-0.283299, -0.62225] theta=-2.29855 r=0.617228
Lens (Superclass)0.5[0.617228, -2.29855]->[-0.283299, -0.62225]
[getDistortedPos] nu=[0.31482, -0.845267] theta=-1.37915 r=0.469459
Lens (Superclass)0.5[0.469459, -1.37915]->[0.31482, -0.845267]
[getDistortedPos] nu=[0.917916, -1.06988] theta=-0.663601 r=0.748207
Lens (Superclass)0.5[0.748207, -0.663601]->[0.917916, -1.06988]
[getDistortedPos] nu=[1.52596, -1.29601] theta=-0.400205 r=1.18289
Lens (Superclass)0.5[1.18289, -0.400205]->[1.52596, -1.29601]
[getDistortedPos] nu=[2.13893, -1.52354] theta=-0.282218 r=1.65489
Lens (Superclass)0.5[1.65489, -0.282218]->[2.13893, -1.52354]
[getDistortedPos] nu=[-1.24762, -1.06762] theta=-2.54361 r=1.70675
Lens (Superclass)0.5[1.70675, -2.54361]->[-1.24762, -1.06762]
[getDistortedPos] nu=[-0.657664, -1.28378] theta=-2.32933 r=1.32379
Lens (Superclass)0.5[1.32379, -2.32933]->[-0.657664, -1.28378]
[getDistortedPos] nu=[-0.0627903, -1.50175] theta=-1.97461 r=1.04491
Lens (Superclass)0.5[1.04491, -1.97461]->[-0.0627903, -1.50175]
[getDistortedPos] nu=[0.536986, -1.72143] theta=-1.478 r=0.965016
Lens (Superclass)0.5[0.965016, -1.478]->[0.536986, -1.72143]
[getDistortedPos] nu=[1.14164, -1.94274] theta=-1.02056 r=1.12724
Lens (Superclass)0.5[1.12724, -1.02056]->[1.14164, -1.94274]
[getDistortedPos] nu=[1.75116, -2.16556] theta=-0.722778 r=1.45262
Lens (Superclass)0.5[1.45262, -0.722778]->[1.75116, -2.16556]
[getDistortedPos] nu=[2.36551, -2.38982] theta=-0.543749 r=1.85729
Lens (Superclass)0.5[1.85729, -0.543749]->[2.36551, -2.38982]
[getDistortedPos] nu=[-0.442231, -2.16966] theta=-2.12818 r=1.72142
Lens (Superclass)0.5[1.72142, -2.12818]->[-0.442231, -2.16966]
[getDistortedPos] nu=[0.154409, -2.38434] theta=-1.84478 r=1.51746
Lens (Superclass)0.5[1.51746, -1.84478]->[0.154409, -2.38434]
[getDistortedPos] nu=[0.755857, -2.60076] theta=-1.50966 r=1.4636
Lens (Superclass)0.5[1.4636, -1.50966]->[0.755857, -2.60076]
[getDistortedPos] nu=[1.36209, -2.8188] theta=-1.1873 r=1.57529
Lens (Superclass)0.5[1.57529, -1.1873]->[1.36209, -2.8188]
[getDistortedPos] nu=[1.9731, -3.03839] theta=-0.930028 r=1.82235
Lens (Superclass)0.5[1.82235, -0.930028]->[1.9731, -3.03839]
[getDistortedPos] nu=[0.971497, -3.48313] theta=-1.52522 r=1.9629
Lens (Superclass)0.5[1.9629, -1.52522]->[0.971497, -3.48313]
[SimulatorModel::distort] begin=430; end=512
[getDistortedPos] nu=[-1.78602, 3.09808] theta=2.10503 r=1.78832
Lens (Superclass)0.5[1.78832, 2.10503]->[-1.78602, 3.09808]
[getDistortedPos] nu=[-1.19974, 2.86269] theta=1.83148 r=1.59296
Lens (Superclass)0.5[1.59296, 1.83148]->[-1.19974, 2.86269]
[getDistortedPos] nu=[-0.60805, 2.62569] theta=1.51276 r=1.54173
Lens (Superclass)0.5[1.54173, 1.51276]->[-0.60805, 2.62569]
[getDistortedPos] nu=[-0.0109865, 2.38717] theta=1.20507 r=1.64814
Lens (Superclass)0.5[1.64814, 1.20507]->[-0.0109865, 2.38717]
[getDistortedPos] nu=[0.59142, 2.14725] theta=0.954845 r=1.88568
Lens (Superclass)0.5[1.88568, 0.954845]->[0.59142, 2.14725]
Time to update(): 59 milliseconds
[SimImage] setParameters()
setModelMode(Raytrace)
[initSim] type(row)=<class 'CosmoSim.CLI.Arguments.Parameters'>
CosmoSim.makeSource() returns (verbose=0
setFile /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initLens] returning 
[PsiFunctionLens.initAlphasBetas] Amplitudes file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initAlphasBetas] opened file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[CosmoSim.initLens] ready to sample lens
[SampledPsiFunctionLens] updatePsi() returns
[CosmoSim.initLens] lens sampled
[SimulatorModel::setMaskMode] 0
[SimulatorModel::setSource] setting source
[SimulatorModel::update] Lens: Lens (Superclass)
[SimulatorModel::update] CHI=0.5
[SimulatorModel::getSource()]
[Lens::getXi] [5.505, 0.155]
[Lens] Fix pt it'n 0; xi0=[5.505, 0.155]; Delta eta = 36.2352, -10.4745
[Lens] Fix pt it'n 1; xi0=[41.7402, -10.3195]; Delta eta = 35.2898, -23.1337
[Lens] Fix pt it'n 2; xi0=[40.7948, -22.9787]; Delta eta = 31.3282, -33.4673
[Lens] Fix pt it'n 3; xi0=[36.8332, -33.3123]; Delta eta = 27.2145, -39.2647
[Lens] Fix pt it'n 4; xi0=[32.7195, -39.1097]; Delta eta = 24.2314, -42.1756
[Lens] Fix pt it'n 5; xi0=[29.7364, -42.0206]; Delta eta = 22.3891, -43.6097
[Lens] Fix pt it'n 6; xi0=[27.8941, -43.4547]; Delta eta = 21.3955, -44.2877
[Lens] Fix pt it'n 7; xi0=[26.9005, -44.1327]; Delta eta = 20.7681, -44.6843
[Lens] Fix pt it'n 8; xi0=[26.2731, -44.5293]; Delta eta = 20.1423, -45.057
[Lens] Fix pt it'n 9; xi0=[25.6473, -44.902]; Delta eta = 20.1423, -45.057
[Lens] Good approximation: xi0=[25.6473, -44.902]; xi1=[25.6473, -44.902]
[setNu] etaOffset set to zero.
[SimulatorModel::update] Done updateApparentAbs()
[SimulatorModel::update] thread section
[SimulatorModel::updateInner()] R=11.0144; CHI=0.5
[calculateAlphaBeta] [[25.6473, -44.902]] ... 
Time to update(): 66 milliseconds
[SimImage] setParameters()
setModelMode(Raytrace)
[initSim] type(row)=<class 'CosmoSim.CLI.Arguments.Parameters'>
CosmoSim.makeSource() returns (verbose=0
setFile /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initLens] returning 
[PsiFunctionLens.initAlphasBetas] Amplitudes file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[initAlphasBetas] opened file /home/georg/git/cosmoai/CosmoSim/src/CosmoSim/sie05.txt
[CosmoSim.initLens] no sampling
[SimulatorModel::setMaskMode] 0
[SimulatorModel::setSource] setting source
[SimulatorModel::update] Lens: Lens (Superclass)
[SimulatorModel::update] CHI=0.5
[SimulatorModel::getSource()]
[Lens::getXi] [5.505, 0.155]
[Lens] Fix pt it'n 0; xi0=[5.505, 0.155]; Delta eta = 36.6416, -9.08535
[Lens] Fix pt it'n 1; xi0=[42.1466, -8.93035]; Delta eta = 35.5485, -22.0062
[Lens] Fix pt it'n 2; xi0=[41.0535, -21.8512]; Delta eta = 31.7068, -32.7793
[Lens] Fix pt it'n 3; xi0=[37.2118, -32.6243]; Delta eta = 27.3886, -39.0702
[Lens] Fix pt it'n 4; xi0=[32.8936, -38.9152]; Delta eta = 24.2201, -42.1871
[Lens] Fix pt it'n 5; xi0=[29.7251, -42.0321]; Delta eta = 22.2814, -43.6881
[Lens] Fix pt it'n 6; xi0=[27.7864, -43.5331]; Delta eta = 21.1833, -44.4264
[Lens] Fix pt it'n 7; xi0=[26.6883, -44.2714]; Delta eta = 20.5823, -44.7992
[Lens] Fix pt it'n 8; xi0=[26.0873, -44.6442]; Delta eta = 20.2588, -44.9913
[Lens] Fix pt it'n 9; xi0=[25.7638, -44.8363]; Delta eta = 20.0859, -45.0914
[Lens] Fix pt it'n 10; xi0=[25.5909, -44.9364]; Delta eta = 19.994, -45.144
[Lens] Fix pt it'n 11; xi0=[25.499, -44.989]; Delta eta = 19.9452, -45.1717
[Lens] Fix pt it'n 12; xi0=[25.4502, -45.0167]; Delta eta = 19.9193, -45.1864
[Lens] Fix pt it'n 13; xi0=[25.4243, -45.0314]; Delta eta = 19.9056, -45.1941
[Lens] Good approximation: xi0=[25.4243, -45.0314]; xi1=[25.4106, -45.0391]
[setNu] etaOffset set to zero.
[SimulatorModel::update] Done updateApparentAbs()
[SimulatorModel::update] thread section
[SimulatorModel::updateInner()] R=11.0144; CHI=0.5
[calculateAlphaBeta] [[25.4106, -45.0391]] ... 
[PsiFunctionLens.calculateAlphaBeta()] 5; 46 - [25.4106, -45.0391]
Time to update(): 35 milliseconds
<Figure size 1000x1000 with 4 Axes>

The difference images are as follows (compared against sampled raytrace).

fig = plt.figure(figsize=(14,7))
fig.tight_layout(pad=0.0)
plt.subplots_adjust(hspace=0.1, wspace=0.1) 

fig.add_subplot(1, 3, 1)
plt.imshow( imageDiff( im1, im3 ), cmap='gray')
plt.title( "Raytrace Simulation" )
plt.axis("off")

fig.add_subplot(1, 3, 2)
plt.imshow( imageDiff( im2, im3 ), cmap='gray')
plt.title( "Roulette Simulation" )
plt.axis("off")
    
fig.add_subplot(1, 3, 3)
plt.imshow( imageDiff( im4, im3 ), cmap='gray')
plt.title( "Sampled Roulette Simulation" )
plt.axis("off")
(np.float64(-0.5), np.float64(511.5), np.float64(511.5), np.float64(-0.5))
<Figure size 1400x700 with 3 Axes>

This gives a much better match. The sampled roulette has a little noise compared to the unsampled versions, but this may just be due to sampling and numerical error.