##// END OF EJS Templates
El grafico de la fase del Beacon se guarda en el disco y envia por ftp
Daniel Valdez -
r454:e7f2b9ab0e3c
parent child
Show More
@@ -1,1675 +1,1698
1 import numpy
1 import numpy
2 import time, datetime, os
2 import time, datetime, os
3 from graphics.figure import *
3 from graphics.figure import *
4 def isRealtime(utcdatatime):
4 def isRealtime(utcdatatime):
5 utcnow = time.mktime(time.localtime())
5 utcnow = time.mktime(time.localtime())
6 delta = abs(utcnow - utcdatatime) # abs
6 delta = abs(utcnow - utcdatatime) # abs
7 if delta >= 30.:
7 if delta >= 30.:
8 return False
8 return False
9 return True
9 return True
10
10
11 class CrossSpectraPlot(Figure):
11 class CrossSpectraPlot(Figure):
12
12
13 __isConfig = None
13 __isConfig = None
14 __nsubplots = None
14 __nsubplots = None
15
15
16 WIDTH = None
16 WIDTH = None
17 HEIGHT = None
17 HEIGHT = None
18 WIDTHPROF = None
18 WIDTHPROF = None
19 HEIGHTPROF = None
19 HEIGHTPROF = None
20 PREFIX = 'cspc'
20 PREFIX = 'cspc'
21
21
22 def __init__(self):
22 def __init__(self):
23
23
24 self.__isConfig = False
24 self.__isConfig = False
25 self.__nsubplots = 4
25 self.__nsubplots = 4
26 self.counter_imagwr = 0
26 self.counter_imagwr = 0
27 self.WIDTH = 250
27 self.WIDTH = 250
28 self.HEIGHT = 250
28 self.HEIGHT = 250
29 self.WIDTHPROF = 0
29 self.WIDTHPROF = 0
30 self.HEIGHTPROF = 0
30 self.HEIGHTPROF = 0
31
31
32 self.PLOT_CODE = 1
32 self.PLOT_CODE = 1
33 self.FTP_WEI = None
33 self.FTP_WEI = None
34 self.EXP_CODE = None
34 self.EXP_CODE = None
35 self.SUB_EXP_CODE = None
35 self.SUB_EXP_CODE = None
36 self.PLOT_POS = None
36 self.PLOT_POS = None
37
37
38 def getSubplots(self):
38 def getSubplots(self):
39
39
40 ncol = 4
40 ncol = 4
41 nrow = self.nplots
41 nrow = self.nplots
42
42
43 return nrow, ncol
43 return nrow, ncol
44
44
45 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
45 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
46
46
47 self.__showprofile = showprofile
47 self.__showprofile = showprofile
48 self.nplots = nplots
48 self.nplots = nplots
49
49
50 ncolspan = 1
50 ncolspan = 1
51 colspan = 1
51 colspan = 1
52
52
53 self.createFigure(id = id,
53 self.createFigure(id = id,
54 wintitle = wintitle,
54 wintitle = wintitle,
55 widthplot = self.WIDTH + self.WIDTHPROF,
55 widthplot = self.WIDTH + self.WIDTHPROF,
56 heightplot = self.HEIGHT + self.HEIGHTPROF,
56 heightplot = self.HEIGHT + self.HEIGHTPROF,
57 show=True)
57 show=True)
58
58
59 nrow, ncol = self.getSubplots()
59 nrow, ncol = self.getSubplots()
60
60
61 counter = 0
61 counter = 0
62 for y in range(nrow):
62 for y in range(nrow):
63 for x in range(ncol):
63 for x in range(ncol):
64 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
64 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
65
65
66 counter += 1
66 counter += 1
67
67
68 def run(self, dataOut, id, wintitle="", pairsList=None,
68 def run(self, dataOut, id, wintitle="", pairsList=None,
69 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
69 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
70 save=False, figpath='./', figfile=None, ftp=False, wr_period=1,
70 save=False, figpath='./', figfile=None, ftp=False, wr_period=1,
71 power_cmap='jet', coherence_cmap='jet', phase_cmap='RdBu_r', show=True,
71 power_cmap='jet', coherence_cmap='jet', phase_cmap='RdBu_r', show=True,
72 server=None, folder=None, username=None, password=None,
72 server=None, folder=None, username=None, password=None,
73 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
73 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
74
74
75 """
75 """
76
76
77 Input:
77 Input:
78 dataOut :
78 dataOut :
79 id :
79 id :
80 wintitle :
80 wintitle :
81 channelList :
81 channelList :
82 showProfile :
82 showProfile :
83 xmin : None,
83 xmin : None,
84 xmax : None,
84 xmax : None,
85 ymin : None,
85 ymin : None,
86 ymax : None,
86 ymax : None,
87 zmin : None,
87 zmin : None,
88 zmax : None
88 zmax : None
89 """
89 """
90
90
91 if pairsList == None:
91 if pairsList == None:
92 pairsIndexList = dataOut.pairsIndexList
92 pairsIndexList = dataOut.pairsIndexList
93 else:
93 else:
94 pairsIndexList = []
94 pairsIndexList = []
95 for pair in pairsList:
95 for pair in pairsList:
96 if pair not in dataOut.pairsList:
96 if pair not in dataOut.pairsList:
97 raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair)
97 raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair)
98 pairsIndexList.append(dataOut.pairsList.index(pair))
98 pairsIndexList.append(dataOut.pairsList.index(pair))
99
99
100 if pairsIndexList == []:
100 if pairsIndexList == []:
101 return
101 return
102
102
103 if len(pairsIndexList) > 4:
103 if len(pairsIndexList) > 4:
104 pairsIndexList = pairsIndexList[0:4]
104 pairsIndexList = pairsIndexList[0:4]
105 #factor = dataOut.normFactor
105 #factor = dataOut.normFactor
106 x = dataOut.getVelRange(1)
106 x = dataOut.getVelRange(1)
107 y = dataOut.getHeiRange()
107 y = dataOut.getHeiRange()
108 z = dataOut.data_spc[:,:,:]#/factor
108 z = dataOut.data_spc[:,:,:]#/factor
109 # z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
109 # z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
110 avg = numpy.abs(numpy.average(z, axis=1))
110 avg = numpy.abs(numpy.average(z, axis=1))
111 noise = dataOut.getNoise()#/factor
111 noise = dataOut.getNoise()#/factor
112
112
113 zdB = 10*numpy.log10(z)
113 zdB = 10*numpy.log10(z)
114 avgdB = 10*numpy.log10(avg)
114 avgdB = 10*numpy.log10(avg)
115 noisedB = 10*numpy.log10(noise)
115 noisedB = 10*numpy.log10(noise)
116
116
117
117
118 #thisDatetime = dataOut.datatime
118 #thisDatetime = dataOut.datatime
119 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
119 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
120 title = wintitle + " Cross-Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
120 title = wintitle + " Cross-Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
121 xlabel = "Velocity (m/s)"
121 xlabel = "Velocity (m/s)"
122 ylabel = "Range (Km)"
122 ylabel = "Range (Km)"
123
123
124 if not self.__isConfig:
124 if not self.__isConfig:
125
125
126 nplots = len(pairsIndexList)
126 nplots = len(pairsIndexList)
127
127
128 self.setup(id=id,
128 self.setup(id=id,
129 nplots=nplots,
129 nplots=nplots,
130 wintitle=wintitle,
130 wintitle=wintitle,
131 showprofile=False,
131 showprofile=False,
132 show=show)
132 show=show)
133
133
134 if xmin == None: xmin = numpy.nanmin(x)
134 if xmin == None: xmin = numpy.nanmin(x)
135 if xmax == None: xmax = numpy.nanmax(x)
135 if xmax == None: xmax = numpy.nanmax(x)
136 if ymin == None: ymin = numpy.nanmin(y)
136 if ymin == None: ymin = numpy.nanmin(y)
137 if ymax == None: ymax = numpy.nanmax(y)
137 if ymax == None: ymax = numpy.nanmax(y)
138 if zmin == None: zmin = numpy.nanmin(avgdB)*0.9
138 if zmin == None: zmin = numpy.nanmin(avgdB)*0.9
139 if zmax == None: zmax = numpy.nanmax(avgdB)*0.9
139 if zmax == None: zmax = numpy.nanmax(avgdB)*0.9
140
140
141 self.FTP_WEI = ftp_wei
141 self.FTP_WEI = ftp_wei
142 self.EXP_CODE = exp_code
142 self.EXP_CODE = exp_code
143 self.SUB_EXP_CODE = sub_exp_code
143 self.SUB_EXP_CODE = sub_exp_code
144 self.PLOT_POS = plot_pos
144 self.PLOT_POS = plot_pos
145
145
146 self.__isConfig = True
146 self.__isConfig = True
147
147
148 self.setWinTitle(title)
148 self.setWinTitle(title)
149
149
150 for i in range(self.nplots):
150 for i in range(self.nplots):
151 pair = dataOut.pairsList[pairsIndexList[i]]
151 pair = dataOut.pairsList[pairsIndexList[i]]
152 str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S"))
152 str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S"))
153 title = "Ch%d: %4.2fdB: %s" %(pair[0], noisedB[pair[0]], str_datetime)
153 title = "Ch%d: %4.2fdB: %s" %(pair[0], noisedB[pair[0]], str_datetime)
154 zdB = 10.*numpy.log10(dataOut.data_spc[pair[0],:,:])
154 zdB = 10.*numpy.log10(dataOut.data_spc[pair[0],:,:])
155 axes0 = self.axesList[i*self.__nsubplots]
155 axes0 = self.axesList[i*self.__nsubplots]
156 axes0.pcolor(x, y, zdB,
156 axes0.pcolor(x, y, zdB,
157 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
157 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
158 xlabel=xlabel, ylabel=ylabel, title=title,
158 xlabel=xlabel, ylabel=ylabel, title=title,
159 ticksize=9, colormap=power_cmap, cblabel='')
159 ticksize=9, colormap=power_cmap, cblabel='')
160
160
161 title = "Ch%d: %4.2fdB: %s" %(pair[1], noisedB[pair[1]], str_datetime)
161 title = "Ch%d: %4.2fdB: %s" %(pair[1], noisedB[pair[1]], str_datetime)
162 zdB = 10.*numpy.log10(dataOut.data_spc[pair[1],:,:])
162 zdB = 10.*numpy.log10(dataOut.data_spc[pair[1],:,:])
163 axes0 = self.axesList[i*self.__nsubplots+1]
163 axes0 = self.axesList[i*self.__nsubplots+1]
164 axes0.pcolor(x, y, zdB,
164 axes0.pcolor(x, y, zdB,
165 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
165 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
166 xlabel=xlabel, ylabel=ylabel, title=title,
166 xlabel=xlabel, ylabel=ylabel, title=title,
167 ticksize=9, colormap=power_cmap, cblabel='')
167 ticksize=9, colormap=power_cmap, cblabel='')
168
168
169 coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:])
169 coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:])
170 coherence = numpy.abs(coherenceComplex)
170 coherence = numpy.abs(coherenceComplex)
171 # phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
171 # phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
172 phase = numpy.arctan2(coherenceComplex.imag, coherenceComplex.real)*180/numpy.pi
172 phase = numpy.arctan2(coherenceComplex.imag, coherenceComplex.real)*180/numpy.pi
173
173
174 title = "Coherence %d%d" %(pair[0], pair[1])
174 title = "Coherence %d%d" %(pair[0], pair[1])
175 axes0 = self.axesList[i*self.__nsubplots+2]
175 axes0 = self.axesList[i*self.__nsubplots+2]
176 axes0.pcolor(x, y, coherence,
176 axes0.pcolor(x, y, coherence,
177 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1,
177 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1,
178 xlabel=xlabel, ylabel=ylabel, title=title,
178 xlabel=xlabel, ylabel=ylabel, title=title,
179 ticksize=9, colormap=coherence_cmap, cblabel='')
179 ticksize=9, colormap=coherence_cmap, cblabel='')
180
180
181 title = "Phase %d%d" %(pair[0], pair[1])
181 title = "Phase %d%d" %(pair[0], pair[1])
182 axes0 = self.axesList[i*self.__nsubplots+3]
182 axes0 = self.axesList[i*self.__nsubplots+3]
183 axes0.pcolor(x, y, phase,
183 axes0.pcolor(x, y, phase,
184 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
184 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
185 xlabel=xlabel, ylabel=ylabel, title=title,
185 xlabel=xlabel, ylabel=ylabel, title=title,
186 ticksize=9, colormap=phase_cmap, cblabel='')
186 ticksize=9, colormap=phase_cmap, cblabel='')
187
187
188
188
189
189
190 self.draw()
190 self.draw()
191
191
192 if save:
192 if save:
193
193
194 self.counter_imagwr += 1
194 self.counter_imagwr += 1
195 if (self.counter_imagwr==wr_period):
195 if (self.counter_imagwr==wr_period):
196 if figfile == None:
196 if figfile == None:
197 str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S")
197 str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S")
198 figfile = self.getFilename(name = str_datetime)
198 figfile = self.getFilename(name = str_datetime)
199
199
200 self.saveFigure(figpath, figfile)
200 self.saveFigure(figpath, figfile)
201
201
202 if ftp:
202 if ftp:
203 #provisionalmente envia archivos en el formato de la web en tiempo real
203 #provisionalmente envia archivos en el formato de la web en tiempo real
204 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
204 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
205 path = '%s%03d' %(self.PREFIX, self.id)
205 path = '%s%03d' %(self.PREFIX, self.id)
206 ftp_file = os.path.join(path,'ftp','%s.png'%name)
206 ftp_file = os.path.join(path,'ftp','%s.png'%name)
207 self.saveFigure(figpath, ftp_file)
207 self.saveFigure(figpath, ftp_file)
208 ftp_filename = os.path.join(figpath,ftp_file)
208 ftp_filename = os.path.join(figpath,ftp_file)
209
209
210 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
210 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
211 self.counter_imagwr = 0
211 self.counter_imagwr = 0
212
212
213 self.counter_imagwr = 0
213 self.counter_imagwr = 0
214
214
215
215
216 class RTIPlot(Figure):
216 class RTIPlot(Figure):
217
217
218 __isConfig = None
218 __isConfig = None
219 __nsubplots = None
219 __nsubplots = None
220
220
221 WIDTHPROF = None
221 WIDTHPROF = None
222 HEIGHTPROF = None
222 HEIGHTPROF = None
223 PREFIX = 'rti'
223 PREFIX = 'rti'
224
224
225 def __init__(self):
225 def __init__(self):
226
226
227 self.timerange = 2*60*60
227 self.timerange = 2*60*60
228 self.__isConfig = False
228 self.__isConfig = False
229 self.__nsubplots = 1
229 self.__nsubplots = 1
230
230
231 self.WIDTH = 800
231 self.WIDTH = 800
232 self.HEIGHT = 150
232 self.HEIGHT = 150
233 self.WIDTHPROF = 120
233 self.WIDTHPROF = 120
234 self.HEIGHTPROF = 0
234 self.HEIGHTPROF = 0
235 self.counter_imagwr = 0
235 self.counter_imagwr = 0
236
236
237 self.PLOT_CODE = 0
237 self.PLOT_CODE = 0
238 self.FTP_WEI = None
238 self.FTP_WEI = None
239 self.EXP_CODE = None
239 self.EXP_CODE = None
240 self.SUB_EXP_CODE = None
240 self.SUB_EXP_CODE = None
241 self.PLOT_POS = None
241 self.PLOT_POS = None
242
242
243 def getSubplots(self):
243 def getSubplots(self):
244
244
245 ncol = 1
245 ncol = 1
246 nrow = self.nplots
246 nrow = self.nplots
247
247
248 return nrow, ncol
248 return nrow, ncol
249
249
250 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
250 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
251
251
252 self.__showprofile = showprofile
252 self.__showprofile = showprofile
253 self.nplots = nplots
253 self.nplots = nplots
254
254
255 ncolspan = 1
255 ncolspan = 1
256 colspan = 1
256 colspan = 1
257 if showprofile:
257 if showprofile:
258 ncolspan = 7
258 ncolspan = 7
259 colspan = 6
259 colspan = 6
260 self.__nsubplots = 2
260 self.__nsubplots = 2
261
261
262 self.createFigure(id = id,
262 self.createFigure(id = id,
263 wintitle = wintitle,
263 wintitle = wintitle,
264 widthplot = self.WIDTH + self.WIDTHPROF,
264 widthplot = self.WIDTH + self.WIDTHPROF,
265 heightplot = self.HEIGHT + self.HEIGHTPROF,
265 heightplot = self.HEIGHT + self.HEIGHTPROF,
266 show=show)
266 show=show)
267
267
268 nrow, ncol = self.getSubplots()
268 nrow, ncol = self.getSubplots()
269
269
270 counter = 0
270 counter = 0
271 for y in range(nrow):
271 for y in range(nrow):
272 for x in range(ncol):
272 for x in range(ncol):
273
273
274 if counter >= self.nplots:
274 if counter >= self.nplots:
275 break
275 break
276
276
277 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
277 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
278
278
279 if showprofile:
279 if showprofile:
280 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
280 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
281
281
282 counter += 1
282 counter += 1
283
283
284 def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True',
284 def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True',
285 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
285 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
286 timerange=None,
286 timerange=None,
287 save=False, figpath='./', figfile=None, ftp=False, wr_period=1, show=True,
287 save=False, figpath='./', figfile=None, ftp=False, wr_period=1, show=True,
288 server=None, folder=None, username=None, password=None,
288 server=None, folder=None, username=None, password=None,
289 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
289 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
290
290
291 """
291 """
292
292
293 Input:
293 Input:
294 dataOut :
294 dataOut :
295 id :
295 id :
296 wintitle :
296 wintitle :
297 channelList :
297 channelList :
298 showProfile :
298 showProfile :
299 xmin : None,
299 xmin : None,
300 xmax : None,
300 xmax : None,
301 ymin : None,
301 ymin : None,
302 ymax : None,
302 ymax : None,
303 zmin : None,
303 zmin : None,
304 zmax : None
304 zmax : None
305 """
305 """
306
306
307 if channelList == None:
307 if channelList == None:
308 channelIndexList = dataOut.channelIndexList
308 channelIndexList = dataOut.channelIndexList
309 else:
309 else:
310 channelIndexList = []
310 channelIndexList = []
311 for channel in channelList:
311 for channel in channelList:
312 if channel not in dataOut.channelList:
312 if channel not in dataOut.channelList:
313 raise ValueError, "Channel %d is not in dataOut.channelList"
313 raise ValueError, "Channel %d is not in dataOut.channelList"
314 channelIndexList.append(dataOut.channelList.index(channel))
314 channelIndexList.append(dataOut.channelList.index(channel))
315
315
316 if timerange != None:
316 if timerange != None:
317 self.timerange = timerange
317 self.timerange = timerange
318
318
319 tmin = None
319 tmin = None
320 tmax = None
320 tmax = None
321 #factor = dataOut.normFactor
321 #factor = dataOut.normFactor
322 x = dataOut.getTimeRange()
322 x = dataOut.getTimeRange()
323 y = dataOut.getHeiRange()
323 y = dataOut.getHeiRange()
324
324
325 z = dataOut.data_spc[channelIndexList,:,:]#/factor
325 z = dataOut.data_spc[channelIndexList,:,:]#/factor
326 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
326 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
327 avg = numpy.average(z, axis=1)
327 avg = numpy.average(z, axis=1)
328
328
329 avgdB = 10.*numpy.log10(avg)
329 avgdB = 10.*numpy.log10(avg)
330
330
331
331
332 # thisDatetime = dataOut.datatime
332 # thisDatetime = dataOut.datatime
333 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
333 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
334 title = wintitle + " RTI" #: %s" %(thisDatetime.strftime("%d-%b-%Y"))
334 title = wintitle + " RTI" #: %s" %(thisDatetime.strftime("%d-%b-%Y"))
335 xlabel = ""
335 xlabel = ""
336 ylabel = "Range (Km)"
336 ylabel = "Range (Km)"
337
337
338 if not self.__isConfig:
338 if not self.__isConfig:
339
339
340 nplots = len(channelIndexList)
340 nplots = len(channelIndexList)
341
341
342 self.setup(id=id,
342 self.setup(id=id,
343 nplots=nplots,
343 nplots=nplots,
344 wintitle=wintitle,
344 wintitle=wintitle,
345 showprofile=showprofile,
345 showprofile=showprofile,
346 show=show)
346 show=show)
347
347
348 tmin, tmax = self.getTimeLim(x, xmin, xmax)
348 tmin, tmax = self.getTimeLim(x, xmin, xmax)
349 if ymin == None: ymin = numpy.nanmin(y)
349 if ymin == None: ymin = numpy.nanmin(y)
350 if ymax == None: ymax = numpy.nanmax(y)
350 if ymax == None: ymax = numpy.nanmax(y)
351 if zmin == None: zmin = numpy.nanmin(avgdB)*0.9
351 if zmin == None: zmin = numpy.nanmin(avgdB)*0.9
352 if zmax == None: zmax = numpy.nanmax(avgdB)*0.9
352 if zmax == None: zmax = numpy.nanmax(avgdB)*0.9
353
353
354 self.FTP_WEI = ftp_wei
354 self.FTP_WEI = ftp_wei
355 self.EXP_CODE = exp_code
355 self.EXP_CODE = exp_code
356 self.SUB_EXP_CODE = sub_exp_code
356 self.SUB_EXP_CODE = sub_exp_code
357 self.PLOT_POS = plot_pos
357 self.PLOT_POS = plot_pos
358
358
359 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
359 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
360 self.__isConfig = True
360 self.__isConfig = True
361
361
362
362
363 self.setWinTitle(title)
363 self.setWinTitle(title)
364
364
365 for i in range(self.nplots):
365 for i in range(self.nplots):
366 title = "Channel %d: %s" %(dataOut.channelList[i]+1, thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
366 title = "Channel %d: %s" %(dataOut.channelList[i]+1, thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
367 axes = self.axesList[i*self.__nsubplots]
367 axes = self.axesList[i*self.__nsubplots]
368 zdB = avgdB[i].reshape((1,-1))
368 zdB = avgdB[i].reshape((1,-1))
369 axes.pcolorbuffer(x, y, zdB,
369 axes.pcolorbuffer(x, y, zdB,
370 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
370 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
371 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
371 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
372 ticksize=9, cblabel='', cbsize="1%")
372 ticksize=9, cblabel='', cbsize="1%")
373
373
374 if self.__showprofile:
374 if self.__showprofile:
375 axes = self.axesList[i*self.__nsubplots +1]
375 axes = self.axesList[i*self.__nsubplots +1]
376 axes.pline(avgdB[i], y,
376 axes.pline(avgdB[i], y,
377 xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
377 xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
378 xlabel='dB', ylabel='', title='',
378 xlabel='dB', ylabel='', title='',
379 ytick_visible=False,
379 ytick_visible=False,
380 grid='x')
380 grid='x')
381
381
382 self.draw()
382 self.draw()
383
383
384 if save:
384 if save:
385
385
386 self.counter_imagwr += 1
386 self.counter_imagwr += 1
387 if (self.counter_imagwr==wr_period):
387 if (self.counter_imagwr==wr_period):
388 if figfile == None:
388 if figfile == None:
389 figfile = self.getFilename(name = self.name)
389 figfile = self.getFilename(name = self.name)
390 self.saveFigure(figpath, figfile)
390 self.saveFigure(figpath, figfile)
391
391
392 if ftp:
392 if ftp:
393 #provisionalmente envia archivos en el formato de la web en tiempo real
393 #provisionalmente envia archivos en el formato de la web en tiempo real
394 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
394 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
395 path = '%s%03d' %(self.PREFIX, self.id)
395 path = '%s%03d' %(self.PREFIX, self.id)
396 ftp_file = os.path.join(path,'ftp','%s.png'%name)
396 ftp_file = os.path.join(path,'ftp','%s.png'%name)
397 self.saveFigure(figpath, ftp_file)
397 self.saveFigure(figpath, ftp_file)
398 ftp_filename = os.path.join(figpath,ftp_file)
398 ftp_filename = os.path.join(figpath,ftp_file)
399 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
399 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
400 self.counter_imagwr = 0
400 self.counter_imagwr = 0
401
401
402 self.counter_imagwr = 0
402 self.counter_imagwr = 0
403
403
404 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
404 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
405 self.__isConfig = False
405 self.__isConfig = False
406
406
407 class SpectraPlot(Figure):
407 class SpectraPlot(Figure):
408
408
409 __isConfig = None
409 __isConfig = None
410 __nsubplots = None
410 __nsubplots = None
411
411
412 WIDTHPROF = None
412 WIDTHPROF = None
413 HEIGHTPROF = None
413 HEIGHTPROF = None
414 PREFIX = 'spc'
414 PREFIX = 'spc'
415
415
416 def __init__(self):
416 def __init__(self):
417
417
418 self.__isConfig = False
418 self.__isConfig = False
419 self.__nsubplots = 1
419 self.__nsubplots = 1
420
420
421 self.WIDTH = 280
421 self.WIDTH = 280
422 self.HEIGHT = 250
422 self.HEIGHT = 250
423 self.WIDTHPROF = 120
423 self.WIDTHPROF = 120
424 self.HEIGHTPROF = 0
424 self.HEIGHTPROF = 0
425 self.counter_imagwr = 0
425 self.counter_imagwr = 0
426
426
427 self.PLOT_CODE = 1
427 self.PLOT_CODE = 1
428 self.FTP_WEI = None
428 self.FTP_WEI = None
429 self.EXP_CODE = None
429 self.EXP_CODE = None
430 self.SUB_EXP_CODE = None
430 self.SUB_EXP_CODE = None
431 self.PLOT_POS = None
431 self.PLOT_POS = None
432
432
433 def getSubplots(self):
433 def getSubplots(self):
434
434
435 ncol = int(numpy.sqrt(self.nplots)+0.9)
435 ncol = int(numpy.sqrt(self.nplots)+0.9)
436 nrow = int(self.nplots*1./ncol + 0.9)
436 nrow = int(self.nplots*1./ncol + 0.9)
437
437
438 return nrow, ncol
438 return nrow, ncol
439
439
440 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
440 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
441
441
442 self.__showprofile = showprofile
442 self.__showprofile = showprofile
443 self.nplots = nplots
443 self.nplots = nplots
444
444
445 ncolspan = 1
445 ncolspan = 1
446 colspan = 1
446 colspan = 1
447 if showprofile:
447 if showprofile:
448 ncolspan = 3
448 ncolspan = 3
449 colspan = 2
449 colspan = 2
450 self.__nsubplots = 2
450 self.__nsubplots = 2
451
451
452 self.createFigure(id = id,
452 self.createFigure(id = id,
453 wintitle = wintitle,
453 wintitle = wintitle,
454 widthplot = self.WIDTH + self.WIDTHPROF,
454 widthplot = self.WIDTH + self.WIDTHPROF,
455 heightplot = self.HEIGHT + self.HEIGHTPROF,
455 heightplot = self.HEIGHT + self.HEIGHTPROF,
456 show=show)
456 show=show)
457
457
458 nrow, ncol = self.getSubplots()
458 nrow, ncol = self.getSubplots()
459
459
460 counter = 0
460 counter = 0
461 for y in range(nrow):
461 for y in range(nrow):
462 for x in range(ncol):
462 for x in range(ncol):
463
463
464 if counter >= self.nplots:
464 if counter >= self.nplots:
465 break
465 break
466
466
467 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
467 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
468
468
469 if showprofile:
469 if showprofile:
470 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
470 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
471
471
472 counter += 1
472 counter += 1
473
473
474 def run(self, dataOut, id, wintitle="", channelList=None, showprofile=True,
474 def run(self, dataOut, id, wintitle="", channelList=None, showprofile=True,
475 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
475 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
476 save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
476 save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
477 server=None, folder=None, username=None, password=None,
477 server=None, folder=None, username=None, password=None,
478 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False):
478 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False):
479
479
480 """
480 """
481
481
482 Input:
482 Input:
483 dataOut :
483 dataOut :
484 id :
484 id :
485 wintitle :
485 wintitle :
486 channelList :
486 channelList :
487 showProfile :
487 showProfile :
488 xmin : None,
488 xmin : None,
489 xmax : None,
489 xmax : None,
490 ymin : None,
490 ymin : None,
491 ymax : None,
491 ymax : None,
492 zmin : None,
492 zmin : None,
493 zmax : None
493 zmax : None
494 """
494 """
495
495
496 if realtime:
496 if realtime:
497 if not(isRealtime(utcdatatime = dataOut.utctime)):
497 if not(isRealtime(utcdatatime = dataOut.utctime)):
498 print 'Skipping this plot function'
498 print 'Skipping this plot function'
499 return
499 return
500
500
501 if channelList == None:
501 if channelList == None:
502 channelIndexList = dataOut.channelIndexList
502 channelIndexList = dataOut.channelIndexList
503 else:
503 else:
504 channelIndexList = []
504 channelIndexList = []
505 for channel in channelList:
505 for channel in channelList:
506 if channel not in dataOut.channelList:
506 if channel not in dataOut.channelList:
507 raise ValueError, "Channel %d is not in dataOut.channelList"
507 raise ValueError, "Channel %d is not in dataOut.channelList"
508 channelIndexList.append(dataOut.channelList.index(channel))
508 channelIndexList.append(dataOut.channelList.index(channel))
509 #factor = dataOut.normFactor
509 #factor = dataOut.normFactor
510 x = dataOut.getVelRange(1)
510 x = dataOut.getVelRange(1)
511 y = dataOut.getHeiRange()
511 y = dataOut.getHeiRange()
512
512
513 z = dataOut.data_spc[channelIndexList,:,:]#/factor
513 z = dataOut.data_spc[channelIndexList,:,:]#/factor
514 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
514 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
515 avg = numpy.average(z, axis=1)
515 avg = numpy.average(z, axis=1)
516 noise = dataOut.getNoise()#/factor
516 noise = dataOut.getNoise()#/factor
517
517
518 zdB = 10*numpy.log10(z)
518 zdB = 10*numpy.log10(z)
519 avgdB = 10*numpy.log10(avg)
519 avgdB = 10*numpy.log10(avg)
520 noisedB = 10*numpy.log10(noise)
520 noisedB = 10*numpy.log10(noise)
521
521
522 #thisDatetime = dataOut.datatime
522 #thisDatetime = dataOut.datatime
523 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
523 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
524 title = wintitle + " Spectra"
524 title = wintitle + " Spectra"
525 xlabel = "Velocity (m/s)"
525 xlabel = "Velocity (m/s)"
526 ylabel = "Range (Km)"
526 ylabel = "Range (Km)"
527
527
528 if not self.__isConfig:
528 if not self.__isConfig:
529
529
530 nplots = len(channelIndexList)
530 nplots = len(channelIndexList)
531
531
532 self.setup(id=id,
532 self.setup(id=id,
533 nplots=nplots,
533 nplots=nplots,
534 wintitle=wintitle,
534 wintitle=wintitle,
535 showprofile=showprofile,
535 showprofile=showprofile,
536 show=show)
536 show=show)
537
537
538 if xmin == None: xmin = numpy.nanmin(x)
538 if xmin == None: xmin = numpy.nanmin(x)
539 if xmax == None: xmax = numpy.nanmax(x)
539 if xmax == None: xmax = numpy.nanmax(x)
540 if ymin == None: ymin = numpy.nanmin(y)
540 if ymin == None: ymin = numpy.nanmin(y)
541 if ymax == None: ymax = numpy.nanmax(y)
541 if ymax == None: ymax = numpy.nanmax(y)
542 if zmin == None: zmin = numpy.nanmin(avgdB)*0.9
542 if zmin == None: zmin = numpy.nanmin(avgdB)*0.9
543 if zmax == None: zmax = numpy.nanmax(avgdB)*0.9
543 if zmax == None: zmax = numpy.nanmax(avgdB)*0.9
544
544
545 self.FTP_WEI = ftp_wei
545 self.FTP_WEI = ftp_wei
546 self.EXP_CODE = exp_code
546 self.EXP_CODE = exp_code
547 self.SUB_EXP_CODE = sub_exp_code
547 self.SUB_EXP_CODE = sub_exp_code
548 self.PLOT_POS = plot_pos
548 self.PLOT_POS = plot_pos
549
549
550 self.__isConfig = True
550 self.__isConfig = True
551
551
552 self.setWinTitle(title)
552 self.setWinTitle(title)
553
553
554 for i in range(self.nplots):
554 for i in range(self.nplots):
555 str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S"))
555 str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S"))
556 title = "Channel %d: %4.2fdB: %s" %(dataOut.channelList[i]+1, noisedB[i], str_datetime)
556 title = "Channel %d: %4.2fdB: %s" %(dataOut.channelList[i]+1, noisedB[i], str_datetime)
557 axes = self.axesList[i*self.__nsubplots]
557 axes = self.axesList[i*self.__nsubplots]
558 axes.pcolor(x, y, zdB[i,:,:],
558 axes.pcolor(x, y, zdB[i,:,:],
559 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
559 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
560 xlabel=xlabel, ylabel=ylabel, title=title,
560 xlabel=xlabel, ylabel=ylabel, title=title,
561 ticksize=9, cblabel='')
561 ticksize=9, cblabel='')
562
562
563 if self.__showprofile:
563 if self.__showprofile:
564 axes = self.axesList[i*self.__nsubplots +1]
564 axes = self.axesList[i*self.__nsubplots +1]
565 axes.pline(avgdB[i], y,
565 axes.pline(avgdB[i], y,
566 xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
566 xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
567 xlabel='dB', ylabel='', title='',
567 xlabel='dB', ylabel='', title='',
568 ytick_visible=False,
568 ytick_visible=False,
569 grid='x')
569 grid='x')
570
570
571 noiseline = numpy.repeat(noisedB[i], len(y))
571 noiseline = numpy.repeat(noisedB[i], len(y))
572 axes.addpline(noiseline, y, idline=1, color="black", linestyle="dashed", lw=2)
572 axes.addpline(noiseline, y, idline=1, color="black", linestyle="dashed", lw=2)
573
573
574 self.draw()
574 self.draw()
575
575
576 if save:
576 if save:
577
577
578 self.counter_imagwr += 1
578 self.counter_imagwr += 1
579 if (self.counter_imagwr==wr_period):
579 if (self.counter_imagwr==wr_period):
580 if figfile == None:
580 if figfile == None:
581 str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S")
581 str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S")
582 figfile = self.getFilename(name = str_datetime)
582 figfile = self.getFilename(name = str_datetime)
583
583
584 self.saveFigure(figpath, figfile)
584 self.saveFigure(figpath, figfile)
585
585
586 if ftp:
586 if ftp:
587 #provisionalmente envia archivos en el formato de la web en tiempo real
587 #provisionalmente envia archivos en el formato de la web en tiempo real
588 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
588 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
589 path = '%s%03d' %(self.PREFIX, self.id)
589 path = '%s%03d' %(self.PREFIX, self.id)
590 ftp_file = os.path.join(path,'ftp','%s.png'%name)
590 ftp_file = os.path.join(path,'ftp','%s.png'%name)
591 self.saveFigure(figpath, ftp_file)
591 self.saveFigure(figpath, ftp_file)
592 ftp_filename = os.path.join(figpath,ftp_file)
592 ftp_filename = os.path.join(figpath,ftp_file)
593 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
593 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
594 self.counter_imagwr = 0
594 self.counter_imagwr = 0
595
595
596
596
597 self.counter_imagwr = 0
597 self.counter_imagwr = 0
598
598
599
599
600 class Scope(Figure):
600 class Scope(Figure):
601
601
602 __isConfig = None
602 __isConfig = None
603
603
604 def __init__(self):
604 def __init__(self):
605
605
606 self.__isConfig = False
606 self.__isConfig = False
607 self.WIDTH = 600
607 self.WIDTH = 600
608 self.HEIGHT = 200
608 self.HEIGHT = 200
609 self.counter_imagwr = 0
609 self.counter_imagwr = 0
610
610
611 def getSubplots(self):
611 def getSubplots(self):
612
612
613 nrow = self.nplots
613 nrow = self.nplots
614 ncol = 3
614 ncol = 3
615 return nrow, ncol
615 return nrow, ncol
616
616
617 def setup(self, id, nplots, wintitle, show):
617 def setup(self, id, nplots, wintitle, show):
618
618
619 self.nplots = nplots
619 self.nplots = nplots
620
620
621 self.createFigure(id=id,
621 self.createFigure(id=id,
622 wintitle=wintitle,
622 wintitle=wintitle,
623 show=show)
623 show=show)
624
624
625 nrow,ncol = self.getSubplots()
625 nrow,ncol = self.getSubplots()
626 colspan = 3
626 colspan = 3
627 rowspan = 1
627 rowspan = 1
628
628
629 for i in range(nplots):
629 for i in range(nplots):
630 self.addAxes(nrow, ncol, i, 0, colspan, rowspan)
630 self.addAxes(nrow, ncol, i, 0, colspan, rowspan)
631
631
632
632
633
633
634 def run(self, dataOut, id, wintitle="", channelList=None,
634 def run(self, dataOut, id, wintitle="", channelList=None,
635 xmin=None, xmax=None, ymin=None, ymax=None, save=False,
635 xmin=None, xmax=None, ymin=None, ymax=None, save=False,
636 figpath='./', figfile=None, show=True, wr_period=1,
636 figpath='./', figfile=None, show=True, wr_period=1,
637 server=None, folder=None, username=None, password=None):
637 server=None, folder=None, username=None, password=None):
638
638
639 """
639 """
640
640
641 Input:
641 Input:
642 dataOut :
642 dataOut :
643 id :
643 id :
644 wintitle :
644 wintitle :
645 channelList :
645 channelList :
646 xmin : None,
646 xmin : None,
647 xmax : None,
647 xmax : None,
648 ymin : None,
648 ymin : None,
649 ymax : None,
649 ymax : None,
650 """
650 """
651
651
652 if channelList == None:
652 if channelList == None:
653 channelIndexList = dataOut.channelIndexList
653 channelIndexList = dataOut.channelIndexList
654 else:
654 else:
655 channelIndexList = []
655 channelIndexList = []
656 for channel in channelList:
656 for channel in channelList:
657 if channel not in dataOut.channelList:
657 if channel not in dataOut.channelList:
658 raise ValueError, "Channel %d is not in dataOut.channelList"
658 raise ValueError, "Channel %d is not in dataOut.channelList"
659 channelIndexList.append(dataOut.channelList.index(channel))
659 channelIndexList.append(dataOut.channelList.index(channel))
660
660
661 x = dataOut.heightList
661 x = dataOut.heightList
662 y = dataOut.data[channelIndexList,:] * numpy.conjugate(dataOut.data[channelIndexList,:])
662 y = dataOut.data[channelIndexList,:] * numpy.conjugate(dataOut.data[channelIndexList,:])
663 y = y.real
663 y = y.real
664
664
665 #thisDatetime = dataOut.datatime
665 #thisDatetime = dataOut.datatime
666 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
666 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
667 title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
667 title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
668 xlabel = "Range (Km)"
668 xlabel = "Range (Km)"
669 ylabel = "Intensity"
669 ylabel = "Intensity"
670
670
671 if not self.__isConfig:
671 if not self.__isConfig:
672 nplots = len(channelIndexList)
672 nplots = len(channelIndexList)
673
673
674 self.setup(id=id,
674 self.setup(id=id,
675 nplots=nplots,
675 nplots=nplots,
676 wintitle=wintitle,
676 wintitle=wintitle,
677 show=show)
677 show=show)
678
678
679 if xmin == None: xmin = numpy.nanmin(x)
679 if xmin == None: xmin = numpy.nanmin(x)
680 if xmax == None: xmax = numpy.nanmax(x)
680 if xmax == None: xmax = numpy.nanmax(x)
681 if ymin == None: ymin = numpy.nanmin(y)
681 if ymin == None: ymin = numpy.nanmin(y)
682 if ymax == None: ymax = numpy.nanmax(y)
682 if ymax == None: ymax = numpy.nanmax(y)
683
683
684 self.__isConfig = True
684 self.__isConfig = True
685
685
686 self.setWinTitle(title)
686 self.setWinTitle(title)
687
687
688 for i in range(len(self.axesList)):
688 for i in range(len(self.axesList)):
689 title = "Channel %d" %(i)
689 title = "Channel %d" %(i)
690 axes = self.axesList[i]
690 axes = self.axesList[i]
691 ychannel = y[i,:]
691 ychannel = y[i,:]
692 axes.pline(x, ychannel,
692 axes.pline(x, ychannel,
693 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
693 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
694 xlabel=xlabel, ylabel=ylabel, title=title)
694 xlabel=xlabel, ylabel=ylabel, title=title)
695
695
696 self.draw()
696 self.draw()
697
697
698 if save:
698 if save:
699 date = thisDatetime.strftime("%Y%m%d_%H%M%S")
699 date = thisDatetime.strftime("%Y%m%d_%H%M%S")
700 if figfile == None:
700 if figfile == None:
701 figfile = self.getFilename(name = date)
701 figfile = self.getFilename(name = date)
702
702
703 self.saveFigure(figpath, figfile)
703 self.saveFigure(figpath, figfile)
704
704
705 self.counter_imagwr += 1
705 self.counter_imagwr += 1
706 if (ftp and (self.counter_imagwr==wr_period)):
706 if (ftp and (self.counter_imagwr==wr_period)):
707 ftp_filename = os.path.join(figpath,figfile)
707 ftp_filename = os.path.join(figpath,figfile)
708 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
708 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
709 self.counter_imagwr = 0
709 self.counter_imagwr = 0
710
710
711 class PowerProfilePlot(Figure):
711 class PowerProfilePlot(Figure):
712 __isConfig = None
712 __isConfig = None
713 __nsubplots = None
713 __nsubplots = None
714
714
715 WIDTHPROF = None
715 WIDTHPROF = None
716 HEIGHTPROF = None
716 HEIGHTPROF = None
717 PREFIX = 'spcprofile'
717 PREFIX = 'spcprofile'
718
718
719 def __init__(self):
719 def __init__(self):
720 self.__isConfig = False
720 self.__isConfig = False
721 self.__nsubplots = 1
721 self.__nsubplots = 1
722
722
723 self.WIDTH = 300
723 self.WIDTH = 300
724 self.HEIGHT = 500
724 self.HEIGHT = 500
725 self.counter_imagwr = 0
725 self.counter_imagwr = 0
726
726
727 def getSubplots(self):
727 def getSubplots(self):
728 ncol = 1
728 ncol = 1
729 nrow = 1
729 nrow = 1
730
730
731 return nrow, ncol
731 return nrow, ncol
732
732
733 def setup(self, id, nplots, wintitle, show):
733 def setup(self, id, nplots, wintitle, show):
734
734
735 self.nplots = nplots
735 self.nplots = nplots
736
736
737 ncolspan = 1
737 ncolspan = 1
738 colspan = 1
738 colspan = 1
739
739
740 self.createFigure(id = id,
740 self.createFigure(id = id,
741 wintitle = wintitle,
741 wintitle = wintitle,
742 widthplot = self.WIDTH,
742 widthplot = self.WIDTH,
743 heightplot = self.HEIGHT,
743 heightplot = self.HEIGHT,
744 show=show)
744 show=show)
745
745
746 nrow, ncol = self.getSubplots()
746 nrow, ncol = self.getSubplots()
747
747
748 counter = 0
748 counter = 0
749 for y in range(nrow):
749 for y in range(nrow):
750 for x in range(ncol):
750 for x in range(ncol):
751 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
751 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
752
752
753 def run(self, dataOut, id, wintitle="", channelList=None,
753 def run(self, dataOut, id, wintitle="", channelList=None,
754 xmin=None, xmax=None, ymin=None, ymax=None,
754 xmin=None, xmax=None, ymin=None, ymax=None,
755 save=False, figpath='./', figfile=None, show=True, wr_period=1,
755 save=False, figpath='./', figfile=None, show=True, wr_period=1,
756 server=None, folder=None, username=None, password=None,):
756 server=None, folder=None, username=None, password=None,):
757
757
758 if channelList == None:
758 if channelList == None:
759 channelIndexList = dataOut.channelIndexList
759 channelIndexList = dataOut.channelIndexList
760 channelList = dataOut.channelList
760 channelList = dataOut.channelList
761 else:
761 else:
762 channelIndexList = []
762 channelIndexList = []
763 for channel in channelList:
763 for channel in channelList:
764 if channel not in dataOut.channelList:
764 if channel not in dataOut.channelList:
765 raise ValueError, "Channel %d is not in dataOut.channelList"
765 raise ValueError, "Channel %d is not in dataOut.channelList"
766 channelIndexList.append(dataOut.channelList.index(channel))
766 channelIndexList.append(dataOut.channelList.index(channel))
767
767
768 #factor = dataOut.normFactor
768 #factor = dataOut.normFactor
769 y = dataOut.getHeiRange()
769 y = dataOut.getHeiRange()
770 x = dataOut.data_spc[channelIndexList,:,:]#/factor
770 x = dataOut.data_spc[channelIndexList,:,:]#/factor
771 x = numpy.where(numpy.isfinite(x), x, numpy.NAN)
771 x = numpy.where(numpy.isfinite(x), x, numpy.NAN)
772 avg = numpy.average(x, axis=1)
772 avg = numpy.average(x, axis=1)
773
773
774 avgdB = 10*numpy.log10(avg)
774 avgdB = 10*numpy.log10(avg)
775
775
776 #thisDatetime = dataOut.datatime
776 #thisDatetime = dataOut.datatime
777 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
777 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
778 title = wintitle + " Power Profile %s" %(thisDatetime.strftime("%d-%b-%Y"))
778 title = wintitle + " Power Profile %s" %(thisDatetime.strftime("%d-%b-%Y"))
779 xlabel = "dB"
779 xlabel = "dB"
780 ylabel = "Range (Km)"
780 ylabel = "Range (Km)"
781
781
782 if not self.__isConfig:
782 if not self.__isConfig:
783
783
784 nplots = 1
784 nplots = 1
785
785
786 self.setup(id=id,
786 self.setup(id=id,
787 nplots=nplots,
787 nplots=nplots,
788 wintitle=wintitle,
788 wintitle=wintitle,
789 show=show)
789 show=show)
790
790
791 if ymin == None: ymin = numpy.nanmin(y)
791 if ymin == None: ymin = numpy.nanmin(y)
792 if ymax == None: ymax = numpy.nanmax(y)
792 if ymax == None: ymax = numpy.nanmax(y)
793 if xmin == None: xmin = numpy.nanmin(avgdB)*0.9
793 if xmin == None: xmin = numpy.nanmin(avgdB)*0.9
794 if xmax == None: xmax = numpy.nanmax(avgdB)*0.9
794 if xmax == None: xmax = numpy.nanmax(avgdB)*0.9
795
795
796 self.__isConfig = True
796 self.__isConfig = True
797
797
798 self.setWinTitle(title)
798 self.setWinTitle(title)
799
799
800
800
801 title = "Power Profile: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
801 title = "Power Profile: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
802 axes = self.axesList[0]
802 axes = self.axesList[0]
803
803
804 legendlabels = ["channel %d"%x for x in channelList]
804 legendlabels = ["channel %d"%x for x in channelList]
805 axes.pmultiline(avgdB, y,
805 axes.pmultiline(avgdB, y,
806 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
806 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
807 xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels,
807 xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels,
808 ytick_visible=True, nxticks=5,
808 ytick_visible=True, nxticks=5,
809 grid='x')
809 grid='x')
810
810
811 self.draw()
811 self.draw()
812
812
813 if save:
813 if save:
814 date = thisDatetime.strftime("%Y%m%d")
814 date = thisDatetime.strftime("%Y%m%d")
815 if figfile == None:
815 if figfile == None:
816 figfile = self.getFilename(name = date)
816 figfile = self.getFilename(name = date)
817
817
818 self.saveFigure(figpath, figfile)
818 self.saveFigure(figpath, figfile)
819
819
820 self.counter_imagwr += 1
820 self.counter_imagwr += 1
821 if (ftp and (self.counter_imagwr==wr_period)):
821 if (ftp and (self.counter_imagwr==wr_period)):
822 ftp_filename = os.path.join(figpath,figfile)
822 ftp_filename = os.path.join(figpath,figfile)
823 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
823 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
824 self.counter_imagwr = 0
824 self.counter_imagwr = 0
825
825
826 class CoherenceMap(Figure):
826 class CoherenceMap(Figure):
827 __isConfig = None
827 __isConfig = None
828 __nsubplots = None
828 __nsubplots = None
829
829
830 WIDTHPROF = None
830 WIDTHPROF = None
831 HEIGHTPROF = None
831 HEIGHTPROF = None
832 PREFIX = 'cmap'
832 PREFIX = 'cmap'
833
833
834 def __init__(self):
834 def __init__(self):
835 self.timerange = 2*60*60
835 self.timerange = 2*60*60
836 self.__isConfig = False
836 self.__isConfig = False
837 self.__nsubplots = 1
837 self.__nsubplots = 1
838
838
839 self.WIDTH = 800
839 self.WIDTH = 800
840 self.HEIGHT = 150
840 self.HEIGHT = 150
841 self.WIDTHPROF = 120
841 self.WIDTHPROF = 120
842 self.HEIGHTPROF = 0
842 self.HEIGHTPROF = 0
843 self.counter_imagwr = 0
843 self.counter_imagwr = 0
844
844
845 self.PLOT_CODE = 3
845 self.PLOT_CODE = 3
846 self.FTP_WEI = None
846 self.FTP_WEI = None
847 self.EXP_CODE = None
847 self.EXP_CODE = None
848 self.SUB_EXP_CODE = None
848 self.SUB_EXP_CODE = None
849 self.PLOT_POS = None
849 self.PLOT_POS = None
850 self.counter_imagwr = 0
850 self.counter_imagwr = 0
851
851
852 def getSubplots(self):
852 def getSubplots(self):
853 ncol = 1
853 ncol = 1
854 nrow = self.nplots*2
854 nrow = self.nplots*2
855
855
856 return nrow, ncol
856 return nrow, ncol
857
857
858 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
858 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
859 self.__showprofile = showprofile
859 self.__showprofile = showprofile
860 self.nplots = nplots
860 self.nplots = nplots
861
861
862 ncolspan = 1
862 ncolspan = 1
863 colspan = 1
863 colspan = 1
864 if showprofile:
864 if showprofile:
865 ncolspan = 7
865 ncolspan = 7
866 colspan = 6
866 colspan = 6
867 self.__nsubplots = 2
867 self.__nsubplots = 2
868
868
869 self.createFigure(id = id,
869 self.createFigure(id = id,
870 wintitle = wintitle,
870 wintitle = wintitle,
871 widthplot = self.WIDTH + self.WIDTHPROF,
871 widthplot = self.WIDTH + self.WIDTHPROF,
872 heightplot = self.HEIGHT + self.HEIGHTPROF,
872 heightplot = self.HEIGHT + self.HEIGHTPROF,
873 show=True)
873 show=True)
874
874
875 nrow, ncol = self.getSubplots()
875 nrow, ncol = self.getSubplots()
876
876
877 for y in range(nrow):
877 for y in range(nrow):
878 for x in range(ncol):
878 for x in range(ncol):
879
879
880 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
880 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
881
881
882 if showprofile:
882 if showprofile:
883 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
883 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
884
884
885 def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True',
885 def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True',
886 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
886 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
887 timerange=None,
887 timerange=None,
888 save=False, figpath='./', figfile=None, ftp=False, wr_period=1,
888 save=False, figpath='./', figfile=None, ftp=False, wr_period=1,
889 coherence_cmap='jet', phase_cmap='RdBu_r', show=True,
889 coherence_cmap='jet', phase_cmap='RdBu_r', show=True,
890 server=None, folder=None, username=None, password=None,
890 server=None, folder=None, username=None, password=None,
891 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
891 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
892
892
893 if pairsList == None:
893 if pairsList == None:
894 pairsIndexList = dataOut.pairsIndexList
894 pairsIndexList = dataOut.pairsIndexList
895 else:
895 else:
896 pairsIndexList = []
896 pairsIndexList = []
897 for pair in pairsList:
897 for pair in pairsList:
898 if pair not in dataOut.pairsList:
898 if pair not in dataOut.pairsList:
899 raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair)
899 raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair)
900 pairsIndexList.append(dataOut.pairsList.index(pair))
900 pairsIndexList.append(dataOut.pairsList.index(pair))
901
901
902 if timerange != None:
902 if timerange != None:
903 self.timerange = timerange
903 self.timerange = timerange
904
904
905 if pairsIndexList == []:
905 if pairsIndexList == []:
906 return
906 return
907
907
908 if len(pairsIndexList) > 4:
908 if len(pairsIndexList) > 4:
909 pairsIndexList = pairsIndexList[0:4]
909 pairsIndexList = pairsIndexList[0:4]
910
910
911 tmin = None
911 tmin = None
912 tmax = None
912 tmax = None
913 x = dataOut.getTimeRange()
913 x = dataOut.getTimeRange()
914 y = dataOut.getHeiRange()
914 y = dataOut.getHeiRange()
915
915
916 #thisDatetime = dataOut.datatime
916 #thisDatetime = dataOut.datatime
917 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
917 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
918 title = wintitle + " CoherenceMap" #: %s" %(thisDatetime.strftime("%d-%b-%Y"))
918 title = wintitle + " CoherenceMap" #: %s" %(thisDatetime.strftime("%d-%b-%Y"))
919 xlabel = ""
919 xlabel = ""
920 ylabel = "Range (Km)"
920 ylabel = "Range (Km)"
921
921
922 if not self.__isConfig:
922 if not self.__isConfig:
923 nplots = len(pairsIndexList)
923 nplots = len(pairsIndexList)
924 self.setup(id=id,
924 self.setup(id=id,
925 nplots=nplots,
925 nplots=nplots,
926 wintitle=wintitle,
926 wintitle=wintitle,
927 showprofile=showprofile,
927 showprofile=showprofile,
928 show=show)
928 show=show)
929
929
930 tmin, tmax = self.getTimeLim(x, xmin, xmax)
930 tmin, tmax = self.getTimeLim(x, xmin, xmax)
931 if ymin == None: ymin = numpy.nanmin(y)
931 if ymin == None: ymin = numpy.nanmin(y)
932 if ymax == None: ymax = numpy.nanmax(y)
932 if ymax == None: ymax = numpy.nanmax(y)
933 if zmin == None: zmin = 0.
933 if zmin == None: zmin = 0.
934 if zmax == None: zmax = 1.
934 if zmax == None: zmax = 1.
935
935
936 self.FTP_WEI = ftp_wei
936 self.FTP_WEI = ftp_wei
937 self.EXP_CODE = exp_code
937 self.EXP_CODE = exp_code
938 self.SUB_EXP_CODE = sub_exp_code
938 self.SUB_EXP_CODE = sub_exp_code
939 self.PLOT_POS = plot_pos
939 self.PLOT_POS = plot_pos
940
940
941 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
941 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
942
942
943 self.__isConfig = True
943 self.__isConfig = True
944
944
945 self.setWinTitle(title)
945 self.setWinTitle(title)
946
946
947 for i in range(self.nplots):
947 for i in range(self.nplots):
948
948
949 pair = dataOut.pairsList[pairsIndexList[i]]
949 pair = dataOut.pairsList[pairsIndexList[i]]
950 # coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:])
950 # coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:])
951 # avgcoherenceComplex = numpy.average(coherenceComplex, axis=0)
951 # avgcoherenceComplex = numpy.average(coherenceComplex, axis=0)
952 # coherence = numpy.abs(avgcoherenceComplex)
952 # coherence = numpy.abs(avgcoherenceComplex)
953
953
954 ## coherence = numpy.abs(coherenceComplex)
954 ## coherence = numpy.abs(coherenceComplex)
955 ## avg = numpy.average(coherence, axis=0)
955 ## avg = numpy.average(coherence, axis=0)
956
956
957 ccf = numpy.average(dataOut.data_cspc[pairsIndexList[i],:,:],axis=0)
957 ccf = numpy.average(dataOut.data_cspc[pairsIndexList[i],:,:],axis=0)
958 powa = numpy.average(dataOut.data_spc[pair[0],:,:],axis=0)
958 powa = numpy.average(dataOut.data_spc[pair[0],:,:],axis=0)
959 powb = numpy.average(dataOut.data_spc[pair[1],:,:],axis=0)
959 powb = numpy.average(dataOut.data_spc[pair[1],:,:],axis=0)
960
960
961
961
962 avgcoherenceComplex = ccf/numpy.sqrt(powa*powb)
962 avgcoherenceComplex = ccf/numpy.sqrt(powa*powb)
963 coherence = numpy.abs(avgcoherenceComplex)
963 coherence = numpy.abs(avgcoherenceComplex)
964
964
965 z = coherence.reshape((1,-1))
965 z = coherence.reshape((1,-1))
966
966
967 counter = 0
967 counter = 0
968
968
969 title = "Coherence %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
969 title = "Coherence %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
970 axes = self.axesList[i*self.__nsubplots*2]
970 axes = self.axesList[i*self.__nsubplots*2]
971 axes.pcolorbuffer(x, y, z,
971 axes.pcolorbuffer(x, y, z,
972 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
972 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
973 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
973 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
974 ticksize=9, cblabel='', colormap=coherence_cmap, cbsize="1%")
974 ticksize=9, cblabel='', colormap=coherence_cmap, cbsize="1%")
975
975
976 if self.__showprofile:
976 if self.__showprofile:
977 counter += 1
977 counter += 1
978 axes = self.axesList[i*self.__nsubplots*2 + counter]
978 axes = self.axesList[i*self.__nsubplots*2 + counter]
979 axes.pline(coherence, y,
979 axes.pline(coherence, y,
980 xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
980 xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
981 xlabel='', ylabel='', title='', ticksize=7,
981 xlabel='', ylabel='', title='', ticksize=7,
982 ytick_visible=False, nxticks=5,
982 ytick_visible=False, nxticks=5,
983 grid='x')
983 grid='x')
984
984
985 counter += 1
985 counter += 1
986 # phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
986 # phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
987 phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi
987 phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi
988 # avg = numpy.average(phase, axis=0)
988 # avg = numpy.average(phase, axis=0)
989 z = phase.reshape((1,-1))
989 z = phase.reshape((1,-1))
990
990
991 title = "Phase %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
991 title = "Phase %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
992 axes = self.axesList[i*self.__nsubplots*2 + counter]
992 axes = self.axesList[i*self.__nsubplots*2 + counter]
993 axes.pcolorbuffer(x, y, z,
993 axes.pcolorbuffer(x, y, z,
994 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
994 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
995 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
995 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
996 ticksize=9, cblabel='', colormap=phase_cmap, cbsize="1%")
996 ticksize=9, cblabel='', colormap=phase_cmap, cbsize="1%")
997
997
998 if self.__showprofile:
998 if self.__showprofile:
999 counter += 1
999 counter += 1
1000 axes = self.axesList[i*self.__nsubplots*2 + counter]
1000 axes = self.axesList[i*self.__nsubplots*2 + counter]
1001 axes.pline(phase, y,
1001 axes.pline(phase, y,
1002 xmin=-180, xmax=180, ymin=ymin, ymax=ymax,
1002 xmin=-180, xmax=180, ymin=ymin, ymax=ymax,
1003 xlabel='', ylabel='', title='', ticksize=7,
1003 xlabel='', ylabel='', title='', ticksize=7,
1004 ytick_visible=False, nxticks=4,
1004 ytick_visible=False, nxticks=4,
1005 grid='x')
1005 grid='x')
1006
1006
1007 self.draw()
1007 self.draw()
1008
1008
1009 if save:
1009 if save:
1010
1010
1011 self.counter_imagwr += 1
1011 self.counter_imagwr += 1
1012 if (self.counter_imagwr==wr_period):
1012 if (self.counter_imagwr==wr_period):
1013 if figfile == None:
1013 if figfile == None:
1014 figfile = self.getFilename(name = self.name)
1014 figfile = self.getFilename(name = self.name)
1015 self.saveFigure(figpath, figfile)
1015 self.saveFigure(figpath, figfile)
1016
1016
1017 if ftp:
1017 if ftp:
1018 #provisionalmente envia archivos en el formato de la web en tiempo real
1018 #provisionalmente envia archivos en el formato de la web en tiempo real
1019 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
1019 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
1020 path = '%s%03d' %(self.PREFIX, self.id)
1020 path = '%s%03d' %(self.PREFIX, self.id)
1021 ftp_file = os.path.join(path,'ftp','%s.png'%name)
1021 ftp_file = os.path.join(path,'ftp','%s.png'%name)
1022 self.saveFigure(figpath, ftp_file)
1022 self.saveFigure(figpath, ftp_file)
1023 ftp_filename = os.path.join(figpath,ftp_file)
1023 ftp_filename = os.path.join(figpath,ftp_file)
1024 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
1024 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
1025 self.counter_imagwr = 0
1025 self.counter_imagwr = 0
1026
1026
1027 self.counter_imagwr = 0
1027 self.counter_imagwr = 0
1028
1028
1029
1029
1030 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
1030 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
1031 self.__isConfig = False
1031 self.__isConfig = False
1032
1032
1033 class BeaconPhase(Figure):
1033 class BeaconPhase(Figure):
1034
1034
1035 __isConfig = None
1035 __isConfig = None
1036 __nsubplots = None
1036 __nsubplots = None
1037
1037
1038 PREFIX = 'beacon_phase'
1038 PREFIX = 'beacon_phase'
1039
1039
1040 def __init__(self):
1040 def __init__(self):
1041
1041
1042 self.timerange = 24*60*60
1042 self.timerange = 24*60*60
1043 self.__isConfig = False
1043 self.__isConfig = False
1044 self.__nsubplots = 1
1044 self.__nsubplots = 1
1045 self.counter_imagwr = 0
1045 self.counter_imagwr = 0
1046 self.WIDTH = 600
1046 self.WIDTH = 600
1047 self.HEIGHT = 300
1047 self.HEIGHT = 300
1048 self.WIDTHPROF = 120
1048 self.WIDTHPROF = 120
1049 self.HEIGHTPROF = 0
1049 self.HEIGHTPROF = 0
1050 self.xdata = None
1050 self.xdata = None
1051 self.ydata = None
1051 self.ydata = None
1052
1052
1053 self.PLOT_CODE = 999999
1053 self.PLOT_CODE = 18
1054 self.FTP_WEI = None
1054 self.FTP_WEI = None
1055 self.EXP_CODE = None
1055 self.EXP_CODE = None
1056 self.SUB_EXP_CODE = None
1056 self.SUB_EXP_CODE = None
1057 self.PLOT_POS = None
1057 self.PLOT_POS = None
1058
1058
1059 def getSubplots(self):
1059 def getSubplots(self):
1060
1060
1061 ncol = 1
1061 ncol = 1
1062 nrow = 1
1062 nrow = 1
1063
1063
1064 return nrow, ncol
1064 return nrow, ncol
1065
1065
1066 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
1066 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
1067
1067
1068 self.__showprofile = showprofile
1068 self.__showprofile = showprofile
1069 self.nplots = nplots
1069 self.nplots = nplots
1070
1070
1071 ncolspan = 7
1071 ncolspan = 7
1072 colspan = 6
1072 colspan = 6
1073 self.__nsubplots = 2
1073 self.__nsubplots = 2
1074
1074
1075 self.createFigure(id = id,
1075 self.createFigure(id = id,
1076 wintitle = wintitle,
1076 wintitle = wintitle,
1077 widthplot = self.WIDTH+self.WIDTHPROF,
1077 widthplot = self.WIDTH+self.WIDTHPROF,
1078 heightplot = self.HEIGHT+self.HEIGHTPROF,
1078 heightplot = self.HEIGHT+self.HEIGHTPROF,
1079 show=show)
1079 show=show)
1080
1080
1081 nrow, ncol = self.getSubplots()
1081 nrow, ncol = self.getSubplots()
1082
1082
1083 self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1)
1083 self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1)
1084
1084
1085
1085
1086 def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True',
1086 def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True',
1087 xmin=None, xmax=None, ymin=None, ymax=None,
1087 xmin=None, xmax=None, ymin=None, ymax=None,
1088 timerange=None,
1088 timerange=None,
1089 save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
1089 save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
1090 server=None, folder=None, username=None, password=None,
1090 server=None, folder=None, username=None, password=None,
1091 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
1091 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
1092
1092
1093 if pairsList == None:
1093 if pairsList == None:
1094 pairsIndexList = dataOut.pairsIndexList
1094 pairsIndexList = dataOut.pairsIndexList
1095 else:
1095 else:
1096 pairsIndexList = []
1096 pairsIndexList = []
1097 for pair in pairsList:
1097 for pair in pairsList:
1098 if pair not in dataOut.pairsList:
1098 if pair not in dataOut.pairsList:
1099 raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair)
1099 raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair)
1100 pairsIndexList.append(dataOut.pairsList.index(pair))
1100 pairsIndexList.append(dataOut.pairsList.index(pair))
1101
1101
1102 if pairsIndexList == []:
1102 if pairsIndexList == []:
1103 return
1103 return
1104
1104
1105 if len(pairsIndexList) > 4:
1105 # if len(pairsIndexList) > 4:
1106 pairsIndexList = pairsIndexList[0:4]
1106 # pairsIndexList = pairsIndexList[0:4]
1107
1107
1108 if timerange != None:
1108 if timerange != None:
1109 self.timerange = timerange
1109 self.timerange = timerange
1110
1110
1111 tmin = None
1111 tmin = None
1112 tmax = None
1112 tmax = None
1113 x = dataOut.getTimeRange()
1113 x = dataOut.getTimeRange()
1114 y = dataOut.getHeiRange()
1114 y = dataOut.getHeiRange()
1115
1115
1116
1116
1117 #thisDatetime = dataOut.datatime
1117 #thisDatetime = dataOut.datatime
1118 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
1118 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
1119 title = wintitle + " Phase of Beacon Signal" # : %s" %(thisDatetime.strftime("%d-%b-%Y"))
1119 title = wintitle + " Phase of Beacon Signal" # : %s" %(thisDatetime.strftime("%d-%b-%Y"))
1120 xlabel = "Local Time"
1120 xlabel = "Local Time"
1121 ylabel = "Phase"
1121 ylabel = "Phase"
1122
1122
1123 nplots = len(pairsIndexList)
1123 nplots = len(pairsIndexList)
1124 #phase = numpy.zeros((len(pairsIndexList),len(dataOut.beacon_heiIndexList)))
1124 #phase = numpy.zeros((len(pairsIndexList),len(dataOut.beacon_heiIndexList)))
1125 phase_beacon = numpy.zeros(len(pairsIndexList))
1125 phase_beacon = numpy.zeros(len(pairsIndexList))
1126 for i in range(nplots):
1126 for i in range(nplots):
1127 pair = dataOut.pairsList[pairsIndexList[i]]
1127 pair = dataOut.pairsList[pairsIndexList[i]]
1128 ccf = numpy.average(dataOut.data_cspc[pairsIndexList[i],:,:],axis=0)
1128 ccf = numpy.average(dataOut.data_cspc[pairsIndexList[i],:,:],axis=0)
1129 powa = numpy.average(dataOut.data_spc[pair[0],:,:],axis=0)
1129 powa = numpy.average(dataOut.data_spc[pair[0],:,:],axis=0)
1130 powb = numpy.average(dataOut.data_spc[pair[1],:,:],axis=0)
1130 powb = numpy.average(dataOut.data_spc[pair[1],:,:],axis=0)
1131 avgcoherenceComplex = ccf/numpy.sqrt(powa*powb)
1131 avgcoherenceComplex = ccf/numpy.sqrt(powa*powb)
1132 phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi
1132 phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi
1133
1133
1134 #print "Phase %d%d" %(pair[0], pair[1])
1134 #print "Phase %d%d" %(pair[0], pair[1])
1135 #print phase[dataOut.beacon_heiIndexList]
1135 #print phase[dataOut.beacon_heiIndexList]
1136
1136
1137 phase_beacon[i] = numpy.average(phase[dataOut.beacon_heiIndexList])
1137 phase_beacon[i] = numpy.average(phase[dataOut.beacon_heiIndexList])
1138
1138
1139 if not self.__isConfig:
1139 if not self.__isConfig:
1140
1140
1141 nplots = len(pairsIndexList)
1141 nplots = len(pairsIndexList)
1142
1142
1143 self.setup(id=id,
1143 self.setup(id=id,
1144 nplots=nplots,
1144 nplots=nplots,
1145 wintitle=wintitle,
1145 wintitle=wintitle,
1146 showprofile=showprofile,
1146 showprofile=showprofile,
1147 show=show)
1147 show=show)
1148
1148
1149 tmin, tmax = self.getTimeLim(x, xmin, xmax)
1149 tmin, tmax = self.getTimeLim(x, xmin, xmax)
1150 if ymin == None: ymin = numpy.nanmin(phase_beacon) - 10.0
1150 if ymin == None: ymin = numpy.nanmin(phase_beacon) - 10.0
1151 if ymax == None: ymax = numpy.nanmax(phase_beacon) + 10.0
1151 if ymax == None: ymax = numpy.nanmax(phase_beacon) + 10.0
1152
1152
1153 self.FTP_WEI = ftp_wei
1153 self.FTP_WEI = ftp_wei
1154 self.EXP_CODE = exp_code
1154 self.EXP_CODE = exp_code
1155 self.SUB_EXP_CODE = sub_exp_code
1155 self.SUB_EXP_CODE = sub_exp_code
1156 self.PLOT_POS = plot_pos
1156 self.PLOT_POS = plot_pos
1157
1157
1158 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
1158 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
1159
1160
1161 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
1162 self.__isConfig = True
1159 self.__isConfig = True
1163
1160
1164 self.xdata = numpy.array([])
1161 self.xdata = numpy.array([])
1165 self.ydata = numpy.array([])
1162 self.ydata = numpy.array([])
1166
1163
1167 self.setWinTitle(title)
1164 self.setWinTitle(title)
1168
1165
1169
1166
1170 title = "Beacon Signal %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
1167 title = "Beacon Signal %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
1171
1168
1172 legendlabels = ["pairs %d%d"%(pair[0], pair[1]) for pair in dataOut.pairsList]
1169 legendlabels = ["pairs %d%d"%(pair[0], pair[1]) for pair in dataOut.pairsList]
1173
1170
1174 axes = self.axesList[0]
1171 axes = self.axesList[0]
1175
1172
1176 self.xdata = numpy.hstack((self.xdata, x[0:1]))
1173 self.xdata = numpy.hstack((self.xdata, x[0:1]))
1177
1174
1178 if len(self.ydata)==0:
1175 if len(self.ydata)==0:
1179 self.ydata = phase_beacon.reshape(-1,1)
1176 self.ydata = phase_beacon.reshape(-1,1)
1180 else:
1177 else:
1181 self.ydata = numpy.hstack((self.ydata, phase_beacon.reshape(-1,1)))
1178 self.ydata = numpy.hstack((self.ydata, phase_beacon.reshape(-1,1)))
1182
1179
1183
1180
1184 axes.pmultilineyaxis(x=self.xdata, y=self.ydata,
1181 axes.pmultilineyaxis(x=self.xdata, y=self.ydata,
1185 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax,
1182 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax,
1186 xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid",
1183 xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid",
1187 XAxisAsTime=True, grid='both'
1184 XAxisAsTime=True, grid='both'
1188 )
1185 )
1189
1186
1190 self.draw()
1187 self.draw()
1188
1189 if save:
1190
1191 self.counter_imagwr += 1
1192 if (self.counter_imagwr==wr_period):
1193 if figfile == None:
1194 figfile = self.getFilename(name = self.name)
1195 self.saveFigure(figpath, figfile)
1196
1197 if ftp:
1198 #provisionalmente envia archivos en el formato de la web en tiempo real
1199 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
1200 path = '%s%03d' %(self.PREFIX, self.id)
1201 ftp_file = os.path.join(path,'ftp','%s.png'%name)
1202 self.saveFigure(figpath, ftp_file)
1203 ftp_filename = os.path.join(figpath,ftp_file)
1204 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
1205
1206 self.counter_imagwr = 0
1207
1208 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
1209 self.__isConfig = False
1210 del self.xdata
1211 del self.ydata
1212
1213
1191
1214
1192
1215
1193 class Noise(Figure):
1216 class Noise(Figure):
1194
1217
1195 __isConfig = None
1218 __isConfig = None
1196 __nsubplots = None
1219 __nsubplots = None
1197
1220
1198 PREFIX = 'noise'
1221 PREFIX = 'noise'
1199
1222
1200 def __init__(self):
1223 def __init__(self):
1201
1224
1202 self.timerange = 24*60*60
1225 self.timerange = 24*60*60
1203 self.__isConfig = False
1226 self.__isConfig = False
1204 self.__nsubplots = 1
1227 self.__nsubplots = 1
1205 self.counter_imagwr = 0
1228 self.counter_imagwr = 0
1206 self.WIDTH = 600
1229 self.WIDTH = 600
1207 self.HEIGHT = 300
1230 self.HEIGHT = 300
1208 self.WIDTHPROF = 120
1231 self.WIDTHPROF = 120
1209 self.HEIGHTPROF = 0
1232 self.HEIGHTPROF = 0
1210 self.xdata = None
1233 self.xdata = None
1211 self.ydata = None
1234 self.ydata = None
1212
1235
1213 self.PLOT_CODE = 77
1236 self.PLOT_CODE = 77
1214 self.FTP_WEI = None
1237 self.FTP_WEI = None
1215 self.EXP_CODE = None
1238 self.EXP_CODE = None
1216 self.SUB_EXP_CODE = None
1239 self.SUB_EXP_CODE = None
1217 self.PLOT_POS = None
1240 self.PLOT_POS = None
1218
1241
1219 def getSubplots(self):
1242 def getSubplots(self):
1220
1243
1221 ncol = 1
1244 ncol = 1
1222 nrow = 1
1245 nrow = 1
1223
1246
1224 return nrow, ncol
1247 return nrow, ncol
1225
1248
1226 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
1249 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
1227
1250
1228 self.__showprofile = showprofile
1251 self.__showprofile = showprofile
1229 self.nplots = nplots
1252 self.nplots = nplots
1230
1253
1231 ncolspan = 7
1254 ncolspan = 7
1232 colspan = 6
1255 colspan = 6
1233 self.__nsubplots = 2
1256 self.__nsubplots = 2
1234
1257
1235 self.createFigure(id = id,
1258 self.createFigure(id = id,
1236 wintitle = wintitle,
1259 wintitle = wintitle,
1237 widthplot = self.WIDTH+self.WIDTHPROF,
1260 widthplot = self.WIDTH+self.WIDTHPROF,
1238 heightplot = self.HEIGHT+self.HEIGHTPROF,
1261 heightplot = self.HEIGHT+self.HEIGHTPROF,
1239 show=show)
1262 show=show)
1240
1263
1241 nrow, ncol = self.getSubplots()
1264 nrow, ncol = self.getSubplots()
1242
1265
1243 self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1)
1266 self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1)
1244
1267
1245
1268
1246 def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True',
1269 def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True',
1247 xmin=None, xmax=None, ymin=None, ymax=None,
1270 xmin=None, xmax=None, ymin=None, ymax=None,
1248 timerange=None,
1271 timerange=None,
1249 save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
1272 save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
1250 server=None, folder=None, username=None, password=None,
1273 server=None, folder=None, username=None, password=None,
1251 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
1274 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
1252
1275
1253 if channelList == None:
1276 if channelList == None:
1254 channelIndexList = dataOut.channelIndexList
1277 channelIndexList = dataOut.channelIndexList
1255 channelList = dataOut.channelList
1278 channelList = dataOut.channelList
1256 else:
1279 else:
1257 channelIndexList = []
1280 channelIndexList = []
1258 for channel in channelList:
1281 for channel in channelList:
1259 if channel not in dataOut.channelList:
1282 if channel not in dataOut.channelList:
1260 raise ValueError, "Channel %d is not in dataOut.channelList"
1283 raise ValueError, "Channel %d is not in dataOut.channelList"
1261 channelIndexList.append(dataOut.channelList.index(channel))
1284 channelIndexList.append(dataOut.channelList.index(channel))
1262
1285
1263 if timerange != None:
1286 if timerange != None:
1264 self.timerange = timerange
1287 self.timerange = timerange
1265
1288
1266 tmin = None
1289 tmin = None
1267 tmax = None
1290 tmax = None
1268 x = dataOut.getTimeRange()
1291 x = dataOut.getTimeRange()
1269 y = dataOut.getHeiRange()
1292 y = dataOut.getHeiRange()
1270 #factor = dataOut.normFactor
1293 #factor = dataOut.normFactor
1271 noise = dataOut.getNoise()#/factor
1294 noise = dataOut.getNoise()#/factor
1272 noisedB = 10*numpy.log10(noise)
1295 noisedB = 10*numpy.log10(noise)
1273
1296
1274 #thisDatetime = dataOut.datatime
1297 #thisDatetime = dataOut.datatime
1275 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
1298 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
1276 title = wintitle + " Noise" # : %s" %(thisDatetime.strftime("%d-%b-%Y"))
1299 title = wintitle + " Noise" # : %s" %(thisDatetime.strftime("%d-%b-%Y"))
1277 xlabel = ""
1300 xlabel = ""
1278 ylabel = "Intensity (dB)"
1301 ylabel = "Intensity (dB)"
1279
1302
1280 if not self.__isConfig:
1303 if not self.__isConfig:
1281
1304
1282 nplots = 1
1305 nplots = 1
1283
1306
1284 self.setup(id=id,
1307 self.setup(id=id,
1285 nplots=nplots,
1308 nplots=nplots,
1286 wintitle=wintitle,
1309 wintitle=wintitle,
1287 showprofile=showprofile,
1310 showprofile=showprofile,
1288 show=show)
1311 show=show)
1289
1312
1290 tmin, tmax = self.getTimeLim(x, xmin, xmax)
1313 tmin, tmax = self.getTimeLim(x, xmin, xmax)
1291 if ymin == None: ymin = numpy.nanmin(noisedB) - 10.0
1314 if ymin == None: ymin = numpy.nanmin(noisedB) - 10.0
1292 if ymax == None: ymax = numpy.nanmax(noisedB) + 10.0
1315 if ymax == None: ymax = numpy.nanmax(noisedB) + 10.0
1293
1316
1294 self.FTP_WEI = ftp_wei
1317 self.FTP_WEI = ftp_wei
1295 self.EXP_CODE = exp_code
1318 self.EXP_CODE = exp_code
1296 self.SUB_EXP_CODE = sub_exp_code
1319 self.SUB_EXP_CODE = sub_exp_code
1297 self.PLOT_POS = plot_pos
1320 self.PLOT_POS = plot_pos
1298
1321
1299 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
1322 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
1300
1323
1301
1324
1302 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
1325 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
1303 self.__isConfig = True
1326 self.__isConfig = True
1304
1327
1305 self.xdata = numpy.array([])
1328 self.xdata = numpy.array([])
1306 self.ydata = numpy.array([])
1329 self.ydata = numpy.array([])
1307
1330
1308 self.setWinTitle(title)
1331 self.setWinTitle(title)
1309
1332
1310
1333
1311 title = "Noise %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
1334 title = "Noise %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
1312
1335
1313 legendlabels = ["channel %d"%(idchannel+1) for idchannel in channelList]
1336 legendlabels = ["channel %d"%(idchannel+1) for idchannel in channelList]
1314 axes = self.axesList[0]
1337 axes = self.axesList[0]
1315
1338
1316 self.xdata = numpy.hstack((self.xdata, x[0:1]))
1339 self.xdata = numpy.hstack((self.xdata, x[0:1]))
1317
1340
1318 if len(self.ydata)==0:
1341 if len(self.ydata)==0:
1319 self.ydata = noisedB[channelIndexList].reshape(-1,1)
1342 self.ydata = noisedB[channelIndexList].reshape(-1,1)
1320 else:
1343 else:
1321 self.ydata = numpy.hstack((self.ydata, noisedB[channelIndexList].reshape(-1,1)))
1344 self.ydata = numpy.hstack((self.ydata, noisedB[channelIndexList].reshape(-1,1)))
1322
1345
1323
1346
1324 axes.pmultilineyaxis(x=self.xdata, y=self.ydata,
1347 axes.pmultilineyaxis(x=self.xdata, y=self.ydata,
1325 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax,
1348 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax,
1326 xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid",
1349 xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid",
1327 XAxisAsTime=True, grid='both'
1350 XAxisAsTime=True, grid='both'
1328 )
1351 )
1329
1352
1330 self.draw()
1353 self.draw()
1331
1354
1332 # if save:
1355 # if save:
1333 #
1356 #
1334 # if figfile == None:
1357 # if figfile == None:
1335 # figfile = self.getFilename(name = self.name)
1358 # figfile = self.getFilename(name = self.name)
1336 #
1359 #
1337 # self.saveFigure(figpath, figfile)
1360 # self.saveFigure(figpath, figfile)
1338
1361
1339 if save:
1362 if save:
1340
1363
1341 self.counter_imagwr += 1
1364 self.counter_imagwr += 1
1342 if (self.counter_imagwr==wr_period):
1365 if (self.counter_imagwr==wr_period):
1343 if figfile == None:
1366 if figfile == None:
1344 figfile = self.getFilename(name = self.name)
1367 figfile = self.getFilename(name = self.name)
1345 self.saveFigure(figpath, figfile)
1368 self.saveFigure(figpath, figfile)
1346
1369
1347 if ftp:
1370 if ftp:
1348 #provisionalmente envia archivos en el formato de la web en tiempo real
1371 #provisionalmente envia archivos en el formato de la web en tiempo real
1349 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
1372 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
1350 path = '%s%03d' %(self.PREFIX, self.id)
1373 path = '%s%03d' %(self.PREFIX, self.id)
1351 ftp_file = os.path.join(path,'ftp','%s.png'%name)
1374 ftp_file = os.path.join(path,'ftp','%s.png'%name)
1352 self.saveFigure(figpath, ftp_file)
1375 self.saveFigure(figpath, ftp_file)
1353 ftp_filename = os.path.join(figpath,ftp_file)
1376 ftp_filename = os.path.join(figpath,ftp_file)
1354 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
1377 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
1355 self.counter_imagwr = 0
1378 self.counter_imagwr = 0
1356
1379
1357 self.counter_imagwr = 0
1380 self.counter_imagwr = 0
1358
1381
1359 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
1382 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
1360 self.__isConfig = False
1383 self.__isConfig = False
1361 del self.xdata
1384 del self.xdata
1362 del self.ydata
1385 del self.ydata
1363
1386
1364
1387
1365 class SpectraHeisScope(Figure):
1388 class SpectraHeisScope(Figure):
1366
1389
1367
1390
1368 __isConfig = None
1391 __isConfig = None
1369 __nsubplots = None
1392 __nsubplots = None
1370
1393
1371 WIDTHPROF = None
1394 WIDTHPROF = None
1372 HEIGHTPROF = None
1395 HEIGHTPROF = None
1373 PREFIX = 'spc'
1396 PREFIX = 'spc'
1374
1397
1375 def __init__(self):
1398 def __init__(self):
1376
1399
1377 self.__isConfig = False
1400 self.__isConfig = False
1378 self.__nsubplots = 1
1401 self.__nsubplots = 1
1379
1402
1380 self.WIDTH = 230
1403 self.WIDTH = 230
1381 self.HEIGHT = 250
1404 self.HEIGHT = 250
1382 self.WIDTHPROF = 120
1405 self.WIDTHPROF = 120
1383 self.HEIGHTPROF = 0
1406 self.HEIGHTPROF = 0
1384 self.counter_imagwr = 0
1407 self.counter_imagwr = 0
1385
1408
1386 def getSubplots(self):
1409 def getSubplots(self):
1387
1410
1388 ncol = int(numpy.sqrt(self.nplots)+0.9)
1411 ncol = int(numpy.sqrt(self.nplots)+0.9)
1389 nrow = int(self.nplots*1./ncol + 0.9)
1412 nrow = int(self.nplots*1./ncol + 0.9)
1390
1413
1391 return nrow, ncol
1414 return nrow, ncol
1392
1415
1393 def setup(self, id, nplots, wintitle, show):
1416 def setup(self, id, nplots, wintitle, show):
1394
1417
1395 showprofile = False
1418 showprofile = False
1396 self.__showprofile = showprofile
1419 self.__showprofile = showprofile
1397 self.nplots = nplots
1420 self.nplots = nplots
1398
1421
1399 ncolspan = 1
1422 ncolspan = 1
1400 colspan = 1
1423 colspan = 1
1401 if showprofile:
1424 if showprofile:
1402 ncolspan = 3
1425 ncolspan = 3
1403 colspan = 2
1426 colspan = 2
1404 self.__nsubplots = 2
1427 self.__nsubplots = 2
1405
1428
1406 self.createFigure(id = id,
1429 self.createFigure(id = id,
1407 wintitle = wintitle,
1430 wintitle = wintitle,
1408 widthplot = self.WIDTH + self.WIDTHPROF,
1431 widthplot = self.WIDTH + self.WIDTHPROF,
1409 heightplot = self.HEIGHT + self.HEIGHTPROF,
1432 heightplot = self.HEIGHT + self.HEIGHTPROF,
1410 show = show)
1433 show = show)
1411
1434
1412 nrow, ncol = self.getSubplots()
1435 nrow, ncol = self.getSubplots()
1413
1436
1414 counter = 0
1437 counter = 0
1415 for y in range(nrow):
1438 for y in range(nrow):
1416 for x in range(ncol):
1439 for x in range(ncol):
1417
1440
1418 if counter >= self.nplots:
1441 if counter >= self.nplots:
1419 break
1442 break
1420
1443
1421 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
1444 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
1422
1445
1423 if showprofile:
1446 if showprofile:
1424 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
1447 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
1425
1448
1426 counter += 1
1449 counter += 1
1427
1450
1428
1451
1429 def run(self, dataOut, id, wintitle="", channelList=None,
1452 def run(self, dataOut, id, wintitle="", channelList=None,
1430 xmin=None, xmax=None, ymin=None, ymax=None, save=False,
1453 xmin=None, xmax=None, ymin=None, ymax=None, save=False,
1431 figpath='./', figfile=None, ftp=False, wr_period=1, show=True,
1454 figpath='./', figfile=None, ftp=False, wr_period=1, show=True,
1432 server=None, folder=None, username=None, password=None):
1455 server=None, folder=None, username=None, password=None):
1433
1456
1434 """
1457 """
1435
1458
1436 Input:
1459 Input:
1437 dataOut :
1460 dataOut :
1438 id :
1461 id :
1439 wintitle :
1462 wintitle :
1440 channelList :
1463 channelList :
1441 xmin : None,
1464 xmin : None,
1442 xmax : None,
1465 xmax : None,
1443 ymin : None,
1466 ymin : None,
1444 ymax : None,
1467 ymax : None,
1445 """
1468 """
1446
1469
1447 if dataOut.realtime:
1470 if dataOut.realtime:
1448 if not(isRealtime(utcdatatime = dataOut.utctime)):
1471 if not(isRealtime(utcdatatime = dataOut.utctime)):
1449 print 'Skipping this plot function'
1472 print 'Skipping this plot function'
1450 return
1473 return
1451
1474
1452 if channelList == None:
1475 if channelList == None:
1453 channelIndexList = dataOut.channelIndexList
1476 channelIndexList = dataOut.channelIndexList
1454 else:
1477 else:
1455 channelIndexList = []
1478 channelIndexList = []
1456 for channel in channelList:
1479 for channel in channelList:
1457 if channel not in dataOut.channelList:
1480 if channel not in dataOut.channelList:
1458 raise ValueError, "Channel %d is not in dataOut.channelList"
1481 raise ValueError, "Channel %d is not in dataOut.channelList"
1459 channelIndexList.append(dataOut.channelList.index(channel))
1482 channelIndexList.append(dataOut.channelList.index(channel))
1460
1483
1461 # x = dataOut.heightList
1484 # x = dataOut.heightList
1462 c = 3E8
1485 c = 3E8
1463 deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
1486 deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
1464 #deberia cambiar para el caso de 1Mhz y 100KHz
1487 #deberia cambiar para el caso de 1Mhz y 100KHz
1465 x = numpy.arange(-1*dataOut.nHeights/2.,dataOut.nHeights/2.)*(c/(2*deltaHeight*dataOut.nHeights*1000))
1488 x = numpy.arange(-1*dataOut.nHeights/2.,dataOut.nHeights/2.)*(c/(2*deltaHeight*dataOut.nHeights*1000))
1466 #para 1Mhz descomentar la siguiente linea
1489 #para 1Mhz descomentar la siguiente linea
1467 #x= x/(10000.0)
1490 #x= x/(10000.0)
1468 # y = dataOut.data[channelIndexList,:] * numpy.conjugate(dataOut.data[channelIndexList,:])
1491 # y = dataOut.data[channelIndexList,:] * numpy.conjugate(dataOut.data[channelIndexList,:])
1469 # y = y.real
1492 # y = y.real
1470 datadB = 10.*numpy.log10(dataOut.data_spc)
1493 datadB = 10.*numpy.log10(dataOut.data_spc)
1471 y = datadB
1494 y = datadB
1472
1495
1473 #thisDatetime = dataOut.datatime
1496 #thisDatetime = dataOut.datatime
1474 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
1497 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
1475 title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
1498 title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
1476 xlabel = ""
1499 xlabel = ""
1477 #para 1Mhz descomentar la siguiente linea
1500 #para 1Mhz descomentar la siguiente linea
1478 #xlabel = "Frequency x 10000"
1501 #xlabel = "Frequency x 10000"
1479 ylabel = "Intensity (dB)"
1502 ylabel = "Intensity (dB)"
1480
1503
1481 if not self.__isConfig:
1504 if not self.__isConfig:
1482 nplots = len(channelIndexList)
1505 nplots = len(channelIndexList)
1483
1506
1484 self.setup(id=id,
1507 self.setup(id=id,
1485 nplots=nplots,
1508 nplots=nplots,
1486 wintitle=wintitle,
1509 wintitle=wintitle,
1487 show=show)
1510 show=show)
1488
1511
1489 if xmin == None: xmin = numpy.nanmin(x)
1512 if xmin == None: xmin = numpy.nanmin(x)
1490 if xmax == None: xmax = numpy.nanmax(x)
1513 if xmax == None: xmax = numpy.nanmax(x)
1491 if ymin == None: ymin = numpy.nanmin(y)
1514 if ymin == None: ymin = numpy.nanmin(y)
1492 if ymax == None: ymax = numpy.nanmax(y)
1515 if ymax == None: ymax = numpy.nanmax(y)
1493
1516
1494 self.__isConfig = True
1517 self.__isConfig = True
1495
1518
1496 self.setWinTitle(title)
1519 self.setWinTitle(title)
1497
1520
1498 for i in range(len(self.axesList)):
1521 for i in range(len(self.axesList)):
1499 ychannel = y[i,:]
1522 ychannel = y[i,:]
1500 str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S"))
1523 str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S"))
1501 title = "Channel %d: %4.2fdB: %s" %(i, numpy.max(ychannel), str_datetime)
1524 title = "Channel %d: %4.2fdB: %s" %(i, numpy.max(ychannel), str_datetime)
1502 axes = self.axesList[i]
1525 axes = self.axesList[i]
1503 axes.pline(x, ychannel,
1526 axes.pline(x, ychannel,
1504 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
1527 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
1505 xlabel=xlabel, ylabel=ylabel, title=title, grid='both')
1528 xlabel=xlabel, ylabel=ylabel, title=title, grid='both')
1506
1529
1507
1530
1508 self.draw()
1531 self.draw()
1509
1532
1510 if save:
1533 if save:
1511 date = thisDatetime.strftime("%Y%m%d_%H%M%S")
1534 date = thisDatetime.strftime("%Y%m%d_%H%M%S")
1512 if figfile == None:
1535 if figfile == None:
1513 figfile = self.getFilename(name = date)
1536 figfile = self.getFilename(name = date)
1514
1537
1515 self.saveFigure(figpath, figfile)
1538 self.saveFigure(figpath, figfile)
1516
1539
1517 self.counter_imagwr += 1
1540 self.counter_imagwr += 1
1518 if (ftp and (self.counter_imagwr==wr_period)):
1541 if (ftp and (self.counter_imagwr==wr_period)):
1519 ftp_filename = os.path.join(figpath,figfile)
1542 ftp_filename = os.path.join(figpath,figfile)
1520 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
1543 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
1521 self.counter_imagwr = 0
1544 self.counter_imagwr = 0
1522
1545
1523
1546
1524 class RTIfromSpectraHeis(Figure):
1547 class RTIfromSpectraHeis(Figure):
1525
1548
1526 __isConfig = None
1549 __isConfig = None
1527 __nsubplots = None
1550 __nsubplots = None
1528
1551
1529 PREFIX = 'rtinoise'
1552 PREFIX = 'rtinoise'
1530
1553
1531 def __init__(self):
1554 def __init__(self):
1532
1555
1533 self.timerange = 24*60*60
1556 self.timerange = 24*60*60
1534 self.__isConfig = False
1557 self.__isConfig = False
1535 self.__nsubplots = 1
1558 self.__nsubplots = 1
1536
1559
1537 self.WIDTH = 820
1560 self.WIDTH = 820
1538 self.HEIGHT = 200
1561 self.HEIGHT = 200
1539 self.WIDTHPROF = 120
1562 self.WIDTHPROF = 120
1540 self.HEIGHTPROF = 0
1563 self.HEIGHTPROF = 0
1541 self.counter_imagwr = 0
1564 self.counter_imagwr = 0
1542 self.xdata = None
1565 self.xdata = None
1543 self.ydata = None
1566 self.ydata = None
1544
1567
1545 def getSubplots(self):
1568 def getSubplots(self):
1546
1569
1547 ncol = 1
1570 ncol = 1
1548 nrow = 1
1571 nrow = 1
1549
1572
1550 return nrow, ncol
1573 return nrow, ncol
1551
1574
1552 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
1575 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
1553
1576
1554 self.__showprofile = showprofile
1577 self.__showprofile = showprofile
1555 self.nplots = nplots
1578 self.nplots = nplots
1556
1579
1557 ncolspan = 7
1580 ncolspan = 7
1558 colspan = 6
1581 colspan = 6
1559 self.__nsubplots = 2
1582 self.__nsubplots = 2
1560
1583
1561 self.createFigure(id = id,
1584 self.createFigure(id = id,
1562 wintitle = wintitle,
1585 wintitle = wintitle,
1563 widthplot = self.WIDTH+self.WIDTHPROF,
1586 widthplot = self.WIDTH+self.WIDTHPROF,
1564 heightplot = self.HEIGHT+self.HEIGHTPROF,
1587 heightplot = self.HEIGHT+self.HEIGHTPROF,
1565 show = show)
1588 show = show)
1566
1589
1567 nrow, ncol = self.getSubplots()
1590 nrow, ncol = self.getSubplots()
1568
1591
1569 self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1)
1592 self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1)
1570
1593
1571
1594
1572 def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True',
1595 def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True',
1573 xmin=None, xmax=None, ymin=None, ymax=None,
1596 xmin=None, xmax=None, ymin=None, ymax=None,
1574 timerange=None,
1597 timerange=None,
1575 save=False, figpath='./', figfile=None, ftp=False, wr_period=1, show=True,
1598 save=False, figpath='./', figfile=None, ftp=False, wr_period=1, show=True,
1576 server=None, folder=None, username=None, password=None):
1599 server=None, folder=None, username=None, password=None):
1577
1600
1578 if channelList == None:
1601 if channelList == None:
1579 channelIndexList = dataOut.channelIndexList
1602 channelIndexList = dataOut.channelIndexList
1580 channelList = dataOut.channelList
1603 channelList = dataOut.channelList
1581 else:
1604 else:
1582 channelIndexList = []
1605 channelIndexList = []
1583 for channel in channelList:
1606 for channel in channelList:
1584 if channel not in dataOut.channelList:
1607 if channel not in dataOut.channelList:
1585 raise ValueError, "Channel %d is not in dataOut.channelList"
1608 raise ValueError, "Channel %d is not in dataOut.channelList"
1586 channelIndexList.append(dataOut.channelList.index(channel))
1609 channelIndexList.append(dataOut.channelList.index(channel))
1587
1610
1588 if timerange != None:
1611 if timerange != None:
1589 self.timerange = timerange
1612 self.timerange = timerange
1590
1613
1591 tmin = None
1614 tmin = None
1592 tmax = None
1615 tmax = None
1593 x = dataOut.getTimeRange()
1616 x = dataOut.getTimeRange()
1594 y = dataOut.getHeiRange()
1617 y = dataOut.getHeiRange()
1595
1618
1596 #factor = 1
1619 #factor = 1
1597 data = dataOut.data_spc#/factor
1620 data = dataOut.data_spc#/factor
1598 data = numpy.average(data,axis=1)
1621 data = numpy.average(data,axis=1)
1599 datadB = 10*numpy.log10(data)
1622 datadB = 10*numpy.log10(data)
1600
1623
1601 # factor = dataOut.normFactor
1624 # factor = dataOut.normFactor
1602 # noise = dataOut.getNoise()/factor
1625 # noise = dataOut.getNoise()/factor
1603 # noisedB = 10*numpy.log10(noise)
1626 # noisedB = 10*numpy.log10(noise)
1604
1627
1605 #thisDatetime = dataOut.datatime
1628 #thisDatetime = dataOut.datatime
1606 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
1629 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
1607 title = wintitle + " RTI: %s" %(thisDatetime.strftime("%d-%b-%Y"))
1630 title = wintitle + " RTI: %s" %(thisDatetime.strftime("%d-%b-%Y"))
1608 xlabel = "Local Time"
1631 xlabel = "Local Time"
1609 ylabel = "Intensity (dB)"
1632 ylabel = "Intensity (dB)"
1610
1633
1611 if not self.__isConfig:
1634 if not self.__isConfig:
1612
1635
1613 nplots = 1
1636 nplots = 1
1614
1637
1615 self.setup(id=id,
1638 self.setup(id=id,
1616 nplots=nplots,
1639 nplots=nplots,
1617 wintitle=wintitle,
1640 wintitle=wintitle,
1618 showprofile=showprofile,
1641 showprofile=showprofile,
1619 show=show)
1642 show=show)
1620
1643
1621 tmin, tmax = self.getTimeLim(x, xmin, xmax)
1644 tmin, tmax = self.getTimeLim(x, xmin, xmax)
1622 if ymin == None: ymin = numpy.nanmin(datadB)
1645 if ymin == None: ymin = numpy.nanmin(datadB)
1623 if ymax == None: ymax = numpy.nanmax(datadB)
1646 if ymax == None: ymax = numpy.nanmax(datadB)
1624
1647
1625 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
1648 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
1626 self.__isConfig = True
1649 self.__isConfig = True
1627
1650
1628 self.xdata = numpy.array([])
1651 self.xdata = numpy.array([])
1629 self.ydata = numpy.array([])
1652 self.ydata = numpy.array([])
1630
1653
1631 self.setWinTitle(title)
1654 self.setWinTitle(title)
1632
1655
1633
1656
1634 # title = "RTI %s" %(thisDatetime.strftime("%d-%b-%Y"))
1657 # title = "RTI %s" %(thisDatetime.strftime("%d-%b-%Y"))
1635 title = "RTI - %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
1658 title = "RTI - %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
1636
1659
1637 legendlabels = ["channel %d"%idchannel for idchannel in channelList]
1660 legendlabels = ["channel %d"%idchannel for idchannel in channelList]
1638 axes = self.axesList[0]
1661 axes = self.axesList[0]
1639
1662
1640 self.xdata = numpy.hstack((self.xdata, x[0:1]))
1663 self.xdata = numpy.hstack((self.xdata, x[0:1]))
1641
1664
1642 if len(self.ydata)==0:
1665 if len(self.ydata)==0:
1643 self.ydata = datadB[channelIndexList].reshape(-1,1)
1666 self.ydata = datadB[channelIndexList].reshape(-1,1)
1644 else:
1667 else:
1645 self.ydata = numpy.hstack((self.ydata, datadB[channelIndexList].reshape(-1,1)))
1668 self.ydata = numpy.hstack((self.ydata, datadB[channelIndexList].reshape(-1,1)))
1646
1669
1647
1670
1648 axes.pmultilineyaxis(x=self.xdata, y=self.ydata,
1671 axes.pmultilineyaxis(x=self.xdata, y=self.ydata,
1649 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax,
1672 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax,
1650 xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='.', markersize=8, linestyle="solid", grid='both',
1673 xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='.', markersize=8, linestyle="solid", grid='both',
1651 XAxisAsTime=True
1674 XAxisAsTime=True
1652 )
1675 )
1653
1676
1654 self.draw()
1677 self.draw()
1655
1678
1656 if save:
1679 if save:
1657
1680
1658 if figfile == None:
1681 if figfile == None:
1659 figfile = self.getFilename(name = self.name)
1682 figfile = self.getFilename(name = self.name)
1660
1683
1661 self.saveFigure(figpath, figfile)
1684 self.saveFigure(figpath, figfile)
1662
1685
1663 self.counter_imagwr += 1
1686 self.counter_imagwr += 1
1664 if (ftp and (self.counter_imagwr==wr_period)):
1687 if (ftp and (self.counter_imagwr==wr_period)):
1665 ftp_filename = os.path.join(figpath,figfile)
1688 ftp_filename = os.path.join(figpath,figfile)
1666 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
1689 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
1667 self.counter_imagwr = 0
1690 self.counter_imagwr = 0
1668
1691
1669 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
1692 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
1670 self.__isConfig = False
1693 self.__isConfig = False
1671 del self.xdata
1694 del self.xdata
1672 del self.ydata
1695 del self.ydata
1673
1696
1674
1697
1675 No newline at end of file
1698
General Comments 0
You need to be logged in to leave comments. Login now