@@ -71,7 +71,8 class AMISR: | |||
|
71 | 71 | for key in list(inputObj.__dict__.keys()): |
|
72 | 72 | self.__dict__[key] = inputObj.__dict__[key] |
|
73 | 73 | |
|
74 | def getNHeights(self): | |
|
74 | @property | |
|
75 | def nHeights(self): | |
|
75 | 76 | |
|
76 | 77 | return len(self.heightList) |
|
77 | 78 | |
@@ -80,11 +81,7 class AMISR: | |||
|
80 | 81 | |
|
81 | 82 | return self.flagNoData |
|
82 | 83 | |
|
83 | def getTimeInterval(self): | |
|
84 | @property | |
|
85 | def timeInterval(self): | |
|
84 | 86 | |
|
85 |
|
|
|
86 | ||
|
87 | return timeInterval | |
|
88 | ||
|
89 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
|
90 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") No newline at end of file | |
|
87 | return self.ippSeconds * self.nCohInt |
@@ -1,8 +1,14 | |||
|
1 | ''' | |
|
1 | # Copyright (c) 2012-2020 Jicamarca Radio Observatory | |
|
2 | # All rights reserved. | |
|
3 | # | |
|
4 | # Distributed under the terms of the BSD 3-clause license. | |
|
5 | """Definition of diferent Data objects for different types of data | |
|
2 | 6 | |
|
3 | $Author: murco $ | |
|
4 | $Id: JROData.py 173 2012-11-20 15:06:21Z murco $ | |
|
5 | ''' | |
|
7 | Here you will find the diferent data objects for the different types | |
|
8 | of data, this data objects must be used as dataIn or dataOut objects in | |
|
9 | processing units and operations. Currently the supported data objects are: | |
|
10 | Voltage, Spectra, SpectraHeis, Fits, Correlation and Parameters | |
|
11 | """ | |
|
6 | 12 | |
|
7 | 13 | import copy |
|
8 | 14 | import numpy |
@@ -152,17 +158,10 class GenericData(object): | |||
|
152 | 158 | |
|
153 | 159 | class JROData(GenericData): |
|
154 | 160 | |
|
155 | # m_BasicHeader = BasicHeader() | |
|
156 | # m_ProcessingHeader = ProcessingHeader() | |
|
157 | ||
|
158 | 161 | systemHeaderObj = SystemHeader() |
|
159 | 162 | radarControllerHeaderObj = RadarControllerHeader() |
|
160 | # data = None | |
|
161 | 163 | type = None |
|
162 | 164 | datatype = None # dtype but in string |
|
163 | # dtype = None | |
|
164 | # nChannels = None | |
|
165 | # nHeights = None | |
|
166 | 165 | nProfiles = None |
|
167 | 166 | heightList = None |
|
168 | 167 | channelList = None |
@@ -173,18 +172,11 class JROData(GenericData): | |||
|
173 | 172 | dstFlag = None |
|
174 | 173 | errorCount = None |
|
175 | 174 | blocksize = None |
|
176 | # nCode = None | |
|
177 | # nBaud = None | |
|
178 | # code = None | |
|
179 | 175 | flagDecodeData = False # asumo q la data no esta decodificada |
|
180 | 176 | flagDeflipData = False # asumo q la data no esta sin flip |
|
181 | 177 | flagShiftFFT = False |
|
182 | # ippSeconds = None | |
|
183 | # timeInterval = None | |
|
184 | 178 | nCohInt = None |
|
185 | # noise = None | |
|
186 | 179 | windowOfFilter = 1 |
|
187 | # Speed of ligth | |
|
188 | 180 | C = 3e8 |
|
189 | 181 | frequency = 49.92e6 |
|
190 | 182 | realtime = False |
@@ -198,50 +190,45 class JROData(GenericData): | |||
|
198 | 190 | error = None |
|
199 | 191 | data = None |
|
200 | 192 | nmodes = None |
|
193 | metadata_list = ['heightList', 'timeZone', 'type'] | |
|
201 | 194 | |
|
202 | 195 | def __str__(self): |
|
203 | 196 | |
|
204 |
return '{} - {}'.format(self.type, self. |
|
|
197 | return '{} - {}'.format(self.type, self.datatime()) | |
|
205 | 198 | |
|
206 | 199 | def getNoise(self): |
|
207 | 200 | |
|
208 | 201 | raise NotImplementedError |
|
209 | 202 | |
|
210 | def getNChannels(self): | |
|
203 | @property | |
|
204 | def nChannels(self): | |
|
211 | 205 | |
|
212 | 206 | return len(self.channelList) |
|
213 | 207 | |
|
214 | def getChannelIndexList(self): | |
|
208 | @property | |
|
209 | def channelIndexList(self): | |
|
215 | 210 | |
|
216 | 211 | return list(range(self.nChannels)) |
|
217 | 212 | |
|
218 | def getNHeights(self): | |
|
213 | @property | |
|
214 | def nHeights(self): | |
|
219 | 215 | |
|
220 | 216 | return len(self.heightList) |
|
221 | 217 | |
|
222 | def getHeiRange(self, extrapoints=0): | |
|
223 | ||
|
224 | heis = self.heightList | |
|
225 | # deltah = self.heightList[1] - self.heightList[0] | |
|
226 | # | |
|
227 | # heis.append(self.heightList[-1]) | |
|
228 | ||
|
229 | return heis | |
|
230 | ||
|
231 | 218 | def getDeltaH(self): |
|
232 | 219 | |
|
233 |
|
|
|
220 | return self.heightList[1] - self.heightList[0] | |
|
234 | 221 | |
|
235 | return delta | |
|
236 | ||
|
237 | def getltctime(self): | |
|
222 | @property | |
|
223 | def ltctime(self): | |
|
238 | 224 | |
|
239 | 225 | if self.useLocalTime: |
|
240 | 226 | return self.utctime - self.timeZone * 60 |
|
241 | 227 | |
|
242 | 228 | return self.utctime |
|
243 | 229 | |
|
244 | def getDatatime(self): | |
|
230 | @property | |
|
231 | def datatime(self): | |
|
245 | 232 | |
|
246 | 233 | datatimeValue = datetime.datetime.utcfromtimestamp(self.ltctime) |
|
247 | 234 | return datatimeValue |
@@ -281,85 +268,76 class JROData(GenericData): | |||
|
281 | 268 | |
|
282 | 269 | return vmax |
|
283 | 270 | |
|
284 | def get_ippSeconds(self): | |
|
271 | @property | |
|
272 | def ippSeconds(self): | |
|
285 | 273 | ''' |
|
286 | 274 | ''' |
|
287 | 275 | return self.radarControllerHeaderObj.ippSeconds |
|
288 | ||
|
289 | def set_ippSeconds(self, ippSeconds): | |
|
276 | ||
|
277 | @ippSeconds.setter | |
|
278 | def ippSeconds(self, ippSeconds): | |
|
290 | 279 | ''' |
|
291 | 280 | ''' |
|
292 | ||
|
293 | 281 | self.radarControllerHeaderObj.ippSeconds = ippSeconds |
|
294 | ||
|
295 | return | |
|
296 | ||
|
297 | def get_dtype(self): | |
|
282 | ||
|
283 | @property | |
|
284 | def code(self): | |
|
298 | 285 | ''' |
|
299 | 286 | ''' |
|
300 | return getNumpyDtype(self.datatype) | |
|
287 | return self.radarControllerHeaderObj.code | |
|
301 | 288 | |
|
302 | def set_dtype(self, numpyDtype): | |
|
289 | @code.setter | |
|
290 | def code(self, code): | |
|
303 | 291 | ''' |
|
304 | 292 | ''' |
|
293 | self.radarControllerHeaderObj.code = code | |
|
305 | 294 | |
|
306 | self.datatype = getDataTypeCode(numpyDtype) | |
|
307 | ||
|
308 | def get_code(self): | |
|
295 | @property | |
|
296 | def ncode(self): | |
|
309 | 297 | ''' |
|
310 | 298 | ''' |
|
311 |
return self.radarControllerHeaderObj. |
|
|
299 | return self.radarControllerHeaderObj.nCode | |
|
312 | 300 | |
|
313 | def set_code(self, code): | |
|
301 | @ncode.setter | |
|
302 | def ncode(self, ncode): | |
|
314 | 303 | ''' |
|
315 | 304 | ''' |
|
316 |
self.radarControllerHeaderObj. |
|
|
317 | ||
|
318 | return | |
|
305 | self.radarControllerHeaderObj.nCode = ncode | |
|
319 | 306 | |
|
320 | def get_ncode(self): | |
|
307 | @property | |
|
308 | def nbaud(self): | |
|
321 | 309 | ''' |
|
322 | 310 | ''' |
|
323 |
return self.radarControllerHeaderObj.n |
|
|
311 | return self.radarControllerHeaderObj.nBaud | |
|
324 | 312 | |
|
325 | def set_ncode(self, nCode): | |
|
313 | @nbaud.setter | |
|
314 | def nbaud(self, nbaud): | |
|
326 | 315 | ''' |
|
327 | 316 | ''' |
|
328 |
self.radarControllerHeaderObj.n |
|
|
329 | ||
|
330 | return | |
|
317 | self.radarControllerHeaderObj.nBaud = nbaud | |
|
331 | 318 | |
|
332 | def get_nbaud(self): | |
|
319 | @property | |
|
320 | def ipp(self): | |
|
333 | 321 | ''' |
|
334 | 322 | ''' |
|
335 |
return self.radarControllerHeaderObj. |
|
|
323 | return self.radarControllerHeaderObj.ipp | |
|
336 | 324 | |
|
337 | def set_nbaud(self, nBaud): | |
|
325 | @ipp.setter | |
|
326 | def ipp(self, ipp): | |
|
338 | 327 | ''' |
|
339 | 328 | ''' |
|
340 |
self.radarControllerHeaderObj. |
|
|
329 | self.radarControllerHeaderObj.ipp = ipp | |
|
341 | 330 | |
|
342 | return | |
|
331 | @property | |
|
332 | def metadata(self): | |
|
333 | ''' | |
|
334 | ''' | |
|
343 | 335 | |
|
344 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") | |
|
345 | channelIndexList = property( | |
|
346 | getChannelIndexList, "I'm the 'channelIndexList' property.") | |
|
347 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") | |
|
348 | #noise = property(getNoise, "I'm the 'nHeights' property.") | |
|
349 | datatime = property(getDatatime, "I'm the 'datatime' property") | |
|
350 | ltctime = property(getltctime, "I'm the 'ltctime' property") | |
|
351 | ippSeconds = property(get_ippSeconds, set_ippSeconds) | |
|
352 | dtype = property(get_dtype, set_dtype) | |
|
353 | # timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
|
354 | code = property(get_code, set_code) | |
|
355 | nCode = property(get_ncode, set_ncode) | |
|
356 | nBaud = property(get_nbaud, set_nbaud) | |
|
336 | return {attr: getattr(self, attr) for attr in self.metadata_list} | |
|
357 | 337 | |
|
358 | 338 | |
|
359 | 339 | class Voltage(JROData): |
|
360 | 340 | |
|
361 | # data es un numpy array de 2 dmensiones (canales, alturas) | |
|
362 | data = None | |
|
363 | 341 | dataPP_POW = None |
|
364 | 342 | dataPP_DOP = None |
|
365 | 343 | dataPP_WIDTH = None |
@@ -375,13 +353,9 class Voltage(JROData): | |||
|
375 | 353 | self.systemHeaderObj = SystemHeader() |
|
376 | 354 | self.type = "Voltage" |
|
377 | 355 | self.data = None |
|
378 | # self.dtype = None | |
|
379 | # self.nChannels = 0 | |
|
380 | # self.nHeights = 0 | |
|
381 | 356 | self.nProfiles = None |
|
382 | 357 | self.heightList = None |
|
383 | 358 | self.channelList = None |
|
384 | # self.channelIndexList = None | |
|
385 | 359 | self.flagNoData = True |
|
386 | 360 | self.flagDiscontinuousBlock = False |
|
387 | 361 | self.utctime = None |
@@ -396,6 +370,8 class Voltage(JROData): | |||
|
396 | 370 | self.flagShiftFFT = False |
|
397 | 371 | self.flagDataAsBlock = False # Asumo que la data es leida perfil a perfil |
|
398 | 372 | self.profileIndex = 0 |
|
373 | self.metadata_list = ['type', 'heightList', 'timeZone', 'nProfiles', 'channelList', 'nCohInt', | |
|
374 | 'code', 'ncode', 'nbaud', 'ippSeconds', 'ipp'] | |
|
399 | 375 | |
|
400 | 376 | def getNoisebyHildebrand(self, channel=None): |
|
401 | 377 | """ |
@@ -444,36 +420,16 class Voltage(JROData): | |||
|
444 | 420 | |
|
445 | 421 | return powerdB |
|
446 | 422 | |
|
447 | def getTimeInterval(self): | |
|
448 | ||
|
449 | timeInterval = self.ippSeconds * self.nCohInt | |
|
423 | @property | |
|
424 | def timeInterval(self): | |
|
450 | 425 | |
|
451 | return timeInterval | |
|
426 | return self.ippSeconds * self.nCohInt | |
|
452 | 427 | |
|
453 | 428 | noise = property(getNoise, "I'm the 'nHeights' property.") |
|
454 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
|
455 | 429 | |
|
456 | 430 | |
|
457 | 431 | class Spectra(JROData): |
|
458 | 432 | |
|
459 | # data spc es un numpy array de 2 dmensiones (canales, perfiles, alturas) | |
|
460 | data_spc = None | |
|
461 | # data cspc es un numpy array de 2 dmensiones (canales, pares, alturas) | |
|
462 | data_cspc = None | |
|
463 | # data dc es un numpy array de 2 dmensiones (canales, alturas) | |
|
464 | data_dc = None | |
|
465 | # data power | |
|
466 | data_pwr = None | |
|
467 | nFFTPoints = None | |
|
468 | # nPairs = None | |
|
469 | pairsList = None | |
|
470 | nIncohInt = None | |
|
471 | wavelength = None # Necesario para cacular el rango de velocidad desde la frecuencia | |
|
472 | nCohInt = None # se requiere para determinar el valor de timeInterval | |
|
473 | ippFactor = None | |
|
474 | profileIndex = 0 | |
|
475 | plotting = "spectra" | |
|
476 | ||
|
477 | 433 | def __init__(self): |
|
478 | 434 | ''' |
|
479 | 435 | Constructor |
@@ -484,14 +440,9 class Spectra(JROData): | |||
|
484 | 440 | self.systemHeaderObj = SystemHeader() |
|
485 | 441 | self.type = "Spectra" |
|
486 | 442 | self.timeZone = 0 |
|
487 | # self.data = None | |
|
488 | # self.dtype = None | |
|
489 | # self.nChannels = 0 | |
|
490 | # self.nHeights = 0 | |
|
491 | 443 | self.nProfiles = None |
|
492 | 444 | self.heightList = None |
|
493 | 445 | self.channelList = None |
|
494 | # self.channelIndexList = None | |
|
495 | 446 | self.pairsList = None |
|
496 | 447 | self.flagNoData = True |
|
497 | 448 | self.flagDiscontinuousBlock = False |
@@ -505,9 +456,10 class Spectra(JROData): | |||
|
505 | 456 | self.flagDeflipData = False # asumo q la data no esta sin flip |
|
506 | 457 | self.flagShiftFFT = False |
|
507 | 458 | self.ippFactor = 1 |
|
508 | #self.noise = None | |
|
509 | 459 | self.beacon_heiIndexList = [] |
|
510 | 460 | self.noise_estimation = None |
|
461 | self.metadata_list = ['type', 'heightList', 'timeZone', 'pairsList', 'channelList', 'nCohInt', | |
|
462 | 'code', 'ncode', 'nbaud', 'ippSeconds', 'ipp','nIncohInt', 'nFFTPoints', 'nProfiles'] | |
|
511 | 463 | |
|
512 | 464 | def getNoisebyHildebrand(self, xmin_index=None, xmax_index=None, ymin_index=None, ymax_index=None): |
|
513 | 465 | """ |
@@ -567,15 +519,18 class Spectra(JROData): | |||
|
567 | 519 | else: |
|
568 | 520 | return velrange |
|
569 | 521 | |
|
570 | def getNPairs(self): | |
|
522 | @property | |
|
523 | def nPairs(self): | |
|
571 | 524 | |
|
572 | 525 | return len(self.pairsList) |
|
573 | 526 | |
|
574 | def getPairsIndexList(self): | |
|
527 | @property | |
|
528 | def pairsIndexList(self): | |
|
575 | 529 | |
|
576 | 530 | return list(range(self.nPairs)) |
|
577 | 531 | |
|
578 | def getNormFactor(self): | |
|
532 | @property | |
|
533 | def normFactor(self): | |
|
579 | 534 | |
|
580 | 535 | pwcode = 1 |
|
581 | 536 | |
@@ -586,21 +541,24 class Spectra(JROData): | |||
|
586 | 541 | |
|
587 | 542 | return normFactor |
|
588 | 543 | |
|
589 | def getFlagCspc(self): | |
|
544 | @property | |
|
545 | def flag_cspc(self): | |
|
590 | 546 | |
|
591 | 547 | if self.data_cspc is None: |
|
592 | 548 | return True |
|
593 | 549 | |
|
594 | 550 | return False |
|
595 | 551 | |
|
596 | def getFlagDc(self): | |
|
552 | @property | |
|
553 | def flag_dc(self): | |
|
597 | 554 | |
|
598 | 555 | if self.data_dc is None: |
|
599 | 556 | return True |
|
600 | 557 | |
|
601 | 558 | return False |
|
602 | 559 | |
|
603 | def getTimeInterval(self): | |
|
560 | @property | |
|
561 | def timeInterval(self): | |
|
604 | 562 | |
|
605 | 563 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt * self.nProfiles * self.ippFactor |
|
606 | 564 | if self.nmodes: |
@@ -650,69 +608,30 class Spectra(JROData): | |||
|
650 | 608 | print("This property should not be initialized") |
|
651 | 609 | |
|
652 | 610 | return |
|
653 | ||
|
654 | nPairs = property(getNPairs, setValue, "I'm the 'nPairs' property.") | |
|
655 | pairsIndexList = property( | |
|
656 | getPairsIndexList, setValue, "I'm the 'pairsIndexList' property.") | |
|
657 | normFactor = property(getNormFactor, setValue, | |
|
658 | "I'm the 'getNormFactor' property.") | |
|
659 | flag_cspc = property(getFlagCspc, setValue) | |
|
660 | flag_dc = property(getFlagDc, setValue) | |
|
611 | ||
|
661 | 612 | noise = property(getNoise, setValue, "I'm the 'nHeights' property.") |
|
662 | timeInterval = property(getTimeInterval, setValue, | |
|
663 | "I'm the 'timeInterval' property") | |
|
664 | 613 | |
|
665 | 614 | |
|
666 | 615 | class SpectraHeis(Spectra): |
|
667 | 616 | |
|
668 | data_spc = None | |
|
669 | data_cspc = None | |
|
670 | data_dc = None | |
|
671 | nFFTPoints = None | |
|
672 | # nPairs = None | |
|
673 | pairsList = None | |
|
674 | nCohInt = None | |
|
675 | nIncohInt = None | |
|
676 | ||
|
677 | 617 | def __init__(self): |
|
678 | 618 | |
|
679 | 619 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
680 | ||
|
681 | 620 | self.systemHeaderObj = SystemHeader() |
|
682 | ||
|
683 | 621 | self.type = "SpectraHeis" |
|
684 | ||
|
685 | # self.dtype = None | |
|
686 | ||
|
687 | # self.nChannels = 0 | |
|
688 | ||
|
689 | # self.nHeights = 0 | |
|
690 | ||
|
691 | 622 | self.nProfiles = None |
|
692 | ||
|
693 | 623 | self.heightList = None |
|
694 | ||
|
695 | 624 | self.channelList = None |
|
696 | ||
|
697 | # self.channelIndexList = None | |
|
698 | ||
|
699 | 625 | self.flagNoData = True |
|
700 | ||
|
701 | 626 | self.flagDiscontinuousBlock = False |
|
702 | ||
|
703 | # self.nPairs = 0 | |
|
704 | ||
|
705 | 627 | self.utctime = None |
|
706 | ||
|
707 | 628 | self.blocksize = None |
|
708 | ||
|
709 | 629 | self.profileIndex = 0 |
|
710 | ||
|
711 | 630 | self.nCohInt = 1 |
|
712 | ||
|
713 | 631 | self.nIncohInt = 1 |
|
714 | 632 | |
|
715 | def getNormFactor(self): | |
|
633 | @property | |
|
634 | def normFactor(self): | |
|
716 | 635 | pwcode = 1 |
|
717 | 636 | if self.flagDecodeData: |
|
718 | 637 | pwcode = numpy.sum(self.code[0]**2) |
@@ -721,86 +640,27 class SpectraHeis(Spectra): | |||
|
721 | 640 | |
|
722 | 641 | return normFactor |
|
723 | 642 | |
|
724 | def getTimeInterval(self): | |
|
725 | ||
|
726 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt | |
|
727 | ||
|
728 | return timeInterval | |
|
643 | @property | |
|
644 | def timeInterval(self): | |
|
729 | 645 | |
|
730 | normFactor = property(getNormFactor, "I'm the 'getNormFactor' property.") | |
|
731 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
|
646 | return self.ippSeconds * self.nCohInt * self.nIncohInt | |
|
732 | 647 | |
|
733 | 648 | |
|
734 | 649 | class Fits(JROData): |
|
735 | 650 | |
|
736 | heightList = None | |
|
737 | channelList = None | |
|
738 | flagNoData = True | |
|
739 | flagDiscontinuousBlock = False | |
|
740 | useLocalTime = False | |
|
741 | utctime = None | |
|
742 | # ippSeconds = None | |
|
743 | # timeInterval = None | |
|
744 | nCohInt = None | |
|
745 | nIncohInt = None | |
|
746 | noise = None | |
|
747 | windowOfFilter = 1 | |
|
748 | # Speed of ligth | |
|
749 | C = 3e8 | |
|
750 | frequency = 49.92e6 | |
|
751 | realtime = False | |
|
752 | ||
|
753 | 651 | def __init__(self): |
|
754 | 652 | |
|
755 | 653 | self.type = "Fits" |
|
756 | ||
|
757 | 654 | self.nProfiles = None |
|
758 | ||
|
759 | 655 | self.heightList = None |
|
760 | ||
|
761 | 656 | self.channelList = None |
|
762 | ||
|
763 | # self.channelIndexList = None | |
|
764 | ||
|
765 | 657 | self.flagNoData = True |
|
766 | ||
|
767 | 658 | self.utctime = None |
|
768 | ||
|
769 | 659 | self.nCohInt = 1 |
|
770 | ||
|
771 | 660 | self.nIncohInt = 1 |
|
772 | ||
|
773 | 661 | self.useLocalTime = True |
|
774 | ||
|
775 | 662 | self.profileIndex = 0 |
|
776 | ||
|
777 | # self.utctime = None | |
|
778 | 663 | self.timeZone = 0 |
|
779 | # self.ltctime = None | |
|
780 | # self.timeInterval = None | |
|
781 | # self.header = None | |
|
782 | # self.data_header = None | |
|
783 | # self.data = None | |
|
784 | # self.datatime = None | |
|
785 | # self.flagNoData = False | |
|
786 | # self.expName = '' | |
|
787 | # self.nChannels = None | |
|
788 | # self.nSamples = None | |
|
789 | # self.dataBlocksPerFile = None | |
|
790 | # self.comments = '' | |
|
791 | # | |
|
792 | ||
|
793 | def getltctime(self): | |
|
794 | ||
|
795 | if self.useLocalTime: | |
|
796 | return self.utctime - self.timeZone * 60 | |
|
797 | ||
|
798 | return self.utctime | |
|
799 | ||
|
800 | def getDatatime(self): | |
|
801 | ||
|
802 | datatime = datetime.datetime.utcfromtimestamp(self.ltctime) | |
|
803 | return datatime | |
|
804 | 664 | |
|
805 | 665 | def getTimeRange(self): |
|
806 | 666 | |
@@ -813,27 +673,12 class Fits(JROData): | |||
|
813 | 673 | |
|
814 | 674 | return datatime |
|
815 | 675 | |
|
816 | def getHeiRange(self): | |
|
817 | ||
|
818 | heis = self.heightList | |
|
819 | ||
|
820 | return heis | |
|
821 | ||
|
822 | def getNHeights(self): | |
|
823 | ||
|
824 | return len(self.heightList) | |
|
825 | ||
|
826 | def getNChannels(self): | |
|
827 | ||
|
828 | return len(self.channelList) | |
|
829 | ||
|
830 | 676 | def getChannelIndexList(self): |
|
831 | 677 | |
|
832 | 678 | return list(range(self.nChannels)) |
|
833 | 679 | |
|
834 | 680 | def getNoise(self, type=1): |
|
835 | 681 | |
|
836 | #noise = numpy.zeros(self.nChannels) | |
|
837 | 682 | |
|
838 | 683 | if type == 1: |
|
839 | 684 | noise = self.getNoisebyHildebrand() |
@@ -846,87 +691,46 class Fits(JROData): | |||
|
846 | 691 | |
|
847 | 692 | return noise |
|
848 | 693 | |
|
849 | def getTimeInterval(self): | |
|
694 | @property | |
|
695 | def timeInterval(self): | |
|
850 | 696 | |
|
851 | 697 | timeInterval = self.ippSeconds * self.nCohInt * self.nIncohInt |
|
852 | 698 | |
|
853 | 699 | return timeInterval |
|
854 | 700 | |
|
855 | def get_ippSeconds(self): | |
|
701 | @property | |
|
702 | def ippSeconds(self): | |
|
856 | 703 | ''' |
|
857 | 704 | ''' |
|
858 | 705 | return self.ipp_sec |
|
859 | 706 | |
|
860 | ||
|
861 | datatime = property(getDatatime, "I'm the 'datatime' property") | |
|
862 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") | |
|
863 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") | |
|
864 | channelIndexList = property( | |
|
865 | getChannelIndexList, "I'm the 'channelIndexList' property.") | |
|
866 | 707 | noise = property(getNoise, "I'm the 'nHeights' property.") |
|
867 | ||
|
868 | ltctime = property(getltctime, "I'm the 'ltctime' property") | |
|
869 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
|
870 | ippSeconds = property(get_ippSeconds, '') | |
|
708 | ||
|
871 | 709 | |
|
872 | 710 | class Correlation(JROData): |
|
873 | 711 | |
|
874 | noise = None | |
|
875 | SNR = None | |
|
876 | #-------------------------------------------------- | |
|
877 | mode = None | |
|
878 | split = False | |
|
879 | data_cf = None | |
|
880 | lags = None | |
|
881 | lagRange = None | |
|
882 | pairsList = None | |
|
883 | normFactor = None | |
|
884 | #-------------------------------------------------- | |
|
885 | # calculateVelocity = None | |
|
886 | nLags = None | |
|
887 | nPairs = None | |
|
888 | nAvg = None | |
|
889 | ||
|
890 | 712 | def __init__(self): |
|
891 | 713 | ''' |
|
892 | 714 | Constructor |
|
893 | 715 | ''' |
|
894 | 716 | self.radarControllerHeaderObj = RadarControllerHeader() |
|
895 | ||
|
896 | 717 | self.systemHeaderObj = SystemHeader() |
|
897 | ||
|
898 | 718 | self.type = "Correlation" |
|
899 | ||
|
900 | 719 | self.data = None |
|
901 | ||
|
902 | 720 | self.dtype = None |
|
903 | ||
|
904 | 721 | self.nProfiles = None |
|
905 | ||
|
906 | 722 | self.heightList = None |
|
907 | ||
|
908 | 723 | self.channelList = None |
|
909 | ||
|
910 | 724 | self.flagNoData = True |
|
911 | ||
|
912 | 725 | self.flagDiscontinuousBlock = False |
|
913 | ||
|
914 | 726 | self.utctime = None |
|
915 | ||
|
916 | 727 | self.timeZone = 0 |
|
917 | ||
|
918 | 728 | self.dstFlag = None |
|
919 | ||
|
920 | 729 | self.errorCount = None |
|
921 | ||
|
922 | 730 | self.blocksize = None |
|
923 | ||
|
924 | 731 | self.flagDecodeData = False # asumo q la data no esta decodificada |
|
925 | ||
|
926 | 732 | self.flagDeflipData = False # asumo q la data no esta sin flip |
|
927 | ||
|
928 | 733 | self.pairsList = None |
|
929 | ||
|
930 | 734 | self.nPoints = None |
|
931 | 735 | |
|
932 | 736 | def getPairsList(self): |
@@ -981,11 +785,10 class Correlation(JROData): | |||
|
981 | 785 | |
|
982 | 786 | return noise |
|
983 | 787 | |
|
984 | def getTimeInterval(self): | |
|
788 | @property | |
|
789 | def timeInterval(self): | |
|
985 | 790 | |
|
986 |
|
|
|
987 | ||
|
988 | return timeInterval | |
|
791 | return self.ippSeconds * self.nCohInt * self.nProfiles | |
|
989 | 792 | |
|
990 | 793 | def splitFunctions(self): |
|
991 | 794 | |
@@ -1011,7 +814,8 class Correlation(JROData): | |||
|
1011 | 814 | |
|
1012 | 815 | return acf_ind, ccf_ind, acf_pairs, ccf_pairs, data_acf, data_ccf |
|
1013 | 816 | |
|
1014 | def getNormFactor(self): | |
|
817 | @property | |
|
818 | def normFactor(self): | |
|
1015 | 819 | acf_ind, ccf_ind, acf_pairs, ccf_pairs, data_acf, data_ccf = self.splitFunctions() |
|
1016 | 820 | acf_pairs = numpy.array(acf_pairs) |
|
1017 | 821 | normFactor = numpy.zeros((self.nPairs, self.nHeights)) |
@@ -1028,25 +832,14 class Correlation(JROData): | |||
|
1028 | 832 | |
|
1029 | 833 | return normFactor |
|
1030 | 834 | |
|
1031 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
|
1032 | normFactor = property(getNormFactor, "I'm the 'normFactor property'") | |
|
1033 | ||
|
1034 | 835 | |
|
1035 | 836 | class Parameters(Spectra): |
|
1036 | 837 | |
|
1037 | experimentInfo = None # Information about the experiment | |
|
1038 | # Information from previous data | |
|
1039 | inputUnit = None # Type of data to be processed | |
|
1040 | operation = None # Type of operation to parametrize | |
|
1041 | # normFactor = None #Normalization Factor | |
|
1042 | 838 | groupList = None # List of Pairs, Groups, etc |
|
1043 | # Parameters | |
|
1044 | 839 | data_param = None # Parameters obtained |
|
1045 | 840 | data_pre = None # Data Pre Parametrization |
|
1046 | 841 | data_SNR = None # Signal to Noise Ratio |
|
1047 | # heightRange = None #Heights | |
|
1048 | 842 | abscissaList = None # Abscissa, can be velocities, lags or time |
|
1049 | # noise = None #Noise Potency | |
|
1050 | 843 | utctimeInit = None # Initial UTC time |
|
1051 | 844 | paramInterval = None # Time interval to calculate Parameters in seconds |
|
1052 | 845 | useLocalTime = True |
@@ -1085,7 +878,8 class Parameters(Spectra): | |||
|
1085 | 878 | |
|
1086 | 879 | return datatime |
|
1087 | 880 | |
|
1088 | def getTimeInterval(self): | |
|
881 | @property | |
|
882 | def timeInterval(self): | |
|
1089 | 883 | |
|
1090 | 884 | if hasattr(self, 'timeInterval1'): |
|
1091 | 885 | return self.timeInterval1 |
@@ -1102,7 +896,6 class Parameters(Spectra): | |||
|
1102 | 896 | |
|
1103 | 897 | return self.spc_noise |
|
1104 | 898 | |
|
1105 | timeInterval = property(getTimeInterval) | |
|
1106 | 899 | noise = property(getNoise, setValue, "I'm the 'Noise' property.") |
|
1107 | 900 | |
|
1108 | 901 | |
@@ -1220,7 +1013,7 class PlotterData(object): | |||
|
1220 | 1013 | if hasattr(dataOut, 'pairsList'): |
|
1221 | 1014 | self.pairs = dataOut.pairsList |
|
1222 | 1015 | |
|
1223 |
self.interval = dataOut. |
|
|
1016 | self.interval = dataOut.timeInterval | |
|
1224 | 1017 | if True in ['spc' in ptype for ptype in self.plottypes]: |
|
1225 | 1018 | self.xrange = (dataOut.getFreqRange(1)/1000., |
|
1226 | 1019 | dataOut.getAcfRange(1), dataOut.getVelRange(1)) |
@@ -1181,9 +1181,7 class JRODataReader(Reader): | |||
|
1181 | 1181 | self.dataOut.useLocalTime = self.basicHeaderObj.useLocalTime |
|
1182 | 1182 | |
|
1183 | 1183 | self.dataOut.ippSeconds = self.radarControllerHeaderObj.ippSeconds / self.nTxs |
|
1184 | ||
|
1185 | # self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock*self.nTxs | |
|
1186 | ||
|
1184 | ||
|
1187 | 1185 | def getFirstHeader(self): |
|
1188 | 1186 | |
|
1189 | 1187 | raise NotImplementedError |
@@ -115,7 +115,7 class DigitalRFReader(ProcessingUnit): | |||
|
115 | 115 | |
|
116 | 116 | self.dataOut.channelList = list(range(self.__num_subchannels)) |
|
117 | 117 | |
|
118 |
self.dataOut.blocksize = self.dataOut. |
|
|
118 | self.dataOut.blocksize = self.dataOut.nChannels * self.dataOut.nHeights | |
|
119 | 119 | |
|
120 | 120 | # self.dataOut.channelIndexList = None |
|
121 | 121 |
@@ -764,7 +764,7 class HFReader(ProcessingUnit): | |||
|
764 | 764 | |
|
765 | 765 | self.dataOut.nCohInt = 1 |
|
766 | 766 | |
|
767 |
self.dataOut.blocksize = self.dataOut. |
|
|
767 | self.dataOut.blocksize = self.dataOut.nChannels * self.dataOut.nHeights | |
|
768 | 768 | |
|
769 | 769 | self.dataOut.flagDecodeData = False #asumo que la data esta decodificada |
|
770 | 770 |
@@ -498,7 +498,7 class AMISRReader(ProcessingUnit): | |||
|
498 | 498 | |
|
499 | 499 | self.dataOut.channelList = self.__channelList |
|
500 | 500 | |
|
501 |
self.dataOut.blocksize = self.dataOut. |
|
|
501 | self.dataOut.blocksize = self.dataOut.nChannels * self.dataOut.nHeights | |
|
502 | 502 | |
|
503 | 503 | # self.dataOut.channelIndexList = None |
|
504 | 504 |
@@ -699,7 +699,7 class MIRA35CReader (ProcessingUnit, FileHeaderMIRA35c, SRVIHeader, RecordHeader | |||
|
699 | 699 | self.dataOut.utctime = dwell |
|
700 | 700 | self.dataOut.timeZone = 0 |
|
701 | 701 | |
|
702 |
self.dataOut.outputInterval = self.dataOut. |
|
|
702 | self.dataOut.outputInterval = self.dataOut.timeInterval | |
|
703 | 703 | self.dataOut.heightList = self.SPARrawGate1 * self.__deltaHeigth + \ |
|
704 | 704 | numpy.array(list(range(self.Num_Hei))) * self.__deltaHeigth |
|
705 | 705 |
@@ -335,31 +335,31 class SimulatorReader(JRODataReader, ProcessingUnit): | |||
|
335 | 335 | self.datablock = numpy.zeros([channels,prof_gen,Samples],dtype= numpy.complex64) |
|
336 | 336 | for i in range(channels): |
|
337 | 337 | for k in range(prof_gen): |
|
338 | #·······················NOISE··············· | |
|
338 | #-----------------------NOISE--------------- | |
|
339 | 339 | Noise_r = numpy.random.normal(DC_level,stdev,Samples) |
|
340 | 340 | Noise_i = numpy.random.normal(DC_level,stdev,Samples) |
|
341 | 341 | Noise = numpy.zeros(Samples,dtype=complex) |
|
342 | 342 | Noise.real = Noise_r |
|
343 | 343 | Noise.imag = Noise_i |
|
344 | #·······················PULSOS·············· | |
|
344 | #-----------------------PULSOS-------------- | |
|
345 | 345 | Pulso = numpy.zeros(pulse_size,dtype=complex) |
|
346 | 346 | Pulso.real = pulses[k%num_codes] |
|
347 | 347 | Pulso.imag = pulses[k%num_codes] |
|
348 | #····················· PULSES+NOISE·········· | |
|
348 | #--------------------- PULSES+NOISE---------- | |
|
349 | 349 | InBuffer = numpy.zeros(Samples,dtype=complex) |
|
350 | 350 | InBuffer[m_nR:m_nR+ps] = Pulso |
|
351 | 351 | InBuffer = InBuffer+Noise |
|
352 | #····················· ANGLE ······························· | |
|
352 | #--------------------- ANGLE ------------------------------- | |
|
353 | 353 | InBuffer.real[m_nR:m_nR+ps] = InBuffer.real[m_nR:m_nR+ps]*(math.cos( self.fAngle)*5) |
|
354 | 354 | InBuffer.imag[m_nR:m_nR+ps] = InBuffer.imag[m_nR:m_nR+ps]*(math.sin( self.fAngle)*5) |
|
355 | 355 | InBuffer=InBuffer |
|
356 | 356 | self.datablock[i][k]= InBuffer |
|
357 | 357 | |
|
358 |
# |
|
|
358 | #----------------DOPPLER SIGNAL............................................... | |
|
359 | 359 | time_vec = numpy.linspace(0,(prof_gen-1)*ippSec,int(prof_gen))+self.nReadBlocks*ippSec*prof_gen+(self.nReadFiles-1)*ippSec*prof_gen |
|
360 | 360 | fd = Fdoppler #+(600.0/120)*self.nReadBlocks |
|
361 | 361 | d_signal = Adoppler*numpy.array(numpy.exp(1.0j*2.0*math.pi*fd*time_vec),dtype=numpy.complex64) |
|
362 | #·············Señal con ancho espectral···················· | |
|
362 | #-------------Senal con ancho espectral-------------------- | |
|
363 | 363 | if prof_gen%2==0: |
|
364 | 364 | min = int(prof_gen/2.0-1.0) |
|
365 | 365 | max = int(prof_gen/2.0) |
@@ -372,11 +372,11 class SimulatorReader(JRODataReader, ProcessingUnit): | |||
|
372 | 372 | specw_sig = specw_sig/w |
|
373 | 373 | specw_sig = numpy.sinc(specw_sig) |
|
374 | 374 | specw_sig = A*numpy.array(specw_sig,dtype=numpy.complex64) |
|
375 | #·················· DATABLOCK + DOPPLER···················· | |
|
375 | #------------------ DATABLOCK + DOPPLER-------------------- | |
|
376 | 376 | HD=int(Hdoppler/self.AcqDH_0) |
|
377 | 377 | for i in range(12): |
|
378 | 378 | self.datablock[0,:,HD+i]=self.datablock[0,:,HD+i]+ d_signal# RESULT |
|
379 | #·················· DATABLOCK + DOPPLER*Sinc(x)···················· | |
|
379 | #------------------ DATABLOCK + DOPPLER*Sinc(x)-------------------- | |
|
380 | 380 | HD=int(Hdoppler/self.AcqDH_0) |
|
381 | 381 | HD=int(HD/2) |
|
382 | 382 | for i in range(12): |
@@ -90,7 +90,7 class USRPReader(ProcessingUnit): | |||
|
90 | 90 | |
|
91 | 91 | self.dataOut.channelList = self.__channelList |
|
92 | 92 | |
|
93 |
self.dataOut.blocksize = self.dataOut. |
|
|
93 | self.dataOut.blocksize = self.dataOut.nChannels * self.dataOut.nHeights | |
|
94 | 94 | |
|
95 | 95 | # self.dataOut.channelIndexList = None |
|
96 | 96 |
@@ -136,11 +136,8 class SpectraHeisProc(ProcessingUnit): | |||
|
136 | 136 | |
|
137 | 137 | for channelIndex in channelIndexList: |
|
138 | 138 | if channelIndex not in self.dataOut.channelIndexList: |
|
139 | print(channelIndexList) | |
|
140 | 139 | raise ValueError("The value %d in channelIndexList is not valid" %channelIndex) |
|
141 | 140 | |
|
142 | # nChannels = len(channelIndexList) | |
|
143 | ||
|
144 | 141 | data_spc = self.dataOut.data_spc[channelIndexList,:] |
|
145 | 142 | |
|
146 | 143 | self.dataOut.data_spc = data_spc |
@@ -78,9 +78,9 class ParametersProc(ProcessingUnit): | |||
|
78 | 78 | self.dataOut.dtype = numpy.dtype([('real','<f4'),('imag','<f4')]) |
|
79 | 79 | # self.dataOut.nHeights = self.dataIn.nHeights |
|
80 | 80 | # self.dataOut.nChannels = self.dataIn.nChannels |
|
81 | self.dataOut.nBaud = self.dataIn.nBaud | |
|
82 | self.dataOut.nCode = self.dataIn.nCode | |
|
83 | self.dataOut.code = self.dataIn.code | |
|
81 | # self.dataOut.nBaud = self.dataIn.nBaud | |
|
82 | # self.dataOut.nCode = self.dataIn.nCode | |
|
83 | # self.dataOut.code = self.dataIn.code | |
|
84 | 84 | # self.dataOut.nProfiles = self.dataOut.nFFTPoints |
|
85 | 85 | self.dataOut.flagDiscontinuousBlock = self.dataIn.flagDiscontinuousBlock |
|
86 | 86 | # self.dataOut.utctime = self.firstdatatime |
@@ -89,10 +89,10 class ParametersProc(ProcessingUnit): | |||
|
89 | 89 | self.dataOut.flagDeflipData = self.dataIn.flagDeflipData #asumo q la data esta sin flip |
|
90 | 90 | self.dataOut.nCohInt = self.dataIn.nCohInt |
|
91 | 91 | # self.dataOut.nIncohInt = 1 |
|
92 | self.dataOut.ippSeconds = self.dataIn.ippSeconds | |
|
92 | # self.dataOut.ippSeconds = self.dataIn.ippSeconds | |
|
93 | 93 | # self.dataOut.windowOfFilter = self.dataIn.windowOfFilter |
|
94 | 94 | self.dataOut.timeInterval1 = self.dataIn.timeInterval |
|
95 |
self.dataOut.heightList = self.dataIn. |
|
|
95 | self.dataOut.heightList = self.dataIn.heightList | |
|
96 | 96 | self.dataOut.frequency = self.dataIn.frequency |
|
97 | 97 | # self.dataOut.noise = self.dataIn.noise |
|
98 | 98 | |
@@ -2770,7 +2770,7 class SMDetection(Operation): | |||
|
2770 | 2770 | channelPositions = [(4.5,2), (2,4.5), (2,2), (2,0), (0,2)] #Estrella |
|
2771 | 2771 | meteorOps = SMOperations() |
|
2772 | 2772 | pairslist0, distances = meteorOps.getPhasePairs(channelPositions) |
|
2773 |
heiRang = dataOut. |
|
|
2773 | heiRang = dataOut.heightList | |
|
2774 | 2774 | #Get Beacon signal - No Beacon signal anymore |
|
2775 | 2775 | # newheis = numpy.where(self.dataOut.heightList>self.dataOut.radarControllerHeaderObj.Taus[tauindex]) |
|
2776 | 2776 | # |
@@ -2832,7 +2832,7 class SMDetection(Operation): | |||
|
2832 | 2832 | |
|
2833 | 2833 | #************** REMOVE MULTIPLE DETECTIONS (3.5) *************************** |
|
2834 | 2834 | #Parameters |
|
2835 |
heiRange = dataOut. |
|
|
2835 | heiRange = dataOut.heightList | |
|
2836 | 2836 | rangeInterval = heiRange[1] - heiRange[0] |
|
2837 | 2837 | rangeLimit = multDet_rangeLimit/rangeInterval |
|
2838 | 2838 | timeLimit = multDet_timeLimit/dataOut.timeInterval |
@@ -1,3 +1,13 | |||
|
1 | # Copyright (c) 2012-2020 Jicamarca Radio Observatory | |
|
2 | # All rights reserved. | |
|
3 | # | |
|
4 | # Distributed under the terms of the BSD 3-clause license. | |
|
5 | """Spectra processing Unit and operations | |
|
6 | ||
|
7 | Here you will find the processing unit `SpectraProc` and several operations | |
|
8 | to work with Spectra data type | |
|
9 | """ | |
|
10 | ||
|
1 | 11 | import time |
|
2 | 12 | import itertools |
|
3 | 13 | |
@@ -11,7 +21,6 from schainpy.utils import log | |||
|
11 | 21 | |
|
12 | 22 | class SpectraProc(ProcessingUnit): |
|
13 | 23 | |
|
14 | ||
|
15 | 24 | def __init__(self): |
|
16 | 25 | |
|
17 | 26 | ProcessingUnit.__init__(self) |
@@ -35,35 +44,24 class SpectraProc(ProcessingUnit): | |||
|
35 | 44 | except: |
|
36 | 45 | pass |
|
37 | 46 | self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy() |
|
47 | ||
|
38 | 48 | self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy() |
|
39 | 49 | self.dataOut.channelList = self.dataIn.channelList |
|
40 | 50 | self.dataOut.heightList = self.dataIn.heightList |
|
41 | 51 | self.dataOut.dtype = numpy.dtype([('real', '<f4'), ('imag', '<f4')]) |
|
42 | ||
|
43 | self.dataOut.nBaud = self.dataIn.nBaud | |
|
44 | self.dataOut.nCode = self.dataIn.nCode | |
|
45 | self.dataOut.code = self.dataIn.code | |
|
46 | 52 | self.dataOut.nProfiles = self.dataOut.nFFTPoints |
|
47 | ||
|
48 | 53 | self.dataOut.flagDiscontinuousBlock = self.dataIn.flagDiscontinuousBlock |
|
49 | 54 | self.dataOut.utctime = self.firstdatatime |
|
50 | # asumo q la data esta decodificada | |
|
51 | 55 | self.dataOut.flagDecodeData = self.dataIn.flagDecodeData |
|
52 | # asumo q la data esta sin flip | |
|
53 | 56 | self.dataOut.flagDeflipData = self.dataIn.flagDeflipData |
|
54 | 57 | self.dataOut.flagShiftFFT = False |
|
55 | ||
|
56 | 58 | self.dataOut.nCohInt = self.dataIn.nCohInt |
|
57 | 59 | self.dataOut.nIncohInt = 1 |
|
58 | ||
|
59 | 60 | self.dataOut.windowOfFilter = self.dataIn.windowOfFilter |
|
60 | ||
|
61 | 61 | self.dataOut.frequency = self.dataIn.frequency |
|
62 | 62 | self.dataOut.realtime = self.dataIn.realtime |
|
63 | ||
|
64 | 63 | self.dataOut.azimuth = self.dataIn.azimuth |
|
65 | 64 | self.dataOut.zenith = self.dataIn.zenith |
|
66 | ||
|
67 | 65 | self.dataOut.beam.codeList = self.dataIn.beam.codeList |
|
68 | 66 | self.dataOut.beam.azimuthList = self.dataIn.beam.azimuthList |
|
69 | 67 | self.dataOut.beam.zenithList = self.dataIn.beam.zenithList |
@@ -120,7 +118,7 class SpectraProc(ProcessingUnit): | |||
|
120 | 118 | self.dataOut.blockSize = blocksize |
|
121 | 119 | self.dataOut.flagShiftFFT = False |
|
122 | 120 | |
|
123 |
def run(self, nProfiles=None, nFFTPoints=None, pairsList= |
|
|
121 | def run(self, nProfiles=None, nFFTPoints=None, pairsList=None, ippFactor=None, shift_fft=False): | |
|
124 | 122 | |
|
125 | 123 | if self.dataIn.type == "Spectra": |
|
126 | 124 | self.dataOut.copy(self.dataIn) |
@@ -133,9 +131,7 class SpectraProc(ProcessingUnit): | |||
|
133 | 131 | #desplaza a la derecha en el eje 2 determinadas posiciones |
|
134 | 132 | self.dataOut.data_cspc = numpy.roll(self.dataOut.data_cspc, shift, axis=1) |
|
135 | 133 | |
|
136 | return True | |
|
137 | ||
|
138 | if self.dataIn.type == "Voltage": | |
|
134 | elif self.dataIn.type == "Voltage": | |
|
139 | 135 | |
|
140 | 136 | self.dataOut.flagNoData = True |
|
141 | 137 | |
@@ -146,12 +142,9 class SpectraProc(ProcessingUnit): | |||
|
146 | 142 | nProfiles = nFFTPoints |
|
147 | 143 | |
|
148 | 144 | if ippFactor == None: |
|
149 | ippFactor = 1 | |
|
150 | ||
|
151 | self.dataOut.ippFactor = ippFactor | |
|
152 | ||
|
145 | self.dataOut.ippFactor = 1 | |
|
146 | ||
|
153 | 147 | self.dataOut.nFFTPoints = nFFTPoints |
|
154 | self.dataOut.pairsList = pairsList | |
|
155 | 148 | |
|
156 | 149 | if self.buffer is None: |
|
157 | 150 | self.buffer = numpy.zeros((self.dataIn.nChannels, |
@@ -181,7 +174,6 class SpectraProc(ProcessingUnit): | |||
|
181 | 174 | raise ValueError("The type object %s has %d profiles, it should just has %d profiles" % ( |
|
182 | 175 | self.dataIn.type, self.dataIn.data.shape[1], nProfiles)) |
|
183 | 176 | self.dataOut.flagNoData = True |
|
184 | return 0 | |
|
185 | 177 | else: |
|
186 | 178 | self.buffer[:, self.profIndex, :] = self.dataIn.data.copy() |
|
187 | 179 | self.profIndex += 1 |
@@ -191,16 +183,16 class SpectraProc(ProcessingUnit): | |||
|
191 | 183 | |
|
192 | 184 | if self.profIndex == nProfiles: |
|
193 | 185 | self.__updateSpecFromVoltage() |
|
186 | if pairsList == None: | |
|
187 | self.dataOut.pairsList = [pair for pair in itertools.combinations(self.dataOut.channelList, 2)] | |
|
194 | 188 | self.__getFft() |
|
195 | 189 | |
|
196 | 190 | self.dataOut.flagNoData = False |
|
197 | 191 | self.firstdatatime = None |
|
198 | 192 | self.profIndex = 0 |
|
199 | ||
|
200 | return True | |
|
201 | ||
|
202 | raise ValueError("The type of input object '%s' is not valid" % ( | |
|
203 | self.dataIn.type)) | |
|
193 | else: | |
|
194 | raise ValueError("The type of input object '%s' is not valid".format( | |
|
195 | self.dataIn.type)) | |
|
204 | 196 | |
|
205 | 197 | def __selectPairs(self, pairsList): |
|
206 | 198 |
@@ -389,6 +389,8 class printAttribute(Operation): | |||
|
389 | 389 | |
|
390 | 390 | def run(self, dataOut, attributes): |
|
391 | 391 | |
|
392 | if isinstance(attributes, str): | |
|
393 | attributes = [attributes] | |
|
392 | 394 | for attr in attributes: |
|
393 | 395 | if hasattr(dataOut, attr): |
|
394 | 396 | log.log(getattr(dataOut, attr), attr) |
@@ -1369,17 +1371,17 class PulsePairVoltage(Operation): | |||
|
1369 | 1371 | Return the PULSEPAIR and the profiles used in the operation |
|
1370 | 1372 | Affected : self.__profileIndex |
|
1371 | 1373 | ''' |
|
1372 | #················· Remove DC··································· | |
|
1374 | #----------------- Remove DC----------------------------------- | |
|
1373 | 1375 | if self.removeDC==True: |
|
1374 | 1376 | mean = numpy.mean(self.__buffer,1) |
|
1375 | 1377 | tmp = mean.reshape(self.__nch,1,self.__nHeis) |
|
1376 | 1378 | dc= numpy.tile(tmp,[1,self.__nProf,1]) |
|
1377 | 1379 | self.__buffer = self.__buffer - dc |
|
1378 | #··················Calculo de Potencia ························ | |
|
1380 | #------------------Calculo de Potencia ------------------------ | |
|
1379 | 1381 | pair0 = self.__buffer*numpy.conj(self.__buffer) |
|
1380 | 1382 | pair0 = pair0.real |
|
1381 | 1383 | lag_0 = numpy.sum(pair0,1) |
|
1382 | #··················Calculo de Ruido x canal···················· | |
|
1384 | #------------------Calculo de Ruido x canal-------------------- | |
|
1383 | 1385 | self.noise = numpy.zeros(self.__nch) |
|
1384 | 1386 | for i in range(self.__nch): |
|
1385 | 1387 | daux = numpy.sort(pair0[i,:,:],axis= None) |
@@ -1389,11 +1391,11 class PulsePairVoltage(Operation): | |||
|
1389 | 1391 | self.noise = numpy.tile(self.noise,[1,self.__nHeis]) |
|
1390 | 1392 | noise_buffer = self.noise.reshape(self.__nch,1,self.__nHeis) |
|
1391 | 1393 | noise_buffer = numpy.tile(noise_buffer,[1,self.__nProf,1]) |
|
1392 |
# |
|
|
1393 | #·················· P= S+N ,P=lag_0/N ································· | |
|
1394 | #···················· Power ·················································· | |
|
1394 | #------------------ Potencia recibida= P , Potencia senal = S , Ruido= N-- | |
|
1395 | #------------------ P= S+N ,P=lag_0/N --------------------------------- | |
|
1396 | #-------------------- Power -------------------------------------------------- | |
|
1395 | 1397 | data_power = lag_0/(self.n*self.nCohInt) |
|
1396 | #------------------ Senal ··················································· | |
|
1398 | #------------------ Senal --------------------------------------------------- | |
|
1397 | 1399 | data_intensity = pair0 - noise_buffer |
|
1398 | 1400 | data_intensity = numpy.sum(data_intensity,axis=1)*(self.n*self.nCohInt)#*self.nCohInt) |
|
1399 | 1401 | #data_intensity = (lag_0-self.noise*self.n)*(self.n*self.nCohInt) |
@@ -1402,28 +1404,28 class PulsePairVoltage(Operation): | |||
|
1402 | 1404 | if data_intensity[i][j] < 0: |
|
1403 | 1405 | data_intensity[i][j] = numpy.min(numpy.absolute(data_intensity[i][j])) |
|
1404 | 1406 | |
|
1405 |
# |
|
|
1407 | #----------------- Calculo de Frecuencia y Velocidad doppler-------- | |
|
1406 | 1408 | pair1 = self.__buffer[:,:-1,:]*numpy.conjugate(self.__buffer[:,1:,:]) |
|
1407 | 1409 | lag_1 = numpy.sum(pair1,1) |
|
1408 | 1410 | data_freq = (-1/(2.0*math.pi*self.ippSec*self.nCohInt))*numpy.angle(lag_1) |
|
1409 | 1411 | data_velocity = (self.lambda_/2.0)*data_freq |
|
1410 | 1412 | |
|
1411 |
# |
|
|
1413 | #---------------- Potencia promedio estimada de la Senal----------- | |
|
1412 | 1414 | lag_0 = lag_0/self.n |
|
1413 | 1415 | S = lag_0-self.noise |
|
1414 | 1416 | |
|
1415 | #················ Frecuencia Doppler promedio ····················· | |
|
1417 | #---------------- Frecuencia Doppler promedio --------------------- | |
|
1416 | 1418 | lag_1 = lag_1/(self.n-1) |
|
1417 | 1419 | R1 = numpy.abs(lag_1) |
|
1418 | 1420 | |
|
1419 | #················ Calculo del SNR·································· | |
|
1421 | #---------------- Calculo del SNR---------------------------------- | |
|
1420 | 1422 | data_snrPP = S/self.noise |
|
1421 | 1423 | for i in range(self.__nch): |
|
1422 | 1424 | for j in range(self.__nHeis): |
|
1423 | 1425 | if data_snrPP[i][j] < 1.e-20: |
|
1424 | 1426 | data_snrPP[i][j] = 1.e-20 |
|
1425 | 1427 | |
|
1426 | #················· Calculo del ancho espectral ······················ | |
|
1428 | #----------------- Calculo del ancho espectral ---------------------- | |
|
1427 | 1429 | L = S/R1 |
|
1428 | 1430 | L = numpy.where(L<0,1,L) |
|
1429 | 1431 | L = numpy.log(L) |
General Comments 0
You need to be logged in to leave comments.
Login now