lsst.meas.algorithms g5065af838d+3d61fe52a5
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader Class Reference
Inheritance diagram for lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader:
lsst.meas.algorithms.loadReferenceObjects.LoadReferenceObjectsTask lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoaderBase lsst.meas.algorithms.loadIndexedReferenceObjects.LoadIndexedReferenceObjectsTask

Public Member Functions

def __init__ (self, dataIds, refCats, log=None, config=None, **kwargs)
 
def applyProperMotions (self, catalog, epoch)
 
def getMetadataBox (self, bbox, wcs, filterName, epoch=None, bboxToSpherePadding=100)
 
def joinMatchListWithCatalog (self, matchCat, sourceCat)
 
def loadPixelBox (self, bbox, wcs, filterName, epoch=None, bboxToSpherePadding=100)
 
def loadRegion (self, region, filterName, filtFunc=None, epoch=None)
 
def loadSkyCircle (self, ctrCoord, radius, filterName, epoch=None)
 

Static Public Member Functions

def makeMinimalSchema (filterNameList, *addCentroid=False, addIsPhotometric=False, addIsResolved=False, addIsVariable=False, coordErrDim=2, addProperMotion=False, properMotionErrDim=2, addParallax=False)
 
def getMetadataCircle (coord, radius, filterName, epoch=None)
 

Public Attributes

 config
 
 dataIds
 
 refCats
 
 log
 

Static Public Attributes

 ConfigClass = LoadReferenceObjectsConfig
 

Detailed Description

This class facilitates loading reference catalogs.

The QuantumGraph generation will create a list of datasets that may
possibly overlap a given region. These datasets are then used to construct
an instance of this class. The class instance should then be passed into
a task which needs reference catalogs. These tasks should then determine
the exact region of the sky reference catalogs will be loaded for, and
call a corresponding method to load the reference objects.

Parameters
----------
dataIds : iterable of `lsst.daf.butler.DataCoordinate`
    An iterable object of data IDs that point to reference catalogs.
refCats : iterable of `lsst.daf.butler.DeferredDatasetHandle`
    Handles to load refCats on demand.
log : `lsst.log.Log`, `logging.Logger` or `None`, optional
    Logger object used to write out messages. If `None` a default
    logger will be used.

Definition at line 251 of file loadReferenceObjects.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.__init__ (   self,
  dataIds,
  refCats,
  log = None,
  config = None,
**  kwargs 
)

Member Function Documentation

◆ applyProperMotions()

def lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.applyProperMotions (   self,
  catalog,
  epoch 
)
Apply proper motion correction to a reference catalog.

Adjust position and position error in the ``catalog``
for proper motion to the specified ``epoch``,
modifying the catalog in place.

Parameters
----------
catalog : `lsst.afw.table.SimpleCatalog`
    Catalog of positions, containing at least these fields:

    - Coordinates, retrieved by the table's coordinate key.
    - ``coord_raErr`` : Error in Right Ascension (rad).
    - ``coord_decErr`` : Error in Declination (rad).
    - ``pm_ra`` : Proper motion in Right Ascension (rad/yr,
        East positive)
    - ``pm_raErr`` : Error in ``pm_ra`` (rad/yr), optional.
    - ``pm_dec`` : Proper motion in Declination (rad/yr,
        North positive)
    - ``pm_decErr`` : Error in ``pm_dec`` (rad/yr), optional.
    - ``epoch`` : Mean epoch of object (an astropy.time.Time)
epoch : `astropy.time.Time`
    Epoch to which to correct proper motion.
    If None, do not apply PM corrections or raise if
    ``config.requireProperMotion`` is True.

Raises
------
RuntimeError
    Raised if ``config.requireProperMotion`` is set but we cannot
    apply the proper motion correction for some reason.

Definition at line 285 of file loadReferenceObjects.py.

◆ getMetadataBox()

def lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.getMetadataBox (   self,
  bbox,
  wcs,
  filterName,
  epoch = None,
  bboxToSpherePadding = 100 
)
Return metadata about the load

This metadata is used for reloading the catalog (e.g., for
reconstituting a normalised match list).

Parameters
----------
bbox : `lsst.geom.Box2I` or `lsst.geom.Box2D`
    Bounding box for the pixels.
wcs : `lsst.afw.geom.SkyWcs`
    The WCS object associated with ``bbox``.
filterName : `str`
    Name of the camera filter.
epoch : `astropy.time.Time` or `None`,  optional
    Epoch to which to correct proper motion and parallax, or `None` to
    not apply such corrections.
