Skip to content

Commit

Permalink
Add dRA and dDec plots for visits and coadds
Browse files Browse the repository at this point in the history
  • Loading branch information
cmsaunders committed Mar 16, 2022
1 parent b55a1bc commit 35b873a
Show file tree
Hide file tree
Showing 3 changed files with 191 additions and 0 deletions.
74 changes: 74 additions & 0 deletions pipelines/coaddQAPlots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -341,3 +341,77 @@ tasks:
selectorActions.SnSelector.bands: ["g", "r", "i"]
python: >
from lsst.analysis.drp.dataSelectors import FlagSelector, CoaddPlotFlagSelector, SnSelector
plot_astromRefCat_sky_tract_dRA:
class: lsst.analysis.drp.skyPlot.SkyPlotTask
config:
connections.catPlot: objectTable_tract_astrometryRefCat_match
connections.plotName: astromRefCatResiduals
axisActions.zAction: AstromDiff
axisActions.zAction.col1: "coord_ra_target"
axisActions.zAction.col2: "coord_ra_ref"
axisActions.xAction.column: "coord_ra_ref"
axisActions.yAction.column: "coord_dec_ref"
selectorActions.flagSelector: CoaddPlotFlagSelector
selectorActions.flagSelector.bands: ["i"]
sourceSelectorActions.sourceSelector: StarIdentifier
sourceSelectorActions.sourceSelector.band: "i"
axisLabels: {"x": "R.A. (Degrees)", "y": "Dec. (Degrees)", "z": "$RA_{target} - RA_{ref}$ (marcsec)"}
python: |
from lsst.analysis.drp.dataSelectors import CoaddPlotFlagSelector, StarIdentifier, SnSelector
from lsst.analysis.drp.calcFunctors import AstromDiff
plot_astromRefCat_sky_tract_dDec:
class: lsst.analysis.drp.skyPlot.SkyPlotTask
config:
connections.catPlot: objectTable_tract_astrometryRefCat_match
connections.plotName: astromRefCatResiduals
axisActions.zAction: AstromDiff
axisActions.zAction.col1: "coord_dec_target"
axisActions.zAction.col2: "coord_dec_ref"
axisActions.xAction.column: "coord_ra_ref"
axisActions.yAction.column: "coord_dec_ref"
selectorActions.flagSelector: CoaddPlotFlagSelector
selectorActions.flagSelector.bands: ["i"]
sourceSelectorActions.sourceSelector: StarIdentifier
sourceSelectorActions.sourceSelector.band: "i"
axisLabels: {"x": "R.A. (Degrees)", "y": "Dec. (Degrees)", "z": "$Dec_{target} - Dec_{ref}$ (marcsec)"}
python: |
from lsst.analysis.drp.dataSelectors import CoaddPlotFlagSelector, StarIdentifier, SnSelector
from lsst.analysis.drp.calcFunctors import AstromDiff
plot_astromRefCat_scatter_tract_dRA:
class: lsst.analysis.drp.scatterPlot.ScatterPlotWithTwoHistsTask
config:
connections.catPlot: objectTable_tract_astrometryRefCat_match
connections.plotName: astromRefCatResiduals
axisActions.yAction: AstromDiff
axisActions.yAction.col1: "coord_ra_target"
axisActions.yAction.col2: "coord_ra_ref"
selectorActions.flagSelector: CoaddPlotFlagSelector
selectorActions.flagSelector.bands: ["i"]
sourceSelectorActions.sourceSelector: StarIdentifier
sourceSelectorActions.sourceSelector.band: "i"
axisLabels: {"x": "PSF Magnitude (mag)", "mag": "PSF Magnitude (mag)",
"y": "$RA_{target} - RA_{ref}$ (marcsec)"}
python: |
from lsst.analysis.drp.dataSelectors import CoaddPlotFlagSelector, StarIdentifier
from lsst.analysis.drp.calcFunctors import AstromDiff
plot_astromRefCat_scatter_tract_dDec:
class: lsst.analysis.drp.scatterPlot.ScatterPlotWithTwoHistsTask
config:
connections.catPlot: objectTable_tract_astrometryRefCat_match
connections.plotName: astromRefCatResiduals
axisActions.yAction: AstromDiff
axisActions.yAction.col1: "coord_dec_target"
axisActions.yAction.col2: "coord_dec_ref"
selectorActions.flagSelector: CoaddPlotFlagSelector
selectorActions.flagSelector.bands: ["i"]
sourceSelectorActions.sourceSelector: StarIdentifier
sourceSelectorActions.sourceSelector.band: "i"
axisLabels: {"x": "PSF Magnitude (mag)", "mag": "PSF Magnitude (mag)",
"y": "$Dec_{target} - Dec_{ref}$ (marcsec)"}
python: |
from lsst.analysis.drp.dataSelectors import CoaddPlotFlagSelector, StarIdentifier
from lsst.analysis.drp.calcFunctors import AstromDiff
71 changes: 71 additions & 0 deletions pipelines/visitQAPlots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,74 @@ tasks:
axisLabels: {"x": "R.A. (Degrees)", "y": "Dec. (Degrees)", "z": "Sky Object Flux (nJy)"}
python: |
from lsst.analysis.drp.dataSelectors import (FlagSelector)
plot_astromRefCat_sky_visit_dRA:
class: lsst.analysis.drp.skyPlotVisit.SkyPlotVisitTask
config:
connections.catPlot: sourceTable_visit_astrometryRefCat_match
connections.plotName: astromRefCatResiduals_dRA
axisActions.zAction: AstromDiff
axisActions.zAction.col1: "coord_ra_target"
axisActions.zAction.col2: "coord_ra_ref"
axisActions.xAction.column: "coord_ra_ref"
axisActions.yAction.column: "coord_dec_ref"
selectorActions.flagSelector: VisitPlotFlagSelector
sourceSelectorActions.sourceSelector: StarIdentifier
sourceSelectorActions.sourceSelector.band: ""
axisLabels: {"x": "R.A. (Degrees)", "y": "Dec. (Degrees)", "z": "$RA_{target} - RA_{ref}$ (marcsec)"}
python: |
from lsst.analysis.drp.dataSelectors import VisitPlotFlagSelector, StarIdentifier
from lsst.analysis.drp.calcFunctors import AstromDiff
plot_astromRefCat_sky_visit_dDec:
class: lsst.analysis.drp.skyPlotVisit.SkyPlotVisitTask
config:
connections.catPlot: sourceTable_visit_astrometryRefCat_match
connections.plotName: astromRefCatResiduals_dDec
axisActions.zAction: AstromDiff
axisActions.zAction.col1: "coord_dec_target"
axisActions.zAction.col2: "coord_dec_ref"
axisActions.xAction.column: "coord_ra_ref"
axisActions.yAction.column: "coord_dec_ref"
selectorActions.flagSelector: VisitPlotFlagSelector
sourceSelectorActions.sourceSelector: StarIdentifier
sourceSelectorActions.sourceSelector.band: ""
axisLabels: {"x": "R.A. (Degrees)", "y": "Dec. (Degrees)",
"z": "$Dec_{target} - Dec_{ref}$ (marcsec)"}
python: |
from lsst.analysis.drp.dataSelectors import VisitPlotFlagSelector, StarIdentifier
from lsst.analysis.drp.calcFunctors import AstromDiff
plot_astromRefCat_scatter_visit_dRA:
class: lsst.analysis.drp.scatterPlotVisit.ScatterPlotVisitTask
config:
connections.catPlot: sourceTable_visit_astrometryRefCat_match
connections.plotName: astromRefCatResiduals
axisActions.yAction: AstromDiff
axisActions.yAction.col1: "coord_ra_target"
axisActions.yAction.col2: "coord_ra_ref"
selectorActions.flagSelector: VisitPlotFlagSelector
sourceSelectorActions.sourceSelector: StarIdentifier
sourceSelectorActions.sourceSelector.band: ""
axisLabels: {"x": "PSF Magnitude (mag)", "mag": "PSF Magnitude (mag)",
"y": "$RA_{target} - RA_{ref}$ (marcsec)"}
python: |
from lsst.analysis.drp.dataSelectors import VisitPlotFlagSelector, StarIdentifier
from lsst.analysis.drp.calcFunctors import AstromDiff
plot_astromRefCat_scatter_visit_dDec:
class: lsst.analysis.drp.scatterPlotVisit.ScatterPlotVisitTask
config:
connections.catPlot: sourceTable_visit_astrometryRefCat_match
connections.plotName: astromRefCatResiduals
axisActions.yAction: AstromDiff
axisActions.yAction.col1: "coord_dec_target"
axisActions.yAction.col2: "coord_dec_ref"
selectorActions.flagSelector: VisitPlotFlagSelector
sourceSelectorActions.sourceSelector: StarIdentifier
sourceSelectorActions.sourceSelector.band: ""
axisLabels: {"x": "PSF Magnitude (mag)", "mag": "PSF Magnitude (mag)",
"y": "$Dec_{target} - Dec_{ref}$ (marcsec)"}
python: |
from lsst.analysis.drp.dataSelectors import VisitPlotFlagSelector, StarIdentifier
from lsst.analysis.drp.calcFunctors import AstromDiff
46 changes: 46 additions & 0 deletions python/lsst/analysis/drp/calcFunctors.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,52 @@ def __call__(self, df):
return magDiff


