diff --git a/locklost/config.py b/locklost/config.py index 9c00c00e54cf029aaa5ca566a4015ff60603d3c8..0c32fcbccf0171329a8f9dda6232f110b6aaa713 100644 --- a/locklost/config.py +++ b/locklost/config.py @@ -140,26 +140,29 @@ PLOT_CHUNKSIZE = 3000 if IFO == 'H1': CHANGE_DAC_DATE = 1224961218 if IFO == 'L1': - CHANGE_DAC_DATE = 1188518418 + CHANGE_DAC_DATE = 1279979838 # ETM's are 20-bit and were changed at a date within our wanted # lockloss time range if IFO == 'H1': - ETM_L3_CHANNELS = [ + TWENTY_BIT_CHANNELS = [ 'SUS-ETMX_L3_MASTER_OUT_UR_DQ', 'SUS-ETMX_L3_MASTER_OUT_UL_DQ', 'SUS-ETMX_L3_MASTER_OUT_LR_DQ', 'SUS-ETMX_L3_MASTER_OUT_LL_DQ', ] if IFO == 'L1': - ETM_L3_CHANNELS = [ - 'SUS-ETMY_L3_MASTER_OUT_DC_DQ', - 'SUS-ETMY_L3_MASTER_OUT_UR_DQ', - 'SUS-ETMY_L3_MASTER_OUT_UL_DQ', - 'SUS-ETMY_L3_MASTER_OUT_LR_DQ', - 'SUS-ETMY_L3_MASTER_OUT_LL_DQ' - ] -ETM_L3_CHANNELS = ifochans(ETM_L3_CHANNELS) + TWENTY_BIT_CHANNELS = [] + for optic in ['ETMX', 'ETMY']: + for stage in ['L1', 'L2', 'L3']: + for quadrant in ['UL', 'LL', 'UR', 'LR']: + TWENTY_BIT_CHANNELS.append('SUS-{}_{}_MASTER_OUT_{}_DQ'.format(optic, stage, quadrant)) + for quadrant in ['F1', 'F2', 'F3', 'LF', 'RT', 'SD']: + TWENTY_BIT_CHANNELS.append('SUS-{}_{}_MASTER_OUT_{}_DQ'.format(optic, 'M0', quadrant)) + for optic in ['TMSX', 'TMSY']: + for quadrant in ['F1', 'F2', 'F3', 'LF', 'RT', 'SD']: + TWENTY_BIT_CHANNELS.append('SUS-{}_{}_MASTER_OUT_{}_DQ'.format(optic, 'M1', quadrant)) +TWENTY_BIT_CHANNELS = ifochans(TWENTY_BIT_CHANNELS) # RM's, OM'S, and ZM'S are 16-bit SIXTEEN_BIT_CHANNELS = [ diff --git a/locklost/plugins/__init__.py b/locklost/plugins/__init__.py index 6a7129a9569e54400644cd4da5d598bb3178edf5..5964751dd18943361f139e98c49b38c5ae3f5ec7 100644 --- a/locklost/plugins/__init__.py +++ b/locklost/plugins/__init__.py @@ -25,14 +25,14 @@ def register_plugin(func): from .discover import discover_data register_plugin(discover_data) -from .history import find_previous_state -register_plugin(find_previous_state) +# from .history import find_previous_state +# register_plugin(find_previous_state) from .refine import refine_time register_plugin(refine_time) -from .ifo_mode import check_ifo_mode -register_plugin(check_ifo_mode) +# from .ifo_mode import check_ifo_mode +# register_plugin(check_ifo_mode) from .saturations import find_saturations register_plugin(find_saturations) @@ -40,33 +40,33 @@ register_plugin(find_saturations) from .lpy import find_lpy register_plugin(find_lpy) -from .lsc_asc import plot_lsc_asc -register_plugin(plot_lsc_asc) - -from .glitch import analyze_glitches -register_plugin(analyze_glitches) - -from .overflows import find_overflows -register_plugin(find_overflows) - -from .brs import check_brs -register_plugin(check_brs) - -from .board_sat import check_boards -register_plugin(check_boards) - -from .wind import check_wind -register_plugin(check_wind) - -from .ads_excursion import check_ads -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) +# from .lsc_asc import plot_lsc_asc +# register_plugin(plot_lsc_asc) +# +# from .glitch import analyze_glitches +# register_plugin(analyze_glitches) +# +# from .overflows import find_overflows +# register_plugin(find_overflows) +# +# from .brs import check_brs +# register_plugin(check_brs) +# +# from .board_sat import check_boards +# register_plugin(check_boards) +# +# from .wind import check_wind +# register_plugin(check_wind) +# +# from .ads_excursion import check_ads +# 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) diff --git a/locklost/plugins/lpy.py b/locklost/plugins/lpy.py index f8417459e7a9a02c0c915afd1ee62359048bbb4a..2f2da91536a5b06a1dee6e31a2e16c7e065195a3 100644 --- a/locklost/plugins/lpy.py +++ b/locklost/plugins/lpy.py @@ -27,22 +27,34 @@ def find_lpy(event): infile_csv = 'saturations.csv' inpath_csv = event.path(infile_csv) sat_channel = '' - lpy_lim = 4*config.SATURATION_THRESHOLD if not os.path.exists(inpath_csv): - logging.info("LPY plot bypassed (no saturating suspensions).") - return - - with open(inpath_csv, 'r') as f: - first_sat = f.readline() - if first_sat: - sat_channel, sat_time = first_sat.split(' ', 1) + sat_channel = '{}:SUS-ETMX_L3_MASTER_OUT_UR_DQ'.format(config.IFO) + else: + with open(inpath_csv, 'r') as f: + first_sat = f.readline() + if first_sat: + sat_channel, sat_time = first_sat.split(' ', 1) + + # set lpy saturation limits based on if channel is 16, 18, or 20-bit + if gps > config.CHANGE_DAC_DATE and sat_channel in config.TWENTY_BIT_CHANNELS: + one_quad_lim = 4*config.SATURATION_THRESHOLD + elif sat_channel in config.SIXTEEN_BIT_CHANNELS: + one_quad_lim = config.SATURATION_THRESHOLD/4 + else: + one_quad_lim = config.SATURATION_THRESHOLD + lpy_lim = 4*one_quad_lim # generate the LPY mapping and channels to query from base channel lpy_map = channel2lpy_coeffs(sat_channel) base_channel, _, _ = sat_channel.rsplit('_', 2) channels = [get_sus_channel(base_channel, corner) for corner in lpy_map['corners']] + magnet_map = magnet_orientation(sat_channel) + for lpy in ['length', 'pitch', 'yaw']: + for corner in lpy_map[lpy]: + lpy_map[lpy][corner] *= magnet_map[corner] + for window_type, window in config.PLOT_WINDOWS.items(): logging.info('Making {} LPY plot for {}'.format(window_type, base_channel)) @@ -124,6 +136,44 @@ def extract_sus_channel(channel): return optic, stage, corner +def magnet_orientation(channel): + + optic, stage, corner = extract_sus_channel(channel) + + if optic in ['ETMX', 'ETMY', 'ITMX', 'ITMY']: + if stage in ['M0']: + magnet_map = {'F2': -1, 'F3': 1} + elif stage in ['L1']: + if optic in ['ETMX']: + magnet_map = {'UL': -1, 'UR': -1, 'LL': 1, 'LR': 1} + else: + magnet_map = {'UL': -1, 'UR': 1, 'LL': 1, 'LR': -1} + elif stage in ['L2']: + magnet_map = {'UL': 1, 'UR': -1, 'LL': -1, 'LR': 1} + elif stage in ['L3']: + magnet_map = {'UL': 1, 'UR': 1, 'LL': 1, 'LR': 1} + elif optic in ['MC1', 'MC2', 'MC3', 'PRM', 'PR2', 'PR3', 'SRM', 'SR2', 'SR3', 'OMC']: + if stage in ['M1']: + magnet_map = {'LF': 1, 'RT': -1, 'T2': -1, 'T3': 1} + if stage in ['M2', 'M3']: + magnet_map = {'UL': 1, 'UR': -1, 'LL': -1, 'LR': 1} + elif optic in ['BS']: + if stage in ['M1']: + magnet_map = {'LF': 1, 'RT': -1, 'F2': 1, 'F3': -1} + if stage in ['M2']: + magnet_map = {'UL': 1, 'UR': -1, 'LL': -1, 'LR': 1} + elif optic in ['TMSX', 'TMSY']: + magnet_map = {'LF': -1, 'RT': 1, 'F2': -1, 'F3': 1} + elif optic in ['OM1', 'OM2', 'OM3', 'RM1', 'ZM1', 'ZM2']: + if stage in ['M1']: + magnet_map = {'UL': 1, 'UR': -1, 'LL': -1, 'LR': 1} + elif optic in ['RM2']: + if stage in ['M1']: + magnet_map = {'UL': -1, 'UR': 1, 'LL': 1, 'LR': -1} + + return magnet_map + + def channel2lpy_coeffs(channel): """From a suspension channel, get a dictionary containing the LPY coefficients. @@ -153,7 +203,7 @@ def channel2lpy_coeffs(channel): lpy_map['pitch'] = {'UL': 1, 'LL': -1, 'UR': 1, 'LR': -1} lpy_map['yaw'] = {'UL': -1, 'LL': -1, 'UR': 1, 'LR': 1} lpy_map['corners'] = ['UL', 'LL', 'UR', 'LR'] - elif optic in ['BS']: + elif optic in ['BS', 'TMSX', 'TMSY']: if stage in ['M1']: lpy_map['length'] = {'LF': 1, 'RT': 1} lpy_map['pitch'] = {'F2': -1, 'F3': -1} diff --git a/locklost/plugins/saturations.py b/locklost/plugins/saturations.py index e1a8ecb563a09c1e582fb2e760bd0238b32c9697..82445d8d0d23c8f81c20e3d27ccd6552b91bad82 100644 --- a/locklost/plugins/saturations.py +++ b/locklost/plugins/saturations.py @@ -21,7 +21,7 @@ def find_saturations(event): saturation_threshold = config.SATURATION_THRESHOLD low_thresh_channels = config.SIXTEEN_BIT_CHANNELS - high_thresh_channels = config.ETM_L3_CHANNELS + high_thresh_channels = config.TWENTY_BIT_CHANNELS plot_first = config.PLOT_SATURATIONS sat_search_window = config.SAT_SEARCH_WINDOW dac_change_date = config.CHANGE_DAC_DATE @@ -259,6 +259,8 @@ def gen_channel_names(): for corner in ['F1', 'F2', 'F3', 'LF', 'RT', 'SD']: add_channel('BS', 'M1', corner) + add_channel('TMSX', 'M1', corner) + add_channel('TMSY', 'M1', corner) for corner in corners: add_channel('BS', 'M2', corner) for corner in triple_top_corners: diff --git a/locklost/web/templates/event.tpl b/locklost/web/templates/event.tpl index 8263efe40bac6cb2c44b6e02b1bfb39f5ed1c4aa..fdc40ee3533f72176cc84a1c08b71468261ec21d 100644 --- a/locklost/web/templates/event.tpl +++ b/locklost/web/templates/event.tpl @@ -78,19 +78,15 @@ % end -% if sat_channels: -
Length, pitch, and yaw drives reconstructed from osem DAC counts for first suspension stage to saturate.
-% include('plots.tpl', plots=event_plot_urls(event, 'lpy'), size=6) -LPY plots not created due to lack of saturating suspension channels.
-% end +Length, pitch, and yaw drives reconstructed from osem DAC counts for first suspension stage to saturate.
+% include('plots.tpl', plots=event_plot_urls(event, 'lpy'), size=6) +