bboxToSpherePadding : `int`, optional
    Padding in pixels to account for translating a set of corners into
    a spherical (convex) boundary that is certain to encompass the
    enitre area covered by the box.

Returns
-------
md : `lsst.daf.base.PropertyList`
    The metadata detailing the search parameters used for this
    dataset.

Definition at line 717 of file loadReferenceObjects.py.

◆ getMetadataCircle()

def lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.getMetadataCircle (   coord,
  radius,
  filterName,
  epoch = None 
)
static
Return metadata about the reference catalog being loaded.

This metadata is used for reloading the catalog (e.g. for
reconstituting a normalized match list).

Parameters
----------
coord : `lsst.geom.SpherePoint`
    ICRS center of the search region.
radius : `lsst.geom.Angle`
    Radius of the search region.
filterName : `str`
    Name of the camera filter.
epoch : `astropy.time.Time` or `None`, optional
    Epoch to which to correct proper motion and parallax, or `None` to
    not apply such corrections.

Returns
-------
md : `lsst.daf.base.PropertyList`
    Metadata about the catalog.

Definition at line 685 of file loadReferenceObjects.py.

◆ joinMatchListWithCatalog()

def lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.joinMatchListWithCatalog (   self,
  matchCat,
  sourceCat 
)
Relink an unpersisted match list to sources and reference objects.

A match list is persisted and unpersisted as a catalog of IDs
produced by afw.table.packMatches(), with match metadata
(as returned by the astrometry tasks) in the catalog's metadata
attribute. This method converts such a match catalog into a match
list, with links to source records and reference object records.

Parameters
----------
matchCat : `lsst.afw.table.BaseCatalog`
    Unpersisted packed match list.
    ``matchCat.table.getMetadata()`` must contain match metadata,
    as returned by the astrometry tasks.
sourceCat : `lsst.afw.table.SourceCatalog`
    Source catalog. As a side effect, the catalog will be sorted
    by ID.

Returns
-------
matchList : `lsst.afw.table.ReferenceMatchVector`
    Match list.

Definition at line 758 of file loadReferenceObjects.py.

◆ loadPixelBox()

def lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.loadPixelBox (   self,
  bbox,
  wcs,
  filterName,
  epoch = None,
  bboxToSpherePadding = 100 
)
Load reference objects that are within a pixel-based rectangular
region.

This algorithm works by creating a spherical box whose corners
correspond to the WCS converted corners of the input bounding box
(possibly padded).  It then defines a filtering function which looks at
the pixel position of the reference objects and accepts only those that
lie within the specified bounding box.

The spherical box region and filtering function are passed to the
generic loadRegion method which loads and filters the reference objects
from the datastore and returns a single catalog containing the filtered
set of reference objects.

Parameters
----------
bbox : `lsst.geom.Box2I` or `lsst.geom.Box2D`
    Box which bounds a region in pixel space.
wcs : `lsst.afw.geom.SkyWcs`
    Wcs object defining the pixel to sky (and inverse) transform for
    the supplied ``bbox``.
filterName : `str`
    Name of camera filter.
epoch : `astropy.time.Time` or `None`, optional
    Epoch to which to correct proper motion and parallax, or `None`
    to not apply such corrections.
bboxToSpherePadding : `int`, optional
    Padding to account for translating a set of corners into a
    spherical (convex) boundary that is certain to encompase the
    enitre area covered by the box.

Returns
-------
output : `lsst.pipe.base.Struct`
    Results struct with attributes:

    ``refCat``
        Catalog containing reference objects inside the specified
        bounding box (padded by self.config.pixelMargin).
    ``fluxField``
        Name of the field containing the flux associated with
        ``filterName``.

Raises
------
RuntimeError
    Raised if no reference catalogs could be found for the specified
    region.
TypeError
    Raised if the loaded reference catalogs do not have matching
    schemas.

Definition at line 784 of file loadReferenceObjects.py.

◆ loadRegion()

def lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.loadRegion (   self,
  region,
  filterName,
  filtFunc = None,
  epoch = None 
)
Load reference objects within a specified region.

This function loads the DataIds used to construct an instance of this
class which intersect or are contained within the specified region. The
reference catalogs which intersect but are not fully contained within
the input region are further filtered by the specified filter function.
This function returns a single source catalog containing all reference
objects inside the specified region.

Parameters
----------
region : `lsst.sphgeom.Region`
    This can be any type that is derived from `lsst.sphgeom.Region` and
    should define the spatial region for which reference objects are to
    be loaded.