class AstromDiff(MultiColumnAction):
"""Calculate the difference between two columns, assuming their units
are degrees, and convert the difference to arcseconds.
Parameters
----------
df : `pandas.core.frame.DataFrame`
The catalog to calculate the position difference from.
Returns
-------
The difference.
Notes
-----
The columns need to be in units (specifiable in
the radecUnits1 and 2 config options) that can be converted
to arcseconds. This action doesn't have any calibration
information and assumes that the positions are already
calibrated.
"""

col1 = Field(doc="Column to subtract from", dtype=str)
radecUnits1 = Field(doc="Units for col1", dtype=str, default="degree")
col2 = Field(doc="Column to subtract", dtype=str)
radecUnits2 = Field(doc="Units for col2", dtype=str, default="degree")
returnMilliArcsecs = Field(doc="Use marcseconds or not?", dtype=bool, default=True)

@property
def columns(self):
return (self.col1, self.col2)

def __call__(self, df):
angle1 = df[self.col1].values * u.Unit(self.radecUnits1)

angle2 = df[self.col2].values * u.Unit(self.radecUnits2)

angleDiff = angle1 - angle2

if self.returnMilliArcsecs:
angleDiffValue = angleDiff.to(u.arcsec) * 1000
else:
angleDiffValue = angleDiff.value
return angleDiffValue


class CalcE1(MultiColumnAction):
"""Calculate E1: (ixx - iyy)/(ixx + iyy)
This is a shape measurement used for doing QA on the ellipticity
Expand Down

0 comments on commit 35b873a

Please sign in to comment.