1 from __future__
import absolute_import, division, print_function
3 __all__ = [
"LoadAstrometryNetObjectsTask",
"LoadAstrometryNetObjectsConfig"]
5 from builtins
import object
10 from .
import astrometry_net
11 from .multiindex
import AstrometryNetCatalog, getConfigFromEnvironment
13 LoadAstrometryNetObjectsConfig = LoadReferenceObjectsTask.ConfigClass
25 """!Load reference objects from astrometry.net index files 27 @anchor LoadAstrometryNetObjectsTask_ 29 @section meas_astrom_loadAstrometryNetObjects_Contents Contents 31 - @ref meas_astrom_loadAstrometryNetObjects_Purpose 32 - @ref meas_astrom_loadAstrometryNetObjects_Initialize 33 - @ref meas_astrom_loadAstrometryNetObjects_IO 34 - @ref meas_algorithms_loadReferenceObjects_Schema 35 - @ref meas_astrom_loadAstrometryNetObjects_Config 36 - @ref meas_astrom_loadAstrometryNetObjects_Example 37 - @ref meas_astrom_loadAstrometryNetObjects_Debug 39 @section meas_astrom_loadAstrometryNetObjects_Purpose Description 41 Load reference objects from astrometry.net index files. 43 @section meas_astrom_loadAstrometryNetObjects_Initialize Task initialisation 47 @section meas_astrom_loadAstrometryNetObjects_IO Invoking the Task 49 @copydoc loadObjectsInBBox 51 @section meas_astrom_loadAstrometryNetObjects_Config Configuration parameters 53 See @ref LoadAstrometryNetObjectsConfig 55 @section meas_astrom_loadAstrometryNetObjects_Example A complete example of using 56 LoadAstrometryNetObjectsTask 58 LoadAstrometryNetObjectsTask is a subtask of AstrometryTask, which is called by PhotoCalTask. 59 See \ref pipe_tasks_photocal_Example. 61 @section meas_astrom_loadAstrometryNetObjects_Debug Debug variables 63 LoadAstrometryNetObjectsTask does not support any debug variables. 65 ConfigClass = LoadAstrometryNetObjectsConfig
67 def __init__(self, config=None, andConfig=None, **kwargs):
68 """!Create a LoadAstrometryNetObjectsTask 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\_\_ 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" 79 LoadReferenceObjectsTask.__init__(self, config=config, **kwargs)
86 """!Load reference objects that overlap a circular sky region 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 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. 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 113 for col, mcol
in self.
andConfig.magColumnMap.items():
116 ecols.append(self.
andConfig.magErrorColumnMap.get(col,
''))
117 margs = (names, mcols, ecols)
142 self.log.
debug(
"search for objects at %s with radius %s deg", ctrCoord, radius.asDegrees())
146 inds = tuple(mi[0]
for mi
in multiInds)
147 refCat = solver.getCatalog(inds, *fixedArgTuple)
151 fluxField =
getRefFluxField(schema=refCat.schema, filterName=filterName)
155 if not refCat.isContiguous():
156 refCat = refCat.copy(deep=
True)
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.")
164 self.log.
debug(
"found %d objects", len(refCat))
165 return pipeBase.Struct(
171 def _readIndexFiles(self):
172 """!Read all astrometry.net index files, if not already read 177 self.log.
debug(
"read index files")
185 def _getMIndexesWithinRange(self, ctrCoord, radius):
186 """!Get list of muti-index objects within range 188 @param[in] ctrCoord center of search region (an afwGeom.Coord) 189 @param[in] radius radius of search region (an afwGeom.Angle) 191 @return list of multiindex objects 193 return [mi
for mi
in self.
multiInds if mi.isWithinRange(ctrCoord, radius)]
195 def _getSolver(self):
196 solver = astrometry_net.Solver()
199 solver.setPixelScaleRange(lo, hi)
204 """Context manager for loading and unloading astrometry.net multi-index files
def _readIndexFiles(self)
Read all astrometry.net index files, if not already read.
Fit spatial kernel using approximate fluxes for candidates, and solving a linear system of equations...
def __init__(self, multiInds)
def convertToNanojansky(catalog, log, doConvert=True)
def _getMIndexesWithinRange(self, ctrCoord, radius)
Get list of muti-index objects within range.
def getRefFluxField(schema, filterName=None)
def _addFluxAliases(self, schema)
def getConfigFromEnvironment()
def __exit__(self, typ, val, trace)
Abstract base class to load objects from reference catalogs.
Load reference objects from astrometry.net index files.
def loadSkyCircle(self, ctrCoord, radius, filterName=None, epoch=None)
Load reference objects that overlap a circular sky region.
def __init__(self, config=None, andConfig=None, kwargs)
Create a LoadAstrometryNetObjectsTask.