LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes | List of all members
lsst.pipe.tasks.exampleStatsTasks.ExampleSimpleStatsTask Class Reference

Example task to compute mean and standard deviation of an image. More...

Inheritance diagram for lsst.pipe.tasks.exampleStatsTasks.ExampleSimpleStatsTask:

Public Member Functions

def run
 Compute and return statistics for a masked image. More...
 

Static Public Attributes

 ConfigClass = pexConfig.Config
 Even a task with no configuration requires setting ConfigClass. More...
 

Private Attributes

 _statsControl
 

Static Private Attributes

string _DefaultName = "exampleSimpleStats"
 Having a default name simplifies construction of the task, since the parent task need not specify a name. More...
 

Detailed Description

Example task to compute mean and standard deviation of an image.

Contents

Description

Example task to compute mean and standard deviation of an image.

This was designed to be run as a subtask by ExampleCmdLineTask. It is about as simple as a task can be; it has no configuration parameters and requires no special initialization. See also ExampleSigmaClippedStatsTask as a variant that is slightly more complicated.

The main method is run.

Configuration parameters

This task has no configuration parameters.

Debug variables

This task has no debug variables.

A complete example of using ExampleSimpleStatsTask

This code is in examples/exampleStatsTask.py (this one example runs both ExampleSigmaClippedStatsTask and ExampleSimpleStatsTask), and can be run as:

1 examples/exampleStatsTask.py [fitsFile]

Definition at line 142 of file exampleStatsTasks.py.

Member Function Documentation

def lsst.pipe.tasks.exampleStatsTasks.ExampleSimpleStatsTask.run (   self,
  maskedImage 
)

Compute and return statistics for a masked image.

Parameters
[in]maskedImage:masked image (an lsst::afw::MaskedImage)
Returns
a pipeBase Struct containing:
  • mean: mean of image plane
  • meanErr: uncertainty in mean
  • stdDev: standard deviation of image plane
  • stdDevErr: uncertainty in standard deviation

Definition at line 191 of file exampleStatsTasks.py.

192  def run(self, maskedImage):
193  """!Compute and return statistics for a masked image
194 
195  @param[in] maskedImage: masked image (an lsst::afw::MaskedImage)
196  @return a pipeBase Struct containing:
197  - mean: mean of image plane
198  - meanErr: uncertainty in mean
199  - stdDev: standard deviation of image plane
200  - stdDevErr: uncertainty in standard deviation
201  """
203  statObj = afwMath.makeStatistics(maskedImage, afwMath.MEAN | afwMath.STDEV | afwMath.ERRORS,
204  self._statsControl)
205  mean, meanErr = statObj.getResult(afwMath.MEAN)
206  stdDev, stdDevErr = statObj.getResult(afwMath.STDEV)
207  self.log.info("simple mean=%0.2f; meanErr=%0.2f; stdDev=%0.2f; stdDevErr=%0.2f" % \
208  (mean, meanErr, stdDev, stdDevErr))
209 
210  return pipeBase.Struct(
211  mean = mean,
212  meanErr = meanErr,
213  stdDev = stdDev,
214  stdDevErr = stdDevErr,
215  )
Pass parameters to a Statistics objectA class to pass parameters which control how the stats are calc...
Definition: Statistics.h:92
def run
Compute and return statistics for a masked image.
Statistics makeStatistics(afwImage::Mask< afwImage::MaskPixel > const &msk, int const flags, StatisticsControl const &sctrl)
Specialization to handle Masks.
Definition: Statistics.cc:1082

Member Data Documentation

string lsst.pipe.tasks.exampleStatsTasks.ExampleSimpleStatsTask._DefaultName = "exampleSimpleStats"
staticprivate

Having a default name simplifies construction of the task, since the parent task need not specify a name.

Note: having a default name is required for command-line tasks. The name can be simple and need not be unique (except for multiple subtasks that will be run by a parent task at the same time).

Definition at line 184 of file exampleStatsTasks.py.

lsst.pipe.tasks.exampleStatsTasks.ExampleSimpleStatsTask._statsControl
private

Definition at line 201 of file exampleStatsTasks.py.

lsst.pipe.tasks.exampleStatsTasks.ExampleSimpleStatsTask.ConfigClass = pexConfig.Config
static

Even a task with no configuration requires setting ConfigClass.

Definition at line 179 of file exampleStatsTasks.py.


The documentation for this class was generated from the following file: