From bc534d7ac763ce7fe1434a91aac5d821a135c243 Mon Sep 17 00:00:00 2001 From: Lanqing Yuan Date: Thu, 20 Jun 2024 20:46:22 -0500 Subject: [PATCH] Support event time window in watcher (#144) * event range * debug * debug --- saltax/match/visual.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/saltax/match/visual.py b/saltax/match/visual.py index f31dd65..643f78c 100644 --- a/saltax/match/visual.py +++ b/saltax/match/visual.py @@ -66,6 +66,14 @@ def plot_event_wf( int((events_salt["s2_time"][ind] - extended_simu_event_timerange_ns[0]) / 10), int((events_salt["s2_endtime"][ind] - extended_simu_event_timerange_ns[0]) / 10), ) + simu_event_timerange_i = ( + int((events_simu["time"][ind] - extended_simu_event_timerange_ns[0]) / 10), + int((events_simu["endtime"][ind] - extended_simu_event_timerange_ns[0]) / 10), + ) + salt_event_timerange_i = ( + int((events_salt["time"][ind] - extended_simu_event_timerange_ns[0]) / 10), + int((events_salt["endtime"][ind] - extended_simu_event_timerange_ns[0]) / 10), + ) # Get peaks and lone hits for the event # Make sure the data is stored before loading @@ -201,6 +209,13 @@ def plot_event_wf( alpha=0.2, label="Simulated S2 Range", ) + ax1.axvspan( + simu_event_timerange_i[0], + simu_event_timerange_i[1], + color="tab:brown", + alpha=0.2, + label="Simulated Event", + ) if events_salt is not None: ax1.axvspan( matched_salt_s1_timerange_i[0], @@ -216,6 +231,13 @@ def plot_event_wf( alpha=0.2, label="Sprinkled S2 Range", ) + ax1.axvspan( + salt_event_timerange_i[0], + salt_event_timerange_i[1], + color="grey", + alpha=0.1, + label="Matched Sprinkled Event", + ) ax1.legend() if events_salt is not None: ax1.set_title( @@ -259,6 +281,13 @@ def plot_event_wf( alpha=0.2, label="Simulated S2 Range", ) + ax2.axvspan( + simu_event_timerange_i[0], + simu_event_timerange_i[1], + color="tab:brown", + alpha=0.2, + label="Simulated Event", + ) if events_salt is not None: ax2.axvspan( matched_salt_s1_timerange_i[0], @@ -274,6 +303,13 @@ def plot_event_wf( alpha=0.2, label="Sprinkled S2 Range", ) + ax2.axvspan( + salt_event_timerange_i[0], + salt_event_timerange_i[1], + color="grey", + alpha=0.1, + label="Matched Sprinkled Event", + ) ax2.legend() ax2.set_ylim(ylim) # Set labels for full event waveform plot