Example Jupyter notebooks
Example plots of time-delay surfaces: tdsurfaces.ipynb
Using a previously calculated deflection angle grid to create a
DeflectionGridLens
: deflectiongridlens.ipynbThe LensPerfect method, using
Wendland lenses
to obtain a mass distribution if deflection angles are known at various locations: wendland.ipynbIllustrations of using a grid function, as well as of the subdivision grid: gridtests.ipynb
Illustration of how to approximate a mass distribution by multiple Plummer basis functions: fittest.ipynb
Creating a circularly symmetric gravitational lens based on the specification of it’s profile: profilelens.ipynb
Illustration of the mass sheet degeneracy in its simplest guise: msdexample.ipynb
An example that shows explicitly how you can modify an existing lens model to influence only the time delay: timedelayadjust.ipynb
Example notebook that illustrates how you can create a degenerate lens that moves the source, by combining two mass disk degeneracies: massdisk_movesource_smooth.ipynb
An example with multiple lens planes; also shows the effect as the source redshift increases: multilensplane.ipynb
Multi-lensplane example from Compound lensing: Einstein Zig-Zags and high multiplicity lensed images
Situation in Figure 7: multisistests.ipynb
Situation in Figure 2: multisistests2.ipynb
Situation in Figure 6 (second row): multisistests3.ipynb
Illustration of loading LensTool models: lenstooltest.ipynb
An example of generating fake weak lensing measurements: generatefakewldata.ipynb
Recreates some plots of the article A generalization of the mass-sheet degeneracy producing ring-like artefacts in the lens mass distribution, describing a generalization of the mass sheet degeneracy that works with sources at different redshifts: scaledegen.ipynb
The previous example scales two sources at different redshifts with the same scale factor, in the article Lensing degeneracies and mass substructure it was shown how different scale factors can be used instead. Some results can be found here: scaledegen2012.ipynb
These notebooks show how the IrtyshI and IrtyshII lens models, used in Free-form grale lens inversion of galaxy clusters with up to 1000 multiple images and created using the gravlens/lensmodel software (see also Keeton 2001), can be convert to lens models for Grale: irtyshI.ipynb and irtyshII.ipynb
Importing deflection fields from various models of the Abell 370:
A modification of msdexample.ipynb above, to illustrate the generation of equivalent lens models by extrapolating the lens potential: msdexample-equivlenstests.ipynb
Using the code from the lens potential extrapolation to obtain lenses with different MSD-like effects for different sources: potentialextrap_multisheet.ipynb
These examples illustrate the
adjustShearMeasurements
function, which is useful when shear measurements need to be transformed from one frame (e.g. the frame of pixels of a camera) to one that’s rotated, perhaps even mirrored (e.g. a frame based on RA/DEC coordinates):
In case only a rotation is involved: sheartransform.ipynb
A modification of the previous notebook, in case there’s also a mirroring: sheartransform_mirror.ipynb
This example uses the A2744 data from Weak gravitational lensing measurements of Abell 2744 using JWST and shear measurement algorithm pyRRG-JWST to recreate (more or less) their Fig. 6 plot that estimates the mass density from the weak lensing measurements: a2744-wldatatest.ipynb
Quick’n’dirty hybrid inversion of A3827:
SIE profiles
combined with a uniform low-resolution grid ofPlummers
for a slightly better result.
This starts from the overlay.json file that was created in the screencast
Then estimates the SIEs positions, rotations and ellipticities from contours made in the GRALE editor (as shown in this screencast), finally storing the data in an
ImagesData
file: galaxies.imgdataThe notebook a3827hybrid.ipynb then illustrates how SIE basis functions can be estimated from this file and used in the inversion script a3827hybrid_invert.py