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

Merge branch 'brs_cleanup' into 'master'

Cleanup BRS glitch code

See merge request !88
parents 427f7903 37168f5f
No related branches found
No related tags found
No related merge requests found
......@@ -226,62 +226,6 @@ LPY_CHANNELS = ifochans(LPY_CHANNELS)
##################################################
BRS_SEARCH_WINDOW = [-30, 5]
BRS_THRESHOLD = 15
# H1 checks single status channel that says what combination of BRSX/BRSY is
# being used
if IFO == 'H1':
BRS_CONFIG = {
'ETMX': {
'axis': 'RY',
'skip_states': {65},
},
'ETMY': {
'axis': 'RX',
'skip_states': {60},
},
}
for station in BRS_CONFIG:
BRS_CONFIG[station]['state_chan'] = 'H1:GRD-SEI_CONF_REQUEST_N'
BRS_CONFIG[station]['skip_states'] |= {10, 17, 45}
# L1 checks status channels for each individual BRS (ETMs and ITMs) that says
# whether it's being used
elif IFO == 'L1':
BRS_CONFIG = {
'ITMX': {
'axis': 'RY',
'state_chan': 'L1:ISI-ITMX_ST1_SENSCOR_X_FADE_CUR_CHAN_MON',
},
'ETMX': {
'axis': 'RY',
'state_chan': 'L1:ISI-ETMX_ST1_SENSCOR_Y_FADE_CUR_CHAN_MON',
},
'ITMY': {
'axis': 'RX',
'state_chan': 'L1:ISI-ITMY_ST1_SENSCOR_Y_FADE_CUR_CHAN_MON',
},
'ETMY': {
'axis': 'RX',
'state_chan': 'L1:ISI-ETMY_ST1_SENSCOR_Y_FADE_CUR_CHAN_MON',
},
}
for station in BRS_CONFIG:
BRS_CONFIG[station]['skip_states'] = {8, 9}
for station, params in BRS_CONFIG.items():
BRS_CONFIG[station]['channels'] = [
'{}:ISI-GND_BRS_{}_{}_BLRMS_{}'.format(
IFO, station, params['axis'], ending) \
for ending in [
'100M_300M',
'300M_1',
'1_3',
]]
##################################################
BOARD_SAT_CM = [
'mediumseagreen',
'cornflowerblue',
......
......@@ -8,6 +8,66 @@ from .. import config
from .. import data
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':
CONFIG = {
'ETMX': {
'skip_states': {65},
'axis': 'RY',
},
'ETMY': {
'skip_states': {60},
'axis': 'RX',
},
}
for station in CONFIG:
CONFIG[station]['state_chan'] = 'H1:GRD-SEI_CONF_REQUEST_N'
CONFIG[station]['skip_states'] |= {10, 17, 45}
# L1 checks status channels for each individual BRS (ETMs and ITMs) that says
# whether it's being used
elif config.IFO == 'L1':
CONFIG = {
'ITMX': {
'state_chan': 'L1:ISI-ITMX_ST1_SENSCOR_X_FADE_CUR_CHAN_MON',
'axis': 'RY',
},
'ETMX': {
'state_chan': 'L1:ISI-ETMX_ST1_SENSCOR_Y_FADE_CUR_CHAN_MON',
'axis': 'RY',
},
'ITMY': {
'state_chan': 'L1:ISI-ITMY_ST1_SENSCOR_Y_FADE_CUR_CHAN_MON',
'axis': 'RX',
},
'ETMY': {
'state_chan': 'L1:ISI-ETMY_ST1_SENSCOR_Y_FADE_CUR_CHAN_MON',
'axis': 'RX',
},
}
for station in CONFIG:
CONFIG[station]['skip_states'] = {8, 9}
for station in CONFIG:
channels = []
for ending in CHANNEL_ENDINGS:
channels.append('{}:ISI-GND_BRS_{}_{}_BLRMS_{}'.format(config.IFO, station, CONFIG[station]['axis'], ending))
CONFIG[station]['channels'] = channels
THRESHOLD = 15
SEARCH_WINDOW = [-30, 5]
#################################################
def check_brs(event):
"""Checks for BRS glitches at both end stations.
......@@ -19,9 +79,9 @@ def check_brs(event):
plotutils.set_rcparams()
segment = Segment(config.BRS_SEARCH_WINDOW).shift(int(event.gps))
segment = Segment(SEARCH_WINDOW).shift(int(event.gps))
for station, params in config.BRS_CONFIG.items():
for station, params in CONFIG.items():
# fetch all data (state and data)
channels = [params['state_chan']] + params['channels']
try:
......@@ -44,10 +104,10 @@ def check_brs(event):
thresh_crossing = segment[1]
for channel, buf in buf_dict.items():
max_brs = max([max_brs, max(buf.data)])
if any(buf.data > config.BRS_THRESHOLD):
if any(buf.data > THRESHOLD):
logging.info('BRS GLITCH DETECTED in {}'.format(channel))
event.add_tag('BRS_GLITCH')
glitch_idx = np.where(buf.data > config.BRS_THRESHOLD)[0][0]
glitch_idx = np.where(buf.data > THRESHOLD)[0][0]
glitch_time = buf.tarray[glitch_idx]
thresh_crossing = min(glitch_time, thresh_crossing)
......@@ -62,7 +122,7 @@ def check_brs(event):
lw=2,
)
ax.axhline(
config.BRS_THRESHOLD,
THRESHOLD,
linestyle='--',
color='black',
label='BRS glitch threshold',
......
......@@ -4,6 +4,7 @@
% from datetime import timedelta
% from locklost import config
% from locklost.web.utils import analysis_status_button, event_plot_urls
% from locklost.plugins import brs
<!-- event status button -->
% status_button = analysis_status_button(event)
......@@ -96,22 +97,30 @@
<div class="container">
<br />
% brs_plots = []
% brs_unused = []
% for station in config.BRS_CONFIG:
% brs_used = {station:True for station in brs.CONFIG}
% for station in brs.CONFIG:
% if os.path.exists(event.path('brs_{}.png'.format(station))):
% brs_plots.append(event.url('brs_{}.png'.format(station)))
% else:
% brs_unused.append(station)
% brs_used[station] = False
% end
% end
<div class="row">
% include('collapsed_plots.tpl', title ='BRS plots', id='brs', plots=brs_plots, size=5, section='main', expand=event.has_tag('BRS_GLITCH'))
</div>
% for station in brs_unused:
<br/>
<div class="row">
<p>{{station}} not using sensor correction during lockloss</p>
</div>
% if any(status is True for status in brs_used.values()):
<div class="row">
% include('collapsed_plots.tpl', title ='BRS plots', id='brs', plots=brs_plots, size=5, section='main', expand=event.has_tag('BRS_GLITCH'))
</div>
% end
% if not any(brs_used.values()):
<h3>BRS plots</h3>
% end
% for endstation, used in brs_used.items():
% if not used:
<br/>
<div class="row">
<p>{{endstation}} not using sensor correction during lockloss</p>
</div>
% end
% end
</div>
......
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