def __init__(self, galaxies, image_plane_positions, cosmology=cosmo.Planck15):

plane_redshifts = lens_util.ordered_plane_redshifts_from_galaxies(galaxies=galaxies)<EOL>galaxies_in_redshift_ordered_lists =lens_util.galaxies_in_redshift_ordered_planes_from_galaxies(galaxies=galaxies,<EOL>plane_redshifts=plane_redshifts)<EOL>if not galaxies:<EOL><INDENT>raise exc.RayTracingException('<STR_LIT>')<EOL><DEDENT>planes = []<EOL>for plane_index in range(<NUM_LIT:0>, len(plane_redshifts)):<EOL><INDENT>if plane_index < len(plane_redshifts) - <NUM_LIT:1>:<EOL><INDENT>compute_deflections = True<EOL><DEDENT>elif plane_index == len(plane_redshifts) - <NUM_LIT:1>:<EOL><INDENT>compute_deflections = False<EOL><DEDENT>else:<EOL><INDENT>raise exc.RayTracingException('<STR_LIT>')<EOL><DEDENT>new_positions = image_plane_positions<EOL>if plane_index > <NUM_LIT:0>:<EOL><INDENT>for previous_plane_index in range(plane_index):<EOL><INDENT>scaling_factor = cosmology_util.scaling_factor_between_redshifts_from_redshifts_and_cosmology(<EOL>redshift_0=plane_redshifts[previous_plane_index], redshift_1=plane_redshifts[plane_index],<EOL>redshift_final=plane_redshifts[-<NUM_LIT:1>], cosmology=cosmology)<EOL>scaled_deflections = list(map(lambda deflections:<EOL>np.multiply(scaling_factor, deflections),<EOL>planes[previous_plane_index].deflections))<EOL>new_positions = list(map(lambda positions, deflections:<EOL>np.subtract(positions, deflections), new_positions, scaled_deflections))<EOL><DEDENT><DEDENT>planes.append(pl.PlanePositions(redshift=plane_redshifts[plane_index],<EOL>galaxies=galaxies_in_redshift_ordered_lists[plane_index],<EOL>positions=new_positions, compute_deflections=compute_deflections))<EOL><DEDENT>super(TracerMultiPlanesPositions, self).__init__(planes=planes, cosmology=cosmology)<EOL>

Positional ray-tracer for a lens system with any number of planes.

        To perform multi-plane ray-tracing, a cosmology must be supplied so that deflection-angles can be rescaled \
        according to the lens-geometry of the multi-plane system.

        Parameters
        ----------
        galaxies : [Galaxy]
            The list of galaxies in the ray-tracing calculation.
        image_plane_positions : [[[]]]
            The (y,x) arc-second coordinates of image-plane pixels which (are expected to) mappers to the same \
            location(s) in the final source-plane.
        cosmology : astropy.cosmology
            The cosmology of the ray-tracing calculation.


ordered_galaxies = sorted(galaxies, key=lambda galaxy: galaxy.redshift, reverse=False)<EOL>galaxy_redshifts = list(map(lambda galaxy: galaxy.redshift, ordered_galaxies))<EOL>return [redshift for i, redshift in enumerate(galaxy_redshifts) if redshift not in galaxy_redshifts[:i]]<EOL>

Given a list of galaxies (with redshifts), return a list of the redshifts in ascending order.

    If two or more galaxies have the same redshift that redshift is not double counted.

    Parameters
    -----------
    galaxies : [Galaxy]
        The list of galaxies in the ray-tracing calculation.


galaxies_in_redshift_ordered_planes =  [[] for i in range(len(plane_redshifts))]<EOL>for galaxy in galaxies:<EOL><INDENT>index = (np.abs(np.asarray(plane_redshifts) - galaxy.redshift)).argmin()<EOL>galaxies_in_redshift_ordered_planes[index].append(galaxy)<EOL><DEDENT>return galaxies_in_redshift_ordered_planes<EOL>

Given a list of galaxies (with redshifts), return a list of the galaxies where each entry contains a list \
    of galaxies at the same redshift in ascending redshift order.

    Parameters
    -----------
    galaxies : [Galaxy]
        The list of galaxies in the ray-tracing calculation.


def plot_residual_map(<EOL>fit, mask=None, extract_array_from_mask=False, zoom_around_mask=False, positions=None, as_subplot=False,<EOL>units='<STR_LIT>', kpc_per_arcsec=None, figsize=(<NUM_LIT:7>, <NUM_LIT:7>), aspect='<STR_LIT>',<EOL>cmap='<STR_LIT>', norm='<STR_LIT>', norm_min=None, norm_max=None, linthresh=<NUM_LIT>, linscale=<NUM_LIT>,<EOL>cb_ticksize=<NUM_LIT:10>, cb_fraction=<NUM_LIT>, cb_pad=<NUM_LIT>, cb_tick_values=None, cb_tick_labels=None,<EOL>title='<STR_LIT>', titlesize=<NUM_LIT:16>, xlabelsize=<NUM_LIT:16>, ylabelsize=<NUM_LIT:16>, xyticksize=<NUM_LIT:16>,<EOL>mask_pointsize=<NUM_LIT:10>, position_pointsize=<NUM_LIT:10>,<EOL>output_path=None, output_format='<STR_LIT>', output_filename='<STR_LIT>'):

array_plotters.plot_array(<EOL>array=fit.residual_map, mask=mask, extract_array_from_mask=extract_array_from_mask,<EOL>zoom_around_mask=zoom_around_mask, positions=positions, as_subplot=as_subplot,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>title=title, titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>mask_pointsize=mask_pointsize, position_pointsize=position_pointsize,<EOL>output_path=output_path, output_format=output_format, output_filename=output_filename)<EOL>

Plot the residual-map 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.
    image_index : int
        The index of the datas in the datas-set of which the residual_map are plotted.


def plot_contribution_maps(<EOL>fit, mask=None, extract_array_from_mask=False, zoom_around_mask=False, positions=None, as_subplot=False,<EOL>units='<STR_LIT>', kpc_per_arcsec=None, figsize=(<NUM_LIT:7>, <NUM_LIT:7>), aspect='<STR_LIT>',<EOL>cmap='<STR_LIT>', norm='<STR_LIT>', norm_min=None, norm_max=None, linthresh=<NUM_LIT>, linscale=<NUM_LIT>,<EOL>cb_ticksize=<NUM_LIT:10>, cb_fraction=<NUM_LIT>, cb_pad=<NUM_LIT>, cb_tick_values=None, cb_tick_labels=None,<EOL>title='<STR_LIT>', titlesize=<NUM_LIT:16>, xlabelsize=<NUM_LIT:16>, ylabelsize=<NUM_LIT:16>, xyticksize=<NUM_LIT:16>,<EOL>mask_pointsize=<NUM_LIT:10>, position_pointsize=<NUM_LIT:10>,<EOL>output_path=None, output_format='<STR_LIT>', output_filename='<STR_LIT>'):

if len(fit.contribution_maps) > <NUM_LIT:1>:<EOL><INDENT>contribution_map = sum(fit.contribution_maps)<EOL><DEDENT>else:<EOL><INDENT>contribution_map = fit.contribution_maps[<NUM_LIT:0>]<EOL><DEDENT>array_plotters.plot_array(<EOL>array=contribution_map, mask=mask, extract_array_from_mask=extract_array_from_mask,<EOL>zoom_around_mask=zoom_around_mask, positions=positions, as_subplot=as_subplot,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>title=title, titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>mask_pointsize=mask_pointsize, position_pointsize=position_pointsize,<EOL>output_path=output_path, output_format=output_format, output_filename=output_filename)<EOL>

Plot the summed contribution maps of a hyper-fit.

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

    Parameters
    -----------
    fit : datas.fitting.fitting.AbstractLensHyperFit
        The hyper-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 contribution_maps are plotted.


def plot_lens_subtracted_image(<EOL>fit, mask=None, extract_array_from_mask=False, zoom_around_mask=False, positions=None, as_subplot=False,<EOL>units='<STR_LIT>', kpc_per_arcsec=None, figsize=(<NUM_LIT:7>, <NUM_LIT:7>), aspect='<STR_LIT>',<EOL>cmap='<STR_LIT>', norm='<STR_LIT>', norm_min=None, norm_max=None, linthresh=<NUM_LIT>, linscale=<NUM_LIT>,<EOL>cb_ticksize=<NUM_LIT:10>, cb_fraction=<NUM_LIT>, cb_pad=<NUM_LIT>, cb_tick_values=None, cb_tick_labels=None,<EOL>title='<STR_LIT>', titlesize=<NUM_LIT:16>, xlabelsize=<NUM_LIT:16>, ylabelsize=<NUM_LIT:16>, xyticksize=<NUM_LIT:16>,<EOL>mask_pointsize=<NUM_LIT:10>, position_pointsize=<NUM_LIT:10>,<EOL>output_path=None, output_format='<STR_LIT>', output_filename='<STR_LIT>'):

