Skip to content

Commit

Permalink
Merge pull request #47 from lsst-camera-dh/LSSTTD-1441_persist_divisi…
Browse files Browse the repository at this point in the history
…dero_results

Lssttd 1441 persist divisidero results in BOT testing
  • Loading branch information
jchiang87 authored Sep 30, 2019
2 parents 0a8c4f8 + c8e8ede commit ae3f52b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
46 changes: 44 additions & 2 deletions python/bot_eo_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion python/ssh_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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\`)'
Expand Down

0 comments on commit ae3f52b

Please sign in to comment.