COMPASS
5.0.0
End-to-end AO simulation tool using GPU acceleration
old2new_attrs.py
1
import
h5py
2
from
glob
import
glob
3
4
old2new_dict = {
5
# Loop params
6
"niter"
:
"_Param_loop__niter"
,
7
"ittime"
:
"_Param_loop__ittime"
,
8
# Geom params
9
"zenithangle"
:
"_Param_geom__zenithangle"
,
10
"pupdiam"
:
"_Param_geom__pupdiam"
,
11
# Telescope params
12
"tel_diam"
:
"_Param_tel__diam"
,
13
"cobs"
:
"_Param_tel__cobs"
,
14
"t_spiders"
:
"_Param_tel__t_spiders"
,
15
"spiders_type"
:
"_Param_tel__spiders_type"
,
16
"type_ap"
:
"_Param_tel__type_ap"
,
17
"referr"
:
"_Param_tel__referr"
,
18
"pupangle"
:
"_Param_tel__pupangle"
,
19
"nbrmissing"
:
"_Param_tel__nbrmissing"
,
20
"std_piston"
:
"_Param_tel__std_piston"
,
21
"std_tt"
:
"_Param_tel__std_tt"
,
22
# Atmos params
23
"r0"
:
"_Param_atmos__r0"
,
24
"nscreens"
:
"_Param_atmos__nscreens"
,
25
"frac"
:
"_Param_atmos__frac"
,
26
"atm.alt"
:
"_Param_atmos__alt"
,
27
"windspeed"
:
"_Param_atmos__windspeed"
,
28
"winddir"
:
"_Param_atmos__winddir"
,
29
"L0"
:
"_Param_atmos__L0"
,
30
"seeds"
:
"_Param_atmos__seeds"
,
31
# Target params
32
"ntargets"
:
"_Param_target__ntargets"
,
33
"target.xpos"
:
"_Param_target__xpos"
,
34
"target.ypos"
:
"_Param_target__ypos"
,
35
"target.Lambda"
:
"_Param_target__Lambda"
,
36
"target.mag"
:
"_Param_target__mag"
,
37
"target.dms_seen"
:
"_Param_target__dms_seen"
,
38
#WFS params
39
"type"
:
"_Param_wfs__type"
,
40
"nxsub"
:
"_Param_wfs__nxsub"
,
41
"npix"
:
"_Param_wfs__npix"
,
42
"pixsize"
:
"_Param_wfs__pixsize"
,
43
"fracsub"
:
"_Param_wfs__fracsub"
,
44
"wfs.xpos"
:
"_Param_wfs__xpos"
,
45
"wfs.ypos"
:
"_Param_wfs__ypos"
,
46
"wfs.Lambda"
:
"_Param_wfs__Lambda"
,
47
"gsmag"
:
"_Param_wfs__gsmag"
,
48
"optthroughput"
:
"_Param_wfs__optthroughput"
,
49
"zerop"
:
"_Param_wfs__zerop"
,
50
"noise"
:
"_Param_wfs__noise"
,
51
"atmos_seen"
:
"_Param_wfs__atmos_seen"
,
52
"dms_seen"
:
"_Param_wfs__dms_seen"
,
53
"beamsize"
:
"_Param_wfs__beamsize"
,
54
"fssize"
:
"_Param_wfs__fssize"
,
55
"fstop"
:
"_Param_wfs__fstop"
,
56
"gsalt"
:
"_Param_wfs__gsalt"
,
57
"laserpower"
:
"_Param_wfs__laserpower"
,
58
"lgsreturnperwatt"
:
"_Param_wfs__lgsreturnperwatt"
,
59
"lltx"
:
"_Param_wfs__lltx"
,
60
"llty"
:
"_Param_wfs__llty"
,
61
"open_loop"
:
"_Param_wfs__open_loop"
,
62
"proftype"
:
"_Param_wfs__proftype"
,
63
"pyr_ampl"
:
"_Param_wfs__pyr_ampl"
,
64
"pyr_loc"
:
"_Param_wfs__pyr_loc"
,
65
"pyr_npts"
:
"_Param_wfs__pyr_npts"
,
66
"pyr_pup_sep"
:
"_Param_wfs__pyr_pup_sep"
,
67
"pyrtype"
:
"_Param_wfs__pyrtype"
,
68
#DM params
69
"type"
:
"_Param_dm__type_dm"
,
70
"dm.alt"
:
"_Param_dm__alt"
,
71
"coupling"
:
"_Param_dm__coupling"
,
72
"nkl"
:
"_Param_dm__nkl"
,
73
"kl_type"
:
"_Param_dm__type_kl"
,
74
"pupoffset"
:
"_Param_dm__pupoffset"
,
75
"nact"
:
"_Param_dm__nact"
,
76
"push4imat"
:
"_Param_dm__push4imat"
,
77
"dm.thresh"
:
"_Param_dm__thresh"
,
78
"unitpervolt"
:
"_Param_dm__unitpervolt"
,
79
#Centroider params
80
"type"
:
"_Param_centroider__type"
,
81
"nmax"
:
"_Param_centroider__nmax"
,
82
"centro.nwfs"
:
"_Param_centroider__nwfs"
,
83
"sizex"
:
"_Param_centroider__sizex"
,
84
"sizey"
:
"_Param_centroider__sizey"
,
85
"centroider.thresh"
:
"_Param_centroider__thresh"
,
86
"type_fct"
:
"_Param_centroider__type_fct"
,
87
"weights"
:
"_Param_centroider__weights"
,
88
"width"
:
"_Param_centroider__width"
,
89
# Control params
90
"type"
:
"_Param_controller__type"
,
91
"TTcond"
:
"_Param_controller__TTcond"
,
92
"cured_ndivs"
:
"_Param_controller__cured_ndivs"
,
93
"delay"
:
"_Param_controller__delay"
,
94
"gain"
:
"_Param_controller__gain"
,
95
"maxcond"
:
"_Param_controller__maxcond"
,
96
"modopti"
:
"_Param_controller__modopti"
,
97
"ndm"
:
"_Param_controller__ndm"
,
98
"nmodes"
:
"_Param_controller__nmodes"
,
99
"nrec"
:
"_Param_controller__nrec"
,
100
"gmin"
:
"_Param_controller__gmin"
,
101
"gmax"
:
"_Param_controller__gmax"
,
102
"ngain"
:
"_Param_controller__ngain"
,
103
"control.nwfs"
:
"_Param_controller__nwfs"
,
104
"ndms"
:
"ndms"
,
105
"nwfs"
:
"nwfs"
,
106
"ncontrollers"
:
"ncontrollers"
,
107
"simulname"
:
"simulname"
,
108
"revision"
:
"revision"
,
109
"ncentroiders"
:
"ncentroiders"
,
110
"hyst"
:
"hyst"
,
111
"margin"
:
"margin"
,
112
"validity"
:
"validity"
113
}
114
115
files = glob(
"/home/fferreira/Data/correlation/*.h5"
)
116
117
for
ff
in
files:
118
f = h5py.File(ff,
'r+'
)
119
if
not
"_Param_atmos__r0"
in
f.attrs.keys():
120
for
k
in
f.attrs.keys():
121
try
:
122
f.attrs[old2new_dict[k]] = f.attrs[k]
123
del f.attrs[k]
124
except
:
125
print(ff)
126
print(k)
127
f.close()
shesha
guardians
scripts
old2new_attrs.py
Generated by
1.8.18