示例#1
0
def plot_signal_to_noise_map(
        fit, mask=None, extract_array_from_mask=False, zoom_around_mask=False, positions=None, as_subplot=False,
        units='arcsec', kpc_per_arcsec=None, figsize=(7, 7), aspect='equal',
        cmap='jet', norm='linear', norm_min=None, norm_max=None, linthresh=0.05, linscale=0.01,
        cb_ticksize=10, cb_fraction=0.047, cb_pad=0.01,
        title='Fit Signal-to-Noise-Map', titlesize=16, xlabelsize=16, ylabelsize=16, xyticksize=16,
        mask_pointsize=10, position_pointsize=10,
        output_path=None, output_format='show', output_filename='fit_signal_to_noise_map'):
    """Plot the noise-map of a lens fit.

    Set *autolens.datas.array.plotters.array_plotters* for a description of all input parameters not described below.

    Parameters
    -----------
    image : datas.ccd.datas.CCD
    The datas-datas, which includes the observed datas, signal_to_noise_map-map, PSF, signal-to-signal_to_noise_map-map, etc.
    plot_origin : True
    If true, the origin of the datas's coordinate system is plotted as a 'x'.
    """
    array_plotters.plot_array(
        array=fit.signal_to_noise_map, mask=mask, extract_array_from_mask=extract_array_from_mask,
        zoom_around_mask=zoom_around_mask, positions=positions, as_subplot=as_subplot,
        units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,
        cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max,
        linthresh=linthresh, linscale=linscale,
        cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad,
        title=title, titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,
        mask_pointsize=mask_pointsize, position_pointsize=position_pointsize,
        output_path=output_path, output_format=output_format, output_filename=output_filename)
示例#2
0
def plot_model_data(
        fit, mask=None, extract_array_from_mask=False, zoom_around_mask=False, positions=None, as_subplot=False,
        units='arcsec', kpc_per_arcsec=None, figsize=(7, 7), aspect='equal',
        cmap='jet', norm='linear', norm_min=None, norm_max=None, linthresh=0.05, linscale=0.01,
        cb_ticksize=10, cb_fraction=0.047, cb_pad=0.01,
        title='Fit Model Image', titlesize=16, xlabelsize=16, ylabelsize=16, xyticksize=16,
        mask_pointsize=10, position_pointsize=10,
        output_path=None, output_format='show', output_filename='fit_model_image'):
    """Plot the model image of a fit.

    Set *autolens.datas.array.plotters.array_plotters* for a description of all input parameters not described below.

    Parameters
    -----------
    fit : datas.fitting.fitting.AbstractFitter
        The fit to the datas, which includes a list of every model image, residual_map, chi-squareds, etc.
    image_index : int
        The index of the datas in the datas-set of which the model image is plotted.
    """
    array_plotters.plot_array(
        array=fit.model_data, mask=mask, extract_array_from_mask=extract_array_from_mask,
        zoom_around_mask=zoom_around_mask, positions=positions, as_subplot=as_subplot,
        units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,
        cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,
        cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad,
        title=title, titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,
        mask_pointsize=mask_pointsize, position_pointsize=position_pointsize,
        output_path=output_path, output_format=output_format, output_filename=output_filename)
示例#3
0
def plot_image_plane_image(tracer,
                           mask=None,
                           extract_array_from_mask=False,
                           zoom_around_mask=False,
                           positions=None,
                           as_subplot=False,
                           units='arcsec',
                           figsize=(7, 7),
                           aspect='equal',
                           cmap='jet',
                           norm='linear',
                           norm_min=None,
                           norm_max=None,
                           linthresh=0.05,
                           linscale=0.01,
                           cb_ticksize=10,
                           cb_fraction=0.047,
                           cb_pad=0.01,
                           title='Tracer CCD-Plane CCD',
                           titlesize=16,
                           xlabelsize=16,
                           ylabelsize=16,
                           xyticksize=16,
                           mask_pointsize=10,
                           position_pointsize=10.0,
                           output_path=None,
                           output_format='show',
                           output_filename='tracer_image_plane_image'):

    array_plotters.plot_array(
        array=tracer.image_plane_image,
        mask=mask,
        extract_array_from_mask=extract_array_from_mask,
        zoom_around_mask=zoom_around_mask,
        positions=positions,
        as_subplot=as_subplot,
        units=units,
        kpc_per_arcsec=tracer.image_plane.kpc_per_arcsec_proper,
        figsize=figsize,
        aspect=aspect,
        cmap=cmap,
        norm=norm,
        norm_min=norm_min,
        norm_max=norm_max,
        linthresh=linthresh,
        linscale=linscale,
        cb_ticksize=cb_ticksize,
        cb_fraction=cb_fraction,
        cb_pad=cb_pad,
        title=title,
        titlesize=titlesize,
        xlabelsize=xlabelsize,
        ylabelsize=ylabelsize,
        xyticksize=xyticksize,
        mask_pointsize=mask_pointsize,
        position_pointsize=position_pointsize,
        output_path=output_path,
        output_format=output_format,
        output_filename=output_filename)
