LSSTApplications  18.1.0
LSSTDataManagementBasePackage
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
lsst.meas.extensions.astrometryNet.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask Class Reference

Load reference objects from astrometry.net index files. More...

Inheritance diagram for lsst.meas.extensions.astrometryNet.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask:
lsst.meas.algorithms.loadReferenceObjects.LoadReferenceObjectsTask

Public Member Functions

def __init__ (self, config=None, andConfig=None, kwargs)
 Create a LoadAstrometryNetObjectsTask. More...
 
def loadSkyCircle (self, ctrCoord, radius, filterName=None, epoch=None)
 Load reference objects that overlap a circular sky region. More...
 
def loadPixelBox (self, bbox, wcs, filterName=None, photoCalib=None, epoch=None)
 
def getMetadataBox (self, bbox, wcs, filterName=None, photoCalib=None, epoch=None)
 
def getMetadataCircle (self, coord, radius, filterName, photoCalib=None, epoch=None)
 
def joinMatchListWithCatalog (self, matchCat, sourceCat)
 
def applyProperMotions (self, catalog, epoch)
 

Static Public Member Functions

def makeMinimalSchema (filterNameList, addCentroid=True, addIsPhotometric=False, addIsResolved=False, addIsVariable=False, coordErrDim=2, addProperMotion=False, properMotionErrDim=2, addParallax=False, addParallaxErr=True)
 

Public Attributes

 andConfig
 
 haveIndexFiles
 
 multiInds
 
 butler
 

Static Public Attributes

 ConfigClass = LoadAstrometryNetObjectsConfig
 

Detailed Description

Load reference objects from astrometry.net index files.

Contents

Description

Load reference objects from astrometry.net index files.

Task initialisation

Create a LoadAstrometryNetObjectsTask.

Parameters
[in]configconfiguration (an instance of self.ConfigClass); if None use self.ConfigClass()
[in]andConfigastrometry.net data config (an instance of AstromNetDataConfig, or None); if None then use andConfig.py in the astrometry_net_data product (which must be setup)
[in]kwargsadditional keyword arguments for pipe_base Task.__init__
Exceptions
RuntimeErrorif andConfig is None and the configuration cannot be found, either because astrometry_net_data is not setup in eups or because the setup version does not include the file "andConfig.py"

Invoking the Task

Configuration parameters

See LoadAstrometryNetObjectsConfig

A complete example of using

LoadAstrometryNetObjectsTask

LoadAstrometryNetObjectsTask is a subtask of AstrometryTask, which is called by PhotoCalTask. See A complete example of using PhotoCalTask.

Debug variables

LoadAstrometryNetObjectsTask does not support any debug variables.

Definition at line 24 of file loadAstrometryNetObjects.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.meas.extensions.astrometryNet.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask.__init__ (   self,
  config = None,
  andConfig = None,
  kwargs 
)

Create a LoadAstrometryNetObjectsTask.

Parameters
[in]configconfiguration (an instance of self.ConfigClass); if None use self.ConfigClass()
[in]andConfigastrometry.net data config (an instance of AstromNetDataConfig, or None); if None then use andConfig.py in the astrometry_net_data product (which must be setup)
[in]kwargsadditional keyword arguments for pipe_base Task.__init__
Exceptions
RuntimeErrorif andConfig is None and the configuration cannot be found, either because astrometry_net_data is not setup in eups or because the setup version does not include the file "andConfig.py"

Definition at line 67 of file loadAstrometryNetObjects.py.

67  def __init__(self, config=None, andConfig=None, **kwargs):
68  """!Create a LoadAstrometryNetObjectsTask
69 
70  @param[in] config configuration (an instance of self.ConfigClass); if None use self.ConfigClass()
71  @param[in] andConfig astrometry.net data config (an instance of AstromNetDataConfig, or None);
72  if None then use andConfig.py in the astrometry_net_data product (which must be setup)
73  @param[in] kwargs additional keyword arguments for pipe_base Task.\_\_init\_\_
74 
75  @throw RuntimeError if andConfig is None and the configuration cannot be found,
76  either because astrometry_net_data is not setup in eups
77  or because the setup version does not include the file "andConfig.py"
78  """
79  LoadReferenceObjectsTask.__init__(self, config=config, **kwargs)
80  self.andConfig = andConfig
81  self.haveIndexFiles = False # defer reading index files until we know they are needed
82  # because astrometry may not be used, in which case it may not be properly configured
83 
def __init__(self, minimum, dataRange, Q)

