2 We used to have AstrometryNetDataConfig() use the pex_config
3 mechanism, but we need nested lists, so we do this home-brew version
10 Checks the validity of a magnitude column map in AstrometryNetDataConfig.
12 if not isinstance(magmap, dict):
13 raise RuntimeError(
'Mag maps must be dicts')
14 for k,v
in magmap.items():
15 if not isinstance(k, str):
16 raise RuntimeError(
'Mag maps must be dicts mapping str->str: got bad key \"%s\"' % str(k))
17 if not isinstance(v, str):
18 raise RuntimeError(
'Mag maps must be dicts mapping str->str: got bad value \"%s\"' % str(v))
19 if not (len(k) > 0
and len(v) > 0):
20 raise RuntimeError(
'Mag maps items must be non-empty: got bad values \"%s\" -> \"%s\"' % (str(k), str(v)))
24 Checks the validity of an index list in AstrometryNetDataConfig.
26 if not isinstance(indexList, list):
27 raise RuntimeError(
'indexList config item must be a list')
29 if not isinstance(k, str):
30 raise RuntimeError(
'indexList config items must be strings: got bad one \"%s\"' % str(k))
32 raise RuntimeError(
'indexList config items must be non-empty strings')
36 Checks the validity of a multi_index list in AstrometryNetDataConfig.
38 if not isinstance(multiIndexList, list):
39 raise RuntimeError(
'multiIndexList config item must be a list')
40 for k
in multiIndexList:
41 if not isinstance(k, list):
42 raise RuntimeError(
'multiIndexList config items must be lists: got bad one \"%s\"' % str(k))
44 raise RuntimeError(
'multiIndexList config items must be non-empty lists')
46 if not isinstance(kk, str):
47 raise RuntimeError(
'multiIndexList config items must be strings: got bad one \"%s\"' % str(kk))
49 raise RuntimeError(
'multiIndexList config items must be non-empty strings')
53 Astrometry.net data config object. This is a plain-python config
54 structure similar to pexConfig.
56 For examples of use, see tests/astrometry_net_data/photocal/andConfig*.py
60 (
'idColumn', str,
'id',
None,
61 'Column name (in the index files) of the ID number of reference sources'),
62 (
'defaultMagColumn', str,
'mag',
None,
63 'Default column name (in the index files) of the reference source mag'),
64 (
'defaultMagErrorColumn', str,
'',
None,
65 'Default column name (in the index files) of the reference source mag error'),
66 (
'starGalaxyColumn', str,
None,
None,
67 'Column name of the star/galaxy flag'),
68 (
'variableColumn', str,
None,
None,
69 'Column name of the star variability flag'),
70 (
'magErrorColumnMap', dict, {}, _checkMagMap,
71 'Mapping from LSST filter name to mag error column name'),
72 (
'magColumnMap', dict, {}, _checkMagMap,
73 'Mapping from LSST filter name to mag column name'),
74 (
'indexFiles', list, [], _checkIndexList,
75 'List of Astrometry.net index filenames'),
76 (
'multiIndexFiles', list, [], _checkMultiIndexList,
77 'Astrometry.net multi-index filename lists. Each item in this list must itself be a list of filenames. The first filename is the file that contains the star kd-tree and tag-along tables. Subsequent filenames must be files containing just the non-star index parts (quads and code kd-tree). Note that this means you may need to repeat the first filename if it contains a star kd-tree and the first index.'),
78 (
'allowCache', bool,
True,
None,
79 'Allow use of cache for reading index file regions?'),
85 execfile(fn, globals(), loc)
89 for k,v
in kwargs.items():
93 for nm,typ,deef,check,doc
in AstrometryNetDataConfig.fields:
100 for nm,typ,deef,check,doc
in AstrometryNetDataConfig.fields:
106 elif not isinstance(v, typ):
107 raise RuntimeError((
'Attempted to set AstrometryNetDataConfig'
108 ' field \"%s\" to type %s, but need type %s') %
109 (nm, str(typ), str(type(v))))
110 if check
is not None:
113 object.__setattr__(self, nm, v)
116 raise RuntimeError(
'Attempted to set invalid AstrometryNetDataConfig'