source_plane_grid = tracer.traced_grids_of_planes_from_grid(
    grid=masked_imaging.grid)[1]

# %%
"""
we'll use another rectangular `Pixelization` and `Mapper` to perform the reconstruction.
"""

# %%
rectangular = al.pix.Rectangular(shape=(25, 25))

mapper = rectangular.mapper_from_grid_and_sparse_grid(grid=source_plane_grid)

include_2d = aplt.Include2D(mask=True, mapper_source_full_grid=True)

mapper_plotter = aplt.MapperPlotter(mapper=mapper, include_2d=include_2d)
mapper_plotter.subplot_image_and_mapper(image=masked_imaging.image)

# %%
"""
And now, finally, we're going to use our `Mapper` to invert the image using an `Inversion`. I'll explain how this 
works in a second - but lets just go ahead and use the `Inversion` first. (Ignore the `regularization` input below for 
now, we'll cover this in the next tutorial).
"""

# %%
inversion = al.Inversion(
    masked_dataset=masked_imaging,
    mapper=mapper,
    regularization=al.reg.Constant(coefficient=1.0),
)
                                          include_2d=include_2d)
inversion_plotter.figures_2d_of_mapper(mapper_index=0, reconstruction=True)
"""
Woah, whats happened? There are lots of additional $(y,x)$ coordinates in the source-plane grid, some of which trace 
to extremely large radii far away from the central regions of the source-plane! These points are the traced image-pixels 
that correspond to the central image-pixels that the annular mask removed (e.g. they were at radii with 0.8" of the 
centre).

Lets quickly check this by plotting the indexes of these image-pixels.
"""
visuals_2d = aplt.Visuals2D(indexes=[986, 987, 988, 989, 990, 991])
include_2d = aplt.Include2D(mapper_source_grid_slim=True)

mapper_plotter = aplt.MapperPlotter(
    mapper=fit.inversion.linear_obj_list[0],
    visuals_2d=visuals_2d,
    include_2d=include_2d,
)

mapper_plotter.subplot_image_and_mapper(image=fit.imaging.image)
"""
So, why is this happening? What is the mass profile physically doing to create these source plane coordinates at 
extremely large radial values? 

Towards the centre of th elliptical isothermal mass profile, the density begins to rise very sharply, it becomes 
extremely steep or 'cuspy'. This cuspy behaviour towards its centre can cause extremely large deflection angles to be 
calculated:
"""
tracer_plotter = aplt.TracerPlotter(tracer=fit.tracer, grid=fit.grid)
tracer_plotter.figures_2d(deflections_y=True, deflections_x=True)
"""
Ejemplo n.º 3
0
    regularization=al.AbstractRegularization(),
)

tracer = al.Tracer.from_galaxies(galaxies=[lens_galaxy, source_galaxy])
"""
__Mapper__

We can extract the `Mapper` from the `Tracer` by passig it the `Grid2D`.
"""
mapper = tracer.linear_obj_list_from(grid=grid)[0]
"""
__Figures__

We now pass the mapper to a `MapperPlotter` and call various `figure_*` methods to plot different attributes.
"""
mapper_plotter = aplt.MapperPlotter(mapper=mapper)
mapper_plotter.figure_2d()
"""
__Subplots__

The `Mapper` can also be plotted with a subplot of its original image.
"""
mapper_plotter = aplt.MapperPlotter(mapper=mapper)
mapper_plotter.subplot_image_and_mapper(image=imaging.image)
"""
The Indexes of `Mapper` plots can be highlighted to show how certain image pixels map to the source plane.
"""
visuals_2d = aplt.Visuals2D(indexes=[0, 1, 2, 3, 4],
                            pix_indexes=[[10, 11], [12, 13, 14]])

mapper_plotter = aplt.MapperPlotter(mapper=mapper, visuals_2d=visuals_2d)
Ejemplo n.º 4
0
inversion_plotter = aplt.InversionPlotter(inversion=fit.inversion,
                                          include_2d=include_2d)
inversion_plotter.figures_2d(reconstruction=True)
"""
Woah, whats happened? There are lots of additional $(y,x)$ coordinates in the source-plane grid, some of which trace 
to extremely large radii far away from the central regions of the source-plane! These points are the traced image-pixels 
that correspond to the central image-pixels that the annular mask removed (e.g. they were at radii with 0.8" of the 
centre).

Lets quickly check this by plotting the indexes of these image-pixels.
"""
visuals_2d = aplt.Visuals2D(indexes=[986, 987, 988, 989, 990, 991])
include_2d = aplt.Include2D(mapper_source_grid_slim=True)

mapper_plotter = aplt.MapperPlotter(mapper=fit.inversion.mapper,
                                    visuals_2d=visuals_2d,
                                    include_2d=include_2d)

mapper_plotter.subplot_image_and_mapper(image=fit.imaging.image)
"""
So, why is this happening? What is the mass profile physically doing to create these source plane coordinates at 
extremely large radial values? 

Towards the centre of th elliptical isothermal mass profile, the density begins to rise very sharply, it becomes 
extremely steep or 'cuspy'. This cuspy behaviour towards its centre can cause extremely large deflection angles to be 
calculated:
"""
tracer_plotter = aplt.TracerPlotter(tracer=fit.tracer, grid=fit.grid)
tracer_plotter.figures_2d(deflections_y=True, deflections_x=True)
"""
Central image pixel can therefore be subjected to 'demagnification', whereby they trace to extremely large values in