Commits

Kana Sugimoto authored 55bec574a76 Merge
Pull request #1423: PIPE-2187: Removed elevation difference warning message in hsd_skycal.

Merge in PIPE/pipeline from PIPE-2187-hsd_skycal-removing-duplicated-warning-for-on-and-off-difference to main * commit 'd6d73bd68b503ac9475ea52c803a49e3ad7c771b': PIPE-2187: Fixing a couple of formatting issues. PIPE-2187: Removed elevation difference warning message in hsd_skycal.

pipeline/hsd/tasks/skycal/qa.py

Modified
1 1 """QA score module for skycal task."""
2 +
2 3 import pipeline.infrastructure.basetask as basetask
3 4 import pipeline.infrastructure.logging as logging
4 5 import pipeline.infrastructure.pipelineqa as pqa
5 6 import pipeline.infrastructure.utils as utils
6 7 import pipeline.qa.scorecalculator as qacalc
7 8 import pipeline.h.tasks.exportdata.aqua as aqua
8 9 from . import skycal
9 10 from typing import TYPE_CHECKING
10 11 if TYPE_CHECKING:
11 12 from pipeline.infrastructure.launcher import Context
12 13
13 14 LOG = logging.get_logger(__name__)
14 15
15 -
16 16 class SDSkyCalQAHandler(pqa.QAPlugin):
17 17 """Class to handle QA score for skycal result."""
18 18
19 19 result_cls = skycal.SDSkyCalResults
20 20 child_cls = None
21 21
22 22 def handle(self, context: 'Context', result: skycal.SDSkyCalResults) -> None:
23 23 """Evaluate QA score for skycal result.
24 24
25 25 Args:
26 26 context: Pipeline context.
27 27 result: SDSkyCalResults instance.
28 28 """
29 29 calapps = result.outcome
30 30 resultdict = skycal.compute_elevation_difference(context, result)
31 31 vis = calapps[0].calto.vis
32 32 ms = context.observing_run.get_ms(vis)
33 - threshold = skycal.SerialSDSkyCal.ElevationDifferenceThreshold
33 + threshold = skycal.ELEVATION_DIFFERENCE_THRESHOLD
34 34 scores = qacalc.score_sd_skycal_elevation_difference(ms, resultdict, threshold=threshold)
35 35 result.qa.pool.append(scores)
36 36
37 37
38 38 class SDSkyCalListQAHandler(pqa.QAPlugin):
39 39 """Class to handle QA score for a list of skycal results."""
40 40
41 41 result_cls = basetask.ResultsList
42 42 child_cls = skycal.SDSkyCalResults
43 43
44 44 def handle(self, context: 'Context', result: skycal.SDSkyCalResults) -> None:
45 45 """Evaluate QA score for a list of skycal results.
46 46
47 47 Args:
48 48 context: Pipeline context (not used).
49 49 result: List of SDSkyCalResults instances.
50 50 """
51 51 # collate the QAScores from each child result, pulling them into our
52 52 # own QAscore list
53 - collated = utils.flatten([r.qa.pool for r in result])
53 + collated = utils.flatten([r.qa.pool for r in result])
54 54 result.qa.pool[:] = collated
55 55
56 -
57 56 aqua_exporter = aqua.xml_generator_for_metric('OnOffElevationDifference', '{:0.3f}deg')
58 57 aqua.register_aqua_metric(aqua_exporter)

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut