-
Notifications
You must be signed in to change notification settings - Fork 0
/
des_info.py
113 lines (90 loc) · 4.09 KB
/
des_info.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
from constants import MAGZP_REF, POSITION_OFFSET
from files import get_piff_path_from_image_path
def add_extra_des_coadd_tile_info(*, info, piff_run):
"""Read the coadd tile info, load WCS info, and load PSF info for
the DES Y3+ DESDM layout.
Parameters
----------
info: dict
Info dict for a coadd tile
piff_run : str
The PIFF PSF run to use.
Returns
-------
info : dict
A dictionary with at least the following keys:
'position_offset' : the offset to add to zero-indexed image
coordinates to get transform them to the convention assumed
by the WCS.
'src_info' : list of dicts for the SE sources
'image_path' : the path to the FITS file with the coadd image
'image_ext' : the name of the FITS extension with the coadd image
'weight_path' : the path to the FITS file with the coadd weight map
'weight_ext' : the name of the FITS extension with the coadd weight
map
'bmask_path' : the path to the FITS file with the coadd bit mask
'bmask_ext' : the name of the FITS extension with the coadd bit
mask
'seg_path' : the path to the FITS file with the coadd seg map
'seg_ext' : the name of the FITS extension with the coadd seg map
'image_flags' : any flags for the coadd image
'scale' : a multiplicative factor to apply to the image
(`*= scale`) and weight map (`/= scale**2`) for magnitude
zero-point calibration.
'magzp' : the magnitude zero point for the image
The dictionaries in the 'src_info' list have at least the
following keys:
'image_path' : the path to the FITS file with the SE image
'image_ext' : the name of the FITS extension with the SE image
'bkg_path' : the path to the FITS file with the SE background image
'bkg_ext' : the name of the FITS extension with the SE background
image
'weight_path' : the path to the FITS file with the SE weight map
'weight_ext' : the name of the FITS extension with the SE weight
map
'bmask_path' : the path to the FITS file with the SE bit mask
'bmask_ext' : the name of the FITS extension with the SE bit mask
'psfex_path' : the path to the PSFEx PSF model
'piff_path' : the path to the Piff PSF model
'scale' : a multiplicative factor to apply to the image
(`*= scale`) and weight map (`/= scale**2`) for magnitude
zero-point calibration
'magzp' : the magnitude zero point for the image
'image_flags' : any flags for the SE image
'position_offset' : the offset to add to zero-indexed image
coordinates to get transform them to the convention assumed
by the WCS.
"""
info['position_offset'] = POSITION_OFFSET
info['image_ext'] = 'sci'
info['weight_path'] = info['image_path']
info['weight_ext'] = 'wgt'
info['bmask_path'] = info['image_path']
info['bmask_ext'] = 'msk'
info['seg_ext'] = 'sci'
# always true for the coadd
info['magzp'] = MAGZP_REF
info['scale'] = 1.0
info['image_shape'] = [10000, 10000]
info['image_flags'] = 0
for index, ii in enumerate(info['src_info']):
ii['image_shape'] = [4096, 2048]
ii['image_flags'] = 0
ii['image_ext'] = 'sci'
ii['weight_path'] = ii['image_path']
ii['weight_ext'] = 'wgt'
ii['bmask_path'] = ii['image_path']
ii['bmask_ext'] = 'msk'
ii['bkg_ext'] = 'sci'
# wcs info
ii['position_offset'] = POSITION_OFFSET
# psfex psf
ii['psfex_path'] = ii['psf_path']
# piff
if piff_run is not None:
ii['piff_path'] = get_piff_path_from_image_path(
image_path=ii['image_path'],
piff_run=piff_run,
)
# image scale
ii['scale'] = 10.0**(0.4*(MAGZP_REF - ii['magzp']))