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.ExampleSigmaClippedStatsTask Class Reference

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

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

Public Member Functions

def __init__
 Construct an ExampleSigmaClippedStatsTask. More...
 
def run
 Compute and return statistics for a masked image. More...
 

Static Public Attributes

 ConfigClass = ExampleSigmaClippedStatsConfig
 

Private Attributes

 _badPixelMask
 
 _statsControl
 

Static Private Attributes

string _DefaultName = "exampleSigmaClippedStats"
 

Detailed Description

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

Contents

Description

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

This is a simple example task designed to be run as a subtask by ExampleCmdLineTask. See also ExampleSimpleStatsTask as a variant that is even simpler.

The main method is run.

Configuration parameters

See ExampleSigmaClippedStatsConfig

Debug variables

This task has no debug variables.

A complete example of using ExampleSigmaClippedStatsTask

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 62 of file exampleStatsTasks.py.

Constructor & Destructor Documentation

def lsst.pipe.tasks.exampleStatsTasks.ExampleSigmaClippedStatsTask.__init__ (   self,
  args,
  kwargs 
)

Construct an ExampleSigmaClippedStatsTask.

The init method may compute anything that that does not require data. In this case we create a statistics control object using the config (which cannot change once the task is created).

Definition at line 100 of file exampleStatsTasks.py.

101  def __init__(self, *args, **kwargs):
102  """!Construct an ExampleSigmaClippedStatsTask
103 
104  The init method may compute anything that that does not require data.
105  In this case we create a statistics control object using the config
106  (which cannot change once the task is created).
107  """
108  pipeBase.Task.__init__(self, *args, **kwargs)
110  self._badPixelMask = MaskU.getPlaneBitMask(self.config.badMaskPlanes)
113  self._statsControl.setNumSigmaClip(self.config.numSigmaClip)
114  self._statsControl.setNumIter(self.config.numIter)
115  self._statsControl.setAndMask(self._badPixelMask)
Pass parameters to a Statistics objectA class to pass parameters which control how the stats are calc...
Definition: Statistics.h:92
def __init__
Construct an ExampleSigmaClippedStatsTask.

Member Function Documentation

def lsst.pipe.tasks.exampleStatsTasks.ExampleSigmaClippedStatsTask.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 117 of file exampleStatsTasks.py.

118  def run(self, maskedImage):
119  """!Compute and return statistics for a masked image
120 
121  @param[in] maskedImage: masked image (an lsst::afw::MaskedImage)
122  @return a pipeBase Struct containing:
123  - mean: mean of image plane
124  - meanErr: uncertainty in mean
125  - stdDev: standard deviation of image plane
126  - stdDevErr: uncertainty in standard deviation
127  """
128  statObj = afwMath.makeStatistics(maskedImage, afwMath.MEANCLIP | afwMath.STDEVCLIP | afwMath.ERRORS,
129  self._statsControl)
130  mean, meanErr = statObj.getResult(afwMath.MEANCLIP)
131  stdDev, stdDevErr = statObj.getResult(afwMath.STDEVCLIP)
132  self.log.info("clipped mean=%0.2f; meanErr=%0.2f; stdDev=%0.2f; stdDevErr=%0.2f" % \
133  (mean, meanErr, stdDev, stdDevErr))
134  return pipeBase.Struct(
135  mean = mean,
136  meanErr = meanErr,
137  stdDev = stdDev,
138  stdDevErr = stdDevErr,
139  )
140 
141 #------------------------- ExampleSimpleStatsTask -------------------------#
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

lsst.pipe.tasks.exampleStatsTasks.ExampleSigmaClippedStatsTask._badPixelMask
private

Definition at line 109 of file exampleStatsTasks.py.

string lsst.pipe.tasks.exampleStatsTasks.ExampleSigmaClippedStatsTask._DefaultName = "exampleSigmaClippedStats"
staticprivate

Definition at line 98 of file exampleStatsTasks.py.

lsst.pipe.tasks.exampleStatsTasks.ExampleSigmaClippedStatsTask._statsControl
private

Definition at line 111 of file exampleStatsTasks.py.

lsst.pipe.tasks.exampleStatsTasks.ExampleSigmaClippedStatsTask.ConfigClass = ExampleSigmaClippedStatsConfig
static

Definition at line 97 of file exampleStatsTasks.py.


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