Skip to content

Commit

Permalink
Clarify output values
Browse files Browse the repository at this point in the history
Modify header message to make it more obvious what is being printed.
Print each value and the difference, for clarity.
  • Loading branch information
parejkoj committed Aug 16, 2023
1 parent 5fadffe commit 21d8165
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion python/lsst/verify/bin/print_metricvalues.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/verify/extract_metricvalues.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions tests/test_extract_metricvalues.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit 21d8165

Please sign in to comment.