Skip to content

Commit

Permalink
Add ExtinctionCorrectedMagDiff Action for stellar locus plots
Browse files Browse the repository at this point in the history
  • Loading branch information
yalsayyad committed Mar 16, 2022
1 parent ce38f52 commit 60ba8a7
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 54 deletions.
24 changes: 12 additions & 12 deletions pipelines/coaddQAPlots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,12 @@ tasks:
class: lsst.analysis.drp.colorColorPlot.ColorColorPlotTask
config:
connections.plotName: ri_gr_cmodel
axisActions.xAction.col1: "g_cModelFlux"
axisActions.xAction.col2: "r_cModelFlux"
axisActions.xAction.returnMillimags: False
axisActions.yAction.col1: "r_cModelFlux"
axisActions.yAction.col2: "i_cModelFlux"
axisActions.yAction.returnMillimags: False
axisActions.xAction.magDiff.col1: "g_cModelFlux"
axisActions.xAction.magDiff.col2: "r_cModelFlux"
axisActions.xAction.magDiff.returnMillimags: False
axisActions.yAction.magDiff.col1: "r_cModelFlux"
axisActions.yAction.magDiff.col2: "i_cModelFlux"
axisActions.yAction.magDiff.returnMillimags: False
axisActions.zAction.column: "i_cModelFlux"
axisLabels: {"x": "g - r CModel Magnitude (mag)",
"y": "r - i CModel Magnitude (mag)",
Expand All @@ -323,12 +323,12 @@ tasks:
class: lsst.analysis.drp.colorColorPlot.ColorColorPlotTask
config:
connections.plotName: ri_gr_psf
axisActions.xAction.col1: "g_psfFlux"
axisActions.xAction.col2: "r_psfFlux"
axisActions.xAction.returnMillimags: False
axisActions.yAction.col1: "r_psfFlux"
axisActions.yAction.col2: "i_psfFlux"
axisActions.yAction.returnMillimags: False
axisActions.xAction.magDiff.col1: "g_psfFlux"
axisActions.xAction.magDiff.col2: "r_psfFlux"
axisActions.xAction.magDiff.returnMillimags: False
axisActions.yAction.magDiff.col1: "r_psfFlux"
axisActions.yAction.magDiff.col2: "i_psfFlux"
axisActions.yAction.magDiff.returnMillimags: False
axisActions.zAction.column: "i_psfFlux"
axisLabels: {"x": "g - r PSF Magnitude (mag)",
"y": "r - i PSF Magnitude (mag)",
Expand Down
72 changes: 36 additions & 36 deletions pipelines/stellarLocusPlots.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ tasks:
class: lsst.analysis.drp.colorColorFitPlot.ColorColorFitPlotTask
config:
connections.plotName: wFit_PSF
axisActions.xAction.col1: "g_psfFlux"
axisActions.xAction.col2: "r_psfFlux"
axisActions.yAction.col1: "r_psfFlux"
axisActions.yAction.col2: "i_psfFlux"
axisActions.xAction.returnMillimags: False
axisActions.yAction.returnMillimags: False
axisActions.xAction.magDiff.col1: "g_psfFlux"
axisActions.xAction.magDiff.col2: "r_psfFlux"
axisActions.yAction.magDiff.col1: "r_psfFlux"
axisActions.yAction.magDiff.col2: "i_psfFlux"
axisActions.xAction.magDiff.returnMillimags: False
axisActions.yAction.magDiff.returnMillimags: False
axisActions.magAction.column: "r_psfFlux"
axisLabels: {"x": "g - r PSF Magnitude (mag)",
"y": "r - i PSF Magnitude (mag)",
Expand All @@ -36,12 +36,12 @@ tasks:
class: lsst.analysis.drp.colorColorFitPlot.ColorColorFitPlotTask
config:
connections.plotName: wFit_CModel
axisActions.xAction.col1: "g_cModelFlux"
axisActions.xAction.col2: "r_cModelFlux"
axisActions.yAction.col1: "r_cModelFlux"
axisActions.yAction.col2: "i_cModelFlux"
axisActions.xAction.returnMillimags: False
axisActions.yAction.returnMillimags: False
axisActions.xAction.magDiff.col1: "g_cModelFlux"
axisActions.xAction.magDiff.col2: "r_cModelFlux"
axisActions.yAction.magDiff.col1: "r_cModelFlux"
axisActions.yAction.magDiff.col2: "i_cModelFlux"
axisActions.xAction.magDiff.returnMillimags: False
axisActions.yAction.magDiff.returnMillimags: False
axisActions.magAction.column: "r_cModelFlux"
axisLabels: {"x": "g - r CModel Magnitude (mag)",
"y": "r - i CModel Magnitude (mag)",
Expand All @@ -61,12 +61,12 @@ tasks:
class: lsst.analysis.drp.colorColorFitPlot.ColorColorFitPlotTask
config:
connections.plotName: xFit_PSF
axisActions.xAction.col1: "g_psfFlux"
axisActions.xAction.col2: "r_psfFlux"
axisActions.yAction.col1: "r_psfFlux"
axisActions.yAction.col2: "i_psfFlux"
axisActions.xAction.returnMillimags: False
axisActions.yAction.returnMillimags: False
axisActions.xAction.magDiff.col1: "g_psfFlux"
axisActions.xAction.magDiff.col2: "r_psfFlux"
axisActions.yAction.magDiff.col1: "r_psfFlux"
axisActions.yAction.magDiff.col2: "i_psfFlux"
axisActions.xAction.magDiff.returnMillimags: False
axisActions.yAction.magDiff.returnMillimags: False
axisActions.magAction.column: "r_psfFlux"
axisLabels: {"x": "g - r PSF Magnitude (mag)",
"y": "r - i PSF Magnitude (mag)",
Expand All @@ -85,12 +85,12 @@ tasks:
class: lsst.analysis.drp.colorColorFitPlot.ColorColorFitPlotTask
config:
connections.plotName: xFit_CModel
axisActions.xAction.col1: "g_cModelFlux"
axisActions.xAction.col2: "r_cModelFlux"
axisActions.yAction.col1: "r_cModelFlux"
axisActions.yAction.col2: "i_cModelFlux"
axisActions.xAction.returnMillimags: False
axisActions.yAction.returnMillimags: False
axisActions.xAction.magDiff.col1: "g_cModelFlux"
axisActions.xAction.magDiff.col2: "r_cModelFlux"
axisActions.yAction.magDiff.col1: "r_cModelFlux"
axisActions.yAction.magDiff.col2: "i_cModelFlux"
axisActions.xAction.magDiff.returnMillimags: False
axisActions.yAction.magDiff.returnMillimags: False
axisActions.magAction.column: "r_cModelFlux"
axisLabels: {"x": "g - r CModel Magnitude (mag)",
"y": "r - i CModel Magnitude (mag)",
Expand All @@ -110,12 +110,12 @@ tasks:
class: lsst.analysis.drp.colorColorFitPlot.ColorColorFitPlotTask
config:
connections.plotName: yFit_PSF
axisActions.xAction.col1: "r_psfFlux"
axisActions.xAction.col2: "i_psfFlux"
axisActions.yAction.col1: "i_psfFlux"
axisActions.yAction.col2: "z_psfFlux"
axisActions.xAction.returnMillimags: False
axisActions.yAction.returnMillimags: False
axisActions.xAction.magDiff.col1: "r_psfFlux"
axisActions.xAction.magDiff.col2: "i_psfFlux"
axisActions.yAction.magDiff.col1: "i_psfFlux"
axisActions.yAction.magDiff.col2: "z_psfFlux"
axisActions.xAction.magDiff.returnMillimags: False
axisActions.yAction.magDiff.returnMillimags: False
axisActions.magAction.column: "i_psfFlux"
axisLabels: {"x": "r - i PSF Magnitude (mag)",
"y": "i - z PSF Magnitude (mag)",
Expand All @@ -134,12 +134,12 @@ tasks:
class: lsst.analysis.drp.colorColorFitPlot.ColorColorFitPlotTask
config:
connections.plotName: yFit_CModel
axisActions.xAction.col1: "r_cModelFlux"
axisActions.xAction.col2: "i_cModelFlux"
axisActions.yAction.col1: "i_cModelFlux"
axisActions.yAction.col2: "z_cModelFlux"
axisActions.xAction.returnMillimags: False
axisActions.yAction.returnMillimags: False
axisActions.xAction.magDiff.col1: "r_cModelFlux"
axisActions.xAction.magDiff.col2: "i_cModelFlux"
axisActions.yAction.magDiff.col1: "i_cModelFlux"
axisActions.yAction.magDiff.col2: "z_cModelFlux"
axisActions.xAction.magDiff.returnMillimags: False
axisActions.yAction.magDiff.returnMillimags: False
axisActions.magAction.column: "i_cModelFlux"
axisLabels: {"x": "r - i CModel Magnitude (mag)",
"y": "i - z CModel Magnitude (mag)",
Expand Down
42 changes: 40 additions & 2 deletions python/lsst/analysis/drp/calcFunctors.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
__all__ = ["SNCalculator", "KronFluxDivPsfFlux", "MagDiff", "ColorDiff", "ColorDiffPull"]
__all__ = ["SNCalculator", "KronFluxDivPsfFlux", "MagDiff", "ColorDiff", "ColorDiffPull",
"ExtinctionCorrectedMagDiff"]

from lsst.pipe.tasks.configurableActions import ConfigurableActionField
from lsst.pipe.tasks.dataFrameActions import DataFrameAction, DivideColumns, MultiColumnAction
from lsst.pex.config import Field
from lsst.pex.config import Field, DictField
from astropy import units as u
import numpy as np

Expand Down Expand Up @@ -71,6 +72,43 @@ def __call__(self, df):
return magDiff


class ExtinctionCorrectedMagDiff(DataFrameAction):
magDiff = ConfigurableActionField(doc="Action that returns a difference in magnitudes",
default=MagDiff, dtype=DataFrameAction)
ebv = Field(doc="E(B-V) Column", dtype=str, default="ebv")
# These default extinction coefficients are WRONG, but better than nothing
# TO DO DM-34061: They should be computed from the FGCM lookup-tables
# Which store the standard bandpasses in a calib-like object
extinctionCoeffs = DictField(
doc="extinction coeffs",
keytype=str, itemtype=float,
default={"u": 4.505,
"g": 3.240,
"r": 2.276,
"i": 1.633,
"z": 1.263,
"y": 1.075
}
)

@property
def columns(self):
return self.magDiff.columns + (self.ebv,)

def __call__(self, df):
diff = self.magDiff(df)
ebv = df[self.ebv].values
col1Band = self.magDiff.col1.split('_')[0]
col2Band = self.magDiff.col2.split('_')[0]
av1 = self.extinctionCoeffs[col1Band]
av2 = self.extinctionCoeffs[col2Band]

correction = (av1-av2)*ebv
if self.magDiff.returnMillimags:
correction = correction*1000.0
return diff - correction*u.mag


class CalcE(MultiColumnAction):
"""Calculate a complex value representation of the ellipticity
Expand Down
5 changes: 3 additions & 2 deletions python/lsst/analysis/drp/colorColorFitPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from lsst.pipe.tasks.configurableActions import ConfigurableActionStructField
from lsst.pipe.tasks.dataFrameActions import MagColumnNanoJansky

from .calcFunctors import MagDiff
from .calcFunctors import ExtinctionCorrectedMagDiff
from . import dataSelectors as dataSelectors
from .plotUtils import parsePlotInfo, addPlotInfo, stellarLocusFit, perpDistance, mkColormap

Expand Down Expand Up @@ -39,7 +39,8 @@ class ColorColorFitPlotTaskConfig(pipeBase.PipelineTaskConfig,

axisActions = ConfigurableActionStructField(
doc="The actions to use to calculate the values on each axis.",
default={"xAction": MagDiff, "yAction": MagDiff, "magAction": MagColumnNanoJansky},
default={"xAction": ExtinctionCorrectedMagDiff, "yAction": ExtinctionCorrectedMagDiff,
"magAction": MagColumnNanoJansky},
)

axisLabels = pexConfig.DictField(
Expand Down
5 changes: 3 additions & 2 deletions python/lsst/analysis/drp/colorColorPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import lsst.pex.config as pexConfig
from lsst.pipe.tasks.configurableActions import ConfigurableActionStructField
from lsst.pipe.tasks.dataFrameActions import MagColumnNanoJansky
from .calcFunctors import MagDiff
from .calcFunctors import ExtinctionCorrectedMagDiff
from .plotUtils import parsePlotInfo, addPlotInfo, mkColormap
from . import dataSelectors as dataSelectors

Expand All @@ -33,7 +33,8 @@ class ColorColorPlotTaskConfig(pipeBase.PipelineTaskConfig,

axisActions = ConfigurableActionStructField(
doc="The actions to use to calculate the values used on each axis.",
default={"xAction": MagDiff, "yAction": MagDiff, "zAction": MagColumnNanoJansky},
default={"xAction": ExtinctionCorrectedMagDiff, "yAction": ExtinctionCorrectedMagDiff,
"zAction": MagColumnNanoJansky},
)

axisLabels = pexConfig.DictField(
Expand Down

0 comments on commit 60ba8a7

Please sign in to comment.