Member Function Documentation

◆ applyProperMotions()

def lsst.meas.algorithms.loadReferenceObjects.LoadReferenceObjectsTask.applyProperMotions (   self,
  catalog,
  epoch 
)
inherited
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 catalong in place.

Parameters
----------
catalog : `lsst.afw.table.SimpleCatalog`
    Catalog of positions, containing:

    - 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` (optional)
    Epoch to which to correct proper motion and parallax,
    or None to not apply such corrections.

Definition at line 1362 of file loadReferenceObjects.py.

1362  def applyProperMotions(self, catalog, epoch):
1363  """Apply proper motion correction to a reference catalog.
1364 
1365  Adjust position and position error in the ``catalog``
1366  for proper motion to the specified ``epoch``,
1367  modifying the catalong in place.
1368 
1369  Parameters
1370  ----------
1371  catalog : `lsst.afw.table.SimpleCatalog`
1372  Catalog of positions, containing:
1373 
1374  - Coordinates, retrieved by the table's coordinate key.
1375  - ``coord_raErr`` : Error in Right Ascension (rad).
1376  - ``coord_decErr`` : Error in Declination (rad).
1377  - ``pm_ra`` : Proper motion in Right Ascension (rad/yr,
1378  East positive)
1379  - ``pm_raErr`` : Error in ``pm_ra`` (rad/yr), optional.
1380  - ``pm_dec`` : Proper motion in Declination (rad/yr,
1381  North positive)
1382  - ``pm_decErr`` : Error in ``pm_dec`` (rad/yr), optional.
1383  - ``epoch`` : Mean epoch of object (an astropy.time.Time)
1384  epoch : `astropy.time.Time` (optional)
1385  Epoch to which to correct proper motion and parallax,
1386  or None to not apply such corrections.
1387  """
1388  if ("epoch" not in catalog.schema or "pm_ra" not in catalog.schema or "pm_dec" not in catalog.schema):
1389  if self.config.requireProperMotion:
1390  raise RuntimeError("Proper motion correction required but not available from catalog")
1391  self.log.warn("Proper motion correction not available from catalog")
1392  return
1393  applyProperMotionsImpl(self.log, catalog, epoch)
1394 
1395 

◆ getMetadataBox()

def lsst.meas.algorithms.loadReferenceObjects.LoadReferenceObjectsTask.getMetadataBox (   self,
  bbox,
  wcs,
  filterName = None,
  photoCalib = None,
  epoch = None 
)
inherited
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`
    Pixel bounding box.
wcs : `lsst.afw.geom.SkyWcs`
    WCS; used to convert pixel positions to sky coordinates.
filterName : `str`
    Name of camera filter, or `None` or `""` for the default
    filter.
photoCalib : `lsst.afw.image.PhotoCalib` (optional)
    Calibration, or `None` if unknown.
epoch : `astropy.time.Time` (optional)
    Epoch to which to correct proper motion and parallax,
    or None to not apply such corrections.

Returns
-------
metadata : lsst.daf.base.PropertyList
    Metadata about the load.

Definition at line 1270 of file loadReferenceObjects.py.

