LSSTApplications  18.1.0
LSSTDataManagementBasePackage
Classes | Functions
lsst.meas.extensions.astrometryNet.multiindex Namespace Reference

Classes

class  AstrometryNetCatalog
 
class  MultiIndexCache
 

Functions

def getIndexPath (fn)
 Get the path to the specified astrometry.net index file. More...
 
def getConfigFromEnvironment ()
 
def generateCache (andConfig=None)
 

Function Documentation

◆ generateCache()

def lsst.meas.extensions.astrometryNet.multiindex.generateCache (   andConfig = None)
Generate a cache file

Definition at line 268 of file multiindex.py.

268 def generateCache(andConfig=None):
269  """Generate a cache file"""
270  if andConfig is None:
271  andConfig = getConfigFromEnvironment()
272  catalog = AstrometryNetCatalog(andConfig)
273  try:
274  for index in catalog:
275  index.reload()
276  catalog.writeCache()
277  finally:
278  for index in catalog:
279  index.unload()

◆ getConfigFromEnvironment()

def lsst.meas.extensions.astrometryNet.multiindex.getConfigFromEnvironment ( )
Find the config file from the environment

The andConfig.py file is in the astrometry_net_data directory.

Definition at line 40 of file multiindex.py.

41  """Find the config file from the environment
42 
43  The andConfig.py file is in the astrometry_net_data directory.
44  """
45  try:
46  anDir = lsst.utils.getPackageDir('astrometry_net_data')
47  except Exception:
48  anDir = os.getcwd()
49  andConfigPath = "andConfig.py"
50  if not os.path.exists(andConfigPath):
51  raise RuntimeError("Unable to find andConfig.py in the current directory. "
52  "Did you forget to setup astrometry_net_data?")
53  else:
54  andConfigPath = os.path.join(anDir, "andConfig.py")
55  if not os.path.exists(andConfigPath):
56  raise RuntimeError("Unable to find andConfig.py in astrometry_net_data directory %s" % (anDir,))
57 
58  andConfig = AstrometryNetDataConfig()
59  andConfig.load(andConfigPath)
60  return andConfig
61 
62 
std::string getPackageDir(std::string const &packageName)
return the root directory of a setup package
Definition: packaging.cc:33

◆ getIndexPath()

def lsst.meas.extensions.astrometryNet.multiindex.getIndexPath (   fn)

Get the path to the specified astrometry.net index file.

No effort is made to confirm that the file exists, so it may be used to locate the path to a non-existent file (e.g., to write).

Parameters
[in]fnpath to index file; if relative, then relative to astrometry_net_data if that product is setup, else relative to the current working directory
Returns
the absolute path to the index file

Definition at line 19 of file multiindex.py.

19 def getIndexPath(fn):
20  """!Get the path to the specified astrometry.net index file
21 
22  No effort is made to confirm that the file exists, so it may be used to
23  locate the path to a non-existent file (e.g., to write).
24 
25  @param[in] fn path to index file; if relative, then relative to
26  astrometry_net_data if that product is setup, else relative to the
27  current working directory
28  @return the absolute path to the index file
29  """
30  if os.path.isabs(fn):
31  return fn
32  try:
33  andir = lsst.utils.getPackageDir('astrometry_net_data')
34  except Exception:
35  # Relative to cwd
36  return os.path.abspath(fn)
37  return os.path.join(andir, fn)
38 
39 
std::string getPackageDir(std::string const &packageName)
return the root directory of a setup package
Definition: packaging.cc:33
def getIndexPath(fn)
Get the path to the specified astrometry.net index file.
Definition: multiindex.py:19