Skip to content
Snippets Groups Projects
Commit c5850856 authored by Marc Lormand's avatar Marc Lormand Committed by Jameson Rollins
Browse files

Improved tagging of elevated seismicity

Expand SEISMIC tag into separate tags indicated elevated noise in the separate EARTHQUAKE, ANTHROPOGENIC, and MICROSEISMIC bands; include plots for all bands.
parent 0f24a123
No related branches found
No related tags found
No related merge requests found
......@@ -66,7 +66,9 @@ TAG_COLORS = {
'BRS_GLITCH': ('rebeccapurple', 'lavender'),
'BOARD_SAT': ('navy', 'cornflowerblue'),
'WINDY': ('springgreen', 'mediumblue'),
'SEISMIC': ('orange', 'black'),
'EARTHQUAKE': ('orange', 'black'),
'MICROSEISMIC': ('yellow', 'black'),
'ANTHROPOGENIC': ('red', 'black'),
'ADS_EXCURSION': ('mediumvioletred', 'plum'),
'SEI_BS_TRANS': ('sienna', 'orange'),
}
......@@ -301,17 +303,91 @@ elif IFO == 'L1':
##################################################
SEISMIC_CHANNELS = [
'ISI-GND_STS_ITMY_Z_BLRMS_30M_100M',
'ISI-GND_STS_ITMY_Z_DQ',
]
SEISMIC_CHANNELS = ifochans(SEISMIC_CHANNELS)
# Set seismic band thresholds based on IFO site
if IFO == 'H1':
SEI_THRESH = 300
SEI_EARTHQUAKE_THRESH = 300
SEI_ANTHROPOGENIC_THRESH = 1000 # placeholder
SEI_MICROSEISMIC_THRESH = 3000 # placeholder
if IFO == 'L1':
SEI_THRESH = 600
SEI_EARTHQUAKE_THRESH = 600
SEI_ANTHROPOGENIC_THRESH = 1000
SEI_MICROSEISMIC_THRESH = 3000
# Main data structure, each subdictionary contains the channel, save file name, data quality key,
# channel's data axis, threshold for the channel, and tag designation
SEISMIC_CONFIG = {
'EQ band' : {
'channel' : 'ISI-GND_STS_ITMY_Z_BLRMS_30M_100M',
'savefile' : 'seismic_eq.png',
'dq_channel' : 'ISI-GND_STS_ITMY_Z_DQ',
'axis' : 'Z',
'threshold' : SEI_EARTHQUAKE_THRESH,
'tag' : 'EARTHQUAKE',
},
'anthropogenic corner' : {
'channel' : 'ISI-GND_STS_ITMY_Z_BLRMS_1_3',
'savefile' : 'seismic_anthro_ITMY.png',
'dq_channel' : 'ISI-GND_STS_ITMY_Z_DQ',
'axis' : 'Z',
'threshold' : SEI_ANTHROPOGENIC_THRESH,
'tag' : 'ANTHROPOGENIC',
},
'anthropogenic Xend' : {
'channel' : 'ISI-GND_STS_ETMX_Z_BLRMS_1_3',
'savefile' : 'seismic_anthro_ETMX.png',
'dq_channel' : 'ISI-GND_STS_ETMX_Z_DQ',
'axis' : 'Z',
'threshold' : SEI_ANTHROPOGENIC_THRESH,
'tag' : 'ANTHROPOGENIC',
},
'anthropogenic Yend' : {
'channel' : 'ISI-GND_STS_ETMY_Z_BLRMS_1_3',
'savefile' : 'seismic_anthro_ETMY.png',
'dq_channel' : 'ISI-GND_STS_ETMY_Z_DQ',
'axis' : 'Z',
'threshold' : SEI_ANTHROPOGENIC_THRESH,
'tag' : 'ANTHROPOGENIC',
},
'micro ITMY Y 100u 300u' : {
'channel' : 'ISI-GND_STS_ITMY_Y_BLRMS_100M_300M',
'savefile' : 'seismic_micro_Y_100u_300u.png',
'dq_channel' : 'ISI-GND_STS_ITMY_Y_DQ',
'axis' : 'Y',
'threshold' : SEI_MICROSEISMIC_THRESH,
'tag' : 'MICROSEISMIC',
},
'micro ITMY Y 300u 1' : {
'channel' : 'ISI-GND_STS_ITMY_Y_BLRMS_300M_1',
'savefile' : 'seismic_micro_Y_300u_1.png',
'dq_channel' : 'ISI-GND_STS_ITMY_Y_DQ',
'axis' : 'Y',
'threshold' : SEI_MICROSEISMIC_THRESH,
'tag' : 'MICROSEISMIC',
},
'micro ITMY Z 100u 300u' : {
'channel' : 'ISI-GND_STS_ITMY_Z_BLRMS_100M_300M',
'savefile' : 'seismic_micro_Z_100u_300u.png',
'dq_channel' : 'ISI-GND_STS_ITMY_Z_DQ',
'axis' : 'Z',
'threshold' : SEI_MICROSEISMIC_THRESH,
'tag' : 'MICROSEISMIC',
},
'micro ITMY Z 300u 1' : {
'channel' : 'ISI-GND_STS_ITMY_Z_BLRMS_300M_1',
'savefile' : 'seismic_micro_Z_300u_1.png',
'dq_channel' : 'ISI-GND_STS_ITMY_Z_DQ',
'axis' : 'Z',
'threshold' : SEI_MICROSEISMIC_THRESH,
'tag' : 'MICROSEISMIC',
},
}
# Loop to convert channel names to the IFO channel names
# Could not use ifochans function since ifochans was only pulling one character at a time from channel string
for i in SEISMIC_CONFIG:
SEISMIC_CONFIG[i]['channel'] = '{}:{}'.format(IFO, SEISMIC_CONFIG[i]['channel'])
SEISMIC_CONFIG[i]['dq_channel'] = '{}:{}'.format(IFO, SEISMIC_CONFIG[i]['dq_channel'])
SEI_SEARCH_WINDOW = [-30, 150]
##################################################
......
......@@ -20,76 +20,103 @@ def check_seismic(event):
"""
mod_window = [config.SEI_SEARCH_WINDOW[0], config.SEI_SEARCH_WINDOW[1]]
segment = Segment(mod_window).shift(int(event.gps))
# need to wait for low-frequency response data to be available
# since it's later than the the default data discovery window
# FIXME: what to do if timeout reached?
data.data_wait(segment)
earthquake_tag = False
micro_tag = False
anthro_tag = False
# Create the channel list that is used to get the data
channel_list = []
for v in config.SEISMIC_CONFIG.values():
channel_list.append(v['channel'])
if v['dq_channel'] not in channel_list:
channel_list.append(v['dq_channel'])
# Fetch data using channel list into the dictionary channel_data
channel_data = data.fetch(channel_list, segment, as_dict=True)
plotutils.set_rcparams()
# Main loop, use config.SEISMIC_CONFIG keys to call data from channel_data dictionary
for band, params in config.SEISMIC_CONFIG.items():
seismic_channels = data.fetch(config.SEISMIC_CHANNELS, segment)
channel = params['channel']
dq_channel = params['dq_channel']
if any(seismic_channels[0].data > config.SEI_THRESH):
event.add_tag('SEISMIC')
else:
logging.info('ground motion below threshold')
blrms_srate = channel_data[channel].sample_rate
blrms_t = channel_data[channel].tarray
raw_srate = channel_data[dq_channel].sample_rate
raw_t = channel_data[dq_channel].tarray
blrms_srate = seismic_channels[0].sample_rate
blrms_t = np.arange(segment[0], segment[1], 1/blrms_srate)
raw_srate = seismic_channels[1].sample_rate
raw_t = np.arange(segment[0], segment[1], 1/raw_srate)
fig, ax = plt.subplots(1, figsize=(22,16))
ln1 = ax.plot(
blrms_t-event.gps,
channel_data[channel].data,
label=channel_data[channel].channel,
alpha=0.8,
lw=2,
color='indigo',
)
ax2 = ax.twinx()
ln2 = ax2.plot(
raw_t-event.gps,
channel_data[dq_channel].data,
label=channel_data[dq_channel].channel,
alpha=0.6,
lw=2,
color='seagreen',
)
ln3 = ax.axhline(
params['threshold'],
linestyle='--',
color='indigo',
label='seismic threshold',
lw=5,
)
# setting left y-axis paramters
ax.spines['left'].set_color('indigo')
ax.yaxis.label.set_color('indigo')
ax.tick_params(axis='y', colors='indigo')
ax.set_ylabel('Band-limited RMS Velocity [nm/s]')
ax.set_ylim(0, max(channel_data[channel].data)+1)
plotutils.set_rcparams()
# setting right y-axis parameters
ax2.spines['right'].set_color('seagreen')
ax2.yaxis.label.set_color('seagreen')
ax2.tick_params(axis='y', colors='seagreen')
ax2.set_ylabel('Raw Output Velocity [nm/s]')
# setting general plot parameters
lns = ln1+ln2+[ln3]
labs = [l.get_label() for l in lns]
ax.legend(lns, labs, loc='best')
ax.set_xlabel(
'Time [s] since lock loss at {}'.format(event.gps),
labelpad=10,
)
plt.xlim(blrms_t[0]-event.gps, blrms_t[-1]-event.gps)
ax.set_title('{}-axis seismic motion'.format(params['axis']))
fig.tight_layout(pad=0.05)
outfile_plot = params['savefile']
outpath_plot = event.path(outfile_plot)
fig.savefig(outpath_plot, bbox_inches='tight')
if any(channel_data[channel].data > params['threshold']):
if not event.has_tag(params['tag']):
event.add_tag(params['tag'])
# Logging info
if not event.has_tag('EARTHQUAKE'):
logging.info('Earthquake ground motion below threshold')
if not event.has_tag('ANTHROPOGENIC'):
logging.info('anthropogenic ground motion below threshold')
if not event.has_tag('MICROSEISMIC'):
logging.info('microseismic ground motion below threshold')
fig, ax = plt.subplots(1, figsize=(22,16))
ln1 = ax.plot(
blrms_t-event.gps,
seismic_channels[0].data,
label=seismic_channels[0].channel,
alpha=0.8,
lw=2,
color='indigo',
)
ax2 = ax.twinx()
ln2 = ax2.plot(
raw_t-event.gps,
seismic_channels[1].data,
label=seismic_channels[1].channel,
alpha=0.6,
lw=2,
color='seagreen',
)
ln3 = ax.axhline(
config.SEI_THRESH,
linestyle='--',
color='indigo',
label='seismic threshold',
lw=5,
)
# setting left y-axis paramters
ax.spines['left'].set_color('indigo')
ax.yaxis.label.set_color('indigo')
ax.tick_params(axis='y', colors='indigo')
ax.set_ylabel('Band-limited RMS Velocity [nm/s]')
ax.set_ylim(0, max(seismic_channels[0].data)+1)
# setting right y-axis parameters
ax2.spines['right'].set_color('seagreen')
ax2.yaxis.label.set_color('seagreen')
ax2.tick_params(axis='y', colors='seagreen')
ax2.set_ylabel('Raw Output Velocity [nm/s]')
# setting general plot parameters
lns = ln1+ln2+[ln3]
labs = [l.get_label() for l in lns]
ax.legend(lns, labs, loc='best')
ax.set_xlabel(
'Time [s] since lock loss at {}'.format(event.gps),
labelpad=10,
)
plt.xlim(blrms_t[0]-event.gps, blrms_t[-1]-event.gps)
ax.set_title('Z-axis seismic motion')
fig.tight_layout(pad=0.05)
outfile_plot = 'seismic.png'
outpath_plot = event.path(outfile_plot)
fig.savefig(outpath_plot, bbox_inches='tight')
......@@ -144,13 +144,10 @@
<br />
<div class="row">
% has_tag = False
% if event.has_tag('SEISMIC') or event.has_tag('WINDY'):
% has_tag = True
% end
% env_plots = [
% event.url('windy.png'),
% event.url('seismic.png'),
% ]
% has_tag = any([event.has_tag(tag) for tag in ['EARTHQUAKE', 'WINDY', 'MICROSEISMIC', 'ANTHROPOGENIC']])
% env_plots = [event.url(v['savefile']) for v in config.SEISMIC_CONFIG.values()]
% env_plots.insert(0, event.url('windy.png'))
%
% include('collapsed_plots.tpl', title ='Environment plots', id='environment', plots=env_plots, size=5, expand=has_tag, section='main')
</div>
</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