예제 #1
0
print("intensity of `Grid` pixel 0:")
print(galaxy_image.in_2d[0, 0])
print("intensity of `Grid` pixel 1:")
print(galaxy_image.in_2d[0, 1])
print("intensity of `Grid` pixel 2:")
print(galaxy_image.in_2d[0, 2])
print("etc.")

# %%
"""
A galaxy `Plotter` allows us to the plot the image, just like the `Profile` mat_plot_2d did for a `LightProfile`'s.
"""

# %%
galaxy_plotter = aplt.GalaxyPlotter(galaxy=galaxy_with_light_profile, grid=grid)
galaxy_plotter.figures(image=True)

# %%
"""
We can pass galaxies as many profiles as we like. Lets create a `Galaxy` with three `LightProfile`'s.
"""

# %%
light_profile_1 = al.lp.SphericalSersic(
    centre=(0.0, 0.0), intensity=1.0, effective_radius=1.0, sersic_index=2.5
)

light_profile_2 = al.lp.SphericalSersic(
    centre=(1.0, 1.0), intensity=1.0, effective_radius=2.0, sersic_index=3.0
)
예제 #2
0
"""
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`.
"""

# %%
light_profile_plotter = aplt.LightProfilePlotter(
    light_profile=fit.tracer.source_plane.galaxies[0].bulge, grid=source_plane_grid
)
예제 #3
0
                                                      angle=45.0),
)

galaxy = al.Galaxy(redshift=0.5, bulge=bulge, disk=disk, mass=mass)
"""
__Grid__

We also need the 2D grid the `Galaxy`'s `Profile`'s are evaluated on.
"""
grid = al.Grid2D.uniform(shape_native=(100, 100), pixel_scales=0.05)
"""
__Figures__

We now pass the galaxy and grid to a `GalaxyPlotter` and call various `figure_*` methods to plot different attributes.
"""
galaxy_plotter = aplt.GalaxyPlotter(galaxy=galaxy, grid=grid)
galaxy_plotter.figures_2d(
    image=True,
    convergence=True,
    potential=False,
    deflections_y=True,
    deflections_x=True,
    magnification=True,
)
galaxy_plotter.figures_1d(image=True, convergence=True, potential=True)
"""
We can plot decomposed 1D profiles, which display a property of the galaxy in addition to those of its individual light 
and mass profiles. 

For the 1D plot of each profile, the 1D grid of (x) coordinates is centred on the profile and aligned with the 
major-axis. This means that if the galaxy consists of multiple profiles with different centres or angles the 1D plots 
lens_satellite = al.Galaxy(
    redshift=0.5,
    bulge=al.lp.SphDevVaucouleurs(centre=(1.0, 0.0),
                                  intensity=2.0,
                                  effective_radius=0.2),
    mass=al.mp.SphIsothermal(centre=(1.0, 0.0), einstein_radius=0.4),
)

print(lens_satellite)
"""
Lets have a quick look at the appearance of our lens galaxy and its satellite.
"""
mat_plot_2d = aplt.MatPlot2D(title=aplt.Title(label="Lens Galaxy"))

galaxy_plotter = aplt.GalaxyPlotter(galaxy=lens_galaxy,
                                    grid=grid,
                                    mat_plot_2d=mat_plot_2d)
galaxy_plotter.figures_2d(image=True)

mat_plot_2d = aplt.MatPlot2D(title=aplt.Title(label="Lens Satellite"))

galaxy_plotter = aplt.GalaxyPlotter(galaxy=lens_satellite,
                                    grid=grid,
                                    mat_plot_2d=mat_plot_2d)
galaxy_plotter.figures_2d(image=True)
"""
And their deflection angles, noting that the satellite does not contribute as much to the deflections.
"""
mat_plot_2d = aplt.MatPlot2D(title=aplt.Title(
    label="Lens Galaxy Deflections (y)"))