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

@@ -20,3 +20,4 @@ from . import utils
from . import plot
from . import analysis
from . import image
from . import channels

View File

@@ -0,0 +1,15 @@
# Machine parameters
GASMONITOR = 'SARFE10-PBIG050-EVR0:CALCI'
PULSE_E_AVG = 'SARFE10-PBPG050:PHOTON-ENERGY-PER-PULSE-AVG'
# Event receiver
EVR = 'SAR-CVME-TIFALL6:EvtSet'
# Jungfrau 1.5M detector
JF = 'JF16T03V01'
# PSSS
PSSS_X = 'SARFE10-PSSS059:SPECTRUM_X'
PSSS_Y = 'SARFE10-PSSS059:SPECTRUM_Y'
PSSS_SUM = 'SARFE10-PSSS059:SPECTRUM_Y_SUM'
PSSS_COM = 'SARFE10-PSSS059:SPECT-COM'

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
)