From 4c5ed1f7bc92fed3c5846dbcb5055fa17c832012 Mon Sep 17 00:00:00 2001 From: James Chiang Date: Mon, 30 Sep 2019 14:12:55 -0700 Subject: [PATCH 1/2] add code to persist divisidero tearing analysis outputs for BOT testing --- python/bot_eo_validators.py | 46 +++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/python/bot_eo_validators.py b/python/bot_eo_validators.py index c959e81..229497e 100644 --- a/python/bot_eo_validators.py +++ b/python/bot_eo_validators.py @@ -5,6 +5,7 @@ import os import glob from collections import OrderedDict +import json import pickle import numpy as np from astropy.io import fits @@ -41,7 +42,7 @@ def run_validator(*det_task_names): def report_missing_data(validator, missing_data, components='detectors', - total=189): + total=205): """Summarize the missing data for the specified components.""" if len(missing_data) == total: print("{}: missing data for all {} {}".format(validator, total, @@ -619,8 +620,49 @@ def validate_tearing(results, det_names): png_files = sorted(glob.glob('*_tearing.png')) results.extend(persist_tearing_png_files(png_files)) - report_missing_data("validate_tearing", missing_det_names) + missing_raft_names = set() + for raft_name in camera_info.get_installed_raft_names(): + try: + divisidero_plot = glob.glob(f'{raft_name}_*_divisidero.png')[0] + except IndexError: + missing_raft_names.add(raft_name) + continue + md = dict(DATA_PRODUCT='divisidero_tearing_plot', LsstId=raft_name) + results.append(siteUtils.make_fileref(divisidero_plot, metadata=md)) + + try: + with open(glob.glob(f'{raft_name}*max_divisidero.json')[0], 'r') \ + as fd: + max_devs = json.load(fd) + except IndexError: + missing_raft_names.add(raft_name) + continue + + fields = ('max_deviation_10_11', + 'max_deviation_11_12', + 'max_deviation_12_13', + 'max_deviation_13_14', + 'max_deviation_14_15', + 'max_deviation_15_16', + 'max_deviation_16_17', + 'max_deviation_00_01', + 'max_deviation_01_02', + 'max_deviation_02_03', + 'max_deviation_03_04', + 'max_deviation_04_05', + 'max_deviation_05_06', + 'max_deviation_06_07') + + divisidero_schema = lcatr.schema.get('divisidero_tearing') + for slot, values in max_devs.items(): + data = {field: max_dev for field, max_dev in zip(fields, values)} + results.append(lcatr.schema.valid(divisidero_schema, slot=slot, + sensor_id=slot, **data)) + + report_missing_data("validate_tearing", missing_det_names) + report_missing_data("validate_tearing", sorted(list(missing_raft_names)), + components='rafts', total=25) return results From c8e8edea207d3c00d093bff881a8d1edd4f5cbfa Mon Sep 17 00:00:00 2001 From: James Chiang Date: Mon, 30 Sep 2019 14:13:38 -0700 Subject: [PATCH 2/2] run command line scripts under ipython since png rendering with savefig is significantly faster --- python/ssh_dispatcher.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/ssh_dispatcher.py b/python/ssh_dispatcher.py index d41ae84..f6e5689 100644 --- a/python/ssh_dispatcher.py +++ b/python/ssh_dispatcher.py @@ -114,7 +114,7 @@ def launch_script(self, remote_host, task_id, *args): command += f'"cd {working_dir}; source {setup}; ' for key, value in self.lcatr_envs.items(): command += f'export {key}={value}; ' - command += f'(echo; {script} {task_id} ' + command += f'(echo; ipython {script} {task_id} ' command += ' '.join([str(_) for _ in args]) command += r' && echo Task succeeded on \`hostname\`' command += r' || echo Task failed on \`hostname\`)'