Skip to content

Commit

Permalink
Handle metadata consistently. Work around astropy issues with None.
Browse files Browse the repository at this point in the history
  • Loading branch information
czwa committed Aug 28, 2020
1 parent 6894ddf commit 879ebee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 2 additions & 3 deletions python/lsst/ip/isr/calibType.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
import abc
import copy
import datetime
import os.path
import warnings
Expand Down Expand Up @@ -70,7 +69,7 @@ def __init__(self, camera=None, detector=None, detectorName=None, detectorId=Non
self._detectorId = detectorId
self._filter = None
self._calibId = None

self._metadata = PropertyList()
self.setMetadata(PropertyList())

# Define the required attributes for this calibration.
Expand Down Expand Up @@ -133,7 +132,7 @@ def setMetadata(self, metadata):
overwrite existing metadata.
"""
if metadata is not None:
self._metadata = copy.copy(metadata)
self._metadata.update(metadata)

# Ensure that we have the obs type required by calibration ingest
self._metadata["OBSTYPE"] = self._OBSTYPE
Expand Down
7 changes: 5 additions & 2 deletions python/lsst/ip/isr/crosstalk.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,11 @@ def toTable(self):
'CT_COUNTS': self.coeffNum.reshape(self.nAmp*self.nAmp),
'CT_VALID': self.coeffValid.reshape(self.nAmp*self.nAmp),
}])

catalog.meta = self.getMetadata().toDict()
# filter None, because astropy can't deal.
inMeta = self.getMetadata().toDict()
outMeta = {k: v for k, v in inMeta.items() if v is not None}
outMeta.update({k: "" for k, v in inMeta.items() if v is None})
catalog.meta = outMeta
tableList.append(catalog)

if self.interChip:
Expand Down

0 comments on commit 879ebee

Please sign in to comment.