From d2ba365f6f18c3345210169339a70bbb067514b6 Mon Sep 17 00:00:00 2001 From: Peter Williams Date: Tue, 23 Aug 2022 15:50:59 -0400 Subject: [PATCH] wwt_data_formats/imageset.py: accept the TPV projection This is non-standard but comes up in DASCH data. It's TAN plus distortions, so if we just treat it like TAN, the results for this routine should be OK. --- wwt_data_formats/imageset.py | 4 +++- wwt_data_formats/tests/test_imageset.py | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/wwt_data_formats/imageset.py b/wwt_data_formats/imageset.py index 2ca74e5..84d8965 100644 --- a/wwt_data_formats/imageset.py +++ b/wwt_data_formats/imageset.py @@ -426,7 +426,9 @@ class ImageSet(LockedXmlTraits, UrlContainer): will do its best to detect and reject them. """ - if headers["CTYPE1"] != "RA---TAN" or headers["CTYPE2"] != "DEC--TAN": + if headers["CTYPE1"] not in ("RA---TAN", "RA---TPV") or headers[ + "CTYPE2" + ] not in ("DEC--TAN", "DEC--TPV"): raise ValueError("WCS coordinates must be in an equatorial/TAN projection") # Figure out the stuff we need from the headers. diff --git a/wwt_data_formats/tests/test_imageset.py b/wwt_data_formats/tests/test_imageset.py index 0f20e70..da37a45 100644 --- a/wwt_data_formats/tests/test_imageset.py +++ b/wwt_data_formats/tests/test_imageset.py @@ -166,6 +166,14 @@ def test_wcs_1(): _check_wcs_roundtrip(imgset, 3000, wcs_keywords) + # Also check with TPV headers, which we allow for DASCH + + wcs_keywords["CTYPE1"] = "RA---TPV" + wcs_keywords["CTYPE2"] = "DEC--TPV" + imgset.set_position_from_wcs(wcs_keywords, 3000, 3000) + observed_xml = imgset.to_xml() + assert_xml_trees_equal(expected_xml, observed_xml) + def test_wcs_only_two_pc_values(): expected_str = """