Example #1
0
                        gridspec_kw={
                            "wspace": 0,
                            "hspace": 0
                        })

# Loop over the data and plot them
for path, gauss, axs_here in zip(files, gauss_all, axs):

    # Loop over the Bayer RGBG2 channels
    for j, (ax, D, c) in enumerate(zip(axs_here, gauss, plot.rgbg2)):

        # Plot the image
        img = ax.imshow(D, cmap=plot.cmaps[c + "r"], vmin=vmin, vmax=vmax)

        # Remove the x- and y-axes
        ax.set_xticks([])
        ax.set_yticks([])

        # For the lowest row only, add a colorbar
        if ax is axs[-1, j]:
            colorbar_here = plot.colorbar(img)
            if ax is axs_here[1]:
                colorbar_here.set_label(colorbar_label)
            colorbar_here.locator = plot.ticker.MaxNLocator(nbins=3)
            colorbar_here.update_ticks()

# Save the figure
fig.savefig(save_to)
plt.close()
print(f"Saved figure to '{save_to}'")
Example #2
0
        # Plot parameters
        ax.set_xticks([])
        ax.set_yticks([])
        ax.set_title(label)

        # Include a colorbar
        # Left-most map has a colorbar on the left
        if ax is axs[0]:
            loc = "left"
        # Right-most map has a colorbar on the right
        elif ax is axs[-1]:
            loc = "right"
        # Any other maps have a colorbar on the bottom
        else:
            loc = "bottom"
        cbar = plot.colorbar(im, location=loc, label="Gain (ADU/e$^-$)")

        # Print the range of gain values found in this map
        percentile_low, percentile_high = analyse.symmetric_percentiles(
            data_RGBG)
        print(label)
        print(f"{c_label:>2}: {percentile_low:.2f} -- {percentile_high:.2f}")

    # Save the figure
    save_to_map_c = save_folder / f"gain_map_{c_label}.pdf"
    fig.savefig(save_to_map_c)
    plt.close()
    print(f"Saved gain map for the {c_label} channel to '{save_to_map_c}'")

# Plot a histogram
fig, axs = plt.subplots(ncols=len(files),