Skip to content

panoptes.pipeline.utils.plot

panoptes.pipeline.utils.plot

plot_background

plot_background(rgb_bg_data, title=None)

Plot the RGB backgrounds from Background2d objects.

Parameters:

Name Type Description Default
rgb_bg_data list[Background2D]

The RGB background data as returned by calling panoptes.utils.images.bayer.get_rgb_background with return_separate=True.

required
title str

The title for the plot, default None.

None
Source code in src/panoptes/pipeline/utils/plot.py
def plot_background(rgb_bg_data, title=None):
    """Plot the RGB backgrounds from `Background2d` objects.

    Args:
        rgb_bg_data (list[photutils.Background2D]): The RGB background data as
            returned by calling `panoptes.utils.images.bayer.get_rgb_background`
            with `return_separate=True`.
        title (str): The title for the plot, default None.

    """

    nrows = 2
    ncols = 3

    fig, axes = plt.subplots(nrows=nrows, ncols=ncols, sharex=True, sharey=True)
    fig.set_facecolor("white")

    for color in bayer.RGB:
        d0 = rgb_bg_data[color]
        ax0 = axes[0][color]
        ax1 = axes[1][color]

        ax0.set_title(f"{color.name.title()} (med {d0.background_median:.02f} ADU)")
        im = ax0.imshow(d0.background, cmap=f"{color.name.title()}s_r", origin="lower")
        plot_utils.add_colorbar(im)

        ax1.set_title(f"{color.name.title()} rms (med {d0.background_rms_median:.02f} ADU)")
        im = ax1.imshow(d0.background_rms, cmap=f"{color.name.title()}s_r", origin="lower")
        plot_utils.add_colorbar(im)

        ax0.set_axis_off()
        ax1.set_axis_off()

    if title:
        fig.suptitle(title)

    fig.set_size_inches(11, 5)
    return fig