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
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
home
lsstsw
stack
Linux64
pipe_tasks
11.0-2-g818369d
python
lsst
pipe
tasks
setConfigFromEups.py
Go to the documentation of this file.
1
from
eups
import
Eups
2
from
fnmatch
import
fnmatch
3
4
from
lsst.pipe.base.argumentParser
import
setDottedAttr
5
6
__all__ = [
"getAndVersion"
,
"setAstrometryConfigFromEups"
,
"setPhotocalConfigFromEups"
,
"setConfigFromEups"
,]
7
8
def
getEups
():
9
"""Return a cached eups instance"""
10
try
:
11
return
getEups._eups
12
except
AttributeError:
13
getEups._eups = Eups()
14
return
getEups._eups
15
16
17
def
getAndVersion
():
18
"""Return the version of astrometry_net_data in use"""
19
return
getEups
().
findSetupVersion
(
"astrometry_net_data"
)[0]
20
21
22
def
setAstrometryConfigFromEups
(config, menu):
23
"""Set the astrometry configuration according to the astrometry_net_data being used
24
25
The menu is a dict mapping the astrometry_net_data version to a dict of configuration
26
values to apply. The menu key may also be a glob. For example:
27
menu = { "ps1*": {}, # No changes
28
"ps1-without-y": { "solver.filterMap": {"y": "z"} }, # No y-band in this specific version
29
"sdss*": { "solver.filterMap": {"y": "z"} }, # No y-band, use z instead
30
"2mass*": { "solver.filterMap": {"y": "J"} }, # No y-band, use J instead
31
}
32
"""
33
version =
getAndVersion
()
34
35
if
version
in
menu:
36
selected = menu[version]
37
else
:
38
# Treat keys in menu as glob; see if any match
39
matchList = [key
for
key
in
menu
if
fnmatch(version, key)]
40
if
len(matchList) > 1:
41
raise
RuntimeError(
"Multiple menu keys match astrometry_net_data version %s: %s"
%
42
(version, matchList))
43
if
len(matchList) == 0:
44
raise
RuntimeError(
"No menu key matches astrometry_net_data version %s"
% version)
45
selected = menu[matchList.pop()]
46
for
name, value
in
selected.iteritems():
47
setDottedAttr
(config, name, value)
48
49
50
def
setPhotocalConfigFromEups
(config):
51
"""Set the photocal configuration according to the astrometry_net_data being used"""
52
config.photoCatName =
getAndVersion
()
53
54
55
def
setConfigFromEups
(photocalConfig=None, astrometryConfig=None, astrometryMenu=None):
56
"""Set the astrometry and photocal configuration according to the astrometry_net_data being used
57
58
The 'astrometryMenu' is as defined for the 'menu' parameter for 'setAstrometryConfigFromEups'.
59
"""
60
if
photocalConfig:
61
setPhotocalConfigFromEups
(photocalConfig)
62
if
astrometryConfig:
63
if
astrometryMenu
is
None
:
64
raise
RuntimeError(
"No astrometryMenu provided for astrometryConfig"
)
65
setAstrometryConfigFromEups
(astrometryConfig, astrometryMenu)
lsst.pipe.tasks.setConfigFromEups.getAndVersion
def getAndVersion
Definition:
setConfigFromEups.py:17
lsst.sconsUtils.eupsForScons.findSetupVersion
def findSetupVersion
Definition:
eupsForScons.py:30
lsst.pipe.base.argumentParser.setDottedAttr
def setDottedAttr
Like setattr, but accepts hierarchical names, e.g.
Definition:
argumentParser.py:751
lsst.pipe.tasks.setConfigFromEups.getEups
def getEups
Definition:
setConfigFromEups.py:8
lsst.pipe.base.argumentParser
Definition:
argumentParser.py:1
lsst.pipe.tasks.setConfigFromEups.setAstrometryConfigFromEups
def setAstrometryConfigFromEups
Definition:
setConfigFromEups.py:22
lsst.pipe.tasks.setConfigFromEups.setConfigFromEups
def setConfigFromEups
Definition:
setConfigFromEups.py:55
lsst.pipe.tasks.setConfigFromEups.setPhotocalConfigFromEups
def setPhotocalConfigFromEups
Definition:
setConfigFromEups.py:50
Generated on Thu Sep 24 2015 02:29:24 for LSSTApplications by
1.8.5