1270  def getMetadataBox(self, bbox, wcs, filterName=None, photoCalib=None, epoch=None):
1271  """Return metadata about the load.
1272 
1273  This metadata is used for reloading the catalog (e.g., for
1274  reconstituting a normalised match list.
1275 
1276  Parameters
1277  ----------
1278  bbox : `lsst.geom.Box2I` or `lsst.geom.Box2D`
1279  Pixel bounding box.
1280  wcs : `lsst.afw.geom.SkyWcs`
1281  WCS; used to convert pixel positions to sky coordinates.
1282  filterName : `str`
1283  Name of camera filter, or `None` or `""` for the default
1284  filter.
1285  photoCalib : `lsst.afw.image.PhotoCalib` (optional)
1286  Calibration, or `None` if unknown.
1287  epoch : `astropy.time.Time` (optional)
1288  Epoch to which to correct proper motion and parallax,
1289  or None to not apply such corrections.
1290 
1291  Returns
1292  -------
1293  metadata : lsst.daf.base.PropertyList
1294  Metadata about the load.
1295  """
1296  circle = self._calculateCircle(bbox, wcs)
1297  return self.getMetadataCircle(circle.coord, circle.radius, filterName, photoCalib)
1298 

◆ getMetadataCircle()

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

This metadata is used for reloading the catalog (e.g., for
reconstituting a normalised 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 camera filter, or `None` or `""` for the default
    filter.
photoCalib : `lsst.afw.image.PhotoCalib` (optional)
    Calibration, or `None` if unknown.
epoch : `astropy.time.Time` (optional)
    Epoch to which to correct proper motion and parallax,
    or None to not apply such corrections.

Returns
-------
metadata : lsst.daf.base.PropertyList
    Metadata about the load

Definition at line 1299 of file loadReferenceObjects.py.

1299  def getMetadataCircle(self, coord, radius, filterName, photoCalib=None, epoch=None):
1300  """Return metadata about the load.
1301 
1302  This metadata is used for reloading the catalog (e.g., for
1303  reconstituting a normalised match list.
1304 
1305  Parameters
1306  ----------
1307  coord : `lsst.geom.SpherePoint`
1308  ICRS center of the search region.
1309  radius : `lsst.geom.Angle`
1310  Radius of the search region.
1311  filterName : `str`
1312  Name of camera filter, or `None` or `""` for the default
1313  filter.
1314  photoCalib : `lsst.afw.image.PhotoCalib` (optional)
1315  Calibration, or `None` if unknown.
1316  epoch : `astropy.time.Time` (optional)
1317  Epoch to which to correct proper motion and parallax,
1318  or None to not apply such corrections.
1319 
1320  Returns
1321  -------
1322  metadata : lsst.daf.base.PropertyList
1323  Metadata about the load
1324  """
1325  md = PropertyList()
1326  md.add('RA', coord.getRa().asDegrees(), 'field center in degrees')
1327  md.add('DEC', coord.getDec().asDegrees(), 'field center in degrees')
1328  md.add('RADIUS', radius.asDegrees(), 'field radius in degrees, minimum')
1329  md.add('SMATCHV', 1, 'SourceMatchVector version number')
1330  filterName = "UNKNOWN" if filterName is None else str(filterName)
1331  md.add('FILTER', filterName, 'filter name for photometric data')
1332  md.add('EPOCH', "NONE" if epoch is None else epoch, 'Epoch (TAI MJD) for catalog')
1333  return md
1334 

◆ joinMatchListWithCatalog()

def lsst.meas.algorithms.loadReferenceObjects.LoadReferenceObjectsTask.joinMatchListWithCatalog (   self,
  matchCat,
  sourceCat 
)
inherited
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`
    Unperisted 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 1335 of file loadReferenceObjects.py.

1335  def joinMatchListWithCatalog(self, matchCat, sourceCat):
1336  """Relink an unpersisted match list to sources and reference
1337  objects.
1338 
1339  A match list is persisted and unpersisted as a catalog of IDs
1340  produced by afw.table.packMatches(), with match metadata
1341  (as returned by the astrometry tasks) in the catalog's metadata
1342  attribute. This method converts such a match catalog into a match
1343  list, with links to source records and reference object records.
1344 
1345  Parameters
1346  ----------
1347  matchCat : `lsst.afw.table.BaseCatalog`
1348  Unperisted packed match list.
1349  ``matchCat.table.getMetadata()`` must contain match metadata,
1350  as returned by the astrometry tasks.
1351  sourceCat : `lsst.afw.table.SourceCatalog`
1352  Source catalog. As a side effect, the catalog will be sorted
1353  by ID.
1354 
1355  Returns
1356  -------
1357  matchList : `lsst.afw.table.ReferenceMatchVector`
1358  Match list.
1359  """
1360  return joinMatchListWithCatalogImpl(self, matchCat, sourceCat)
1361 
def joinMatchListWithCatalogImpl(refObjLoader, matchCat, sourceCat)

◆ loadPixelBox()

def lsst.meas.algorithms.loadReferenceObjects.LoadReferenceObjectsTask.loadPixelBox (   self,
  bbox,
  wcs,
  filterName = None,
  photoCalib = None,
  epoch = None 
)
inherited
Load reference objects that overlap a rectangular pixel region.

Parameters
----------
bbox : `lsst.geom.Box2I` or `lsst.geom.Box2D`
    Bounding box for pixels.
wcs : `lsst.afw.geom.SkyWcs`
    WCS; used to convert pixel positions to sky coordinates
    and vice-versa.
filterName : `str`
    Name of filter, or `None` or `""` for the default filter.
    This is used for flux values in case we have flux limits
    (which are not yet implemented).
photoCalib : `lsst.afw.image.PhotoCalib` (optional)
    Calibration, or `None` if unknown.
epoch : `astropy.time.Time` (optional)
    Epoch to which to correct proper motion and parallax,
    or None to not apply such corrections.

Returns
-------
results : `lsst.pipe.base.Struct`
    A Struct containing the following fields:
    refCat : `lsst.afw.catalog.SimpleCatalog`
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.
    fluxField : `str`
Name of flux field for specified `filterName`.

Notes
-----
The search algorithm works by searching in a region in sky
coordinates whose center is the center of the bbox and radius
is large enough to just include all 4 corners of the bbox.
Stars that lie outside the bbox are then trimmed from the list.

Definition at line 901 of file loadReferenceObjects.py.

901  def loadPixelBox(self, bbox, wcs, filterName=None, photoCalib=None, epoch=None):
902  """Load reference objects that overlap a rectangular pixel region.
903 
904  Parameters
905  ----------
906  bbox : `lsst.geom.Box2I` or `lsst.geom.Box2D`
907  Bounding box for pixels.
908  wcs : `lsst.afw.geom.SkyWcs`
909  WCS; used to convert pixel positions to sky coordinates
910  and vice-versa.
911  filterName : `str`
912  Name of filter, or `None` or `""` for the default filter.
913  This is used for flux values in case we have flux limits
914  (which are not yet implemented).
915  photoCalib : `lsst.afw.image.PhotoCalib` (optional)
916  Calibration, or `None` if unknown.
917  epoch : `astropy.time.Time` (optional)
918  Epoch to which to correct proper motion and parallax,
919  or None to not apply such corrections.
920 
921  Returns
922  -------
923  results : `lsst.pipe.base.Struct`
924  A Struct containing the following fields:
925  refCat : `lsst.afw.catalog.SimpleCatalog`
926  A catalog of reference objects with the standard
927  schema, as documented in the main doc string for
928  `LoadReferenceObjects`.
929  The catalog is guaranteed to be contiguous.
930  fluxField : `str`
931  Name of flux field for specified `filterName`.
932 
933  Notes
934  -----
935  The search algorithm works by searching in a region in sky
936  coordinates whose center is the center of the bbox and radius
937  is large enough to just include all 4 corners of the bbox.
938  Stars that lie outside the bbox are then trimmed from the list.
939  """
940  circle = self._calculateCircle(bbox, wcs)
941 
942  # find objects in circle
943  self.log.info("Loading reference objects using center %s and radius %s deg" %
944  (circle.coord, circle.radius.asDegrees()))
945  loadRes = self.loadSkyCircle(circle.coord, circle.radius, filterName)
946  refCat = loadRes.refCat
947  numFound = len(refCat)
948 
949  # trim objects outside bbox
950  refCat = self._trimToBBox(refCat=refCat, bbox=circle.bbox, wcs=wcs)
951  numTrimmed = numFound - len(refCat)
952  self.log.debug("trimmed %d out-of-bbox objects, leaving %d", numTrimmed, len(refCat))
953  self.log.info("Loaded %d reference objects", len(refCat))
954 
955  # make sure catalog is contiguous
956  if not refCat.isContiguous():
957  loadRes.refCat = refCat.copy(deep=True)
958 
959  return loadRes
960 

◆ loadSkyCircle()

def lsst.meas.extensions.astrometryNet.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask.loadSkyCircle (   self,
  ctrCoord,
  radius,
  filterName = None,
  epoch = None 
)

Load reference objects that overlap a circular sky region.

Parameters
[in]ctrCoordcenter of search region (an afwGeom.Coord)
[in]radiusradius of search region (an afwGeom.Angle)
[in]filterNamename of filter, or None for the default filter; used for flux values in case we have flux limits (which are not yet implemented)
[in]epochEpoch for proper motion and parallax correction (an astropy.time.Time), or None

No proper motion correction is made, since our astrometry.net catalogs typically don't support that, and even if they do they format is uncertain. Users interested in proper motion corrections should use the lsst.meas.algorithms.LoadIndexedReferenceObjectsTask or they will need to subclass and define how the proper motion correction is to be done.

Returns
an lsst.pipe.base.Struct containing:
  • refCat a catalog of reference objects with the standard schema as documented in LoadReferenceObjects, including photometric, resolved and variable; hasCentroid is False for all objects.
  • fluxField = name of flux field for specified filterName

Definition at line 85 of file loadAstrometryNetObjects.py.

85  def loadSkyCircle(self, ctrCoord, radius, filterName=None, epoch=None):
86  """!Load reference objects that overlap a circular sky region
87 
88  @param[in] ctrCoord center of search region (an afwGeom.Coord)
89  @param[in] radius radius of search region (an afwGeom.Angle)
90  @param[in] filterName name of filter, or None for the default filter;
91  used for flux values in case we have flux limits (which are not yet implemented)
92  @param[in] epoch Epoch for proper motion and parallax correction
93  (an astropy.time.Time), or None
94 
95  No proper motion correction is made, since our astrometry.net catalogs
96  typically don't support that, and even if they do they format is uncertain.
97  Users interested in proper motion corrections should use the
98  lsst.meas.algorithms.LoadIndexedReferenceObjectsTask or they will need to
99  subclass and define how the proper motion correction is to be done.
100 
101  @return an lsst.pipe.base.Struct containing:
102  - refCat a catalog of reference objects with the
103  \link meas_algorithms_loadReferenceObjects_Schema standard schema \endlink
104  as documented in LoadReferenceObjects, including photometric, resolved and variable;
105  hasCentroid is False for all objects.
106  - fluxField = name of flux field for specified filterName
107  """
108  self._readIndexFiles()
109 
110  names = []
111  mcols = []
112  ecols = []
113  for col, mcol in self.andConfig.magColumnMap.items():
114  names.append(col)
115  mcols.append(mcol)
116  ecols.append(self.andConfig.magErrorColumnMap.get(col, ''))
117  margs = (names, mcols, ecols)
118 
119  solver = self._getSolver()
120 
121  # Find multi-index files within range
122  multiInds = self._getMIndexesWithinRange(ctrCoord, radius)
123 
124  # compute solver.getCatalog arguments that follow the list of star kd-trees:
125  # - center equatorial angle (e.g. RA) in deg
126  # - center polar angle (e.g. Dec) in deg
127  # - radius, in deg
128  # - idColumn
129  # - (margs)
130  # - star-galaxy column
131  # - variability column
132  fixedArgTuple = (
133  ctrCoord,
134  radius,
135  self.andConfig.idColumn,
136  ) + margs + (
137  self.andConfig.starGalaxyColumn,
138  self.andConfig.variableColumn,
139  True, # eliminate duplicate IDs
140  )
141 
142  self.log.debug("search for objects at %s with radius %s deg", ctrCoord, radius.asDegrees())
143  with LoadMultiIndexes(multiInds):
144  # We just want to pass the star kd-trees, so just pass the
145  # first element of each multi-index.
146  inds = tuple(mi[0] for mi in multiInds)
147  refCat = solver.getCatalog(inds, *fixedArgTuple)
148 
149  self._addFluxAliases(schema=refCat.schema)
150 
151  fluxField = getRefFluxField(schema=refCat.schema, filterName=filterName)
152 
153  # NOTE: sourceSelectors require contiguous catalogs, so ensure
154  # contiguity now, so views are preserved from here on.
155  if not refCat.isContiguous():
156  refCat = refCat.copy(deep=True)
157 
158  # Update flux fields to be nJy. a.net catalogs do not have a conversion script.
159  self.log.warn("Loading A.net reference catalog with old style units in schema.")
160  self.log.warn("A.net reference catalogs will not be supported in the future.")
161  self.log.warn("See RFC-562 and RFC-575 for more details.")
162  refCat = convertToNanojansky(refCat, self.log)
163 
164  self.log.debug("found %d objects", len(refCat))
165  return pipeBase.Struct(
166  refCat=refCat,
167  fluxField=fluxField,
168  )
169 
def convertToNanojansky(catalog, log, doConvert=True)

◆ makeMinimalSchema()

def lsst.meas.algorithms.loadReferenceObjects.LoadReferenceObjectsTask.makeMinimalSchema (   filterNameList,
  addCentroid = True,
  addIsPhotometric = False,
  addIsResolved = False,
  addIsVariable = False,
  coordErrDim = 2,
  addProperMotion = False,
  properMotionErrDim = 2,
  addParallax = False,
  addParallaxErr = True 
)
staticinherited
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".
addParallaxErr : `bool`
    If True add field "parallaxErr"; ignored if addParallax false.

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 1084 of file loadReferenceObjects.py.

1084  addParallax=False, addParallaxErr=True):
1085  """Make a standard schema for reference object catalogs.
1086 
1087  Parameters
1088  ----------
1089  filterNameList : `list` of `str`
1090  List of filter names. Used to create <filterName>_flux fields.
1091  addIsPhotometric : `bool`
1092  If True then add field "photometric".
1093  addIsResolved : `bool`
1094  If True then add field "resolved".
1095  addIsVariable : `bool`
1096  If True then add field "variable".
1097  coordErrDim : `int`
1098  Number of coord error fields; must be one of 0, 2, 3:
1099 
1100  - If 2 or 3: add fields "coord_raErr" and "coord_decErr".
1101  - If 3: also add field "coord_radecErr".
1102  addProperMotion : `bool`
1103  If True add fields "epoch", "pm_ra", "pm_dec" and "pm_flag".
1104  properMotionErrDim : `int`
1105  Number of proper motion error fields; must be one of 0, 2, 3;
1106  ignored if addProperMotion false:
1107  - If 2 or 3: add fields "pm_raErr" and "pm_decErr".
1108  - If 3: also add field "pm_radecErr".
1109  addParallax : `bool`
1110  If True add fields "epoch", "parallax", "parallaxErr"
1111  and "parallax_flag".
1112  addParallaxErr : `bool`
1113  If True add field "parallaxErr"; ignored if addParallax false.
1114 
1115  Returns
1116  -------
1117  schema : `lsst.afw.table.Schema`
1118  Schema for reference catalog, an
1119  `lsst.afw.table.SimpleCatalog`.
1120 
1121  Notes
1122  -----
1123  Reference catalogs support additional covariances, such as
1124  covariance between RA and proper motion in declination,
1125  that are not supported by this method, but can be added after
1126  calling this method.
1127  """
1128  schema = afwTable.SimpleTable.makeMinimalSchema()
1129  if addCentroid:
1130  afwTable.Point2DKey.addFields(
1131  schema,
1132  "centroid",
1133  "centroid on an exposure, if relevant",
1134  "pixel",
1135  )
1136  schema.addField(
1137  field="hasCentroid",
1138  type="Flag",
1139  doc="is position known?",
1140  )
1141  for filterName in filterNameList:
1142  schema.addField(
1143  field="%s_flux" % (filterName,),
1144  type=numpy.float64,
1145  doc="flux in filter %s" % (filterName,),
1146  units="nJy",
1147  )
1148  for filterName in filterNameList:
1149  schema.addField(
1150  field="%s_fluxErr" % (filterName,),
1151  type=numpy.float64,
1152  doc="flux uncertainty in filter %s" % (filterName,),
1153  units="nJy",
1154  )
1155  if addIsPhotometric:
1156  schema.addField(
1157  field="photometric",
1158  type="Flag",
1159  doc="set if the object can be used for photometric calibration",
1160  )
1161  if addIsResolved:
1162  schema.addField(
1163  field="resolved",
1164  type="Flag",
1165  doc="set if the object is spatially resolved",
1166  )
1167  if addIsVariable:
1168  schema.addField(
1169  field="variable",
1170  type="Flag",
1171  doc="set if the object has variable brightness",
1172  )
1173  if coordErrDim not in (0, 2, 3):
1174  raise ValueError("coordErrDim={}; must be (0, 2, 3)".format(coordErrDim))
1175  if coordErrDim > 0:
1176  afwTable.CovarianceMatrix2fKey.addFields(
1177  schema=schema,
1178  prefix="coord",
1179  names=["ra", "dec"],
1180  units=["rad", "rad"],
1181  diagonalOnly=(coordErrDim == 2),
1182  )
1183 
1184  if addProperMotion or addParallax:
1185  schema.addField(
1186  field="epoch",
1187  type=numpy.float64,
1188  doc="date of observation (TAI, MJD)",
1189  units="day",
1190  )
1191 
1192  if addProperMotion:
1193  schema.addField(
1194  field="pm_ra",
1195  type="Angle",
1196  doc="proper motion in the right ascension direction = dra/dt * cos(dec)",
1197  units="rad/year",
1198  )
1199  schema.addField(
1200  field="pm_dec",
1201  type="Angle",
1202  doc="proper motion in the declination direction",
1203  units="rad/year",
1204  )
1205  if properMotionErrDim not in (0, 2, 3):
1206  raise ValueError("properMotionErrDim={}; must be (0, 2, 3)".format(properMotionErrDim))
1207  if properMotionErrDim > 0:
1208  afwTable.CovarianceMatrix2fKey.addFields(
1209  schema=schema,
1210  prefix="pm",
1211  names=["ra", "dec"],
1212  units=["rad/year", "rad/year"],
1213  diagonalOnly=(properMotionErrDim == 2),
1214  )
1215  schema.addField(
1216  field="pm_flag",
1217  type="Flag",
1218  doc="Set if proper motion or proper motion error is bad",
1219  )
1220 
1221  if addParallax:
1222  schema.addField(
1223  field="parallax",
1224  type=numpy.float64,
1225  doc="parallax",
1226  units="rad",
1227  )
1228  if addParallaxErr:
1229  schema.addField(
1230  field="parallaxErr",
1231  type=numpy.float64,
1232  doc="uncertainty in parallax",
1233  units="rad",
1234  )
1235  schema.addField(
1236  field="parallax_flag",
1237  type="Flag",
1238  doc="Set if parallax or parallax error is bad",
1239  )
1240  return schema
1241 
def format(config, name=None, writeSourceLine=True, prefix="", verbose=False)
Definition: history.py:168

Member Data Documentation

◆ andConfig

lsst.meas.extensions.astrometryNet.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask.andConfig

Definition at line 80 of file loadAstrometryNetObjects.py.

◆ butler

lsst.meas.algorithms.loadReferenceObjects.LoadReferenceObjectsTask.butler
inherited

Definition at line 898 of file loadReferenceObjects.py.

◆ ConfigClass

lsst.meas.extensions.astrometryNet.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask.ConfigClass = LoadAstrometryNetObjectsConfig
static

Definition at line 65 of file loadAstrometryNetObjects.py.

◆ haveIndexFiles

lsst.meas.extensions.astrometryNet.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask.haveIndexFiles

Definition at line 81 of file loadAstrometryNetObjects.py.

◆ multiInds

lsst.meas.extensions.astrometryNet.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask.multiInds

Definition at line 183 of file loadAstrometryNetObjects.py.


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