Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-39053: Always use the WCS from VisitInfo if available #455

Merged
merged 3 commits into from
May 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions python/lsst/obs/base/_fitsRawFormatterBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,10 @@ def makeWcs(self, visitInfo, detector):
# This is not an on-sky observation
return None

skyWcs = self._createSkyWcsFromMetadata()

if visitInfo is None:
msg = "No VisitInfo; cannot access boresight information. Defaulting to metadata-based SkyWcs."
log.warning(msg)
skyWcs = self._createSkyWcsFromMetadata()
if skyWcs is None:
raise InitialSkyWcsError(
"Failed to create both metadata and boresight-based SkyWcs."
Expand Down
7 changes: 3 additions & 4 deletions tests/test_fitsRawFormatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,11 @@ def test_makeWcs(self):
self.assertNotEqual(wcs, self.metadataSkyWcs)
self.assertEqual(wcs, self.boresightSkyWcs)

def test_makeWcs_warn_if_metadata_is_bad(self):
"""If the metadata is bad, log a warning and use the VisitInfo WCS."""
def test_makeWcs_if_metadata_is_bad(self):
"""Always use the VisitInfo WCS if available."""
detector = self.formatter.getDetector(1)
self.metadata.remove("CTYPE1")
with self.warnContext:
wcs = self.formatter.makeWcs(self.visitInfo, detector)
wcs = self.formatter.makeWcs(self.visitInfo, detector)
self.assertNotEqual(wcs, self.metadataSkyWcs)
self.assertEqual(wcs, self.boresightSkyWcs)

Expand Down