Skip to content

Commit

Permalink
Merge pull request #145 from lsst/tickets/DM-40768
Browse files Browse the repository at this point in the history
DM-40768: Stellar photometric repeatability in analysis_tools is not applying defaults correctly
  • Loading branch information
jeffcarlin committed Oct 3, 2023
2 parents 92b6ad8 + 5aad4f1 commit 78bb400
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions python/lsst/analysis/tools/atools/photometricRepeatability.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def setDefaults(self):

# Compute per-group quantities
self.process.buildActions.perGroupSn = PerGroupStatistic()
self.process.buildActions.perGroupSn.buildAction = CalcSn(fluxType=f"{self.fluxType}")
self.process.buildActions.perGroupSn.buildAction = CalcSn()
self.process.buildActions.perGroupSn.func = "median"
self.process.buildActions.perGroupExtendedness = PerGroupStatistic()
self.process.buildActions.perGroupExtendedness.buildAction.vectorKey = "extendedness"
Expand Down Expand Up @@ -106,13 +106,6 @@ def setDefaults(self):

# Compute summary statistics on filtered groups
self.process.calculateActions.photRepeatStdev = MedianAction(vectorKey="perGroupStdevFiltered")
self.process.calculateActions.photRepeatOutlier = FracThreshold(
vectorKey="perGroupStdevFiltered",
op="ge",
threshold=self.PA2Value,
percent=True,
relative_to_median=True,
)
self.process.calculateActions.photRepeatNsources = CountAction(vectorKey="perGroupStdevFiltered")

self.produce.plot = HistPlot()
Expand All @@ -125,7 +118,6 @@ def setDefaults(self):
self.produce.plot.panels["panel_rms"].statsPanel.stat2 = ["photRepeatStdev"]
self.produce.plot.panels["panel_rms"].statsPanel.stat3 = ["photRepeatOutlier"]

self.produce.plot.panels["panel_rms"].referenceValue = self.PA2Value
self.produce.plot.panels["panel_rms"].refRelativeToMedian = True

self.produce.plot.panels["panel_rms"].label = "rms (mmag)"
Expand All @@ -136,6 +128,26 @@ def setDefaults(self):
"photRepeatOutlier": "percent",
"photRepeatNsources": "ct",
}

def finalize(self):
super().finalize()
self.process.buildActions.perGroupSn.buildAction.fluxType = f"{self.fluxType}"
self.process.buildActions.perGroupCount.buildAction.vectorKey = f"{self.fluxType}"
self.process.buildActions.perGroupStdev.buildAction = ConvertFluxToMag(
vectorKey=f"{self.fluxType}",
returnMillimags=True,
)
self.process.calculateActions.photRepeatOutlier = FracThreshold(
vectorKey="perGroupStdevFiltered",
op="ge",
threshold=self.PA2Value,
percent=True,
relative_to_median=True,
)

if isinstance(self.produce.plot, HistPlot):
self.produce.plot.panels["panel_rms"].referenceValue = self.PA2Value

self.produce.metric.newNames = {
"photRepeatStdev": "{band}_stellarPhotRepeatStdev",
"photRepeatOutlier": "{band}_stellarPhotRepeatOutlierFraction",
Expand Down

0 comments on commit 78bb400

Please sign in to comment.