From 593006fd4c8507bdbb402fd570c05f044ca7ac1b Mon Sep 17 00:00:00 2001 From: Laurent Mercadier <laurent.mercadier@xfel.eu> Date: Mon, 3 Feb 2025 16:02:20 +0100 Subject: [PATCH] Plot 2nd and 2nd to last peaks in check_peak_params --- src/toolbox_scs/detectors/digitizers.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/toolbox_scs/detectors/digitizers.py b/src/toolbox_scs/detectors/digitizers.py index 828f5a5..067a75b 100644 --- a/src/toolbox_scs/detectors/digitizers.py +++ b/src/toolbox_scs/detectors/digitizers.py @@ -663,15 +663,20 @@ def plotPeakIntegrationWindow(raw_trace, params, show_all=False): fig, ax = plt.subplots(1, 2, figsize=(6, 3), constrained_layout=True) for plot in range(2): title = 'First pulse' if plot == 0 else 'Last pulse' - i = 0 if plot == 0 else -1 - ax[plot].axvline(baseStarts[i], ls='--', color='k') - ax[plot].axvline(baseStops[i], ls='--', color='k') - ax[plot].axvspan(baseStarts[i], baseStops[i], - alpha=0.5, color='grey', label='baseline') - ax[plot].axvline(starts[i], ls='--', color='r') - ax[plot].axvline(stops[i], ls='--', color='r') - ax[plot].axvspan(starts[i], stops[i], - alpha=0.2, color='r', label='peak') + i = 0 if plot == 0 else - 1 + for j in range(min(2, len(starts))): + if plot == 1: + j = -j + label='baseline' if j == 0 else '' + ax[plot].axvline(baseStarts[i+j], ls='--', color='k') + ax[plot].axvline(baseStops[i+j], ls='--', color='k') + ax[plot].axvspan(baseStarts[i+j], baseStops[i+j], + alpha=0.5, color='grey', label=label) + label='peak' if j == 0 else '' + ax[plot].axvline(starts[i+j], ls='--', color='r') + ax[plot].axvline(stops[i+j], ls='--', color='r') + ax[plot].axvspan(starts[i+j], stops[i+j], + alpha=0.2, color='r', label=label) if len(starts) > 1: period = starts[1] - starts[0] xmin = np.max([0, baseStarts[i] - int(1.5*period)]) -- GitLab