From 1af74cfa0a8442599e70edabde84922f2c6e8d74 Mon Sep 17 00:00:00 2001 From: Ian Sullivan Date: Fri, 17 Jul 2026 11:20:19 +0200 Subject: [PATCH] Guard against missing `deblend_nChild` columns in source catalogs --- python/lsst/display/firefly/footprints.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/python/lsst/display/firefly/footprints.py b/python/lsst/display/firefly/footprints.py index 200cc2d..df5dc46 100644 --- a/python/lsst/display/firefly/footprints.py +++ b/python/lsst/display/firefly/footprints.py @@ -43,7 +43,11 @@ def recordSelector(record, selection): meaning zero parents and zero children. Values to check for sel """ - nChildren = record.get('deblend_nChild') + # Catalogs missing the 'deblend_nChild' column were not deblended + if 'deblend_nChild' in record.schema.getNames(): + nChildren = record.get('deblend_nChild') + else: + nChildren = 0 parentId = record.getParent() if selection == 'all': return True @@ -93,6 +97,8 @@ def createFootprintsTable(catalog, xy0=None, insertColumn=4): inputColumnNames = sourceTable.colnames x0, y0 = xy0 + # The 'deblend_nChild' column is only present if the catalog was deblended + isDeblended = 'deblend_nChild' in catalog.schema.getNames() spanList = [] peakList = [] familyList = [] @@ -122,7 +128,7 @@ def createFootprintsTable(catalog, xy0=None, insertColumn=4): dtype=np.bool)) fpbbox = footprint.getBBox() parentId = record.getParent() - nChild = record.get('deblend_nChild') + nChild = record.get('deblend_nChild') if isDeblended else 0 if parentId == 0: familyList.append(recordId) if nChild > 0: