lsst.pipe.tasks g8b9e2231ea+fa07cb600e
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected 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.
 

Static Public Attributes

ExampleCmdLineConfig ConfigClass = ExampleCmdLineConfig
 

Protected Member Functions

def _getConfigName (self)
 Get the name prefix for the task config's dataset type, or None to prevent persisting the config.
 
def _getMetadataName (self)
 Get the name prefix for the task metadata's dataset type, or None to prevent persisting metadata.
 

Static Protected Attributes

str _DefaultName = "exampleTask"
 

Detailed Description

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

Contents

Description

This task was written as an example for the documents Creating a task and Creating a command-line task. The task reads in a "calexp" (a calibrated science 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 retarget (replace) them with variant subtasks.

The main method is runDataRef.

Configuration parameters

See ExampleCmdLineConfig

Debug variables

This task supports the following debug variables:

display
If True then display the exposure in current display backend

To enable debugging, see the lsstDebug documentation.

A complete example of using ExampleCmdLineTask

This code is in examples/exampleCmdLineTask.py, and can be run as follows:

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

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

Member Function Documentation

◆ _getConfigName()

def lsst.pipe.tasks.exampleCmdLineTask.ExampleCmdLineTask._getConfigName (   self)
protected

Get the name prefix for the task config's dataset type, or None to prevent persisting the config.

    This override returns None to avoid persisting metadata for this trivial task.

    However, if the method returns a name, then the full name of the dataset type will be <name>_config.
    The default CmdLineTask._getConfigName returns _DefaultName,
    which for this task would result in a dataset name of "exampleTask_config".

    Normally you can use the default CmdLineTask._getConfigName, but here are two reasons
    why you might want to override it:
    - If you do not want your task to write its config, then have the override return None.
      That is done for this example task, because I didn't want to clutter up the
      repository with config information for a trivial task.
    - If the default name would not be unique. An example is
      \ref lsst.pipe.tasks.makeSkyMap.MakeSkyMapTask "MakeSkyMapTask": it makes a
      \ref lsst.skymap.SkyMap "sky map" (sky pixelization for a coadd)
      for any of several different types of coadd, such as deep or goodSeeing.
      As such, the name of the persisted config must include the coadd type in order to be unique.

    Normally if you override _getConfigName then you override _getMetadataName to match.

Definition at line 152 of file exampleCmdLineTask.py.

◆ _getMetadataName()

def lsst.pipe.tasks.exampleCmdLineTask.ExampleCmdLineTask._getMetadataName (   self)
protected

Get the name prefix for the task metadata's dataset type, or None to prevent persisting metadata.

    This override returns None to avoid persisting metadata for this trivial task.

    However, if the method returns a name, then the full name of the dataset type will be <name>_metadata.
    The default CmdLineTask._getConfigName returns _DefaultName,
    which for this task would result in a dataset name of "exampleTask_metadata".

    See the description of _getConfigName for reasons to override this method.

Definition at line 176 of file exampleCmdLineTask.py.

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

Member Data Documentation

◆ _DefaultName

str lsst.pipe.tasks.exampleCmdLineTask.ExampleCmdLineTask._DefaultName = "exampleTask"
staticprotected

Definition at line 111 of file exampleCmdLineTask.py.

◆ ConfigClass

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

Definition at line 110 of file exampleCmdLineTask.py.


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