Skip to content

Commit

Permalink
Add support for proper motion correction
Browse files Browse the repository at this point in the history
Mainly this consists of getting the epoch (TAI MJD) of the exposure into
the catalog loader.
  • Loading branch information
PaulPrice authored and r-owen committed Sep 4, 2018
1 parent 1b7a1d8 commit be05087
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 2 additions & 0 deletions python/lsst/meas/astrom/astrometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,14 @@ def solve(self, exposure, sourceCat):
wcs=expMd.wcs,
filterName=expMd.filterName,
calib=expMd.calib,
epoch=expMd.epoch,
)
matchMeta = self.refObjLoader.getMetadataBox(
bbox=expMd.bbox,
wcs=expMd.wcs,
filterName=expMd.filterName,
calib=expMd.calib,
epoch=expMd.epoch,
)

if debug.display:
Expand Down
8 changes: 5 additions & 3 deletions python/lsst/meas/astrom/directMatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,24 @@ def __init__(self, butler=None, refObjLoader=None, **kwargs):
self.makeSubtask("sourceSelection")
self.makeSubtask("referenceSelection")

def run(self, catalog, filterName=None):
def run(self, catalog, filterName=None, epoch=None):
"""!Load reference objects and match to them
@param[in] catalog Catalog to match to (lsst.afw.table.SourceCatalog)
@param[in] filterName Name of filter, for loading fluxes (str)
@param[in] epoch Epoch for proper motion and parallax correction
(an astropy.time.Time), or None
@return Struct with matches (lsst.afw.table.SourceMatchVector) and
matchMeta (lsst.meas.astrom.MatchMetadata)
"""
circle = self.calculateCircle(catalog)
matchMeta = self.refObjLoader.getMetadataCircle(circle.center, circle.radius, filterName)
matchMeta = self.refObjLoader.getMetadataCircle(circle.center, circle.radius, filterName, epoch=epoch)
emptyResult = Struct(matches=[], matchMeta=matchMeta)
sourceSelection = self.sourceSelection.run(catalog)
if len(sourceSelection.sourceCat) == 0:
self.log.warn("No objects selected from %d objects in source catalog", len(catalog))
return emptyResult
refData = self.refObjLoader.loadSkyCircle(circle.center, circle.radius, filterName)
refData = self.refObjLoader.loadSkyCircle(circle.center, circle.radius, filterName, epoch=epoch)
refCat = refData.refCat
refSelection = self.referenceSelection.run(refCat)
if len(refSelection.sourceCat) == 0:
Expand Down
11 changes: 11 additions & 0 deletions python/lsst/meas/astrom/ref_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@

__all__ = ['RefMatchConfig', 'RefMatchTask']

import astropy.time

import lsst.geom
import lsst.daf.base
import lsst.afw.math as afwMath
import lsst.pex.config as pexConfig
import lsst.pipe.base as pipeBase
Expand Down Expand Up @@ -180,14 +183,22 @@ def _getExposureMetadata(self, exposure):
- wcs: WCS (an lsst.afw.geom.Wcs)
- calib calibration (an lsst.afw.image.Calib), or None if unknown
- filterName: name of filter, or None if unknown
- epoch: date of exposure (an astropy.time.Time), or None
"""
exposureInfo = exposure.getInfo()
filterName = exposureInfo.getFilter().getName() or None
if filterName == "_unknown_":
filterName = None
epoch = None
if exposure.getInfo().hasVisitInfo():
epochTaiMjd = exposure.getInfo().getVisitInfo().getDate().get(system=lsst.daf.base.MJD,
scale=lsst.daf.base.TAI)
epoch = astropy.time.Time(epochTaiMjd, scale="tai", format="mjd")

return pipeBase.Struct(
bbox=exposure.getBBox(),
wcs=exposureInfo.getWcs(),
calib=exposureInfo.getCalib() if exposureInfo.hasCalib() else None,
filterName=filterName,
epoch=epoch,
)

0 comments on commit be05087

Please sign in to comment.