示例#4
0
def plot_reconstructed_image(inversion,
                             mask=None,
                             positions=None,
                             grid=None,
                             as_subplot=False,
                             units='arcsec',
                             kpc_per_arcsec=None,
                             figsize=(7, 7),
                             aspect='equal',
                             cmap='jet',
                             norm='linear',
                             norm_min=None,
                             norm_max=None,
                             linthresh=0.05,
                             linscale=0.01,
                             cb_ticksize=10,
                             cb_fraction=0.047,
                             cb_pad=0.01,
                             title='Reconstructed CCD',
                             titlesize=16,
                             xlabelsize=16,
                             ylabelsize=16,
                             xyticksize=16,
                             output_path=None,
                             output_format='show',
                             output_filename='reconstructed_inversion_image'):

    array_plotters.plot_array(array=inversion.reconstructed_data,
                              mask=mask,
                              positions=positions,
                              grid=grid,
                              as_subplot=as_subplot,
                              units=units,
                              kpc_per_arcsec=kpc_per_arcsec,
                              figsize=figsize,
                              aspect=aspect,
                              cmap=cmap,
                              norm=norm,
                              norm_min=norm_min,
                              norm_max=norm_max,
                              linthresh=linthresh,
                              linscale=linscale,
                              cb_ticksize=cb_ticksize,
                              cb_fraction=cb_fraction,
                              cb_pad=cb_pad,
                              title=title,
                              titlesize=titlesize,
                              xlabelsize=xlabelsize,
                              ylabelsize=ylabelsize,
                              xyticksize=xyticksize,
                              output_path=output_path,
                              output_format=output_format,
                              output_filename=output_filename)
示例#5
0
def plot_deflections_x(plane,
                       mask=None,
                       extract_array_from_mask=False,
                       zoom_around_mask=False,
                       as_subplot=False,
                       units='arcsec',
                       figsize=(7, 7),
                       aspect='equal',
                       cmap='jet',
                       norm='linear',
                       norm_min=None,
                       norm_max=None,
                       linthresh=0.05,
                       linscale=0.01,
                       cb_ticksize=10,
                       cb_fraction=0.047,
                       cb_pad=0.01,
                       title='Plane Deflections (x)',
                       titlesize=16,
                       xlabelsize=16,
                       ylabelsize=16,
                       xyticksize=16,
                       output_path=None,
                       output_format='show',
                       output_filename='plane_deflections_x'):

    array_plotters.plot_array(array=plane.deflections_x,
                              mask=mask,
                              extract_array_from_mask=extract_array_from_mask,
                              zoom_around_mask=zoom_around_mask,
                              as_subplot=as_subplot,
                              units=units,
                              kpc_per_arcsec=plane.kpc_per_arcsec_proper,
                              figsize=figsize,
                              aspect=aspect,
                              cmap=cmap,
                              norm=norm,
                              norm_min=norm_min,
                              norm_max=norm_max,
                              linthresh=linthresh,
                              linscale=linscale,
                              cb_ticksize=cb_ticksize,
                              cb_fraction=cb_fraction,
                              cb_pad=cb_pad,
                              title=title,
                              titlesize=titlesize,
                              xlabelsize=xlabelsize,
                              ylabelsize=ylabelsize,
                              xyticksize=xyticksize,
                              output_path=output_path,
                              output_format=output_format,
                              output_filename=output_filename)
