LSST Applications  21.0.0-147-g0e635eb1+1acddb5be5,22.0.0+052faf71bd,22.0.0+1ea9a8b2b2,22.0.0+6312710a6c,22.0.0+729191ecac,22.0.0+7589c3a021,22.0.0+9f079a9461,22.0.1-1-g7d6de66+b8044ec9de,22.0.1-1-g87000a6+536b1ee016,22.0.1-1-g8e32f31+6312710a6c,22.0.1-10-gd060f87+016f7cdc03,22.0.1-12-g9c3108e+df145f6f68,22.0.1-16-g314fa6d+c825727ab8,22.0.1-19-g93a5c75+d23f2fb6d8,22.0.1-19-gb93eaa13+aab3ef7709,22.0.1-2-g8ef0a89+b8044ec9de,22.0.1-2-g92698f7+9f079a9461,22.0.1-2-ga9b0f51+052faf71bd,22.0.1-2-gac51dbf+052faf71bd,22.0.1-2-gb66926d+6312710a6c,22.0.1-2-gcb770ba+09e3807989,22.0.1-20-g32debb5+b8044ec9de,22.0.1-23-gc2439a9a+fb0756638e,22.0.1-3-g496fd5d+09117f784f,22.0.1-3-g59f966b+1e6ba2c031,22.0.1-3-g849a1b8+f8b568069f,22.0.1-3-gaaec9c0+c5c846a8b1,22.0.1-32-g5ddfab5d3+60ce4897b0,22.0.1-4-g037fbe1+64e601228d,22.0.1-4-g8623105+b8044ec9de,22.0.1-5-g096abc9+d18c45d440,22.0.1-5-g15c806e+57f5c03693,22.0.1-7-gba73697+57f5c03693,master-g6e05de7fdc+c1283a92b8,master-g72cdda8301+729191ecac,w.2021.39
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 54 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 107 of file exampleCmdLineTask.py.

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

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 116 of file exampleCmdLineTask.py.

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


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