コード例 #1
0
def plot_image_and_source_plane_subplot(
        image_plane,
        source_plane,
        points=None,
        axis_limits=None,
        units='arcsec',
        output_path=None,
        output_format='show',
        output_filename='image_and_source_plane_grids'):

    rows, columns, figsize = plotter_util.get_subplot_rows_columns_figsize(
        number_subplots=2)

    plt.figure(figsize=figsize)
    plt.subplot(rows, columns, 1)

    plot_plane_grid(plane=image_plane,
                    axis_limits=axis_limits,
                    points=points,
                    as_subplot=True,
                    units=units,
                    pointsize=3,
                    xyticksize=16,
                    titlesize=10,
                    xlabelsize=10,
                    ylabelsize=10,
                    title='CCD-plane Grid',
                    output_path=output_path,
                    output_filename=output_filename,
                    output_format=output_format)

    plt.subplot(rows, columns, 2)

    plot_plane_grid(plane=source_plane,
                    axis_limits=axis_limits,
                    points=points,
                    as_subplot=True,
                    units=units,
                    pointsize=3,
                    xyticksize=16,
                    titlesize=10,
                    xlabelsize=10,
                    ylabelsize=10,
                    title='Source-plane Grid',
                    output_path=output_path,
                    output_filename=output_filename,
                    output_format=output_format)

    plotter_util.output_subplot_array(output_path=output_path,
                                      output_filename=output_filename,
                                      output_format=output_format)
    plt.close()
コード例 #2
0
def plot_image_and_mapper(ccd_data,
                          mapper,
                          mask=None,
                          positions=None,
                          should_plot_centres=False,
                          should_plot_grid=False,
                          should_plot_border=False,
                          image_pixels=None,
                          source_pixels=None,
                          units='arcsec',
                          kpc_per_arcsec=None,
                          output_path=None,
                          output_filename='image_and_mapper',
                          output_format='show'):

    rows, columns, figsize = plotter_util.get_subplot_rows_columns_figsize(
        number_subplots=2)
    plt.figure(figsize=figsize)
    plt.subplot(rows, columns, 1)

    ccd_plotters.plot_image(ccd_data=ccd_data,
                            mask=mask,
                            positions=positions,
                            as_subplot=True,
                            units=units,
                            kpc_per_arcsec=None,
                            xyticksize=16,
                            norm='linear',
                            norm_min=None,
                            norm_max=None,
                            linthresh=0.05,
                            linscale=0.01,
                            figsize=None,
                            aspect='equal',
                            cmap='jet',
                            cb_ticksize=10,
                            titlesize=10,
                            xlabelsize=10,
                            ylabelsize=10,
                            output_path=output_path,
                            output_format=output_format)

    image_grid = convert_grid(grid=mapper.grid_stack.regular.unlensed_grid,
                              units=units,
                              kpc_per_arcsec=kpc_per_arcsec)

    point_colors = itertools.cycle(["y", "r", "k", "g", "m"])
    plot_image_plane_image_pixels(grid=image_grid,
                                  image_pixels=image_pixels,
                                  point_colors=point_colors)
    plot_image_plane_source_pixels(grid=image_grid,
                                   mapper=mapper,
                                   source_pixels=source_pixels,
                                   point_colors=point_colors)

    plt.subplot(rows, columns, 2)

    plot_mapper(mapper=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,
                figsize=None)

    plotter_util.output_subplot_array(output_path=output_path,
                                      output_filename=output_filename,
                                      output_format=output_format)
    plt.close()
