Skip to content
Snippets Groups Projects
Commit 64701574 authored by Jameson Rollins's avatar Jameson Rollins
Browse files

Merge branch 'fss_tag' into 'master'

Search for and tag FSS oscillations before lockloss

Closes #109 and #154

See merge request jameson.rollins/locklost!94
parents 4ef4209f 4542b003
No related branches found
No related tags found
No related merge requests found
......@@ -70,6 +70,7 @@ TAG_COLORS = {
'MICROSEISMIC': ('yellow', 'black'),
'ANTHROPOGENIC': ('red', 'black'),
'ADS_EXCURSION': ('mediumvioletred', 'plum'),
'FSS_OSCILLATION': ('69650b', 'palegoldenrod'),
'SEI_BS_TRANS': ('sienna', 'orange'),
'COMMISSIONING': ('lightseagreen', 'darkslategrey'),
'MAINTENANCE': ('lightseagreen', 'darkslategrey'),
......
......@@ -12,6 +12,10 @@ def set_thresh_crossing(ax, thresh_crossing, gps, segment):
lw=5,
)
x_fraction = (thresh_crossing-segment[0])/(segment[1]-segment[0])
if x_fraction < 0.05:
align = 'left'
else:
align = 'center'
ax.annotate(
'First threshold crossing',
xy=(x_fraction, 1),
......@@ -19,6 +23,7 @@ def set_thresh_crossing(ax, thresh_crossing, gps, segment):
horizontalalignment='center',
verticalalignment='bottom',
bbox=dict(boxstyle="round", fc="w", ec="red", alpha=0.95),
ha=align,
)
......
......@@ -64,6 +64,9 @@ register_plugin(check_ads)
from .sei_bs_trans import check_sei_bs
register_plugin(check_sei_bs)
from .fss_oscillation import check_fss
register_plugin(check_fss)
# add last since this needs to wait for additional data
from .seismic import check_seismic
register_plugin(check_seismic)
import logging
import numpy as np
import matplotlib.pyplot as plt
from gwpy.segments import Segment
from .. import config
from .. import data
from .. import plotutils
FSS_SEARCH_WINDOW = [-5, 5]
FSS_CHANNELS = [
'{}:PSL-FSS_FAST_MON_OUT_DQ'.format(config.IFO)
]
FSS_THRESH = 3
##############################################
def check_fss(event):
"""Checks for FSS oscillations.
Checks FSS PD for counts below threshold and
creates a tag/plot if below said threshold.
"""
plotutils.set_rcparams()
mod_window = [FSS_SEARCH_WINDOW[0], FSS_SEARCH_WINDOW[1]]
segment = Segment(mod_window).shift(int(event.gps))
buf = data.fetch(FSS_CHANNELS, segment)[0]
thresh_crossing = segment[1]
srate = buf.sample_rate
t = np.arange(segment[0], segment[1], 1/srate)
thresh_ref = buf.data[np.where(t-event.gps <= -1)]
thresh_above = np.mean(thresh_ref)+FSS_THRESH
thresh_below = np.mean(thresh_ref)-FSS_THRESH
glitches = np.where((thresh_ref <= thresh_below) | (thresh_ref >= thresh_above))[0]
if any(glitches):
glitch_time = t[glitches[0]]
thresh_crossing = min(glitch_time, thresh_crossing)
event.add_tag('FSS_OSCILLATION')
else:
logging.info('no fss oscillations')
fig, ax = plt.subplots(1, figsize=(22,16))
t = np.arange(segment[0], segment[1], 1/srate)
ax.plot(
t-event.gps,
buf.data,
label=buf.channel,
alpha=0.8,
lw=2,
)
ax.axhline(
thresh_below,
linestyle='--',
color='black',
label='FSS oscillation threshold',
lw=5,
)
ax.axhline(
thresh_above,
linestyle='--',
color='black',
lw=5,
)
ax.grid()
ax.set_xlabel('Time [s] since lock loss at {}'.format(event.gps), labelpad=10)
ax.set_ylabel('Voltage [V]')
ax.legend(loc='best')
ax.set_title('FSS stability check', y=1.04)
ax.set_xlim(segment[0]-event.gps, segment[1]-event.gps)
if thresh_crossing != segment[1]:
plotutils.set_thresh_crossing(ax, thresh_crossing, event.gps, segment)
fig.tight_layout()
fig.savefig(event.path('fss.png'))
......@@ -92,6 +92,17 @@
<p>LPY plots not created due to lack of saturating suspension channels.</p>
% end
<!-- FSS oscillations -->
<hr />
<div class="container">
<br />
<div class="row">
% has_tag = event.has_tag('FSS_OSCILLATION')
% board_plot = [event.url('fss.png')]
% include('collapsed_plots.tpl', title ='FSS oscillation plot', id='fss', plots=board_plot, size=5, expand=has_tag, section='main')
</div>
</div>
<!-- BRS glitch -->
<hr />
<div class="container">
......
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