channel names and more plots

This commit is contained in:
2023-11-26 01:52:09 +01:00
parent 087b4406b8
commit b3001316ef
3 changed files with 24 additions and 5 deletions

View File

@@ -155,7 +155,7 @@ def plot_2d_channel(data: SFDataFiles, channel_name, ax=None):
axis_styling(ax, channel_name, description)
def plot_detector_image(image_data, channel_name=None, ax=None, rois=None, norms=None, log_colorscale=False):
def plot_detector_image(image_data, title=None, comment=None, ax=None, rois=None, norms=None, log_colorscale=False, **fig_kw):
"""
Plots channel data for a channel that contains an image (2d array) of numeric values per pulse.
Optional:
@@ -173,7 +173,7 @@ def plot_detector_image(image_data, channel_name=None, ax=None, rois=None, norms
im = log_transform(im)
if ax is None:
fig, ax = plt.subplots(constrained_layout=True)
fig, ax = plt.subplots(constrained_layout=True, **fig_kw)
std = im.std()
mean = im.mean()
@@ -200,9 +200,12 @@ def plot_detector_image(image_data, channel_name=None, ax=None, rois=None, norms
label=roi.name,
)
ax.add_patch(rect)
if comment is not None:
description = f"{comment}\nmean: {mean:.2e},\nstd: {std:.2e}"
else:
description = f"mean: {mean:.2e},\nstd: {std:.2e}"
description = f"mean: {mean:.2e},\nstd: {std:.2e}"
axis_styling(ax, channel_name, description)
axis_styling(ax, title, description)
ax.legend(loc=4)
@@ -218,7 +221,7 @@ def plot_image_channel(data: SFDataFiles, channel_name, pulse=0, ax=None, rois=N
image_data = data[channel_name][pulse]
plot_detector_image(
image_data, channel_name=channel_name, ax=ax, rois=rois, norms=norms, log_colorscale=log_colorscale
image_data, title=channel_name, ax=ax, rois=rois, norms=norms, log_colorscale=log_colorscale
)