##// END OF EJS Templates
Time-window option added to GUI
Miguel Valdez -
r816:66f9c3c86dfe
parent child
Show More

The requested changes are too big and content was truncated. Show full diff

1 NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
@@ -1,528 +1,528
1 1 from PyQt4 import QtCore, QtGui
2 2
3 3 try:
4 4 _fromUtf8 = QtCore.QString.fromUtf8
5 5 except AttributeError:
6 6 def _fromUtf8(s):
7 7 return s
8 8
9 9 try:
10 10 _encoding = QtGui.QApplication.UnicodeUTF8
11 11 def _translate(context, text, disambig):
12 12 return QtGui.QApplication.translate(context, text, disambig, _encoding)
13 13 except AttributeError:
14 14 def _translate(context, text, disambig):
15 15 return QtGui.QApplication.translate(context, text, disambig)
16 16
17 17 class Ui_SpectraTab(object):
18 18
19 19 def setupUi(self):
20 20
21 21 self.tabSpectra = QtGui.QWidget()
22 22 self.tabSpectra.setObjectName(_fromUtf8("tabSpectra"))
23 23 self.gridLayout_7 = QtGui.QGridLayout(self.tabSpectra)
24 24 self.gridLayout_7.setObjectName(_fromUtf8("gridLayout_7"))
25 25 self.frame_5 = QtGui.QFrame(self.tabSpectra)
26 26 self.frame_5.setFrameShape(QtGui.QFrame.StyledPanel)
27 27 self.frame_5.setFrameShadow(QtGui.QFrame.Raised)
28 28 self.frame_5.setObjectName(_fromUtf8("frame_5"))
29 29 self.gridLayout_18 = QtGui.QGridLayout(self.frame_5)
30 30 self.gridLayout_18.setObjectName(_fromUtf8("gridLayout_18"))
31 31
32 32 self.specOpOk = QtGui.QPushButton(self.frame_5)
33 33 self.specOpOk.setObjectName(_fromUtf8("specOpOk"))
34 34 self.gridLayout_18.addWidget(self.specOpOk, 0, 0, 1, 1)
35 35
36 36 self.specGraphClear = QtGui.QPushButton(self.frame_5)
37 37 self.specGraphClear.setObjectName(_fromUtf8("specGraphClear"))
38 38 self.gridLayout_18.addWidget(self.specGraphClear, 0, 1, 1, 1)
39 39
40 40 self.gridLayout_7.addWidget(self.frame_5, 1, 1, 1, 1)
41 41
42 42 self.tabWidgetSpectra = QtGui.QTabWidget(self.tabSpectra)
43 43 self.tabWidgetSpectra.setObjectName(_fromUtf8("tabWidgetSpectra"))
44 44
45 45 self.tabopSpectra = QtGui.QWidget()
46 46 self.tabopSpectra.setObjectName(_fromUtf8("tabopSpectra"))
47 47
48 48 self.gridLayout_5 = QtGui.QGridLayout(self.tabopSpectra)
49 49 self.gridLayout_5.setObjectName(_fromUtf8("gridLayout_5"))
50 50
51 51
52 52
53 53 self.specOpCebRadarfrequency = QtGui.QCheckBox(self.tabopSpectra)
54 54 self.specOpCebRadarfrequency.setObjectName(_fromUtf8("specOpCebRadarfrequency"))
55 55 self.gridLayout_5.addWidget(self.specOpCebRadarfrequency, 0, 0, 1, 1)
56 56
57 57 self.specOpRadarfrequency = QtGui.QLineEdit(self.tabopSpectra)
58 58 self.specOpRadarfrequency.setObjectName(_fromUtf8("specOpRadarfrequency"))
59 59 self.gridLayout_5.addWidget(self.specOpRadarfrequency, 0, 1, 1, 4)
60 60
61 61
62 62 self.specLabProfiles = QtGui.QLabel(self.tabopSpectra)
63 63 self.specLabProfiles.setObjectName(_fromUtf8("specLabProfiles"))
64 64 self.gridLayout_5.addWidget(self.specLabProfiles, 1, 0, 1, 1)
65 65
66 66 self.specOpProfiles = QtGui.QLineEdit(self.tabopSpectra)
67 67 self.specOpProfiles.setObjectName(_fromUtf8("specOpProfiles"))
68 68 self.gridLayout_5.addWidget(self.specOpProfiles, 1, 1, 1, 4)
69 69
70 70
71 71 self.specLabnFFTPoints = QtGui.QLabel(self.tabopSpectra)
72 72 self.specLabnFFTPoints.setObjectName(_fromUtf8("specLabnFFTPoints"))
73 73 self.gridLayout_5.addWidget(self.specLabnFFTPoints, 2, 0, 1, 1)
74 74
75 75 self.specOpnFFTpoints = QtGui.QLineEdit(self.tabopSpectra)
76 76 self.specOpnFFTpoints.setObjectName(_fromUtf8("specOpnFFTpoints"))
77 77 self.gridLayout_5.addWidget(self.specOpnFFTpoints, 2, 1, 1, 4)
78 78
79 79
80 80 self.specLabippFactor = QtGui.QLabel(self.tabopSpectra)
81 81 self.specLabippFactor.setObjectName(_fromUtf8("specLabippFactor"))
82 82 self.gridLayout_5.addWidget(self.specLabippFactor, 3, 0, 1, 1)
83 83
84 84 self.specOpippFactor = QtGui.QLineEdit(self.tabopSpectra)
85 85 self.specOpippFactor.setObjectName(_fromUtf8("specOpippFactor"))
86 86 self.gridLayout_5.addWidget(self.specOpippFactor, 3, 1, 1, 4)
87 87
88 88
89 89 self.specOpCebChannel = QtGui.QCheckBox(self.tabopSpectra)
90 90 self.specOpCebChannel.setObjectName(_fromUtf8("specOpCebChannel"))
91 91 self.gridLayout_5.addWidget(self.specOpCebChannel, 4, 0, 1, 1)
92 92
93 93 self.specOpComChannel = QtGui.QComboBox(self.tabopSpectra)
94 94 self.specOpComChannel.setObjectName(_fromUtf8("specOpComChannel"))
95 95 self.specOpComChannel.addItem(_fromUtf8(""))
96 96 self.specOpComChannel.addItem(_fromUtf8(""))
97 97 self.gridLayout_5.addWidget(self.specOpComChannel, 4, 1, 1, 2)
98 98
99 99 self.specOpChannel = QtGui.QLineEdit(self.tabopSpectra)
100 100 self.specOpChannel.setObjectName(_fromUtf8("specOpChannel"))
101 101 self.gridLayout_5.addWidget(self.specOpChannel, 4, 3, 1, 2)
102 102
103 103
104 104 self.specOpCebCrossSpectra = QtGui.QCheckBox(self.tabopSpectra)
105 105 self.specOpCebCrossSpectra.setObjectName(_fromUtf8("specOpCebCrossSpectra"))
106 106 self.gridLayout_5.addWidget(self.specOpCebCrossSpectra, 5, 0, 1, 1)
107 107
108 108 self.specOpComCrossSpectra = QtGui.QComboBox(self.tabopSpectra)
109 109 self.specOpComCrossSpectra.setObjectName(_fromUtf8("specOpComCrossSpectra"))
110 110 self.specOpComCrossSpectra.addItem(_fromUtf8(""))
111 111 self.gridLayout_5.addWidget(self.specOpComCrossSpectra, 5, 1, 1, 2)
112 112
113 113 self.specOppairsList = QtGui.QLineEdit(self.tabopSpectra)
114 114 self.specOppairsList.setObjectName(_fromUtf8("specOppairsList"))
115 115 self.gridLayout_5.addWidget(self.specOppairsList, 5, 3, 1, 2)
116 116
117 117
118 118 self.specOpCebHeights = QtGui.QCheckBox(self.tabopSpectra)
119 119 self.specOpCebHeights.setObjectName(_fromUtf8("specOpCebHeights"))
120 120 self.gridLayout_5.addWidget(self.specOpCebHeights, 6, 0, 1, 1)
121 121
122 122 self.specOpComHeights = QtGui.QComboBox(self.tabopSpectra)
123 123 self.specOpComHeights.setObjectName(_fromUtf8("specOpComHeights"))
124 124 self.specOpComHeights.addItem(_fromUtf8(""))
125 125 self.specOpComHeights.addItem(_fromUtf8(""))
126 126 self.gridLayout_5.addWidget(self.specOpComHeights, 6, 1, 1, 2)
127 127
128 128 self.specOpHeights = QtGui.QLineEdit(self.tabopSpectra)
129 129 self.specOpHeights.setObjectName(_fromUtf8("specOpHeights"))
130 130 self.gridLayout_5.addWidget(self.specOpHeights, 6, 3, 1, 2)
131 131
132 132
133 133 self.specOpCebIncoherent = QtGui.QCheckBox(self.tabopSpectra)
134 134 self.specOpCebIncoherent.setObjectName(_fromUtf8("specOpCebIncoherent"))
135 135 self.gridLayout_5.addWidget(self.specOpCebIncoherent, 7, 0, 1, 1)
136 136
137 137 self.specOpCobIncInt = QtGui.QComboBox(self.tabopSpectra)
138 138 self.specOpCobIncInt.setObjectName(_fromUtf8("specOpCobIncInt"))
139 139 self.specOpCobIncInt.addItem(_fromUtf8(""))
140 140 self.specOpCobIncInt.addItem(_fromUtf8(""))
141 141 self.gridLayout_5.addWidget(self.specOpCobIncInt, 7, 1, 1, 2)
142 142
143 143 self.specOpIncoherent = QtGui.QLineEdit(self.tabopSpectra)
144 144 self.specOpIncoherent.setObjectName(_fromUtf8("specOpIncoherent"))
145 145 self.gridLayout_5.addWidget(self.specOpIncoherent, 7, 3, 1, 2)
146 146
147 147
148 148 self.specOpCebRemoveDC = QtGui.QCheckBox(self.tabopSpectra)
149 149 self.specOpCebRemoveDC.setObjectName(_fromUtf8("specOpCebRemoveDC"))
150 150 self.gridLayout_5.addWidget(self.specOpCebRemoveDC, 8, 0, 1, 1)
151 151
152 152 self.specOpComRemoveDC = QtGui.QComboBox(self.tabopSpectra)
153 153 self.specOpComRemoveDC.setObjectName(_fromUtf8("specOpComRemoveDC"))
154 154 self.specOpComRemoveDC.addItem(_fromUtf8(""))
155 155 self.specOpComRemoveDC.addItem(_fromUtf8(""))
156 156 self.gridLayout_5.addWidget(self.specOpComRemoveDC, 8, 1, 1, 2)
157 157
158 158
159 159 self.specOpCebRemoveInt = QtGui.QCheckBox(self.tabopSpectra)
160 160 self.specOpCebRemoveInt.setObjectName(_fromUtf8("specOpCebRemoveInt"))
161 161 self.gridLayout_5.addWidget(self.specOpCebRemoveInt, 9, 0, 1, 1)
162 162
163 163
164 164 self.specOpCebgetNoise = QtGui.QCheckBox(self.tabopSpectra)
165 165 self.specOpCebgetNoise.setObjectName(_fromUtf8("specOpCebgetNoise"))
166 166 self.gridLayout_5.addWidget(self.specOpCebgetNoise, 10, 0, 1, 1)
167 167
168 168 self.specOpgetNoise = QtGui.QLineEdit(self.tabopSpectra)
169 169 self.specOpgetNoise.setObjectName(_fromUtf8("specOpgetNoise"))
170 170 self.gridLayout_5.addWidget(self.specOpgetNoise, 10, 1, 1, 4)
171 171
172 172 # spacerItem9 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
173 173 # self.gridLayout_5.addItem(spacerItem9, 12, 3, 1, 1)
174 174 #
175 175 # spacerItem10 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
176 176 # self.gridLayout_5.addItem(spacerItem10, 9, 3, 1, 1)
177 177 #
178 178 # spacerItem11 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
179 179 # self.gridLayout_5.addItem(spacerItem11, 7, 3, 1, 1)
180 180 #
181 181 # spacerItem12 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
182 182 # self.gridLayout_5.addItem(spacerItem12, 4, 3, 1, 1)
183 183 #
184 184 # spacerItem13 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
185 185 # self.gridLayout_5.addItem(spacerItem13, 15, 3, 1, 1)
186 186
187 187
188 188 self.tabWidgetSpectra.addTab(self.tabopSpectra, _fromUtf8(""))
189 189
190 190 ################################################################
191 191 ################################################################
192 192
193 193 self.tabgraphSpectra = QtGui.QWidget()
194 194 self.tabgraphSpectra.setObjectName(_fromUtf8("tabgraphSpectra"))
195 195 self.gridLayout_9 = QtGui.QGridLayout(self.tabgraphSpectra)
196 196 self.gridLayout_9.setObjectName(_fromUtf8("gridLayout_9"))
197 197
198 198 # spacerItem14 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
199 199 # self.gridLayout_9.addItem(spacerItem14, 14, 2, 1, 1)
200 200 xi = 0
201 201
202 202 self.label_24 = QtGui.QLabel(self.tabgraphSpectra)
203 203 self.label_24.setObjectName(_fromUtf8("label_24"))
204 204 self.gridLayout_9.addWidget(self.label_24, xi, 0, 1, 1)
205 205
206 206 self.specGraphPath = QtGui.QLineEdit(self.tabgraphSpectra)
207 207 self.specGraphPath.setObjectName(_fromUtf8("specGraphPath"))
208 208 self.gridLayout_9.addWidget(self.specGraphPath, xi, 1, 1, 6)
209 209
210 210 self.specGraphToolPath = QtGui.QToolButton(self.tabgraphSpectra)
211 211 self.specGraphToolPath.setObjectName(_fromUtf8("specGraphToolPath"))
212 212 self.gridLayout_9.addWidget(self.specGraphToolPath, xi, 7, 1, 1)
213 213
214 214 self.label_25 = QtGui.QLabel(self.tabgraphSpectra)
215 215 self.label_25.setObjectName(_fromUtf8("label_25"))
216 216 self.gridLayout_9.addWidget(self.label_25, xi+1, 0, 1, 1)
217 217 self.specGraphPrefix = QtGui.QLineEdit(self.tabgraphSpectra)
218 218 self.specGraphPrefix.setObjectName(_fromUtf8("specGraphPrefix"))
219 219 self.gridLayout_9.addWidget(self.specGraphPrefix, xi+1, 1, 1, 7)
220 220
221 221 xi = 2
222 222
223 223 self.label_40 = QtGui.QLabel(self.tabgraphSpectra)
224 224 self.label_40.setObjectName(_fromUtf8("label_40"))
225 225 self.gridLayout_9.addWidget(self.label_40, xi+1, 0, 1, 1)
226 226 self.label_41 = QtGui.QLabel(self.tabgraphSpectra)
227 227 self.label_41.setObjectName(_fromUtf8("label_41"))
228 228 self.gridLayout_9.addWidget(self.label_41, xi+2, 0, 1, 1)
229 229 self.label_42 = QtGui.QLabel(self.tabgraphSpectra)
230 230 self.label_42.setObjectName(_fromUtf8("label_42"))
231 231 self.gridLayout_9.addWidget(self.label_42, xi+3, 0, 1, 1)
232 232 self.label_44 = QtGui.QLabel(self.tabgraphSpectra)
233 233 self.label_44.setObjectName(_fromUtf8("label_44"))
234 234 self.gridLayout_9.addWidget(self.label_44, xi+4, 0, 1, 1)
235 235 self.label_46 = QtGui.QLabel(self.tabgraphSpectra)
236 236 self.label_46.setObjectName(_fromUtf8("label_46"))
237 237 self.gridLayout_9.addWidget(self.label_46, xi+5, 0, 1, 1)
238 238 self.label_45 = QtGui.QLabel(self.tabgraphSpectra)
239 239 self.label_45.setObjectName(_fromUtf8("label_45"))
240 240 self.gridLayout_9.addWidget(self.label_45, xi+6, 0, 1, 1)
241 241
242 242 self.label_43 = QtGui.QLabel(self.tabgraphSpectra)
243 243 self.label_43.setObjectName(_fromUtf8("label_43"))
244 244 self.gridLayout_9.addWidget(self.label_43, xi, 3, 1, 1)
245 245 self.specGraphCebSpectraplot = QtGui.QCheckBox(self.tabgraphSpectra)
246 246 self.specGraphCebSpectraplot.setText(_fromUtf8(""))
247 247 self.specGraphCebSpectraplot.setObjectName(_fromUtf8("specGraphCebSpectraplot"))
248 248 self.gridLayout_9.addWidget(self.specGraphCebSpectraplot, xi+1, 3, 1, 1)
249 249 self.specGraphCebCrossSpectraplot = QtGui.QCheckBox(self.tabgraphSpectra)
250 250 self.specGraphCebCrossSpectraplot.setText(_fromUtf8(""))
251 251 self.specGraphCebCrossSpectraplot.setObjectName(_fromUtf8("specGraphCebCrossSpectraplot"))
252 252 self.gridLayout_9.addWidget(self.specGraphCebCrossSpectraplot, xi+2, 3, 1, 1)
253 253 self.specGraphCebRTIplot = QtGui.QCheckBox(self.tabgraphSpectra)
254 254 self.specGraphCebRTIplot.setText(_fromUtf8(""))
255 255 self.specGraphCebRTIplot.setObjectName(_fromUtf8("specGraphCebRTIplot"))
256 256 self.gridLayout_9.addWidget(self.specGraphCebRTIplot, xi+3, 3, 1, 1)
257 257 self.specGraphCebCoherencmap = QtGui.QCheckBox(self.tabgraphSpectra)
258 258 self.specGraphCebCoherencmap.setText(_fromUtf8(""))
259 259 self.specGraphCebCoherencmap.setObjectName(_fromUtf8("specGraphCebCoherencmap"))
260 260 self.gridLayout_9.addWidget(self.specGraphCebCoherencmap, xi+4, 3, 1, 1)
261 261 self.specGraphPowerprofile = QtGui.QCheckBox(self.tabgraphSpectra)
262 262 self.specGraphPowerprofile.setText(_fromUtf8(""))
263 263 self.specGraphPowerprofile.setObjectName(_fromUtf8("specGraphPowerprofile"))
264 264 self.gridLayout_9.addWidget(self.specGraphPowerprofile, xi+5, 3, 1, 1)
265 265 self.specGraphCebRTInoise = QtGui.QCheckBox(self.tabgraphSpectra)
266 266 self.specGraphCebRTInoise.setText(_fromUtf8(""))
267 267 self.specGraphCebRTInoise.setObjectName(_fromUtf8("specGraphCebRTInoise"))
268 268 self.gridLayout_9.addWidget(self.specGraphCebRTInoise, xi+6, 3, 1, 1)
269 269
270 270 # spacerItem18 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
271 271 # self.gridLayout_9.addItem(spacerItem18, 4, 3, 1, 1)
272 272
273 273 self.label_47 = QtGui.QLabel(self.tabgraphSpectra)
274 274 self.label_47.setObjectName(_fromUtf8("label_47"))
275 275 self.gridLayout_9.addWidget(self.label_47, xi, 5, 1, 1)
276 276 self.specGraphSaveSpectra = QtGui.QCheckBox(self.tabgraphSpectra)
277 277 self.specGraphSaveSpectra.setText(_fromUtf8(""))
278 278 self.specGraphSaveSpectra.setObjectName(_fromUtf8("specGraphSaveSpectra"))
279 279 self.gridLayout_9.addWidget(self.specGraphSaveSpectra, xi+1, 5, 1, 1)
280 280 self.specGraphSaveCross = QtGui.QCheckBox(self.tabgraphSpectra)
281 281 self.specGraphSaveCross.setText(_fromUtf8(""))
282 282 self.specGraphSaveCross.setObjectName(_fromUtf8("specGraphSaveCross"))
283 283 self.gridLayout_9.addWidget(self.specGraphSaveCross, xi+2, 5, 1, 1)
284 284 self.specGraphSaveRTIplot = QtGui.QCheckBox(self.tabgraphSpectra)
285 285 self.specGraphSaveRTIplot.setText(_fromUtf8(""))
286 286 self.specGraphSaveRTIplot.setObjectName(_fromUtf8("specGraphSaveRTIplot"))
287 287 self.gridLayout_9.addWidget(self.specGraphSaveRTIplot, xi+3, 5, 1, 1)
288 288 self.specGraphSaveCoherencemap = QtGui.QCheckBox(self.tabgraphSpectra)
289 289 self.specGraphSaveCoherencemap.setText(_fromUtf8(""))
290 290 self.specGraphSaveCoherencemap.setObjectName(_fromUtf8("specGraphSaveCoherencemap"))
291 291 self.gridLayout_9.addWidget(self.specGraphSaveCoherencemap, xi+4, 5, 1, 1)
292 292 self.specGraphSavePowerprofile = QtGui.QCheckBox(self.tabgraphSpectra)
293 293 self.specGraphSavePowerprofile.setText(_fromUtf8(""))
294 294 self.specGraphSavePowerprofile.setObjectName(_fromUtf8("specGraphSavePowerprofile"))
295 295 self.gridLayout_9.addWidget(self.specGraphSavePowerprofile, xi+5, 5, 1, 1)
296 296 self.specGraphSaveRTInoise = QtGui.QCheckBox(self.tabgraphSpectra)
297 297 self.specGraphSaveRTInoise.setText(_fromUtf8(""))
298 298 self.specGraphSaveRTInoise.setObjectName(_fromUtf8("specGraphSaveRTInoise"))
299 299 self.gridLayout_9.addWidget(self.specGraphSaveRTInoise, xi+6, 5, 1, 1)
300 300
301 301 self.label_19 = QtGui.QLabel(self.tabgraphSpectra)
302 302 self.label_19.setObjectName(_fromUtf8("label_19"))
303 303 self.gridLayout_9.addWidget(self.label_19, xi, 7, 1, 1)
304 304 self.specGraphftpSpectra = QtGui.QCheckBox(self.tabgraphSpectra)
305 305 self.specGraphftpSpectra.setText(_fromUtf8(""))
306 306 self.specGraphftpSpectra.setObjectName(_fromUtf8("specGraphftpSpectra"))
307 307 self.gridLayout_9.addWidget(self.specGraphftpSpectra, xi+1, 7, 1, 1)
308 308 self.specGraphftpCross = QtGui.QCheckBox(self.tabgraphSpectra)
309 309 self.specGraphftpCross.setText(_fromUtf8(""))
310 310 self.specGraphftpCross.setObjectName(_fromUtf8("specGraphftpCross"))
311 311 self.gridLayout_9.addWidget(self.specGraphftpCross, xi+2, 7, 1, 1)
312 312 self.specGraphftpRTIplot = QtGui.QCheckBox(self.tabgraphSpectra)
313 313 self.specGraphftpRTIplot.setText(_fromUtf8(""))
314 314 self.specGraphftpRTIplot.setObjectName(_fromUtf8("specGraphftpRTIplot"))
315 315 self.gridLayout_9.addWidget(self.specGraphftpRTIplot, xi+3, 7, 1, 1)
316 316 self.specGraphftpCoherencemap = QtGui.QCheckBox(self.tabgraphSpectra)
317 317 self.specGraphftpCoherencemap.setText(_fromUtf8(""))
318 318 self.specGraphftpCoherencemap.setObjectName(_fromUtf8("specGraphftpCoherencemap"))
319 319 self.gridLayout_9.addWidget(self.specGraphftpCoherencemap, xi+4, 7, 1, 1)
320 320 self.specGraphftpPowerprofile = QtGui.QCheckBox(self.tabgraphSpectra)
321 321 self.specGraphftpPowerprofile.setText(_fromUtf8(""))
322 322 self.specGraphftpPowerprofile.setObjectName(_fromUtf8("specGraphftpPowerprofile"))
323 323 self.gridLayout_9.addWidget(self.specGraphftpPowerprofile, xi+5, 7, 1, 1)
324 324 self.specGraphftpRTInoise = QtGui.QCheckBox(self.tabgraphSpectra)
325 325 self.specGraphftpRTInoise.setText(_fromUtf8(""))
326 326 self.specGraphftpRTInoise.setObjectName(_fromUtf8("specGraphftpRTInoise"))
327 327 self.gridLayout_9.addWidget(self.specGraphftpRTInoise, xi+6, 7, 1, 1)
328 328
329 329 # spacerItem19 = QtGui.QSpacerItem(39, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
330 330 # self.gridLayout_9.addItem(spacerItem19, 27, 4, 1, 1)
331 331
332 332 xi = 11
333 333
334 334 self.label_22 = QtGui.QLabel(self.tabgraphSpectra)
335 335 self.label_22.setObjectName(_fromUtf8("label_22"))
336 336 self.gridLayout_9.addWidget(self.label_22, xi, 0, 1, 1)
337 337 self.specGgraphFreq = QtGui.QLineEdit(self.tabgraphSpectra)
338 338 self.specGgraphFreq.setObjectName(_fromUtf8("specGgraphFreq"))
339 339 self.gridLayout_9.addWidget(self.specGgraphFreq, xi, 2, 1, 2)
340 340
341 341 self.label_16 = QtGui.QLabel(self.tabgraphSpectra)
342 342 self.label_16.setObjectName(_fromUtf8("label_16"))
343 343 self.gridLayout_9.addWidget(self.label_16, xi+1, 0, 1, 1)
344 344 self.specGgraphHeight = QtGui.QLineEdit(self.tabgraphSpectra)
345 345 self.specGgraphHeight.setObjectName(_fromUtf8("specGgraphHeight"))
346 346 self.gridLayout_9.addWidget(self.specGgraphHeight, xi+1, 2, 1, 2)
347 347
348 348 self.label_17 = QtGui.QLabel(self.tabgraphSpectra)
349 349 self.label_17.setObjectName(_fromUtf8("label_17"))
350 350 self.gridLayout_9.addWidget(self.label_17, xi+2, 0, 1, 1)
351 351 self.specGgraphDbsrange = QtGui.QLineEdit(self.tabgraphSpectra)
352 352 self.specGgraphDbsrange.setObjectName(_fromUtf8("specGgraphDbsrange"))
353 353 self.gridLayout_9.addWidget(self.specGgraphDbsrange, xi+2, 2, 1, 2)
354 354
355 355 self.specGraphTminTmaxLabel = QtGui.QLabel(self.tabgraphSpectra)
356 356 self.specGraphTminTmaxLabel.setObjectName(_fromUtf8("specGraphTminTmaxLabel"))
357 357 self.gridLayout_9.addWidget(self.specGraphTminTmaxLabel, xi+3, 0, 1, 2)
358 358 self.specGgraphTminTmax = QtGui.QLineEdit(self.tabgraphSpectra)
359 359 self.specGgraphTminTmax.setObjectName(_fromUtf8("specGgraphTminTmax"))
360 360 self.gridLayout_9.addWidget(self.specGgraphTminTmax, xi+3, 2, 1, 2)
361 361
362 self.label_48 = QtGui.QLabel(self.tabgraphSpectra)
363 self.label_48.setObjectName(_fromUtf8("label_48"))
364 self.gridLayout_9.addWidget(self.label_48, xi+4, 0, 1, 2)
365 self.specGgraphTimeRange = QtGui.QLineEdit(self.tabgraphSpectra)
366 self.specGgraphTimeRange.setObjectName(_fromUtf8("specGgraphTimeRange"))
367 self.gridLayout_9.addWidget(self.specGgraphTimeRange, xi+4, 2, 1, 2)
368
362 369 self.specGraphMagLabel = QtGui.QLabel(self.tabgraphSpectra)
363 370 self.specGraphMagLabel.setObjectName(_fromUtf8("specGraphMagLabel"))
364 371 self.gridLayout_9.addWidget(self.specGraphMagLabel, xi, 4, 1, 2)
365 372 self.specGgraphmagnitud = QtGui.QLineEdit(self.tabgraphSpectra)
366 373 self.specGgraphmagnitud.setObjectName(_fromUtf8("specGgraphmagnitud"))
367 374 self.gridLayout_9.addWidget(self.specGgraphmagnitud, xi, 6, 1, 2)
368 375
369 376 self.specGraphPhaseLabel = QtGui.QLabel(self.tabgraphSpectra)
370 377 self.specGraphPhaseLabel.setObjectName(_fromUtf8("specGraphPhaseLabel"))
371 378 self.gridLayout_9.addWidget(self.specGraphPhaseLabel, xi+1, 4, 1, 2)
372 379 self.specGgraphPhase = QtGui.QLineEdit(self.tabgraphSpectra)
373 380 self.specGgraphPhase.setObjectName(_fromUtf8("specGgraphPhase"))
374 381 self.gridLayout_9.addWidget(self.specGgraphPhase, xi+1, 6, 1, 2)
375 382
376 383 self.label_6 = QtGui.QLabel(self.tabgraphSpectra)
377 384 self.label_6.setObjectName(_fromUtf8("label_6"))
378 385 self.gridLayout_9.addWidget(self.label_6, xi+2, 4, 1, 1)
379 386 self.specGgraphChannelList = QtGui.QLineEdit(self.tabgraphSpectra)
380 387 self.specGgraphChannelList.setObjectName(_fromUtf8("specGgraphChannelList"))
381 388 self.gridLayout_9.addWidget(self.specGgraphChannelList, xi+2, 6, 1, 2)
382 389
383 390 self.label_29 = QtGui.QLabel(self.tabgraphSpectra)
384 391 self.label_29.setObjectName(_fromUtf8("label_29"))
385 392 self.gridLayout_9.addWidget(self.label_29, xi+3, 4, 1, 2)
386 393 self.specGgraphftpratio = QtGui.QLineEdit(self.tabgraphSpectra)
387 394 self.specGgraphftpratio.setObjectName(_fromUtf8("specGgraphftpratio"))
388 395 self.gridLayout_9.addWidget(self.specGgraphftpratio, xi+3, 6, 1, 2)
389 396
390 self.label_48 = QtGui.QLabel(self.tabgraphSpectra)
391 self.label_48.setObjectName(_fromUtf8("label_48"))
392 self.gridLayout_9.addWidget(self.label_48, xi+4, 4, 1, 2)
393 self.specGgraphTimeRange = QtGui.QLineEdit(self.tabgraphSpectra)
394 self.specGgraphTimeRange.setObjectName(_fromUtf8("specGgraphTimeRange"))
395 self.gridLayout_9.addWidget(self.specGgraphTimeRange, xi+4, 6, 1, 2)
396
397 397 # spacerItem15 = QtGui.QSpacerItem(28, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
398 398 # self.gridLayout_9.addItem(spacerItem15, 27, 6, 1, 2)
399 399 # spacerItem16 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
400 400 # self.gridLayout_9.addItem(spacerItem16, 3, 5, 1, 1)
401 401 # spacerItem17 = QtGui.QSpacerItem(49, 15, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
402 402 # self.gridLayout_9.addItem(spacerItem17, 27, 0, 1, 1)
403 403
404 404
405 405
406 406 self.tabWidgetSpectra.addTab(self.tabgraphSpectra, _fromUtf8(""))
407 407 self.taboutputSpectra = QtGui.QWidget()
408 408 self.taboutputSpectra.setObjectName(_fromUtf8("taboutputSpectra"))
409 409 self.gridLayout_11 = QtGui.QGridLayout(self.taboutputSpectra)
410 410 self.gridLayout_11.setObjectName(_fromUtf8("gridLayout_11"))
411 411 self.label_39 = QtGui.QLabel(self.taboutputSpectra)
412 412 self.label_39.setObjectName(_fromUtf8("label_39"))
413 413 self.gridLayout_11.addWidget(self.label_39, 0, 0, 1, 1)
414 414 self.specOutputComData = QtGui.QComboBox(self.taboutputSpectra)
415 415 self.specOutputComData.setObjectName(_fromUtf8("specOutputComData"))
416 416 self.specOutputComData.addItem(_fromUtf8(""))
417 417 self.gridLayout_11.addWidget(self.specOutputComData, 0, 2, 1, 2)
418 418 self.label_34 = QtGui.QLabel(self.taboutputSpectra)
419 419 self.label_34.setObjectName(_fromUtf8("label_34"))
420 420 self.gridLayout_11.addWidget(self.label_34, 1, 0, 1, 1)
421 421 self.specOutputPath = QtGui.QLineEdit(self.taboutputSpectra)
422 422 self.specOutputPath.setObjectName(_fromUtf8("specOutputPath"))
423 423 self.gridLayout_11.addWidget(self.specOutputPath, 1, 2, 1, 1)
424 424 spacerItem20 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
425 425 self.gridLayout_11.addItem(spacerItem20, 4, 2, 1, 1)
426 426 self.specOutputToolPath = QtGui.QToolButton(self.taboutputSpectra)
427 427 self.specOutputToolPath.setObjectName(_fromUtf8("specOutputToolPath"))
428 428 self.gridLayout_11.addWidget(self.specOutputToolPath, 1, 3, 1, 1)
429 429 self.specOutputblocksperfile = QtGui.QLineEdit(self.taboutputSpectra)
430 430 self.specOutputblocksperfile.setObjectName(_fromUtf8("specOutputblocksperfile"))
431 431 self.gridLayout_11.addWidget(self.specOutputblocksperfile, 2, 2, 1, 1)
432 432 self.label_9 = QtGui.QLabel(self.taboutputSpectra)
433 433 self.label_9.setObjectName(_fromUtf8("label_9"))
434 434 self.gridLayout_11.addWidget(self.label_9, 2, 0, 1, 2)
435 435
436 436 self.tabWidgetSpectra.addTab(self.taboutputSpectra, _fromUtf8(""))
437 437 self.gridLayout_7.addWidget(self.tabWidgetSpectra, 0, 1, 1, 1)
438 438
439 439 self.tabWidgetProject.addTab(self.tabSpectra, _fromUtf8(""))
440 440
441 441 self.tabWidgetSpectra.setCurrentIndex(0)
442 442
443 443 def retranslateUi(self):
444 444
445 445 self.specOpOk.setText(_translate("MainWindow", "Ok", None))
446 446 self.specGraphClear.setText(_translate("MainWindow", "Clear", None))
447 447 self.specOpCebCrossSpectra.setText(_translate("MainWindow", "Select Cross Spectra:", None))
448 448 self.specOpComChannel.setItemText(0, _translate("MainWindow", "Value", None))
449 449 self.specOpComChannel.setItemText(1, _translate("MainWindow", "Index", None))
450 450 self.specOpComHeights.setItemText(0, _translate("MainWindow", "Value", None))
451 451 self.specOpComHeights.setItemText(1, _translate("MainWindow", "Index", None))
452 452 self.specOpCebRemoveDC.setText(_translate("MainWindow", "Remove DC:", None))
453 453 self.specOpCebHeights.setText(_translate("MainWindow", "Select Heights:", None))
454 454 self.specOpCebChannel.setText(_translate("MainWindow", "Select Channel:", None))
455 455
456 456 self.specOpComCrossSpectra.setItemText(0, _translate("MainWindow", "x-y pairs", None))
457 457
458 458 self.specLabnFFTPoints.setText(_translate("MainWindow", "Number of FFT points:", None))
459 459 self.specOpCebIncoherent.setText(_translate("MainWindow", "Incoherent Integration:", None))
460 460 self.specOpCobIncInt.setItemText(0, _translate("MainWindow", "Time Interval", None))
461 461 self.specOpCobIncInt.setItemText(1, _translate("MainWindow", "Number of Profiles", None))
462 462 self.specOpCebRadarfrequency.setText(_translate("MainWindow", "Radar frequency (MHz):", None))
463 463 self.specLabProfiles.setText(_translate("MainWindow", "Number of Profiles", None))
464 464 self.specOpCebRemoveInt.setText(_translate("MainWindow", "Remove Interference:", None))
465 465 self.specLabippFactor.setText(_translate("MainWindow", "Ipp Factor:", None))
466 466 self.specOpCebgetNoise.setText(_translate("MainWindow", "Set Noise area:", None))
467 467 self.specOpComRemoveDC.setItemText(0, _translate("MainWindow", "Mode 1", None))
468 468 self.specOpComRemoveDC.setItemText(1, _translate("MainWindow", "Mode 2", None))
469 469 self.tabWidgetSpectra.setTabText(self.tabWidgetSpectra.indexOf(self.tabopSpectra), _translate("MainWindow", "Operation", None))
470 470
471 471 self.label_44.setText(_translate("MainWindow", "Coherence Map:", None))
472 self.specGraphTminTmaxLabel.setText(_translate("MainWindow", "Time range:", None))
472 self.specGraphTminTmaxLabel.setText(_translate("MainWindow", "Time range (hours):", None))
473 473 self.label_25.setText(_translate("MainWindow", "Prefix:", None))
474 474 self.label_42.setText(_translate("MainWindow", "RTI Plot:", None))
475 475 self.label_16.setText(_translate("MainWindow", "Height range:", None))
476 476 self.label_17.setText(_translate("MainWindow", "dB range:", None))
477 477 self.specGraphMagLabel.setText(_translate("MainWindow", "Coh. Magnitud:", None))
478 478 self.label_24.setText(_translate("MainWindow", "Path:", None))
479 479 self.label_46.setText(_translate("MainWindow", "Power Profile:", None))
480 480 self.label_22.setText(_translate("MainWindow", "Freq/Vel range:", None))
481 481 self.label_41.setText(_translate("MainWindow", "Cross Spectra Plot:", None))
482 482 self.specGraphToolPath.setText(_translate("MainWindow", "...", None))
483 483 self.label_6.setText(_translate("MainWindow", "Channel List:", None))
484 484 self.label_40.setText(_translate("MainWindow", "Spectra Plot:", None))
485 485 self.label_43.setText(_translate("MainWindow", "Show:", None))
486 486 self.label_29.setText(_translate("MainWindow", "Writing Period:", None))
487 487 self.label_47.setText(_translate("MainWindow", "Save:", None))
488 488 self.label_19.setText(_translate("MainWindow", "Ftp:", None))
489 489 self.label_45.setText(_translate("MainWindow", "Noise:", None))
490 self.label_48.setText(_translate("MainWindow", "Time Range:", None))
490 self.label_48.setText(_translate("MainWindow", "Time window (seconds):", None))
491 491 self.specGraphPhaseLabel.setText(_translate("MainWindow", "Coh. Phase:", None))
492 self.label_48.hide()
493 self.specGgraphTimeRange.hide()
492 # self.label_48.hide()
493 # self.specGgraphTimeRange.hide()
494 494 self.tabWidgetSpectra.setTabText(self.tabWidgetSpectra.indexOf(self.tabgraphSpectra), _translate("MainWindow", "Graphics", None))
495 495
496 496 self.label_39.setText(_translate("MainWindow", "Type:", None))
497 497 self.specOutputComData.setItemText(0, _translate("MainWindow", ".pdata", None))
498 498 self.label_34.setText(_translate("MainWindow", "Path:", None))
499 499 self.specOutputToolPath.setText(_translate("MainWindow", "...", None))
500 500 self.label_9.setText(_translate("MainWindow", "Blocks per File: ", None))
501 501
502 502 self.tabWidgetSpectra.setTabText(self.tabWidgetSpectra.indexOf(self.taboutputSpectra), _translate("MainWindow", "Output", None))
503 503
504 504 self.tabWidgetProject.setTabText(self.tabWidgetProject.indexOf(self.tabSpectra), _translate("MainWindow", "Spectra", None))
505 505
506 506 self.__setToolTip()
507 507
508 508 def __setToolTip(self):
509 509
510 510 self.specOpnFFTpoints.setToolTip('Number of FFT points used in FFT function. Example: 128')
511 511 self.specOpProfiles.setToolTip('Number of data points used in FFT function. Example: 128')
512 512 self.specOpippFactor.setToolTip('This factor is multiplied to IPP value to get velocity and frequency range. Example: 4')
513 513 self.specOpIncoherent.setToolTip('Example: 10')
514 514 self.specOpgetNoise.setToolTip('Example:20,180,30,120 (minHei,maxHei,minVel,maxVel)')
515 515
516 516 self.specOpChannel.setToolTip('Example: 0,1,2,3')
517 517 self.specOpHeights.setToolTip('Example: 90,180')
518 518 self.specOppairsList.setToolTip('Example: (0,1),(2,3)')
519 519 # tool tip gui specGraph
520 520
521 521 self.specGgraphChannelList.setToolTip('Example: 0,3,4')
522 522 self.specGgraphFreq.setToolTip('Example: -20,20')
523 523 self.specGgraphHeight.setToolTip('Example: 100,400')
524 524 self.specGgraphDbsrange.setToolTip('Example: 30,170')
525 525
526 526 self.specGraphPrefix.setToolTip('Example: EXPERIMENT_NAME')
527 527
528 528 No newline at end of file
@@ -1,1509 +1,1509
1 1 '''
2 2 Created on Jul 9, 2014
3 3
4 4 @author: roj-idl71
5 5 '''
6 6 import os
7 7 import datetime
8 8 import numpy
9 9
10 10 from figure import Figure, isRealtime, isTimeInHourRange
11 11 from plotting_codes import *
12 12
13 13 class SpectraPlot(Figure):
14 14
15 15 isConfig = None
16 16 __nsubplots = None
17 17
18 18 WIDTHPROF = None
19 19 HEIGHTPROF = None
20 20 PREFIX = 'spc'
21 21
22 22 def __init__(self):
23 23
24 24 self.isConfig = False
25 25 self.__nsubplots = 1
26 26
27 27 self.WIDTH = 250
28 28 self.HEIGHT = 250
29 29 self.WIDTHPROF = 120
30 30 self.HEIGHTPROF = 0
31 31 self.counter_imagwr = 0
32 32
33 33 self.PLOT_CODE = SPEC_CODE
34 34
35 35 self.FTP_WEI = None
36 36 self.EXP_CODE = None
37 37 self.SUB_EXP_CODE = None
38 38 self.PLOT_POS = None
39 39
40 40 self.__xfilter_ena = False
41 41 self.__yfilter_ena = False
42 42
43 43 def getSubplots(self):
44 44
45 45 ncol = int(numpy.sqrt(self.nplots)+0.9)
46 46 nrow = int(self.nplots*1./ncol + 0.9)
47 47
48 48 return nrow, ncol
49 49
50 50 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
51 51
52 52 self.__showprofile = showprofile
53 53 self.nplots = nplots
54 54
55 55 ncolspan = 1
56 56 colspan = 1
57 57 if showprofile:
58 58 ncolspan = 3
59 59 colspan = 2
60 60 self.__nsubplots = 2
61 61
62 62 self.createFigure(id = id,
63 63 wintitle = wintitle,
64 64 widthplot = self.WIDTH + self.WIDTHPROF,
65 65 heightplot = self.HEIGHT + self.HEIGHTPROF,
66 66 show=show)
67 67
68 68 nrow, ncol = self.getSubplots()
69 69
70 70 counter = 0
71 71 for y in range(nrow):
72 72 for x in range(ncol):
73 73
74 74 if counter >= self.nplots:
75 75 break
76 76
77 77 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
78 78
79 79 if showprofile:
80 80 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
81 81
82 82 counter += 1
83 83
84 84 def run(self, dataOut, id, wintitle="", channelList=None, showprofile=True,
85 85 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
86 86 save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
87 87 server=None, folder=None, username=None, password=None,
88 88 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False,
89 89 xaxis="velocity"):
90 90
91 91 """
92 92
93 93 Input:
94 94 dataOut :
95 95 id :
96 96 wintitle :
97 97 channelList :
98 98 showProfile :
99 99 xmin : None,
100 100 xmax : None,
101 101 ymin : None,
102 102 ymax : None,
103 103 zmin : None,
104 104 zmax : None
105 105 """
106 106
107 107 if realtime:
108 108 if not(isRealtime(utcdatatime = dataOut.utctime)):
109 109 print 'Skipping this plot function'
110 110 return
111 111
112 112 if channelList == None:
113 113 channelIndexList = dataOut.channelIndexList
114 114 else:
115 115 channelIndexList = []
116 116 for channel in channelList:
117 117 if channel not in dataOut.channelList:
118 118 raise ValueError, "Channel %d is not in dataOut.channelList" %channel
119 119 channelIndexList.append(dataOut.channelList.index(channel))
120 120
121 121 factor = dataOut.normFactor
122 122
123 123 if xaxis == "frequency":
124 124 x = dataOut.getFreqRange(1)/1000.
125 125 xlabel = "Frquency (kHz)"
126 126
127 127 elif xaxis == "time":
128 128 x = dataOut.getAcfRange(1)
129 129 xlabel = "Time (ms)"
130 130
131 131 else:
132 132 x = dataOut.getVelRange(1)
133 133 xlabel = "Velocity (m/s)"
134 134
135 135 ylabel = "Range (Km)"
136 136
137 137 y = dataOut.getHeiRange()
138 138
139 139 z = dataOut.data_spc/factor
140 140 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
141 141 zdB = 10*numpy.log10(z)
142 142
143 143 avg = numpy.average(z, axis=1)
144 144 avgdB = 10*numpy.log10(avg)
145 145
146 146 noise = dataOut.getNoise()/factor
147 147 noisedB = 10*numpy.log10(noise)
148 148
149 149 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0])
150 150 title = wintitle + " Spectra"
151 151 if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)):
152 152 title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith)
153 153
154 154 if not self.isConfig:
155 155
156 156 nplots = len(channelIndexList)
157 157
158 158 self.setup(id=id,
159 159 nplots=nplots,
160 160 wintitle=wintitle,
161 161 showprofile=showprofile,
162 162 show=show)
163 163
164 164 if xmin == None: xmin = numpy.nanmin(x)
165 165 if xmax == None: xmax = numpy.nanmax(x)
166 166 if ymin == None: ymin = numpy.nanmin(y)
167 167 if ymax == None: ymax = numpy.nanmax(y)
168 168 if zmin == None: zmin = numpy.floor(numpy.nanmin(noisedB)) - 3
169 169 if zmax == None: zmax = numpy.ceil(numpy.nanmax(avgdB)) + 3
170 170
171 171 self.FTP_WEI = ftp_wei
172 172 self.EXP_CODE = exp_code
173 173 self.SUB_EXP_CODE = sub_exp_code
174 174 self.PLOT_POS = plot_pos
175 175
176 176 self.isConfig = True
177 177
178 178 self.setWinTitle(title)
179 179
180 180 for i in range(self.nplots):
181 181 index = channelIndexList[i]
182 182 str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S"))
183 183 title = "Channel %d: %4.2fdB: %s" %(dataOut.channelList[index], noisedB[index], str_datetime)
184 184 if len(dataOut.beam.codeList) != 0:
185 185 title = "Ch%d:%4.2fdB,%2.2f,%2.2f:%s" %(dataOut.channelList[index], noisedB[index], dataOut.beam.azimuthList[index], dataOut.beam.zenithList[index], str_datetime)
186 186
187 187 axes = self.axesList[i*self.__nsubplots]
188 188 axes.pcolor(x, y, zdB[index,:,:],
189 189 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
190 190 xlabel=xlabel, ylabel=ylabel, title=title,
191 191 ticksize=9, cblabel='')
192 192
193 193 if self.__showprofile:
194 194 axes = self.axesList[i*self.__nsubplots +1]
195 195 axes.pline(avgdB[index,:], y,
196 196 xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
197 197 xlabel='dB', ylabel='', title='',
198 198 ytick_visible=False,
199 199 grid='x')
200 200
201 201 noiseline = numpy.repeat(noisedB[index], len(y))
202 202 axes.addpline(noiseline, y, idline=1, color="black", linestyle="dashed", lw=2)
203 203
204 204 self.draw()
205 205
206 206 if figfile == None:
207 207 str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S")
208 208 name = str_datetime
209 209 if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)):
210 210 name = name + '_az' + '_%2.2f'%(dataOut.azimuth) + '_zn' + '_%2.2f'%(dataOut.zenith)
211 211 figfile = self.getFilename(name)
212 212
213 213 self.save(figpath=figpath,
214 214 figfile=figfile,
215 215 save=save,
216 216 ftp=ftp,
217 217 wr_period=wr_period,
218 218 thisDatetime=thisDatetime)
219 219
220 220 class CrossSpectraPlot(Figure):
221 221
222 222 isConfig = None
223 223 __nsubplots = None
224 224
225 225 WIDTH = None
226 226 HEIGHT = None
227 227 WIDTHPROF = None
228 228 HEIGHTPROF = None
229 229 PREFIX = 'cspc'
230 230
231 231 def __init__(self):
232 232
233 233 self.isConfig = False
234 234 self.__nsubplots = 4
235 235 self.counter_imagwr = 0
236 236 self.WIDTH = 250
237 237 self.HEIGHT = 250
238 238 self.WIDTHPROF = 0
239 239 self.HEIGHTPROF = 0
240 240
241 241 self.PLOT_CODE = CROSS_CODE
242 242 self.FTP_WEI = None
243 243 self.EXP_CODE = None
244 244 self.SUB_EXP_CODE = None
245 245 self.PLOT_POS = None
246 246
247 247 def getSubplots(self):
248 248
249 249 ncol = 4
250 250 nrow = self.nplots
251 251
252 252 return nrow, ncol
253 253
254 254 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
255 255
256 256 self.__showprofile = showprofile
257 257 self.nplots = nplots
258 258
259 259 ncolspan = 1
260 260 colspan = 1
261 261
262 262 self.createFigure(id = id,
263 263 wintitle = wintitle,
264 264 widthplot = self.WIDTH + self.WIDTHPROF,
265 265 heightplot = self.HEIGHT + self.HEIGHTPROF,
266 266 show=True)
267 267
268 268 nrow, ncol = self.getSubplots()
269 269
270 270 counter = 0
271 271 for y in range(nrow):
272 272 for x in range(ncol):
273 273 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
274 274
275 275 counter += 1
276 276
277 277 def run(self, dataOut, id, wintitle="", pairsList=None,
278 278 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
279 279 coh_min=None, coh_max=None, phase_min=None, phase_max=None,
280 280 save=False, figpath='./', figfile=None, ftp=False, wr_period=1,
281 281 power_cmap='jet', coherence_cmap='jet', phase_cmap='RdBu_r', show=True,
282 282 server=None, folder=None, username=None, password=None,
283 283 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
284 284
285 285 """
286 286
287 287 Input:
288 288 dataOut :
289 289 id :
290 290 wintitle :
291 291 channelList :
292 292 showProfile :
293 293 xmin : None,
294 294 xmax : None,
295 295 ymin : None,
296 296 ymax : None,
297 297 zmin : None,
298 298 zmax : None
299 299 """
300 300
301 301 if pairsList == None:
302 302 pairsIndexList = dataOut.pairsIndexList
303 303 else:
304 304 pairsIndexList = []
305 305 for pair in pairsList:
306 306 if pair not in dataOut.pairsList:
307 307 raise ValueError, "Pair %s is not in dataOut.pairsList" %str(pair)
308 308 pairsIndexList.append(dataOut.pairsList.index(pair))
309 309
310 310 if not pairsIndexList:
311 311 return
312 312
313 313 if len(pairsIndexList) > 4:
314 314 pairsIndexList = pairsIndexList[0:4]
315 315
316 316 factor = dataOut.normFactor
317 317 x = dataOut.getVelRange(1)
318 318 y = dataOut.getHeiRange()
319 319 z = dataOut.data_spc[:,:,:]/factor
320 320 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
321 321
322 322 noise = dataOut.noise/factor
323 323
324 324 zdB = 10*numpy.log10(z)
325 325 noisedB = 10*numpy.log10(noise)
326 326
327 327 if coh_min == None:
328 328 coh_min = 0.0
329 329 if coh_max == None:
330 330 coh_max = 1.0
331 331
332 332 if phase_min == None:
333 333 phase_min = -180
334 334 if phase_max == None:
335 335 phase_max = 180
336 336
337 337 #thisDatetime = dataOut.datatime
338 338 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0])
339 339 title = wintitle + " Cross-Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
340 340 xlabel = "Velocity (m/s)"
341 341 ylabel = "Range (Km)"
342 342
343 343 if not self.isConfig:
344 344
345 345 nplots = len(pairsIndexList)
346 346
347 347 self.setup(id=id,
348 348 nplots=nplots,
349 349 wintitle=wintitle,
350 350 showprofile=False,
351 351 show=show)
352 352
353 353 avg = numpy.abs(numpy.average(z, axis=1))
354 354 avgdB = 10*numpy.log10(avg)
355 355
356 356 if xmin == None: xmin = numpy.nanmin(x)
357 357 if xmax == None: xmax = numpy.nanmax(x)
358 358 if ymin == None: ymin = numpy.nanmin(y)
359 359 if ymax == None: ymax = numpy.nanmax(y)
360 360 if zmin == None: zmin = numpy.floor(numpy.nanmin(noisedB)) - 3
361 361 if zmax == None: zmax = numpy.ceil(numpy.nanmax(avgdB)) + 3
362 362
363 363 self.FTP_WEI = ftp_wei
364 364 self.EXP_CODE = exp_code
365 365 self.SUB_EXP_CODE = sub_exp_code
366 366 self.PLOT_POS = plot_pos
367 367
368 368 self.isConfig = True
369 369
370 370 self.setWinTitle(title)
371 371
372 372 for i in range(self.nplots):
373 373 pair = dataOut.pairsList[pairsIndexList[i]]
374 374
375 375 chan_index0 = dataOut.channelList.index(pair[0])
376 376 chan_index1 = dataOut.channelList.index(pair[1])
377 377
378 378 str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S"))
379 379 title = "Ch%d: %4.2fdB: %s" %(pair[0], noisedB[chan_index0], str_datetime)
380 380 zdB = 10.*numpy.log10(dataOut.data_spc[chan_index0,:,:]/factor)
381 381 axes0 = self.axesList[i*self.__nsubplots]
382 382 axes0.pcolor(x, y, zdB,
383 383 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
384 384 xlabel=xlabel, ylabel=ylabel, title=title,
385 385 ticksize=9, colormap=power_cmap, cblabel='')
386 386
387 387 title = "Ch%d: %4.2fdB: %s" %(pair[1], noisedB[chan_index1], str_datetime)
388 388 zdB = 10.*numpy.log10(dataOut.data_spc[chan_index1,:,:]/factor)
389 389 axes0 = self.axesList[i*self.__nsubplots+1]
390 390 axes0.pcolor(x, y, zdB,
391 391 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
392 392 xlabel=xlabel, ylabel=ylabel, title=title,
393 393 ticksize=9, colormap=power_cmap, cblabel='')
394 394
395 395 coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[chan_index0,:,:]*dataOut.data_spc[chan_index1,:,:])
396 396 coherence = numpy.abs(coherenceComplex)
397 397 # phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
398 398 phase = numpy.arctan2(coherenceComplex.imag, coherenceComplex.real)*180/numpy.pi
399 399
400 400 title = "Coherence Ch%d * Ch%d" %(pair[0], pair[1])
401 401 axes0 = self.axesList[i*self.__nsubplots+2]
402 402 axes0.pcolor(x, y, coherence,
403 403 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=coh_min, zmax=coh_max,
404 404 xlabel=xlabel, ylabel=ylabel, title=title,
405 405 ticksize=9, colormap=coherence_cmap, cblabel='')
406 406
407 407 title = "Phase Ch%d * Ch%d" %(pair[0], pair[1])
408 408 axes0 = self.axesList[i*self.__nsubplots+3]
409 409 axes0.pcolor(x, y, phase,
410 410 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=phase_min, zmax=phase_max,
411 411 xlabel=xlabel, ylabel=ylabel, title=title,
412 412 ticksize=9, colormap=phase_cmap, cblabel='')
413 413
414 414
415 415
416 416 self.draw()
417 417
418 418 self.save(figpath=figpath,
419 419 figfile=figfile,
420 420 save=save,
421 421 ftp=ftp,
422 422 wr_period=wr_period,
423 423 thisDatetime=thisDatetime)
424 424
425 425
426 426 class RTIPlot(Figure):
427 427
428 428 __isConfig = None
429 429 __nsubplots = None
430 430
431 431 WIDTHPROF = None
432 432 HEIGHTPROF = None
433 433 PREFIX = 'rti'
434 434
435 435 def __init__(self):
436 436
437 437 self.timerange = None
438 438 self.isConfig = False
439 439 self.__nsubplots = 1
440 440
441 441 self.WIDTH = 800
442 442 self.HEIGHT = 180
443 443 self.WIDTHPROF = 120
444 444 self.HEIGHTPROF = 0
445 445 self.counter_imagwr = 0
446 446
447 447 self.PLOT_CODE = RTI_CODE
448 448
449 449 self.FTP_WEI = None
450 450 self.EXP_CODE = None
451 451 self.SUB_EXP_CODE = None
452 452 self.PLOT_POS = None
453 453 self.tmin = None
454 454 self.tmax = None
455 455
456 456 self.xmin = None
457 457 self.xmax = None
458 458
459 459 self.figfile = None
460 460
461 461 def getSubplots(self):
462 462
463 463 ncol = 1
464 464 nrow = self.nplots
465 465
466 466 return nrow, ncol
467 467
468 468 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
469 469
470 470 self.__showprofile = showprofile
471 471 self.nplots = nplots
472 472
473 473 ncolspan = 1
474 474 colspan = 1
475 475 if showprofile:
476 476 ncolspan = 7
477 477 colspan = 6
478 478 self.__nsubplots = 2
479 479
480 480 self.createFigure(id = id,
481 481 wintitle = wintitle,
482 482 widthplot = self.WIDTH + self.WIDTHPROF,
483 483 heightplot = self.HEIGHT + self.HEIGHTPROF,
484 484 show=show)
485 485
486 486 nrow, ncol = self.getSubplots()
487 487
488 488 counter = 0
489 489 for y in range(nrow):
490 490 for x in range(ncol):
491 491
492 492 if counter >= self.nplots:
493 493 break
494 494
495 495 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
496 496
497 497 if showprofile:
498 498 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
499 499
500 500 counter += 1
501 501
502 502 def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True',
503 503 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
504 504 timerange=None,
505 505 save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True,
506 506 server=None, folder=None, username=None, password=None,
507 507 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
508 508
509 509 """
510 510
511 511 Input:
512 512 dataOut :
513 513 id :
514 514 wintitle :
515 515 channelList :
516 516 showProfile :
517 517 xmin : None,
518 518 xmax : None,
519 519 ymin : None,
520 520 ymax : None,
521 521 zmin : None,
522 522 zmax : None
523 523 """
524 524
525 525 if not isTimeInHourRange(dataOut.datatime, xmin, xmax):
526 526 return
527 527
528 528 if channelList == None:
529 529 channelIndexList = dataOut.channelIndexList
530 530 else:
531 531 channelIndexList = []
532 532 for channel in channelList:
533 533 if channel not in dataOut.channelList:
534 534 raise ValueError, "Channel %d is not in dataOut.channelList"
535 535 channelIndexList.append(dataOut.channelList.index(channel))
536 536
537 537 factor = dataOut.normFactor
538 538 x = dataOut.getTimeRange()
539 539 y = dataOut.getHeiRange()
540 540
541 541 z = dataOut.data_spc/factor
542 542 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
543 543 avg = numpy.average(z, axis=1)
544 544
545 545 avgdB = 10.*numpy.log10(avg)
546 546
547 547 thisDatetime = dataOut.datatime
548 548 # thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0])
549 549 title = wintitle + " RTI" #: %s" %(thisDatetime.strftime("%d-%b-%Y"))
550 550 xlabel = ""
551 551 ylabel = "Range (Km)"
552 552
553 553 update_figfile = False
554 554
555 if dataOut.ltctime >= self.xmax:
556 self.counter_imagwr = wr_period
557 self.isConfig = False
558 update_figfile = True
559
555 560 if not self.isConfig:
556 561
557 562 nplots = len(channelIndexList)
558 563
559 564 self.setup(id=id,
560 565 nplots=nplots,
561 566 wintitle=wintitle,
562 567 showprofile=showprofile,
563 568 show=show)
564 569
565 570 if timerange != None:
566 571 self.timerange = timerange
567 572
568 573 self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange)
569 574
570 575 noise = dataOut.noise/factor
571 576 noisedB = 10*numpy.log10(noise)
572 577
573 578 if ymin == None: ymin = numpy.nanmin(y)
574 579 if ymax == None: ymax = numpy.nanmax(y)
575 580 if zmin == None: zmin = numpy.floor(numpy.nanmin(noisedB)) - 3
576 581 if zmax == None: zmax = numpy.ceil(numpy.nanmax(avgdB)) + 3
577 582
578 583 self.FTP_WEI = ftp_wei
579 584 self.EXP_CODE = exp_code
580 585 self.SUB_EXP_CODE = sub_exp_code
581 586 self.PLOT_POS = plot_pos
582 587
583 588 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
584 589 self.isConfig = True
585 590 self.figfile = figfile
586 591 update_figfile = True
587 592
588 593 self.setWinTitle(title)
589 594
590 595 for i in range(self.nplots):
591 596 index = channelIndexList[i]
592 597 title = "Channel %d: %s" %(dataOut.channelList[index], thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
593 598 if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)):
594 599 title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith)
595 600 axes = self.axesList[i*self.__nsubplots]
596 601 zdB = avgdB[index].reshape((1,-1))
597 602 axes.pcolorbuffer(x, y, zdB,
598 603 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
599 604 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
600 605 ticksize=9, cblabel='', cbsize="1%")
601 606
602 607 if self.__showprofile:
603 608 axes = self.axesList[i*self.__nsubplots +1]
604 609 axes.pline(avgdB[index], y,
605 610 xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
606 611 xlabel='dB', ylabel='', title='',
607 612 ytick_visible=False,
608 613 grid='x')
609 614
610 615 self.draw()
611 616
612 if dataOut.ltctime >= self.xmax:
613 self.counter_imagwr = wr_period
614 self.isConfig = False
615 update_figfile = True
616
617 617 self.save(figpath=figpath,
618 618 figfile=figfile,
619 619 save=save,
620 620 ftp=ftp,
621 621 wr_period=wr_period,
622 622 thisDatetime=thisDatetime,
623 623 update_figfile=update_figfile)
624 624
625 625 class CoherenceMap(Figure):
626 626 isConfig = None
627 627 __nsubplots = None
628 628
629 629 WIDTHPROF = None
630 630 HEIGHTPROF = None
631 631 PREFIX = 'cmap'
632 632
633 633 def __init__(self):
634 634 self.timerange = 2*60*60
635 635 self.isConfig = False
636 636 self.__nsubplots = 1
637 637
638 638 self.WIDTH = 800
639 639 self.HEIGHT = 180
640 640 self.WIDTHPROF = 120
641 641 self.HEIGHTPROF = 0
642 642 self.counter_imagwr = 0
643 643
644 644 self.PLOT_CODE = COH_CODE
645 645
646 646 self.FTP_WEI = None
647 647 self.EXP_CODE = None
648 648 self.SUB_EXP_CODE = None
649 649 self.PLOT_POS = None
650 650 self.counter_imagwr = 0
651 651
652 652 self.xmin = None
653 653 self.xmax = None
654 654
655 655 def getSubplots(self):
656 656 ncol = 1
657 657 nrow = self.nplots*2
658 658
659 659 return nrow, ncol
660 660
661 661 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
662 662 self.__showprofile = showprofile
663 663 self.nplots = nplots
664 664
665 665 ncolspan = 1
666 666 colspan = 1
667 667 if showprofile:
668 668 ncolspan = 7
669 669 colspan = 6
670 670 self.__nsubplots = 2
671 671
672 672 self.createFigure(id = id,
673 673 wintitle = wintitle,
674 674 widthplot = self.WIDTH + self.WIDTHPROF,
675 675 heightplot = self.HEIGHT + self.HEIGHTPROF,
676 676 show=True)
677 677
678 678 nrow, ncol = self.getSubplots()
679 679
680 680 for y in range(nrow):
681 681 for x in range(ncol):
682 682
683 683 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
684 684
685 685 if showprofile:
686 686 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
687 687
688 688 def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True',
689 689 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
690 690 timerange=None, phase_min=None, phase_max=None,
691 691 save=False, figpath='./', figfile=None, ftp=False, wr_period=1,
692 692 coherence_cmap='jet', phase_cmap='RdBu_r', show=True,
693 693 server=None, folder=None, username=None, password=None,
694 694 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
695 695
696 696 if not isTimeInHourRange(dataOut.datatime, xmin, xmax):
697 697 return
698 698
699 699 if pairsList == None:
700 700 pairsIndexList = dataOut.pairsIndexList
701 701 else:
702 702 pairsIndexList = []
703 703 for pair in pairsList:
704 704 if pair not in dataOut.pairsList:
705 705 raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair)
706 706 pairsIndexList.append(dataOut.pairsList.index(pair))
707 707
708 708 if pairsIndexList == []:
709 709 return
710 710
711 711 if len(pairsIndexList) > 4:
712 712 pairsIndexList = pairsIndexList[0:4]
713 713
714 714 if phase_min == None:
715 715 phase_min = -180
716 716 if phase_max == None:
717 717 phase_max = 180
718 718
719 719 x = dataOut.getTimeRange()
720 720 y = dataOut.getHeiRange()
721 721
722 722 thisDatetime = dataOut.datatime
723 723
724 724 title = wintitle + " CoherenceMap" #: %s" %(thisDatetime.strftime("%d-%b-%Y"))
725 725 xlabel = ""
726 726 ylabel = "Range (Km)"
727 727 update_figfile = False
728 728
729 729 if not self.isConfig:
730 730 nplots = len(pairsIndexList)
731 731 self.setup(id=id,
732 732 nplots=nplots,
733 733 wintitle=wintitle,
734 734 showprofile=showprofile,
735 735 show=show)
736 736
737 737 if timerange != None:
738 738 self.timerange = timerange
739 739
740 740 self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange)
741 741
742 742 if ymin == None: ymin = numpy.nanmin(y)
743 743 if ymax == None: ymax = numpy.nanmax(y)
744 744 if zmin == None: zmin = 0.
745 745 if zmax == None: zmax = 1.
746 746
747 747 self.FTP_WEI = ftp_wei
748 748 self.EXP_CODE = exp_code
749 749 self.SUB_EXP_CODE = sub_exp_code
750 750 self.PLOT_POS = plot_pos
751 751
752 752 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
753 753
754 754 self.isConfig = True
755 755 update_figfile = True
756 756
757 757 self.setWinTitle(title)
758 758
759 759 for i in range(self.nplots):
760 760
761 761 pair = dataOut.pairsList[pairsIndexList[i]]
762 762
763 763 ccf = numpy.average(dataOut.data_cspc[pairsIndexList[i],:,:],axis=0)
764 764 powa = numpy.average(dataOut.data_spc[pair[0],:,:],axis=0)
765 765 powb = numpy.average(dataOut.data_spc[pair[1],:,:],axis=0)
766 766
767 767
768 768 avgcoherenceComplex = ccf/numpy.sqrt(powa*powb)
769 769 coherence = numpy.abs(avgcoherenceComplex)
770 770
771 771 z = coherence.reshape((1,-1))
772 772
773 773 counter = 0
774 774
775 775 title = "Coherence Ch%d * Ch%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
776 776 axes = self.axesList[i*self.__nsubplots*2]
777 777 axes.pcolorbuffer(x, y, z,
778 778 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
779 779 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
780 780 ticksize=9, cblabel='', colormap=coherence_cmap, cbsize="1%")
781 781
782 782 if self.__showprofile:
783 783 counter += 1
784 784 axes = self.axesList[i*self.__nsubplots*2 + counter]
785 785 axes.pline(coherence, y,
786 786 xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
787 787 xlabel='', ylabel='', title='', ticksize=7,
788 788 ytick_visible=False, nxticks=5,
789 789 grid='x')
790 790
791 791 counter += 1
792 792
793 793 phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi
794 794
795 795 z = phase.reshape((1,-1))
796 796
797 797 title = "Phase Ch%d * Ch%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
798 798 axes = self.axesList[i*self.__nsubplots*2 + counter]
799 799 axes.pcolorbuffer(x, y, z,
800 800 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=phase_min, zmax=phase_max,
801 801 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
802 802 ticksize=9, cblabel='', colormap=phase_cmap, cbsize="1%")
803 803
804 804 if self.__showprofile:
805 805 counter += 1
806 806 axes = self.axesList[i*self.__nsubplots*2 + counter]
807 807 axes.pline(phase, y,
808 808 xmin=phase_min, xmax=phase_max, ymin=ymin, ymax=ymax,
809 809 xlabel='', ylabel='', title='', ticksize=7,
810 810 ytick_visible=False, nxticks=4,
811 811 grid='x')
812 812
813 813 self.draw()
814 814
815 815 if dataOut.ltctime >= self.xmax:
816 816 self.counter_imagwr = wr_period
817 817 self.isConfig = False
818 818 update_figfile = True
819 819
820 820 self.save(figpath=figpath,
821 821 figfile=figfile,
822 822 save=save,
823 823 ftp=ftp,
824 824 wr_period=wr_period,
825 825 thisDatetime=thisDatetime,
826 826 update_figfile=update_figfile)
827 827
828 828 class PowerProfilePlot(Figure):
829 829
830 830 isConfig = None
831 831 __nsubplots = None
832 832
833 833 WIDTHPROF = None
834 834 HEIGHTPROF = None
835 835 PREFIX = 'spcprofile'
836 836
837 837 def __init__(self):
838 838 self.isConfig = False
839 839 self.__nsubplots = 1
840 840
841 841 self.PLOT_CODE = POWER_CODE
842 842
843 843 self.WIDTH = 300
844 844 self.HEIGHT = 500
845 845 self.counter_imagwr = 0
846 846
847 847 def getSubplots(self):
848 848 ncol = 1
849 849 nrow = 1
850 850
851 851 return nrow, ncol
852 852
853 853 def setup(self, id, nplots, wintitle, show):
854 854
855 855 self.nplots = nplots
856 856
857 857 ncolspan = 1
858 858 colspan = 1
859 859
860 860 self.createFigure(id = id,
861 861 wintitle = wintitle,
862 862 widthplot = self.WIDTH,
863 863 heightplot = self.HEIGHT,
864 864 show=show)
865 865
866 866 nrow, ncol = self.getSubplots()
867 867
868 868 counter = 0
869 869 for y in range(nrow):
870 870 for x in range(ncol):
871 871 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
872 872
873 873 def run(self, dataOut, id, wintitle="", channelList=None,
874 874 xmin=None, xmax=None, ymin=None, ymax=None,
875 875 save=False, figpath='./', figfile=None, show=True,
876 876 ftp=False, wr_period=1, server=None,
877 877 folder=None, username=None, password=None):
878 878
879 879
880 880 if channelList == None:
881 881 channelIndexList = dataOut.channelIndexList
882 882 channelList = dataOut.channelList
883 883 else:
884 884 channelIndexList = []
885 885 for channel in channelList:
886 886 if channel not in dataOut.channelList:
887 887 raise ValueError, "Channel %d is not in dataOut.channelList"
888 888 channelIndexList.append(dataOut.channelList.index(channel))
889 889
890 890 factor = dataOut.normFactor
891 891
892 892 y = dataOut.getHeiRange()
893 893
894 894 #for voltage
895 895 if dataOut.type == 'Voltage':
896 896 x = dataOut.data[channelIndexList,:] * numpy.conjugate(dataOut.data[channelIndexList,:])
897 897 x = x.real
898 898 x = numpy.where(numpy.isfinite(x), x, numpy.NAN)
899 899
900 900 #for spectra
901 901 if dataOut.type == 'Spectra':
902 902 x = dataOut.data_spc[channelIndexList,:,:]/factor
903 903 x = numpy.where(numpy.isfinite(x), x, numpy.NAN)
904 904 x = numpy.average(x, axis=1)
905 905
906 906
907 907 xdB = 10*numpy.log10(x)
908 908
909 909 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0])
910 910 title = wintitle + " Power Profile %s" %(thisDatetime.strftime("%d-%b-%Y"))
911 911 xlabel = "dB"
912 912 ylabel = "Range (Km)"
913 913
914 914 if not self.isConfig:
915 915
916 916 nplots = 1
917 917
918 918 self.setup(id=id,
919 919 nplots=nplots,
920 920 wintitle=wintitle,
921 921 show=show)
922 922
923 923 if ymin == None: ymin = numpy.nanmin(y)
924 924 if ymax == None: ymax = numpy.nanmax(y)
925 925 if xmin == None: xmin = numpy.nanmin(xdB)*0.9
926 926 if xmax == None: xmax = numpy.nanmax(xdB)*1.1
927 927
928 928 self.isConfig = True
929 929
930 930 self.setWinTitle(title)
931 931
932 932 title = "Power Profile: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
933 933 axes = self.axesList[0]
934 934
935 935 legendlabels = ["channel %d"%x for x in channelList]
936 936 axes.pmultiline(xdB, y,
937 937 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
938 938 xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels,
939 939 ytick_visible=True, nxticks=5,
940 940 grid='x')
941 941
942 942 self.draw()
943 943
944 944 self.save(figpath=figpath,
945 945 figfile=figfile,
946 946 save=save,
947 947 ftp=ftp,
948 948 wr_period=wr_period,
949 949 thisDatetime=thisDatetime)
950 950
951 951 class SpectraCutPlot(Figure):
952 952
953 953 isConfig = None
954 954 __nsubplots = None
955 955
956 956 WIDTHPROF = None
957 957 HEIGHTPROF = None
958 958 PREFIX = 'spc_cut'
959 959
960 960 def __init__(self):
961 961 self.isConfig = False
962 962 self.__nsubplots = 1
963 963
964 964 self.PLOT_CODE = POWER_CODE
965 965
966 966 self.WIDTH = 700
967 967 self.HEIGHT = 500
968 968 self.counter_imagwr = 0
969 969
970 970 def getSubplots(self):
971 971 ncol = 1
972 972 nrow = 1
973 973
974 974 return nrow, ncol
975 975
976 976 def setup(self, id, nplots, wintitle, show):
977 977
978 978 self.nplots = nplots
979 979
980 980 ncolspan = 1
981 981 colspan = 1
982 982
983 983 self.createFigure(id = id,
984 984 wintitle = wintitle,
985 985 widthplot = self.WIDTH,
986 986 heightplot = self.HEIGHT,
987 987 show=show)
988 988
989 989 nrow, ncol = self.getSubplots()
990 990
991 991 counter = 0
992 992 for y in range(nrow):
993 993 for x in range(ncol):
994 994 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
995 995
996 996 def run(self, dataOut, id, wintitle="", channelList=None,
997 997 xmin=None, xmax=None, ymin=None, ymax=None,
998 998 save=False, figpath='./', figfile=None, show=True,
999 999 ftp=False, wr_period=1, server=None,
1000 1000 folder=None, username=None, password=None,
1001 1001 xaxis="velocity"):
1002 1002
1003 1003
1004 1004 if channelList == None:
1005 1005 channelIndexList = dataOut.channelIndexList
1006 1006 channelList = dataOut.channelList
1007 1007 else:
1008 1008 channelIndexList = []
1009 1009 for channel in channelList:
1010 1010 if channel not in dataOut.channelList:
1011 1011 raise ValueError, "Channel %d is not in dataOut.channelList"
1012 1012 channelIndexList.append(dataOut.channelList.index(channel))
1013 1013
1014 1014 factor = dataOut.normFactor
1015 1015
1016 1016 y = dataOut.getHeiRange()
1017 1017
1018 1018 z = dataOut.data_spc/factor
1019 1019 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
1020 1020
1021 1021 hei_index = numpy.arange(25)*3 + 20
1022 1022
1023 1023 if xaxis == "frequency":
1024 1024 x = dataOut.getFreqRange()/1000.
1025 1025 zdB = 10*numpy.log10(z[0,:,hei_index])
1026 1026 xlabel = "Frequency (kHz)"
1027 1027 ylabel = "Power (dB)"
1028 1028
1029 1029 elif xaxis == "time":
1030 1030 x = dataOut.getAcfRange()
1031 1031 zdB = z[0,:,hei_index]
1032 1032 xlabel = "Time (ms)"
1033 1033 ylabel = "ACF"
1034 1034
1035 1035 else:
1036 1036 x = dataOut.getVelRange()
1037 1037 zdB = 10*numpy.log10(z[0,:,hei_index])
1038 1038 xlabel = "Velocity (m/s)"
1039 1039 ylabel = "Power (dB)"
1040 1040
1041 1041 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0])
1042 1042 title = wintitle + " Range Cuts %s" %(thisDatetime.strftime("%d-%b-%Y"))
1043 1043
1044 1044 if not self.isConfig:
1045 1045
1046 1046 nplots = 1
1047 1047
1048 1048 self.setup(id=id,
1049 1049 nplots=nplots,
1050 1050 wintitle=wintitle,
1051 1051 show=show)
1052 1052
1053 1053 if xmin == None: xmin = numpy.nanmin(x)*0.9
1054 1054 if xmax == None: xmax = numpy.nanmax(x)*1.1
1055 1055 if ymin == None: ymin = numpy.nanmin(zdB)
1056 1056 if ymax == None: ymax = numpy.nanmax(zdB)
1057 1057
1058 1058 self.isConfig = True
1059 1059
1060 1060 self.setWinTitle(title)
1061 1061
1062 1062 title = "Spectra Cuts: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
1063 1063 axes = self.axesList[0]
1064 1064
1065 1065 legendlabels = ["Range = %dKm" %y[i] for i in hei_index]
1066 1066
1067 1067 axes.pmultilineyaxis( x, zdB,
1068 1068 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
1069 1069 xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels,
1070 1070 ytick_visible=True, nxticks=5,
1071 1071 grid='x')
1072 1072
1073 1073 self.draw()
1074 1074
1075 1075 self.save(figpath=figpath,
1076 1076 figfile=figfile,
1077 1077 save=save,
1078 1078 ftp=ftp,
1079 1079 wr_period=wr_period,
1080 1080 thisDatetime=thisDatetime)
1081 1081
1082 1082 class Noise(Figure):
1083 1083
1084 1084 isConfig = None
1085 1085 __nsubplots = None
1086 1086
1087 1087 PREFIX = 'noise'
1088 1088
1089 1089 def __init__(self):
1090 1090
1091 1091 self.timerange = 24*60*60
1092 1092 self.isConfig = False
1093 1093 self.__nsubplots = 1
1094 1094 self.counter_imagwr = 0
1095 1095 self.WIDTH = 800
1096 1096 self.HEIGHT = 400
1097 1097 self.WIDTHPROF = 120
1098 1098 self.HEIGHTPROF = 0
1099 1099 self.xdata = None
1100 1100 self.ydata = None
1101 1101
1102 1102 self.PLOT_CODE = NOISE_CODE
1103 1103
1104 1104 self.FTP_WEI = None
1105 1105 self.EXP_CODE = None
1106 1106 self.SUB_EXP_CODE = None
1107 1107 self.PLOT_POS = None
1108 1108 self.figfile = None
1109 1109
1110 1110 self.xmin = None
1111 1111 self.xmax = None
1112 1112
1113 1113 def getSubplots(self):
1114 1114
1115 1115 ncol = 1
1116 1116 nrow = 1
1117 1117
1118 1118 return nrow, ncol
1119 1119
1120 1120 def openfile(self, filename):
1121 1121 dirname = os.path.dirname(filename)
1122 1122
1123 1123 if not os.path.exists(dirname):
1124 1124 os.mkdir(dirname)
1125 1125
1126 1126 f = open(filename,'w+')
1127 1127 f.write('\n\n')
1128 1128 f.write('JICAMARCA RADIO OBSERVATORY - Noise \n')
1129 1129 f.write('DD MM YYYY HH MM SS Channel0 Channel1 Channel2 Channel3\n\n' )
1130 1130 f.close()
1131 1131
1132 1132 def save_data(self, filename_phase, data, data_datetime):
1133 1133
1134 1134 f=open(filename_phase,'a')
1135 1135
1136 1136 timetuple_data = data_datetime.timetuple()
1137 1137 day = str(timetuple_data.tm_mday)
1138 1138 month = str(timetuple_data.tm_mon)
1139 1139 year = str(timetuple_data.tm_year)
1140 1140 hour = str(timetuple_data.tm_hour)
1141 1141 minute = str(timetuple_data.tm_min)
1142 1142 second = str(timetuple_data.tm_sec)
1143 1143
1144 1144 data_msg = ''
1145 1145 for i in range(len(data)):
1146 1146 data_msg += str(data[i]) + ' '
1147 1147
1148 1148 f.write(day+' '+month+' '+year+' '+hour+' '+minute+' '+second+' ' + data_msg + '\n')
1149 1149 f.close()
1150 1150
1151 1151
1152 1152 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
1153 1153
1154 1154 self.__showprofile = showprofile
1155 1155 self.nplots = nplots
1156 1156
1157 1157 ncolspan = 7
1158 1158 colspan = 6
1159 1159 self.__nsubplots = 2
1160 1160
1161 1161 self.createFigure(id = id,
1162 1162 wintitle = wintitle,
1163 1163 widthplot = self.WIDTH+self.WIDTHPROF,
1164 1164 heightplot = self.HEIGHT+self.HEIGHTPROF,
1165 1165 show=show)
1166 1166
1167 1167 nrow, ncol = self.getSubplots()
1168 1168
1169 1169 self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1)
1170 1170
1171 1171
1172 1172 def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True',
1173 1173 xmin=None, xmax=None, ymin=None, ymax=None,
1174 1174 timerange=None,
1175 1175 save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
1176 1176 server=None, folder=None, username=None, password=None,
1177 1177 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
1178 1178
1179 1179 if not isTimeInHourRange(dataOut.datatime, xmin, xmax):
1180 1180 return
1181 1181
1182 1182 if channelList == None:
1183 1183 channelIndexList = dataOut.channelIndexList
1184 1184 channelList = dataOut.channelList
1185 1185 else:
1186 1186 channelIndexList = []
1187 1187 for channel in channelList:
1188 1188 if channel not in dataOut.channelList:
1189 1189 raise ValueError, "Channel %d is not in dataOut.channelList"
1190 1190 channelIndexList.append(dataOut.channelList.index(channel))
1191 1191
1192 1192 x = dataOut.getTimeRange()
1193 1193 #y = dataOut.getHeiRange()
1194 1194 factor = dataOut.normFactor
1195 1195 noise = dataOut.noise[channelIndexList]/factor
1196 1196 noisedB = 10*numpy.log10(noise)
1197 1197
1198 1198 thisDatetime = dataOut.datatime
1199 1199
1200 1200 title = wintitle + " Noise" # : %s" %(thisDatetime.strftime("%d-%b-%Y"))
1201 1201 xlabel = ""
1202 1202 ylabel = "Intensity (dB)"
1203 1203 update_figfile = False
1204 1204
1205 1205 if not self.isConfig:
1206 1206
1207 1207 nplots = 1
1208 1208
1209 1209 self.setup(id=id,
1210 1210 nplots=nplots,
1211 1211 wintitle=wintitle,
1212 1212 showprofile=showprofile,
1213 1213 show=show)
1214 1214
1215 1215 if timerange != None:
1216 1216 self.timerange = timerange
1217 1217
1218 1218 self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange)
1219 1219
1220 1220 if ymin == None: ymin = numpy.floor(numpy.nanmin(noisedB)) - 10.0
1221 1221 if ymax == None: ymax = numpy.nanmax(noisedB) + 10.0
1222 1222
1223 1223 self.FTP_WEI = ftp_wei
1224 1224 self.EXP_CODE = exp_code
1225 1225 self.SUB_EXP_CODE = sub_exp_code
1226 1226 self.PLOT_POS = plot_pos
1227 1227
1228 1228
1229 1229 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
1230 1230 self.isConfig = True
1231 1231 self.figfile = figfile
1232 1232 self.xdata = numpy.array([])
1233 1233 self.ydata = numpy.array([])
1234 1234
1235 1235 update_figfile = True
1236 1236
1237 1237 #open file beacon phase
1238 1238 path = '%s%03d' %(self.PREFIX, self.id)
1239 1239 noise_file = os.path.join(path,'%s.txt'%self.name)
1240 1240 self.filename_noise = os.path.join(figpath,noise_file)
1241 1241
1242 1242 self.setWinTitle(title)
1243 1243
1244 1244 title = "Noise %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
1245 1245
1246 1246 legendlabels = ["channel %d"%(idchannel) for idchannel in channelList]
1247 1247 axes = self.axesList[0]
1248 1248
1249 1249 self.xdata = numpy.hstack((self.xdata, x[0:1]))
1250 1250
1251 1251 if len(self.ydata)==0:
1252 1252 self.ydata = noisedB.reshape(-1,1)
1253 1253 else:
1254 1254 self.ydata = numpy.hstack((self.ydata, noisedB.reshape(-1,1)))
1255 1255
1256 1256
1257 1257 axes.pmultilineyaxis(x=self.xdata, y=self.ydata,
1258 1258 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax,
1259 1259 xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid",
1260 1260 XAxisAsTime=True, grid='both'
1261 1261 )
1262 1262
1263 1263 self.draw()
1264 1264
1265 1265 if dataOut.ltctime >= self.xmax:
1266 1266 self.counter_imagwr = wr_period
1267 1267 self.isConfig = False
1268 1268 update_figfile = True
1269 1269
1270 1270 self.save(figpath=figpath,
1271 1271 figfile=figfile,
1272 1272 save=save,
1273 1273 ftp=ftp,
1274 1274 wr_period=wr_period,
1275 1275 thisDatetime=thisDatetime,
1276 1276 update_figfile=update_figfile)
1277 1277
1278 1278 #store data beacon phase
1279 1279 if save:
1280 1280 self.save_data(self.filename_noise, noisedB, thisDatetime)
1281 1281
1282 1282 class BeaconPhase(Figure):
1283 1283
1284 1284 __isConfig = None
1285 1285 __nsubplots = None
1286 1286
1287 1287 PREFIX = 'beacon_phase'
1288 1288
1289 1289 def __init__(self):
1290 1290
1291 1291 self.timerange = 24*60*60
1292 1292 self.isConfig = False
1293 1293 self.__nsubplots = 1
1294 1294 self.counter_imagwr = 0
1295 1295 self.WIDTH = 800
1296 1296 self.HEIGHT = 400
1297 1297 self.WIDTHPROF = 120
1298 1298 self.HEIGHTPROF = 0
1299 1299 self.xdata = None
1300 1300 self.ydata = None
1301 1301
1302 1302 self.PLOT_CODE = BEACON_CODE
1303 1303
1304 1304 self.FTP_WEI = None
1305 1305 self.EXP_CODE = None
1306 1306 self.SUB_EXP_CODE = None
1307 1307 self.PLOT_POS = None
1308 1308
1309 1309 self.filename_phase = None
1310 1310
1311 1311 self.figfile = None
1312 1312
1313 1313 self.xmin = None
1314 1314 self.xmax = None
1315 1315
1316 1316 def getSubplots(self):
1317 1317
1318 1318 ncol = 1
1319 1319 nrow = 1
1320 1320
1321 1321 return nrow, ncol
1322 1322
1323 1323 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
1324 1324
1325 1325 self.__showprofile = showprofile
1326 1326 self.nplots = nplots
1327 1327
1328 1328 ncolspan = 7
1329 1329 colspan = 6
1330 1330 self.__nsubplots = 2
1331 1331
1332 1332 self.createFigure(id = id,
1333 1333 wintitle = wintitle,
1334 1334 widthplot = self.WIDTH+self.WIDTHPROF,
1335 1335 heightplot = self.HEIGHT+self.HEIGHTPROF,
1336 1336 show=show)
1337 1337
1338 1338 nrow, ncol = self.getSubplots()
1339 1339
1340 1340 self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1)
1341 1341
1342 1342 def save_phase(self, filename_phase):
1343 1343 f = open(filename_phase,'w+')
1344 1344 f.write('\n\n')
1345 1345 f.write('JICAMARCA RADIO OBSERVATORY - Beacon Phase \n')
1346 1346 f.write('DD MM YYYY HH MM SS pair(2,0) pair(2,1) pair(2,3) pair(2,4)\n\n' )
1347 1347 f.close()
1348 1348
1349 1349 def save_data(self, filename_phase, data, data_datetime):
1350 1350 f=open(filename_phase,'a')
1351 1351 timetuple_data = data_datetime.timetuple()
1352 1352 day = str(timetuple_data.tm_mday)
1353 1353 month = str(timetuple_data.tm_mon)
1354 1354 year = str(timetuple_data.tm_year)
1355 1355 hour = str(timetuple_data.tm_hour)
1356 1356 minute = str(timetuple_data.tm_min)
1357 1357 second = str(timetuple_data.tm_sec)
1358 1358 f.write(day+' '+month+' '+year+' '+hour+' '+minute+' '+second+' '+str(data[0])+' '+str(data[1])+' '+str(data[2])+' '+str(data[3])+'\n')
1359 1359 f.close()
1360 1360
1361 1361
1362 1362 def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True',
1363 1363 xmin=None, xmax=None, ymin=None, ymax=None, hmin=None, hmax=None,
1364 1364 timerange=None,
1365 1365 save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
1366 1366 server=None, folder=None, username=None, password=None,
1367 1367 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
1368 1368
1369 1369 if not isTimeInHourRange(dataOut.datatime, xmin, xmax):
1370 1370 return
1371 1371
1372 1372 if pairsList == None:
1373 1373 pairsIndexList = dataOut.pairsIndexList[:10]
1374 1374 else:
1375 1375 pairsIndexList = []
1376 1376 for pair in pairsList:
1377 1377 if pair not in dataOut.pairsList:
1378 1378 raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair)
1379 1379 pairsIndexList.append(dataOut.pairsList.index(pair))
1380 1380
1381 1381 if pairsIndexList == []:
1382 1382 return
1383 1383
1384 1384 # if len(pairsIndexList) > 4:
1385 1385 # pairsIndexList = pairsIndexList[0:4]
1386 1386
1387 1387 hmin_index = None
1388 1388 hmax_index = None
1389 1389
1390 1390 if hmin != None and hmax != None:
1391 1391 indexes = numpy.arange(dataOut.nHeights)
1392 1392 hmin_list = indexes[dataOut.heightList >= hmin]
1393 1393 hmax_list = indexes[dataOut.heightList <= hmax]
1394 1394
1395 1395 if hmin_list.any():
1396 1396 hmin_index = hmin_list[0]
1397 1397
1398 1398 if hmax_list.any():
1399 1399 hmax_index = hmax_list[-1]+1
1400 1400
1401 1401 x = dataOut.getTimeRange()
1402 1402 #y = dataOut.getHeiRange()
1403 1403
1404 1404
1405 1405 thisDatetime = dataOut.datatime
1406 1406
1407 1407 title = wintitle + " Signal Phase" # : %s" %(thisDatetime.strftime("%d-%b-%Y"))
1408 1408 xlabel = "Local Time"
1409 1409 ylabel = "Phase (degrees)"
1410 1410
1411 1411 update_figfile = False
1412 1412
1413 1413 nplots = len(pairsIndexList)
1414 1414 #phase = numpy.zeros((len(pairsIndexList),len(dataOut.beacon_heiIndexList)))
1415 1415 phase_beacon = numpy.zeros(len(pairsIndexList))
1416 1416 for i in range(nplots):
1417 1417 pair = dataOut.pairsList[pairsIndexList[i]]
1418 1418 ccf = numpy.average(dataOut.data_cspc[pairsIndexList[i], :, hmin_index:hmax_index], axis=0)
1419 1419 powa = numpy.average(dataOut.data_spc[pair[0], :, hmin_index:hmax_index], axis=0)
1420 1420 powb = numpy.average(dataOut.data_spc[pair[1], :, hmin_index:hmax_index], axis=0)
1421 1421 avgcoherenceComplex = ccf/numpy.sqrt(powa*powb)
1422 1422 phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi
1423 1423
1424 1424 #print "Phase %d%d" %(pair[0], pair[1])
1425 1425 #print phase[dataOut.beacon_heiIndexList]
1426 1426
1427 1427 if dataOut.beacon_heiIndexList:
1428 1428 phase_beacon[i] = numpy.average(phase[dataOut.beacon_heiIndexList])
1429 1429 else:
1430 1430 phase_beacon[i] = numpy.average(phase)
1431 1431
1432 1432 if not self.isConfig:
1433 1433
1434 1434 nplots = len(pairsIndexList)
1435 1435
1436 1436 self.setup(id=id,
1437 1437 nplots=nplots,
1438 1438 wintitle=wintitle,
1439 1439 showprofile=showprofile,
1440 1440 show=show)
1441 1441
1442 1442 if timerange != None:
1443 1443 self.timerange = timerange
1444 1444
1445 1445 self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange)
1446 1446
1447 1447 if ymin == None: ymin = 0
1448 1448 if ymax == None: ymax = 360
1449 1449
1450 1450 self.FTP_WEI = ftp_wei
1451 1451 self.EXP_CODE = exp_code
1452 1452 self.SUB_EXP_CODE = sub_exp_code
1453 1453 self.PLOT_POS = plot_pos
1454 1454
1455 1455 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
1456 1456 self.isConfig = True
1457 1457 self.figfile = figfile
1458 1458 self.xdata = numpy.array([])
1459 1459 self.ydata = numpy.array([])
1460 1460
1461 1461 update_figfile = True
1462 1462
1463 1463 #open file beacon phase
1464 1464 path = '%s%03d' %(self.PREFIX, self.id)
1465 1465 beacon_file = os.path.join(path,'%s.txt'%self.name)
1466 1466 self.filename_phase = os.path.join(figpath,beacon_file)
1467 1467 #self.save_phase(self.filename_phase)
1468 1468
1469 1469
1470 1470 #store data beacon phase
1471 1471 #self.save_data(self.filename_phase, phase_beacon, thisDatetime)
1472 1472
1473 1473 self.setWinTitle(title)
1474 1474
1475 1475
1476 1476 title = "Phase Plot %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
1477 1477
1478 1478 legendlabels = ["Pair (%d,%d)"%(pair[0], pair[1]) for pair in dataOut.pairsList]
1479 1479
1480 1480 axes = self.axesList[0]
1481 1481
1482 1482 self.xdata = numpy.hstack((self.xdata, x[0:1]))
1483 1483
1484 1484 if len(self.ydata)==0:
1485 1485 self.ydata = phase_beacon.reshape(-1,1)
1486 1486 else:
1487 1487 self.ydata = numpy.hstack((self.ydata, phase_beacon.reshape(-1,1)))
1488 1488
1489 1489
1490 1490 axes.pmultilineyaxis(x=self.xdata, y=self.ydata,
1491 1491 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax,
1492 1492 xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid",
1493 1493 XAxisAsTime=True, grid='both'
1494 1494 )
1495 1495
1496 1496 self.draw()
1497 1497
1498 1498 if dataOut.ltctime >= self.xmax:
1499 1499 self.counter_imagwr = wr_period
1500 1500 self.isConfig = False
1501 1501 update_figfile = True
1502 1502
1503 1503 self.save(figpath=figpath,
1504 1504 figfile=figfile,
1505 1505 save=save,
1506 1506 ftp=ftp,
1507 1507 wr_period=wr_period,
1508 1508 thisDatetime=thisDatetime,
1509 1509 update_figfile=update_figfile)
General Comments 0
You need to be logged in to leave comments. Login now