Skip to content

Commit

Permalink
Add requireFiniteRaDec clause to source selector
Browse files Browse the repository at this point in the history
We are now persisting source catalogs even in light of an astrometric
failure in single frame processing.  Such catalogs will have their sky
coordinate column (typically "coord_ra" and "coord_dec") values set to
NaN.  They are thus not suitable for inclusion in the jointcal
calibration, so this config default ensures they are omited from the
selection of "good" sources.
  • Loading branch information
laurenam committed Sep 13, 2021
1 parent 3bd7ecb commit 9736412
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions python/lsst/jointcal/jointcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,9 @@ def setDefaults(self):
'base_PixelFlags_flag_interpolatedCenter', 'base_SdssCentroid_flag',
'base_PsfFlux_flag', 'base_PixelFlags_flag_suspectCenter']
self.sourceSelector['science'].flags.bad = badFlags
self.sourceSelector['science'].doRequireFiniteRaDec = True
self.sourceSelector['science'].requireFiniteRaDec.raColName = "ra"
self.sourceSelector['science'].requireFiniteRaDec.decColName = "decl"

# Default to Gaia-DR2 (with proper motions) for astrometry and
# PS1-DR1 for photometry, with a reasonable initial filterMap.
Expand Down Expand Up @@ -888,18 +891,25 @@ def _load_data(self, inputSourceTableVisit, inputVisitSummary, associations,
for visitSummaryRef in inputVisitSummary:
visitSummary = visitSummaryRef.get()
visitCatalog = inputSourceTableVisit[catalogMap[visitSummaryRef.dataId['visit']]].get()
detector_column = "detector" if "detector" in visitCatalog.columns else "ccd"
selected = self.sourceSelector.run(visitCatalog)

# Build a CcdImage for each detector in this visit.
detectors = {id: index for index, id in enumerate(visitSummary['id'])}
for id, index in detectors.items():
catalog = self._extract_detector_catalog_from_visit_catalog(table, selected.sourceCat, id)
data = self._make_one_input_data(visitSummary[index], catalog, detectorDict)
result = self._build_ccdImage(data, associations, jointcalControl)
if result is not None:
oldWcsList.append(result.wcs)
# A visit has only one band, so we can just use the first.
filters.append(data.filter)
if sum(selected.sourceCat[detector_column] == id) > 0:
catalog = self._extract_detector_catalog_from_visit_catalog(table,
selected.sourceCat, id)
data = self._make_one_input_data(visitSummary[index], catalog, detectorDict)
result = self._build_ccdImage(data, associations, jointcalControl)
if result is not None:
oldWcsList.append(result.wcs)
# A visit has only one band, so we can just use
# the first.
filters.append(data.filter)
else:
self.log.info("Catalog had no sky coordiate positions (and thus no entries) for"
" dataId %s.", visitSummaryRef.dataId)
if len(filters) == 0:
raise RuntimeError("No data to process: did source selector remove all sources?")
filters = collections.Counter(filters)
Expand Down

0 comments on commit 9736412

Please sign in to comment.