Skip to content

Commit

Permalink
Merge pull request #756 from lsst/tickets/DM-47920
Browse files Browse the repository at this point in the history
DM-47920: Drop unnecessary and broken handling of dotted FITS keys in WCS reads.
  • Loading branch information
TallJimbo authored Dec 4, 2024
2 parents 9726552 + 9403ed5 commit 3280fe6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/geom/detail/frameSetUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,8 @@ ast::FitsChan getFitsChanFromPropertyList(daf::base::PropertySet& metadata,
}

// Loop over the names and add them to the FitsChan if not excluded
for (auto const &fullName : allParamNames) {
if (excludeNames.count(fullName) == 0) {
std::size_t lastPeriod = fullName.rfind(char('.'));
auto name = (lastPeriod == std::string::npos) ? fullName : fullName.substr(lastPeriod + 1);
for (auto const &name : allParamNames) {
if (excludeNames.count(name) == 0) {
std::type_info const &type = metadata.typeOf(name);

if (name.size() > 8) {
Expand Down
9 changes: 9 additions & 0 deletions tests/test_exposure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,15 @@ def testReadVersion2(self):
self.assertEqual(reader.readExposureInfo().getPhotoCalib(), self.v1PhotoCalib)
self.assertEqual(reader.readPhotoCalib(), self.v1PhotoCalib)

def testReadDottedHeaderKey(self):
"""Test that we can read a file with a dot-delimited header key."""
original = afwImage.ExposureF.readFits(os.path.join(self.dataDir, "exposure-version-2.fits"))
original.metadata["x.y.z"] = "three"
with lsst.utils.tests.getTempFilePath(".fits") as tmpFile:
original.writeFits(tmpFile)
roundtripped = afwImage.ExposureF(tmpFile)
self.assertMaskedImagesEqual(original.maskedImage, roundtripped.maskedImage)

def testExposureSummaryExtraComponents(self):
"""Test that we can read an exposure summary with extra components.
"""
Expand Down

0 comments on commit 3280fe6

Please sign in to comment.