示例#1
0
文件: plot.py 项目: burggraaff/ispex2
def plot_fluorescent_lines_dispersion(y2,
                                      lines2,
                                      lines_fit2,
                                      dispersion2,
                                      saveto=None):
    p_eff = [pe.Stroke(linewidth=5, foreground='k'), pe.Normal()]

    fig, axs = plt.subplots(ncols=2,
                            figsize=(10, 3),
                            gridspec_kw={
                                "width_ratios": (4, 1),
                                "hspace": 0,
                                "wspace": 0.05
                            },
                            sharey=True)
    for offset, y, lines, lines_fit, dispersion in zip(offsets, y2, lines2,
                                                       lines_fit2,
                                                       dispersion2):
        for j, c in enumerate("rgb"):
            axs[0].scatter(lines[j], y + offset, s=25, c=c, alpha=0.8)
            axs[0].plot(lines_fit[j], y + offset, c=c, path_effects=p_eff)

        axs[1].plot(dispersion, y + offset, c='k', lw=5)

    axs[0].set_title("Locations of RGB maxima")
    axs[0].set_xlabel("Line center [px]")  # x
    axs[0].set_ylabel("Row along spectrum [px]")  # y
    axs[0].invert_yaxis()
    axs[1].tick_params(axis="y", left=False)
    axs[1].set_xlabel("Dispersion [nm/px]")
    for ax in axs:
        ax.grid(ls="--")

    spectacle_plot._saveshow(saveto, bbox_inches="tight")
示例#2
0
文件: plot.py 项目: burggraaff/ispex2
def plot_fluorescent_lines(y, lines, lines_fit, saveto=None):
    plt.figure(figsize=(7, 4))

    p_eff = [pe.Stroke(linewidth=5, foreground='k'), pe.Normal()]
    for j, c in enumerate("rgb"):
        plt.scatter(lines[j], y, s=25, c=c, alpha=0.8)
        plt.plot(lines_fit[j], y, c=c, path_effects=p_eff)

    plt.title("Locations of RGB maxima")
    plt.xlabel("Line center")  # x
    plt.ylabel("Row along spectrum")  # y
    plt.axis("tight")
    plt.grid(ls="--")
    spectacle_plot._saveshow(saveto, bbox_inches="tight")
示例#3
0
文件: plot.py 项目: burggraaff/ispex2
def plot_fluorescent_lines_double(y2, lines2, lines_fit2, saveto=None):
    p_eff = [pe.Stroke(linewidth=5, foreground='k'), pe.Normal()]

    plt.figure(figsize=(10, 3))
    for offset, y, lines, lines_fit in zip(offsets, y2, lines2, lines_fit2):
        for j, c in enumerate("rgb"):
            plt.scatter(lines[j], y + offset, s=25, c=c, alpha=0.8)
            plt.plot(lines_fit[j], y + offset, c=c, path_effects=p_eff)

    plt.title("Locations of RGB maxima")
    plt.xlabel("Line center [px]")  # x
    plt.ylabel("Row along spectrum [px]")  # y
    plt.gca().invert_yaxis()
    plt.grid(ls="--")
    spectacle_plot._saveshow(saveto, bbox_inches="tight")
示例#4
0
文件: plot.py 项目: burggraaff/ispex2
def show_RGBG(data, colour=None, colorbar_label="", saveto=None, **kwargs):
    fig, axs = plt.subplots(nrows=4,
                            sharex=True,
                            sharey=True,
                            figsize=(5, 5),
                            squeeze=True,
                            gridspec_kw={
                                "wspace": 1,
                                "hspace": 0
                            })
    for ax, data_c, c in zip(axs.ravel(), data, spectacle_plot.RGBG2):
        img = ax.imshow(data_c, cmap=spectacle_plot.cmaps[c + "r"], **kwargs)
        ax.set_xticks([])
        ax.set_yticks([])
    spectacle_plot._saveshow(saveto, bbox_inches="tight")
示例#5
0
                          saveto=save_to_histogram)
print("Made histogram")

# Plot Gauss-convolved maps of the data
camera.plot_gauss_maps(gains,
                       colorbar_label="Gain (ADU/e$^-$)",
                       saveto=save_to_map)
print("Made maps")

# Plot a miniature RGB histogram
xmin, xmax = 0, 3.5
fig, axs = plt.subplots(nrows=4,
                        sharex=True,
                        sharey=True,
                        figsize=(3.3, 3),
                        gridspec_kw={
                            "wspace": 0,
                            "hspace": 0
                        })
camera.plot_histogram_RGB(gains,
                          axs=axs,
                          xmin=xmin,
                          xmax=xmax,
                          nrbins=250,
                          xlabel="Gain (ADU/e$^-$)")
axs[0].set_ylim(0, 2.5)
axs[0].set_yticks([0, 1, 2])
axs[1].set_ylabel("Frequency")
plot._saveshow(save_to_histogram_miniature)
print("Made RGB histogram")
示例#6
0
                       axs=ax_arr,
                       xmin=0.4,
                       xmax=2.8,
                       nrbins=250,
                       xlabel="Gain (ADU/e$^-$)")

    # Add a title to the top plot in each column
    ax_arr[0].set_title(label)

# Remove ticks from the left y-axis of all plots except the left-most
for ax in axs[:, 1:].ravel():
    ax.tick_params(left=False)

# Add ticks to the right y-axis of the right-most plot
for ax in axs[:, -1].ravel():
    ax.tick_params(right=True, labelright=True)

# Add a label to y-axis of the left-most and right-most, middle plots
axs[1, 0].set_ylabel("Frequency")
axs[1, -1].yaxis.set_label_position("right")
axs[1, -1].set_ylabel("Frequency")

# Plot parameters (shared)
axs[0, 0].set_yticks([0.5, 1.5])
axs[0, 0].set_xticks(np.arange(0.5, 3, 0.5))

# Save the figure
save_to_histogram = save_folder / "gain_histogram.pdf"
plot._saveshow(save_to_histogram)
print(f"Saved RGB histogram to '{save_to_histogram}'")