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
Public Member Functions | Static Public Attributes | List of all members
lsst.meas.base.references.BaseReferencesTask Class Reference

Base class for forced photometry subtask that retrieves reference sources. More...

Inheritance diagram for lsst.meas.base.references.BaseReferencesTask:
lsst.meas.base.references.CoaddSrcReferencesTask lsst.meas.base.references.MultiBandReferencesTask

Public Member Functions

def __init__
 Initialize the task. More...
 
def getSchema
 Return the schema for the reference sources. More...
 
def getWcs
 Return the WCS for reference sources. More...
 
def fetchInBox
 Return reference sources that overlap a region defined by a pixel-coordinate bounding box and corresponding Wcs. More...
 
def fetchInPatches
 Return reference sources that overlap a region defined by one or more SkyMap patches. More...
 
def subset
 Filter sources to contain only those within the given box, defined in the coordinate system defined by the given Wcs. More...
 

Static Public Attributes

 ConfigClass = BaseReferencesConfig
 

Detailed Description

Base class for forced photometry subtask that retrieves reference sources.

BaseReferencesTask defines the required API for the references task, which includes:

It also provides the subset() method, which may be of use to derived classes when reimplementing fetchInBox.

Definition at line 45 of file references.py.

Constructor & Destructor Documentation

def lsst.meas.base.references.BaseReferencesTask.__init__ (   self,
  butler = None,
  schema = None,
  kwargs 
)

Initialize the task.

BaseReferencesTask and its subclasses take two keyword arguments beyond the usual Task arguments:

  • schema: the Schema of the reference catalog
  • butler: a butler that will allow the task to load its Schema from disk. At least one of these arguments must be present; if both are, schema takes precedence.

Definition at line 61 of file references.py.

61 
62  def __init__(self, butler=None, schema=None, **kwargs):
63  """!Initialize the task.
64 
65  BaseReferencesTask and its subclasses take two keyword arguments beyond the usual Task arguments:
66  - schema: the Schema of the reference catalog
67  - butler: a butler that will allow the task to load its Schema from disk.
68  At least one of these arguments must be present; if both are, schema takes precedence.
69  """
70  lsst.pipe.base.Task.__init__(self, **kwargs)

Member Function Documentation

def lsst.meas.base.references.BaseReferencesTask.fetchInBox (   self,
  dataRef,
  bbox,
  wcs 
)

Return reference sources that overlap a region defined by a pixel-coordinate bounding box and corresponding Wcs.

Parameters
[in]dataRefButlerDataRef; the implied data ID must contain the 'tract' key.
[in]bboxa afw.geom.Box2I or Box2D that defines the region in pixel coordinates
[in]wcsafw.image.Wcs that maps the bbox to sky coordinates
Returns
an iterable of reference sources

It is not required that the returned object be a SourceCatalog; it may be any Python iterable containing SourceRecords (including a lazy iterator).

The returned set of sources should be complete and close to minimal.

Definition at line 85 of file references.py.

85 
86  def fetchInBox(self, dataRef, bbox, wcs):
87  """!
88  Return reference sources that overlap a region defined by a pixel-coordinate bounding box
89  and corresponding Wcs.
90 
91  @param[in] dataRef ButlerDataRef; the implied data ID must contain the 'tract' key.
92  @param[in] bbox a afw.geom.Box2I or Box2D that defines the region in pixel coordinates
93  @param[in] wcs afw.image.Wcs that maps the bbox to sky coordinates
94 
95  @return an iterable of reference sources
96 
97  It is not required that the returned object be a SourceCatalog; it may be any Python iterable
98  containing SourceRecords (including a lazy iterator).
99 
100  The returned set of sources should be complete and close to minimal.
101  """
102  raise NotImplementedError("BaseReferencesTask is pure abstract, and cannot be used directly.")
def fetchInBox
Return reference sources that overlap a region defined by a pixel-coordinate bounding box and corresp...
Definition: references.py:85
def lsst.meas.base.references.BaseReferencesTask.fetchInPatches (   self,
  dataRef,
  patchList 
)

Return reference sources that overlap a region defined by one or more SkyMap patches.

Parameters
[in]dataRefButlerDataRef; the implied data ID must contain the 'tract' key.
[in]patchListlist of skymap.PatchInfo instances for which to fetch reference sources
Returns
an iterable of reference sources

It is not required that the returned object be a SourceCatalog; it may be any Python sequence containing SourceRecords (including a lazy iterator).

The returned set of sources should be complete and close to minimal. If config.removePatchOverlaps is True, only sources within each patch's "inner" bounding box should be returned.

Definition at line 103 of file references.py.