コード例 #3
0
def plot_ray_tracing_subplot(tracer,
                             mask=None,
                             extract_array_from_mask=False,
                             zoom_around_mask=False,
                             positions=None,
                             units='arcsec',
                             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.0,
                             output_path=None,
                             output_filename='tracer',
                             output_format='show'):
    """Plot the observed _tracer of an analysis, using the *CCD* class object.

    The visualization and output type can be fully customized.

    Parameters
    -----------
    tracer : autolens.ccd.tracer.CCD
        Class containing the _tracer, noise_map-mappers and PSF that are to be plotted.
        The font size of the figure ylabel.
    output_path : str
        The path where the _tracer is output if the output_type is a file format (e.g. png, fits)
    output_format : str
        How the _tracer is output. File formats (e.g. png, fits) output the _tracer to harddisk. 'show' displays the _tracer \
        in the python interpreter window.
    """

    rows, columns, figsize_tool = plotter_util.get_subplot_rows_columns_figsize(
        number_subplots=6)

    if figsize is None:
        figsize = figsize_tool

    plt.figure(figsize=figsize)
    plt.subplot(rows, columns, 1)

    plot_image_plane_image(tracer=tracer,
                           mask=mask,
                           extract_array_from_mask=extract_array_from_mask,
                           zoom_around_mask=zoom_around_mask,
                           positions=positions,
                           as_subplot=True,
                           units=units,
                           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,
                           titlesize=titlesize,
                           xlabelsize=xlabelsize,
                           ylabelsize=ylabelsize,
                           xyticksize=xyticksize,
                           mask_pointsize=mask_pointsize,
                           position_pointsize=position_pointsize,
                           output_path=output_path,
                           output_filename='',
                           output_format=output_format)

    if tracer.has_mass_profile:

        plt.subplot(rows, columns, 2)

        plot_surface_density(tracer=tracer,
                             mask=mask,
                             extract_array_from_mask=extract_array_from_mask,
                             zoom_around_mask=zoom_around_mask,
                             as_subplot=True,
                             units=units,
                             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,
                             titlesize=titlesize,
                             xlabelsize=xlabelsize,
                             ylabelsize=ylabelsize,
                             xyticksize=xyticksize,
                             output_path=output_path,
                             output_filename='',
                             output_format=output_format)

        plt.subplot(rows, columns, 3)

        plot_potential(tracer=tracer,
                       mask=mask,
                       extract_array_from_mask=extract_array_from_mask,
                       zoom_around_mask=zoom_around_mask,
                       as_subplot=True,
                       units=units,
                       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,
                       titlesize=titlesize,
                       xlabelsize=xlabelsize,
                       ylabelsize=ylabelsize,
                       xyticksize=xyticksize,
                       output_path=output_path,
                       output_filename='',
                       output_format=output_format)

    plt.subplot(rows, columns, 4)

    plane_plotters.plot_plane_image(plane=tracer.source_plane,
                                    as_subplot=True,
                                    positions=None,
                                    plot_grid=False,
                                    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,
                                    titlesize=titlesize,
                                    xlabelsize=xlabelsize,
                                    ylabelsize=ylabelsize,
                                    xyticksize=xyticksize,
                                    grid_pointsize=grid_pointsize,
                                    output_path=output_path,
                                    output_filename='',
                                    output_format=output_format)

    if tracer.has_mass_profile:

        plt.subplot(rows, columns, 5)

        plot_deflections_y(tracer=tracer,
                           mask=mask,
                           extract_array_from_mask=extract_array_from_mask,
                           zoom_around_mask=zoom_around_mask,
                           as_subplot=True,
                           units=units,
                           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,
                           titlesize=titlesize,
                           xlabelsize=xlabelsize,
                           ylabelsize=ylabelsize,
                           xyticksize=xyticksize,
                           output_path=output_path,
                           output_filename='',
                           output_format=output_format)

        plt.subplot(rows, columns, 6)

        plot_deflections_x(tracer=tracer,
                           mask=mask,
                           extract_array_from_mask=extract_array_from_mask,
                           zoom_around_mask=zoom_around_mask,
                           as_subplot=True,
                           units=units,
                           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,
                           titlesize=titlesize,
                           xlabelsize=xlabelsize,
                           ylabelsize=ylabelsize,
                           xyticksize=xyticksize,
                           output_path=output_path,
                           output_filename='',
                           output_format=output_format)

    plotter_util.output_subplot_array(output_path=output_path,
                                      output_filename=output_filename,
                                      output_format=output_format)

    plt.close()
