1 from __future__
import absolute_import, division, print_function
3 from fnmatch
import fnmatch
5 from lsst.pipe.base.argumentParser
import setDottedAttr
7 __all__ = [
"getAndVersion",
"setAstrometryConfigFromEups",
"setPhotocalConfigFromEups",
"setConfigFromEups", ]
11 """Return a cached eups instance""" 14 except AttributeError:
15 getEups._eups = Eups()
20 """Return the version of astrometry_net_data in use""" 21 return getEups().findSetupVersion(
"astrometry_net_data")[0]
25 """Set the astrometry configuration according to the astrometry_net_data being used 27 The menu is a dict mapping the astrometry_net_data version to a dict of configuration 28 values to apply. The menu key may also be a glob. For example: 29 menu = { "ps1*": {}, # No changes 30 "ps1-without-y": { "solver.filterMap": {"y": "z"} }, # No y-band in this specific version 31 "sdss*": { "solver.filterMap": {"y": "z"} }, # No y-band, use z instead 32 "2mass*": { "solver.filterMap": {"y": "J"} }, # No y-band, use J instead 38 selected = menu[version]
41 matchList = [key
for key
in menu
if fnmatch(version, key)]
42 if len(matchList) > 1:
43 raise RuntimeError(
"Multiple menu keys match astrometry_net_data version %s: %s" %
45 if len(matchList) == 0:
46 raise RuntimeError(
"No menu key matches astrometry_net_data version %s" % version)
47 selected = menu[matchList.pop()]
48 for name, value
in selected.items():
49 setDottedAttr(config, name, value)
53 """Set the photocal configuration according to the astrometry_net_data being used""" 58 """Set the astrometry and photocal configuration according to the astrometry_net_data being used 60 The 'astrometryMenu' is as defined for the 'menu' parameter for 'setAstrometryConfigFromEups'. 65 if astrometryMenu
is None:
66 raise RuntimeError(
"No astrometryMenu provided for astrometryConfig")
def setPhotocalConfigFromEups(config)
def setAstrometryConfigFromEups(config, menu)
def setConfigFromEups(photocalConfig=None, astrometryConfig=None, astrometryMenu=None)