if fit.tracer.total_planes == <NUM_LIT:2>:<EOL><INDENT>if fit.tracer.image_plane.has_light_profile:<EOL><INDENT>lens_subtracted_image = fit.image - fit.model_image_of_planes[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>lens_subtracted_image = fit.image<EOL><DEDENT><DEDENT>else:<EOL><INDENT>lens_subtracted_image = fit.image - sum(fit.model_image_of_planes[<NUM_LIT:0>:-<NUM_LIT:2>])<EOL><DEDENT>array_plotters.plot_array(<EOL>array=lens_subtracted_image, mask=mask, extract_array_from_mask=extract_array_from_mask,<EOL>zoom_around_mask=zoom_around_mask, positions=positions, as_subplot=as_subplot,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>title=title, titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>mask_pointsize=mask_pointsize, position_pointsize=position_pointsize,<EOL>output_path=output_path, output_format=output_format, output_filename=output_filename)<EOL>

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.
    image_index : int
        The index of the datas in the datas-set of which the model image is plotted.
    plane_indexes : int
        The plane from which the model image is generated.


def plot_image(<EOL>fit, mask=None, extract_array_from_mask=False, zoom_around_mask=False, positions=None,<EOL>image_plane_pix_grid=None, as_subplot=False,<EOL>units='<STR_LIT>', kpc_per_arcsec=None, figsize=(<NUM_LIT:7>, <NUM_LIT:7>), aspect='<STR_LIT>',<EOL>cmap='<STR_LIT>', norm='<STR_LIT>', norm_min=None, norm_max=None, linthresh=<NUM_LIT>, linscale=<NUM_LIT>,<EOL>cb_ticksize=<NUM_LIT:10>, cb_fraction=<NUM_LIT>, cb_pad=<NUM_LIT>, cb_tick_values=None, cb_tick_labels=None,<EOL>title='<STR_LIT>', titlesize=<NUM_LIT:16>, xlabelsize=<NUM_LIT:16>, ylabelsize=<NUM_LIT:16>, xyticksize=<NUM_LIT:16>,<EOL>grid_pointsize=<NUM_LIT:1>, mask_pointsize=<NUM_LIT:10>, position_pointsize=<NUM_LIT:10>,<EOL>output_path=None, output_format='<STR_LIT>', output_filename='<STR_LIT>'):

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

Plot the image 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, noise_map-map, PSF, signal-to-noise_map-map, etc.
    plot_origin : True
        If true, the origin of the datas's coordinate system is plotted as a 'x'.


def plot_signal_to_noise_map(<EOL>fit, mask=None, extract_array_from_mask=False, zoom_around_mask=False, positions=None, as_subplot=False,<EOL>units='<STR_LIT>', kpc_per_arcsec=None, figsize=(<NUM_LIT:7>, <NUM_LIT:7>), aspect='<STR_LIT>',<EOL>cmap='<STR_LIT>', norm='<STR_LIT>', norm_min=None, norm_max=None, linthresh=<NUM_LIT>, linscale=<NUM_LIT>,<EOL>cb_ticksize=<NUM_LIT:10>, cb_fraction=<NUM_LIT>, cb_pad=<NUM_LIT>, cb_tick_values=None, cb_tick_labels=None,<EOL>title='<STR_LIT>', titlesize=<NUM_LIT:16>, xlabelsize=<NUM_LIT:16>, ylabelsize=<NUM_LIT:16>, xyticksize=<NUM_LIT:16>,<EOL>mask_pointsize=<NUM_LIT:10>, position_pointsize=<NUM_LIT:10>,<EOL>output_path=None, output_format='<STR_LIT>', output_filename='<STR_LIT>'):

array_plotters.plot_array(<EOL>array=fit.signal_to_noise_map, mask=mask, extract_array_from_mask=extract_array_from_mask,<EOL>zoom_around_mask=zoom_around_mask, positions=positions, as_subplot=as_subplot,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max,<EOL>linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>title=title, titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>mask_pointsize=mask_pointsize, position_pointsize=position_pointsize,<EOL>output_path=output_path, output_format=output_format, output_filename=output_filename)<EOL>

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'.


def plot_model_data(<EOL>fit, mask=None, extract_array_from_mask=False, zoom_around_mask=False, positions=None,<EOL>plot_mass_profile_centres=True, as_subplot=False,<EOL>units='<STR_LIT>', kpc_per_arcsec=None, figsize=(<NUM_LIT:7>, <NUM_LIT:7>), aspect='<STR_LIT>',<EOL>cmap='<STR_LIT>', norm='<STR_LIT>', norm_min=None, norm_max=None, linthresh=<NUM_LIT>, linscale=<NUM_LIT>,<EOL>cb_ticksize=<NUM_LIT:10>, cb_fraction=<NUM_LIT>, cb_pad=<NUM_LIT>, cb_tick_values=None, cb_tick_labels=None,<EOL>title='<STR_LIT>', titlesize=<NUM_LIT:16>, xlabelsize=<NUM_LIT:16>, ylabelsize=<NUM_LIT:16>, xyticksize=<NUM_LIT:16>,<EOL>mask_pointsize=<NUM_LIT:10>, position_pointsize=<NUM_LIT:10>,<EOL>output_path=None, output_format='<STR_LIT>', output_filename='<STR_LIT>'):

centres = get_mass_profile_centes(plot_mass_profile_centres=plot_mass_profile_centres, fit=fit)<EOL>array_plotters.plot_array(<EOL>array=fit.model_data, mask=mask, extract_array_from_mask=extract_array_from_mask,<EOL>zoom_around_mask=zoom_around_mask, positions=positions, centres=centres, as_subplot=as_subplot,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>title=title, titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>mask_pointsize=mask_pointsize, position_pointsize=position_pointsize,<EOL>output_path=output_path, output_format=output_format, output_filename=output_filename)<EOL>

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.


def plot_noise_map(<EOL>fit, mask=None, extract_array_from_mask=False, zoom_around_mask=False, positions=None, as_subplot=False,<EOL>units='<STR_LIT>', kpc_per_arcsec=None, figsize=(<NUM_LIT:7>, <NUM_LIT:7>), aspect='<STR_LIT>',<EOL>cmap='<STR_LIT>', norm='<STR_LIT>', norm_min=None, norm_max=None, linthresh=<NUM_LIT>, linscale=<NUM_LIT>,<EOL>cb_ticksize=<NUM_LIT:10>, cb_fraction=<NUM_LIT>, cb_pad=<NUM_LIT>, cb_tick_values=None, cb_tick_labels=None,<EOL>title='<STR_LIT>', titlesize=<NUM_LIT:16>, xlabelsize=<NUM_LIT:16>, ylabelsize=<NUM_LIT:16>, xyticksize=<NUM_LIT:16>,<EOL>mask_pointsize=<NUM_LIT:10>, position_pointsize=<NUM_LIT:10>,<EOL>output_path=None, output_format='<STR_LIT>', output_filename='<STR_LIT>'):

array_plotters.plot_array(<EOL>array=fit.noise_map, mask=mask, extract_array_from_mask=extract_array_from_mask,<EOL>zoom_around_mask=zoom_around_mask,<EOL>positions=positions, as_subplot=as_subplot,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>title=title, titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>mask_pointsize=mask_pointsize, position_pointsize=position_pointsize,<EOL>output_path=output_path, output_format=output_format, output_filename=output_filename)<EOL>

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, noise_map-map, PSF, signal-to-noise_map-map, etc.
    plot_origin : True
        If true, the origin of the datas's coordinate system is plotted as a 'x'.


mask = lens_plotter_util.get_mask(fit=fit, should_plot_mask=should_plot_mask)<EOL>kpc_per_arcsec = fit.tracer.image_plane.kpc_per_arcsec<EOL>if should_plot_image:<EOL><INDENT>image_plane_pix_grid = lens_plotter_util.get_image_plane_pix_grid(should_plot_image_plane_pix, fit)<EOL>lens_plotter_util.plot_image(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask,<EOL>image_plane_pix_grid=image_plane_pix_grid,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec,<EOL>output_path=output_path, output_format=output_format)<EOL><DEDENT>if should_plot_noise_map:<EOL><INDENT>lens_plotter_util.plot_noise_map(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec,<EOL>output_path=output_path, output_format=output_format)<EOL><DEDENT>if should_plot_signal_to_noise_map:<EOL><INDENT>lens_plotter_util.plot_signal_to_noise_map(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec,<EOL>output_path=output_path, output_format=output_format)<EOL><DEDENT>if should_plot_lens_subtracted_image:<EOL><INDENT>lens_plotter_util.plot_lens_subtracted_image(<EOL>fit=fit, mask=mask, positions=positions, extract_array_from_mask=extract_array_from_mask,<EOL>zoom_around_mask=zoom_around_mask,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec,<EOL>output_path=output_path, output_format=output_format)<EOL><DEDENT>if should_plot_model_image:<EOL><INDENT>lens_plotter_util.plot_model_data(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec,<EOL>output_path=output_path, output_format=output_format)<EOL><DEDENT>if should_plot_lens_model_image:<EOL><INDENT>lens_plotter_util.plot_model_image_of_planes(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask,<EOL>plot_foreground=True,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec,<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL><DEDENT>if should_plot_source_model_image:<EOL><INDENT>lens_plotter_util.plot_model_image_of_planes(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask,<EOL>plot_source=True,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec,<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL><DEDENT>if should_plot_source_plane_image:<EOL><INDENT>if fit.total_inversions == <NUM_LIT:0>:<EOL><INDENT>plane_plotters.plot_plane_image(<EOL>plane=fit.tracer.source_plane, plot_grid=True,<EOL>units=units, figsize=(<NUM_LIT:20>, <NUM_LIT:20>),<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL><DEDENT>elif fit.total_inversions == <NUM_LIT:1>:<EOL><INDENT>inversion_plotters.plot_reconstructed_pixelization(<EOL>inversion=fit.inversion, should_plot_grid=True,<EOL>units=units, figsize=(<NUM_LIT:20>, <NUM_LIT:20>),<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL><DEDENT><DEDENT>if should_plot_residual_map:<EOL><INDENT>lens_plotter_util.plot_residual_map(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec,<EOL>output_path=output_path, output_format=output_format)<EOL><DEDENT>if should_plot_chi_squared_map:<EOL><INDENT>lens_plotter_util.plot_chi_squared_map(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec,<EOL>output_path=output_path, output_format=output_format)<EOL><DEDENT>

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_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.


def plot_fit_subplot_lens_and_source_planes(<EOL>fit, should_plot_mask=True, extract_array_from_mask=False, zoom_around_mask=False,<EOL>should_plot_source_grid=False, positions=None, should_plot_image_plane_pix=False, plot_mass_profile_centres=True,<EOL>units='<STR_LIT>', figsize=None, aspect='<STR_LIT>',<EOL>cmap='<STR_LIT>', norm='<STR_LIT>', norm_min=None, norm_max=None, linthresh=<NUM_LIT>, linscale=<NUM_LIT>,<EOL>cb_ticksize=<NUM_LIT:10>, cb_fraction=<NUM_LIT>, cb_pad=<NUM_LIT>, cb_tick_values=None, cb_tick_labels=None,<EOL>titlesize=<NUM_LIT:10>, xlabelsize=<NUM_LIT:10>, ylabelsize=<NUM_LIT:10>, xyticksize=<NUM_LIT:10>,<EOL>mask_pointsize=<NUM_LIT:10>, position_pointsize=<NUM_LIT:10>, grid_pointsize=<NUM_LIT:1>,<EOL>output_path=None, output_filename='<STR_LIT>', output_format='<STR_LIT>'):

rows, columns, figsize_tool = plotter_util.get_subplot_rows_columns_figsize(number_subplots=<NUM_LIT:9>)<EOL>mask = lens_plotter_util.get_mask(fit=fit, should_plot_mask=should_plot_mask)<EOL>if figsize is None:<EOL><INDENT>figsize = figsize_tool<EOL><DEDENT>plt.figure(figsize=figsize)<EOL>kpc_per_arcsec = fit.tracer.image_plane.kpc_per_arcsec<EOL>image_plane_pix_grid = lens_plotter_util.get_image_plane_pix_grid(should_plot_image_plane_pix, fit)<EOL>plt.subplot(rows, columns, <NUM_LIT:1>)<EOL>lens_plotter_util.plot_image(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask, positions=positions,<EOL>image_plane_pix_grid=image_plane_pix_grid, as_subplot=True,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>grid_pointsize=grid_pointsize, position_pointsize=position_pointsize, mask_pointsize=mask_pointsize,<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL>plt.subplot(rows, columns, <NUM_LIT:2>)<EOL>lens_plotter_util.plot_noise_map(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask, positions=None, as_subplot=True,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>position_pointsize=position_pointsize, mask_pointsize=mask_pointsize,<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL>plt.subplot(rows, columns, <NUM_LIT:3>)<EOL>lens_plotter_util.plot_signal_to_noise_map(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask, positions=None, as_subplot=True,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>position_pointsize=position_pointsize, mask_pointsize=mask_pointsize,<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL>plt.subplot(rows, columns, <NUM_LIT:4>)<EOL>lens_plotter_util.plot_lens_subtracted_image(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask, positions=positions, as_subplot=True,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>title='<STR_LIT>', titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize,<EOL>position_pointsize=position_pointsize, xyticksize=xyticksize,<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL>if fit.tracer.image_plane.has_light_profile:<EOL><INDENT>plt.subplot(rows, columns, <NUM_LIT:5>)<EOL>lens_plotter_util.plot_model_image_of_planes(<EOL>fit=fit, plot_foreground=True, mask=mask, extract_array_from_mask=extract_array_from_mask,<EOL>zoom_around_mask=zoom_around_mask, plot_mass_profile_centres=plot_mass_profile_centres, as_subplot=True,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>title='<STR_LIT>', titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize,<EOL>xyticksize=xyticksize,<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL><DEDENT>plt.subplot(rows, columns, <NUM_LIT:6>)<EOL>lens_plotter_util.plot_model_image_of_planes(<EOL>fit=fit, plot_source=True, mask=mask, extract_array_from_mask=extract_array_from_mask,<EOL>zoom_around_mask=zoom_around_mask, plot_mass_profile_centres=plot_mass_profile_centres, as_subplot=True,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>title='<STR_LIT>', titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize,<EOL>xyticksize=xyticksize,<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL>if fit.total_inversions == <NUM_LIT:0>:<EOL><INDENT>plt.subplot(rows, columns, <NUM_LIT:7>)<EOL>plane_plotters.plot_plane_image(<EOL>plane=fit.tracer.source_plane, positions=None, plot_grid=should_plot_source_grid, as_subplot=True,<EOL>units=units, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad,<EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>grid_pointsize=grid_pointsize, position_pointsize=position_pointsize,<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL><DEDENT>elif fit.total_inversions == <NUM_LIT:1>:<EOL><INDENT>ratio = float((fit.inversion.mapper.geometry.arc_second_maxima[<NUM_LIT:1>] - fit.inversion.mapper.geometry.arc_second_minima[<NUM_LIT:1>]) /(fit.inversion.mapper.geometry.arc_second_maxima[<NUM_LIT:0>] - fit.inversion.mapper.geometry.arc_second_minima[<NUM_LIT:0>]))<EOL>if aspect is '<STR_LIT>':<EOL><INDENT>aspect_inv = ratio<EOL><DEDENT>elif aspect is '<STR_LIT>':<EOL><INDENT>aspect_inv = <NUM_LIT:1.0> / ratio<EOL><DEDENT>elif aspect is '<STR_LIT>':<EOL><INDENT>aspect_inv = <NUM_LIT:1.0><EOL><DEDENT>plt.subplot(rows, columns, <NUM_LIT:7>, aspect=float(aspect_inv))<EOL>inversion_plotters.plot_reconstructed_pixelization(<EOL>inversion=fit.inversion, positions=None, should_plot_grid=False, should_plot_centres=False, as_subplot=True,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=None,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad,<EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>output_path=output_path, output_filename=None, output_format=output_format)<EOL><DEDENT>plt.subplot(rows, columns, <NUM_LIT:8>)<EOL>lens_plotter_util.plot_residual_map(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask, as_subplot=True,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad,<EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL>plt.subplot(rows, columns, <NUM_LIT:9>)<EOL>lens_plotter_util.plot_chi_squared_map(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask, as_subplot=True,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad,<EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL>plotter_util.output_subplot_array(output_path=output_path, output_filename=output_filename,<EOL>output_format=output_format)<EOL>plt.close()<EOL>

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.


def plot_fit_subplot_lens_plane_only(<EOL>fit, should_plot_mask=True, extract_array_from_mask=False, zoom_around_mask=False, positions=None,<EOL>should_plot_image_plane_pix=False,<EOL>units='<STR_LIT>', figsize=None, aspect='<STR_LIT>',<EOL>cmap='<STR_LIT>', norm='<STR_LIT>', norm_min=None, norm_max=None, linthresh=<NUM_LIT>, linscale=<NUM_LIT>,<EOL>cb_ticksize=<NUM_LIT:10>, cb_fraction=<NUM_LIT>, cb_pad=<NUM_LIT>, cb_tick_values=None, cb_tick_labels=None,<EOL>titlesize=<NUM_LIT:10>, xlabelsize=<NUM_LIT:10>, ylabelsize=<NUM_LIT:10>, xyticksize=<NUM_LIT:10>,<EOL>mask_pointsize=<NUM_LIT:10>, position_pointsize=<NUM_LIT:10>, grid_pointsize=<NUM_LIT:1>,<EOL>output_path=None, output_filename='<STR_LIT>', output_format='<STR_LIT>'):

rows, columns, figsize_tool = plotter_util.get_subplot_rows_columns_figsize(number_subplots=<NUM_LIT:6>)<EOL>mask = lens_plotter_util.get_mask(fit=fit, should_plot_mask=should_plot_mask)<EOL>if figsize is None:<EOL><INDENT>figsize = figsize_tool<EOL><DEDENT>plt.figure(figsize=figsize)<EOL>plt.subplot(rows, columns, <NUM_LIT:1>)<EOL>kpc_per_arcsec = fit.tracer.image_plane.kpc_per_arcsec<EOL>image_plane_pix_grid = lens_plotter_util.get_image_plane_pix_grid(should_plot_image_plane_pix, fit)<EOL>lens_plotter_util.plot_image(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask,<EOL>positions=positions, image_plane_pix_grid=image_plane_pix_grid, as_subplot=True,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>grid_pointsize=grid_pointsize, position_pointsize=position_pointsize, mask_pointsize=mask_pointsize,<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL>plt.subplot(rows, columns, <NUM_LIT:2>)<EOL>lens_plotter_util.plot_noise_map(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask,<EOL>positions=positions, as_subplot=True,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>position_pointsize=position_pointsize, mask_pointsize=mask_pointsize,<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL>plt.subplot(rows, columns, <NUM_LIT:3>)<EOL>lens_plotter_util.plot_signal_to_noise_map(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask,<EOL>positions=positions, as_subplot=True,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>position_pointsize=position_pointsize, mask_pointsize=mask_pointsize,<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL>plt.subplot(rows, columns, <NUM_LIT:4>)<EOL>lens_plotter_util.plot_model_data(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask, as_subplot=True,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL>plt.subplot(rows, columns, <NUM_LIT:5>)<EOL>lens_plotter_util.plot_residual_map(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask, as_subplot=True,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL>plt.subplot(rows, columns, <NUM_LIT:6>)<EOL>lens_plotter_util.plot_chi_squared_map(<EOL>fit=fit, mask=mask, extract_array_from_mask=extract_array_from_mask, zoom_around_mask=zoom_around_mask, as_subplot=True,<EOL>units=units, kpc_per_arcsec=kpc_per_arcsec, figsize=figsize, aspect=aspect,<EOL>cmap=cmap, norm=norm, norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad, <EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels,<EOL>titlesize=titlesize, xlabelsize=xlabelsize, ylabelsize=ylabelsize, xyticksize=xyticksize,<EOL>output_path=output_path, output_filename='<STR_LIT>', output_format=output_format)<EOL>plotter_util.output_subplot_array(output_path=output_path, output_filename=output_filename,<EOL>output_format=output_format)<EOL>plt.close()<EOL>


def __init__(self, lens_data, tracer_normal, tracer_sensitive):

AbstractSensitivityFit.__init__(self=self, tracer_normal=tracer_normal, tracer_sensitive=tracer_sensitive)<EOL>self.fit_normal = lens_fit.LensProfileFit(lens_data=lens_data, tracer=tracer_normal)<EOL>self.fit_sensitive = lens_fit.LensProfileFit(lens_data=lens_data, tracer=tracer_sensitive)<EOL>

Evaluate the sensitivity of a profile fit to a specific component of a lens model and tracer. This is \
        performed by evaluating the likelihood of a fit to an image using two tracers:

        1) A 'normal tracer', which uses the same lens model as a the simulated lens data. This gives a baseline \
           value of the likelihood we can expect when we fit the model to itself.

        2) A 'sensitive tracer', which uses the same lens model as the simulated lens data, but also includes the \
           additional model components (e.g. a mass clump 'subhalo') which we are testing our sensitivity to.

        The difference in likelihood of these two fits informs us of how sensitive we are to the component in the \
        second tracer. For example, if the difference in likelihood is neglible, it means the model component had no \
        impact on our fit, meaning we are not sensitive to its properties.

        Parameters
        ----------
        lens_data: lens_data.LensData
            A simulated lens data which is used to determine our sensitiivity to specific model components.
        tracer_normal : ray_tracing.AbstractTracer
            A tracer whose galaxies have the same model components (e.g. light profiles, mass profiles) as the \
            lens data that we are fitting.
       tracer_sensitive : ray_tracing.AbstractTracerNonStack
            A tracer whose galaxies have the same model components (e.g. light profiles, mass profiles) as the \
            lens data that we are fitting, but also addition components (e.g. mass clumps) which we measure \
            how sensitive we are too.


def fit_lens_data_with_sensitivity_tracers(lens_data, tracer_normal, tracer_sensitive):

if (tracer_normal.has_light_profile and tracer_sensitive.has_light_profile) and(not tracer_normal.has_pixelization and not tracer_sensitive.has_pixelization):<EOL><INDENT>return SensitivityProfileFit(lens_data=lens_data, tracer_normal=tracer_normal,<EOL>tracer_sensitive=tracer_sensitive)<EOL><DEDENT>elif (not tracer_normal.has_light_profile and not tracer_sensitive.has_light_profile) and(tracer_normal.has_pixelization and tracer_sensitive.has_pixelization):<EOL><INDENT>return SensitivityInversionFit(lens_data=lens_data, tracer_normal=tracer_normal,<EOL>tracer_sensitive=tracer_sensitive)<EOL><DEDENT>else:<EOL><INDENT>raise exc.FittingException('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>

Fit lens data with a normal tracer and sensitivity tracer, to determine our sensitivity to a selection of \
    galaxy components. This factory automatically determines the type of fit based on the properties of the galaxies \
    in the tracers.

    Parameters
    -----------
    lens_data : lens_data.LensData or lens_data.LensDataHyper
        The lens-images that is fitted.
    tracer_normal : ray_tracing.AbstractTracer
        A tracer whose galaxies have the same model components (e.g. light profiles, mass profiles) as the \
        lens data that we are fitting.
    tracer_sensitive : ray_tracing.AbstractTracerNonStack
        A tracer whose galaxies have the same model components (e.g. light profiles, mass profiles) as the \
        lens data that we are fitting, but also addition components (e.g. mass clumps) which we measure \
        how sensitive we are too.


def __init__(self, positions, noise_map):

self.positions = positions<EOL>self.noise_map = noise_map<EOL>

A lens position fitter, which takes a set of positions (e.g. from a plane in the tracer) and computes \
        their maximum separation, such that points which tracer closer to one another have a higher likelihood.

        Parameters
        -----------
        positions : [[]]
            The (y,x) arc-second coordinates of positions which the maximum distance and likelihood is computed using.
        noise_map : ndarray | float
            The noise-value assumed when computing the likelihood.


def __init__(self, lens_data, tracer, padded_tracer=None):

blurred_profile_image_1d = util.blurred_image_1d_from_1d_unblurred_and_blurring_images(<EOL>unblurred_image_1d=tracer.image_plane_image_1d, blurring_image_1d=tracer.image_plane_blurring_image_1d,<EOL>convolver=lens_data.convolver_image)<EOL>blurred_profile_image = lens_data.map_to_scaled_array(array_1d=blurred_profile_image_1d)<EOL>profile_subtracted_image_1d = lens_data.image_1d - blurred_profile_image_1d<EOL>inversion = inversions.inversion_from_image_mapper_and_regularization(<EOL>image_1d=profile_subtracted_image_1d, noise_map_1d=lens_data.noise_map_1d,<EOL>convolver=lens_data.convolver_mapping_matrix, mapper=tracer.mappers_of_planes[-<NUM_LIT:1>],<EOL>regularization=tracer.regularizations_of_planes[-<NUM_LIT:1>])<EOL>model_image = blurred_profile_image + inversion.reconstructed_data<EOL>super(LensProfileInversionFit, self).__init__(tracer=tracer,<EOL>padded_tracer=padded_tracer,<EOL>lens_data=lens_data,<EOL>model_image=model_image,<EOL>inversion=inversion)<EOL>self.convolver_image = lens_data.convolver_image<EOL>self.blurred_profile_image = blurred_profile_image<EOL>self.profile_subtracted_image = lens_data.image - self.blurred_profile_image<EOL>

An  lens profile and inversion fitter, which first generates and subtracts the image-plane \
        image of all galaxies (with light profiles) in the tracer, blurs it with the PSF and fits the residual image \
        with an inversion using the mapper(s) and regularization(s) in the galaxy's of the tracer.

        This inversion use's the lens-image, its PSF and an input noise-map.

        If a padded tracer is supplied, the blurred profile image's can be generated over the entire image and thus \
        without the mask.

        Parameters
        -----------
        lens_data : lens_data.LensData
            The lens-image that is fitted.
        tracer : ray_tracing.Tracer
            The tracer, which describes the ray-tracing and strong lens configuration.
        padded_tracer : ray_tracing.TracerNonStack or None
            A tracer with an identical strong lens configuration to the tracer above, but using the lens data's \
            padded grid_stack such that unmasked model-images can be computed.


An  lens inversion fitter, which fits the lens data an inversion using the mapper(s) and \
        regularization(s) in the galaxies of the tracer.

        This inversion use's the lens-image, its PSF and an input noise-map.

        Parameters
        -----------
        lens_data : lens_data.LensData
            The lens-image that is fitted.
        tracer : ray_tracing.Tracer
            The tracer, which describes the ray-tracing and strong lens configuration.


if not as_subplot:<EOL><INDENT>fig = plt.figure(figsize=figsize)<EOL>return fig<EOL><DEDENT>

Setup a figure for plotting an image.

    Parameters
    -----------
    figsize : (int, int)
        The size of the figure in (rows, columns).
    as_subplot : bool
        If the figure is a subplot, the setup_figure function is omitted to ensure that each subplot does not create a \
        new figure and so that it can be output using the *output_subplot_array* function.


if number_subplots <= <NUM_LIT:2>:<EOL><INDENT>return <NUM_LIT:1>, <NUM_LIT:2>, (<NUM_LIT>, <NUM_LIT:8>)<EOL><DEDENT>elif number_subplots <= <NUM_LIT:4>:<EOL><INDENT>return <NUM_LIT:2>, <NUM_LIT:2>, (<NUM_LIT>, <NUM_LIT:10>)<EOL><DEDENT>elif number_subplots <= <NUM_LIT:6>:<EOL><INDENT>return <NUM_LIT:2>, <NUM_LIT:3>, (<NUM_LIT>, <NUM_LIT:12>)<EOL><DEDENT>elif number_subplots <= <NUM_LIT:9>:<EOL><INDENT>return <NUM_LIT:3>, <NUM_LIT:3>, (<NUM_LIT>, <NUM_LIT:20>)<EOL><DEDENT>elif number_subplots <= <NUM_LIT:12>:<EOL><INDENT>return <NUM_LIT:3>, <NUM_LIT:4>, (<NUM_LIT>, <NUM_LIT:20>)<EOL><DEDENT>elif number_subplots <= <NUM_LIT:16>:<EOL><INDENT>return <NUM_LIT:4>, <NUM_LIT:4>, (<NUM_LIT>, <NUM_LIT:20>)<EOL><DEDENT>elif number_subplots <= <NUM_LIT:20>:<EOL><INDENT>return <NUM_LIT:4>, <NUM_LIT:5>, (<NUM_LIT>, <NUM_LIT:20>)<EOL><DEDENT>else:<EOL><INDENT>return <NUM_LIT:6>, <NUM_LIT:6>, (<NUM_LIT>, <NUM_LIT:20>)<EOL><DEDENT>

Get the size of a sub plot in (rows, columns), based on the number of subplots that are going to be plotted.

    Parameters
    -----------
    number_subplots : int
        The number of subplots that are to be plotted in the figure.


plt.title(title, fontsize=titlesize)<EOL>

Set the title and title size of the figure.

    Parameters
    -----------
    title : str
        The text of the title.
    titlesize : int
        The size of of the title of the figure.


if not as_subplot:<EOL><INDENT>plt.close()<EOL><DEDENT>

After plotting and outputting a figure, close the matplotlib figure instance (omit if a subplot).

    Parameters
    -----------
    as_subplot : bool
        Whether the figure is part of subplot, in which case the figure is not closed so that the entire figure can \
        be closed later after output.


def get_extent(array, units, kpc_per_arcsec, xticks_manual, yticks_manual):

if xticks_manual is not None and yticks_manual is not None:<EOL><INDENT>return np.asarray([xticks_manual[<NUM_LIT:0>], xticks_manual[<NUM_LIT:3>], yticks_manual[<NUM_LIT:0>], yticks_manual[<NUM_LIT:3>]])<EOL><DEDENT>if units in '<STR_LIT>':<EOL><INDENT>return np.asarray([<NUM_LIT:0>, array.shape[<NUM_LIT:1>], <NUM_LIT:0>, array.shape[<NUM_LIT:0>]])<EOL><DEDENT>elif units in '<STR_LIT>' or kpc_per_arcsec is None:<EOL><INDENT>return np.asarray([array.arc_second_minima[<NUM_LIT:1>], array.arc_second_maxima[<NUM_LIT:1>],<EOL>array.arc_second_minima[<NUM_LIT:0>], array.arc_second_maxima[<NUM_LIT:0>]])<EOL><DEDENT>elif units in '<STR_LIT>':<EOL><INDENT>return list(map(lambda tick : tick*kpc_per_arcsec,<EOL>np.asarray([array.arc_second_minima[<NUM_LIT:1>], array.arc_second_maxima[<NUM_LIT:1>],<EOL>array.arc_second_minima[<NUM_LIT:0>], array.arc_second_maxima[<NUM_LIT:0>]])))<EOL><DEDENT>else:<EOL><INDENT>raise exc.PlottingException('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>

Get the extent of the dimensions of the array in the units of the figure (e.g. arc-seconds or kpc).

    This is used to set the extent of the array and thus the y / x axis limits.

    Parameters
    -----------
    array : data.array.scaled_array.ScaledArray
        The 2D array of data which is plotted.
    units : str
        The units of the y / x axis of the plots, in arc-seconds ('arcsec') or kiloparsecs ('kpc').
    kpc_per_arcsec : float
        The conversion factor between arc-seconds and kiloparsecs, required to plot the units in kpc.
    xticks_manual :  [] or None
        If input, the xticks do not use the array's default xticks but instead overwrite them as these values.
    yticks_manual :  [] or None
        If input, the yticks do not use the array's default yticks but instead overwrite them as these values.


def get_normalization_scale(norm, norm_min, norm_max, linthresh, linscale):

if norm is '<STR_LIT>':<EOL><INDENT>return colors.Normalize(vmin=norm_min, vmax=norm_max)<EOL><DEDENT>elif norm is '<STR_LIT>':<EOL><INDENT>if norm_min == <NUM_LIT:0.0>:<EOL><INDENT>norm_min = <NUM_LIT><EOL><DEDENT>return colors.LogNorm(vmin=norm_min, vmax=norm_max)<EOL><DEDENT>elif norm is '<STR_LIT>':<EOL><INDENT>return colors.SymLogNorm(linthresh=linthresh, linscale=linscale, vmin=norm_min, vmax=norm_max)<EOL><DEDENT>else:<EOL><INDENT>raise exc.PlottingException('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>

Get the normalization scale of the colormap. This will be scaled based on the input min / max normalization \
    values.

    For a 'symmetric_log' colormap, linthesh and linscale also change the colormap.

    If norm_min / norm_max are not supplied, the minimum / maximum values of the array of data are used.

    Parameters
    -----------
    array : data.array.scaled_array.ScaledArray
        The 2D array of data which is plotted.
    norm_min : float or None
        The minimum array value the colormap map spans (all values below this value are plotted the same color).
    norm_max : float or None
        The maximum array value the colormap map spans (all values above this value are plotted the same color).
    linthresh : float
        For the 'symmetric_log' colormap normalization ,this specifies the range of values within which the colormap \
        is linear.
    linscale : float
        For the 'symmetric_log' colormap normalization, this allowws the linear range set by linthresh to be stretched \
        relative to the logarithmic range.


def plot_origin(array, origin, units, kpc_per_arcsec, zoom_offset_arcsec):

if origin is not None:<EOL><INDENT>origin_grid = np.asarray(origin)<EOL>if zoom_offset_arcsec is not None:<EOL><INDENT>origin_grid -= zoom_offset_arcsec<EOL><DEDENT>origin_units = convert_grid_units(array=array, grid_arcsec=origin_grid, units=units,<EOL>kpc_per_arcsec=kpc_per_arcsec)<EOL>plt.scatter(y=origin_units[<NUM_LIT:0>], x=origin_units[<NUM_LIT:1>], s=<NUM_LIT>, c='<STR_LIT:k>', marker='<STR_LIT:x>')<EOL><DEDENT>

Plot the (y,x) origin ofo the array's coordinates as a 'x'.

    Parameters
    -----------
    array : data.array.scaled_array.ScaledArray
        The 2D array of data which is plotted.
    origin : (float, float).
        The origin of the coordinate system of the array, which is plotted as an 'x' on the image if input.
    units : str
        The units of the y / x axis of the plots, in arc-seconds ('arcsec') or kiloparsecs ('kpc').
    kpc_per_arcsec : float or None
        The conversion factor between arc-seconds and kiloparsecs, required to plot the units in kpc.


def set_colorbar(cb_ticksize, cb_fraction, cb_pad, cb_tick_values, cb_tick_labels):

if cb_tick_values is None and cb_tick_labels is None:<EOL><INDENT>cb = plt.colorbar(fraction=cb_fraction, pad=cb_pad)<EOL><DEDENT>elif cb_tick_values is not None and cb_tick_labels is not None:<EOL><INDENT>cb = plt.colorbar(fraction=cb_fraction, pad=cb_pad, ticks=cb_tick_values)<EOL>cb.ax.set_yticklabels(cb_tick_labels)<EOL><DEDENT>else:<EOL><INDENT>raise exc.PlottingException('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>cb.ax.tick_params(labelsize=cb_ticksize)<EOL>

Setup the colorbar of the figure, specifically its ticksize and the size is appears relative to the figure.

    Parameters
    -----------
    cb_ticksize : int
        The size of the tick labels on the colorbar.
    cb_fraction : float
        The fraction of the figure that the colorbar takes up, which resizes the colorbar relative to the figure.
    cb_pad : float
        Pads the color bar in the figure, which resizes the colorbar relative to the figure.
    cb_tick_values : [float]
        Manually specified values of where the colorbar tick labels appear on the colorbar.
    cb_tick_labels : [float]
        Manually specified labels of the color bar tick labels, which appear where specified by cb_tick_values.


def plot_grid(grid_arcsec, array, units, kpc_per_arcsec, pointsize, zoom_offset_arcsec):

if grid_arcsec is not None:<EOL><INDENT>if zoom_offset_arcsec is not None:<EOL><INDENT>grid_arcsec -= zoom_offset_arcsec<EOL><DEDENT>grid_units = convert_grid_units(grid_arcsec=grid_arcsec, array=array, units=units,<EOL>kpc_per_arcsec=kpc_per_arcsec)<EOL>plt.scatter(y=np.asarray(grid_units[:, <NUM_LIT:0>]), x=np.asarray(grid_units[:, <NUM_LIT:1>]), s=pointsize, c='<STR_LIT:k>')<EOL><DEDENT>

Plot a grid of points over the array of data on the figure.

     Parameters
     -----------.
     grid_arcsec : ndarray or data.array.grids.RegularGrid
         A grid of (y,x) coordinates in arc-seconds which may be plotted over the array.
     array : data.array.scaled_array.ScaledArray
        The 2D array of data which is plotted.
     units : str
         The units of the y / x axis of the plots, in arc-seconds ('arcsec') or kiloparsecs ('kpc').
     kpc_per_arcsec : float or None
         The conversion factor between arc-seconds and kiloparsecs, required to plot the units in kpc.
     grid_pointsize : int
         The size of the points plotted to show the grid.


def plot_figure(array, as_subplot, units, kpc_per_arcsec, figsize, aspect, cmap, norm, norm_min, norm_max,<EOL>linthresh, linscale, xticks_manual, yticks_manual):

fig = plotter_util.setup_figure(figsize=figsize, as_subplot=as_subplot)<EOL>norm_min, norm_max = get_normalization_min_max(array=array, norm_min=norm_min, norm_max=norm_max)<EOL>norm_scale = get_normalization_scale(norm=norm, norm_min=norm_min, norm_max=norm_max,<EOL>linthresh=linthresh, linscale=linscale)<EOL>extent = get_extent(array=array, units=units, kpc_per_arcsec=kpc_per_arcsec,<EOL>xticks_manual=xticks_manual, yticks_manual=yticks_manual)<EOL>plt.imshow(array, aspect=aspect, cmap=cmap, norm=norm_scale, extent=extent)<EOL>return fig<EOL>

Open a matplotlib figure and plot the array of data on it.

    Parameters
    -----------
    array : data.array.scaled_array.ScaledArray
        The 2D array of data which is plotted.
    as_subplot : bool
        Whether the array is plotted as part of a subplot, in which case the grid figure is not opened / closed.
    units : str
        The units of the y / x axis of the plots, in arc-seconds ('arcsec') or kiloparsecs ('kpc').
    kpc_per_arcsec : float or None
        The conversion factor between arc-seconds and kiloparsecs, required to plot the units in kpc.
    figsize : (int, int)
        The size of the figure in (rows, columns).
    aspect : str
        The aspect ratio of the array, specifically whether it is forced to be square ('equal') or adapts its size to \
        the figure size ('auto').
    cmap : str
        The colormap the array is plotted using, which may be chosen from the standard matplotlib colormaps.
    norm : str
        The normalization of the colormap used to plot the image, specifically whether it is linear ('linear'), log \
        ('log') or a symmetric log normalization ('symmetric_log').
    norm_min : float or None
        The minimum array value the colormap map spans (all values below this value are plotted the same color).
    norm_max : float or None
        The maximum array value the colormap map spans (all values above this value are plotted the same color).
    linthresh : float
        For the 'symmetric_log' colormap normalization ,this specifies the range of values within which the colormap \
        is linear.
    linscale : float
        For the 'symmetric_log' colormap normalization, this allowws the linear range set by linthresh to be stretched \
        relative to the logarithmic range.
    xticks_manual :  [] or None
        If input, the xticks do not use the array's default xticks but instead overwrite them as these values.
    yticks_manual :  [] or None
        If input, the yticks do not use the array's default yticks but instead overwrite them as these values.


def plot_array(array, origin=None, mask=None, extract_array_from_mask=False, zoom_around_mask=False,<EOL>should_plot_border=False, positions=None, centres=None, axis_ratios=None, phis=None, grid=None,<EOL>as_subplot=False,<EOL>units='<STR_LIT>', kpc_per_arcsec=None, figsize=(<NUM_LIT:7>, <NUM_LIT:7>), aspect='<STR_LIT>',<EOL>cmap='<STR_LIT>', norm='<STR_LIT>', norm_min=None, norm_max=None, linthresh=<NUM_LIT>, linscale=<NUM_LIT>,<EOL>cb_ticksize=<NUM_LIT:10>, cb_fraction=<NUM_LIT>, cb_pad=<NUM_LIT>, cb_tick_values=None, cb_tick_labels=None,<EOL>title='<STR_LIT>', titlesize=<NUM_LIT:16>, xlabelsize=<NUM_LIT:16>, ylabelsize=<NUM_LIT:16>, xyticksize=<NUM_LIT:16>,<EOL>mask_pointsize=<NUM_LIT:10>, border_pointsize=<NUM_LIT:2>, position_pointsize=<NUM_LIT:30>, grid_pointsize=<NUM_LIT:1>,<EOL>xticks_manual=None, yticks_manual=None,<EOL>output_path=None, output_format='<STR_LIT>', output_filename='<STR_LIT>'):

if array is None:<EOL><INDENT>return<EOL><DEDENT>if extract_array_from_mask and mask is not None:<EOL><INDENT>array = np.add(array, <NUM_LIT:0.0>, out=np.zeros_like(array), where=np.asarray(mask) == <NUM_LIT:0>)<EOL><DEDENT>if zoom_around_mask and mask is not None:<EOL><INDENT>array = array.zoomed_scaled_array_around_mask(mask=mask, buffer=<NUM_LIT:2>)<EOL>zoom_offset_pixels = np.asarray(mask.zoom_offset_pixels)<EOL>zoom_offset_arcsec = np.asarray(mask.zoom_offset_arcsec)<EOL><DEDENT>else:<EOL><INDENT>zoom_offset_pixels = None<EOL>zoom_offset_arcsec = None<EOL><DEDENT>if aspect is '<STR_LIT>':<EOL><INDENT>aspect = float(array.shape_arcsec[<NUM_LIT:1>]) / float(array.shape_arcsec[<NUM_LIT:0>])<EOL><DEDENT>fig = plot_figure(array=array, as_subplot=as_subplot, units=units, kpc_per_arcsec=kpc_per_arcsec,<EOL>figsize=figsize, aspect=aspect, cmap=cmap, norm=norm,<EOL>norm_min=norm_min, norm_max=norm_max, linthresh=linthresh, linscale=linscale,<EOL>xticks_manual=xticks_manual, yticks_manual=yticks_manual)<EOL>plotter_util.set_title(title=title, titlesize=titlesize)<EOL>set_xy_labels_and_ticksize(units=units, kpc_per_arcsec=kpc_per_arcsec, xlabelsize=xlabelsize, ylabelsize=ylabelsize,<EOL>xyticksize=xyticksize)<EOL>set_colorbar(cb_ticksize=cb_ticksize, cb_fraction=cb_fraction, cb_pad=cb_pad,<EOL>cb_tick_values=cb_tick_values, cb_tick_labels=cb_tick_labels)<EOL>plot_origin(array=array, origin=origin, units=units, kpc_per_arcsec=kpc_per_arcsec,<EOL>zoom_offset_arcsec=zoom_offset_arcsec)<EOL>plot_mask(mask=mask, units=units, kpc_per_arcsec=kpc_per_arcsec, pointsize=mask_pointsize,<EOL>zoom_offset_pixels=zoom_offset_pixels)<EOL>plot_border(mask=mask, should_plot_border=should_plot_border, units=units, kpc_per_arcsec=kpc_per_arcsec,<EOL>pointsize=border_pointsize, zoom_offset_pixels=zoom_offset_pixels)<EOL>plot_points(points_arcsec=positions, array=array, units=units, kpc_per_arcsec=kpc_per_arcsec,<EOL>pointsize=position_pointsize, zoom_offset_arcsec=zoom_offset_arcsec)<EOL>plot_grid(grid_arcsec=grid, array=array, units=units, kpc_per_arcsec=kpc_per_arcsec, pointsize=grid_pointsize,<EOL>zoom_offset_arcsec=zoom_offset_arcsec)<EOL>plot_centres(array=array, centres=centres, units=units, kpc_per_arcsec=kpc_per_arcsec,<EOL>zoom_offset_arcsec=zoom_offset_arcsec)<EOL>plot_ellipses(fig=fig, array=array, centres=centres, axis_ratios=axis_ratios, phis=phis, units=units,<EOL>kpc_per_arcsec=kpc_per_arcsec, zoom_offset_arcsec=zoom_offset_arcsec)<EOL>plotter_util.output_figure(array, as_subplot=as_subplot, output_path=output_path, output_filename=output_filename,<EOL>output_format=output_format)<EOL>plotter_util.close_figure(as_subplot=as_subplot)<EOL>

Plot an array of data as a figure.

    Parameters
    -----------
    array : data.array.scaled_array.ScaledArray
        The 2D array of data which is plotted.
    origin : (float, float).
        The origin of the coordinate system of the array, which is plotted as an 'x' on the image if input.
    mask : data.array.mask.Mask
        The mask applied to the array, the edge of which is plotted as a set of points over the plotted array.
    extract_array_from_mask : bool
        The plotter array is extracted using the mask, such that masked values are plotted as zeros. This ensures \
        bright features outside the mask do not impact the color map of the plot.
    zoom_around_mask : bool
        If True, the 2D region of the array corresponding to the rectangle encompassing all unmasked values is \
        plotted, thereby zooming into the region of interest.
    should_plot_border : bool
        If a mask is supplied, its borders pixels (e.g. the exterior edge) is plotted if this is *True*.
    positions : [[]]
        Lists of (y,x) coordinates on the image which are plotted as colored dots, to highlight specific pixels.
    grid : data.array.grids.RegularGrid
        A grid of (y,x) coordinates which may be plotted over the plotted array.
    as_subplot : bool
        Whether the array is plotted as part of a subplot, in which case the grid figure is not opened / closed.
    units : str
        The units of the y / x axis of the plots, in arc-seconds ('arcsec') or kiloparsecs ('kpc').
    kpc_per_arcsec : float or None
        The conversion factor between arc-seconds and kiloparsecs, required to plot the units in kpc.
    figsize : (int, int)
        The size of the figure in (rows, columns).
    aspect : str
        The aspect ratio of the array, specifically whether it is forced to be square ('equal') or adapts its size to \
        the figure size ('auto').
    cmap : str
        The colormap the array is plotted using, which may be chosen from the standard matplotlib colormaps.
    norm : str
        The normalization of the colormap used to plot the image, specifically whether it is linear ('linear'), log \
        ('log') or a symmetric log normalization ('symmetric_log').
    norm_min : float or None
        The minimum array value the colormap map spans (all values below this value are plotted the same color).
    norm_max : float or None
        The maximum array value the colormap map spans (all values above this value are plotted the same color).
    linthresh : float
        For the 'symmetric_log' colormap normalization ,this specifies the range of values within which the colormap \
        is linear.
    linscale : float
        For the 'symmetric_log' colormap normalization, this allowws the linear range set by linthresh to be stretched \
        relative to the logarithmic range.
    cb_ticksize : int
        The size of the tick labels on the colorbar.
    cb_fraction : float
        The fraction of the figure that the colorbar takes up, which resizes the colorbar relative to the figure.
    cb_pad : float
        Pads the color bar in the figure, which resizes the colorbar relative to the figure.
    xlabelsize : int
        The fontsize of the x axes label.
    ylabelsize : int
        The fontsize of the y axes label.
    xyticksize : int
        The font size of the x and y ticks on the figure axes.
    mask_pointsize : int
        The size of the points plotted to show the mask.
    border_pointsize : int
        The size of the points plotted to show the borders.
    positions_pointsize : int
        The size of the points plotted to show the input positions.
    grid_pointsize : int
        The size of the points plotted to show the grid.
    xticks_manual :  [] or None
        If input, the xticks do not use the array's default xticks but instead overwrite them as these values.
    yticks_manual :  [] or None
        If input, the yticks do not use the array's default yticks but instead overwrite them as these values.
    output_path : str
        The path on the hard-disk where the figure is output.
    output_filename : str
        The filename of the figure that is output.
    output_format : str
        The format the figue is output:
        'show' - display on computer screen.
        'png' - output to hard-disk as a png.
        'fits' - output to hard-disk as a fits file.'

    Returns
    --------
    None

    Examples
    --------
        array_plotters.plot_array(
        array=image, origin=(0.0, 0.0), mask=circular_mask, extract_array_from_mask=True, zoom_around_mask=True,
        should_plot_border=False, positions=[[1.0, 1.0], [2.0, 2.0]], grid=None, as_subplot=False,
        units='arcsec', kpc_per_arcsec=None, figsize=(7,7), aspect='auto',
        cmap='jet', norm='linear, norm_min=None, norm_max=None, linthresh=None, linscale=None,
        cb_ticksize=10, cb_fraction=0.047, cb_pad=0.01, cb_tick_values=None, cb_tick_labels=None,
        title='Image', titlesize=16, xlabelsize=16, ylabelsize=16, xyticksize=16,
        mask_pointsize=10, border_pointsize=2, position_pointsize=10, grid_pointsize=10,
        xticks_manual=None, yticks_manual=None,
        output_path='/path/to/output', output_format='png', output_filename='image')


def set_xy_labels_and_ticksize(units, kpc_per_arcsec, ylabel, xlabelsize, ylabelsize, xyticksize):

plt.ylabel(ylabel=ylabel, fontsize=ylabelsize)<EOL>if units in '<STR_LIT>' or kpc_per_arcsec is None:<EOL><INDENT>plt.xlabel('<STR_LIT>', fontsize=xlabelsize)<EOL><DEDENT>elif units in '<STR_LIT>':<EOL><INDENT>plt.xlabel('<STR_LIT>', fontsize=xlabelsize)<EOL><DEDENT>else:<EOL><INDENT>raise exc.PlottingException('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>plt.tick_params(labelsize=xyticksize)<EOL>

Set the x and y labels of the figure, and set the fontsize of those labels.

    The x label is always the distance scale / radius, thus the x-label is either arc-seconds or kpc and depending \
    on the units the figure is plotted in.

    The ylabel is the physical quantity being plotted and is passed as an input parameter.

    Parameters
    -----------
    units : str
        The units of the y / x axis of the plots, in arc-seconds ('arcsec') or kiloparsecs ('kpc').
    kpc_per_arcsec : float
        The conversion factor between arc-seconds and kiloparsecs, required to plot the units in kpc.
    ylabel : str
        The y-label of the figure, which is the physical quantitiy being plotted.
    xlabelsize : int
        The fontsize of the x axes label.
    ylabelsize : int
        The fontsize of the y axes label.
    xyticksize : int
        The font size of the x and y ticks on the figure axes.


def plot_grid(grid, axis_limits=None, points=None, as_subplot=False,<EOL>units='<STR_LIT>', kpc_per_arcsec=None,<EOL>figsize=(<NUM_LIT:12>, <NUM_LIT:8>), pointsize=<NUM_LIT:5>, pointcolor='<STR_LIT:k>', xyticksize=<NUM_LIT:16>,<EOL>title='<STR_LIT>', titlesize=<NUM_LIT:16>, xlabelsize=<NUM_LIT:16>, ylabelsize=<NUM_LIT:16>,<EOL>output_path=None, output_format='<STR_LIT>', output_filename='<STR_LIT>'):

plotter_util.setup_figure(figsize=figsize, as_subplot=as_subplot)<EOL>grid = convert_grid_units(grid_arcsec=grid, units=units, kpc_per_arcsec=kpc_per_arcsec)<EOL>plt.scatter(y=np.asarray(grid[:, <NUM_LIT:0>]), x=np.asarray(grid[:, <NUM_LIT:1>]), s=pointsize, marker='<STR_LIT:.>')<EOL>plotter_util.set_title(title=title, titlesize=titlesize)<EOL>set_xy_labels(units, kpc_per_arcsec, xlabelsize, ylabelsize, xyticksize)<EOL>set_axis_limits(axis_limits)<EOL>plot_points(grid, points, pointcolor)<EOL>plt.tick_params(labelsize=xyticksize)<EOL>plotter_util.output_figure(None, as_subplot, output_path, output_filename, output_format)<EOL>plotter_util.close_figure(as_subplot=as_subplot)<EOL>

Plot a grid of (y,x) Cartesian coordinates as a scatter plot of points.

    Parameters
    -----------
    grid : data.array.grids.RegularGrid
        The (y,x) coordinates of the grid, in an array of shape (total_coordinates, 2).
    axis_limits : []
        The axis limits of the figure on which the grid is plotted, following [xmin, xmax, ymin, ymax].
    points : []
        A set of points that are plotted in a different colour for emphasis (e.g. to show the mappings between \
        different planes).
    as_subplot : bool
        Whether the grid is plotted as part of a subplot, in which case the grid figure is not opened / closed.
    units : str
        The units of the y / x axis of the plots, in arc-seconds ('arcsec') or kiloparsecs ('kpc').
    kpc_per_arcsec : float
        The conversion factor between arc-seconds and kiloparsecs, required to plot the units in kpc.
    figsize : (int, int)
        The size of the figure in (rows, columns).
    pointsize : int
        The size of the points plotted on the grid.
    xyticksize : int
        The font size of the x and y ticks on the figure axes.
    title : str
        The text of the title.
    titlesize : int
        The size of of the title of the figure.
    xlabelsize : int
        The fontsize of the x axes label.
    ylabelsize : int
        The fontsize of the y axes label.
    output_path : str
        The path on the hard-disk where the figure is output.
    output_filename : str
        The filename of the figure that is output.
    output_format : str
        The format the figue is output:
        'show' - display on computer screen.
        'png' - output to hard-disk as a png.


def convert_grid_units(grid_arcsec, units, kpc_per_arcsec):

if units in '<STR_LIT>' or kpc_per_arcsec is None:<EOL><INDENT>return grid_arcsec<EOL><DEDENT>elif units in '<STR_LIT>':<EOL><INDENT>return grid_arcsec * kpc_per_arcsec<EOL><DEDENT>

Convert the grid from its input units (arc-seconds) to the input unit (e.g. retain arc-seconds) or convert to \
    another set of units (kiloparsecs).

    Parameters
    -----------
    grid_arcsec : ndarray or data.array.grids.RegularGrid
        The (y,x) coordinates of the grid in arc-seconds, in an array of shape (total_coordinates, 2).
    units : str
        The units of the y / x axis of the plots, in arc-seconds ('arcsec') or kiloparsecs ('kpc').
    kpc_per_arcsec : float
        The conversion factor between arc-seconds and kiloparsecs, required to plot the units in kpc.


if axis_limits is not None:<EOL><INDENT>plt.axis(axis_limits)<EOL><DEDENT>

Set the axis limits of the figure the grid is plotted on.

    Parameters
    -----------
    axis_limits : []
        The axis limits of the figure on which the grid is plotted, following [xmin, xmax, ymin, ymax].


poisson_noise_map_options = sum([convert_poisson_noise_map_from_weight_map,<EOL>convert_poisson_noise_map_from_inverse_noise_map,<EOL>poisson_noise_map_from_image])<EOL>if poisson_noise_map_options == <NUM_LIT:0> and poisson_noise_map_path is not None:<EOL><INDENT>return PoissonNoiseMap.from_fits_with_pixel_scale(file_path=poisson_noise_map_path, hdu=poisson_noise_map_hdu,<EOL>pixel_scale=pixel_scale)<EOL><DEDENT>elif poisson_noise_map_from_image:<EOL><INDENT>if not (convert_from_electrons or convert_from_adus) and exposure_time_map is None:<EOL><INDENT>raise exc.DataException('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>if convert_from_adus and gain is None:<EOL><INDENT>raise exc.DataException('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>return PoissonNoiseMap.from_image_and_exposure_time_map(pixel_scale=pixel_scale, image=image,<EOL>exposure_time_map=exposure_time_map,<EOL>convert_from_electrons=convert_from_electrons,<EOL>gain=gain,<EOL>convert_from_adus=convert_from_adus)<EOL><DEDENT>elif convert_poisson_noise_map_from_weight_map and poisson_noise_map_path is not None:<EOL><INDENT>weight_map = Array.from_fits(file_path=poisson_noise_map_path, hdu=poisson_noise_map_hdu)<EOL>return PoissonNoiseMap.from_weight_map(weight_map=weight_map, pixel_scale=pixel_scale)<EOL><DEDENT>elif convert_poisson_noise_map_from_inverse_noise_map and poisson_noise_map_path is not None:<EOL><INDENT>inverse_noise_map = Array.from_fits(file_path=poisson_noise_map_path, hdu=poisson_noise_map_hdu)<EOL>return PoissonNoiseMap.from_inverse_noise_map(inverse_noise_map=inverse_noise_map, pixel_scale=pixel_scale)<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>

Factory for loading the Poisson noise-map from a .fits file.

    This factory also includes a number of routines for converting the Poisson noise-map from from other units (e.g. \
    a weight map) or computing the Poisson noise_map from other unblurred_image_1d (e.g. the ccd image).

    Parameters
    ----------
    poisson_noise_map_path : str
        The path to the poisson_noise_map .fits file containing the Poisson noise-map \
         (e.g. '/path/to/poisson_noise_map.fits')
    poisson_noise_map_hdu : int
        The hdu the poisson_noise_map is contained in the .fits file specified by *poisson_noise_map_path*.
    pixel_scale : float
        The size of each pixel in arc seconds.
    convert_poisson_noise_map_from_weight_map : bool
        If True, the Poisson noise-map loaded from the .fits file is converted from a weight-map to a noise-map (see \
        *NoiseMap.from_weight_map).
    convert_poisson_noise_map_from_inverse_noise_map : bool
        If True, the Poisson noise-map loaded from the .fits file is converted from an inverse noise-map to a \
        noise-map (see *NoiseMap.from_inverse_noise_map).
    poisson_noise_map_from_image : bool
        If True, the Poisson noise-map is estimated using the image.
    image : ndarray
        The image, which the Poisson noise-map can be calculated using.
    background_noise_map : ndarray
        The background noise-map, which the Poisson noise-map can be calculated using.
    exposure_time_map : ndarray
        The exposure-time map, which the Poisson noise-map can be calculated using.
    convert_from_electrons : bool
        If True, the input unblurred_image_1d are in units of electrons and all converted to electrons / second using the exposure \
        time map.
    gain : float
        The image gain, used for convert from ADUs.
    convert_from_adus : bool
        If True, the input unblurred_image_1d are in units of adus and all converted to electrons / second using the exposure \
        time map and gain.


def generate_poisson_noise(image, exposure_time_map, seed=-<NUM_LIT:1>):

setup_random_seed(seed)<EOL>image_counts = np.multiply(image, exposure_time_map)<EOL>return image - np.divide(np.random.poisson(image_counts, image.shape), exposure_time_map)<EOL>

Generate a two-dimensional poisson noise_maps-mappers from an image.

Values are computed from a Poisson distribution using the image's input values in units of counts.

Parameters
----------
image : ndarray
    The 2D image, whose values in counts are used to draw Poisson noise_maps values.
exposure_time_map : Union(ndarray, int)
    2D array of the exposure time in each pixel used to convert to / from counts and electrons per second.
seed : int
    The seed of the random number generator, used for the random noise_maps maps.

Returns
-------
poisson_noise_map: ndarray
    An array describing simulated poisson noise_maps


return np.multiply(array, self.exposure_time_map)<EOL>

For an array (in electrons per second) and an exposure time mappers, return an array in units counts.

Parameters
----------
array : ndarray
    The array the values are to be converted from electrons per seconds to counts.


@classmethod<EOL><INDENT>def from_fits_with_scale(cls, file_path, hdu, pixel_scale):<DEDENT>

return cls(array=array_util.numpy_array_2d_from_fits(file_path, hdu), pixel_scale=pixel_scale)<EOL>

Loads the PSF from a .fits file.

Parameters
----------
pixel_scale
file_path: String
    The path to the file containing the PSF
hdu : int
    The HDU the PSF is stored in the .fits file.


return self.array_from_counts_to_electrons_per_second(self.estimated_noise_map_counts)<EOL>

The estimated noise_maps mappers of the image (using its background noise_maps mappers and image values
        in counts) in electrons per second.


@classmethod<EOL><INDENT>def from_weight_map(cls, pixel_scale, weight_map):<DEDENT>

np.seterr(divide='<STR_LIT:ignore>')<EOL>noise_map = <NUM_LIT:1.0> / np.sqrt(weight_map)<EOL>noise_map[noise_map == np.inf] = <NUM_LIT><EOL>return NoiseMap(array=noise_map, pixel_scale=pixel_scale)<EOL>

Setup the noise-map from a weight map, which is a form of noise-map that comes via HST image-reduction and \
        the software package MultiDrizzle.

        The variance in each pixel is computed as:

        Variance = 1.0 / sqrt(weight_map).

        The weight map may contain zeros, in which cause the variances are converted to large values to omit them from \
        the analysis.

        Parameters
        -----------
        pixel_scale : float
            The size of each pixel in arc seconds.
        weight_map : ndarray
            The weight-value of each pixel which is converted to a variance.


@classmethod<EOL><INDENT>def simulate_variable_arrays(cls, array, pixel_scale, exposure_time_map, psf=None, background_sky_map=None,<EOL>add_noise=True, noise_if_add_noise_false=<NUM_LIT:0.1>, noise_seed=-<NUM_LIT:1>, name=None):<DEDENT>

if background_sky_map is not None:<EOL><INDENT>array += background_sky_map<EOL><DEDENT>if psf is not None:<EOL><INDENT>array = psf.convolve(array)<EOL>array = cls.trim_psf_edges(array, psf)<EOL>exposure_time_map = cls.trim_psf_edges(exposure_time_map, psf)<EOL>if background_sky_map is not None:<EOL><INDENT>background_sky_map = cls.trim_psf_edges(background_sky_map, psf)<EOL><DEDENT><DEDENT>if add_noise is True:<EOL><INDENT>array += generate_poisson_noise(array, exposure_time_map, noise_seed)<EOL>array_counts = np.multiply(array, exposure_time_map)<EOL>noise_map = np.divide(np.sqrt(array_counts), exposure_time_map)<EOL><DEDENT>else:<EOL><INDENT>noise_map = noise_if_add_noise_false * np.ones(array.shape)<EOL><DEDENT>if np.isnan(noise_map).any():<EOL><INDENT>raise exc.DataException('<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>if background_sky_map is not None:<EOL><INDENT>array -= background_sky_map<EOL><DEDENT>if background_sky_map is not None:<EOL><INDENT>background_noise_map_counts = np.sqrt(np.multiply(background_sky_map, exposure_time_map))<EOL>background_noise_map = np.divide(background_noise_map_counts, exposure_time_map)<EOL><DEDENT>else:<EOL><INDENT>background_noise_map = None<EOL><DEDENT>array_counts = np.multiply(array, exposure_time_map)<EOL>poisson_noise_map = np.divide(np.sqrt(np.abs(array_counts)), exposure_time_map)<EOL>array = ScaledSquarePixelArray(array=array, pixel_scale=pixel_scale)<EOL>noise_map = NoiseMap(array=noise_map, pixel_scale=pixel_scale)<EOL>if background_noise_map is not None:<EOL><INDENT>background_noise_map = NoiseMap(array=background_noise_map, pixel_scale=pixel_scale)<EOL><DEDENT>if poisson_noise_map is not None:<EOL><INDENT>poisson_noise_map = PoissonNoiseMap(array=poisson_noise_map, pixel_scale=pixel_scale)<EOL><DEDENT>return CCDData(array, pixel_scale=pixel_scale, psf=psf, noise_map=noise_map,<EOL>background_noise_map=background_noise_map, poisson_noise_map=poisson_noise_map,<EOL>exposure_time_map=exposure_time_map, background_sky_map=background_sky_map, name=name)<EOL>

Create a realistic simulated image by applying effects to a plain simulated image.

Parameters
----------
name
array : ndarray
    The image before simulating (e.g. the lens and source galaxies before optics blurring and CCD read-out).
pixel_scale: float
    The scale of each pixel in arc seconds
exposure_time_map : ndarray
    An array representing the effective exposure time of each pixel.
psf: PSF
    An array describing the PSF the simulated image is blurred with.
background_sky_map : ndarray
    The value of background sky in every image pixel (electrons per second).
add_noise: Bool
    If True poisson noise_maps is simulated and added to the image, based on the total counts in each image
    pixel
noise_seed: int
    A seed for random noise_maps generation


return self.array_from_electrons_per_second_to_counts(self.background_noise_map)<EOL>

The background noise_maps mappers in units of counts.


def __init__(self, image, pixel_scale, psf, noise_map=None, background_noise_map=None, poisson_noise_map=None,<EOL>exposure_time_map=None, background_sky_map=None, name=None, **kwargs):

self.name = name<EOL>self.image = image<EOL>self.pixel_scale = pixel_scale<EOL>self.psf = psf<EOL>self.noise_map = noise_map<EOL>self.background_noise_map = background_noise_map<EOL>self.poisson_noise_map = poisson_noise_map<EOL>self.exposure_time_map = exposure_time_map<EOL>self.background_sky_map = background_sky_map<EOL>self.origin = (<NUM_LIT:0.0>, <NUM_LIT:0.0>)<EOL>

A collection of 2D CCD data (an image, noise-map, psf, etc.)

        Parameters
        ----------
        image : scaled_array.ScaledArraySquarePixels
            The array of the image data, in units of electrons per second.
        pixel_scale : float
            The size of each pixel in arc seconds.
        psf : PSF
            An array describing the PSF kernel of the image.
        noise_map : NoiseMap | float | ndarray
            An array describing the RMS standard deviation error in each pixel, preferably in units of electrons per
            second.
        background_noise_map : NoiseMap
            An array describing the RMS standard deviation error in each pixel due to the background sky noise_map,
            preferably in units of electrons per second.
        poisson_noise_map : NoiseMap
            An array describing the RMS standard deviation error in each pixel due to the Poisson counts of the source,
            preferably in units of electrons per second.
        exposure_time_map : scaled_array.ScaledSquarePixelArray
            An array describing the effective exposure time in each ccd pixel.
        background_sky_map : scaled_array.ScaledSquarePixelArray
            An array describing the background sky.


@classmethod<EOL><INDENT>def from_fits_renormalized(cls, file_path, hdu, pixel_scale):<DEDENT>

psf = PSF.from_fits_with_scale(file_path, hdu, pixel_scale)<EOL>psf[:, :] = np.divide(psf, np.sum(psf))<EOL>return psf<EOL>

Loads a PSF from fits and renormalizes it

        Parameters
        ----------
        pixel_scale
        file_path: String
            The path to the file containing the PSF
        hdu : int
            The HDU the PSF is stored in the .fits file.

        Returns
        -------
        psf: PSF
            A renormalized PSF instance


def __init__(self, array, pixel_scale, renormalize=False, **kwargs):

<EOL>super().__init__(array=array, pixel_scale=pixel_scale)<EOL>if renormalize:<EOL><INDENT>self[:, :] = np.divide(self, np.sum(self))<EOL><DEDENT>

Class storing a 2D Point Spread Function (PSF), including its blurring kernel.

Parameters
----------
array : ndarray
    The 2d PSF blurring kernel.
renormalize : bool
    Renormalize the PSF such that he sum of kernel values total 1.0?


with open(positions_path) as f:<EOL><INDENT>position_string = f.readlines()<EOL><DEDENT>positions = []<EOL>for line in position_string:<EOL><INDENT>position_list = ast.literal_eval(line)<EOL>positions.append(position_list)<EOL><DEDENT>return positions<EOL>

Load the positions of an image.

    Positions correspond to a set of pixels in the lensed source galaxy that are anticipated to come from the same \
    multiply-imaged region of the source-plane. Mass models which do not trace the pixels within a threshold value of \
    one another are resampled during the non-linear search.

    Positions are stored in a .dat file, where each line of the file gives a list of list of (y,x) positions which \
    correspond to the same region of the source-plane. Thus, multiple source-plane regions can be input over multiple \
    lines of the same positions file.

    Parameters
    ----------
    positions_path : str
        The path to the positions .dat file containing the positions (e.g. '/path/to/positions.dat')


if seed == -<NUM_LIT:1>:<EOL><INDENT>seed = np.random.randint(<NUM_LIT:0>,<EOL>int(<NUM_LIT>))  <EOL><DEDENT>np.random.seed(seed)<EOL>

Setup the random seed. If the input seed is -1, the code will use a random seed for every run. If it is \
    positive, that seed is used for all runs, thereby giving reproducible results.

    Parameters
    ----------
    seed : int
        The seed of the random number generator.


@classmethod<EOL><INDENT>def simulate_to_target_signal_to_noise(cls, array, pixel_scale, target_signal_to_noise, exposure_time_map,<EOL>psf=None, background_sky_map=None, seed=-<NUM_LIT:1>):<DEDENT>

max_index = np.unravel_index(array.argmax(), array.shape)<EOL>max_image = array[max_index]<EOL>max_effective_exposure_time = exposure_time_map[max_index]<EOL>max_array_counts = np.multiply(max_image, max_effective_exposure_time)<EOL>if background_sky_map is not None:<EOL><INDENT>max_background_sky_map = background_sky_map[max_index]<EOL>max_background_sky_map_counts = np.multiply(max_background_sky_map, max_effective_exposure_time)<EOL><DEDENT>else:<EOL><INDENT>max_background_sky_map_counts = None<EOL><DEDENT>scale_factor = <NUM_LIT:1.><EOL>if background_sky_map is None:<EOL><INDENT>scale_factor = target_signal_to_noise ** <NUM_LIT> / max_array_counts<EOL><DEDENT>elif background_sky_map is not None:<EOL><INDENT>scale_factor = (max_array_counts + max_background_sky_map_counts) * target_signal_to_noise ** <NUM_LIT>/ max_array_counts ** <NUM_LIT><EOL><DEDENT>scaled_effective_exposure_time = np.multiply(scale_factor, exposure_time_map)<EOL>return cls.simulate_variable_arrays(array=array, pixel_scale=pixel_scale,<EOL>exposure_time_map=scaled_effective_exposure_time,<EOL>psf=psf, background_sky_map=background_sky_map,<EOL>add_noise=True, noise_seed=seed)<EOL>

Create a realistic simulated image by applying effects to a plain simulated image.

Parameters
----------
target_signal_to_noise
array : ndarray
    The image before simulating (e.g. the lens and source galaxies before optics blurring and CCD read-out).
pixel_scale: float
    The scale of each pixel in arc seconds
exposure_time_map : ndarray
    An array representing the effective exposure time of each pixel.
psf: PSF
    An array describing the PSF the simulated image is blurred with.
background_sky_map : ndarray
    The value of background sky in every image pixel (electrons per second).
seed: int
    A seed for random noise_maps generation


def load_exposure_time_map(exposure_time_map_path, exposure_time_map_hdu, pixel_scale, shape, exposure_time,<EOL>exposure_time_map_from_inverse_noise_map, inverse_noise_map):

exposure_time_map_options = sum([exposure_time_map_from_inverse_noise_map])<EOL>if exposure_time is not None and exposure_time_map_path is not None:<EOL><INDENT>raise exc.DataException(<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT>if exposure_time_map_options == <NUM_LIT:0>:<EOL><INDENT>if exposure_time is not None and exposure_time_map_path is None:<EOL><INDENT>return ExposureTimeMap.single_value(value=exposure_time, pixel_scale=pixel_scale, shape=shape)<EOL><DEDENT>elif exposure_time is None and exposure_time_map_path is not None:<EOL><INDENT>return ExposureTimeMap.from_fits_with_pixel_scale(file_path=exposure_time_map_path,<EOL>hdu=exposure_time_map_hdu, pixel_scale=pixel_scale)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if exposure_time_map_from_inverse_noise_map:<EOL><INDENT>return ExposureTimeMap.from_exposure_time_and_inverse_noise_map(pixel_scale=pixel_scale,<EOL>exposure_time=exposure_time,<EOL>inverse_noise_map=inverse_noise_map)<EOL><DEDENT><DEDENT>

Factory for loading the exposure time map from a .fits file.

    This factory also includes a number of routines for computing the exposure-time map from other unblurred_image_1d \
    (e.g. the background noise-map).

    Parameters
    ----------
    exposure_time_map_path : str
        The path to the exposure_time_map .fits file containing the exposure time map \
        (e.g. '/path/to/exposure_time_map.fits')
    exposure_time_map_hdu : int
        The hdu the exposure_time_map is contained in the .fits file specified by *exposure_time_map_path*.
    pixel_scale : float
        The size of each pixel in arc seconds.
    shape : (int, int)
        The shape of the image, required if a single value is used to calculate the exposure time map.
    exposure_time : float
        The exposure-time used to compute the expsure-time map if only a single value is used.
    exposure_time_map_from_inverse_noise_map : bool
        If True, the exposure-time map is computed from the background noise_map map \
        (see *ExposureTimeMap.from_background_noise_map*)
    inverse_noise_map : ndarray
        The background noise-map, which the Poisson noise-map can be calculated using.


return self.array_from_electrons_per_second_to_counts(self.image)<EOL>


@classmethod<EOL><INDENT>def from_mask_and_sub_grid_size(cls, mask, sub_grid_size=<NUM_LIT:1>):<DEDENT>

sub_grid_masked = grid_util.sub_grid_1d_masked_from_mask_pixel_scales_and_sub_grid_size(<EOL>mask=mask,<EOL>pixel_scales=mask.pixel_scales,<EOL>sub_grid_size=sub_grid_size)<EOL>return SubGrid(sub_grid_masked, mask, sub_grid_size)<EOL>

Setup a sub-grid of the unmasked pixels, using a mask and a specified sub-grid size. The center of \
        every unmasked pixel's sub-pixels give the grid's (y,x) arc-second coordinates.

        Parameters
        -----------
        mask : Mask
            The mask whose masked pixels are used to setup the sub-pixel grid_stack.
        sub_grid_size : int
            The size (sub_grid_size x sub_grid_size) of each unmasked pixels sub-grid.


def padded_blurred_image_2d_from_padded_image_1d_and_psf(self, padded_image_1d, psf):

padded_model_image_1d = self.convolve_array_1d_with_psf(padded_array_1d=padded_image_1d, psf=psf)<EOL>return self.scaled_array_2d_from_array_1d(array_1d=padded_model_image_1d)<EOL>

Compute a 2D padded blurred image from a 1D padded image.

        Parameters
        ----------
        padded_image_1d : ndarray
            A 1D unmasked image which is blurred with the PSF.
        psf : ndarray
            An array describing the PSF kernel of the image.


def __new__(cls, arr, regular_to_nearest_pix, *args, **kwargs):

obj = arr.view(cls)<EOL>obj.regular_to_nearest_pix = regular_to_nearest_pix<EOL>obj.interpolator = None<EOL>return obj<EOL>

A pix-grid of (y,x) coordinates which are used to form the pixel centres of adaptive pixelizations in the \
        *pixelizations* module.

        A *PixGrid* is ordered such pixels begin from the top-row of the mask and go rightwards and then \
        downwards. Therefore, it is a ndarray of shape [total_pix_pixels, 2]. The first element of the ndarray \
        thus corresponds to the pix pixel index and second element the y or x arc -econd coordinates. For example:

        - pix_grid[3,0] = the 4th unmasked pixel's y-coordinate.
        - pix_grid[6,1] = the 7th unmasked pixel's x-coordinate.

        Parameters
        -----------
        pix_grid : ndarray
            The grid of (y,x) arc-second coordinates of every image-plane pixelization grid used for adaptive source \
            -plane pixelizations.
        regular_to_nearest_pix : ndarray
            A 1D array that maps every regular-grid pixel to its nearest pix-grid pixel.


@classmethod<EOL><INDENT>def padded_grid_from_shape_psf_shape_and_pixel_scale(cls, shape, psf_shape, pixel_scale):<DEDENT>

padded_shape = (shape[<NUM_LIT:0>] + psf_shape[<NUM_LIT:0>] - <NUM_LIT:1>, shape[<NUM_LIT:1>] + psf_shape[<NUM_LIT:1>] - <NUM_LIT:1>)<EOL>padded_regular_grid = grid_util.regular_grid_1d_masked_from_mask_pixel_scales_and_origin(<EOL>mask=np.full(padded_shape, False), pixel_scales=(pixel_scale, pixel_scale))<EOL>padded_mask = msk.Mask.unmasked_for_shape_and_pixel_scale(shape=padded_shape, pixel_scale=pixel_scale)<EOL>return PaddedRegularGrid(arr=padded_regular_grid, mask=padded_mask, image_shape=shape)<EOL>

Setup a regular padded grid from a 2D array shape, psf-shape and pixel-scale.

        The center of every pixel is used to setup the grid's (y,x) arc-second coordinates, including padded pixels \
        which are beyond the input shape but will blurred light into the 2D array's shape due to the psf.

        Parameters
        ----------
        shape : (int, int)
            The (y,x) shape of the masked-grid's 2D image in units of pixels.
        psf_shape : (int, int)
           The shape of the psf which defines the blurring region and therefore size of padding.
        pixel_scale : float
            The scale of each pixel in arc seconds


@classmethod<EOL><INDENT>def blurring_grid_from_mask_and_psf_shape(cls, mask, psf_shape):<DEDENT>

blurring_mask = mask.blurring_mask_for_psf_shape(psf_shape)<EOL>return RegularGrid.from_mask(blurring_mask)<EOL>

Setup a blurring-grid from a mask, where a blurring grid consists of all pixels that are masked, but they \
        are close enough to the unmasked pixels that a fraction of their light will be blurred into those pixels \
        via PSF convolution. For example, if our mask is as follows:

        |x|x|x|x|x|x|x|x|x|x|
        |x|x|x|x|x|x|x|x|x|x|     This is an ccd.Mask, where:
        |x|x|x|x|x|x|x|x|x|x|
        |x|x|x|x|x|x|x|x|x|x|     x = True (Pixel is masked and excluded from lens)
        |x|x|x|o|o|o|x|x|x|x|     o = False (Pixel is not masked and included in lens)
        |x|x|x|o|o|o|x|x|x|x|
        |x|x|x|o|o|o|x|x|x|x|
        |x|x|x|x|x|x|x|x|x|x|
        |x|x|x|x|x|x|x|x|x|x|
        |x|x|x|x|x|x|x|x|x|x|

        For a PSF of shape (3,3), the following blurring mask is computed (noting that only pixels that are direct \
        neighbors of the unmasked pixels above will blur light into an unmasked pixel):

        |x|x|x|x|x|x|x|x|x|     This is an example regular.Mask, where:
        |x|x|x|x|x|x|x|x|x|
        |x|x|o|o|o|o|o|x|x|     x = True (Pixel is masked and excluded from lens)
        |x|x|o|x|x|x|o|x|x|     o = False (Pixel is not masked and included in lens)
        |x|x|o|x|x|x|o|x|x|
        |x|x|o|x|x|x|o|x|x|
        |x|x|o|o|o|o|o|x|x|
        |x|x|x|x|x|x|x|x|x|
        |x|x|x|x|x|x|x|x|x|

        Thus, the blurring grid coordinates and indexes will be as follows:

        pixel_scale = 1.0"

        <--- -ve  x  +ve -->
                                                            y     x
        |x|x|x |x |x |x |x |x|x|  |   blurring_grid[0] = [2.0, -2.0]  blurring_grid[9] =  [-1.0, -2.0]
        |x|x|x |x |x |x |x |x|x|  |   blurring_grid[1] = [2.0, -1.0]  blurring_grid[10] = [-1.0,  2.0]
        |x|x|0 |1 |2 |3 |4 |x|x| +ve  blurring_grid[2] = [2.0,  0.0]  blurring_grid[11] = [-2.0, -2.0]
        |x|x|5 |x |x |x |6 |x|x|  y   blurring_grid[3] = [2.0,  1.0]  blurring_grid[12] = [-2.0, -1.0]
        |x|x|7 |x |x |x |8 |x|x| -ve  blurring_grid[4] = [2.0,  2.0]  blurring_grid[13] = [-2.0,  0.0]
        |x|x|9 |x |x |x |10|x|x|  |   blurring_grid[5] = [1.0, -2.0]  blurring_grid[14] = [-2.0,  1.0]
        |x|x|11|12|13|14|15|x|x|  |   blurring_grid[6] = [1.0,  2.0]  blurring_grid[15] = [-2.0,  2.0]
        |x|x|x |x |x |x |x |x|x| \/   blurring_grid[7] = [0.0, -2.0]
        |x|x|x |x |x |x |x |x|x|      blurring_grid[8] = [0.0,  2.0]

        For a PSF of shape (5,5), the following blurring mask is computed (noting that pixels that are 2 pixels from an
        direct unmasked pixels now blur light into an unmasked pixel):

        |x|x|x|x|x|x|x|x|x|     This is an example regular.Mask, where:
        |x|o|o|o|o|o|o|o|x|
        |x|o|o|o|o|o|o|o|x|     x = True (Pixel is masked and excluded from lens)
        |x|o|o|x|x|x|o|o|x|     o = False (Pixel is not masked and included in lens)
        |x|o|o|x|x|x|o|o|x|
        |x|o|o|x|x|x|o|o|x|
        |x|o|o|o|o|o|o|o|x|
        |x|o|o|o|o|o|o|o|x|
        |x|x|x|x|x|x|x|x|x|


array = grid_util.regular_grid_1d_masked_from_mask_pixel_scales_and_origin(mask=mask,<EOL>pixel_scales=mask.pixel_scales)<EOL>return cls(array, mask)<EOL>

Setup a regular-grid from a mask, wehere the center of every unmasked pixel gives the grid's (y,x) \
        arc-second coordinates.

        Parameters
        -----------
        mask : Mask
            The mask whose unmasked pixels are used to setup the regular-pixel grid.


@classmethod<EOL><INDENT>def grid_stack_for_simulation(cls, shape, pixel_scale, psf_shape, sub_grid_size=<NUM_LIT:2>):<DEDENT>

Setup a grid-stack of grid_stack for simulating an image of a strong lens, whereby the grid's use \
        padded-grid_stack to ensure that the PSF blurring in the simulation routine (*ccd.PrepatoryImage.simulate*) \
        is not degraded due to edge effects.

        Parameters
        -----------
        shape : (int, int)
            The 2D shape of the array, where all pixels are used to generate the grid-stack's grid_stack.
        pixel_scale : float
            The size of each pixel in arc seconds.
        psf_shape : (int, int)
            The shape of the PSF used in the analysis, which defines how much the grid's must be masked to mitigate \
            edge effects.
        sub_grid_size : int
            The size of a sub-pixel's sub-grid (sub_grid_size x sub_grid_size).