# Metadata is not persisted when persisting an ExposureCatalog to fits

XMLWordPrintable

#### Details

• Type: Bug
• Status: Done
• Resolution: Done
• Fix Version/s: None
• Component/s:
• Labels:
None
• Story Points:
1
• Team:
Data Release Production

#### Description

When writing an ExposureCatalog to FITS, the metadata property list is not persisted. When writing a test case for this I ran into the problem that the case of the property list values is not always round-trippable ( https://community.lsst.org/t/fits-and-lowercase-header-keys/1184/3 ) but by looking at the header of the persisted file I see that this is unrelated to the current issue. That is, the metadata is not persisted to the FITS file for an ExposureCatalog with any case.

 import lsst.afw.table as afwTable import lsst.daf.base as dafBase import lsst.geom   name = 'TEST'   schema = afwTable.ExposureTable.makeMinimalSchema() cat = afwTable.ExposureCatalog(schema) cat.reserve(1) rec = cat.addNew()   plist = dafBase.PropertyList() plist.addDouble(name, 1.0)   cat.setMetadata(plist)   print(cat.getMetadata()[name])   cat.writeFits('%s_expcatalog_metadata.fits' % (name))   cat2 = afwTable.ExposureCatalog.readFits('%s_expcatalog_metadata.fits' % (name))   print(cat2.getMetadata()[name])  

#### Activity

Hide
Tim Jenness added a comment -

We know that metadata is written for BaseCatalog so what's special about ExposureCatalog? Do we have no tests of ExposureCatalog that use setMetadata?

Show
Tim Jenness added a comment - We know that metadata is written for BaseCatalog so what's special about ExposureCatalog? Do we have no tests of ExposureCatalog that use setMetadata?
Hide
Eli Rykoff added a comment -

I guess not. I just wrote a quick one in test_exposureTable.py on my machine and it fails.

Show
Eli Rykoff added a comment - I guess not. I just wrote a quick one in test_exposureTable.py on my machine and it fails.
Hide
Eli Rykoff added a comment -

The problem appears to be here: https://github.com/lsst/afw/blob/d8786685a889d9c94e279327d68a2888e50e6bfb/src/table/Exposure.cc#L230 in that a new table is being generated from the old table prior to persistence, and it doesn't also set the metadata.

Show
Eli Rykoff added a comment - The problem appears to be here: https://github.com/lsst/afw/blob/d8786685a889d9c94e279327d68a2888e50e6bfb/src/table/Exposure.cc#L230 in that a new table is being generated from the old table prior to persistence, and it doesn't also set the metadata.
Hide
Eli Rykoff added a comment -
Show
Eli Rykoff added a comment - PR here https://github.com/lsst/afw/pull/502 Jenkins here https://ci.lsst.codes/blue/organizations/jenkins/stack-os-matrix/detail/stack-os-matrix/30797/pipeline

#### People

Assignee:
Eli Rykoff
Reporter:
Eli Rykoff
Reviewers:
Jim Bosch
Watchers:
Eli Rykoff, Jim Bosch, Tim Jenness