Skip to content
Snippets Groups Projects
Commit a384b90a authored by Yannick Lecoeuche's avatar Yannick Lecoeuche Committed by Jameson Rollins
Browse files

Improve zoomed refine plots

As mentioned in #161, when a zoomed refined time plot has a threshold crossing outside of the plot window, the channel data outside the window does not get plotted. This is because the code is specifically selecting data that falls within the window. This code plots all the data and chooses xlims based on the refined time and window boundaries.

This generally shouldn't be necessary, as we don't expect good refinement to yield times more than 5 seconds before the unrefined lockloss time, but it's nice to have consistent plots.
parent 332bac10
No related branches found
No related tags found
No related merge requests found
...@@ -44,12 +44,7 @@ def plot_indicators(event, params, refined_gps=None, threshold=None): ...@@ -44,12 +44,7 @@ def plot_indicators(event, params, refined_gps=None, threshold=None):
# plot indicator # plot indicator
color = 'blue' color = 'blue'
label = params['CHANNEL'] label = params['CHANNEL']
# filter data based on window ax1.plot(t_ind-t0, y_ind, label=label,
condition = np.logical_and(t0+window[0] <= t_ind, t_ind <= t0+window[1])
idx = np.argwhere(condition)
y = y_ind[idx]
t = t_ind[idx]
ax1.plot(t-t0, y, label=label,
color=color, alpha=0.8, linewidth=2) color=color, alpha=0.8, linewidth=2)
ax1.grid(True) ax1.grid(True)
ax1.set_ylabel(params['CHANNEL']) ax1.set_ylabel(params['CHANNEL'])
...@@ -108,16 +103,12 @@ def plot_indicators(event, params, refined_gps=None, threshold=None): ...@@ -108,16 +103,12 @@ def plot_indicators(event, params, refined_gps=None, threshold=None):
verticalalignment='bottom', verticalalignment='bottom',
bbox=dict(boxstyle="round", fc="w", ec="red", alpha=0.95), bbox=dict(boxstyle="round", fc="w", ec="red", alpha=0.95),
) )
ax1.set_xlim(min(atx-1, window[0]), window[1])
# plot guardian # plot guardian
color = 'orange' color = 'orange'
label = config.GRD_STATE_N_CHANNEL label = config.GRD_STATE_N_CHANNEL
# filter data based on window ax2.plot(t_grd-t0, y_grd, label=label,
condition = np.logical_and(t0+window[0] <= t_grd, t_grd <= t0+window[1])
idx = np.argwhere(condition)
y = y_grd[idx]
t = t_grd[idx]
ax2.plot(t-t0, y, label=label,
color=color, linewidth=2) color=color, linewidth=2)
ax2.set_yticks(trans) ax2.set_yticks(trans)
ylim = ax2.get_ylim() ylim = ax2.get_ylim()
...@@ -140,6 +131,7 @@ def plot_indicators(event, params, refined_gps=None, threshold=None): ...@@ -140,6 +131,7 @@ def plot_indicators(event, params, refined_gps=None, threshold=None):
linestyle = '--', linestyle = '--',
linewidth = 2 linewidth = 2
) )
ax2.set_xlim(min(atx-1, window[0]), window[1])
fig.suptitle("Lock loss refinement for {}".format(event.id)) fig.suptitle("Lock loss refinement for {}".format(event.id))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment