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
|
Example command-line task that computes simple statistics on an image. More...
Public Member Functions | |
def | __init__ |
def | run |
Compute a few statistics on the image plane of an exposure. More... | |
Static Public Attributes | |
ConfigClass = ExampleCmdLineConfig | |
Private Member Functions | |
def | _getConfigName |
Get the name prefix for the task config's dataset type, or None to prevent persisting the config. More... | |
def | _getMetadataName |
Get the name prefix for the task metadata's dataset type, or None to prevent persisting metadata. More... | |
Static Private Attributes | |
string | _DefaultName = "exampleTask" |
Example command-line task that computes simple statistics on an image.
Example command-line task that computes simple statistics on an image.
This task was written as an example for the documents How to Write a Task and How to Write 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 ds9.
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 run.
This task supports the following debug variables:
display
To enable debugging, see Using lsstDebug to control debugging output.
This code is in examples/exampleCmdLineTask.py, and can be run as follows:
Definition at line 51 of file exampleCmdLineTask.py.
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 104 of file exampleCmdLineTask.py.
|
private |
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:
Normally if you override _getConfigName then you override _getMetadataName to match.
Definition at line 142 of file exampleCmdLineTask.py.
|
private |
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 166 of file exampleCmdLineTask.py.
def lsst.pipe.tasks.exampleCmdLineTask.ExampleCmdLineTask.run | ( | self, | |
dataRef | |||
) |
Compute a few statistics on the image plane of an exposure.
dataRef: | data reference for a calibrated science exposure ("calexp") |
Definition at line 113 of file exampleCmdLineTask.py.
|
staticprivate |
Definition at line 102 of file exampleCmdLineTask.py.
|
static |
Definition at line 101 of file exampleCmdLineTask.py.