Skip to content

Commit

Permalink
Always use the WCS from VisitInfo if available
Browse files Browse the repository at this point in the history
  • Loading branch information
isullivan committed May 4, 2023
1 parent 41e5c8d commit c05af24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
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

0 comments on commit c05af24

Please sign in to comment.