filtFunc : callable or `None`, optional
    This optional parameter should be a callable object that takes a
    reference catalog and its corresponding region as parameters,
    filters the catalog by some criteria and returns the filtered
    reference catalog. If `None`, an internal filter function is used
    which filters according to if a reference object falls within the
    input region.
filterName : `str`
    Name of camera filter.
epoch : `astropy.time.Time` or `None`, optional
    Epoch to which to correct proper motion and parallax, or `None` to
    not apply such corrections.

Returns
-------
output : `lsst.pipe.base.Struct`
    Results struct with attributes:

    ``refCat``
        Catalog containing reference objects which intersect the
        input region, filtered by the specified filter function.
    ``fluxField``
        Name of the field containing the flux associated with
        ``filterName``.

Raises
------
RuntimeError
    Raised if no reference catalogs could be found for the specified
    region.
TypeError
    Raised if the loaded reference catalogs do not have matching
    schemas.

Definition at line 875 of file loadReferenceObjects.py.

◆ loadSkyCircle()

def lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.loadSkyCircle (   self,
  ctrCoord,
  radius,
  filterName,
  epoch = None 
)
Load reference objects that lie within a circular region on the sky.

This method constructs a circular region from an input center and
angular radius, loads reference catalogs which are contained in or
intersect the circle, and filters reference catalogs which intersect
down to objects which lie within the defined circle.

Parameters
----------
ctrCoord : `lsst.geom.SpherePoint`
    Point defining the center of the circular region.
radius : `lsst.geom.Angle`
    Defines the angular radius of the circular region.
filterName : `str`
    Name of camera filter.
epoch : `astropy.time.Time` or `None`, optional
    Epoch to which to correct proper motion and parallax, or `None` to
    not apply such corrections.

Returns
-------
output : `lsst.pipe.base.Struct`
    Results struct with attributes:

    ``refCat``
        Catalog containing reference objects inside the specified
        search circle.
    ``fluxField``
        Name of the field containing the flux associated with
        ``filterName``.

Reimplemented in lsst.meas.algorithms.loadReferenceObjects.LoadReferenceObjectsTask.

Definition at line 996 of file loadReferenceObjects.py.

◆ makeMinimalSchema()

def lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.makeMinimalSchema (   filterNameList,
addCentroid = False,
  addIsPhotometric = False,
  addIsResolved = False,
  addIsVariable = False,
  coordErrDim = 2,
  addProperMotion = False,
  properMotionErrDim = 2,
  addParallax = False 
)
static
Make a standard schema for reference object catalogs.

Parameters
----------
filterNameList : `list` of `str`
    List of filter names. Used to create <filterName>_flux fields.
addIsPhotometric : `bool`
    If True then add field "photometric".
addIsResolved : `bool`
    If True then add field "resolved".
addIsVariable : `bool`
    If True then add field "variable".
coordErrDim : `int`
    Number of coord error fields; must be one of 0, 2, 3:

    - If 2 or 3: add fields "coord_raErr" and "coord_decErr".
    - If 3: also add field "coord_radecErr".
addProperMotion : `bool`
    If True add fields "epoch", "pm_ra", "pm_dec" and "pm_flag".
properMotionErrDim : `int`
    Number of proper motion error fields; must be one of 0, 2, 3;
    ignored if addProperMotion false:
    - If 2 or 3: add fields "pm_raErr" and "pm_decErr".
    - If 3: also add field "pm_radecErr".
addParallax : `bool`
    If True add fields "epoch", "parallax", "parallaxErr"
    and "parallax_flag".

Returns
-------
schema : `lsst.afw.table.Schema`
    Schema for reference catalog, an
    `lsst.afw.table.SimpleCatalog`.

Notes
-----
Reference catalogs support additional covariances, such as
covariance between RA and proper motion in declination,
that are not supported by this method, but can be added after
calling this method.

Definition at line 344 of file loadReferenceObjects.py.

Member Data Documentation

◆ config

lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.config

Definition at line 280 of file loadReferenceObjects.py.

◆ ConfigClass

lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.ConfigClass = LoadReferenceObjectsConfig
static

Definition at line 271 of file loadReferenceObjects.py.

◆ dataIds

lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.dataIds

Definition at line 281 of file loadReferenceObjects.py.

◆ log

lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.log

Definition at line 283 of file loadReferenceObjects.py.

◆ refCats

lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.refCats

Definition at line 282 of file loadReferenceObjects.py.


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