The requested changes are too big and content was truncated. Show full diff
@@ -548,7 +548,7 class Spectra(JROData): | |||||
548 |
|
548 | |||
549 | deltav = self.getVmax() / (self.nFFTPoints * self.ippFactor) |
|
549 | deltav = self.getVmax() / (self.nFFTPoints * self.ippFactor) | |
550 | velrange = deltav * (numpy.arange(self.nFFTPoints + extrapoints) - self.nFFTPoints / 2.) |
|
550 | velrange = deltav * (numpy.arange(self.nFFTPoints + extrapoints) - self.nFFTPoints / 2.) | |
551 |
|
551 | |||
552 | if self.nmodes: |
|
552 | if self.nmodes: | |
553 | return velrange/self.nmodes |
|
553 | return velrange/self.nmodes | |
554 | else: |
|
554 | else: | |
@@ -1104,7 +1104,7 class PlotterData(object): | |||||
1104 | MAXNUMY = 100 |
|
1104 | MAXNUMY = 100 | |
1105 |
|
1105 | |||
1106 | def __init__(self, code, throttle_value, exp_code, buffering=True, snr=False): |
|
1106 | def __init__(self, code, throttle_value, exp_code, buffering=True, snr=False): | |
1107 |
|
1107 | |||
1108 | self.key = code |
|
1108 | self.key = code | |
1109 | self.throttle = throttle_value |
|
1109 | self.throttle = throttle_value | |
1110 | self.exp_code = exp_code |
|
1110 | self.exp_code = exp_code | |
@@ -1139,7 +1139,7 class PlotterData(object): | |||||
1139 | return len(self.__times) |
|
1139 | return len(self.__times) | |
1140 |
|
1140 | |||
1141 | def __getitem__(self, key): |
|
1141 | def __getitem__(self, key): | |
1142 |
|
1142 | |||
1143 | if key not in self.data: |
|
1143 | if key not in self.data: | |
1144 | raise KeyError(log.error('Missing key: {}'.format(key))) |
|
1144 | raise KeyError(log.error('Missing key: {}'.format(key))) | |
1145 | if 'spc' in key or not self.buffering: |
|
1145 | if 'spc' in key or not self.buffering: | |
@@ -1172,7 +1172,7 class PlotterData(object): | |||||
1172 | elif 'spc_moments' == plot: |
|
1172 | elif 'spc_moments' == plot: | |
1173 | plot = 'moments' |
|
1173 | plot = 'moments' | |
1174 | self.data[plot] = {} |
|
1174 | self.data[plot] = {} | |
1175 |
|
1175 | |||
1176 | if 'spc' in self.data or 'rti' in self.data or 'cspc' in self.data or 'moments' in self.data: |
|
1176 | if 'spc' in self.data or 'rti' in self.data or 'cspc' in self.data or 'moments' in self.data: | |
1177 | self.data['noise'] = {} |
|
1177 | self.data['noise'] = {} | |
1178 | self.data['rti'] = {} |
|
1178 | self.data['rti'] = {} | |
@@ -1180,7 +1180,7 class PlotterData(object): | |||||
1180 | self.plottypes.append('noise') |
|
1180 | self.plottypes.append('noise') | |
1181 | if 'rti' not in self.plottypes: |
|
1181 | if 'rti' not in self.plottypes: | |
1182 | self.plottypes.append('rti') |
|
1182 | self.plottypes.append('rti') | |
1183 |
|
1183 | |||
1184 | def shape(self, key): |
|
1184 | def shape(self, key): | |
1185 | ''' |
|
1185 | ''' | |
1186 | Get the shape of the one-element data for the given key |
|
1186 | Get the shape of the one-element data for the given key | |
@@ -1196,17 +1196,17 class PlotterData(object): | |||||
1196 | ''' |
|
1196 | ''' | |
1197 | Update data object with new dataOut |
|
1197 | Update data object with new dataOut | |
1198 | ''' |
|
1198 | ''' | |
1199 |
|
1199 | |||
1200 | if tm in self.__times: |
|
1200 | if tm in self.__times: | |
1201 | return |
|
1201 | return | |
1202 | self.profileIndex = dataOut.profileIndex |
|
1202 | self.profileIndex = dataOut.profileIndex | |
1203 | self.tm = tm |
|
1203 | self.tm = tm | |
1204 | self.type = dataOut.type |
|
1204 | self.type = dataOut.type | |
1205 | self.parameters = getattr(dataOut, 'parameters', []) |
|
1205 | self.parameters = getattr(dataOut, 'parameters', []) | |
1206 |
|
1206 | |||
1207 | if hasattr(dataOut, 'meta'): |
|
1207 | if hasattr(dataOut, 'meta'): | |
1208 | self.meta.update(dataOut.meta) |
|
1208 | self.meta.update(dataOut.meta) | |
1209 |
|
1209 | |||
1210 | self.pairs = dataOut.pairsList |
|
1210 | self.pairs = dataOut.pairsList | |
1211 | self.interval = dataOut.getTimeInterval() |
|
1211 | self.interval = dataOut.getTimeInterval() | |
1212 | self.localtime = dataOut.useLocalTime |
|
1212 | self.localtime = dataOut.useLocalTime | |
@@ -1217,7 +1217,7 class PlotterData(object): | |||||
1217 | self.__heights.append(dataOut.heightList) |
|
1217 | self.__heights.append(dataOut.heightList) | |
1218 | self.__all_heights.update(dataOut.heightList) |
|
1218 | self.__all_heights.update(dataOut.heightList) | |
1219 | self.__times.append(tm) |
|
1219 | self.__times.append(tm) | |
1220 |
|
1220 | |||
1221 | for plot in self.plottypes: |
|
1221 | for plot in self.plottypes: | |
1222 | if plot in ('spc', 'spc_moments'): |
|
1222 | if plot in ('spc', 'spc_moments'): | |
1223 | z = dataOut.data_spc/dataOut.normFactor |
|
1223 | z = dataOut.data_spc/dataOut.normFactor | |
@@ -1250,8 +1250,8 class PlotterData(object): | |||||
1250 | if plot == 'scope': |
|
1250 | if plot == 'scope': | |
1251 | buffer = dataOut.data |
|
1251 | buffer = dataOut.data | |
1252 | self.flagDataAsBlock = dataOut.flagDataAsBlock |
|
1252 | self.flagDataAsBlock = dataOut.flagDataAsBlock | |
1253 |
self.nProfiles = dataOut.nProfiles |
|
1253 | self.nProfiles = dataOut.nProfiles | |
1254 |
|
1254 | |||
1255 | if plot == 'spc': |
|
1255 | if plot == 'spc': | |
1256 | self.data['spc'] = buffer |
|
1256 | self.data['spc'] = buffer | |
1257 | elif plot == 'cspc': |
|
1257 | elif plot == 'cspc': | |
@@ -1326,7 +1326,7 class PlotterData(object): | |||||
1326 | else: |
|
1326 | else: | |
1327 | meta['xrange'] = [] |
|
1327 | meta['xrange'] = [] | |
1328 |
|
1328 | |||
1329 |
meta.update(self.meta) |
|
1329 | meta.update(self.meta) | |
1330 | ret['metadata'] = meta |
|
1330 | ret['metadata'] = meta | |
1331 | return json.dumps(ret) |
|
1331 | return json.dumps(ret) | |
1332 |
|
1332 |
@@ -42,7 +42,7 class SpectraPlot_(Figure): | |||||
42 |
|
42 | |||
43 | self.__xfilter_ena = False |
|
43 | self.__xfilter_ena = False | |
44 | self.__yfilter_ena = False |
|
44 | self.__yfilter_ena = False | |
45 |
|
45 | |||
46 | self.indice=1 |
|
46 | self.indice=1 | |
47 |
|
47 | |||
48 | def getSubplots(self): |
|
48 | def getSubplots(self): | |
@@ -225,11 +225,231 class SpectraPlot_(Figure): | |||||
225 | ftp=ftp, |
|
225 | ftp=ftp, | |
226 | wr_period=wr_period, |
|
226 | wr_period=wr_period, | |
227 | thisDatetime=thisDatetime) |
|
227 | thisDatetime=thisDatetime) | |
228 |
|
228 | |||
229 |
|
229 | |||
230 | return dataOut |
|
230 | return dataOut | |
231 |
|
231 | |||
232 | @MPDecorator |
|
232 | @MPDecorator | |
|
233 | class WpowerPlot_(Figure): | |||
|
234 | ||||
|
235 | isConfig = None | |||
|
236 | __nsubplots = None | |||
|
237 | ||||
|
238 | WIDTHPROF = None | |||
|
239 | HEIGHTPROF = None | |||
|
240 | PREFIX = 'wpo' | |||
|
241 | ||||
|
242 | def __init__(self): | |||
|
243 | Figure.__init__(self) | |||
|
244 | self.isConfig = False | |||
|
245 | self.__nsubplots = 1 | |||
|
246 | self.WIDTH = 250 | |||
|
247 | self.HEIGHT = 250 | |||
|
248 | self.WIDTHPROF = 120 | |||
|
249 | self.HEIGHTPROF = 0 | |||
|
250 | self.counter_imagwr = 0 | |||
|
251 | ||||
|
252 | self.PLOT_CODE = WPO_CODE | |||
|
253 | ||||
|
254 | self.FTP_WEI = None | |||
|
255 | self.EXP_CODE = None | |||
|
256 | self.SUB_EXP_CODE = None | |||
|
257 | self.PLOT_POS = None | |||
|
258 | ||||
|
259 | self.__xfilter_ena = False | |||
|
260 | self.__yfilter_ena = False | |||
|
261 | ||||
|
262 | self.indice=1 | |||
|
263 | ||||
|
264 | def getSubplots(self): | |||
|
265 | ||||
|
266 | ncol = int(numpy.sqrt(self.nplots)+0.9) | |||
|
267 | nrow = int(self.nplots*1./ncol + 0.9) | |||
|
268 | ||||
|
269 | return nrow, ncol | |||
|
270 | ||||
|
271 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): | |||
|
272 | ||||
|
273 | self.__showprofile = showprofile | |||
|
274 | self.nplots = nplots | |||
|
275 | ||||
|
276 | ncolspan = 1 | |||
|
277 | colspan = 1 | |||
|
278 | if showprofile: | |||
|
279 | ncolspan = 3 | |||
|
280 | colspan = 2 | |||
|
281 | self.__nsubplots = 2 | |||
|
282 | ||||
|
283 | self.createFigure(id = id, | |||
|
284 | wintitle = wintitle, | |||
|
285 | widthplot = self.WIDTH + self.WIDTHPROF, | |||
|
286 | heightplot = self.HEIGHT + self.HEIGHTPROF, | |||
|
287 | show=show) | |||
|
288 | ||||
|
289 | nrow, ncol = self.getSubplots() | |||
|
290 | ||||
|
291 | counter = 0 | |||
|
292 | for y in range(nrow): | |||
|
293 | for x in range(ncol): | |||
|
294 | ||||
|
295 | if counter >= self.nplots: | |||
|
296 | break | |||
|
297 | ||||
|
298 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) | |||
|
299 | ||||
|
300 | if showprofile: | |||
|
301 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) | |||
|
302 | ||||
|
303 | counter += 1 | |||
|
304 | ||||
|
305 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile=True, | |||
|
306 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, | |||
|
307 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, | |||
|
308 | server=None, folder=None, username=None, password=None, | |||
|
309 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False, | |||
|
310 | xaxis="frequency", colormap='jet', normFactor=None): | |||
|
311 | ||||
|
312 | """ | |||
|
313 | ||||
|
314 | Input: | |||
|
315 | dataOut : | |||
|
316 | id : | |||
|
317 | wintitle : | |||
|
318 | channelList : | |||
|
319 | showProfile : | |||
|
320 | xmin : None, | |||
|
321 | xmax : None, | |||
|
322 | ymin : None, | |||
|
323 | ymax : None, | |||
|
324 | zmin : None, | |||
|
325 | zmax : None | |||
|
326 | """ | |||
|
327 | print("***************PLOTEO******************") | |||
|
328 | print("DATAOUT SHAPE : ",dataOut.data.shape) | |||
|
329 | if dataOut.flagNoData: | |||
|
330 | return dataOut | |||
|
331 | ||||
|
332 | if realtime: | |||
|
333 | if not(isRealtime(utcdatatime = dataOut.utctime)): | |||
|
334 | print('Skipping this plot function') | |||
|
335 | return | |||
|
336 | ||||
|
337 | if channelList == None: | |||
|
338 | channelIndexList = dataOut.channelIndexList | |||
|
339 | else: | |||
|
340 | channelIndexList = [] | |||
|
341 | for channel in channelList: | |||
|
342 | if channel not in dataOut.channelList: | |||
|
343 | raise ValueError("Channel %d is not in dataOut.channelList" %channel) | |||
|
344 | channelIndexList.append(dataOut.channelList.index(channel)) | |||
|
345 | ||||
|
346 | ||||
|
347 | print("channelIndexList",channelIndexList) | |||
|
348 | if normFactor is None: | |||
|
349 | factor = dataOut.normFactor | |||
|
350 | else: | |||
|
351 | factor = normFactor | |||
|
352 | if xaxis == "frequency": | |||
|
353 | x = dataOut.getFreqRange(1)/1000. | |||
|
354 | xlabel = "Frequency (kHz)" | |||
|
355 | ||||
|
356 | elif xaxis == "time": | |||
|
357 | x = dataOut.getAcfRange(1) | |||
|
358 | xlabel = "Time (ms)" | |||
|
359 | ||||
|
360 | else: | |||
|
361 | x = dataOut.getVelRange(1) | |||
|
362 | xlabel = "Velocity (m/s)" | |||
|
363 | ||||
|
364 | ylabel = "Range (km)" | |||
|
365 | ||||
|
366 | y = dataOut.getHeiRange() | |||
|
367 | print("factor",factor) | |||
|
368 | ||||
|
369 | z = dataOut.data/factor # dividido /factor | |||
|
370 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) | |||
|
371 | zdB = 10*numpy.log10(z) | |||
|
372 | ||||
|
373 | avg = numpy.average(z, axis=1) | |||
|
374 | avgdB = 10*numpy.log10(avg) | |||
|
375 | ||||
|
376 | noise = dataOut.getNoise()/factor | |||
|
377 | noisedB = 10*numpy.log10(noise) | |||
|
378 | ||||
|
379 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) | |||
|
380 | title = wintitle + "Weather Power" | |||
|
381 | ||||
|
382 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): | |||
|
383 | title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith) | |||
|
384 | ||||
|
385 | if not self.isConfig: | |||
|
386 | ||||
|
387 | nplots = len(channelIndexList) | |||
|
388 | ||||
|
389 | self.setup(id=id, | |||
|
390 | nplots=nplots, | |||
|
391 | wintitle=wintitle, | |||
|
392 | showprofile=showprofile, | |||
|
393 | show=show) | |||
|
394 | ||||
|
395 | if xmin == None: xmin = numpy.nanmin(x) | |||
|
396 | if xmax == None: xmax = numpy.nanmax(x) | |||
|
397 | if ymin == None: ymin = numpy.nanmin(y) | |||
|
398 | if ymax == None: ymax = numpy.nanmax(y) | |||
|
399 | if zmin == None: zmin = numpy.floor(numpy.nanmin(noisedB)) - 3 | |||
|
400 | if zmax == None: zmax = numpy.ceil(numpy.nanmax(avgdB)) + 3 | |||
|
401 | ||||
|
402 | self.FTP_WEI = ftp_wei | |||
|
403 | self.EXP_CODE = exp_code | |||
|
404 | self.SUB_EXP_CODE = sub_exp_code | |||
|
405 | self.PLOT_POS = plot_pos | |||
|
406 | ||||
|
407 | self.isConfig = True | |||
|
408 | ||||
|
409 | self.setWinTitle(title) | |||
|
410 | ||||
|
411 | for i in range(self.nplots): | |||
|
412 | index = channelIndexList[i] | |||
|
413 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) | |||
|
414 | title = "Channel %d: %4.2fdB: %s" %(dataOut.channelList[index], noisedB[index], str_datetime) | |||
|
415 | if len(dataOut.beam.codeList) != 0: | |||
|
416 | title = "Ch%d:%4.2fdB,%2.2f,%2.2f:%s" %(dataOut.channelList[index], noisedB[index], dataOut.beam.azimuthList[index], dataOut.beam.zenithList[index], str_datetime) | |||
|
417 | ||||
|
418 | axes = self.axesList[i*self.__nsubplots] | |||
|
419 | axes.pcolor(x, y, zdB[index,:,:], | |||
|
420 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, | |||
|
421 | xlabel=xlabel, ylabel=ylabel, title=title, colormap=colormap, | |||
|
422 | ticksize=9, cblabel='') | |||
|
423 | ||||
|
424 | if self.__showprofile: | |||
|
425 | axes = self.axesList[i*self.__nsubplots +1] | |||
|
426 | axes.pline(avgdB[index,:], y, | |||
|
427 | xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax, | |||
|
428 | xlabel='dB', ylabel='', title='', | |||
|
429 | ytick_visible=False, | |||
|
430 | grid='x') | |||
|
431 | ||||
|
432 | noiseline = numpy.repeat(noisedB[index], len(y)) | |||
|
433 | axes.addpline(noiseline, y, idline=1, color="black", linestyle="dashed", lw=2) | |||
|
434 | ||||
|
435 | self.draw() | |||
|
436 | ||||
|
437 | if figfile == None: | |||
|
438 | str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S") | |||
|
439 | name = str_datetime | |||
|
440 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): | |||
|
441 | name = name + '_az' + '_%2.2f'%(dataOut.azimuth) + '_zn' + '_%2.2f'%(dataOut.zenith) | |||
|
442 | figfile = self.getFilename(name) | |||
|
443 | ||||
|
444 | self.save(figpath=figpath, | |||
|
445 | figfile=figfile, | |||
|
446 | save=save, | |||
|
447 | ftp=ftp, | |||
|
448 | wr_period=wr_period, | |||
|
449 | thisDatetime=thisDatetime) | |||
|
450 | return dataOut | |||
|
451 | ||||
|
452 | @MPDecorator | |||
233 | class CrossSpectraPlot_(Figure): |
|
453 | class CrossSpectraPlot_(Figure): | |
234 |
|
454 | |||
235 | isConfig = None |
|
455 | isConfig = None | |
@@ -256,7 +476,7 class CrossSpectraPlot_(Figure): | |||||
256 | self.EXP_CODE = None |
|
476 | self.EXP_CODE = None | |
257 | self.SUB_EXP_CODE = None |
|
477 | self.SUB_EXP_CODE = None | |
258 | self.PLOT_POS = None |
|
478 | self.PLOT_POS = None | |
259 |
|
479 | |||
260 | self.indice=0 |
|
480 | self.indice=0 | |
261 |
|
481 | |||
262 | def getSubplots(self): |
|
482 | def getSubplots(self): | |
@@ -314,7 +534,7 class CrossSpectraPlot_(Figure): | |||||
314 | zmax : None |
|
534 | zmax : None | |
315 | """ |
|
535 | """ | |
316 |
|
536 | |||
317 |
if dataOut.flagNoData: |
|
537 | if dataOut.flagNoData: | |
318 | return dataOut |
|
538 | return dataOut | |
319 |
|
539 | |||
320 | if pairsList == None: |
|
540 | if pairsList == None: | |
@@ -331,7 +551,7 class CrossSpectraPlot_(Figure): | |||||
331 |
|
551 | |||
332 | if len(pairsIndexList) > 4: |
|
552 | if len(pairsIndexList) > 4: | |
333 | pairsIndexList = pairsIndexList[0:4] |
|
553 | pairsIndexList = pairsIndexList[0:4] | |
334 |
|
554 | |||
335 | if normFactor is None: |
|
555 | if normFactor is None: | |
336 | factor = dataOut.normFactor |
|
556 | factor = dataOut.normFactor | |
337 | else: |
|
557 | else: | |
@@ -402,7 +622,7 class CrossSpectraPlot_(Figure): | |||||
402 | self.isConfig = True |
|
622 | self.isConfig = True | |
403 |
|
623 | |||
404 | self.setWinTitle(title) |
|
624 | self.setWinTitle(title) | |
405 |
|
625 | |||
406 |
|
626 | |||
407 | for i in range(self.nplots): |
|
627 | for i in range(self.nplots): | |
408 | pair = dataOut.pairsList[pairsIndexList[i]] |
|
628 | pair = dataOut.pairsList[pairsIndexList[i]] | |
@@ -563,7 +783,7 class RTIPlot_(Figure): | |||||
563 | #colormap = kwargs.get('colormap', 'jet') |
|
783 | #colormap = kwargs.get('colormap', 'jet') | |
564 | if HEIGHT is not None: |
|
784 | if HEIGHT is not None: | |
565 | self.HEIGHT = HEIGHT |
|
785 | self.HEIGHT = HEIGHT | |
566 |
|
786 | |||
567 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): |
|
787 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): | |
568 | return |
|
788 | return | |
569 |
|
789 | |||
@@ -745,7 +965,7 class CoherenceMap_(Figure): | |||||
745 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
965 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): | |
746 |
|
966 | |||
747 |
|
967 | |||
748 |
if dataOut.flagNoData: |
|
968 | if dataOut.flagNoData: | |
749 | return dataOut |
|
969 | return dataOut | |
750 |
|
970 | |||
751 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): |
|
971 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): | |
@@ -935,7 +1155,7 class PowerProfilePlot_(Figure): | |||||
935 | ftp=False, wr_period=1, server=None, |
|
1155 | ftp=False, wr_period=1, server=None, | |
936 | folder=None, username=None, password=None): |
|
1156 | folder=None, username=None, password=None): | |
937 |
|
1157 | |||
938 |
if dataOut.flagNoData: |
|
1158 | if dataOut.flagNoData: | |
939 | return dataOut |
|
1159 | return dataOut | |
940 |
|
1160 | |||
941 |
|
1161 | |||
@@ -1009,7 +1229,7 class PowerProfilePlot_(Figure): | |||||
1009 | ftp=ftp, |
|
1229 | ftp=ftp, | |
1010 | wr_period=wr_period, |
|
1230 | wr_period=wr_period, | |
1011 | thisDatetime=thisDatetime) |
|
1231 | thisDatetime=thisDatetime) | |
1012 |
|
1232 | |||
1013 | return dataOut |
|
1233 | return dataOut | |
1014 |
|
1234 | |||
1015 | @MPDecorator |
|
1235 | @MPDecorator | |
@@ -1066,7 +1286,7 class SpectraCutPlot_(Figure): | |||||
1066 | folder=None, username=None, password=None, |
|
1286 | folder=None, username=None, password=None, | |
1067 | xaxis="frequency"): |
|
1287 | xaxis="frequency"): | |
1068 |
|
1288 | |||
1069 |
if dataOut.flagNoData: |
|
1289 | if dataOut.flagNoData: | |
1070 | return dataOut |
|
1290 | return dataOut | |
1071 |
|
1291 | |||
1072 | if channelList == None: |
|
1292 | if channelList == None: | |
@@ -1248,7 +1468,7 class Noise_(Figure): | |||||
1248 | server=None, folder=None, username=None, password=None, |
|
1468 | server=None, folder=None, username=None, password=None, | |
1249 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
1469 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): | |
1250 |
|
1470 | |||
1251 |
if dataOut.flagNoData: |
|
1471 | if dataOut.flagNoData: | |
1252 | return dataOut |
|
1472 | return dataOut | |
1253 |
|
1473 | |||
1254 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): |
|
1474 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): | |
@@ -1444,7 +1664,7 class BeaconPhase_(Figure): | |||||
1444 | server=None, folder=None, username=None, password=None, |
|
1664 | server=None, folder=None, username=None, password=None, | |
1445 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
1665 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): | |
1446 |
|
1666 | |||
1447 |
if dataOut.flagNoData: |
|
1667 | if dataOut.flagNoData: | |
1448 | return dataOut |
|
1668 | return dataOut | |
1449 |
|
1669 | |||
1450 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): |
|
1670 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): | |
@@ -1586,4 +1806,4 class BeaconPhase_(Figure): | |||||
1586 | thisDatetime=thisDatetime, |
|
1806 | thisDatetime=thisDatetime, | |
1587 | update_figfile=update_figfile) |
|
1807 | update_figfile=update_figfile) | |
1588 |
|
1808 | |||
1589 | return dataOut No newline at end of file |
|
1809 | return dataOut |
@@ -13,62 +13,62 from .figure import Figure | |||||
13 |
|
13 | |||
14 | @MPDecorator |
|
14 | @MPDecorator | |
15 | class Scope_(Figure): |
|
15 | class Scope_(Figure): | |
16 |
|
16 | |||
17 | isConfig = None |
|
17 | isConfig = None | |
18 |
|
18 | |||
19 | def __init__(self):#, **kwargs): #YONG |
|
19 | def __init__(self):#, **kwargs): #YONG | |
20 | Figure.__init__(self)#, **kwargs) |
|
20 | Figure.__init__(self)#, **kwargs) | |
21 | self.isConfig = False |
|
21 | self.isConfig = False | |
22 | self.WIDTH = 300 |
|
22 | self.WIDTH = 300 | |
23 | self.HEIGHT = 200 |
|
23 | self.HEIGHT = 200 | |
24 | self.counter_imagwr = 0 |
|
24 | self.counter_imagwr = 0 | |
25 |
|
25 | |||
26 | def getSubplots(self): |
|
26 | def getSubplots(self): | |
27 |
|
27 | |||
28 | nrow = self.nplots |
|
28 | nrow = self.nplots | |
29 | ncol = 3 |
|
29 | ncol = 3 | |
30 | return nrow, ncol |
|
30 | return nrow, ncol | |
31 |
|
31 | |||
32 | def setup(self, id, nplots, wintitle, show): |
|
32 | def setup(self, id, nplots, wintitle, show): | |
33 |
|
33 | |||
34 | self.nplots = nplots |
|
34 | self.nplots = nplots | |
35 |
|
35 | |||
36 |
self.createFigure(id=id, |
|
36 | self.createFigure(id=id, | |
37 |
wintitle=wintitle, |
|
37 | wintitle=wintitle, | |
38 | show=show) |
|
38 | show=show) | |
39 |
|
39 | |||
40 | nrow,ncol = self.getSubplots() |
|
40 | nrow,ncol = self.getSubplots() | |
41 | colspan = 3 |
|
41 | colspan = 3 | |
42 | rowspan = 1 |
|
42 | rowspan = 1 | |
43 |
|
43 | |||
44 | for i in range(nplots): |
|
44 | for i in range(nplots): | |
45 | self.addAxes(nrow, ncol, i, 0, colspan, rowspan) |
|
45 | self.addAxes(nrow, ncol, i, 0, colspan, rowspan) | |
46 |
|
46 | |||
47 | def plot_iq(self, x, y, id, channelIndexList, thisDatetime, wintitle, show, xmin, xmax, ymin, ymax): |
|
47 | def plot_iq(self, x, y, id, channelIndexList, thisDatetime, wintitle, show, xmin, xmax, ymin, ymax): | |
48 | yreal = y[channelIndexList,:].real |
|
48 | yreal = y[channelIndexList,:].real | |
49 | yimag = y[channelIndexList,:].imag |
|
49 | yimag = y[channelIndexList,:].imag | |
50 |
|
50 | |||
51 | title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
51 | title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) | |
52 | xlabel = "Range (Km)" |
|
52 | xlabel = "Range (Km)" | |
53 | ylabel = "Intensity - IQ" |
|
53 | ylabel = "Intensity - IQ" | |
54 |
|
54 | |||
55 | if not self.isConfig: |
|
55 | if not self.isConfig: | |
56 | nplots = len(channelIndexList) |
|
56 | nplots = len(channelIndexList) | |
57 |
|
57 | |||
58 | self.setup(id=id, |
|
58 | self.setup(id=id, | |
59 | nplots=nplots, |
|
59 | nplots=nplots, | |
60 | wintitle='', |
|
60 | wintitle='', | |
61 | show=show) |
|
61 | show=show) | |
62 |
|
62 | |||
63 | if xmin == None: xmin = numpy.nanmin(x) |
|
63 | if xmin == None: xmin = numpy.nanmin(x) | |
64 | if xmax == None: xmax = numpy.nanmax(x) |
|
64 | if xmax == None: xmax = numpy.nanmax(x) | |
65 | if ymin == None: ymin = min(numpy.nanmin(yreal),numpy.nanmin(yimag)) |
|
65 | if ymin == None: ymin = min(numpy.nanmin(yreal),numpy.nanmin(yimag)) | |
66 | if ymax == None: ymax = max(numpy.nanmax(yreal),numpy.nanmax(yimag)) |
|
66 | if ymax == None: ymax = max(numpy.nanmax(yreal),numpy.nanmax(yimag)) | |
67 |
|
67 | |||
68 | self.isConfig = True |
|
68 | self.isConfig = True | |
69 |
|
69 | |||
70 | self.setWinTitle(title) |
|
70 | self.setWinTitle(title) | |
71 |
|
71 | |||
72 | for i in range(len(self.axesList)): |
|
72 | for i in range(len(self.axesList)): | |
73 | title = "Channel %d" %(i) |
|
73 | title = "Channel %d" %(i) | |
74 | axes = self.axesList[i] |
|
74 | axes = self.axesList[i] | |
@@ -78,32 +78,32 class Scope_(Figure): | |||||
78 | xlabel=xlabel, ylabel=ylabel, title=title) |
|
78 | xlabel=xlabel, ylabel=ylabel, title=title) | |
79 |
|
79 | |||
80 | axes.addpline(x, yimag[i,:], idline=1, color="red", linestyle="solid", lw=2) |
|
80 | axes.addpline(x, yimag[i,:], idline=1, color="red", linestyle="solid", lw=2) | |
81 |
|
81 | |||
82 | def plot_power(self, x, y, id, channelIndexList, thisDatetime, wintitle, show, xmin, xmax, ymin, ymax): |
|
82 | def plot_power(self, x, y, id, channelIndexList, thisDatetime, wintitle, show, xmin, xmax, ymin, ymax): | |
83 | y = y[channelIndexList,:] * numpy.conjugate(y[channelIndexList,:]) |
|
83 | y = y[channelIndexList,:] * numpy.conjugate(y[channelIndexList,:]) | |
84 | yreal = y.real |
|
84 | yreal = y.real | |
85 |
|
85 | |||
86 | title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
86 | title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) | |
87 | xlabel = "Range (Km)" |
|
87 | xlabel = "Range (Km)" | |
88 | ylabel = "Intensity" |
|
88 | ylabel = "Intensity" | |
89 |
|
89 | |||
90 | if not self.isConfig: |
|
90 | if not self.isConfig: | |
91 | nplots = len(channelIndexList) |
|
91 | nplots = len(channelIndexList) | |
92 |
|
92 | |||
93 | self.setup(id=id, |
|
93 | self.setup(id=id, | |
94 | nplots=nplots, |
|
94 | nplots=nplots, | |
95 | wintitle='', |
|
95 | wintitle='', | |
96 | show=show) |
|
96 | show=show) | |
97 |
|
97 | |||
98 | if xmin == None: xmin = numpy.nanmin(x) |
|
98 | if xmin == None: xmin = numpy.nanmin(x) | |
99 | if xmax == None: xmax = numpy.nanmax(x) |
|
99 | if xmax == None: xmax = numpy.nanmax(x) | |
100 | if ymin == None: ymin = numpy.nanmin(yreal) |
|
100 | if ymin == None: ymin = numpy.nanmin(yreal) | |
101 | if ymax == None: ymax = numpy.nanmax(yreal) |
|
101 | if ymax == None: ymax = numpy.nanmax(yreal) | |
102 |
|
102 | |||
103 | self.isConfig = True |
|
103 | self.isConfig = True | |
104 |
|
104 | |||
105 | self.setWinTitle(title) |
|
105 | self.setWinTitle(title) | |
106 |
|
106 | |||
107 | for i in range(len(self.axesList)): |
|
107 | for i in range(len(self.axesList)): | |
108 | title = "Channel %d" %(i) |
|
108 | title = "Channel %d" %(i) | |
109 | axes = self.axesList[i] |
|
109 | axes = self.axesList[i] | |
@@ -112,14 +112,48 class Scope_(Figure): | |||||
112 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, |
|
112 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, | |
113 | xlabel=xlabel, ylabel=ylabel, title=title) |
|
113 | xlabel=xlabel, ylabel=ylabel, title=title) | |
114 |
|
114 | |||
115 |
|
115 | def plot_weatherpower(self, x, y, id, channelIndexList, thisDatetime, wintitle, show, xmin, xmax, ymin, ymax): | ||
|
116 | y = y[channelIndexList,:] | |||
|
117 | yreal = y | |||
|
118 | ||||
|
119 | title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) | |||
|
120 | xlabel = "Range (Km)" | |||
|
121 | ylabel = "Intensity" | |||
|
122 | ||||
|
123 | if not self.isConfig: | |||
|
124 | nplots = len(channelIndexList) | |||
|
125 | ||||
|
126 | self.setup(id=id, | |||
|
127 | nplots=nplots, | |||
|
128 | wintitle='', | |||
|
129 | show=show) | |||
|
130 | ||||
|
131 | if xmin == None: xmin = numpy.nanmin(x) | |||
|
132 | if xmax == None: xmax = numpy.nanmax(x) | |||
|
133 | if ymin == None: ymin = numpy.nanmin(yreal) | |||
|
134 | if ymax == None: ymax = numpy.nanmax(yreal) | |||
|
135 | ||||
|
136 | self.isConfig = True | |||
|
137 | ||||
|
138 | self.setWinTitle(title) | |||
|
139 | ||||
|
140 | for i in range(len(self.axesList)): | |||
|
141 | title = "Channel %d" %(i) | |||
|
142 | axes = self.axesList[i] | |||
|
143 | ychannel = yreal[i,:] | |||
|
144 | axes.pline(x, ychannel, | |||
|
145 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, | |||
|
146 | xlabel=xlabel, ylabel=ylabel, title=title) | |||
|
147 | ||||
|
148 | ||||
|
149 | ||||
116 | def run(self, dataOut, id, wintitle="", channelList=None, |
|
150 | def run(self, dataOut, id, wintitle="", channelList=None, | |
117 | xmin=None, xmax=None, ymin=None, ymax=None, save=False, |
|
151 | xmin=None, xmax=None, ymin=None, ymax=None, save=False, | |
118 | figpath='./', figfile=None, show=True, wr_period=1, |
|
152 | figpath='./', figfile=None, show=True, wr_period=1, | |
119 | ftp=False, server=None, folder=None, username=None, password=None, type='power', **kwargs): |
|
153 | ftp=False, server=None, folder=None, username=None, password=None, type='power', **kwargs): | |
120 |
|
154 | |||
121 | """ |
|
155 | """ | |
122 |
|
156 | |||
123 | Input: |
|
157 | Input: | |
124 | dataOut : |
|
158 | dataOut : | |
125 | id : |
|
159 | id : | |
@@ -130,9 +164,9 class Scope_(Figure): | |||||
130 | ymin : None, |
|
164 | ymin : None, | |
131 | ymax : None, |
|
165 | ymax : None, | |
132 | """ |
|
166 | """ | |
133 |
if dataOut.flagNoData: |
|
167 | if dataOut.flagNoData: | |
134 | return dataOut |
|
168 | return dataOut | |
135 |
|
169 | |||
136 | if channelList == None: |
|
170 | if channelList == None: | |
137 | channelIndexList = dataOut.channelIndexList |
|
171 | channelIndexList = dataOut.channelIndexList | |
138 | else: |
|
172 | else: | |
@@ -141,20 +175,22 class Scope_(Figure): | |||||
141 | if channel not in dataOut.channelList: |
|
175 | if channel not in dataOut.channelList: | |
142 | raise ValueError("Channel %d is not in dataOut.channelList") |
|
176 | raise ValueError("Channel %d is not in dataOut.channelList") | |
143 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
177 | channelIndexList.append(dataOut.channelList.index(channel)) | |
144 |
|
178 | |||
145 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
179 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) | |
146 |
|
180 | ### print("***************** PLOTEO **************************") | ||
|
181 | ### print(dataOut.nProfiles) | |||
|
182 | ### print(dataOut.heightList.shape) | |||
147 | if dataOut.flagDataAsBlock: |
|
183 | if dataOut.flagDataAsBlock: | |
148 |
|
184 | |||
149 | for i in range(dataOut.nProfiles): |
|
185 | for i in range(dataOut.nProfiles): | |
150 |
|
186 | |||
151 | wintitle1 = wintitle + " [Profile = %d] " %i |
|
187 | wintitle1 = wintitle + " [Profile = %d] " %i | |
152 |
|
188 | |||
153 | if type == "power": |
|
189 | if type == "power": | |
154 |
self.plot_power(dataOut.heightList, |
|
190 | self.plot_power(dataOut.heightList, | |
155 | dataOut.data[:,i,:], |
|
191 | dataOut.data[:,i,:], | |
156 |
id, |
|
192 | id, | |
157 |
channelIndexList, |
|
193 | channelIndexList, | |
158 | thisDatetime, |
|
194 | thisDatetime, | |
159 | wintitle1, |
|
195 | wintitle1, | |
160 | show, |
|
196 | show, | |
@@ -162,12 +198,38 class Scope_(Figure): | |||||
162 | xmax, |
|
198 | xmax, | |
163 | ymin, |
|
199 | ymin, | |
164 | ymax) |
|
200 | ymax) | |
165 |
|
201 | |||
|
202 | if type == "weatherpower": | |||
|
203 | self.plot_weatherpower(dataOut.heightList, | |||
|
204 | dataOut.data[:,i,:], | |||
|
205 | id, | |||
|
206 | channelIndexList, | |||
|
207 | thisDatetime, | |||
|
208 | wintitle1, | |||
|
209 | show, | |||
|
210 | xmin, | |||
|
211 | xmax, | |||
|
212 | ymin, | |||
|
213 | ymax) | |||
|
214 | ||||
|
215 | if type == "weathervelocity": | |||
|
216 | self.plot_weatherpower(dataOut.heightList, | |||
|
217 | dataOut.data_velocity[:,i,:], | |||
|
218 | id, | |||
|
219 | channelIndexList, | |||
|
220 | thisDatetime, | |||
|
221 | wintitle1, | |||
|
222 | show, | |||
|
223 | xmin, | |||
|
224 | xmax, | |||
|
225 | ymin, | |||
|
226 | ymax) | |||
|
227 | ||||
166 | if type == "iq": |
|
228 | if type == "iq": | |
167 |
self.plot_iq(dataOut.heightList, |
|
229 | self.plot_iq(dataOut.heightList, | |
168 | dataOut.data[:,i,:], |
|
230 | dataOut.data[:,i,:], | |
169 |
id, |
|
231 | id, | |
170 |
channelIndexList, |
|
232 | channelIndexList, | |
171 | thisDatetime, |
|
233 | thisDatetime, | |
172 | wintitle1, |
|
234 | wintitle1, | |
173 | show, |
|
235 | show, | |
@@ -175,27 +237,27 class Scope_(Figure): | |||||
175 | xmax, |
|
237 | xmax, | |
176 | ymin, |
|
238 | ymin, | |
177 | ymax) |
|
239 | ymax) | |
178 |
|
240 | |||
179 | self.draw() |
|
241 | self.draw() | |
180 |
|
242 | |||
181 | str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
243 | str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S") | |
182 | figfile = self.getFilename(name = str_datetime) + "_" + str(i) |
|
244 | figfile = self.getFilename(name = str_datetime) + "_" + str(i) | |
183 |
|
245 | |||
184 | self.save(figpath=figpath, |
|
246 | self.save(figpath=figpath, | |
185 | figfile=figfile, |
|
247 | figfile=figfile, | |
186 | save=save, |
|
248 | save=save, | |
187 | ftp=ftp, |
|
249 | ftp=ftp, | |
188 | wr_period=wr_period, |
|
250 | wr_period=wr_period, | |
189 | thisDatetime=thisDatetime) |
|
251 | thisDatetime=thisDatetime) | |
190 |
|
252 | |||
191 | else: |
|
253 | else: | |
192 | wintitle += " [Profile = %d] " %dataOut.profileIndex |
|
254 | wintitle += " [Profile = %d] " %dataOut.profileIndex | |
193 |
|
255 | |||
194 | if type == "power": |
|
256 | if type == "power": | |
195 |
self.plot_power(dataOut.heightList, |
|
257 | self.plot_power(dataOut.heightList, | |
196 | dataOut.data, |
|
258 | dataOut.data, | |
197 |
id, |
|
259 | id, | |
198 |
channelIndexList, |
|
260 | channelIndexList, | |
199 | thisDatetime, |
|
261 | thisDatetime, | |
200 | wintitle, |
|
262 | wintitle, | |
201 | show, |
|
263 | show, | |
@@ -203,12 +265,12 class Scope_(Figure): | |||||
203 | xmax, |
|
265 | xmax, | |
204 | ymin, |
|
266 | ymin, | |
205 | ymax) |
|
267 | ymax) | |
206 |
|
268 | |||
207 | if type == "iq": |
|
269 | if type == "iq": | |
208 |
self.plot_iq(dataOut.heightList, |
|
270 | self.plot_iq(dataOut.heightList, | |
209 | dataOut.data, |
|
271 | dataOut.data, | |
210 |
id, |
|
272 | id, | |
211 |
channelIndexList, |
|
273 | channelIndexList, | |
212 | thisDatetime, |
|
274 | thisDatetime, | |
213 | wintitle, |
|
275 | wintitle, | |
214 | show, |
|
276 | show, | |
@@ -216,12 +278,12 class Scope_(Figure): | |||||
216 | xmax, |
|
278 | xmax, | |
217 | ymin, |
|
279 | ymin, | |
218 | ymax) |
|
280 | ymax) | |
219 |
|
281 | |||
220 | self.draw() |
|
282 | self.draw() | |
221 |
|
283 | |||
222 | str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S") + "_" + str(dataOut.profileIndex) |
|
284 | str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S") + "_" + str(dataOut.profileIndex) | |
223 |
figfile = self.getFilename(name = str_datetime) |
|
285 | figfile = self.getFilename(name = str_datetime) | |
224 |
|
286 | |||
225 | self.save(figpath=figpath, |
|
287 | self.save(figpath=figpath, | |
226 | figfile=figfile, |
|
288 | figfile=figfile, | |
227 | save=save, |
|
289 | save=save, | |
@@ -229,4 +291,4 class Scope_(Figure): | |||||
229 | wr_period=wr_period, |
|
291 | wr_period=wr_period, | |
230 | thisDatetime=thisDatetime) |
|
292 | thisDatetime=thisDatetime) | |
231 |
|
293 | |||
232 |
return dataOut |
|
294 | return dataOut |
@@ -23,6 +23,8 MSKYMAP_CODE = 23 | |||||
23 | MPHASE_CODE = 24 |
|
23 | MPHASE_CODE = 24 | |
24 |
|
24 | |||
25 | MOMENTS_CODE = 25 |
|
25 | MOMENTS_CODE = 25 | |
26 | PARMS_CODE = 26 |
|
26 | PARMS_CODE = 26 | |
27 | SPECFIT_CODE = 27 |
|
27 | SPECFIT_CODE = 27 | |
28 | EWDRIFT_CODE = 28 |
|
28 | EWDRIFT_CODE = 28 | |
|
29 | ||||
|
30 | WPO_CODE = 29 #Weather Intensity - Power |
@@ -183,7 +183,7 class ParamReader(JRODataReader,ProcessingUnit): | |||||
183 | except IOError: |
|
183 | except IOError: | |
184 | traceback.print_exc() |
|
184 | traceback.print_exc() | |
185 | raise IOError("The file %s can't be opened" %(filename)) |
|
185 | raise IOError("The file %s can't be opened" %(filename)) | |
186 |
|
186 | |||
187 | #In case has utctime attribute |
|
187 | #In case has utctime attribute | |
188 | grp2 = grp1['utctime'] |
|
188 | grp2 = grp1['utctime'] | |
189 | # thisUtcTime = grp2.value[0] - 5*3600 #To convert to local time |
|
189 | # thisUtcTime = grp2.value[0] - 5*3600 #To convert to local time | |
@@ -497,7 +497,7 class ParamWriter(Operation): | |||||
497 | setType = None |
|
497 | setType = None | |
498 |
|
498 | |||
499 | def __init__(self): |
|
499 | def __init__(self): | |
500 |
|
500 | |||
501 | Operation.__init__(self) |
|
501 | Operation.__init__(self) | |
502 | return |
|
502 | return | |
503 |
|
503 | |||
@@ -530,9 +530,9 class ParamWriter(Operation): | |||||
530 | dsDict['variable'] = self.dataList[i] |
|
530 | dsDict['variable'] = self.dataList[i] | |
531 | #--------------------- Conditionals ------------------------ |
|
531 | #--------------------- Conditionals ------------------------ | |
532 | #There is no data |
|
532 | #There is no data | |
533 |
|
533 | |||
534 | if dataAux is None: |
|
534 | if dataAux is None: | |
535 |
|
535 | |||
536 | return 0 |
|
536 | return 0 | |
537 |
|
537 | |||
538 | if isinstance(dataAux, (int, float, numpy.integer, numpy.float)): |
|
538 | if isinstance(dataAux, (int, float, numpy.integer, numpy.float)): | |
@@ -704,7 +704,7 class ParamWriter(Operation): | |||||
704 | return False |
|
704 | return False | |
705 |
|
705 | |||
706 | def setNextFile(self): |
|
706 | def setNextFile(self): | |
707 |
|
707 | |||
708 | ext = self.ext |
|
708 | ext = self.ext | |
709 | path = self.path |
|
709 | path = self.path | |
710 | setFile = self.setFile |
|
710 | setFile = self.setFile | |
@@ -785,7 +785,7 class ParamWriter(Operation): | |||||
785 | for j in range(dsInfo['dsNumber']): |
|
785 | for j in range(dsInfo['dsNumber']): | |
786 | dsInfo = dsList[i] |
|
786 | dsInfo = dsList[i] | |
787 | tableName = dsInfo['dsName'] |
|
787 | tableName = dsInfo['dsName'] | |
788 |
|
788 | |||
789 |
|
789 | |||
790 | if dsInfo['nDim'] == 3: |
|
790 | if dsInfo['nDim'] == 3: | |
791 | shape = dsInfo['shape'].astype(int) |
|
791 | shape = dsInfo['shape'].astype(int) | |
@@ -869,7 +869,8 class ParamWriter(Operation): | |||||
869 | dsList = self.dsList |
|
869 | dsList = self.dsList | |
870 | data = self.data |
|
870 | data = self.data | |
871 | ind = 0 |
|
871 | ind = 0 | |
872 |
|
872 | #print("dsList ",dsList) | ||
|
873 | #print("len ",len(dsList)) | |||
873 | while ind < len(dsList): |
|
874 | while ind < len(dsList): | |
874 | dsInfo = dsList[ind] |
|
875 | dsInfo = dsList[ind] | |
875 | dataAux = getattr(self.dataOut, dsInfo['variable']) |
|
876 | dataAux = getattr(self.dataOut, dsInfo['variable']) | |
@@ -902,22 +903,41 class ParamWriter(Operation): | |||||
902 | dsList = self.dsList |
|
903 | dsList = self.dsList | |
903 |
|
904 | |||
904 | for i in range(len(self.ds)): |
|
905 | for i in range(len(self.ds)): | |
|
906 | print("#############", i , "#######################") | |||
905 | dsInfo = dsList[i] |
|
907 | dsInfo = dsList[i] | |
906 | nDim = dsInfo['nDim'] |
|
908 | nDim = dsInfo['nDim'] | |
907 | mode = dsInfo['mode'] |
|
909 | mode = dsInfo['mode'] | |
908 |
|
910 | print("dsInfo",dsInfo) | ||
|
911 | print("nDim",nDim) | |||
|
912 | print("mode",mode) | |||
909 | # First time |
|
913 | # First time | |
910 | if self.firsttime: |
|
914 | if self.firsttime: | |
|
915 | print("ENTRE FIRSTIME") | |||
911 | if type(self.data[i]) == numpy.ndarray: |
|
916 | if type(self.data[i]) == numpy.ndarray: | |
912 |
|
917 | |||
913 | if nDim == 3: |
|
918 | if nDim == 3: | |
|
919 | print("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") | |||
|
920 | print("ndim","dentro del primer if 3") | |||
914 | self.data[i] = self.data[i].reshape((self.data[i].shape[0],self.data[i].shape[1],1)) |
|
921 | self.data[i] = self.data[i].reshape((self.data[i].shape[0],self.data[i].shape[1],1)) | |
|
922 | print(self.data[i].shape) | |||
|
923 | print(type(self.data[i])) | |||
915 | self.ds[i].resize(self.data[i].shape) |
|
924 | self.ds[i].resize(self.data[i].shape) | |
|
925 | print(self.ds[i].shape) | |||
|
926 | print(type(self.ds[i])) | |||
916 | if mode == 2: |
|
927 | if mode == 2: | |
917 | self.ds[i].resize(self.data[i].shape) |
|
928 | self.ds[i].resize(self.data[i].shape) | |
918 | self.ds[i][:] = self.data[i] |
|
929 | try: | |
919 | else: |
|
930 | print("PTM ODIO ESTO") | |
|
931 | print(self.ds[i][:].shape) | |||
|
932 | self.ds[i][:] = self.data[i] | |||
|
933 | print("*****___________********______******") | |||
920 |
|
934 | |||
|
935 | except: | |||
|
936 | print("q habra pasaado") | |||
|
937 | return | |||
|
938 | print("LLEGUE Y CUMPLI EL IF") | |||
|
939 | else: | |||
|
940 | print("ELSE -----------------------") | |||
921 | # From second time |
|
941 | # From second time | |
922 | # Meteors! |
|
942 | # Meteors! | |
923 | if mode == 2: |
|
943 | if mode == 2: | |
@@ -944,7 +964,8 class ParamWriter(Operation): | |||||
944 |
|
964 | |||
945 | self.firsttime = False |
|
965 | self.firsttime = False | |
946 | self.blockIndex += 1 |
|
966 | self.blockIndex += 1 | |
947 |
|
967 | print("HOLA AMIGOS COMO ESTAN LLEGUE") | ||
|
968 | print("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") | |||
948 | #Close to save changes |
|
969 | #Close to save changes | |
949 | self.fp.flush() |
|
970 | self.fp.flush() | |
950 | self.fp.close() |
|
971 | self.fp.close() | |
@@ -954,7 +975,7 class ParamWriter(Operation): | |||||
954 |
|
975 | |||
955 | self.dataOut = dataOut |
|
976 | self.dataOut = dataOut | |
956 | if not(self.isConfig): |
|
977 | if not(self.isConfig): | |
957 |
self.setup(dataOut, path=path, blocksPerFile=blocksPerFile, |
|
978 | self.setup(dataOut, path=path, blocksPerFile=blocksPerFile, | |
958 | metadataList=metadataList, dataList=dataList, mode=mode, |
|
979 | metadataList=metadataList, dataList=dataList, mode=mode, | |
959 | setType=setType) |
|
980 | setType=setType) | |
960 |
|
981 | |||
@@ -963,7 +984,7 class ParamWriter(Operation): | |||||
963 |
|
984 | |||
964 | self.putData() |
|
985 | self.putData() | |
965 | return |
|
986 | return | |
966 |
|
987 | |||
967 |
|
988 | |||
968 | @MPDecorator |
|
989 | @MPDecorator | |
969 | class ParameterReader(Reader, ProcessingUnit): |
|
990 | class ParameterReader(Reader, ProcessingUnit): | |
@@ -992,43 +1013,43 class ParameterReader(Reader, ProcessingUnit): | |||||
992 |
|
1013 | |||
993 | self.set_kwargs(**kwargs) |
|
1014 | self.set_kwargs(**kwargs) | |
994 | if not self.ext.startswith('.'): |
|
1015 | if not self.ext.startswith('.'): | |
995 |
self.ext = '.{}'.format(self.ext) |
|
1016 | self.ext = '.{}'.format(self.ext) | |
996 |
|
1017 | |||
997 | if self.online: |
|
1018 | if self.online: | |
998 | log.log("Searching files in online mode...", self.name) |
|
1019 | log.log("Searching files in online mode...", self.name) | |
999 |
|
1020 | |||
1000 | for nTries in range(self.nTries): |
|
1021 | for nTries in range(self.nTries): | |
1001 | fullpath = self.searchFilesOnLine(self.path, self.startDate, |
|
1022 | fullpath = self.searchFilesOnLine(self.path, self.startDate, | |
1002 |
self.endDate, self.expLabel, self.ext, self.walk, |
|
1023 | self.endDate, self.expLabel, self.ext, self.walk, | |
1003 | self.filefmt, self.folderfmt) |
|
1024 | self.filefmt, self.folderfmt) | |
1004 |
|
1025 | |||
1005 | try: |
|
1026 | try: | |
1006 | fullpath = next(fullpath) |
|
1027 | fullpath = next(fullpath) | |
1007 | except: |
|
1028 | except: | |
1008 | fullpath = None |
|
1029 | fullpath = None | |
1009 |
|
1030 | |||
1010 | if fullpath: |
|
1031 | if fullpath: | |
1011 | break |
|
1032 | break | |
1012 |
|
1033 | |||
1013 | log.warning( |
|
1034 | log.warning( | |
1014 | 'Waiting {} sec for a valid file in {}: try {} ...'.format( |
|
1035 | 'Waiting {} sec for a valid file in {}: try {} ...'.format( | |
1015 |
self.delay, self.path, nTries + 1), |
|
1036 | self.delay, self.path, nTries + 1), | |
1016 | self.name) |
|
1037 | self.name) | |
1017 | time.sleep(self.delay) |
|
1038 | time.sleep(self.delay) | |
1018 |
|
1039 | |||
1019 | if not(fullpath): |
|
1040 | if not(fullpath): | |
1020 | raise schainpy.admin.SchainError( |
|
1041 | raise schainpy.admin.SchainError( | |
1021 |
'There isn\'t any valid file in {}'.format(self.path)) |
|
1042 | 'There isn\'t any valid file in {}'.format(self.path)) | |
1022 |
|
1043 | |||
1023 | pathname, filename = os.path.split(fullpath) |
|
1044 | pathname, filename = os.path.split(fullpath) | |
1024 | self.year = int(filename[1:5]) |
|
1045 | self.year = int(filename[1:5]) | |
1025 | self.doy = int(filename[5:8]) |
|
1046 | self.doy = int(filename[5:8]) | |
1026 |
self.set = int(filename[8:11]) - 1 |
|
1047 | self.set = int(filename[8:11]) - 1 | |
1027 | else: |
|
1048 | else: | |
1028 | log.log("Searching files in {}".format(self.path), self.name) |
|
1049 | log.log("Searching files in {}".format(self.path), self.name) | |
1029 |
self.filenameList = self.searchFilesOffLine(self.path, self.startDate, |
|
1050 | self.filenameList = self.searchFilesOffLine(self.path, self.startDate, | |
1030 | self.endDate, self.expLabel, self.ext, self.walk, self.filefmt, self.folderfmt) |
|
1051 | self.endDate, self.expLabel, self.ext, self.walk, self.filefmt, self.folderfmt) | |
1031 |
|
1052 | |||
1032 | self.setNextFile() |
|
1053 | self.setNextFile() | |
1033 |
|
1054 | |||
1034 | return |
|
1055 | return | |
@@ -1036,11 +1057,11 class ParameterReader(Reader, ProcessingUnit): | |||||
1036 | def readFirstHeader(self): |
|
1057 | def readFirstHeader(self): | |
1037 | '''Read metadata and data''' |
|
1058 | '''Read metadata and data''' | |
1038 |
|
1059 | |||
1039 |
self.__readMetadata() |
|
1060 | self.__readMetadata() | |
1040 | self.__readData() |
|
1061 | self.__readData() | |
1041 | self.__setBlockList() |
|
1062 | self.__setBlockList() | |
1042 | self.blockIndex = 0 |
|
1063 | self.blockIndex = 0 | |
1043 |
|
1064 | |||
1044 | return |
|
1065 | return | |
1045 |
|
1066 | |||
1046 | def __setBlockList(self): |
|
1067 | def __setBlockList(self): | |
@@ -1099,7 +1120,7 class ParameterReader(Reader, ProcessingUnit): | |||||
1099 | else: |
|
1120 | else: | |
1100 | data = gp[name].value |
|
1121 | data = gp[name].value | |
1101 | listMetaname.append(name) |
|
1122 | listMetaname.append(name) | |
1102 |
listMetadata.append(data) |
|
1123 | listMetadata.append(data) | |
1103 | elif self.metadata: |
|
1124 | elif self.metadata: | |
1104 | metadata = json.loads(self.metadata) |
|
1125 | metadata = json.loads(self.metadata) | |
1105 | listShapes = {} |
|
1126 | listShapes = {} | |
@@ -1115,7 +1136,7 class ParameterReader(Reader, ProcessingUnit): | |||||
1115 |
|
1136 | |||
1116 | self.listShapes = listShapes |
|
1137 | self.listShapes = listShapes | |
1117 | self.listMetaname = listMetaname |
|
1138 | self.listMetaname = listMetaname | |
1118 |
self.listMeta = listMetadata |
|
1139 | self.listMeta = listMetadata | |
1119 |
|
1140 | |||
1120 | return |
|
1141 | return | |
1121 |
|
1142 | |||
@@ -1123,7 +1144,7 class ParameterReader(Reader, ProcessingUnit): | |||||
1123 |
|
1144 | |||
1124 | listdataname = [] |
|
1145 | listdataname = [] | |
1125 | listdata = [] |
|
1146 | listdata = [] | |
1126 |
|
1147 | |||
1127 | if 'Data' in self.fp: |
|
1148 | if 'Data' in self.fp: | |
1128 | grp = self.fp['Data'] |
|
1149 | grp = self.fp['Data'] | |
1129 | for item in list(grp.items()): |
|
1150 | for item in list(grp.items()): | |
@@ -1137,7 +1158,7 class ParameterReader(Reader, ProcessingUnit): | |||||
1137 | for i in range(dim): |
|
1158 | for i in range(dim): | |
1138 | array.append(grp[name]['table{:02d}'.format(i)].value) |
|
1159 | array.append(grp[name]['table{:02d}'.format(i)].value) | |
1139 | array = numpy.array(array) |
|
1160 | array = numpy.array(array) | |
1140 |
|
1161 | |||
1141 | listdata.append(array) |
|
1162 | listdata.append(array) | |
1142 | elif self.metadata: |
|
1163 | elif self.metadata: | |
1143 | metadata = json.loads(self.metadata) |
|
1164 | metadata = json.loads(self.metadata) | |
@@ -1160,7 +1181,7 class ParameterReader(Reader, ProcessingUnit): | |||||
1160 | self.listDataname = listdataname |
|
1181 | self.listDataname = listdataname | |
1161 | self.listData = listdata |
|
1182 | self.listData = listdata | |
1162 | return |
|
1183 | return | |
1163 |
|
1184 | |||
1164 | def getData(self): |
|
1185 | def getData(self): | |
1165 |
|
1186 | |||
1166 | for i in range(len(self.listMeta)): |
|
1187 | for i in range(len(self.listMeta)): | |
@@ -1230,7 +1251,7 class ParameterWriter(Operation): | |||||
1230 | lastTime = None |
|
1251 | lastTime = None | |
1231 |
|
1252 | |||
1232 | def __init__(self): |
|
1253 | def __init__(self): | |
1233 |
|
1254 | |||
1234 | Operation.__init__(self) |
|
1255 | Operation.__init__(self) | |
1235 | return |
|
1256 | return | |
1236 |
|
1257 | |||
@@ -1257,7 +1278,7 class ParameterWriter(Operation): | |||||
1257 | dsDict['nDim'] = len(dataAux.shape) |
|
1278 | dsDict['nDim'] = len(dataAux.shape) | |
1258 | dsDict['shape'] = dataAux.shape |
|
1279 | dsDict['shape'] = dataAux.shape | |
1259 | dsDict['dsNumber'] = dataAux.shape[0] |
|
1280 | dsDict['dsNumber'] = dataAux.shape[0] | |
1260 |
|
1281 | |||
1261 | dsList.append(dsDict) |
|
1282 | dsList.append(dsDict) | |
1262 | tableList.append((self.dataList[i], dsDict['nDim'])) |
|
1283 | tableList.append((self.dataList[i], dsDict['nDim'])) | |
1263 |
|
1284 | |||
@@ -1274,7 +1295,7 class ParameterWriter(Operation): | |||||
1274 | self.lastTime = currentTime |
|
1295 | self.lastTime = currentTime | |
1275 | self.currentDay = dataDay |
|
1296 | self.currentDay = dataDay | |
1276 | return False |
|
1297 | return False | |
1277 |
|
1298 | |||
1278 | timeDiff = currentTime - self.lastTime |
|
1299 | timeDiff = currentTime - self.lastTime | |
1279 |
|
1300 | |||
1280 | #Si el dia es diferente o si la diferencia entre un dato y otro supera la hora |
|
1301 | #Si el dia es diferente o si la diferencia entre un dato y otro supera la hora | |
@@ -1292,7 +1313,7 class ParameterWriter(Operation): | |||||
1292 |
|
1313 | |||
1293 | self.dataOut = dataOut |
|
1314 | self.dataOut = dataOut | |
1294 | if not(self.isConfig): |
|
1315 | if not(self.isConfig): | |
1295 |
self.setup(path=path, blocksPerFile=blocksPerFile, |
|
1316 | self.setup(path=path, blocksPerFile=blocksPerFile, | |
1296 | metadataList=metadataList, dataList=dataList, |
|
1317 | metadataList=metadataList, dataList=dataList, | |
1297 | setType=setType) |
|
1318 | setType=setType) | |
1298 |
|
1319 | |||
@@ -1301,9 +1322,9 class ParameterWriter(Operation): | |||||
1301 |
|
1322 | |||
1302 | self.putData() |
|
1323 | self.putData() | |
1303 | return |
|
1324 | return | |
1304 |
|
1325 | |||
1305 | def setNextFile(self): |
|
1326 | def setNextFile(self): | |
1306 |
|
1327 | |||
1307 | ext = self.ext |
|
1328 | ext = self.ext | |
1308 | path = self.path |
|
1329 | path = self.path | |
1309 | setFile = self.setFile |
|
1330 | setFile = self.setFile | |
@@ -1369,17 +1390,17 class ParameterWriter(Operation): | |||||
1369 | return |
|
1390 | return | |
1370 |
|
1391 | |||
1371 | def writeData(self, fp): |
|
1392 | def writeData(self, fp): | |
1372 |
|
1393 | |||
1373 | grp = fp.create_group("Data") |
|
1394 | grp = fp.create_group("Data") | |
1374 | dtsets = [] |
|
1395 | dtsets = [] | |
1375 | data = [] |
|
1396 | data = [] | |
1376 |
|
1397 | |||
1377 | for dsInfo in self.dsList: |
|
1398 | for dsInfo in self.dsList: | |
1378 | if dsInfo['nDim'] == 0: |
|
1399 | if dsInfo['nDim'] == 0: | |
1379 | ds = grp.create_dataset( |
|
1400 | ds = grp.create_dataset( | |
1380 |
dsInfo['variable'], |
|
1401 | dsInfo['variable'], | |
1381 | (self.blocksPerFile, ), |
|
1402 | (self.blocksPerFile, ), | |
1382 |
chunks=True, |
|
1403 | chunks=True, | |
1383 | dtype=numpy.float64) |
|
1404 | dtype=numpy.float64) | |
1384 | dtsets.append(ds) |
|
1405 | dtsets.append(ds) | |
1385 | data.append((dsInfo['variable'], -1)) |
|
1406 | data.append((dsInfo['variable'], -1)) | |
@@ -1387,7 +1408,7 class ParameterWriter(Operation): | |||||
1387 | sgrp = grp.create_group(dsInfo['variable']) |
|
1408 | sgrp = grp.create_group(dsInfo['variable']) | |
1388 | for i in range(dsInfo['dsNumber']): |
|
1409 | for i in range(dsInfo['dsNumber']): | |
1389 | ds = sgrp.create_dataset( |
|
1410 | ds = sgrp.create_dataset( | |
1390 |
'table{:02d}'.format(i), |
|
1411 | 'table{:02d}'.format(i), | |
1391 | (self.blocksPerFile, ) + dsInfo['shape'][1:], |
|
1412 | (self.blocksPerFile, ) + dsInfo['shape'][1:], | |
1392 | chunks=True) |
|
1413 | chunks=True) | |
1393 | dtsets.append(ds) |
|
1414 | dtsets.append(ds) | |
@@ -1395,7 +1416,7 class ParameterWriter(Operation): | |||||
1395 | fp.flush() |
|
1416 | fp.flush() | |
1396 |
|
1417 | |||
1397 | log.log('Creating file: {}'.format(fp.filename), self.name) |
|
1418 | log.log('Creating file: {}'.format(fp.filename), self.name) | |
1398 |
|
1419 | |||
1399 | self.ds = dtsets |
|
1420 | self.ds = dtsets | |
1400 | self.data = data |
|
1421 | self.data = data | |
1401 | self.firsttime = True |
|
1422 | self.firsttime = True | |
@@ -1409,10 +1430,12 class ParameterWriter(Operation): | |||||
1409 | self.setNextFile() |
|
1430 | self.setNextFile() | |
1410 |
|
1431 | |||
1411 | for i, ds in enumerate(self.ds): |
|
1432 | for i, ds in enumerate(self.ds): | |
|
1433 | print(i,ds) | |||
1412 | attr, ch = self.data[i] |
|
1434 | attr, ch = self.data[i] | |
1413 | if ch == -1: |
|
1435 | if ch == -1: | |
1414 | ds[self.blockIndex] = getattr(self.dataOut, attr) |
|
1436 | ds[self.blockIndex] = getattr(self.dataOut, attr) | |
1415 | else: |
|
1437 | else: | |
|
1438 | print(ch, getattr(self.dataOut, attr).shape) | |||
1416 | ds[self.blockIndex] = getattr(self.dataOut, attr)[ch] |
|
1439 | ds[self.blockIndex] = getattr(self.dataOut, attr)[ch] | |
1417 |
|
1440 | |||
1418 | self.fp.flush() |
|
1441 | self.fp.flush() |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file | ||
The requested commit or file is too big and content was truncated. Show full diff |
@@ -94,6 +94,12 class SpectraProc(ProcessingUnit): | |||||
94 | blocksize += dc.size |
|
94 | blocksize += dc.size | |
95 | blocksize += spc.size |
|
95 | blocksize += spc.size | |
96 |
|
96 | |||
|
97 | #print("spc :",spc.shape) | |||
|
98 | data_wr = None | |||
|
99 | if self.dataOut.flagWR: | |||
|
100 | data_wr = fft_volt | |||
|
101 | blocksize = fft_volt.size | |||
|
102 | ||||
97 | cspc = None |
|
103 | cspc = None | |
98 | pairIndex = 0 |
|
104 | pairIndex = 0 | |
99 | if self.dataOut.pairsList != None: |
|
105 | if self.dataOut.pairsList != None: | |
@@ -113,16 +119,20 class SpectraProc(ProcessingUnit): | |||||
113 | pairIndex += 1 |
|
119 | pairIndex += 1 | |
114 | blocksize += cspc.size |
|
120 | blocksize += cspc.size | |
115 |
|
121 | |||
116 | self.dataOut.data_spc = spc |
|
122 | self.dataOut.data_spc = spc | |
117 | self.dataOut.data_cspc = cspc |
|
123 | self.dataOut.data_cspc = cspc | |
118 |
self.dataOut.data_ |
|
124 | self.dataOut.data_wr = data_wr | |
119 |
self.dataOut. |
|
125 | self.dataOut.data_dc = dc | |
|
126 | self.dataOut.blockSize = blocksize | |||
120 | self.dataOut.flagShiftFFT = False |
|
127 | self.dataOut.flagShiftFFT = False | |
121 |
|
128 | |||
122 | def run(self, nProfiles=None, nFFTPoints=None, pairsList=[], ippFactor=None, shift_fft=False): |
|
129 | def run(self, nProfiles=None, nFFTPoints=None, pairsList=[], ippFactor=None, shift_fft=False,flagWR= 0): | |
|
130 | ||||
|
131 | self.dataOut.flagWR = flagWR | |||
123 |
|
132 | |||
124 | if self.dataIn.type == "Spectra": |
|
133 | if self.dataIn.type == "Spectra": | |
125 | self.dataOut.copy(self.dataIn) |
|
134 | self.dataOut.copy(self.dataIn) | |
|
135 | ||||
126 | if shift_fft: |
|
136 | if shift_fft: | |
127 | #desplaza a la derecha en el eje 2 determinadas posiciones |
|
137 | #desplaza a la derecha en el eje 2 determinadas posiciones | |
128 | shift = int(self.dataOut.nFFTPoints/2) |
|
138 | shift = int(self.dataOut.nFFTPoints/2) | |
@@ -135,7 +145,7 class SpectraProc(ProcessingUnit): | |||||
135 | return True |
|
145 | return True | |
136 |
|
146 | |||
137 | if self.dataIn.type == "Voltage": |
|
147 | if self.dataIn.type == "Voltage": | |
138 |
|
148 | #print("VOLTAGE INPUT SPECTRA") | ||
139 | self.dataOut.flagNoData = True |
|
149 | self.dataOut.flagNoData = True | |
140 |
|
150 | |||
141 | if nFFTPoints == None: |
|
151 | if nFFTPoints == None: | |
@@ -157,6 +167,7 class SpectraProc(ProcessingUnit): | |||||
157 | nProfiles, |
|
167 | nProfiles, | |
158 | self.dataIn.nHeights), |
|
168 | self.dataIn.nHeights), | |
159 | dtype='complex') |
|
169 | dtype='complex') | |
|
170 | #print("buffer :",self.buffer.shape) | |||
160 |
|
171 | |||
161 | if self.dataIn.flagDataAsBlock: |
|
172 | if self.dataIn.flagDataAsBlock: | |
162 | nVoltProfiles = self.dataIn.data.shape[1] |
|
173 | nVoltProfiles = self.dataIn.data.shape[1] | |
@@ -182,6 +193,7 class SpectraProc(ProcessingUnit): | |||||
182 | self.dataOut.flagNoData = True |
|
193 | self.dataOut.flagNoData = True | |
183 | return 0 |
|
194 | return 0 | |
184 | else: |
|
195 | else: | |
|
196 | #print("Spectra ",self.profIndex) | |||
185 | self.buffer[:, self.profIndex, :] = self.dataIn.data.copy() |
|
197 | self.buffer[:, self.profIndex, :] = self.dataIn.data.copy() | |
186 | self.profIndex += 1 |
|
198 | self.profIndex += 1 | |
187 |
|
199 | |||
@@ -191,6 +203,7 class SpectraProc(ProcessingUnit): | |||||
191 | if self.profIndex == nProfiles: |
|
203 | if self.profIndex == nProfiles: | |
192 | self.__updateSpecFromVoltage() |
|
204 | self.__updateSpecFromVoltage() | |
193 | self.__getFft() |
|
205 | self.__getFft() | |
|
206 | #print(" DATAOUT SHAPE SPEC",self.dataOut.data_spc.shape) | |||
194 |
|
207 | |||
195 | self.dataOut.flagNoData = False |
|
208 | self.dataOut.flagNoData = False | |
196 | self.firstdatatime = None |
|
209 | self.firstdatatime = None | |
@@ -291,16 +304,16 class SpectraProc(ProcessingUnit): | |||||
291 | # self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] |
|
304 | # self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] | |
292 | self.dataOut.channelList = range(len(channelIndexList)) |
|
305 | self.dataOut.channelList = range(len(channelIndexList)) | |
293 | self.__selectPairsByChannel(channelIndexList) |
|
306 | self.__selectPairsByChannel(channelIndexList) | |
294 |
|
307 | |||
295 | return 1 |
|
308 | return 1 | |
296 |
|
309 | |||
297 |
|
310 | |||
298 | def selectFFTs(self, minFFT, maxFFT ): |
|
311 | def selectFFTs(self, minFFT, maxFFT ): | |
299 | """ |
|
312 | """ | |
300 |
Selecciona un bloque de datos en base a un grupo de valores de puntos FFTs segun el rango |
|
313 | Selecciona un bloque de datos en base a un grupo de valores de puntos FFTs segun el rango | |
301 | minFFT<= FFT <= maxFFT |
|
314 | minFFT<= FFT <= maxFFT | |
302 | """ |
|
315 | """ | |
303 |
|
316 | |||
304 | if (minFFT > maxFFT): |
|
317 | if (minFFT > maxFFT): | |
305 | raise ValueError("Error selecting heights: Height range (%d,%d) is not valid" % (minFFT, maxFFT)) |
|
318 | raise ValueError("Error selecting heights: Height range (%d,%d) is not valid" % (minFFT, maxFFT)) | |
306 |
|
319 | |||
@@ -330,20 +343,20 class SpectraProc(ProcessingUnit): | |||||
330 | self.selectFFTsByIndex(minIndex, maxIndex) |
|
343 | self.selectFFTsByIndex(minIndex, maxIndex) | |
331 |
|
344 | |||
332 | return 1 |
|
345 | return 1 | |
333 |
|
346 | |||
334 |
|
347 | |||
335 | def setH0(self, h0, deltaHeight = None): |
|
348 | def setH0(self, h0, deltaHeight = None): | |
336 |
|
349 | |||
337 | if not deltaHeight: |
|
350 | if not deltaHeight: | |
338 | deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0] |
|
351 | deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0] | |
339 |
|
352 | |||
340 | nHeights = self.dataOut.nHeights |
|
353 | nHeights = self.dataOut.nHeights | |
341 |
|
354 | |||
342 | newHeiRange = h0 + numpy.arange(nHeights)*deltaHeight |
|
355 | newHeiRange = h0 + numpy.arange(nHeights)*deltaHeight | |
343 |
|
356 | |||
344 | self.dataOut.heightList = newHeiRange |
|
357 | self.dataOut.heightList = newHeiRange | |
345 |
|
358 | |||
346 |
|
359 | |||
347 | def selectHeights(self, minHei, maxHei): |
|
360 | def selectHeights(self, minHei, maxHei): | |
348 | """ |
|
361 | """ | |
349 | Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango |
|
362 | Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango | |
@@ -360,7 +373,7 class SpectraProc(ProcessingUnit): | |||||
360 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 |
|
373 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 | |
361 | """ |
|
374 | """ | |
362 |
|
375 | |||
363 |
|
376 | |||
364 | if (minHei > maxHei): |
|
377 | if (minHei > maxHei): | |
365 | raise ValueError("Error selecting heights: Height range (%d,%d) is not valid" % (minHei, maxHei)) |
|
378 | raise ValueError("Error selecting heights: Height range (%d,%d) is not valid" % (minHei, maxHei)) | |
366 |
|
379 | |||
@@ -388,7 +401,7 class SpectraProc(ProcessingUnit): | |||||
388 | maxIndex = len(heights) |
|
401 | maxIndex = len(heights) | |
389 |
|
402 | |||
390 | self.selectHeightsByIndex(minIndex, maxIndex) |
|
403 | self.selectHeightsByIndex(minIndex, maxIndex) | |
391 |
|
404 | |||
392 |
|
405 | |||
393 | return 1 |
|
406 | return 1 | |
394 |
|
407 | |||
@@ -436,7 +449,7 class SpectraProc(ProcessingUnit): | |||||
436 |
|
449 | |||
437 | def selectFFTsByIndex(self, minIndex, maxIndex): |
|
450 | def selectFFTsByIndex(self, minIndex, maxIndex): | |
438 | """ |
|
451 | """ | |
439 |
|
452 | |||
440 | """ |
|
453 | """ | |
441 |
|
454 | |||
442 | if (minIndex < 0) or (minIndex > maxIndex): |
|
455 | if (minIndex < 0) or (minIndex > maxIndex): | |
@@ -459,7 +472,7 class SpectraProc(ProcessingUnit): | |||||
459 | self.dataOut.data_spc = data_spc |
|
472 | self.dataOut.data_spc = data_spc | |
460 | self.dataOut.data_cspc = data_cspc |
|
473 | self.dataOut.data_cspc = data_cspc | |
461 | self.dataOut.data_dc = data_dc |
|
474 | self.dataOut.data_dc = data_dc | |
462 |
|
475 | |||
463 | self.dataOut.ippSeconds = self.dataOut.ippSeconds*(self.dataOut.nFFTPoints / numpy.shape(data_cspc)[1]) |
|
476 | self.dataOut.ippSeconds = self.dataOut.ippSeconds*(self.dataOut.nFFTPoints / numpy.shape(data_cspc)[1]) | |
464 | self.dataOut.nFFTPoints = numpy.shape(data_cspc)[1] |
|
477 | self.dataOut.nFFTPoints = numpy.shape(data_cspc)[1] | |
465 | self.dataOut.profilesPerBlock = numpy.shape(data_cspc)[1] |
|
478 | self.dataOut.profilesPerBlock = numpy.shape(data_cspc)[1] | |
@@ -552,7 +565,7 class SpectraProc(ProcessingUnit): | |||||
552 | xx_inv = numpy.linalg.inv(xx) |
|
565 | xx_inv = numpy.linalg.inv(xx) | |
553 | xx_aux = xx_inv[0, :] |
|
566 | xx_aux = xx_inv[0, :] | |
554 |
|
567 | |||
555 |
for ich in range(num_chan): |
|
568 | for ich in range(num_chan): | |
556 | yy = jspectra[ich, ind_vel, :] |
|
569 | yy = jspectra[ich, ind_vel, :] | |
557 | jspectra[ich, freq_dc, :] = numpy.dot(xx_aux, yy) |
|
570 | jspectra[ich, freq_dc, :] = numpy.dot(xx_aux, yy) | |
558 |
|
571 | |||
@@ -574,12 +587,12 class SpectraProc(ProcessingUnit): | |||||
574 | return 1 |
|
587 | return 1 | |
575 |
|
588 | |||
576 | def removeInterference2(self): |
|
589 | def removeInterference2(self): | |
577 |
|
590 | |||
578 | cspc = self.dataOut.data_cspc |
|
591 | cspc = self.dataOut.data_cspc | |
579 | spc = self.dataOut.data_spc |
|
592 | spc = self.dataOut.data_spc | |
580 |
Heights = numpy.arange(cspc.shape[2]) |
|
593 | Heights = numpy.arange(cspc.shape[2]) | |
581 | realCspc = numpy.abs(cspc) |
|
594 | realCspc = numpy.abs(cspc) | |
582 |
|
595 | |||
583 | for i in range(cspc.shape[0]): |
|
596 | for i in range(cspc.shape[0]): | |
584 | LinePower= numpy.sum(realCspc[i], axis=0) |
|
597 | LinePower= numpy.sum(realCspc[i], axis=0) | |
585 | Threshold = numpy.amax(LinePower)-numpy.sort(LinePower)[len(Heights)-int(len(Heights)*0.1)] |
|
598 | Threshold = numpy.amax(LinePower)-numpy.sort(LinePower)[len(Heights)-int(len(Heights)*0.1)] | |
@@ -587,17 +600,17 class SpectraProc(ProcessingUnit): | |||||
587 | InterferenceSum = numpy.sum( realCspc[i,:,SelectedHeights], axis=0 ) |
|
600 | InterferenceSum = numpy.sum( realCspc[i,:,SelectedHeights], axis=0 ) | |
588 | InterferenceThresholdMin = numpy.sort(InterferenceSum)[int(len(InterferenceSum)*0.98)] |
|
601 | InterferenceThresholdMin = numpy.sort(InterferenceSum)[int(len(InterferenceSum)*0.98)] | |
589 | InterferenceThresholdMax = numpy.sort(InterferenceSum)[int(len(InterferenceSum)*0.99)] |
|
602 | InterferenceThresholdMax = numpy.sort(InterferenceSum)[int(len(InterferenceSum)*0.99)] | |
590 |
|
603 | |||
591 |
|
604 | |||
592 | InterferenceRange = numpy.where( ([InterferenceSum > InterferenceThresholdMin]))# , InterferenceSum < InterferenceThresholdMax]) ) |
|
605 | InterferenceRange = numpy.where( ([InterferenceSum > InterferenceThresholdMin]))# , InterferenceSum < InterferenceThresholdMax]) ) | |
593 | #InterferenceRange = numpy.where( ([InterferenceRange < InterferenceThresholdMax])) |
|
606 | #InterferenceRange = numpy.where( ([InterferenceRange < InterferenceThresholdMax])) | |
594 | if len(InterferenceRange)<int(cspc.shape[1]*0.3): |
|
607 | if len(InterferenceRange)<int(cspc.shape[1]*0.3): | |
595 | cspc[i,InterferenceRange,:] = numpy.NaN |
|
608 | cspc[i,InterferenceRange,:] = numpy.NaN | |
596 |
|
609 | |||
597 |
|
610 | |||
598 |
|
611 | |||
599 | self.dataOut.data_cspc = cspc |
|
612 | self.dataOut.data_cspc = cspc | |
600 |
|
613 | |||
601 | def removeInterference(self, interf = 2,hei_interf = None, nhei_interf = None, offhei_interf = None): |
|
614 | def removeInterference(self, interf = 2,hei_interf = None, nhei_interf = None, offhei_interf = None): | |
602 |
|
615 | |||
603 | jspectra = self.dataOut.data_spc |
|
616 | jspectra = self.dataOut.data_spc | |
@@ -931,7 +944,7 class IncohInt(Operation): | |||||
931 | if n is not None: |
|
944 | if n is not None: | |
932 | self.n = int(n) |
|
945 | self.n = int(n) | |
933 | else: |
|
946 | else: | |
934 |
|
947 | |||
935 | self.__integrationtime = int(timeInterval) |
|
948 | self.__integrationtime = int(timeInterval) | |
936 | self.n = None |
|
949 | self.n = None | |
937 | self.__byTime = True |
|
950 | self.__byTime = True | |
@@ -941,6 +954,9 class IncohInt(Operation): | |||||
941 | Add a profile to the __buffer_spc and increase in one the __profileIndex |
|
954 | Add a profile to the __buffer_spc and increase in one the __profileIndex | |
942 |
|
955 | |||
943 | """ |
|
956 | """ | |
|
957 | print("profIndex: ",self.__profIndex) | |||
|
958 | print("data_spc.shape: ",data_spc.shape) | |||
|
959 | print("data_spc.shape: ",data_spc[0,0,:]) | |||
944 |
|
960 | |||
945 | self.__buffer_spc += data_spc |
|
961 | self.__buffer_spc += data_spc | |
946 |
|
962 | |||
@@ -1032,7 +1048,7 class IncohInt(Operation): | |||||
1032 | def run(self, dataOut, n=None, timeInterval=None, overlapping=False): |
|
1048 | def run(self, dataOut, n=None, timeInterval=None, overlapping=False): | |
1033 | if n == 1: |
|
1049 | if n == 1: | |
1034 | return |
|
1050 | return | |
1035 |
|
1051 | |||
1036 | dataOut.flagNoData = True |
|
1052 | dataOut.flagNoData = True | |
1037 |
|
1053 | |||
1038 | if not self.isConfig: |
|
1054 | if not self.isConfig: | |
@@ -1048,9 +1064,197 class IncohInt(Operation): | |||||
1048 |
|
1064 | |||
1049 | dataOut.data_spc = avgdata_spc |
|
1065 | dataOut.data_spc = avgdata_spc | |
1050 | dataOut.data_cspc = avgdata_cspc |
|
1066 | dataOut.data_cspc = avgdata_cspc | |
1051 |
dataOut.data_dc = avgdata_dc |
|
1067 | dataOut.data_dc = avgdata_dc | |
1052 | dataOut.nIncohInt *= self.n |
|
1068 | dataOut.nIncohInt *= self.n | |
1053 | dataOut.utctime = avgdatatime |
|
1069 | dataOut.utctime = avgdatatime | |
1054 | dataOut.flagNoData = False |
|
1070 | dataOut.flagNoData = False | |
1055 |
|
1071 | |||
1056 | return dataOut No newline at end of file |
|
1072 | return dataOut | |
|
1073 | ||||
|
1074 | ||||
|
1075 | class PulsePair(Operation): | |||
|
1076 | isConfig = False | |||
|
1077 | __profIndex = 0 | |||
|
1078 | __profIndex2 = 0 | |||
|
1079 | __initime = None | |||
|
1080 | __lastdatatime = None | |||
|
1081 | __buffer = None | |||
|
1082 | __buffer2 = [] | |||
|
1083 | __buffer3 = None | |||
|
1084 | __dataReady = False | |||
|
1085 | n = None | |||
|
1086 | ||||
|
1087 | __nch =0 | |||
|
1088 | __nProf =0 | |||
|
1089 | __nHeis =0 | |||
|
1090 | ||||
|
1091 | def __init__(self,**kwargs): | |||
|
1092 | Operation.__init__(self,**kwargs) | |||
|
1093 | ||||
|
1094 | def setup(self,dataOut,n =None, m = None): | |||
|
1095 | ||||
|
1096 | self.__initime = None | |||
|
1097 | self.__lastdatatime = 0 | |||
|
1098 | self.__buffer = 0 | |||
|
1099 | self.__bufferV = 0 | |||
|
1100 | #self.__buffer2 = [] | |||
|
1101 | self.__buffer3 = 0 | |||
|
1102 | self.__dataReady = False | |||
|
1103 | self.__profIndex = 0 | |||
|
1104 | self.__profIndex2 = 0 | |||
|
1105 | self.count = 0 | |||
|
1106 | ||||
|
1107 | ||||
|
1108 | self.__nch = dataOut.nChannels | |||
|
1109 | self.__nHeis = dataOut.nHeights | |||
|
1110 | self.__nProf = dataOut.nProfiles | |||
|
1111 | self.__nFFT = dataOut.nFFTPoints | |||
|
1112 | #print("Valores de Ch,Samples,Perfiles,nFFT",self.__nch,self.__nHeis,self.__nProf, self.__nFFT) | |||
|
1113 | #print("EL VALOR DE n es:",n) | |||
|
1114 | if n == None: | |||
|
1115 | raise ValueError("n Should be specified.") | |||
|
1116 | ||||
|
1117 | if n != None: | |||
|
1118 | if n<2: | |||
|
1119 | raise ValueError("n Should be greather than 2 ") | |||
|
1120 | self.n = n | |||
|
1121 | if m == None: | |||
|
1122 | m = n | |||
|
1123 | if m != None: | |||
|
1124 | if m<2: | |||
|
1125 | raise ValueError("n Should be greather than 2 ") | |||
|
1126 | ||||
|
1127 | self.m = m | |||
|
1128 | self.__buffer2 = numpy.zeros((self.__nch,self.m,self.__nHeis)) | |||
|
1129 | self.__bufferV2 = numpy.zeros((self.__nch,self.m,self.__nHeis)) | |||
|
1130 | ||||
|
1131 | ||||
|
1132 | ||||
|
1133 | def putData(self,data): | |||
|
1134 | #print("###################################################") | |||
|
1135 | ''' | |||
|
1136 | data_tmp = numpy.zeros(self.__nch,self.n,self.__nHeis, dtype= complex) | |||
|
1137 | if self.count < self.__nProf: | |||
|
1138 | ||||
|
1139 | for i in range(self.n): | |||
|
1140 | data_tmp[:,i,:] = data[:,i+self.count,:] | |||
|
1141 | ||||
|
1142 | self.__buffer = data_tmp*numpy.conjugate(data_tmp) | |||
|
1143 | ||||
|
1144 | ||||
|
1145 | #####self.__buffer = data*numpy.conjugate(data) | |||
|
1146 | #####self.__bufferV = data[:,(self.__nProf-1):,:]*numpy.conjugate(data[:,1:,:]) | |||
|
1147 | ||||
|
1148 | #self.__buffer2.append(numpy.conjugate(data)) | |||
|
1149 | ||||
|
1150 | #####self.__profIndex = data.shape[1] | |||
|
1151 | self.count = self.count + self.n -1 | |||
|
1152 | self.__profIndex = self.n | |||
|
1153 | ''' | |||
|
1154 | self.__buffer = data*numpy.conjugate(data) | |||
|
1155 | self.__bufferV = data[:,(self.__nProf-1):,:]*numpy.conjugate(data[:,1:,:]) | |||
|
1156 | self.__profIndex = self.n | |||
|
1157 | return | |||
|
1158 | ||||
|
1159 | def pushData(self): | |||
|
1160 | ||||
|
1161 | data_I = numpy.zeros((self.__nch,self.__nHeis)) | |||
|
1162 | data_IV = numpy.zeros((self.__nch,self.__nHeis)) | |||
|
1163 | ||||
|
1164 | for i in range(self.__nch): | |||
|
1165 | data_I[i,:] = numpy.sum(numpy.sum(self.__buffer[i],axis=0),axis=0)/self.n | |||
|
1166 | data_IV[i,:] = numpy.sum(numpy.sum(self.__bufferV[i],axis=0),axis=0)/(self.n-1) | |||
|
1167 | ||||
|
1168 | n = self.__profIndex | |||
|
1169 | ####data_intensity = numpy.sum(numpy.sum(self.__buffer,axis=0),axis=0)/self.n | |||
|
1170 | #print("data_intensity push data",data_intensity.shape) | |||
|
1171 | #data_velocity = self.__buffer3/(self.n-1) | |||
|
1172 | ####n = self.__profIndex | |||
|
1173 | ||||
|
1174 | self.__buffer = 0 | |||
|
1175 | self.__buffer3 = 0 | |||
|
1176 | self.__profIndex = 0 | |||
|
1177 | ||||
|
1178 | #return data_intensity,data_velocity,n | |||
|
1179 | return data_I,data_IV,n | |||
|
1180 | ||||
|
1181 | def pulsePairbyProfiles(self,data): | |||
|
1182 | self.__dataReady = False | |||
|
1183 | data_intensity = None | |||
|
1184 | data_velocity = None | |||
|
1185 | ||||
|
1186 | self.putData(data) | |||
|
1187 | ||||
|
1188 | if self.__profIndex == self.n: | |||
|
1189 | #data_intensity,data_velocity,n = self.pushData() | |||
|
1190 | data_intensity,data_velocity,n = self.pushData() | |||
|
1191 | #print(data_intensity.shape) | |||
|
1192 | #print("self.__profIndex2", self.__profIndex2) | |||
|
1193 | if self.__profIndex2 == 0: | |||
|
1194 | #print("PRIMERA VEZ") | |||
|
1195 | #print("self.__buffer2",self.__buffer2) | |||
|
1196 | for i in range(self.__nch): | |||
|
1197 | self.__buffer2[i][self.__profIndex2] = data_intensity[i] | |||
|
1198 | self.__bufferV2[i][self.__profIndex2] = data_velocity[i] | |||
|
1199 | self.__profIndex2 += 1 | |||
|
1200 | return None,None | |||
|
1201 | ||||
|
1202 | if self.__profIndex2 > 0: | |||
|
1203 | for i in range(self.__nch): | |||
|
1204 | self.__buffer2[i][self.__profIndex2] = data_intensity[i] | |||
|
1205 | self.__bufferV2[i][self.__profIndex2] = data_velocity[i] | |||
|
1206 | #print("Dentro del bucle",self.__buffer2) | |||
|
1207 | self.__profIndex2 += 1 | |||
|
1208 | if self.__profIndex2 == self.m : | |||
|
1209 | data_i = self.__buffer2 | |||
|
1210 | data_v = self.__bufferV2 | |||
|
1211 | #print(data_i.shape) | |||
|
1212 | self.__dataReady = True | |||
|
1213 | self.__profIndex2 = 0 | |||
|
1214 | self.__buffer2 = numpy.zeros((self.__nch,self.m,self.__nHeis)) | |||
|
1215 | self.__bufferV2 = numpy.zeros((self.__nch,self.m,self.__nHeis)) | |||
|
1216 | return data_i,data_v | |||
|
1217 | return None,None | |||
|
1218 | ||||
|
1219 | def pulsePairOp(self,data,datatime=None): | |||
|
1220 | if self.__initime == None: | |||
|
1221 | self.__initime = datatime | |||
|
1222 | ||||
|
1223 | data_intensity,data_velocity = self.pulsePairbyProfiles(data) | |||
|
1224 | self.__lastdatatime = datatime | |||
|
1225 | ||||
|
1226 | if data_intensity is None: | |||
|
1227 | return None,None,None | |||
|
1228 | ||||
|
1229 | avgdatatime = self.__initime | |||
|
1230 | self.__initime = datatime | |||
|
1231 | ||||
|
1232 | return data_intensity,data_velocity,avgdatatime | |||
|
1233 | ||||
|
1234 | def run(self,dataOut,n =None,m=None): | |||
|
1235 | ||||
|
1236 | if not self.isConfig: | |||
|
1237 | self.setup(dataOut = dataOut, n = n, m = m) | |||
|
1238 | self.isConfig = True | |||
|
1239 | ||||
|
1240 | data_intensity,data_velocity,avgdatatime = self.pulsePairOp(dataOut.data_wr,dataOut.utctime) | |||
|
1241 | dataOut.flagNoData = True | |||
|
1242 | ||||
|
1243 | if self.__dataReady: | |||
|
1244 | #print(" DATA " , data_intensity.shape) | |||
|
1245 | #dataOut.data = numpy.array([data_intensity])#aqui amigo revisa | |||
|
1246 | #tmp = numpy.zeros([1,data_intensity.shape[0],data_intensity.shape[1]]) | |||
|
1247 | #tmp[0] = data_intensity | |||
|
1248 | dataOut.data = data_intensity | |||
|
1249 | dataOut.data_velocity = data_velocity | |||
|
1250 | #dataOut.data = tmp | |||
|
1251 | #print(" DATA " , dataOut.data.shape) | |||
|
1252 | dataOut.nIncohInt *= self.n | |||
|
1253 | dataOut.nProfiles = self.m | |||
|
1254 | dataOut.nFFTPoints = self.m | |||
|
1255 | #dataOut.data_intensity = data_intensity | |||
|
1256 | dataOut.PRFbyAngle = self.n | |||
|
1257 | dataOut.utctime = avgdatatime | |||
|
1258 | dataOut.flagNoData = False | |||
|
1259 | #####print("TIEMPO: ",dataOut.utctime) | |||
|
1260 | return dataOut |
@@ -8,8 +8,8 from time import time | |||||
8 |
|
8 | |||
9 |
|
9 | |||
10 | @MPDecorator |
|
10 | @MPDecorator | |
11 |
class VoltageProc(ProcessingUnit): |
|
11 | class VoltageProc(ProcessingUnit): | |
12 |
|
12 | |||
13 | def __init__(self): |
|
13 | def __init__(self): | |
14 |
|
14 | |||
15 | ProcessingUnit.__init__(self) |
|
15 | ProcessingUnit.__init__(self) | |
@@ -115,7 +115,7 class VoltageProc(ProcessingUnit): | |||||
115 | self.dataOut.data = data |
|
115 | self.dataOut.data = data | |
116 | # self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] |
|
116 | # self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] | |
117 | self.dataOut.channelList = range(len(channelIndexList)) |
|
117 | self.dataOut.channelList = range(len(channelIndexList)) | |
118 |
|
118 | |||
119 | return 1 |
|
119 | return 1 | |
120 |
|
120 | |||
121 | def selectHeights(self, minHei=None, maxHei=None): |
|
121 | def selectHeights(self, minHei=None, maxHei=None): | |
@@ -229,7 +229,7 class VoltageProc(ProcessingUnit): | |||||
229 | """ |
|
229 | """ | |
230 | Si la data es obtenida por bloques, dimension = [nChannels, nProfiles, nHeis] |
|
230 | Si la data es obtenida por bloques, dimension = [nChannels, nProfiles, nHeis] | |
231 | """ |
|
231 | """ | |
232 |
buffer = self.dataOut.data[:, :, 0:int(self.dataOut.nHeights-r)] |
|
232 | buffer = self.dataOut.data[:, :, 0:int(self.dataOut.nHeights-r)] | |
233 | buffer = buffer.reshape(self.dataOut.nChannels, self.dataOut.nProfiles, int(self.dataOut.nHeights/window), window) |
|
233 | buffer = buffer.reshape(self.dataOut.nChannels, self.dataOut.nProfiles, int(self.dataOut.nHeights/window), window) | |
234 | buffer = numpy.sum(buffer,3) |
|
234 | buffer = numpy.sum(buffer,3) | |
235 |
|
235 | |||
@@ -384,14 +384,16 class CohInt(Operation): | |||||
384 | """ |
|
384 | """ | |
385 |
|
385 | |||
386 | if not self.__withOverlapping: |
|
386 | if not self.__withOverlapping: | |
|
387 | print("inside over") | |||
387 | self.__buffer += data.copy() |
|
388 | self.__buffer += data.copy() | |
388 | self.__profIndex += 1 |
|
389 | self.__profIndex += 1 | |
389 | return |
|
390 | return | |
390 |
|
391 | |||
391 | #Overlapping data |
|
392 | #Overlapping data | |
392 | nChannels, nHeis = data.shape |
|
393 | nChannels, nHeis = data.shape | |
|
394 | print("show me the light",data.shape) | |||
393 | data = numpy.reshape(data, (1, nChannels, nHeis)) |
|
395 | data = numpy.reshape(data, (1, nChannels, nHeis)) | |
394 |
|
396 | print(data.shape) | ||
395 | #If the buffer is empty then it takes the data value |
|
397 | #If the buffer is empty then it takes the data value | |
396 | if self.__buffer is None: |
|
398 | if self.__buffer is None: | |
397 | self.__buffer = data |
|
399 | self.__buffer = data | |
@@ -422,6 +424,7 class CohInt(Operation): | |||||
422 | """ |
|
424 | """ | |
423 |
|
425 | |||
424 | if not self.__withOverlapping: |
|
426 | if not self.__withOverlapping: | |
|
427 | #print("ahora que fue") | |||
425 | data = self.__buffer |
|
428 | data = self.__buffer | |
426 | n = self.__profIndex |
|
429 | n = self.__profIndex | |
427 |
|
430 | |||
@@ -430,6 +433,7 class CohInt(Operation): | |||||
430 |
|
433 | |||
431 | return data, n |
|
434 | return data, n | |
432 |
|
435 | |||
|
436 | #print("cual funciona") | |||
433 | #Integration with Overlapping |
|
437 | #Integration with Overlapping | |
434 | data = numpy.sum(self.__buffer, axis=0) |
|
438 | data = numpy.sum(self.__buffer, axis=0) | |
435 | # print data |
|
439 | # print data | |
@@ -445,6 +449,7 class CohInt(Operation): | |||||
445 | # n = None |
|
449 | # n = None | |
446 | # print data |
|
450 | # print data | |
447 | # raise |
|
451 | # raise | |
|
452 | #print("beforeputdata") | |||
448 | self.putData(data) |
|
453 | self.putData(data) | |
449 |
|
454 | |||
450 | if self.__profIndex == self.n: |
|
455 | if self.__profIndex == self.n: | |
@@ -497,8 +502,8 class CohInt(Operation): | |||||
497 | # print self.__bufferStride[self.__profIndexStride - 1] |
|
502 | # print self.__bufferStride[self.__profIndexStride - 1] | |
498 | # raise |
|
503 | # raise | |
499 | return self.__bufferStride[self.__profIndexStride - 1] |
|
504 | return self.__bufferStride[self.__profIndexStride - 1] | |
500 |
|
505 | |||
501 |
|
506 | |||
502 | return None, None |
|
507 | return None, None | |
503 |
|
508 | |||
504 | def integrate(self, data, datatime=None): |
|
509 | def integrate(self, data, datatime=None): | |
@@ -520,7 +525,7 class CohInt(Operation): | |||||
520 | avgdatatime = self.__initime |
|
525 | avgdatatime = self.__initime | |
521 |
|
526 | |||
522 | deltatime = datatime - self.__lastdatatime |
|
527 | deltatime = datatime - self.__lastdatatime | |
523 |
|
528 | |||
524 | if not self.__withOverlapping: |
|
529 | if not self.__withOverlapping: | |
525 | self.__initime = datatime |
|
530 | self.__initime = datatime | |
526 | else: |
|
531 | else: | |
@@ -546,7 +551,7 class CohInt(Operation): | |||||
546 | avgdatatime = (times - 1) * timeInterval + dataOut.utctime |
|
551 | avgdatatime = (times - 1) * timeInterval + dataOut.utctime | |
547 | self.__dataReady = True |
|
552 | self.__dataReady = True | |
548 | return avgdata, avgdatatime |
|
553 | return avgdata, avgdatatime | |
549 |
|
554 | |||
550 | def run(self, dataOut, n=None, timeInterval=None, stride=None, overlapping=False, byblock=False, **kwargs): |
|
555 | def run(self, dataOut, n=None, timeInterval=None, stride=None, overlapping=False, byblock=False, **kwargs): | |
551 |
|
556 | |||
552 | if not self.isConfig: |
|
557 | if not self.isConfig: | |
@@ -560,12 +565,12 class CohInt(Operation): | |||||
560 | avgdata, avgdatatime = self.integrateByBlock(dataOut) |
|
565 | avgdata, avgdatatime = self.integrateByBlock(dataOut) | |
561 | dataOut.nProfiles /= self.n |
|
566 | dataOut.nProfiles /= self.n | |
562 | else: |
|
567 | else: | |
563 |
if stride is None: |
|
568 | if stride is None: | |
564 | avgdata, avgdatatime = self.integrate(dataOut.data, dataOut.utctime) |
|
569 | avgdata, avgdatatime = self.integrate(dataOut.data, dataOut.utctime) | |
565 | else: |
|
570 | else: | |
566 | avgdata, avgdatatime = self.integrateByStride(dataOut.data, dataOut.utctime) |
|
571 | avgdata, avgdatatime = self.integrateByStride(dataOut.data, dataOut.utctime) | |
567 |
|
572 | |||
568 |
|
573 | |||
569 | # dataOut.timeInterval *= n |
|
574 | # dataOut.timeInterval *= n | |
570 | dataOut.flagNoData = True |
|
575 | dataOut.flagNoData = True | |
571 |
|
576 | |||
@@ -670,11 +675,11 class Decoder(Operation): | |||||
670 | junk = junk.flatten() |
|
675 | junk = junk.flatten() | |
671 | code_block = numpy.reshape(junk, (self.nCode*repetitions, self.nBaud)) |
|
676 | code_block = numpy.reshape(junk, (self.nCode*repetitions, self.nBaud)) | |
672 | profilesList = range(self.__nProfiles) |
|
677 | profilesList = range(self.__nProfiles) | |
673 |
|
678 | |||
674 |
for i in range(self.__nChannels): |
|
679 | for i in range(self.__nChannels): | |
675 |
for j in profilesList: |
|
680 | for j in profilesList: | |
676 |
self.datadecTime[i,j,:] = numpy.correlate(data[i,j,:], code_block[j,:], mode='full')[self.nBaud-1:] |
|
681 | self.datadecTime[i,j,:] = numpy.correlate(data[i,j,:], code_block[j,:], mode='full')[self.nBaud-1:] | |
677 |
return self.datadecTime |
|
682 | return self.datadecTime | |
678 |
|
683 | |||
679 | def __convolutionByBlockInFreq(self, data): |
|
684 | def __convolutionByBlockInFreq(self, data): | |
680 |
|
685 | |||
@@ -691,7 +696,7 class Decoder(Operation): | |||||
691 |
|
696 | |||
692 | return data |
|
697 | return data | |
693 |
|
698 | |||
694 |
|
699 | |||
695 | def run(self, dataOut, code=None, nCode=None, nBaud=None, mode = 0, osamp=None, times=None): |
|
700 | def run(self, dataOut, code=None, nCode=None, nBaud=None, mode = 0, osamp=None, times=None): | |
696 |
|
701 | |||
697 | if dataOut.flagDecodeData: |
|
702 | if dataOut.flagDecodeData: | |
@@ -722,7 +727,7 class Decoder(Operation): | |||||
722 |
|
727 | |||
723 | self.__nProfiles = dataOut.nProfiles |
|
728 | self.__nProfiles = dataOut.nProfiles | |
724 | datadec = None |
|
729 | datadec = None | |
725 |
|
730 | |||
726 | if mode == 3: |
|
731 | if mode == 3: | |
727 | mode = 0 |
|
732 | mode = 0 | |
728 |
|
733 | |||
@@ -1105,9 +1110,9 class SplitProfiles(Operation): | |||||
1105 |
|
1110 | |||
1106 | if shape[2] % n != 0: |
|
1111 | if shape[2] % n != 0: | |
1107 | raise ValueError("Could not split the data, n=%d has to be multiple of %d" %(n, shape[2])) |
|
1112 | raise ValueError("Could not split the data, n=%d has to be multiple of %d" %(n, shape[2])) | |
1108 |
|
1113 | |||
1109 | new_shape = shape[0], shape[1]*n, int(shape[2]/n) |
|
1114 | new_shape = shape[0], shape[1]*n, int(shape[2]/n) | |
1110 |
|
1115 | |||
1111 | dataOut.data = numpy.reshape(dataOut.data, new_shape) |
|
1116 | dataOut.data = numpy.reshape(dataOut.data, new_shape) | |
1112 | dataOut.flagNoData = False |
|
1117 | dataOut.flagNoData = False | |
1113 |
|
1118 | |||
@@ -1191,6 +1196,296 class CombineProfiles(Operation): | |||||
1191 | dataOut.ippSeconds *= n |
|
1196 | dataOut.ippSeconds *= n | |
1192 |
|
1197 | |||
1193 | return dataOut |
|
1198 | return dataOut | |
|
1199 | ||||
|
1200 | ||||
|
1201 | ||||
|
1202 | class CreateBlockVoltage(Operation): | |||
|
1203 | ||||
|
1204 | isConfig = False | |||
|
1205 | __Index = 0 | |||
|
1206 | bufferShape = None | |||
|
1207 | buffer = None | |||
|
1208 | firstdatatime = None | |||
|
1209 | ||||
|
1210 | def __init__(self,**kwargs): | |||
|
1211 | Operation.__init__(self,**kwargs) | |||
|
1212 | self.isConfig = False | |||
|
1213 | self.__Index = 0 | |||
|
1214 | self.firstdatatime = None | |||
|
1215 | ||||
|
1216 | def setup(self,dataOut, m = None ): | |||
|
1217 | ''' | |||
|
1218 | m= Numero perfiles | |||
|
1219 | ''' | |||
|
1220 | #print("CONFIGURANDO CBV") | |||
|
1221 | self.__nChannels = dataOut.nChannels | |||
|
1222 | self.__nHeis = dataOut.nHeights | |||
|
1223 | shape = dataOut.data.shape #nchannels, nprofiles, nsamples | |||
|
1224 | #print("input nChannels",self.__nChannels) | |||
|
1225 | #print("input nHeis",self.__nHeis) | |||
|
1226 | #print("SETUP CREATE BLOCK VOLTAGE") | |||
|
1227 | #print("input Shape",shape) | |||
|
1228 | #print("dataOut.nProfiles",dataOut.nProfiles) | |||
|
1229 | numberSamples = self.__nHeis | |||
|
1230 | numberProfile = int(m) | |||
|
1231 | dataOut.nProfiles = numberProfile | |||
|
1232 | #print("new numberProfile",numberProfile) | |||
|
1233 | #print("new numberSamples",numberSamples) | |||
|
1234 | ||||
|
1235 | self.bufferShape = shape[0], numberProfile, numberSamples # nchannels,nprofiles,nsamples | |||
|
1236 | self.buffer = numpy.zeros((self.bufferShape)) | |||
|
1237 | self.bufferVel = numpy.zeros((self.bufferShape)) | |||
|
1238 | ||||
|
1239 | def run(self, dataOut, m=None): | |||
|
1240 | #print("RUN") | |||
|
1241 | dataOut.flagNoData = True | |||
|
1242 | dataOut.flagDataAsBlock = False | |||
|
1243 | #print("BLOCK INDEX ",self.__Index) | |||
|
1244 | ||||
|
1245 | if not self.isConfig: | |||
|
1246 | self.setup(dataOut, m= m) | |||
|
1247 | self.isConfig = True | |||
|
1248 | if self.__Index < m: | |||
|
1249 | #print("PROFINDEX BLOCK CBV",self.__Index) | |||
|
1250 | self.buffer[:,self.__Index,:] = dataOut.data | |||
|
1251 | self.bufferVel[:,self.__Index,:] = dataOut.data_velocity | |||
|
1252 | self.__Index += 1 | |||
|
1253 | dataOut.flagNoData = True | |||
|
1254 | ||||
|
1255 | if self.firstdatatime == None: | |||
|
1256 | self.firstdatatime = dataOut.utctime | |||
|
1257 | ||||
|
1258 | if self.__Index == m: | |||
|
1259 | #print("**********************************************") | |||
|
1260 | #print("self.buffer.shape ",self.buffer.shape) | |||
|
1261 | #print("##############",self.firstdatatime) | |||
|
1262 | ##print("*********************************************") | |||
|
1263 | ##print("*********************************************") | |||
|
1264 | ##print("******* nProfiles *******", dataOut.nProfiles) | |||
|
1265 | ##print("*********************************************") | |||
|
1266 | ##print("*********************************************") | |||
|
1267 | dataOut.data = self.buffer | |||
|
1268 | dataOut.data_velocity = self.bufferVel | |||
|
1269 | dataOut.utctime = self.firstdatatime | |||
|
1270 | dataOut.nProfiles = m | |||
|
1271 | self.firstdatatime = None | |||
|
1272 | dataOut.flagNoData = False | |||
|
1273 | dataOut.flagDataAsBlock = True | |||
|
1274 | self.__Index = 0 | |||
|
1275 | dataOut.identifierWR = True | |||
|
1276 | return dataOut | |||
|
1277 | ||||
|
1278 | class PulsePairVoltage(Operation): | |||
|
1279 | ''' | |||
|
1280 | Function PulsePair(Signal Power, Velocity) | |||
|
1281 | The real component of Lag[0] provides Intensity Information | |||
|
1282 | The imag component of Lag[1] Phase provides Velocity Information | |||
|
1283 | ||||
|
1284 | Configuration Parameters: | |||
|
1285 | nPRF = Number of Several PRF | |||
|
1286 | theta = Degree Azimuth angel Boundaries | |||
|
1287 | ||||
|
1288 | Input: | |||
|
1289 | self.dataOut | |||
|
1290 | lag[N] | |||
|
1291 | Affected: | |||
|
1292 | self.dataOut.spc | |||
|
1293 | ''' | |||
|
1294 | isConfig = False | |||
|
1295 | __profIndex = 0 | |||
|
1296 | __initime = None | |||
|
1297 | __lastdatatime = None | |||
|
1298 | __buffer = None | |||
|
1299 | __buffer2 = [] | |||
|
1300 | __buffer3 = None | |||
|
1301 | __dataReady = False | |||
|
1302 | n = None | |||
|
1303 | __nch = 0 | |||
|
1304 | __nHeis = 0 | |||
|
1305 | ||||
|
1306 | def __init__(self,**kwargs): | |||
|
1307 | Operation.__init__(self,**kwargs) | |||
|
1308 | ||||
|
1309 | def setup(self, dataOut, n = None ): | |||
|
1310 | ''' | |||
|
1311 | n= Numero de PRF's de entrada | |||
|
1312 | ''' | |||
|
1313 | self.__initime = None | |||
|
1314 | self.__lastdatatime = 0 | |||
|
1315 | self.__dataReady = False | |||
|
1316 | self.__buffer = 0 | |||
|
1317 | self.__buffer2 = [] | |||
|
1318 | self.__buffer3 = 0 | |||
|
1319 | self.__profIndex = 0 | |||
|
1320 | ||||
|
1321 | self.__nch = dataOut.nChannels | |||
|
1322 | self.__nHeis = dataOut.nHeights | |||
|
1323 | ||||
|
1324 | print("ELVALOR DE n es:", n) | |||
|
1325 | if n == None: | |||
|
1326 | raise ValueError("n should be specified.") | |||
|
1327 | ||||
|
1328 | if n != None: | |||
|
1329 | if n<2: | |||
|
1330 | raise ValueError("n should be greater than 2") | |||
|
1331 | ||||
|
1332 | self.n = n | |||
|
1333 | self.__nProf = n | |||
|
1334 | ''' | |||
|
1335 | if overlapping: | |||
|
1336 | self.__withOverlapping = True | |||
|
1337 | self.__buffer = None | |||
|
1338 | ||||
|
1339 | else: | |||
|
1340 | #print ("estoy sin __withO") | |||
|
1341 | self.__withOverlapping = False | |||
|
1342 | self.__buffer = 0 | |||
|
1343 | self.__buffer2 = [] | |||
|
1344 | self.__buffer3 = 0 | |||
|
1345 | ''' | |||
|
1346 | ||||
|
1347 | def putData(self,data): | |||
|
1348 | ''' | |||
|
1349 | Add a profile to he __buffer and increase in one the __profiel Index | |||
|
1350 | ''' | |||
|
1351 | #print("self.__profIndex :",self.__profIndex) | |||
|
1352 | self.__buffer += data*numpy.conjugate(data) | |||
|
1353 | self.__buffer2.append(numpy.conjugate(data)) | |||
|
1354 | if self.__profIndex > 0: | |||
|
1355 | self.__buffer3 += self.__buffer2[self.__profIndex-1]*data | |||
|
1356 | self.__profIndex += 1 | |||
|
1357 | return | |||
|
1358 | ''' | |||
|
1359 | if not self.__withOverlapping: | |||
|
1360 | #print("Putdata inside over") | |||
|
1361 | self.__buffer += data* numpy.conjugate(data) | |||
|
1362 | self.__buffer2.append(numpy.conjugate(data)) | |||
|
1363 | ||||
|
1364 | if self.__profIndex >0: | |||
|
1365 | self.__buffer3 += self.__buffer2[self.__profIndex-1]*data | |||
|
1366 | self.__profIndex += 1 | |||
|
1367 | return | |||
|
1368 | ||||
|
1369 | if self.__buffer is None: | |||
|
1370 | #print("aqui bro") | |||
|
1371 | self.__buffer = data* numpy.conjugate(data) | |||
|
1372 | self.__buffer2.append(numpy.conjugate(data)) | |||
|
1373 | self.__profIndex += 1 | |||
|
1374 | ||||
|
1375 | return | |||
|
1376 | ||||
|
1377 | if self.__profIndex < self.n: | |||
|
1378 | self.__buffer = numpy.vstack(self.__buffer,data* numpy.conjugate(data)) | |||
|
1379 | self.__buffer2.append(numpy.conjugate(data)) | |||
|
1380 | ||||
|
1381 | if self.__profIndex == 1: | |||
|
1382 | self.__buffer3 = self.__buffer2[self.__profIndex -1] * data | |||
|
1383 | else: | |||
|
1384 | self.__buffer3 = numpy.vstack(self.__buffer3, self.__buffer2[self.profIndex-1]*data) | |||
|
1385 | ||||
|
1386 | self.__profIndex += 1 | |||
|
1387 | return | |||
|
1388 | ''' | |||
|
1389 | ||||
|
1390 | def pushData(self): | |||
|
1391 | ''' | |||
|
1392 | Return the PULSEPAIR and the profiles used in the operation | |||
|
1393 | Affected : self.__profileIndex | |||
|
1394 | ''' | |||
|
1395 | #print("************************************************") | |||
|
1396 | #print("push data int vel n") | |||
|
1397 | data_intensity = self.__buffer/self.n | |||
|
1398 | data_velocity = self.__buffer3/(self.n-1) | |||
|
1399 | n = self.__profIndex | |||
|
1400 | ||||
|
1401 | self.__buffer = 0 | |||
|
1402 | self.__buffer2 = [] | |||
|
1403 | self.__buffer3 = 0 | |||
|
1404 | self.__profIndex = 0 | |||
|
1405 | ||||
|
1406 | return data_intensity, data_velocity,n | |||
|
1407 | ''' | |||
|
1408 | if not self.__withOverlapping: | |||
|
1409 | #print("ahora que fue") | |||
|
1410 | data_intensity = self.__buffer/self.n | |||
|
1411 | data_velocity = self.__buffer3/(self.n-1) | |||
|
1412 | n = self.__profIndex | |||
|
1413 | ||||
|
1414 | self.__buffer = 0 | |||
|
1415 | self.__buffer2 = [] | |||
|
1416 | self.__buffer3 = 0 | |||
|
1417 | self.__profIndex = 0 | |||
|
1418 | return data_intensity, data_velocity,n | |||
|
1419 | ||||
|
1420 | data_intensity = numpy.sum(self.__buffer,axis = 0) | |||
|
1421 | data_velocity = numpy.sum(self.__buffer3,axis = 0) | |||
|
1422 | n = self.__profIndex | |||
|
1423 | #self.__buffer = 0 | |||
|
1424 | #self.__buffer2 = [] | |||
|
1425 | #self.__buffer3 = 0 | |||
|
1426 | #self.__profIndex = 0 | |||
|
1427 | return data_intensity, data_velocity,n | |||
|
1428 | ''' | |||
|
1429 | ||||
|
1430 | def pulsePairbyProfiles(self,data): | |||
|
1431 | ||||
|
1432 | self.__dataReady = False | |||
|
1433 | data_intensity = None | |||
|
1434 | data_velocity = None | |||
|
1435 | #print("beforeputada") | |||
|
1436 | self.putData(data) | |||
|
1437 | #print("ProfileIndex:",self.__profIndex) | |||
|
1438 | if self.__profIndex == self.n: | |||
|
1439 | data_intensity, data_velocity, n = self.pushData() | |||
|
1440 | self.__dataReady = True | |||
|
1441 | #print("-----------------------------------------------") | |||
|
1442 | #print("data_intensity",data_intensity.shape,"data_velocity",data_velocity.shape) | |||
|
1443 | return data_intensity, data_velocity | |||
|
1444 | ||||
|
1445 | def pulsePairOp(self, data, datatime= None): | |||
|
1446 | ||||
|
1447 | if self.__initime == None: | |||
|
1448 | self.__initime = datatime | |||
|
1449 | ||||
|
1450 | data_intensity, data_velocity = self.pulsePairbyProfiles(data) | |||
|
1451 | self.__lastdatatime = datatime | |||
|
1452 | ||||
|
1453 | if data_intensity is None: | |||
|
1454 | return None, None, None | |||
|
1455 | ||||
|
1456 | avgdatatime = self.__initime | |||
|
1457 | deltatime = datatime - self.__lastdatatime | |||
|
1458 | self.__initime = datatime | |||
|
1459 | ''' | |||
|
1460 | if not self.__withOverlapping: | |||
|
1461 | self.__initime = datatime | |||
|
1462 | else: | |||
|
1463 | self.__initime += deltatime | |||
|
1464 | ''' | |||
|
1465 | return data_intensity, data_velocity, avgdatatime | |||
|
1466 | ||||
|
1467 | def run(self, dataOut,n = None, overlapping= False,**kwargs): | |||
|
1468 | ||||
|
1469 | if not self.isConfig: | |||
|
1470 | self.setup(dataOut = dataOut, n = n , **kwargs) | |||
|
1471 | self.isConfig = True | |||
|
1472 | #print("*******************") | |||
|
1473 | #print("print Shape input data:",dataOut.data.shape) | |||
|
1474 | data_intensity, data_velocity, avgdatatime = self.pulsePairOp(dataOut.data, dataOut.utctime) | |||
|
1475 | dataOut.flagNoData = True | |||
|
1476 | ||||
|
1477 | if self.__dataReady: | |||
|
1478 | #print("#------------------------------------------------------") | |||
|
1479 | #print("data_ready",data_intensity.shape) | |||
|
1480 | dataOut.data = data_intensity #valor para plotear RTI | |||
|
1481 | dataOut.nCohInt *= self.n | |||
|
1482 | dataOut.data_intensity = data_intensity #valor para intensidad | |||
|
1483 | dataOut.data_velocity = data_velocity #valor para velocidad | |||
|
1484 | dataOut.PRFbyAngle = self.n #numero de PRF*cada angulo rotado que equivale a un tiempo. | |||
|
1485 | dataOut.utctime = avgdatatime | |||
|
1486 | dataOut.flagNoData = False | |||
|
1487 | return dataOut | |||
|
1488 | ||||
1194 | # import collections |
|
1489 | # import collections | |
1195 | # from scipy.stats import mode |
|
1490 | # from scipy.stats import mode | |
1196 | # |
|
1491 | # |
@@ -25,9 +25,10 controllerObj.setup(id = '191', name='Test_USRP', description=desc) | |||||
25 | #path = '/media/data/data/vientos/57.2063km/echoes/NCO_Woodman' |
|
25 | #path = '/media/data/data/vientos/57.2063km/echoes/NCO_Woodman' | |
26 |
|
26 | |||
27 |
|
27 | |||
28 | path = '/home/soporte/data_hdf5' #### with clock 35.16 db noise |
|
28 | #path = '/home/soporte/data_hdf5' #### with clock 35.16 db noise | |
29 |
|
29 | path = '/home/alex/WEATHER_DATA/DATA' | ||
30 | figpath = '/home/soporte/data_hdf5_imag' |
|
30 | figpath = '/home/alex/WEATHER_DATA/DATA/pic' | |
|
31 | #figpath = '/home/soporte/data_hdf5_imag' | |||
31 | #remotefolder = "/home/wmaster/graficos" |
|
32 | #remotefolder = "/home/wmaster/graficos" | |
32 | ####################################################################### |
|
33 | ####################################################################### | |
33 | ################# RANGO DE PLOTEO###################################### |
|
34 | ################# RANGO DE PLOTEO###################################### | |
@@ -95,14 +96,33 procUnitConfObjA = controllerObj.addProcUnit(datatype='VoltageProc', inputId=rea | |||||
95 | #opObj11.addParameter(name='nBaud', value='28', format='int') |
|
96 | #opObj11.addParameter(name='nBaud', value='28', format='int') | |
96 |
|
97 | |||
97 | #opObj11 = procUnitConfObjA.addOperation(name='CohInt', optype='other') |
|
98 | #opObj11 = procUnitConfObjA.addOperation(name='CohInt', optype='other') | |
98 |
#opObj11.addParameter(name='n', value='10 |
|
99 | #opObj11.addParameter(name='n', value='10', format='int') | |
|
100 | ||||
|
101 | ||||
|
102 | opObj11 = procUnitConfObjA.addOperation(name='PulsePair', optype='other') | |||
|
103 | opObj11.addParameter(name='n', value='10', format='int') | |||
|
104 | ||||
|
105 | opObj11 = procUnitConfObjA.addOperation(name='CreateBlockVoltage', optype='other') | |||
|
106 | opObj11.addParameter(name='m', value='16', format='int') | |||
|
107 | ||||
|
108 | procUnitConfObj2 = controllerObj.addProcUnit(datatype='ParametersProc', inputId=procUnitConfObjA.getId()) | |||
99 |
|
109 | |||
|
110 | #Not used because the RGB data is obtained directly from the HF Reader. | |||
|
111 | #opObj21 = procUnitConfObj2.addOperation(name='GetRGBData') | |||
|
112 | ||||
|
113 | opObj21 = procUnitConfObj2.addOperation(name='ParamWriter', optype='external') | |||
|
114 | opObj21.addParameter(name='path', value=figpath+'/NEWData') | |||
|
115 | opObj21.addParameter(name='blocksPerFile', value='1', format='int') | |||
|
116 | opObj21.addParameter(name='metadataList',value='heightList',format='list') | |||
|
117 | opObj21.addParameter(name='dataList',value='data_intensity',format='list') | |||
|
118 | ||||
|
119 | ''' | |||
100 |
|
|
120 | ####################################################################### | |
101 |
|
|
121 | ########## OPERACIONES DOMINIO DE LA FRECUENCIA######################## | |
102 |
|
|
122 | ####################################################################### | |
103 | procUnitConfObjSousySpectra = controllerObj.addProcUnit(datatype='SpectraProc', inputId=procUnitConfObjA.getId()) |
|
123 | procUnitConfObjSousySpectra = controllerObj.addProcUnit(datatype='SpectraProc', inputId=procUnitConfObjA.getId()) | |
104 |
procUnitConfObjSousySpectra.addParameter(name='nFFTPoints', value='1 |
|
124 | procUnitConfObjSousySpectra.addParameter(name='nFFTPoints', value='16', format='int') | |
105 |
procUnitConfObjSousySpectra.addParameter(name='nProfiles', value='1 |
|
125 | procUnitConfObjSousySpectra.addParameter(name='nProfiles', value='16', format='int') | |
106 |
|
|
126 | #procUnitConfObjSousySpectra.addParameter(name='pairsList', value='(0,0),(1,1),(0,1)', format='pairsList') | |
107 |
|
|
127 | ||
108 |
|
|
128 | #opObj13 = procUnitConfObjSousySpectra.addOperation(name='removeDC') | |
@@ -174,10 +194,10 opObj11.addParameter(name='save_period', value=10, format='int') | |||||
174 |
|
|
194 | #opObj11 = procUnitConfObjSousySpectra.addOperation(name='SpectraWriter', optype='other') | |
175 |
|
|
195 | #opObj11.addParameter(name='path', value=wr_path) | |
176 |
|
|
196 | #opObj11.addParameter(name='blocksPerFile', value='50', format='int') | |
|
197 | ''' | |||
177 | print ("Escribiendo el archivo XML") |
|
198 | print ("Escribiendo el archivo XML") | |
178 | print ("Leyendo el archivo XML") |
|
199 | print ("Leyendo el archivo XML") | |
179 |
|
200 | |||
180 |
|
201 | |||
181 |
|
202 | |||
182 | controllerObj.start() |
|
203 | controllerObj.start() | |
183 |
|
General Comments 0
You need to be logged in to leave comments.
Login now