LSSTApplications  17.0+103,17.0+11,17.0+61,18.0.0+13,18.0.0+25,18.0.0+5,18.0.0+52,18.0.0-4-g68ffd23,18.1.0-1-g0001055+8,18.1.0-1-g03d53ef+1,18.1.0-1-g1349e88+28,18.1.0-1-g2505f39+22,18.1.0-1-g380d4d4+27,18.1.0-1-g5315e5e+1,18.1.0-1-g5e4b7ea+10,18.1.0-1-g7e8fceb+1,18.1.0-1-g85f8cd4+23,18.1.0-1-g9a6769a+13,18.1.0-1-ga1a4c1a+22,18.1.0-1-gd55f500+17,18.1.0-12-g42eabe8e+10,18.1.0-14-gd04256d+15,18.1.0-16-g430f6a53+1,18.1.0-17-gd2166b6e4,18.1.0-18-gb5d19ff+1,18.1.0-2-gfbf3545+7,18.1.0-2-gfefb8b5+16,18.1.0-3-g52aa583+13,18.1.0-3-g62b5e86+14,18.1.0-3-g8f4a2b1+17,18.1.0-3-g9bc06b8+7,18.1.0-3-gb69f684+9,18.1.0-4-g1ee41a7+1,18.1.0-5-g6dbcb01+13,18.1.0-5-gc286bb7+3,18.1.0-6-g48bdcd3+2,18.1.0-6-gd05e160+9,18.1.0-7-gc4d902b+2,18.1.0-7-gebc0338+8,18.1.0-9-gae7190a+10,w.2019.38
LSSTDataManagementBasePackage
Public Member Functions | Public Attributes | List of all members
lsst.meas.extensions.astrometryNet.multiindex.AstrometryNetCatalog Class Reference

Public Member Functions

def __init__ (self, andConfig)
 Constructor. More...
 
def writeCache (self)
 
def __getitem__ (self, ii)
 
def __iter__ (self)
 
def __len__ (self)
 

Public Attributes

 config
 

Detailed Description

An interface to an astrometry.net catalog

Behaves like a list of MultiIndexCache (or multiindex_t).

These should usually be constructed using the 'fromEnvironment'
class method, which wraps the 'fromIndexFiles' and 'fromCache'
alternative class methods.

Definition at line 165 of file multiindex.py.

Constructor & Destructor Documentation

◆ __init__()

def lsst.meas.extensions.astrometryNet.multiindex.AstrometryNetCatalog.__init__ (   self,
  andConfig 
)

Constructor.

Parameters
andConfigConfiguration (an AstrometryNetDataConfig)

Definition at line 176 of file multiindex.py.

176  def __init__(self, andConfig):
177  """!Constructor
178 
179  @param andConfig Configuration (an AstrometryNetDataConfig)
180  """
181  self.config = andConfig
182  cacheName = getIndexPath(self._cacheFilename)
183  if self.config.allowCache and os.path.exists(cacheName):
184  self._initFromCache(cacheName)
185  else:
186  self._initFromIndexFiles(self.config)
187 
def getIndexPath(fn)
Get the path to the specified astrometry.net index file.
Definition: multiindex.py:14
def __init__(self, minimum, dataRange, Q)

Member Function Documentation

◆ __getitem__()

def lsst.meas.extensions.astrometryNet.multiindex.AstrometryNetCatalog.__getitem__ (   self,
  ii 
)

Definition at line 253 of file multiindex.py.

253  def __getitem__(self, ii):
254  return self._multiInds[ii]
255 

◆ __iter__()

def lsst.meas.extensions.astrometryNet.multiindex.AstrometryNetCatalog.__iter__ (   self)

Definition at line 256 of file multiindex.py.

256  def __iter__(self):
257  return iter(self._multiInds)
258 

◆ __len__()

def lsst.meas.extensions.astrometryNet.multiindex.AstrometryNetCatalog.__len__ (   self)

Definition at line 259 of file multiindex.py.

259  def __len__(self):
260  return len(self._multiInds)
261 
262 

◆ writeCache()

def lsst.meas.extensions.astrometryNet.multiindex.AstrometryNetCatalog.writeCache (   self)
Write a cache file

The cache file is a FITS file with all the required information to
build the AstrometryNetCatalog quickly.  The first table extension
contains a row for each multiindex, storing the healpix and nside
values.  The second table extension contains a row for each filename
in all the multiindexes.  The two may be JOINed through the 'id'
column.

Definition at line 193 of file multiindex.py.

193  def writeCache(self):
194  """Write a cache file
195 
196  The cache file is a FITS file with all the required information to
197  build the AstrometryNetCatalog quickly. The first table extension
198  contains a row for each multiindex, storing the healpix and nside
199  values. The second table extension contains a row for each filename
200  in all the multiindexes. The two may be JOINed through the 'id'
201  column.
202  """
203  outName = getIndexPath(self._cacheFilename)
204  numFilenames = sum(len(ind._filenameList) for ind in self._multiInds)
205  maxLength = max(len(fn) for ind in self._multiInds for fn in ind._filenameList) + 1
206 
207  # First table
208  first = fits.BinTableHDU.from_columns([fits.Column(name="id", format="K"),
209  fits.Column(name="healpix", format="K"),
210  fits.Column(name="nside", format="K"),
211  ], nrows=len(self._multiInds))
212  first.data.field("id")[:] = np.arange(len(self._multiInds), dtype=int)
213  first.data.field("healpix")[:] = np.array([ind._healpix for ind in self._multiInds])
214  first.data.field("nside")[:] = np.array([ind._nside for ind in self._multiInds])
215 
216  # Second table
217  second = fits.BinTableHDU.from_columns([fits.Column(name="id", format="K"),
218  fits.Column(name="filename", format="%dA" % (maxLength)),
219  ], nrows=numFilenames)
220  ident = second.data.field("id")
221  filenames = second.data.field("filename")
222  i = 0
223  for j, ind in enumerate(self._multiInds):
224  for fn in ind._filenameList:
225  ident[i] = j
226  filenames[i] = fn
227  i += 1
228 
229  fits.HDUList([fits.PrimaryHDU(), first, second]).writeto(outName, overwrite=True)
230 
def getIndexPath(fn)
Get the path to the specified astrometry.net index file.
Definition: multiindex.py:14
int max

Member Data Documentation

◆ config

lsst.meas.extensions.astrometryNet.multiindex.AstrometryNetCatalog.config

Definition at line 181 of file multiindex.py.


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