示例#6
0
def plot_model_image_of_planes(
        fit, plot_foreground=False, plot_source=False, mask=None, extract_array_from_mask=False, zoom_around_mask=False,
        positions=None, as_subplot=False,
        units='arcsec', kpc_per_arcsec=None, figsize=(7, 7), aspect='equal',
        cmap='jet', norm='linear', norm_min=None, norm_max=None, linthresh=0.05, linscale=0.01,
        cb_ticksize=10, cb_fraction=0.047, cb_pad=0.01,
        title='Fit Model Image', titlesize=16, xlabelsize=16, ylabelsize=16, xyticksize=16,
        mask_pointsize=10, position_pointsize=10,
        output_path=None, output_format='show', output_filename='fit_model_image_of_plane'):
    """Plot the model image of a specific plane of a lens fit.

    Set *autolens.datas.array.plotters.array_plotters* for a description of all input parameters not described below.

    Parameters
    -----------
    fit : datas.fitting.fitting.AbstractFitter
        The fit to the datas, which includes a list of every model image, residual_map, chi-squareds, etc.
    plane_indexes : [int]
        The plane from which the model image is generated.
    """

    if plot_foreground:

        if fit.tracer.total_planes == 2:
            model_image = fit.model_image_of_planes[0]
        else:
            model_image = sum(fit.model_image_of_planes[0:-2])

    elif plot_source:

        model_image = fit.model_image_of_planes[-1]

    else:

        raise exc.PlottingException('Both plot_foreground and plot_source were False, one must be True')

    array_plotters.plot_array(
        array=model_image, mask=mask, extract_array_from_mask=extract_array_from_mask,
        zoom_around_mask=zoom_around_mask, positions=positions, as_subplot=as_subplot,
        units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,
        cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,
        cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad,
        title=title, titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,
        mask_pointsize=mask_pointsize, position_pointsize=position_pointsize,
        output_path=output_path, output_format=output_format, output_filename=output_filename)
示例#7
0
def plot_plane_image(plane,
                     plot_origin=True,
                     positions=None,
                     plot_grid=True,
                     as_subplot=False,
                     units='arcsec',
                     figsize=(7, 7),
                     aspect='equal',
                     cmap='jet',
                     norm='linear',
                     norm_min=None,
                     norm_max=None,
                     linthresh=0.05,
                     linscale=0.01,
                     cb_ticksize=10,
                     cb_fraction=0.047,
                     cb_pad=0.01,
                     title='Plane CCD',
                     titlesize=16,
                     xlabelsize=16,
                     ylabelsize=16,
                     xyticksize=16,
                     position_pointsize=10,
                     grid_pointsize=1,
                     output_path=None,
                     output_format='show',
                     output_filename='plane_image'):

    if plot_grid:
        grid = plane.grid_stack.regular
    else:
        grid = None

    if plot_origin:
        origin = plane.plane_image.origin
    else:
        origin = None

    array_plotters.plot_array(array=plane.plane_image,
                              origin=origin,
                              positions=positions,
                              grid=grid,
                              as_subplot=as_subplot,
                              units=units,
                              kpc_per_arcsec=plane.kpc_per_arcsec_proper,
                              figsize=figsize,
                              aspect=aspect,
                              cmap=cmap,
                              norm=norm,
                              norm_min=norm_min,
                              norm_max=norm_max,
                              linthresh=linthresh,
                              linscale=linscale,
                              cb_ticksize=cb_ticksize,
                              cb_fraction=cb_fraction,
                              cb_pad=cb_pad,
                              title=title,
                              titlesize=titlesize,
                              xlabelsize=xlabelsize,
                              ylabelsize=ylabelsize,
                              xyticksize=xyticksize,
                              position_pointsize=position_pointsize,
                              grid_pointsize=grid_pointsize,
                              output_path=output_path,
                              output_format=output_format,
                              output_filename=output_filename)
示例#8
0
# We have included the .fits data required for this example in the directory
# 'workspace/output/data/example/slacs1430+4105/'.

# First, lets setup the path to the .fits file of the image.
lens_name = 'slacs1430+4105'

path = '{}/../../..'.format(os.path.dirname(os.path.realpath(__file__)))
image_path = path + '/data/example/' + lens_name + '/image.fits'

# Now, lets load this image as a scaled array. A scaled array is an ordinary NumPy array, but it also includes a pixel
# scale which allows us to convert the axes of the image to arc-second coordinates.
image = scaled_array.ScaledSquarePixelArray.from_fits_with_pixel_scale(
    file_path=image_path, hdu=0, pixel_scale=0.03)

# We can now use an array plotter to plot the image. Lets first plot it using the default PyAutoLens settings.
array_plotters.plot_array(array=image, title='SLACS1430+4105 Image')

# For a lens like SLACS1430+4105, the lens galaxy's light outshines the background source, making it appear faint.
# we can use a symmetric logarithmic colorbar normalization to better reveal the source galaxy (due to negative values
# in the image, we cannot use a regular logirithmic colorbar normalization).
array_plotters.plot_array(array=image,
                          title='SLACS1430+4105 Image',
                          norm='symmetric_log',
                          linthresh=0.05,
                          linscale=0.02)

# Alternatively, we can use the default linear colorbar normalization and customize the limits over which the colormap
# spans its dynamic range.
array_plotters.plot_array(array=image,
                          title='SLACS1430+4105 Image',
                          norm='linear',
示例#9
0
# First, lets setup the path to the .fits file of the residual map.
lens_name = 'slacs1430+4105'
pipeline_name = 'pipeline_lens_light_and_x1_source_parametric'
phase_name = 'phase_3_both'

path = '{}/../../..'.format(os.path.dirname(os.path.realpath(__file__)))
residual_map_path = path+'/output/example/'+lens_name+'/'+pipeline_name+'/'+phase_name+'/image/fits/fit_residual_map.fits'

# Now, lets load this image as a scaled array. A scaled array is an ordinary NumPy array, but it also includes a pixel
# scale which allows us to convert the axes of the image to arc-second coordinates.
residual_map = scaled_array.ScaledSquarePixelArray.from_fits_with_pixel_scale(file_path=residual_map_path, hdu=0,
                                                                              pixel_scale=0.04)

# We can now use an array plotter to plot the residual map.
array_plotters.plot_array(array=residual_map, title='SLACS1430+4105 Residual Map')

# A useful way to really dig into the residuals is to set upper and lower limits on the normalization of the colorbar.
array_plotters.plot_array(array=residual_map, title='SLACS1430+4105 Residual Map',
                          norm_min=-0.02, norm_max=0.02)

# Or, alternatively, use a symmetric logarithmic colormap
array_plotters.plot_array(array=residual_map, title='SLACS1430+4105 Residual Map',
                          norm='symmetric_log', linthresh=0.01, linscale=0.02)

# These tools are equally powerful ways to inspect the chi-squared map of a fit.
chi_squared_map_path = \
    path+'/output/example/'+lens_name+'/'+pipeline_name+'/'+phase_name+'/image/fits/fit_chi_squared_map.fits'
chi_squared_map = scaled_array.ScaledSquarePixelArray.from_fits_with_pixel_scale(file_path=chi_squared_map_path, hdu=0,
                                                                                 pixel_scale=0.04)
array_plotters.plot_array(array=chi_squared_map, title='SLACS1430+4105 Chi-Squared Map')
示例#10
0
def plot_reconstructed_pixelization(
        inversion,
        plot_origin=True,
        positions=None,
        should_plot_centres=False,
        should_plot_grid=False,
        should_plot_border=False,
        image_pixels=None,
        source_pixels=None,
        as_subplot=False,
        units='arcsec',
        kpc_per_arcsec=None,
        figsize=(7, 7),
        aspect='equal',
        cmap='jet',
        norm='linear',
        norm_min=None,
        norm_max=None,
        linthresh=0.05,
        linscale=0.01,
        cb_ticksize=10,
        cb_fraction=0.047,
        cb_pad=0.01,
        title='Reconstructed Pixelization',
        titlesize=16,
        xlabelsize=16,
        ylabelsize=16,
        xyticksize=16,
        output_path=None,
        output_format='show',
        output_filename='reconstructed_inversion_image'):

    if output_format is 'fits':
        return

    plotter_util.setup_figure(figsize=figsize, as_subplot=as_subplot)

    if isinstance(inversion.mapper, mappers.RectangularMapper):

        reconstructed_pixelization = \
            inversion.mapper.reconstructed_pixelization_from_solution_vector(inversion.solution_vector)

        origin = get_origin(image=reconstructed_pixelization,
                            plot_origin=plot_origin)

        array_plotters.plot_array(array=reconstructed_pixelization,
                                  origin=origin,
                                  positions=positions,
                                  as_subplot=True,
                                  units=units,
                                  kpc_per_arcsec=kpc_per_arcsec,
                                  figsize=figsize,
                                  aspect=aspect,
                                  cmap=cmap,
                                  norm=norm,
                                  norm_min=norm_min,
                                  norm_max=norm_max,
                                  linthresh=linthresh,
                                  linscale=linscale,
                                  cb_ticksize=cb_ticksize,
                                  cb_fraction=cb_fraction,
                                  cb_pad=cb_pad,
                                  title=title,
                                  titlesize=titlesize,
                                  xlabelsize=xlabelsize,
                                  ylabelsize=ylabelsize,
                                  xyticksize=xyticksize,
                                  output_filename=output_filename)

        mapper_plotters.plot_rectangular_mapper(
            mapper=inversion.mapper,
            should_plot_centres=should_plot_centres,
            should_plot_grid=should_plot_grid,
            should_plot_border=should_plot_border,
            image_pixels=image_pixels,
            source_pixels=source_pixels,
            as_subplot=True,
            units=units,
            kpc_per_arcsec=kpc_per_arcsec,
            title=title,
            titlesize=titlesize,
            xlabelsize=xlabelsize,
            ylabelsize=ylabelsize,
            xyticksize=xyticksize)

        plotter_util.output_figure(array=reconstructed_pixelization,
                                   as_subplot=as_subplot,
                                   output_path=output_path,
                                   output_filename=output_filename,
                                   output_format=output_format)

    elif isinstance(inversion.mapper, mappers.VoronoiMapper):

        mapper_plotters.plot_voronoi_mapper(
            mapper=inversion.mapper,
            solution_vector=inversion.solution_vector,
            should_plot_centres=should_plot_centres,
            should_plot_grid=should_plot_grid,
            should_plot_border=should_plot_border,
            image_pixels=image_pixels,
            source_pixels=source_pixels,
            as_subplot=True,
            units=units,
            kpc_per_arcsec=kpc_per_arcsec,
            title=title,
            titlesize=titlesize,
            xlabelsize=xlabelsize,
            ylabelsize=ylabelsize,
            xyticksize=xyticksize)

        plotter_util.output_figure(array=None,
                                   as_subplot=as_subplot,
                                   output_path=output_path,
                                   output_filename=output_filename,
                                   output_format=output_format)

    plotter_util.close_figure(as_subplot=as_subplot)
示例#11
0
def plot_surface_density(mass_profile,
                         grid,
                         mask=None,
                         extract_array_from_mask=False,
                         zoom_around_mask=False,
                         positions=None,
                         as_subplot=False,
                         units='arcsec',
                         kpc_per_arcsec=None,
                         figsize=(7, 7),
                         aspect='equal',
                         cmap='jet',
                         norm='linear',
                         norm_min=None,
                         norm_max=None,
                         linthresh=0.05,
                         linscale=0.01,
                         cb_ticksize=10,
                         cb_fraction=0.047,
                         cb_pad=0.01,
                         title='Surface Density',
                         titlesize=16,
                         xlabelsize=16,
                         ylabelsize=16,
                         xyticksize=16,
                         mask_pointsize=10,
                         position_pointsize=10.0,
                         grid_pointsize=1,
                         output_path=None,
                         output_format='show',
                         output_filename='surface_density'):
    """Plot the surface density of a mass profile, on a regular grid of (y,x) coordinates.

    Set *autolens.hyper.array.plotters.array_plotters* for a description of all innput parameters not described below.

    Parameters
    -----------
    mass_profile : model.profiles.mass_profiles.MassProfile
        The mass profile whose surface density is plotted.
    grid : ndarray or hyper.array.grid_stacks.RegularGrid
        The (y,x) coordinates of the grid, in an array of shape (total_coordinates, 2)
    """
    surface_density = mass_profile.surface_density_from_grid(grid=grid)
    surface_density = grid.scaled_array_from_array_1d(surface_density)

    array_plotters.plot_array(array=surface_density,
                              mask=mask,
                              extract_array_from_mask=extract_array_from_mask,
                              zoom_around_mask=zoom_around_mask,
                              positions=positions,
                              as_subplot=as_subplot,
                              units=units,
                              kpc_per_arcsec=kpc_per_arcsec,
                              figsize=figsize,
                              aspect=aspect,
                              cmap=cmap,
                              norm=norm,
                              norm_min=norm_min,
                              norm_max=norm_max,
                              linthresh=linthresh,
                              linscale=linscale,
                              cb_ticksize=cb_ticksize,
                              cb_fraction=cb_fraction,
                              cb_pad=cb_pad,
                              title=title,
                              titlesize=titlesize,
                              xlabelsize=xlabelsize,
                              ylabelsize=ylabelsize,
                              xyticksize=xyticksize,
                              mask_pointsize=mask_pointsize,
                              position_pointsize=position_pointsize,
                              grid_pointsize=grid_pointsize,
                              output_path=output_path,
                              output_format=output_format,
                              output_filename=output_filename)
示例#12
0
def plot_intensities(galaxy,
                     grid,
                     mask=None,
                     extract_array_from_mask=False,
                     zoom_around_mask=False,
                     positions=None,
                     as_subplot=False,
                     units='arcsec',
                     kpc_per_arcsec=None,
                     figsize=(7, 7),
                     aspect='equal',
                     cmap='jet',
                     norm='linear',
                     norm_min=None,
                     norm_max=None,
                     linthresh=0.05,
                     linscale=0.01,
                     cb_ticksize=10,
                     cb_fraction=0.047,
                     cb_pad=0.01,
                     title='Galaxy Intensities',
                     titlesize=16,
                     xlabelsize=16,
                     ylabelsize=16,
                     xyticksize=16,
                     mask_pointsize=10,
                     position_pointsize=10.0,
                     grid_pointsize=1,
                     output_path=None,
                     output_format='show',
                     output_filename='galaxy_intensities'):
    """Plot the intensities (e.g. the datas) of a galaxy, on a regular grid of (y,x) coordinates.

    Set *autolens.datas.array.plotters.array_plotters* for a description of all innput parameters not described below.

    Parameters
    -----------
    galaxy : model.galaxy.galaxy.Galaxy
        The galaxy whose intensities are plotted.
    grid : ndarray or datas.array.grid_stacks.RegularGrid
        The (y,x) coordinates of the grid, in an array of shape (total_coordinates, 2)
    """
    intensities = galaxy.intensities_from_grid(grid=grid)
    intensities = grid.scaled_array_from_array_1d(intensities)

    array_plotters.plot_array(array=intensities,
                              mask=mask,
                              extract_array_from_mask=extract_array_from_mask,
                              zoom_around_mask=zoom_around_mask,
                              positions=positions,
                              as_subplot=as_subplot,
                              units=units,
                              kpc_per_arcsec=kpc_per_arcsec,
                              figsize=figsize,
                              aspect=aspect,
                              cmap=cmap,
                              norm=norm,
                              norm_min=norm_min,
                              norm_max=norm_max,
                              linthresh=linthresh,
                              linscale=linscale,
                              cb_ticksize=cb_ticksize,
                              cb_fraction=cb_fraction,
                              cb_pad=cb_pad,
                              title=title,
                              titlesize=titlesize,
                              xlabelsize=xlabelsize,
                              ylabelsize=ylabelsize,
                              xyticksize=xyticksize,
                              mask_pointsize=mask_pointsize,
                              position_pointsize=position_pointsize,
                              grid_pointsize=grid_pointsize,
                              output_path=output_path,
                              output_format=output_format,
                              output_filename=output_filename)
示例#13
0
def plot_noise_map(noise_map,
                   plot_origin=True,
                   mask=None,
                   extract_array_from_mask=False,
                   zoom_around_mask=False,
                   as_subplot=False,
                   units='arcsec',
                   kpc_per_arcsec=None,
                   figsize=(7, 7),
                   aspect='equal',
                   cmap='jet',
                   norm='linear',
                   norm_min=None,
                   norm_max=None,
                   linthresh=0.05,
                   linscale=0.01,
                   cb_ticksize=10,
                   cb_fraction=0.047,
                   cb_pad=0.01,
                   title='Noise-Map',
                   titlesize=16,
                   xlabelsize=16,
                   ylabelsize=16,
                   xyticksize=16,
                   mask_pointsize=10,
                   output_path=None,
                   output_format='show',
                   output_filename='noise_map'):
    """Plot the noise_map-map of the ccd data.

    Set *autolens.data.array.plotters.array_plotters* for a description of all innput parameters not described below.

    Parameters
    -----------
    noise_map : ScaledSquarePixelArray
        The noise map of the data.
    plot_origin : True
        If true, the origin of the data's coordinate system is plotted as a 'x'.
    """
    origin = get_origin(array=noise_map, plot_origin=plot_origin)

    array_plotters.plot_array(array=noise_map,
                              origin=origin,
                              mask=mask,
                              extract_array_from_mask=extract_array_from_mask,
                              zoom_around_mask=zoom_around_mask,
                              as_subplot=as_subplot,
                              units=units,
                              kpc_per_arcsec=kpc_per_arcsec,
                              figsize=figsize,
                              aspect=aspect,
                              cmap=cmap,
                              norm=norm,
                              norm_min=norm_min,
                              norm_max=norm_max,
                              linthresh=linthresh,
                              linscale=linscale,
                              cb_ticksize=cb_ticksize,
                              cb_fraction=cb_fraction,
                              cb_pad=cb_pad,
                              title=title,
                              titlesize=titlesize,
                              xlabelsize=xlabelsize,
                              ylabelsize=ylabelsize,
                              xyticksize=xyticksize,
                              mask_pointsize=mask_pointsize,
                              output_path=output_path,
                              output_format=output_format,
                              output_filename=output_filename)
示例#14
0
def plot_image(image,
               plot_origin=True,
               mask=None,
               extract_array_from_mask=False,
               zoom_around_mask=False,
               should_plot_border=False,
               positions=None,
               as_subplot=False,
               units='arcsec',
               kpc_per_arcsec=None,
               figsize=(7, 7),
               aspect='equal',
               cmap='jet',
               norm='linear',
               norm_min=None,
               norm_max=None,
               linthresh=0.05,
               linscale=0.01,
               cb_ticksize=10,
               cb_fraction=0.047,
               cb_pad=0.01,
               title='Image',
               titlesize=16,
               xlabelsize=16,
               ylabelsize=16,
               xyticksize=16,
               mask_pointsize=10,
               position_pointsize=30,
               grid_pointsize=1,
               output_path=None,
               output_format='show',
               output_filename='image'):
    """Plot the observed image of the ccd data.

    Set *autolens.data.array.plotters.array_plotters* for a description of all innput parameters not described below.

    Parameters
    -----------
    image : ScaledSquarePixelArray
        The image of the data.
    plot_origin : True
        If true, the origin of the data's coordinate system is plotted as a 'x'.
    image_plane_pix_grid : ndarray or data.array.grid_stacks.PixGrid
        If an adaptive pixelization whose pixels are formed by tracing pixels from the data, this plots those pixels \
        over the immage.
    """
    origin = get_origin(array=image, plot_origin=plot_origin)

    array_plotters.plot_array(array=image,
                              origin=origin,
                              mask=mask,
                              extract_array_from_mask=extract_array_from_mask,
                              zoom_around_mask=zoom_around_mask,
                              should_plot_border=should_plot_border,
                              positions=positions,
                              as_subplot=as_subplot,
                              units=units,
                              kpc_per_arcsec=kpc_per_arcsec,
                              figsize=figsize,
                              aspect=aspect,
                              cmap=cmap,
                              norm=norm,
                              norm_min=norm_min,
                              norm_max=norm_max,
                              linthresh=linthresh,
                              linscale=linscale,
                              cb_ticksize=cb_ticksize,
                              cb_fraction=cb_fraction,
                              cb_pad=cb_pad,
                              title=title,
                              titlesize=titlesize,
                              xlabelsize=xlabelsize,
                              ylabelsize=ylabelsize,
                              xyticksize=xyticksize,
                              mask_pointsize=mask_pointsize,
                              position_pointsize=position_pointsize,
                              grid_pointsize=grid_pointsize,
                              output_path=output_path,
                              output_format=output_format,
                              output_filename=output_filename)
示例#15
0
# scale which allows us to convert the axes of the array to arc-second coordinates.
image = scaled_array.ScaledSquarePixelArray.from_fits_with_pixel_scale(
    file_path=file_path, hdu=0, pixel_scale=0.03)

# We can now use an array plotter to plot the array. We customize the plot as follows:

# 1) We make the array's figure size bigger than the default size (7,7).

# 2) Because the figure is bigger, we increase the size of the title, x and y labels / ticks from their default size of
#    16 to 24.

# 3) For the same reason, we increase the size of the colorbar ticks from the default value 10 to 20.
array_plotters.plot_array(array=image,
                          figsize=(12, 12),
                          title='SLACS1430+4105 Image',
                          titlesize=24,
                          xlabelsize=24,
                          ylabelsize=24,
                          xyticksize=24,
                          cb_ticksize=20)

# The colormap of the array can be changed to any of the standard matplotlib colormaps.
array_plotters.plot_array(array=image,
                          title='SLACS1430+4105 Image',
                          cmap='spring')

# We can change the x / y axis units from arc-seconds to kiloparsec, by inputting a kiloparsec to arcsecond conversion
# factor (for SLACS1430+4105, the lens galaxy is at redshift 0.285, corresponding to the conversion factor below).
array_plotters.plot_array(array=image,
                          title='SLACS1430+4105 Image',
                          units='kpc',
                          kpc_per_arcsec=4.335)
示例#16
0
def plot_galaxy_data_array(galaxy_data,
                           mask=None,
                           extract_array_from_mask=False,
                           zoom_around_mask=False,
                           positions=None,
                           as_subplot=False,
                           units='arcsec',
                           kpc_per_arcsec=None,
                           figsize=None,
                           aspect='equal',
                           cmap='jet',
                           norm='linear',
                           norm_min=None,
                           norm_max=None,
                           linthresh=0.05,
                           linscale=0.01,
                           cb_ticksize=10,
                           cb_fraction=0.047,
                           cb_pad=0.01,
                           titlesize=10,
                           xlabelsize=10,
                           ylabelsize=10,
                           xyticksize=10,
                           mask_pointsize=10,
                           position_pointsize=10.0,
                           grid_pointsize=1,
                           output_path=None,
                           output_filename='galaxy_data',
                           output_format='show'):

    if galaxy_data.use_intensities:
        title = 'Galaxy Data Intensities'
    elif galaxy_data.use_surface_density:
        title = 'Galaxy Data Surface Density'
    elif galaxy_data.use_potential:
        title = 'Galaxy Data Potential'
    elif galaxy_data.use_deflections_y:
        title = 'Galaxy Data Deflections (y)'
    elif galaxy_data.use_deflections_x:
        title = 'Galaxy Data Deflections (x)'
    else:
        raise exc.PlottingException(
            'The galaxy data array does not have a True use_profile_type')

    array_plotters.plot_array(array=galaxy_data.image,
                              mask=mask,
                              extract_array_from_mask=extract_array_from_mask,
                              zoom_around_mask=zoom_around_mask,
                              positions=positions,
                              as_subplot=as_subplot,
                              units=units,
                              kpc_per_arcsec=kpc_per_arcsec,
                              figsize=figsize,
                              aspect=aspect,
                              cmap=cmap,
                              norm=norm,
                              norm_min=norm_min,
                              norm_max=norm_max,
                              linthresh=linthresh,
                              linscale=linscale,
                              cb_ticksize=cb_ticksize,
                              cb_fraction=cb_fraction,
                              cb_pad=cb_pad,
                              title=title,
                              titlesize=titlesize,
                              xlabelsize=xlabelsize,
                              ylabelsize=ylabelsize,
                              xyticksize=xyticksize,
                              mask_pointsize=mask_pointsize,
                              position_pointsize=position_pointsize,
                              grid_pointsize=grid_pointsize,
                              output_path=output_path,
                              output_format=output_format,
                              output_filename=output_filename)