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

Merge branch 'check_brs_usage' into 'master'

See merge request jameson.rollins/locklost!83
parents d0b4d670 4348ca99
No related branches found
No related tags found
No related merge requests found
......@@ -203,21 +203,6 @@ SIXTEEN_BIT_CHANNELS = [
]
SIXTEEN_BIT_CHANNELS = ifochans(SIXTEEN_BIT_CHANNELS)
BRS_CHANNEL_ENDINGS = [
'100M_300M',
'300M_1',
'1_3',
]
BRS_CHANNELS = {}
for endstation, axis in zip(['ETMX', 'ETMY'], ['RY', 'RX']):
BRS_CHANNELS[endstation] = []
for ending in BRS_CHANNEL_ENDINGS:
BRS_CHANNELS[endstation].append('%s:ISI-GND_BRS_%s_%s_BLRMS_%s' % (IFO, endstation, axis, ending))
BRS_THRESH = 15
BRS_SEARCH_WINDOW = [-30, 5]
ANALOG_BOARD_CHANNELS = [
'IMC-REFL_SERVO_SPLITMON',
'IMC-REFL_SERVO_FASTMON',
......
......@@ -10,6 +10,49 @@ from .. import plotutils
#################################################
CHANNEL_ENDINGS = [
'100M_300M',
'300M_1',
'1_3',
]
# H1 checks single status channel that says what combination of BRSX/BRSY is
# being used
if config.IFO == 'H1':
ENDS = ['ETMX', 'ETMY']
AXES = ['RY', 'RX']
STATE_REQUEST = ['GRD-SEI_CONF_REQUEST_N']
SKIP_STATES = {
'XY': [10, 17, 45],
'ETMX': [65],
'ETMY': [60],
}
# L1 checks status channels for each individual BRS (ETMs and ITMs) that says
# whether it's being used
elif config.IFO == 'L1':
ENDS = ['ETMX', 'ETMY', 'ITMX', 'ITMY']
AXES = ['RY', 'RX', 'RY', 'RX']
STATE_REQUEST = [
'ISI-ITMX_ST1_SENSCOR_X_FADE_CUR_CHAN_MON',
'ISI-ITMY_ST1_SENSCOR_Y_FADE_CUR_CHAN_MON',
'ISI-ETMX_ST1_SENSCOR_X_FADE_CUR_CHAN_MON',
'ISI-ETMY_ST1_SENSCOR_Y_FADE_CUR_CHAN_MON',
]
SKIP_STATES = [8, 9]
STATE_REQUEST = ['{}:{}'.format(config.IFO, chan) for chan in STATE_REQUEST]
CHANNELS = {}
for endstation, axis in zip(ENDS, AXES):
CHANNELS[endstation] = []
for ending in CHANNEL_ENDINGS:
CHANNELS[endstation].append('{}:ISI-GND_BRS_{}_{}_BLRMS_{}'.format(config.IFO, endstation, axis, ending))
BRS_THRESH = 15
BRS_SEARCH_WINDOW = [-30, 5]
def check_brs(event):
"""Checks for BRS glitches at both end stations.
......@@ -20,11 +63,35 @@ def check_brs(event):
plotutils.set_rcparams()
mod_window = [config.BRS_SEARCH_WINDOW[0], config.BRS_SEARCH_WINDOW[1]]
mod_window = [BRS_SEARCH_WINDOW[0], BRS_SEARCH_WINDOW[1]]
segment = Segment(mod_window).shift(int(event.gps))
for endstation, channel_names in config.BRS_CHANNELS.items():
brs_channels = data.fetch(channel_names, segment)
brs_requests = data.fetch(STATE_REQUEST, segment)
srate = brs_requests[0].sample_rate
t = np.arange(segment[0], segment[1], 1/srate)
brs_states = [i.data[np.argmin(np.absolute(t-event.gps))] for i in brs_requests]
brs_all = {station:[] for station in ENDS}
brs_used = {station:True for station in ENDS}
if config.IFO == 'H1':
if brs_states[0] in SKIP_STATES['XY']:
logging.info('IFO not using sensor correction during lockloss')
return
for endstation, channel_names in CHANNELS.items():
if brs_states[0] in SKIP_STATES[endstation]:
logging.info('{} not using sensor correction during lockloss'.format(endstation))
brs_used[endstation] = False
continue
brs_all[endstation] = data.fetch(channel_names, segment)
elif config.IFO == 'L1':
for idx, (endstation, channel_names) in enumerate(CHANNELS.items()):
if brs_states[idx] in SKIP_STATES:
logging.info('{} not using sensor correction during lockloss'.format(endstation))
brs_used[endstation] = False
continue
brs_all[endstation] = data.fetch(channel_names, segment)
for endstation in brs_all:
if not brs_used[endstation]:
continue
glitch_count = 0
max_brs = 0
thresh_crossing = segment[1]
......@@ -34,7 +101,7 @@ def check_brs(event):
glitch_count += 1
srate = buf.sample_rate
t = np.arange(segment[0], segment[1], 1/srate)
glitch_idx = np.where(buf.data > config.BRS_THRESH)[0][0]
glitch_idx = np.where(buf.data > BRS_THRESH)[0][0]
glitch_time = t[glitch_idx]
thresh_crossing = min(glitch_time, thresh_crossing)
......@@ -42,10 +109,10 @@ def check_brs(event):
if glitch_count > 1:
event.add_tag('BRS_GLITCH')
else:
logging.info('No %s BRS glitching detected' % (endstation))
logging.info('No {} BRS glitching detected'.format(endstation))
fig, ax = plt.subplots(1, figsize=(22,16))
for buf in brs_channels:
for buf in brs_all[endstation]:
srate = buf.sample_rate
t = np.arange(segment[0], segment[1], 1/srate)
ax.plot(
......@@ -71,9 +138,9 @@ def check_brs(event):
ax.set_ylim(0, max_brs+1)
ax.set_xlim(t[0]-event.gps, t[-1]-event.gps)
ax.legend(loc='best')
ax.set_title('%s BRS BLRMS' % (endstation), y=1.04)
ax.set_title('{} BRS BLRMS'.format(endstation), y=1.04)
fig.tight_layout(pad=0.05)
outfile_plot = 'brs_%s.png' % (endstation)
outfile_plot = 'brs_{}.png'.format(endstation)
outpath_plot = event.path(outfile_plot)
fig.savefig(outpath_plot, bbox_inches='tight')
......@@ -11,6 +11,7 @@
<h5 class="panel-title"><a data-toggle="collapse" href="#{{id}}">{{title}} (click to show)</a></h5>
% end
</div>
<br/>
% if expand == True:
<div id="{{id}}" class="panel-collapse">
......
......@@ -98,19 +98,44 @@
<hr />
<div class="container">
<br />
<div class="row">
% brs_plots = []
% has_tag = False
% if event.has_tag('BRS_GLITCH'):
% has_tag = True
% end
% if config.IFO == 'H1':
% brs_plots, endstation_used = [], {'ETMX':True, 'ETMY':True}
% elif config.IFO == 'L1':
% brs_plots, endstation_used = [], {'ETMX':True, 'ETMY':True, 'ITMX':True, 'ITMY':True}
% end
% for endstation in endstation_used:
% brs_url = event.url('brs_{}.png'.format(endstation))
% if os.path.exists(event.path('brs_{}.png'.format(endstation))):
% brs_plots.append(brs_url)
% else:
% endstation_used[endstation] = False
% end
% end
<p>{{endstation_used}}</p>
% if any(status is True for status in endstation_used.itervalues()):
<div class="row">
% include('collapsed_plots.tpl', title ='BRS plots', id='brs', plots=brs_plots, size=5, section='main', expand=has_tag)
</div>
% end
% for endstation, used in endstation_used.iteritems():
% if used is False:
<br/>
<div class="row">
<p>{{endstation}} not using sensor correction during lockloss</p>
</div>
% end
% end
% for endstation in ['ETMX', 'ETMY']:
% brs_url = event.url('brs_%s.png' % (endstation))
% brs_url = event.url('brs_{}.png'.format(endstation))
% brs_plots.append(brs_url)
% end
% include('collapsed_plots.tpl', title ='BRS plots', id='brs', plots=brs_plots, size=5, expand=has_tag, section='main')
</div>
</div>
<!-- analog board saturation plot -->
<hr />
......
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