104  def fetchInPatches(self, dataRef, patchList):
105  """!
106  Return reference sources that overlap a region defined by one or more SkyMap patches.
107 
108  @param[in] dataRef ButlerDataRef; the implied data ID must contain the 'tract' key.
109  @param[in] patchList list of skymap.PatchInfo instances for which to fetch reference sources
110 
111  @return an iterable of reference sources
112 
113  It is not required that the returned object be a SourceCatalog; it may be any Python sequence
114  containing SourceRecords (including a lazy iterator).
115 
116  The returned set of sources should be complete and close to minimal. If
117  config.removePatchOverlaps is True, only sources within each patch's "inner" bounding box
118  should be returned.
119  """
120  raise NotImplementedError("BaseReferencesTask is pure abstract, and cannot be used directly.")
def fetchInPatches
Return reference sources that overlap a region defined by one or more SkyMap patches.
Definition: references.py:103
def lsst.meas.base.references.BaseReferencesTask.getSchema (   self,
  butler 
)

Return the schema for the reference sources.

Must be available even before any data has been processed.

Definition at line 71 of file references.py.

71 
72  def getSchema(self, butler):
73  """!
74  Return the schema for the reference sources.
75 
76  Must be available even before any data has been processed.
77  """
78  raise NotImplementedError("BaseReferencesTask is pure abstract, and cannot be used directly.")
def getSchema
Return the schema for the reference sources.
Definition: references.py:71
def lsst.meas.base.references.BaseReferencesTask.getWcs (   self,
  dataRef 
)

Return the WCS for reference sources.

The given dataRef must include the tract in its dataId.

Definition at line 79 of file references.py.

79 
80  def getWcs(self, dataRef):
81  """!
82  Return the WCS for reference sources. The given dataRef must include the tract in its dataId.
83  """
84  raise NotImplementedError("BaseReferencesTask is pure abstract, and cannot be used directly.")
def getWcs
Return the WCS for reference sources.
Definition: references.py:79
def lsst.meas.base.references.BaseReferencesTask.subset (   self,
  sources,
  bbox,
  wcs 
)

Filter sources to contain only those within the given box, defined in the coordinate system defined by the given Wcs.

Parameters
[in]sourcesinput iterable of SourceRecords
[in]bboxbounding box with which to filter reference sources (Box2I or Box2D)
[in]wcsafw.image.Wcs that defines the coordinate system of bbox

Instead of filtering sources directly via their positions, we filter based on the positions of parent objects, then include or discard all children based on their parent's status. This is necessary to support ReplaceWithNoise in measurement, which requires all child sources have their parent present.

Returns
an iterable of filtered reference sources

This is not a part of the required BaseReferencesTask interface; it's a convenience function used in implementing fetchInBox that may be of use to subclasses.

Definition at line 121 of file references.py.

122  def subset(self, sources, bbox, wcs):
123  """!
124  Filter sources to contain only those within the given box, defined in the coordinate system
125  defined by the given Wcs.
126 
127  @param[in] sources input iterable of SourceRecords
128  @param[in] bbox bounding box with which to filter reference sources (Box2I or Box2D)
129  @param[in] wcs afw.image.Wcs that defines the coordinate system of bbox
130 
131  Instead of filtering sources directly via their positions, we filter based on the positions
132  of parent objects, then include or discard all children based on their parent's status. This
133  is necessary to support ReplaceWithNoise in measurement, which requires all child sources have
134  their parent present.
135 
136  @return an iterable of filtered reference sources
137 
138  This is not a part of the required BaseReferencesTask interface; it's a convenience function
139  used in implementing fetchInBox that may be of use to subclasses.
140  """
141  boxD = lsst.afw.geom.Box2D(bbox)
142  # We're passed an arbitrary iterable, but we need a catalog so we can iterate
143  # over parents and then children.
144  catalog = lsst.afw.table.SourceCatalog(self.schema)
145  catalog.extend(sources)
146  # Iterate over objects that have no parent.
147  for parent in catalog.getChildren(0):
148  pixel = wcs.skyToPixel(parent.getCoord())
149  if boxD.contains(pixel):
150  yield parent
151  for child in catalog.getChildren(parent.getId()):
152  yield child
153 
def subset
Filter sources to contain only those within the given box, defined in the coordinate system defined b...
Definition: references.py:121
Custom catalog class for record/table subclasses that are guaranteed to have an ID, and should generally be sorted by that ID.
Definition: fwd.h:55
A floating-point coordinate rectangle geometry.
Definition: Box.h:271

Member Data Documentation

lsst.meas.base.references.BaseReferencesTask.ConfigClass = BaseReferencesConfig
static

Definition at line 59 of file references.py.


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