コード例 #4
0
def plot_fit_subplot_lens_and_source_planes(fit,
                                            should_plot_mask=True,
                                            extract_array_from_mask=False,
                                            zoom_around_mask=False,
                                            should_plot_source_grid=False,
                                            positions=None,
                                            should_plot_image_plane_pix=False,
                                            units='arcsec',
                                            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,
                                            grid_pointsize=1,
                                            output_path=None,
                                            output_filename='lens_fit',
                                            output_format='show'):
    """Plot the model datas_ of an analysis, using the *Fitter* class object.

    The visualization and output type can be fully customized.

    Parameters
    -----------
    fit : autolens.lens.fitting.Fitter
        Class containing fit between the model datas_ and observed lens datas_ (including residual_map, chi_squared_map etc.)
    output_path : str
        The path where the datas_ is output if the output_type is a file format (e.g. png, fits)
    output_filename : str
        The name of the file that is output, if the output_type is a file format (e.g. png, fits)
    output_format : str
        How the datas_ is output. File formats (e.g. png, fits) output the datas_ to harddisk. 'show' displays the datas_ \
        in the python interpreter window.
    """

    rows, columns, figsize_tool = plotter_util.get_subplot_rows_columns_figsize(
        number_subplots=9)

    mask = lens_plotter_util.get_mask(fit=fit,
                                      should_plot_mask=should_plot_mask)

    if figsize is None:
        figsize = figsize_tool

    plt.figure(figsize=figsize)

    kpc_per_arcsec = fit.tracer.image_plane.kpc_per_arcsec_proper

    image_plane_pix_grid = lens_plotter_util.get_image_plane_pix_grid(
        should_plot_image_plane_pix, fit)

    plt.subplot(rows, columns, 1)

    lens_plotter_util.plot_image(
        fit=fit,
        mask=mask,
        extract_array_from_mask=extract_array_from_mask,
        zoom_around_mask=zoom_around_mask,
        positions=positions,
        image_plane_pix_grid=image_plane_pix_grid,
        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,
        titlesize=titlesize,
        xlabelsize=xlabelsize,
        ylabelsize=ylabelsize,
        xyticksize=xyticksize,
        grid_pointsize=grid_pointsize,
        position_pointsize=position_pointsize,
        mask_pointsize=mask_pointsize,
        output_path=output_path,
        output_filename='',
        output_format=output_format)

    plt.subplot(rows, columns, 2)

    lens_plotter_util.plot_noise_map(
        fit=fit,
        mask=mask,
        extract_array_from_mask=extract_array_from_mask,
        zoom_around_mask=zoom_around_mask,
        positions=None,
        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,
        titlesize=titlesize,
        xlabelsize=xlabelsize,
        ylabelsize=ylabelsize,
        xyticksize=xyticksize,
        position_pointsize=position_pointsize,
        mask_pointsize=mask_pointsize,
        output_path=output_path,
        output_filename='',
        output_format=output_format)

    plt.subplot(rows, columns, 3)

    lens_plotter_util.plot_signal_to_noise_map(
        fit=fit,
        mask=mask,
        extract_array_from_mask=extract_array_from_mask,
        zoom_around_mask=zoom_around_mask,
        positions=None,
        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,
        titlesize=titlesize,
        xlabelsize=xlabelsize,
        ylabelsize=ylabelsize,
        xyticksize=xyticksize,
        position_pointsize=position_pointsize,
        mask_pointsize=mask_pointsize,
        output_path=output_path,
        output_filename='',
        output_format=output_format)

    plt.subplot(rows, columns, 4)

    lens_plotter_util.plot_lens_subtracted_image(
        fit=fit,
        mask=mask,
        extract_array_from_mask=extract_array_from_mask,
        zoom_around_mask=zoom_around_mask,
        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='Fit Lens Subtracted Image',
        titlesize=titlesize,
        xlabelsize=xlabelsize,
        ylabelsize=ylabelsize,
        position_pointsize=position_pointsize,
        xyticksize=xyticksize,
        output_path=output_path,
        output_filename='',
        output_format=output_format)

    if fit.tracer.image_plane.has_light_profile:

        plt.subplot(rows, columns, 5)

        lens_plotter_util.plot_model_image_of_planes(
            fit=fit,
            plot_foreground=True,
            mask=mask,
            extract_array_from_mask=extract_array_from_mask,
            zoom_around_mask=zoom_around_mask,
            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='Fit Image-Plane Model Image',
            titlesize=titlesize,
            xlabelsize=xlabelsize,
            ylabelsize=ylabelsize,
            xyticksize=xyticksize,
            output_path=output_path,
            output_filename='',
            output_format=output_format)

    plt.subplot(rows, columns, 6)

    lens_plotter_util.plot_model_image_of_planes(
        fit=fit,
        plot_source=True,
        mask=mask,
        extract_array_from_mask=extract_array_from_mask,
        zoom_around_mask=zoom_around_mask,
        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='Fit Source-Plane Model Image',
        titlesize=titlesize,
        xlabelsize=xlabelsize,
        ylabelsize=ylabelsize,
        xyticksize=xyticksize,
        output_path=output_path,
        output_filename='lens_subtracted_image',
        output_format=output_format)

    plt.subplot(rows, columns, 7)

    if fit.total_inversions == 0:

        plane_plotters.plot_plane_image(plane=fit.tracer.source_plane,
                                        positions=None,
                                        plot_grid=should_plot_source_grid,
                                        as_subplot=True,
                                        units=units,
                                        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,
                                        titlesize=titlesize,
                                        xlabelsize=xlabelsize,
                                        ylabelsize=ylabelsize,
                                        xyticksize=xyticksize,
                                        grid_pointsize=grid_pointsize,
                                        position_pointsize=position_pointsize,
                                        output_path=output_path,
                                        output_filename='',
                                        output_format=output_format)

    elif fit.total_inversions == 1:

        inversion_plotters.plot_reconstructed_pixelization(
            inversion=fit.inversion,
            positions=None,
            should_plot_grid=False,
            should_plot_centres=False,
            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,
            titlesize=titlesize,
            xlabelsize=xlabelsize,
            ylabelsize=ylabelsize,
            xyticksize=xyticksize,
            output_path=output_path,
            output_filename=None,
            output_format=output_format)

    plt.subplot(rows, columns, 8)

    lens_plotter_util.plot_residual_map(
        fit=fit,
        mask=mask,
        extract_array_from_mask=extract_array_from_mask,
        zoom_around_mask=zoom_around_mask,
        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,
        titlesize=titlesize,
        xlabelsize=xlabelsize,
        ylabelsize=ylabelsize,
        xyticksize=xyticksize,
        output_path=output_path,
        output_filename='',
        output_format=output_format)

    plt.subplot(rows, columns, 9)

    lens_plotter_util.plot_chi_squared_map(
        fit=fit,
        mask=mask,
        extract_array_from_mask=extract_array_from_mask,
        zoom_around_mask=zoom_around_mask,
        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,
        titlesize=titlesize,
        xlabelsize=xlabelsize,
        ylabelsize=ylabelsize,
        xyticksize=xyticksize,
        output_path=output_path,
        output_filename='',
        output_format=output_format)

    plotter_util.output_subplot_array(output_path=output_path,
                                      output_filename=output_filename,
                                      output_format=output_format)

    plt.close()
