コード例 #1
0
print(fit.tracer.source_plane.galaxies[0].disk)
print()

# %%
"""
Using the mat_plot_2d we've used throughout this chapter, we can visualize any aspect of a fit we're interested in. 
For example, if we want to plot the image of the source galaxy `MassProfile`, we can do this in a variety of 
different ways
"""

# %%
tracer_plotter = aplt.TracerPlotter(tracer=fit.tracer, grid=masked_imaging.grid)
tracer_plotter.figures(image=True)

source_plane_grid = tracer.traced_grids_of_planes_from_grid(grid=masked_imaging.grid)[1]
plane_plotter = aplt.PlanePlotter(plane=tracer.source_plane, grid=source_plane_grid)
plane_plotter.figures(image=True)

galaxy_plotter = aplt.GalaxyPlotter(
    galaxy=fit.tracer.source_plane.galaxies[0], grid=source_plane_grid
)
galaxy_plotter.figures(image=True)

# %%
"""
As our fit and ray-tracing becomes more complex, it is useful to know how to decompose their different attributes to 
extract different things about them. For example, we made our source-galaxy above with two `LightProfile`'s, a 
`bulge` and `disk. We can plot the image of each component individually, if we know how to break-up the different 
components of the fit and `Tracer`.
"""
コード例 #2
0
"""
Just like profiles and galaxies, a `Plane` has `_from_grid` method which we can use to compute its quantities.
"""
deflections = image_plane.deflections_yx_2d_from(grid=image_plane_grid)

print("deflection-angles of `Plane`'s `Grid2D` pixel 0:")
print(deflections.native[0, 0, 0])
print(deflections.native[0, 0, 0])

print("deflection-angles of `Plane`'s `Grid2D` pixel 1:")
print(deflections.native[0, 1, 1])
print(deflections.native[0, 1, 1])
"""
There is also a `PlanePlotter` which, you guessed it, behaves like the profile and galaxy plotters.
"""
plane_plotter = aplt.PlanePlotter(plane=image_plane, grid=image_plane_grid)
plane_plotter.figures_2d(deflections_y=True, deflections_x=True)
"""
__Ray Tracing__

Throughout this chapter we have plotted deflection angles frequently. However, we have not yet used the deflection 
angles to actually deflect anything! 

The deflection angles tell us how light is 'deflected' or 'lensed' by the lens galaxy. By taking the $(y,x)$ grid of 
image-plane coordinates and the $(y,x)$ grid of deflection angles, we can subtract the two to determine the 
source-plane`s coordinates, e.g.

 `source_plane_coordinates = image_plane_coordinates - image_plane_deflection_angles`

We perform this below using the `traced_grid_from` method of the `image_plane`:
"""
コード例 #3
0
    sersic_index=2.5,
)

source_galaxy = al.Galaxy(redshift=1.0, bulge=bulge)

image_plane = al.Plane(galaxies=[lens_galaxy])
source_plane = al.Plane(galaxies=[source_galaxy])
"""
__Figures__

We can plot the `image_plane` by passing it and our `grid to a` PlanePlotter` and calling various `figure_*` methods.

In this script our `lens_galaxy` only had a `MassProfile` so only methods like `figure_convergence` are
available.
"""
plane_plotter = aplt.PlanePlotter(plane=image_plane, grid=grid)
plane_plotter.figures_2d(convergence=True)
"""
We can also plot the `source_plane` by passing it with the `lensed_grid` to a `PlanePlotter`.

In this case, our `source_galaxy` only had a ` LightProfile` so only a plot of its image is available.
"""
plane_plotter = aplt.PlanePlotter(plane=source_plane, grid=lensed_grid)
plane_plotter.figures_2d(image=True)
"""
In addition to the lensed image of the source-plane, we can plot its unlensed image (e.g. how the source-galaxy 
appears in the source-plane before lensing) using the `figure_plane_image` method.
"""
plane_plotter.figures_2d(plane_image=True)
"""
__Visuals__