Skip to content

Commit b28c213

Browse files
committed
Optimize plot to show DiaObjects with few DiaSources.
1 parent 5e81d1a commit b28c213

1 file changed

Lines changed: 22 additions & 9 deletions

File tree

python/lsst/analysis/tools/atools/diaObjectPlot.py

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222

2323
__all__ = ("DiaObjectPlot",)
2424

25+
from ..actions.plot.calculateRange import MinMax
2526
from ..actions.plot.skyPlot import SkyPlot
26-
from ..actions.vector import LoadVector
27-
from ..actions.vector.selectors import ThresholdSelector
27+
from ..actions.vector import DownselectVector, LoadVector
28+
from ..actions.vector.selectors import FiniteSelector, ThresholdSelector
2829
from ..interfaces import AnalysisTool
29-
from ..actions.plot.calculateRange import MinMax
3030

3131

3232
class DiaObjectPlot(AnalysisTool):
@@ -40,15 +40,26 @@ def setDefaults(self):
4040
self.process.buildActions.y = LoadVector(vectorKey="dec")
4141
self.process.buildActions.z = LoadVector(vectorKey="nDiaSources")
4242

43-
# statMask is required for SkyPlot, so just select everything
44-
self.process.buildActions.statMask = ThresholdSelector()
45-
self.process.buildActions.statMask.vectorKey = "nDiaSources"
46-
self.process.buildActions.statMask.threshold = 0
47-
self.process.buildActions.statMask.op = "gt"
43+
# statMask is required for SkyPlot
44+
# it computes the nanMedian and nanSigmaMad for the z array,
45+
# with some selector applied
46+
self.process.buildActions.statMask = FiniteSelector(vectorKey="nDiaSources")
47+
48+
# only plot diaObjects composed of 5 or fewer diaSources
49+
self.process.filterActions.z = DownselectVector(vectorKey="z")
50+
self.process.filterActions.z.selector = ThresholdSelector(
51+
vectorKey="nDiaSources", op="le", threshold=5
52+
)
53+
self.process.filterActions.x = DownselectVector(
54+
vectorKey="x", selector=self.process.filterActions.z.selector
55+
)
56+
self.process.filterActions.y = DownselectVector(
57+
vectorKey="y", selector=self.process.filterActions.z.selector
58+
)
4859

4960
self.produce.plot = SkyPlot()
5061
self.produce.plot.plotTypes = ["any"]
51-
self.produce.plot.plotName = "nDiaSourceCount"
62+
self.produce.plot.plotName = "DiaObjects with 5 or fewer DiaSources"
5263

5364
self.produce.plot.xAxisLabel = "R.A. (deg)"
5465
self.produce.plot.yAxisLabel = "Dec. (deg)"
@@ -57,3 +68,5 @@ def setDefaults(self):
5768
self.produce.plot.colorbarRange = MinMax
5869
self.produce.plot.plotOutlines = True
5970
self.produce.plot.doBinning = False
71+
self.produce.plot.alpha = 0.2
72+
self.produce.plot.scatPtSize = 3

0 commit comments

Comments
 (0)