From 21d8165d7007c5caf1e2560016df8166ca5e0e78 Mon Sep 17 00:00:00 2001 From: John Parejko Date: Tue, 25 Jul 2023 20:24:00 -0700 Subject: [PATCH] Clarify output values Modify header message to make it more obvious what is being printed. Print each value and the difference, for clarity. --- python/lsst/verify/bin/print_metricvalues.py | 8 +++++++- python/lsst/verify/extract_metricvalues.py | 2 +- tests/test_extract_metricvalues.py | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/python/lsst/verify/bin/print_metricvalues.py b/python/lsst/verify/bin/print_metricvalues.py index 6f57b80c..11f18962 100644 --- a/python/lsst/verify/bin/print_metricvalues.py +++ b/python/lsst/verify/bin/print_metricvalues.py @@ -72,7 +72,13 @@ def main(): else: collection2 = args.collection2 if args.collection2 is not None else args.collection butler2 = lsst.daf.butler.Butler(args.repo2, collections=collection2) - print(f"Showing difference of {args.repo2}#{collection2} - {args.repo}#{args.collection}") + print("Printed values are `repo2 - repo1 = delta`, where:") + print(f"repo2 = {args.repo2}#{collection2}") + print(f"repo1 = {args.repo}#{args.collection}") + if args.repo2 == args.repo: + print(f"delta = ({collection2}) - ({args.collection})") + else: + print(f"delta = ({args.repo2}) - ({args.repo})") extract_metricvalues.print_diff_metrics(butler, butler2, data_id_keys=args.data_id_keys, diff --git a/python/lsst/verify/extract_metricvalues.py b/python/lsst/verify/extract_metricvalues.py index 703831a7..02a7aa19 100644 --- a/python/lsst/verify/extract_metricvalues.py +++ b/python/lsst/verify/extract_metricvalues.py @@ -127,7 +127,7 @@ def print_diff_metrics(butler1, butler2, data_id_keys=None, verbose=False): delta = value2.quantity - value1.quantity if delta != 0 or verbose: - print(f"{value1.datum.label}: {delta} / {value1.quantity}") + print(f"{value1.datum.label}: {value2.quantity} - {value1.quantity} = {delta}") if delta == 0: same += 1 diff --git a/tests/test_extract_metricvalues.py b/tests/test_extract_metricvalues.py index 4584e945..84808ba1 100644 --- a/tests/test_extract_metricvalues.py +++ b/tests/test_extract_metricvalues.py @@ -186,13 +186,13 @@ def check_stdout(n, last_line, **kwargs): result = check_stdout(12, last_line) expect = "{instrument: 'TestCam', detector: 12, visit: 12345, ...}" self.assertIn(expect, result) - expect = "verify.another: 1.0 mas / 3.0 mas" + expect = "verify.another: 4.0 mas - 3.0 mas = 1.0 mas" self.assertIn(expect, result) result = check_stdout(12, last_line, data_id_keys=("detector", "visit")) expect = "detector: 12, visit: 12345" self.assertIn(expect, result) - expect = "verify.another: 1.0 mas / 3.0 mas" + expect = "verify.another: 4.0 mas - 3.0 mas = 1.0 mas" self.assertIn(expect, result)