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 | 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)
[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 20 of file loadAstrometryNetObjects.py.

Constructor & Destructor Documentation

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

Create a LoadAstrometryNetObjectsTask.

Parameters
[in]configconfiguration (an instance of 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 62 of file loadAstrometryNetObjects.py.

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

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

Definition at line 171 of file loadAstrometryNetObjects.py.

172  def _getSolver(self):
173  solver = astromNet.solver_new()
174  # HACK, set huge default pixel scale range.
175  lo,hi = 0.01, 3600.
176  solver.setPixelScaleRange(lo, hi)
177  return solver
178 
def lsst.meas.astrom.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask._readIndexFiles (   self)
private

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

Definition at line 147 of file loadAstrometryNetObjects.py.

148  def _readIndexFiles(self):
149  """!Read all astrometry.net index files, if not already read
150  """
151  if self.haveIndexFiles:
152  return
153 
154  self.log.logdebug("read index files")
155  self.haveIndexFiles = True # just try once
156 
157  if self.andConfig is None:
160  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 80 of file loadAstrometryNetObjects.py.

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

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

Definition at line 60 of file loadAstrometryNetObjects.py.

lsst.meas.astrom.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask.haveIndexFiles

Definition at line 76 of file loadAstrometryNetObjects.py.

lsst.meas.astrom.loadAstrometryNetObjects.LoadAstrometryNetObjectsTask.multiInds

Definition at line 159 of file loadAstrometryNetObjects.py.


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