コード例 #5
0
def plot_deflections_x_subplot(
        galaxy,
        grid,
        mask=None,
        extract_array_from_mask=False,
        zoom_around_mask=False,
        positions=None,
        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_format='show',
        output_filename='galaxy_individual_deflections_x'):

    total_mass_profiles = len(galaxy.mass_profiles)
    rows, columns, figsize_tool = plotter_util.get_subplot_rows_columns_figsize(
        number_subplots=total_mass_profiles)

    if figsize is None:
        figsize = figsize_tool

    plt.figure(figsize=figsize)

    for i, mass_profile in enumerate(galaxy.mass_profiles):

        plt.subplot(rows, columns, i + 1)

        profile_plotters.plot_deflections_x(
            mass_profile=mass_profile,
            grid=grid,
            mask=mask,
            extract_array_from_mask=extract_array_from_mask,
            zoom_around_mask=zoom_around_mask,
            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='Galaxy Component',
            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)

    plotter_util.output_subplot_array(output_path=output_path,
                                      output_filename=output_filename,
                                      output_format=output_format)
    plt.close()
コード例 #6
0
def plot_ccd_subplot(
        ccd_data, plot_origin=True, mask=None, extract_array_from_mask=False, zoom_around_mask=False,
        should_plot_border=False, positions=None,
        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=30, grid_pointsize=1,
        output_path=None, output_filename='ccd_data', output_format='show'):
    """Plot the ccd data as a sub-plot of all its quantites (e.g. the data, noise_map-map, PSF, Signal-to_noise-map, \
     etc).

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

    Parameters
    -----------
    ccd_data : data.CCDData
        The ccd data, which includes the observed data, noise_map-map, PSF, signal-to-noise_map-map, etc.
    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.
    ignore_config : bool
        If *False*, the config file general.ini is used to determine whether the subpot is plotted. If *True*, the \
        config file is ignored.
    """

    rows, columns, figsize_tool = plotter_util.get_subplot_rows_columns_figsize(number_subplots=4)

    if figsize is None:
        figsize = figsize_tool

    plt.figure(figsize=figsize)
    plt.subplot(rows, columns, 1)

    plot_image(
        ccd_data=ccd_data, plot_origin=plot_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=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,
        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)

    plt.subplot(rows, columns, 2)

    plot_noise_map(
        ccd_data=ccd_data, plot_origin=plot_origin, mask=mask, extract_array_from_mask=extract_array_from_mask,
        zoom_around_mask=zoom_around_mask, 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,
        titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,
        mask_pointsize=mask_pointsize,
        output_path=output_path, output_format=output_format)

    plt.subplot(rows, columns, 3)

    plot_psf(
        ccd_data=ccd_data, 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,
        titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,
        output_path=output_path, output_format=output_format)

    plt.subplot(rows, columns, 4)

    plot_signal_to_noise_map(
        ccd_data=ccd_data, plot_origin=plot_origin, mask=mask, extract_array_from_mask=extract_array_from_mask,
        zoom_around_mask=zoom_around_mask, 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,
        titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,
        mask_pointsize=mask_pointsize,
        output_path=output_path, output_format=output_format)

    plotter_util.output_subplot_array(output_path=output_path, output_filename=output_filename,
                                      output_format=output_format)

    plt.close()
