lsst.meas.algorithms  20.0.0-10-g0891cd99+c064e41ce0
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader Class Reference

Public Member Functions

def __init__ (self, dataIds, refCats, config, log=None)
 
def loadPixelBox (self, bbox, wcs, filterName=None, epoch=None, photoCalib=None, bboxPadding=100)
 
def loadRegion (self, region, filtFunc=None, filterName=None, epoch=None)
 
def loadSkyCircle (self, ctrCoord, radius, filterName=None, epoch=None)
 
def joinMatchListWithCatalog (self, matchCat, sourceCat)
 
def getMetadataBox (cls, bbox, wcs, filterName=None, photoCalib=None, epoch=None, bboxPadding=100)
 

Static Public Member Functions

def getMetadataCircle (coord, radius, filterName, photoCalib=None, epoch=None)
 
def addFluxAliases (refCat, defaultFilter, filterReferenceMap)
 
def remapReferenceCatalogSchema (refCat, *filterNameList=None, position=False, photometric=False)
 

Public Attributes

 dataIds
 
 refCats
 
 log
 
 config
 

Detailed Description

This class facilitates loading reference catalogs with gen 3 middleware

The middleware preflight solver will create a list of datarefs that may
possibly overlap a given region. These datarefs are then used to construct
and 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.

Definition at line 195 of file loadReferenceObjects.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.__init__ (   self,
  dataIds,
  refCats,
  config,
  log = None 
)
Constructs an instance of ReferenceObjectLoader

Parameters
----------
dataIds : iterable of `lsst.daf.butler.DataIds`
    An iterable object of DataSetRefs which point to reference catalogs
    in a gen 3 repository
refCats : Iterable of `lsst.daf.butler.DeferedDatasetHandle`
    Handles to load refCats on demand
log : `lsst.log.Log`
    Logger object used to write out messages. If `None` (default) the default
    lsst logger will be used

Definition at line 205 of file loadReferenceObjects.py.

Member Function Documentation

◆ addFluxAliases()

def lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.addFluxAliases (   refCat,
  defaultFilter,
  filterReferenceMap 
)
static
This function creates a new catalog containing the information of the input refCat
as well as added flux columns and aliases between camera and reference flux.

Parameters
----------
refCat : `lsst.afw.table.SimpleCatalog`
    Catalog of reference objects
defaultFilter : `str`
    Name of the default reference filter
filterReferenceMap : `dict` of `str`
    Dictionary with keys corresponding to a filter name, and values which
    correspond to the name of the reference filter.

Returns
-------
refCat : `lsst.afw.table.SimpleCatalog`
    Reference catalog with columns added to track reference filters

Raises
------
`RuntimeError`
    If specified reference filter name is not a filter specifed as a key in the
    reference filter map.

Definition at line 587 of file loadReferenceObjects.py.

◆ getMetadataBox()

def lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.getMetadataBox (   cls,
  bbox,
  wcs,
  filterName = None,
  photoCalib = None,
  epoch = None,
  bboxPadding = 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`
    Bounding bos for the pixels
wcs : `lsst.afw.geom.SkyWcs
    WCS object
filterName : `str` or None
    filterName of the camera filter, or None or blank for the default filter
photoCalib : None
    Deprecated, only included for api compatibility
epoch : `astropy.time.Time` (optional)
    Epoch to which to correct proper motion and parallax,
    or None to not apply such corrections.
bboxPadding : `int`
    Number describing how much to pad the input bbox by (in pixels), defaults
    to 100. This parameter is necessary because optical distortions in telescopes
    can cause a rectangular pixel grid to map into a non "rectangular" spherical
    region in sky coordinates. This padding is used to create a spherical
    "rectangle", which will for sure enclose the input box.  This padding is only
    used to determine if the reference catalog for a sky patch will be loaded from
    the data store, this function will filter out objects which lie within the
    padded region but fall outside the input bounding box region.
Returns
-------
md : `lsst.daf.base.PropertyList`

Definition at line 504 of file loadReferenceObjects.py.

◆ getMetadataCircle()

def lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.getMetadataCircle (   coord,
  radius,
  filterName,
  photoCalib = None,
  epoch = None 
)
static
Return metadata about the load

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

Parameters
----------
coord : `lsst.geom.SpherePoint`
    ICRS center of a circle
radius : `lsst.geom.angle`
    radius of a circle
filterName : `str` or None
    filterName of the camera filter, or None or blank for the default filter
photoCalib : None
    Deprecated, only included for api compatibility
epoch : `astropy.time.Time` (optional)
    Epoch to which to correct proper motion and parallax,
    or None to not apply such corrections.

Returns
-------
md : `lsst.daf.base.PropertyList`

Definition at line 552 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 476 of file loadReferenceObjects.py.

◆ loadPixelBox()

def lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.loadPixelBox (   self,
  bbox,
  wcs,
  filterName = None,
  epoch = None,
  photoCalib = None,
  bboxPadding = 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 will look at a reference
objects pixel position and accept objects that lie within the specified
bounding box.

The spherical box region and filtering function are passed to the generic
loadRegion method which will load and filter the reference objects from
the datastore and return a single catalog containing all reference objects

Parameters
----------
bbox : `lsst.geom.box2I`
    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 space
    of pixels of the supplied bbox
filterName : `str`
    Name of camera filter, or None or blank for the default filter
epoch : `astropy.time.Time` (optional)
    Epoch to which to correct proper motion and parallax,
    or None to not apply such corrections.
photoCalib : None
    Deprecated and ignored, only included for api compatibility
bboxPadding : `int`
    Number describing how much to pad the input bbox by (in pixels), defaults
    to 100. This parameter is necessary because optical distortions in telescopes
    can cause a rectangular pixel grid to map into a non "rectangular" spherical
    region in sky coordinates. This padding is used to create a spherical
    "rectangle", which will for sure enclose the input box.  This padding is only
    used to determine if the reference catalog for a sky patch will be loaded from
    the data store, this function will filter out objects which lie within the
    padded region but fall outside the input bounding box region.

Returns
-------
referenceCatalog : `lsst.afw.table.SimpleCatalog`
    Catalog containing reference objects inside the specified bounding box

Raises
------
`lsst.pex.exception.RuntimeError`
    Raised if no reference catalogs could be found for the specified region

`lsst.pex.exception.TypeError`
    Raised if the loaded reference catalogs do not have matching schemas

Definition at line 255 of file loadReferenceObjects.py.

◆ loadRegion()

def lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.loadRegion (   self,
  region,
  filtFunc = None,
  filterName = 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 will return 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
    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 the value is
    left as the default (None) than 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, or None or blank for the default filter
epoch : `astropy.time.Time` (optional)
    Epoch to which to correct proper motion and parallax,
    or None to not apply such corrections.

Returns
-------
referenceCatalog : `lsst.afw.table.SourceCatalog`
    Catalog containing reference objects which intersect the input region,
    filtered by the specified filter function

Raises
------
`lsst.pex.exception.RuntimeError`
    Raised if no reference catalogs could be found for the specified region

`lsst.pex.exception.TypeError`
    Raised if the loaded reference catalogs do not have matching schemas

Definition at line 326 of file loadReferenceObjects.py.

◆ loadSkyCircle()

def lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.loadSkyCircle (   self,
  ctrCoord,
  radius,
  filterName = None,
  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, or None or blank for the default filter
epoch : `astropy.time.Time` (optional)
    Epoch to which to correct proper motion and parallax,
    or None to not apply such corrections.

Returns
-------
referenceCatalog : `lsst.afw.table.SourceCatalog`
    Catalog containing reference objects inside the specified bounding box

Raises
------
`lsst.pex.exception.RuntimeError`
    Raised if no reference catalogs could be found for the specified region

`lsst.pex.exception.TypeError`
    Raised if the loaded reference catalogs do not have matching schemas

Definition at line 437 of file loadReferenceObjects.py.

◆ remapReferenceCatalogSchema()

def lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.remapReferenceCatalogSchema (   refCat,
filterNameList = None,
  position = False,
  photometric = False 
)
static
This function takes in a reference catalog and creates a new catalog with additional
columns defined the remaining function arguments.

Parameters
----------
refCat : `lsst.afw.table.SimpleCatalog`
    Reference catalog to map to new catalog

Returns
-------
expandedCat : `lsst.afw.table.SimpleCatalog`
    Deep copy of input reference catalog with additional columns added

Definition at line 633 of file loadReferenceObjects.py.

Member Data Documentation

◆ config

lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.config

Definition at line 223 of file loadReferenceObjects.py.

◆ dataIds

lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.dataIds

Definition at line 220 of file loadReferenceObjects.py.

◆ log

lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.log

Definition at line 222 of file loadReferenceObjects.py.

◆ refCats

lsst.meas.algorithms.loadReferenceObjects.ReferenceObjectLoader.refCats

Definition at line 221 of file loadReferenceObjects.py.


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