LoadIndexedReferenceObjectsTask¶
-
class
lsst.meas.algorithms.
LoadIndexedReferenceObjectsTask
(config: Optional[Config] = None, name: Optional[str] = None, parentTask: Optional[Task] = None, log: Optional[Union[logging.Logger, lsst.utils.logging.LsstLogAdapter]] = None)¶ Bases:
lsst.meas.algorithms.LoadReferenceObjectsTask
Stub of the LoadIndexedReferenceObjectsTask to allow retargeting before removal.
Deprecated since version v25.0: This task is used in gen2 only; it will be removed after v25. See DM-35671 for details on updating code to avoid this warning.
Methods Summary
applyProperMotions
(catalog, epoch)Apply proper motion correction to a reference catalog. emptyMetadata
()Empty (clear) the metadata for this Task and all sub-Tasks. getFullMetadata
()Get metadata for all tasks. getFullName
()Get the task name as a hierarchical name including parent task names. getMetadataBox
(bbox, wcs, filterName[, …])Return metadata about the loaded reference catalog, in an on-detector box. getMetadataCircle
(coord, radius, filterName)Return metadata about the loaded reference catalog, in an on-sky circle. getName
()Get the name of the task. getTaskDict
()Get a dictionary of all tasks as a shallow copy. loadPixelBox
(bbox, wcs, filterName[, epoch, …])Load reference objects that are within a pixel-based rectangular region. loadRegion
(region, filterName[, filtFunc, epoch])Load reference objects within a specified region. loadSkyCircle
(ctrCoord, radius, filterName)Load reference objects that overlap a circular sky region. makeField
(doc)Make a lsst.pex.config.ConfigurableField
for this task.makeSubtask
(name, **keyArgs)Create a subtask as a new instance as the name
attribute of this task.timer
(name, logLevel)Context manager to log performance data for an arbitrary block of code. Methods Documentation
-
applyProperMotions
(catalog, epoch)¶ Apply proper motion correction to a reference catalog.
Adjust position and position error in the
catalog
for proper motion to the specifiedepoch
, 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 inpm_ra
(rad/yr), optional.pm_dec
: Proper motion in Declination (rad/yr,- North positive)
pm_decErr
: Error inpm_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.
- catalog :
-
emptyMetadata
() → None¶ Empty (clear) the metadata for this Task and all sub-Tasks.
-
getFullMetadata
() → lsst.pipe.base._task_metadata.TaskMetadata¶ Get metadata for all tasks.
Returns: - metadata :
TaskMetadata
The keys are the full task name. Values are metadata for the top-level task and all subtasks, sub-subtasks, etc.
Notes
The returned metadata includes timing information (if
@timer.timeMethod
is used) and any metadata set by the task. The name of each item consists of the full task name with.
replaced by:
, followed by.
and the name of the item, e.g.:topLevelTaskName:subtaskName:subsubtaskName.itemName
using
:
in the full task name disambiguates the rare situation that a task has a subtask and a metadata item with the same name.- metadata :
-
getFullName
() → str¶ Get the task name as a hierarchical name including parent task names.
Returns: - fullName :
str
The full name consists of the name of the parent task and each subtask separated by periods. For example:
- The full name of top-level task “top” is simply “top”.
- The full name of subtask “sub” of top-level task “top” is “top.sub”.
- The full name of subtask “sub2” of subtask “sub” of top-level task “top” is “top.sub.sub2”.
- fullName :
-
getMetadataBox
(bbox, wcs, filterName, epoch=None, bboxToSpherePadding=100)¶ Return metadata about the loaded reference catalog, in an on-detector box.
This metadata is used for reloading the catalog (e.g., for reconstituting a normalised match list).
Parameters: - bbox :
lsst.geom.Box2I
orlsst.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
orNone
, optional Epoch that proper motion and parallax were corrected to, or
None
if no such corrections were applied.- 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.
- bbox :
-
static
getMetadataCircle
(coord, radius, filterName, epoch=None)¶ Return metadata about the loaded reference catalog, in an on-sky circle.
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
orNone
, optional Epoch that proper motion and parallax were corrected to, or
None
if no such corrections were applied.
Returns: - md :
lsst.daf.base.PropertyList
Metadata about the catalog.
- coord :
-
getTaskDict
() → Dict[str, weakref.ReferenceType[lsst.pipe.base.task.Task]]¶ Get a dictionary of all tasks as a shallow copy.
Returns: - taskDict :
dict
Dictionary containing full task name: task object for the top-level task and all subtasks, sub-subtasks, etc.
- taskDict :
-
loadPixelBox
(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
orlsst.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
orNone
, 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.
- bbox :
-
loadRegion
(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
orNone
, 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.
- region :
-
loadSkyCircle
(ctrCoord, radius, filterName, epoch=None, centroids=False)¶ Load reference objects that overlap a circular sky region.
Parameters: - ctrCoord :
lsst.geom.SpherePoint
ICRS center of search region.
- radius :
lsst.geom.Angle
Radius of search region.
- filterName :
str
Name of filter. This can be used for flux limit comparisons.
- epoch :
astropy.time.Time
orNone
, optional Epoch to which to correct proper motion and parallax, or
None
to not apply such corrections.- centroids :
bool
, optional Add centroid fields to the loaded Schema.
loadPixelBox
expects these fields to exist.
Returns: - results :
lsst.pipe.base.Struct
A
Struct
containing the following fields:refCat
A catalog of reference objects with the standard schema, as documented in the main doc string for
LoadReferenceObjects
. The catalog is guaranteed to be contiguous. (lsst.afw.catalog.SimpleCatalog
)fluxField
Name of flux field for specified
filterName
. (str
)
Notes
Note that subclasses are responsible for performing the proper motion correction, since this is the lowest-level interface for retrieving the catalog.
- ctrCoord :
-
classmethod
makeField
(doc: str) → lsst.pex.config.configurableField.ConfigurableField¶ Make a
lsst.pex.config.ConfigurableField
for this task.Parameters: - doc :
str
Help text for the field.
Returns: - configurableField :
lsst.pex.config.ConfigurableField
A
ConfigurableField
for this task.
Examples
Provides a convenient way to specify this task is a subtask of another task.
Here is an example of use:
class OtherTaskConfig(lsst.pex.config.Config): aSubtask = ATaskClass.makeField("brief description of task")
- doc :
-
makeSubtask
(name: str, **keyArgs) → None¶ Create a subtask as a new instance as the
name
attribute of this task.Parameters: - name :
str
Brief name of the subtask.
- keyArgs
Extra keyword arguments used to construct the task. The following arguments are automatically provided and cannot be overridden:
- “config”.
- “parentTask”.
Notes
The subtask must be defined by
Task.config.name
, an instance ofConfigurableField
orRegistryField
.- name :
-
timer
(name: str, logLevel: int = 10) → Iterator[None]¶ Context manager to log performance data for an arbitrary block of code.
Parameters: See also
timer.logInfo
Examples
Creating a timer context:
with self.timer("someCodeToTime"): pass # code to time
-