コード例 #7
0
def plot_fit_subplot(fit,
                     should_plot_mask=True,
                     extract_array_from_mask=False,
                     zoom_around_mask=False,
                     positions=None,
                     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_fit',
                     output_format='show'):

    rows, columns, figsize_tool = plotter_util.get_subplot_rows_columns_figsize(
        number_subplots=4)

    mask = lens_plotter_util.get_mask(fit=fit,
                                      should_plot_mask=should_plot_mask)

    if figsize is None:
        figsize = figsize_tool

    plt.figure(figsize=figsize)
    plt.subplot(rows, columns, 1)

    plot_galaxy_data_array(galaxy_data=fit.galaxy_data,
                           mask=mask,
                           extract_array_from_mask=extract_array_from_mask,
                           zoom_around_mask=zoom_around_mask,
                           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,
                           titlesize=titlesize,
                           xlabelsize=xlabelsize,
                           ylabelsize=ylabelsize,
                           xyticksize=xyticksize,
                           grid_pointsize=grid_pointsize,
                           position_pointsize=position_pointsize,
                           mask_pointsize=mask_pointsize,
                           output_path=output_path,
                           output_filename=output_filename,
                           output_format=output_format)

    plt.subplot(rows, columns, 2)

    lens_plotter_util.plot_model_data(
        fit=fit,
        mask=mask,
        extract_array_from_mask=extract_array_from_mask,
        zoom_around_mask=zoom_around_mask,
        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='Model Galaxy',
        titlesize=titlesize,
        xlabelsize=xlabelsize,
        ylabelsize=ylabelsize,
        xyticksize=xyticksize,
        position_pointsize=position_pointsize,
        mask_pointsize=mask_pointsize,
        output_path=output_path,
        output_filename='',
        output_format=output_format)

    plt.subplot(rows, columns, 3)

    lens_plotter_util.plot_residual_map(
        fit=fit,
        mask=mask,
        extract_array_from_mask=extract_array_from_mask,
        zoom_around_mask=zoom_around_mask,
        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,
        titlesize=titlesize,
        xlabelsize=xlabelsize,
        ylabelsize=ylabelsize,
        xyticksize=xyticksize,
        position_pointsize=position_pointsize,
        mask_pointsize=mask_pointsize,
        output_path=output_path,
        output_filename='',
        output_format=output_format)

    plt.subplot(rows, columns, 4)

    lens_plotter_util.plot_chi_squared_map(
        fit=fit,
        mask=mask,
        extract_array_from_mask=extract_array_from_mask,
        zoom_around_mask=zoom_around_mask,
        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,
        titlesize=titlesize,
        xlabelsize=xlabelsize,
        ylabelsize=ylabelsize,
        xyticksize=xyticksize,
        position_pointsize=position_pointsize,
        mask_pointsize=mask_pointsize,
        output_path=output_path,
        output_filename='',
        output_format=output_format)

    plotter_util.output_subplot_array(output_path=output_path,
                                      output_filename=output_filename,
                                      output_format=output_format)

    plt.close()