lsst.pipe.tasks g4a6547c0d5+6fab381471
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.pipe.tasks.measurePsf.MeasurePsfTask Class Reference

More...

Inheritance diagram for lsst.pipe.tasks.measurePsf.MeasurePsfTask:

Public Member Functions

def __init__ (self, schema=None, **kwargs)
 Create the detection task. More...
 
def run (self, exposure, sources, expId=0, matches=None)
 Measure the PSF. More...
 
def usesMatches (self)
 

Public Attributes

 candidateKey
 
 usedKey
 

Static Public Attributes

 ConfigClass = MeasurePsfConfig
 

Detailed Description

Measure the PSF

Contents

Description

A task that selects stars from a catalog of sources and uses those to measure the PSF.

The star selector is a subclass of lsst.meas.algorithms.BaseStarSelectorTask and the PSF determiner is a sublcass of lsst.meas.algorithms.BasePsfDeterminerTask

Warning
There is no establised set of configuration parameters for these algorithms, so once you start modifying parameters (as we do in A complete example of using MeasurePsfTask) your code is no longer portable.

Task initialisation

Invoking the Task

Measure the PSF.

    @param[in,out]   exposure   Exposure to process; measured PSF will be added.
    @param[in,out]   sources    Measured sources on exposure; flag fields will be set marking
                                stars chosen by the star selector and the PSF determiner if a schema
                                was passed to the task constructor.
    @param[in]       expId      Exposure id used for generating random seed.
    @param[in]  matches         A list of lsst.afw.table.ReferenceMatch objects
                                (@em i.e. of lsst.afw.table.Match
                                with @c first being of type lsst.afw.table.SimpleRecord and @c second
                                type lsst.afw.table.SourceRecord --- the reference object and detected
                                object respectively) as returned by @em e.g. the AstrometryTask.
                                Used by star selectors that choose to refer to an external catalog.

    @return a pipe.base.Struct with fields:
     - psf: The measured PSF (also set in the input exposure)
     - cellSet: an lsst.afw.math.SpatialCellSet containing the PSF candidates
        as returned by the psf determiner.

Configuration parameters

See MeasurePsfConfig.

Debug variables

The command line task interface supports a flag -d to import debug.py from your PYTHONPATH; see Using lsstDebug to control debugging output for more about debug.py files.

display
If True, display debugging plots
displayExposure
display the Exposure + spatialCells
displayPsfCandidates
show mosaic of candidates
showBadCandidates
Include bad candidates
displayPsfMosaic
show mosaic of reconstructed PSF(xy)
displayResiduals
show residuals
normalizeResiduals
Normalise residuals by object amplitude

Additionally you can enable any debug outputs that your chosen star selector and psf determiner support.

A complete example of using MeasurePsfTask

This code is in in the examples directory, and can be run as e.g examples/measurePsfTask.py --doDisplay measurePsfTask.py The example also runs SourceDetectionTask and SingleFrameMeasurementTask; see meas_algorithms_measurement_Example for more explanation. Import the tasks (there are some other standard imports; read the file to see them all): SourceDetectionTask MeasurePsfTask We need to create the tasks before processing any data as the task constructor can add an extra column to the schema, but first we need an almost-empty Schema: makeMinimalSchema We can now call the constructors for the tasks we need to find and characterize candidate PSF stars: SourceDetectionTask.ConfigClass measureTask Note that we've chosen a minimal set of measurement plugins: we need the outputs of base_SdssCentroid base_SdssShape and base_CircularApertureFlux as inputs to the PSF measurement algorithm, while base_PixelFlags identifies and flags bad sources (e.g. with pixels too close to the edge) so they can be removed later. Now we can create and configure the task that we're interested in: MeasurePsfTask measurePsfTask We're now ready to process the data (we could loop over multiple exposures/catalogues using the same task objects). First create the output table: afwTable And process the image: sources = result We can then unpack and use the results: psf cellSet If you specified --doDisplay you can see the PSF candidates: display RED

To investigate the Debug variables, put something like

import lsstDebug
def DebugInfo(name):
di = lsstDebug.getInfo(name) # N.b. lsstDebug.Info(name) would call us recursively
if name == "lsst.pipe.tasks.measurePsf" :
di.display = True
di.displayExposure = False # display the Exposure + spatialCells
di.displayPsfCandidates = True # show mosaic of candidates
di.displayPsfMosaic = True # show mosaic of reconstructed PSF(xy)
di.displayResiduals = True # show residuals
di.showBadCandidates = True # Include bad candidates
di.normalizeResiduals = False # Normalise residuals by object amplitude
return di
lsstDebug.Info = DebugInfo

into your debug.py file and run measurePsfTask.py with the --debug flag.

Definition at line 57 of file measurePsf.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.pipe.tasks.measurePsf.MeasurePsfTask.__init__ (   self,
  schema = None,
**  kwargs 
)

Create the detection task.

Most arguments are simply passed onto pipe.base.Task.

    @param schema An lsst::afw::table::Schema used to create the output lsst.afw.table.SourceCatalog
    @param **kwargs Keyword arguments passed to lsst.pipe.base.task.Task.__init__.

    If schema is not None, 'calib_psf_candidate' and 'calib_psf_used' fields will be added to
    identify which stars were employed in the PSF estimation.

    @note This task can add fields to the schema, so any code calling this task must ensure that
    these fields are indeed present in the input table.

Definition at line 206 of file measurePsf.py.

Member Function Documentation

◆ run()

def lsst.pipe.tasks.measurePsf.MeasurePsfTask.run (   self,
  exposure,
  sources,
  expId = 0,
  matches = None 
)

Measure the PSF.

    @param[in,out]   exposure   Exposure to process; measured PSF will be added.
    @param[in,out]   sources    Measured sources on exposure; flag fields will be set marking
                                stars chosen by the star selector and the PSF determiner if a schema
                                was passed to the task constructor.
    @param[in]       expId      Exposure id used for generating random seed.
    @param[in]  matches         A list of lsst.afw.table.ReferenceMatch objects
                                (@em i.e. of lsst.afw.table.Match
                                with @c first being of type lsst.afw.table.SimpleRecord and @c second
                                type lsst.afw.table.SourceRecord --- the reference object and detected
                                object respectively) as returned by @em e.g. the AstrometryTask.
                                Used by star selectors that choose to refer to an external catalog.

    @return a pipe.base.Struct with fields:
     - psf: The measured PSF (also set in the input exposure)
     - cellSet: an lsst.afw.math.SpatialCellSet containing the PSF candidates
        as returned by the psf determiner.

Definition at line 241 of file measurePsf.py.

◆ usesMatches()

def lsst.pipe.tasks.measurePsf.MeasurePsfTask.usesMatches (   self)
Return True if this task makes use of the "matches" argument to the run method

Definition at line 334 of file measurePsf.py.

Member Data Documentation

◆ candidateKey

lsst.pipe.tasks.measurePsf.MeasurePsfTask.candidateKey

Definition at line 221 of file measurePsf.py.

◆ ConfigClass

lsst.pipe.tasks.measurePsf.MeasurePsfTask.ConfigClass = MeasurePsfConfig
static

Definition at line 203 of file measurePsf.py.

◆ usedKey

lsst.pipe.tasks.measurePsf.MeasurePsfTask.usedKey

Definition at line 226 of file measurePsf.py.


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