From ed3937f55baebde621c78165a7ac68bebe08d712 Mon Sep 17 00:00:00 2001 From: Coda Phillips <cphillips@sean.ssec.wisc.edu> Date: Mon, 11 Jul 2016 11:30:02 -0500 Subject: [PATCH] Add abb check --- scene_checks.py | 2 +- state_checks.py | 52 +++++++++++++++++++++++++++---------------------- 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/scene_checks.py b/scene_checks.py index 9378384..d1d6971 100644 --- a/scene_checks.py +++ b/scene_checks.py @@ -11,7 +11,7 @@ def hatch_check(frame, parameters): hatch_closed_during_viewing = ((frame.hatchOpen != 1) & (~frame.sceneMirrorPosition.isin([ord('H'), ord('A')]))) - frame['hatch_check'] = hatch_closed_during_viewing + frame['hatch_check'] = hatch_closed_during_viewing * 1 annotate_all(frame, hatch_closed_during_viewing, 'hatch closed') return frame diff --git a/state_checks.py b/state_checks.py index be91118..1ef7bdb 100644 --- a/state_checks.py +++ b/state_checks.py @@ -16,39 +16,45 @@ def detector_check(frame, parameters): return frame def hbb_thermistor_check(frame, parameters): + return thermistor_check(frame, 'HBB', 331, 335) + +def abb_thermistor_check(frame, parameters): + return thermistor_check(frame, 'ABB', 150, 335) + +def thermistor_check(frame, bb, low, high): """ - Check that all HBB thermistor temps are in range + Check that all thermistor temps are in range """ - if not np.in1d(['HBBbottomTemp','HBBapexTemp','HBBtopTemp'], frame.columns).all(): + if not np.in1d([x.format(bb) for x in ['{}bottomTemp','{}apexTemp','{}topTemp']], frame.columns).all(): return frame - hbbb_too_low = (frame['HBBbottomTemp'] - 333) < -2 - hbba_too_low = (frame['HBBapexTemp'] - 333) < -2 - hbbt_too_low = (frame['HBBtopTemp'] - 333) < -2 - hbbb_too_high = (frame['HBBbottomTemp'] - 333) > 2 - hbba_too_high = (frame['HBBapexTemp'] - 333) > 2 - hbbt_too_high = (frame['HBBtopTemp'] - 333) > 2 - hbbb_problem = hbbb_too_low | hbbb_too_high - hbba_problem = hbba_too_low | hbba_too_high - hbbt_problem = hbbt_too_low | hbbt_too_high + bbb_too_low = frame['{}bottomTemp'.format(bb)] < low + bba_too_low = frame['{}apexTemp'.format(bb)] < low + bbt_too_low = frame['{}topTemp'.format(bb)] < low + bbb_too_high = frame['{}bottomTemp'.format(bb)] > high + bba_too_high = frame['{}apexTemp'.format(bb)] > high + bbt_too_high = frame['{}topTemp'.format(bb)] > high + bbb_problem = bbb_too_low | bbb_too_high + bba_problem = bba_too_low | bba_too_high + bbt_problem = bbt_too_low | bbt_too_high # Record qc for each thermistor # qc variables are probabilites between 0 and 1 variable_qcs = pd.DataFrame({ - 'qc_HBBbottomTemp':hbbb_problem * 1, - 'qc_HBBapexTemp' : hbba_problem * 1, - 'qc_HBBtopTemp' : hbbt_problem * 1 + 'qc_{}bottomTemp'.format(bb) :bbb_problem * 1, + 'qc_{}apexTemp'.format(bb) : bba_problem * 1, + 'qc_{}topTemp'.format(bb) : bbt_problem * 1 }, index=frame.index) frame = update_variable_qc(frame, variable_qcs) # Compute overall BB quality - frame['hbb_thermistor_check'] = (hbbb_problem | hbba_problem | hbbt_problem) * 1 - annotate_all(frame, hbbb_too_low, 'HBB bottom temperature too low') - annotate_all(frame, hbbt_too_low, 'HBB top temperature too low') - annotate_all(frame, hbba_too_low, 'HBB apex temperature too low') - annotate_all(frame, hbbb_too_high, 'HBB bottom temperature too high') - annotate_all(frame, hbbt_too_high, 'HBB top temperature too high') - annotate_all(frame, hbba_too_high, 'HBB apex temperature too high') - frame = invalidate_records(frame, 'hbb_thermistor_check') + frame['{}_thermistor_check'.format(bb.lower())] = (bbb_problem | bba_problem | bbt_problem) * 1 + annotate_all(frame, bbb_too_low, '{} bottom temperature too low'.format(bb)) + annotate_all(frame, bbt_too_low, '{} top temperature too low'.format(bb)) + annotate_all(frame, bba_too_low, '{} apex temperature too low'.format(bb)) + annotate_all(frame, bbb_too_high, '{} bottom temperature too high'.format(bb)) + annotate_all(frame, bbt_too_high, '{} top temperature too high'.format(bb)) + annotate_all(frame, bba_too_high, '{} apex temperature too high'.format(bb)) + frame = invalidate_records(frame, '{}_thermistor_check'.format(bb.lower())) return frame def hbb_stable_check(frame, parameters): @@ -76,7 +82,7 @@ def hbb_stable_check(frame, parameters): return frame class CheckList(BaseCheckList): - checks = [detector_check, hbb_thermistor_check, hbb_stable_check] + checks = [detector_check, hbb_thermistor_check, hbb_stable_check, abb_thermistor_check] #### TESTS #### -- GitLab