43 """!Configuration for ExampleSigmaClippedStatsTask
45 badMaskPlanes = pexConfig.ListField(
47 doc =
"Mask planes that, if set, the associated pixel should not be included in the coaddTempExp.",
50 numSigmaClip = pexConfig.Field(
51 doc =
"number of sigmas at which to clip data",
55 numIter = pexConfig.Field(
56 doc =
"number of iterations of sigma clipping",
63 """!Example task to compute sigma-clipped mean and standard deviation of an image
65 \section pipeTasks_ExampleSigmaClippedStatsTask_Contents Contents
67 - \ref pipeTasks_ExampleSigmaClippedStatsTask_Purpose
68 - \ref pipeTasks_ExampleSigmaClippedStatsTask_Config
69 - \ref pipeTasks_ExampleSigmaClippedStatsTask_Debug
70 - \ref pipeTasks_ExampleSigmaClippedStatsTask_Example
72 \section pipeTasks_ExampleSigmaClippedStatsTask_Purpose Description
74 \copybrief ExampleSigmaClippedStatsTask
76 This is a simple example task designed to be run as a subtask by ExampleCmdLineTask.
77 See also ExampleSimpleStatsTask as a variant that is even simpler.
79 The main method is \ref ExampleSigmaClippedStatsTask.run "run".
81 \section pipeTasks_ExampleSigmaClippedStatsTask_Config Configuration parameters
83 See \ref ExampleSigmaClippedStatsConfig
85 \section pipeTasks_ExampleSigmaClippedStatsTask_Debug Debug variables
87 This task has no debug variables.
89 \section pipeTasks_ExampleSigmaClippedStatsTask_Example A complete example of using ExampleSigmaClippedStatsTask
91 This code is in examples/exampleStatsTask.py (this one example runs both
92 ExampleSigmaClippedStatsTask and ExampleSimpleStatsTask), and can be run as:
94 examples/exampleStatsTask.py [fitsFile]
97 ConfigClass = ExampleSigmaClippedStatsConfig
98 _DefaultName =
"exampleSigmaClippedStats"
101 """!Construct an ExampleSigmaClippedStatsTask
103 The init method may compute anything that that does not require data.
104 In this case we create a statistics control object using the config
105 (which cannot change once the task is created).
107 pipeBase.Task.__init__(self, *args, **kwargs)
112 self._statsControl.setNumSigmaClip(self.config.numSigmaClip)
113 self._statsControl.setNumIter(self.config.numIter)
117 def run(self, maskedImage):
118 """!Compute and return statistics for a masked image
120 @param[in] maskedImage: masked image (an lsst::afw::MaskedImage)
121 @return a pipeBase Struct containing:
122 - mean: mean of image plane
123 - meanErr: uncertainty in mean
124 - stdDev: standard deviation of image plane
125 - stdDevErr: uncertainty in standard deviation
129 mean, meanErr = statObj.getResult(afwMath.MEANCLIP)
130 stdDev, stdDevErr = statObj.getResult(afwMath.STDEVCLIP)
131 self.log.info(
"clipped mean=%0.2f; meanErr=%0.2f; stdDev=%0.2f; stdDevErr=%0.2f" % \
132 (mean, meanErr, stdDev, stdDevErr))
133 return pipeBase.Struct(
137 stdDevErr = stdDevErr,
143 """!Example task to compute mean and standard deviation of an image
145 \section pipeTasks_ExampleSimpleStatsTask_Contents Contents
147 - \ref pipeTasks_ExampleSimpleStatsTask_Purpose
148 - \ref pipeTasks_ExampleSimpleStatsTask_Config
149 - \ref pipeTasks_ExampleSimpleStatsTask_Debug
150 - \ref pipeTasks_ExampleSimpleStatsTask_Example
152 \section pipeTasks_ExampleSimpleStatsTask_Purpose Description
154 \copybrief ExampleSimpleStatsTask
156 This was designed to be run as a subtask by ExampleCmdLineTask.
157 It is about as simple as a task can be; it has no configuration parameters and requires no special
158 initialization. See also ExampleSigmaClippedStatsTask as a variant that is slightly more complicated.
160 The main method is \ref ExampleSimpleTask.run "run".
162 \section pipeTasks_ExampleSimpleStatsTask_Config Configuration parameters
164 This task has no configuration parameters.
166 \section pipeTasks_ExampleSimpleStatsTask_Debug Debug variables
168 This task has no debug variables.
170 \section pipeTasks_ExampleSimpleStatsTask_Example A complete example of using ExampleSimpleStatsTask
172 This code is in examples/exampleStatsTask.py (this one example runs both
173 ExampleSigmaClippedStatsTask and ExampleSimpleStatsTask), and can be run as:
175 examples/exampleStatsTask.py [fitsFile]
179 ConfigClass = pexConfig.Config
184 _DefaultName =
"exampleSimpleStats"
191 def run(self, maskedImage):
192 """!Compute and return statistics for a masked image
194 @param[in] maskedImage: masked image (an lsst::afw::MaskedImage)
195 @return a pipeBase Struct containing:
196 - mean: mean of image plane
197 - meanErr: uncertainty in mean
198 - stdDev: standard deviation of image plane
199 - stdDevErr: uncertainty in standard deviation
204 mean, meanErr = statObj.getResult(afwMath.MEAN)
205 stdDev, stdDevErr = statObj.getResult(afwMath.STDEV)
206 self.log.info(
"simple mean=%0.2f; meanErr=%0.2f; stdDev=%0.2f; stdDevErr=%0.2f" % \
207 (mean, meanErr, stdDev, stdDevErr))
209 return pipeBase.Struct(
213 stdDevErr = stdDevErr,
Example task to compute sigma-clipped mean and standard deviation of an image.
Pass parameters to a Statistics objectA class to pass parameters which control how the stats are calc...
def run
Compute and return statistics for a masked image.
def run
Compute and return statistics for a masked image.
Configuration for ExampleSigmaClippedStatsTask.
Example task to compute mean and standard deviation of an image.
Statistics makeStatistics(afwImage::Mask< afwImage::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl)
Specialization to handle Masks.
def __init__
Construct an ExampleSigmaClippedStatsTask.