LSST Applications  21.0.0-172-gfb10e10a+18fedfabac,22.0.0+297cba6710,22.0.0+80564b0ff1,22.0.0+8d77f4f51a,22.0.0+a28f4c53b1,22.0.0+dcf3732eb2,22.0.1-1-g7d6de66+2a20fdde0d,22.0.1-1-g8e32f31+297cba6710,22.0.1-1-geca5380+7fa3b7d9b6,22.0.1-12-g44dc1dc+2a20fdde0d,22.0.1-15-g6a90155+515f58c32b,22.0.1-16-g9282f48+790f5f2caa,22.0.1-2-g92698f7+dcf3732eb2,22.0.1-2-ga9b0f51+7fa3b7d9b6,22.0.1-2-gd1925c9+bf4f0e694f,22.0.1-24-g1ad7a390+a9625a72a8,22.0.1-25-g5bf6245+3ad8ecd50b,22.0.1-25-gb120d7b+8b5510f75f,22.0.1-27-g97737f7+2a20fdde0d,22.0.1-32-gf62ce7b1+aa4237961e,22.0.1-4-g0b3f228+2a20fdde0d,22.0.1-4-g243d05b+871c1b8305,22.0.1-4-g3a563be+32dcf1063f,22.0.1-4-g44f2e3d+9e4ab0f4fa,22.0.1-42-gca6935d93+ba5e5ca3eb,22.0.1-5-g15c806e+85460ae5f3,22.0.1-5-g58711c4+611d128589,22.0.1-5-g75bb458+99c117b92f,22.0.1-6-g1c63a23+7fa3b7d9b6,22.0.1-6-g50866e6+84ff5a128b,22.0.1-6-g8d3140d+720564cf76,22.0.1-6-gd805d02+cc5644f571,22.0.1-8-ge5750ce+85460ae5f3,master-g6e05de7fdc+babf819c66,master-g99da0e417a+8d77f4f51a,w.2021.48
LSST Data Management Base Package
Public Member Functions | Static Public Attributes | List of all members
lsst.pipe.tasks.exampleCmdLineTask.ExampleCmdLineTask Class Reference

Example command-line task that computes simple statistics on an image. More...

Inheritance diagram for lsst.pipe.tasks.exampleCmdLineTask.ExampleCmdLineTask:

Public Member Functions

def __init__ (self, *args, **kwargs)
 
def runDataRef (self, dataRef)
 Compute a few statistics on the image plane of an exposure. More...
 

Static Public Attributes

 ConfigClass = ExampleCmdLineConfig
 

Detailed Description

Example command-line task that computes simple statistics on an image.

\section pipeTasks_ExampleCmdLineTask_Contents Contents

 - \ref pipeTasks_ExampleCmdLineTask_Purpose
 - \ref pipeTasks_ExampleCmdLineTask_Config
 - \ref pipeTasks_ExampleCmdLineTask_Debug
 - \ref pipeTasks_ExampleCmdLineTask_Example

\section pipeTasks_ExampleCmdLineTask_Purpose Description

\copybrief ExampleCmdLineTask

This task was written as an example for the documents \ref pipeTasks_writeTask
and \ref pipeTasks_writeCmdLineTask.
The task reads in a "calexp" (a calibrated science \ref lsst::afw::image::Exposure "exposure"),
computes statistics on the image plane, and logs and returns the statistics.
In addition, if debugging is enabled, it displays the image in current display backend.

The image statistics are computed using a subtask, in order to show how to call subtasks and how to
\ref pipeBase_argumentParser_retargetSubtasks "retarget" (replace) them with variant subtasks.

The main method is \ref ExampleCmdLineTask.runDataRef "runDataRef".

\section pipeTasks_ExampleCmdLineTask_Config    Configuration parameters

See \ref ExampleCmdLineConfig

\section pipeTasks_ExampleCmdLineTask_Debug     Debug variables

This task supports the following debug variables:
<dl>
    <dt>`display`
    <dd>If True then display the exposure in current display backend
</dl>

To enable debugging, see \ref baseDebug.

\section pipeTasks_ExampleCmdLineTask_Example A complete example of using ExampleCmdLineTask

This code is in examples/exampleCmdLineTask.py, and can be run as follows:
\code
examples/exampleCmdLineTask.py $OBS_TEST_DIR/data/input --id
# that will process all data; you can also try any combination of these flags:
--id filter=g
--config doFail=True --doraise
--show config data
\endcode

Definition at line 55 of file exampleCmdLineTask.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.pipe.tasks.exampleCmdLineTask.ExampleCmdLineTask.__init__ (   self,
args,
**  kwargs 
)
Construct an ExampleCmdLineTask

Call the parent class constructor and make the "stats" subtask from the config field of the same name.

Definition at line 108 of file exampleCmdLineTask.py.

108  def __init__(self, *args, **kwargs):
109  """Construct an ExampleCmdLineTask
110 
111  Call the parent class constructor and make the "stats" subtask from the config field of the same name.
112  """
113  pipeBase.CmdLineTask.__init__(self, *args, **kwargs)
114  self.makeSubtask("stats")
115 

Member Function Documentation

◆ runDataRef()

def lsst.pipe.tasks.exampleCmdLineTask.ExampleCmdLineTask.runDataRef (   self,
  dataRef 
)

Compute a few statistics on the image plane of an exposure.

    @param dataRef: data reference for a calibrated science exposure ("calexp")
    @return 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 exampleCmdLineTask.py.

117  def runDataRef(self, dataRef):
118  """!Compute a few statistics on the image plane of an exposure
119 
120  @param dataRef: data reference for a calibrated science exposure ("calexp")
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
126  """
127  self.log.info("Processing data ID %s", dataRef.dataId)
128  if self.config.doFail:
129  raise pipeBase.TaskError("Raising TaskError by request (config.doFail=True)")
130 
131  # Unpersist the raw exposure pointed to by the data reference
132  rawExp = dataRef.get("raw")
133  maskedImage = rawExp.getMaskedImage()
134 
135  # Support extra debug output.
136  # -
137  import lsstDebug
138  display = lsstDebug.Info(__name__).display
139  if display:
140  frame = 1
141  disp = afwDisplay.Display(frame=frame)
142  disp.mtv(rawExp, title="exposure")
143 
144  # return the pipe_base Struct that is returned by self.stats.run
145  return self.stats.run(maskedImage)
146 
def run(self, coaddExposures, bbox, wcs)
Definition: getTemplate.py:603

Member Data Documentation

◆ ConfigClass

lsst.pipe.tasks.exampleCmdLineTask.ExampleCmdLineTask.ConfigClass = ExampleCmdLineConfig
static

Definition at line 105 of file exampleCmdLineTask.py.


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