LSSTApplications  11.0-22-g33de520,12.1+25,13.0+25,13.0+30,13.0-1-g174df6e+3,13.0-1-g41367f3+3,13.0-1-g47a359c+3,13.0-1-g52a7baa+3,13.0-1-g976b40b+3,13.0-10-gcc6134a+6,13.0-10-gf7c21d5+2,13.0-13-gdd29b46+5,13.0-14-gc9904b0,13.0-2-g15de9a1+3,13.0-2-ga4f5e85+6,13.0-2-gf5c5ced+6,13.0-2-gf9e84ea+5,13.0-22-g8f1d162,13.0-3-g7fa07e0+4,13.0-34-ga37f01a,13.0-4-g0bde1de,13.0-5-g0db1a30+1,13.0-5-g6708b9e+9,13.0-6-g7b63e3f+6,13.0-8-gba0f85f,13.0-9-gc47bba1,master-gb637561bb9
LSSTDataManagementBasePackage
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | List of all members
lsst.meas.astrom.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask Class Reference

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

Inheritance diagram for lsst.meas.astrom.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask:

Public Member Functions

def __init__
 Create a LoadAstrometryNetObjectsTask. More...
 
def loadSkyCircle
 Load reference objects that overlap a circular sky region. More...
 

Public Attributes

 andConfig
 
 haveIndexFiles
 
 multiInds
 

Static Public Attributes

 ConfigClass = LoadAstrometryNetObjectsConfig
 

Private Member Functions

def _readIndexFiles
 Read all astrometry.net index files, if not already read. More...
 
def _getMIndexesWithinRange
 Get list of muti-index objects within range. More...
 
def _getSolver
 

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 meas_photocal_photocal_Example.

Debug variables

LoadAstrometryNetObjectsTask does not support any debug variables.

Definition at line 22 of file loadAstrometryNetObjects.py.

Constructor & Destructor Documentation

def lsst.meas.astrom.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 65 of file loadAstrometryNetObjects.py.

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

Member Function Documentation

def lsst.meas.astrom.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask._getMIndexesWithinRange (   self,
  ctrCoord,
  radius 
)
private

Get list of muti-index objects within range.

Parameters
[in]ctrCoordcenter of search region (an afwGeom.Coord)
[in]radiusradius of search region (an afwGeom.Angle)
Returns
list of multiindex objects

Definition at line 164 of file loadAstrometryNetObjects.py.

165  def _getMIndexesWithinRange(self, ctrCoord, radius):
166  """!Get list of muti-index objects within range
167 
168  @param[in] ctrCoord center of search region (an afwGeom.Coord)
169  @param[in] radius radius of search region (an afwGeom.Angle)
170 
171  @return list of multiindex objects
172  """
173  return [mi for mi in self.multiInds if mi.isWithinRange(ctrCoord, radius)]
def lsst.meas.astrom.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask._getSolver (   self)
private

Definition at line 174 of file loadAstrometryNetObjects.py.

175  def _getSolver(self):
176  solver = astrometry_net.Solver()
177  # HACK, set huge default pixel scale range.
178  lo, hi = 0.01, 3600.
179  solver.setPixelScaleRange(lo, hi)
180  return solver
181 
def lsst.meas.astrom.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask._readIndexFiles (   self)
private

Read all astrometry.net index files, if not already read.

Definition at line 150 of file loadAstrometryNetObjects.py.

151  def _readIndexFiles(self):
152  """!Read all astrometry.net index files, if not already read
153  """
154  if self.haveIndexFiles:
155  return
156 
157  self.log.debug("read index files")
158  self.haveIndexFiles = True # just try once
159 
160  if self.andConfig is None:
163  self.multiInds = AstrometryNetCatalog(self.andConfig)
def _readIndexFiles
Read all astrometry.net index files, if not already read.
def lsst.meas.astrom.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask.loadSkyCircle (   self,
  ctrCoord,
  radius,
  filterName = 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)
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 83 of file loadAstrometryNetObjects.py.

83 
84  def loadSkyCircle(self, ctrCoord, radius, filterName=None):
85  """!Load reference objects that overlap a circular sky region
86 
87  @param[in] ctrCoord center of search region (an afwGeom.Coord)
88  @param[in] radius radius of search region (an afwGeom.Angle)
89  @param[in] filterName name of filter, or None for the default filter;
90  used for flux values in case we have flux limits (which are not yet implemented)
91 
92  @return an lsst.pipe.base.Struct containing:
93  - refCat a catalog of reference objects with the
94  \link meas_algorithms_loadReferenceObjects_Schema standard schema \endlink
95  as documented in LoadReferenceObjects, including photometric, resolved and variable;
96  hasCentroid is False for all objects.
97  - fluxField = name of flux field for specified filterName
98  """
99  self._readIndexFiles()
100 
101  names = []
102  mcols = []
103  ecols = []
104  for col, mcol in self.andConfig.magColumnMap.items():
105  names.append(col)
106  mcols.append(mcol)
107  ecols.append(self.andConfig.magErrorColumnMap.get(col, ''))
108  margs = (names, mcols, ecols)
109 
110  solver = self._getSolver()
111 
112  # Find multi-index files within range
113  multiInds = self._getMIndexesWithinRange(ctrCoord, radius)
114 
115  # compute solver.getCatalog arguments that follow the list of star kd-trees:
116  # - center equatorial angle (e.g. RA) in deg
117  # - center polar angle (e.g. Dec) in deg
118  # - radius, in deg
119  # - idColumn
120  # - (margs)
121  # - star-galaxy column
122  # - variability column
123  fixedArgTuple = (
124  ctrCoord,
125  radius,
126  self.andConfig.idColumn,
127  ) + margs + (
128  self.andConfig.starGalaxyColumn,
129  self.andConfig.variableColumn,
130  True, # eliminate duplicate IDs
131  )
132 
133  self.log.debug("search for objects at %s with radius %s deg", ctrCoord, radius.asDegrees())
134  with LoadMultiIndexes(multiInds):
135  # We just want to pass the star kd-trees, so just pass the
136  # first element of each multi-index.
137  inds = tuple(mi[0] for mi in multiInds)
138  refCat = solver.getCatalog(inds, *fixedArgTuple)
139 
140  self._addFluxAliases(schema=refCat.schema)
141 
142  fluxField = getRefFluxField(schema=refCat.schema, filterName=filterName)
143 
144  self.log.debug("found %d objects", len(refCat))
145  return pipeBase.Struct(
146  refCat=refCat,
147  fluxField=fluxField,
148  )
def getRefFluxField
Get name of flux field in schema.
def _readIndexFiles
Read all astrometry.net index files, if not already read.
def loadSkyCircle
Load reference objects that overlap a circular sky region.

Member Data Documentation

lsst.meas.astrom.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask.andConfig

Definition at line 78 of file loadAstrometryNetObjects.py.

lsst.meas.astrom.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask.ConfigClass = LoadAstrometryNetObjectsConfig
static

Definition at line 63 of file loadAstrometryNetObjects.py.

lsst.meas.astrom.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask.haveIndexFiles

Definition at line 79 of file loadAstrometryNetObjects.py.

lsst.meas.astrom.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask.multiInds

Definition at line 162 of file loadAstrometryNetObjects.py.


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