@@ -30,7 +30,7 rti.addParameter(name='wr_period', value='5', format='int') | |||||
30 | rti.addParameter(name='exp_code', value='22', format='int') |
|
30 | rti.addParameter(name='exp_code', value='22', format='int') | |
31 |
|
31 | |||
32 |
|
32 | |||
33 |
|
|
33 | project.start() | |
34 | ''' |
|
34 | ''' | |
35 |
|
35 | |||
36 | multiprocess = '''from schainpy.controller import Project, MPProject |
|
36 | multiprocess = '''from schainpy.controller import Project, MPProject |
@@ -31,6 +31,7 def getNumpyDtype(dataTypeCode): | |||||
31 |
|
31 | |||
32 | return numpyDtype |
|
32 | return numpyDtype | |
33 |
|
33 | |||
|
34 | ||||
34 | def getDataTypeCode(numpyDtype): |
|
35 | def getDataTypeCode(numpyDtype): | |
35 |
|
36 | |||
36 | if numpyDtype == numpy.dtype([('real','<i1'),('imag','<i1')]): |
|
37 | if numpyDtype == numpy.dtype([('real', '<i1'), ('imag', '<i1')]): | |
@@ -50,6 +51,7 def getDataTypeCode(numpyDtype): | |||||
50 |
|
51 | |||
51 | return datatype |
|
52 | return datatype | |
52 |
|
53 | |||
|
54 | ||||
53 | def hildebrand_sekhon(data, navg): |
|
55 | def hildebrand_sekhon(data, navg): | |
54 | """ |
|
56 | """ | |
55 | This method is for the objective determination of the noise level in Doppler spectra. This |
|
57 | This method is for the objective determination of the noise level in Doppler spectra. This | |
@@ -110,6 +112,7 class Beam: | |||||
110 | self.azimuthList = [] |
|
112 | self.azimuthList = [] | |
111 | self.zenithList = [] |
|
113 | self.zenithList = [] | |
112 |
|
114 | |||
|
115 | ||||
113 | class GenericData(object): |
|
116 | class GenericData(object): | |
114 |
|
117 | |||
115 | flagNoData = True |
|
118 | flagNoData = True | |
@@ -143,6 +146,7 class GenericData(object): | |||||
143 |
|
146 | |||
144 | return self.flagNoData |
|
147 | return self.flagNoData | |
145 |
|
148 | |||
|
149 | ||||
146 | class JROData(GenericData): |
|
150 | class JROData(GenericData): | |
147 |
|
151 | |||
148 | # m_BasicHeader = BasicHeader() |
|
152 | # m_BasicHeader = BasicHeader() | |
@@ -366,7 +370,8 class JROData(GenericData): | |||||
366 | return |
|
370 | return | |
367 |
|
371 | |||
368 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") |
|
372 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") | |
369 | channelIndexList = property(getChannelIndexList, "I'm the 'channelIndexList' property.") |
|
373 | channelIndexList = property( | |
|
374 | getChannelIndexList, "I'm the 'channelIndexList' property.") | |||
370 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") |
|
375 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") | |
371 | #noise = property(getNoise, "I'm the 'nHeights' property.") |
|
376 | #noise = property(getNoise, "I'm the 'nHeights' property.") | |
372 | datatime = property(getDatatime, "I'm the 'datatime' property") |
|
377 | datatime = property(getDatatime, "I'm the 'datatime' property") | |
@@ -378,6 +383,7 class JROData(GenericData): | |||||
378 | nCode = property(get_ncode, set_ncode) |
|
383 | nCode = property(get_ncode, set_ncode) | |
379 | nBaud = property(get_nbaud, set_nbaud) |
|
384 | nBaud = property(get_nbaud, set_nbaud) | |
380 |
|
385 | |||
|
386 | ||||
381 | class Voltage(JROData): |
|
387 | class Voltage(JROData): | |
382 |
|
388 | |||
383 | #data es un numpy array de 2 dmensiones (canales, alturas) |
|
389 | # data es un numpy array de 2 dmensiones (canales, alturas) | |
@@ -494,6 +500,7 class Voltage(JROData): | |||||
494 | noise = property(getNoise, "I'm the 'nHeights' property.") |
|
500 | noise = property(getNoise, "I'm the 'nHeights' property.") | |
495 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
501 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
496 |
|
502 | |||
|
503 | ||||
497 | class Spectra(JROData): |
|
504 | class Spectra(JROData): | |
498 |
|
505 | |||
499 | #data spc es un numpy array de 2 dmensiones (canales, perfiles, alturas) |
|
506 | # data spc es un numpy array de 2 dmensiones (canales, perfiles, alturas) | |
@@ -587,7 +594,6 class Spectra(JROData): | |||||
587 |
|
594 | |||
588 | self.noise_estimation = None |
|
595 | self.noise_estimation = None | |
589 |
|
596 | |||
590 |
|
||||
591 | def getNoisebyHildebrand(self, xmin_index=None, xmax_index=None, ymin_index=None, ymax_index=None): |
|
597 | def getNoisebyHildebrand(self, xmin_index=None, xmax_index=None, ymin_index=None, ymax_index=None): | |
592 | """ |
|
598 | """ | |
593 | Determino el nivel de ruido usando el metodo Hildebrand-Sekhon |
|
599 | Determino el nivel de ruido usando el metodo Hildebrand-Sekhon | |
@@ -599,7 +605,8 class Spectra(JROData): | |||||
599 | noise = numpy.zeros(self.nChannels) |
|
605 | noise = numpy.zeros(self.nChannels) | |
600 |
|
606 | |||
601 | for channel in range(self.nChannels): |
|
607 | for channel in range(self.nChannels): | |
602 |
daux = self.data_spc[channel, |
|
608 | daux = self.data_spc[channel, | |
|
609 | xmin_index:xmax_index, ymin_index:ymax_index] | |||
603 | noise[channel] = hildebrand_sekhon(daux, self.nIncohInt) |
|
610 | noise[channel] = hildebrand_sekhon(daux, self.nIncohInt) | |
604 |
|
611 | |||
605 | return noise |
|
612 | return noise | |
@@ -607,36 +614,45 class Spectra(JROData): | |||||
607 | def getNoise(self, xmin_index=None, xmax_index=None, ymin_index=None, ymax_index=None): |
|
614 | def getNoise(self, xmin_index=None, xmax_index=None, ymin_index=None, ymax_index=None): | |
608 |
|
615 | |||
609 | if self.noise_estimation is not None: |
|
616 | if self.noise_estimation is not None: | |
610 |
|
|
617 | # this was estimated by getNoise Operation defined in jroproc_spectra.py | |
|
618 | return self.noise_estimation | |||
611 | else: |
|
619 | else: | |
612 |
noise = self.getNoisebyHildebrand( |
|
620 | noise = self.getNoisebyHildebrand( | |
|
621 | xmin_index, xmax_index, ymin_index, ymax_index) | |||
613 | return noise |
|
622 | return noise | |
614 |
|
623 | |||
615 | def getFreqRangeTimeResponse(self, extrapoints=0): |
|
624 | def getFreqRangeTimeResponse(self, extrapoints=0): | |
616 |
|
625 | |||
617 | deltafreq = self.getFmaxTimeResponse() / (self.nFFTPoints*self.ippFactor) |
|
626 | deltafreq = self.getFmaxTimeResponse() / (self.nFFTPoints * self.ippFactor) | |
618 | freqrange = deltafreq*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) - deltafreq/2 |
|
627 | freqrange = deltafreq * \ | |
|
628 | (numpy.arange(self.nFFTPoints + extrapoints) - | |||
|
629 | self.nFFTPoints / 2.) - deltafreq / 2 | |||
619 |
|
630 | |||
620 | return freqrange |
|
631 | return freqrange | |
621 |
|
632 | |||
622 | def getAcfRange(self, extrapoints=0): |
|
633 | def getAcfRange(self, extrapoints=0): | |
623 |
|
634 | |||
624 | deltafreq = 10./(self.getFmax() / (self.nFFTPoints*self.ippFactor)) |
|
635 | deltafreq = 10. / (self.getFmax() / (self.nFFTPoints * self.ippFactor)) | |
625 | freqrange = deltafreq*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) - deltafreq/2 |
|
636 | freqrange = deltafreq * \ | |
|
637 | (numpy.arange(self.nFFTPoints + extrapoints) - | |||
|
638 | self.nFFTPoints / 2.) - deltafreq / 2 | |||
626 |
|
639 | |||
627 | return freqrange |
|
640 | return freqrange | |
628 |
|
641 | |||
629 | def getFreqRange(self, extrapoints=0): |
|
642 | def getFreqRange(self, extrapoints=0): | |
630 |
|
643 | |||
631 | deltafreq = self.getFmax() / (self.nFFTPoints*self.ippFactor) |
|
644 | deltafreq = self.getFmax() / (self.nFFTPoints * self.ippFactor) | |
632 | freqrange = deltafreq*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) - deltafreq/2 |
|
645 | freqrange = deltafreq * \ | |
|
646 | (numpy.arange(self.nFFTPoints + extrapoints) - | |||
|
647 | self.nFFTPoints / 2.) - deltafreq / 2 | |||
633 |
|
648 | |||
634 | return freqrange |
|
649 | return freqrange | |
635 |
|
650 | |||
636 | def getVelRange(self, extrapoints=0): |
|
651 | def getVelRange(self, extrapoints=0): | |
637 |
|
652 | |||
638 | deltav = self.getVmax() / (self.nFFTPoints*self.ippFactor) |
|
653 | deltav = self.getVmax() / (self.nFFTPoints * self.ippFactor) | |
639 |
velrange = deltav*(numpy.arange(self.nFFTPoints+ |
|
654 | velrange = deltav * (numpy.arange(self.nFFTPoints + | |
|
655 | extrapoints) - self.nFFTPoints / 2.) # - deltav/2 | |||
640 |
|
656 | |||
641 | return velrange |
|
657 | return velrange | |
642 |
|
658 | |||
@@ -655,7 +671,8 class Spectra(JROData): | |||||
655 | if self.flagDecodeData: |
|
671 | if self.flagDecodeData: | |
656 | pwcode = numpy.sum(self.code[0]**2) |
|
672 | pwcode = numpy.sum(self.code[0]**2) | |
657 | #normFactor = min(self.nFFTPoints,self.nProfiles)*self.nIncohInt*self.nCohInt*pwcode*self.windowOfFilter |
|
673 | #normFactor = min(self.nFFTPoints,self.nProfiles)*self.nIncohInt*self.nCohInt*pwcode*self.windowOfFilter | |
658 |
normFactor = self.nProfiles*self.nIncohInt* |
|
674 | normFactor = self.nProfiles * self.nIncohInt * \ | |
|
675 | self.nCohInt * pwcode * self.windowOfFilter | |||
659 |
|
676 | |||
660 | return normFactor |
|
677 | return normFactor | |
661 |
|
678 | |||
@@ -697,11 +714,13 class Spectra(JROData): | |||||
697 | pairsIndexList = [] |
|
714 | pairsIndexList = [] | |
698 | for pair in pairsList: |
|
715 | for pair in pairsList: | |
699 | if pair not in self.pairsList: |
|
716 | if pair not in self.pairsList: | |
700 |
raise ValueError, "Pair %s is not in dataOut.pairsList" %( |
|
717 | raise ValueError, "Pair %s is not in dataOut.pairsList" % ( | |
|
718 | pair) | |||
701 |
pairsIndexList.append(self.pairsList.index(pair)) |
|
719 | pairsIndexList.append(self.pairsList.index(pair)) | |
702 | for i in range(len(pairsIndexList)): |
|
720 | for i in range(len(pairsIndexList)): | |
703 | pair = self.pairsList[pairsIndexList[i]] |
|
721 | pair = self.pairsList[pairsIndexList[i]] | |
704 | ccf = numpy.average(self.data_cspc[pairsIndexList[i], :, :], axis=0) |
|
722 | ccf = numpy.average( | |
|
723 | self.data_cspc[pairsIndexList[i], :, :], axis=0) | |||
705 | powa = numpy.average(self.data_spc[pair[0], :, :], axis=0) |
|
724 | powa = numpy.average(self.data_spc[pair[0], :, :], axis=0) | |
706 | powb = numpy.average(self.data_spc[pair[1], :, :], axis=0) |
|
725 | powb = numpy.average(self.data_spc[pair[1], :, :], axis=0) | |
707 | avgcoherenceComplex = ccf/numpy.sqrt(powa*powb) |
|
726 | avgcoherenceComplex = ccf / numpy.sqrt(powa * powb) | |
@@ -722,12 +741,16 class Spectra(JROData): | |||||
722 | return |
|
741 | return | |
723 |
|
742 | |||
724 | nPairs = property(getNPairs, setValue, "I'm the 'nPairs' property.") |
|
743 | nPairs = property(getNPairs, setValue, "I'm the 'nPairs' property.") | |
725 | pairsIndexList = property(getPairsIndexList, setValue, "I'm the 'pairsIndexList' property.") |
|
744 | pairsIndexList = property( | |
726 | normFactor = property(getNormFactor, setValue, "I'm the 'getNormFactor' property.") |
|
745 | getPairsIndexList, setValue, "I'm the 'pairsIndexList' property.") | |
|
746 | normFactor = property(getNormFactor, setValue, | |||
|
747 | "I'm the 'getNormFactor' property.") | |||
727 | flag_cspc = property(getFlagCspc, setValue) |
|
748 | flag_cspc = property(getFlagCspc, setValue) | |
728 | flag_dc = property(getFlagDc, setValue) |
|
749 | flag_dc = property(getFlagDc, setValue) | |
729 | noise = property(getNoise, setValue, "I'm the 'nHeights' property.") |
|
750 | noise = property(getNoise, setValue, "I'm the 'nHeights' property.") | |
730 |
timeInterval = property(getTimeInterval, setValue, |
|
751 | timeInterval = property(getTimeInterval, setValue, | |
|
752 | "I'm the 'timeInterval' property") | |||
|
753 | ||||
731 |
|
754 | |||
732 | class SpectraHeis(Spectra): |
|
755 | class SpectraHeis(Spectra): | |
733 |
|
756 | |||
@@ -803,6 +826,7 class SpectraHeis(Spectra): | |||||
803 | normFactor = property(getNormFactor, "I'm the 'getNormFactor' property.") |
|
826 | normFactor = property(getNormFactor, "I'm the 'getNormFactor' property.") | |
804 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
827 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
805 |
|
828 | |||
|
829 | ||||
806 | class Fits(JROData): |
|
830 | class Fits(JROData): | |
807 |
|
831 | |||
808 | heightList = None |
|
832 | heightList = None | |
@@ -838,7 +862,6 class Fits(JROData): | |||||
838 |
|
862 | |||
839 | realtime = False |
|
863 | realtime = False | |
840 |
|
864 | |||
841 |
|
||||
842 | def __init__(self): |
|
865 | def __init__(self): | |
843 |
|
866 | |||
844 | self.type = "Fits" |
|
867 | self.type = "Fits" | |
@@ -879,7 +902,6 class Fits(JROData): | |||||
879 | # self.comments = '' |
|
902 | # self.comments = '' | |
880 | # |
|
903 | # | |
881 |
|
904 | |||
882 |
|
||||
883 | def getltctime(self): |
|
905 | def getltctime(self): | |
884 |
|
906 | |||
885 | if self.useLocalTime: |
|
907 | if self.useLocalTime: | |
@@ -945,7 +967,8 class Fits(JROData): | |||||
945 | datatime = property(getDatatime, "I'm the 'datatime' property") |
|
967 | datatime = property(getDatatime, "I'm the 'datatime' property") | |
946 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") |
|
968 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") | |
947 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") |
|
969 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") | |
948 | channelIndexList = property(getChannelIndexList, "I'm the 'channelIndexList' property.") |
|
970 | channelIndexList = property( | |
|
971 | getChannelIndexList, "I'm the 'channelIndexList' property.") | |||
949 | noise = property(getNoise, "I'm the 'nHeights' property.") |
|
972 | noise = property(getNoise, "I'm the 'nHeights' property.") | |
950 |
|
973 | |||
951 | ltctime = property(getltctime, "I'm the 'ltctime' property") |
|
974 | ltctime = property(getltctime, "I'm the 'ltctime' property") | |
@@ -984,7 +1007,6 class Correlation(JROData): | |||||
984 |
|
1007 | |||
985 | nAvg = None |
|
1008 | nAvg = None | |
986 |
|
1009 | |||
987 |
|
||||
988 | def __init__(self): |
|
1010 | def __init__(self): | |
989 | ''' |
|
1011 | ''' | |
990 | Constructor |
|
1012 | Constructor | |
@@ -1049,7 +1071,8 class Correlation(JROData): | |||||
1049 | ind_vel[range(0,1)] = ind_vel[range(0,1)] + self.num_prof |
|
1071 | ind_vel[range(0, 1)] = ind_vel[range(0, 1)] + self.num_prof | |
1050 |
|
1072 | |||
1051 | if mode == 1: |
|
1073 | if mode == 1: | |
1052 | jspectra[:,freq_dc,:] = (jspectra[:,ind_vel[1],:] + jspectra[:,ind_vel[2],:])/2 #CORRECCION |
|
1074 | jspectra[:, freq_dc, :] = ( | |
|
1075 | jspectra[:, ind_vel[1], :] + jspectra[:, ind_vel[2], :]) / 2 # CORRECCION | |||
1053 |
|
1076 | |||
1054 | if mode == 2: |
|
1077 | if mode == 2: | |
1055 |
|
1078 | |||
@@ -1070,7 +1093,8 class Correlation(JROData): | |||||
1070 | cjunkid = sum(junkid) |
|
1093 | cjunkid = sum(junkid) | |
1071 |
|
1094 | |||
1072 | if cjunkid.any(): |
|
1095 | if cjunkid.any(): | |
1073 |
jspectra[ich,freq_dc,junkid.nonzero()] = ( |
|
1096 | jspectra[ich, freq_dc, junkid.nonzero()] = ( | |
|
1097 | jspectra[ich, ind_vel[1], junkid] + jspectra[ich, ind_vel[2], junkid]) / 2 | |||
1074 |
|
1098 | |||
1075 | noise = jspectra0[:,freq_dc,:] - jspectra[:,freq_dc,:] |
|
1099 | noise = jspectra0[:, freq_dc, :] - jspectra[:, freq_dc, :] | |
1076 |
|
1100 | |||
@@ -1126,6 +1150,7 class Correlation(JROData): | |||||
1126 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
1150 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
1127 | normFactor = property(getNormFactor, "I'm the 'normFactor property'") |
|
1151 | normFactor = property(getNormFactor, "I'm the 'normFactor property'") | |
1128 |
|
1152 | |||
|
1153 | ||||
1129 | class Parameters(Spectra): |
|
1154 | class Parameters(Spectra): | |
1130 |
|
1155 | |||
1131 |
experimentInfo = None |
|
1156 | experimentInfo = None # Information about the experiment | |
@@ -1180,7 +1205,6 class Parameters(Spectra): | |||||
1180 |
|
1205 | |||
1181 | GauSPC = None #Fit gaussian SPC |
|
1206 | GauSPC = None # Fit gaussian SPC | |
1182 |
|
1207 | |||
1183 |
|
||||
1184 | def __init__(self): |
|
1208 | def __init__(self): | |
1185 | ''' |
|
1209 | ''' | |
1186 | Constructor |
|
1210 | Constructor |
@@ -15,7 +15,6 import os | |||||
15 | import datetime |
|
15 | import datetime | |
16 | import numpy |
|
16 | import numpy | |
17 | import timeit |
|
17 | import timeit | |
18 | from profilehooks import coverage, profile |
|
|||
19 | from fractions import Fraction |
|
18 | from fractions import Fraction | |
20 |
|
19 | |||
21 | try: |
|
20 | try: | |
@@ -34,6 +33,7 try: | |||||
34 | except: |
|
33 | except: | |
35 | print 'You should install "digital_rf" module if you want to read Digital RF data' |
|
34 | print 'You should install "digital_rf" module if you want to read Digital RF data' | |
36 |
|
35 | |||
|
36 | ||||
37 | class DigitalRFReader(ProcessingUnit): |
|
37 | class DigitalRFReader(ProcessingUnit): | |
38 | ''' |
|
38 | ''' | |
39 | classdocs |
|
39 | classdocs | |
@@ -76,7 +76,8 class DigitalRFReader(ProcessingUnit): | |||||
76 | nProfiles = 1.0/ippSeconds # Number of profiles in one second |
|
76 | nProfiles = 1.0 / ippSeconds # Number of profiles in one second | |
77 |
|
77 | |||
78 | try: |
|
78 | try: | |
79 |
self.dataOut.radarControllerHeaderObj = RadarControllerHeader( |
|
79 | self.dataOut.radarControllerHeaderObj = RadarControllerHeader( | |
|
80 | self.__radarControllerHeader) | |||
80 | except: |
|
81 | except: | |
81 | self.dataOut.radarControllerHeaderObj = RadarControllerHeader( |
|
82 | self.dataOut.radarControllerHeaderObj = RadarControllerHeader( | |
82 | txA=0, |
|
83 | txA=0, | |
@@ -94,7 +95,8 class DigitalRFReader(ProcessingUnit): | |||||
94 | except: |
|
95 | except: | |
95 | self.dataOut.systemHeaderObj = SystemHeader(nSamples=self.__nSamples, |
|
96 | self.dataOut.systemHeaderObj = SystemHeader(nSamples=self.__nSamples, | |
96 | nProfiles=nProfiles, |
|
97 | nProfiles=nProfiles, | |
97 |
nChannels=len( |
|
98 | nChannels=len( | |
|
99 | self.__channelList), | |||
98 | adcResolution=14) |
|
100 | adcResolution=14) | |
99 | self.dataOut.type = "Voltage" |
|
101 | self.dataOut.type = "Voltage" | |
100 |
|
102 | |||
@@ -108,7 +110,9 class DigitalRFReader(ProcessingUnit): | |||||
108 |
|
110 | |||
109 | self.dataOut.nProfiles = int(nProfiles) |
|
111 | self.dataOut.nProfiles = int(nProfiles) | |
110 |
|
112 | |||
111 |
self.dataOut.heightList = self.__firstHeigth + |
|
113 | self.dataOut.heightList = self.__firstHeigth + \ | |
|
114 | numpy.arange(self.__nSamples, dtype=numpy.float) * \ | |||
|
115 | self.__deltaHeigth | |||
112 |
|
116 | |||
113 | self.dataOut.channelList = range(self.__num_subchannels) |
|
117 | self.dataOut.channelList = range(self.__num_subchannels) | |
114 |
|
118 | |||
@@ -124,18 +128,23 class DigitalRFReader(ProcessingUnit): | |||||
124 |
|
128 | |||
125 | self.dataOut.utctime = None |
|
129 | self.dataOut.utctime = None | |
126 |
|
130 | |||
127 |
|
|
131 | # timezone like jroheader, difference in minutes between UTC and localtime | |
|
132 | self.dataOut.timeZone = self.__timezone / 60 | |||
128 |
|
133 | |||
129 | self.dataOut.dstFlag = 0 |
|
134 | self.dataOut.dstFlag = 0 | |
130 |
|
135 | |||
131 | self.dataOut.errorCount = 0 |
|
136 | self.dataOut.errorCount = 0 | |
132 |
|
137 | |||
133 | try: |
|
138 | try: | |
134 |
self.dataOut.nCohInt = self.fixed_metadata_dict.get( |
|
139 | self.dataOut.nCohInt = self.fixed_metadata_dict.get( | |
|
140 | 'nCohInt', self.nCohInt) | |||
135 |
|
141 | |||
136 | self.dataOut.flagDecodeData = self.fixed_metadata_dict['flagDecodeData'] # asumo que la data esta decodificada |
|
142 | # asumo que la data esta decodificada | |
|
143 | self.dataOut.flagDecodeData = self.fixed_metadata_dict.get( | |||
|
144 | 'flagDecodeData', self.flagDecodeData) | |||
137 |
|
145 | |||
138 | self.dataOut.flagDeflipData = self.fixed_metadata_dict['flagDeflipData'] # asumo que la data esta sin flip |
|
146 | # asumo que la data esta sin flip | |
|
147 | self.dataOut.flagDeflipData = self.fixed_metadata_dict['flagDeflipData'] | |||
139 |
|
148 | |||
140 | self.dataOut.flagShiftFFT = self.fixed_metadata_dict['flagShiftFFT'] |
|
149 | self.dataOut.flagShiftFFT = self.fixed_metadata_dict['flagShiftFFT'] | |
141 |
|
150 | |||
@@ -143,7 +152,6 class DigitalRFReader(ProcessingUnit): | |||||
143 | except: |
|
152 | except: | |
144 | pass |
|
153 | pass | |
145 |
|
154 | |||
146 |
|
||||
147 | self.dataOut.ippSeconds = ippSeconds |
|
155 | self.dataOut.ippSeconds = ippSeconds | |
148 |
|
156 | |||
149 | # Time interval between profiles |
|
157 | # Time interval between profiles | |
@@ -159,7 +167,8 class DigitalRFReader(ProcessingUnit): | |||||
159 | return [] |
|
167 | return [] | |
160 |
|
168 | |||
161 | try: |
|
169 | try: | |
162 |
digitalReadObj = digital_rf.DigitalRFReader( |
|
170 | digitalReadObj = digital_rf.DigitalRFReader( | |
|
171 | path, load_all_metadata=True) | |||
163 | except: |
|
172 | except: | |
164 | digitalReadObj = digital_rf.DigitalRFReader(path) |
|
173 | digitalReadObj = digital_rf.DigitalRFReader(path) | |
165 |
|
174 | |||
@@ -179,7 +188,8 class DigitalRFReader(ProcessingUnit): | |||||
179 | except: |
|
188 | except: | |
180 | timezone = 0 |
|
189 | timezone = 0 | |
181 |
|
190 | |||
182 |
startUTCSecond, endUTCSecond = digitalReadObj.get_bounds( |
|
191 | startUTCSecond, endUTCSecond = digitalReadObj.get_bounds( | |
|
192 | channelNameList[0]) / sample_rate - timezone | |||
183 |
|
193 | |||
184 | startDatetime = datetime.datetime.utcfromtimestamp(startUTCSecond) |
|
194 | startDatetime = datetime.datetime.utcfromtimestamp(startUTCSecond) | |
185 | endDatatime = datetime.datetime.utcfromtimestamp(endUTCSecond) |
|
195 | endDatatime = datetime.datetime.utcfromtimestamp(endUTCSecond) | |
@@ -220,6 +230,11 class DigitalRFReader(ProcessingUnit): | |||||
220 |
|
|
230 | delay=60, | |
221 |
|
|
231 | buffer_size=1024, | |
222 |
|
|
232 | ippKm=None, | |
|
233 | nCohInt=1, | |||
|
234 | nCode=1, | |||
|
235 | nBaud=1, | |||
|
236 | flagDecodeData=False, | |||
|
237 | code=numpy.ones((1, 1), dtype=numpy.int), | |||
223 |
|
|
238 | **kwargs): | |
224 | ''' |
|
239 | ''' | |
225 | In this method we should set all initial parameters. |
|
240 | In this method we should set all initial parameters. | |
@@ -236,12 +251,15 class DigitalRFReader(ProcessingUnit): | |||||
236 | online |
|
251 | online | |
237 | delay |
|
252 | delay | |
238 | ''' |
|
253 | ''' | |
|
254 | self.nCohInt = nCohInt | |||
|
255 | self.flagDecodeData = flagDecodeData | |||
239 | self.i = 0 |
|
256 | self.i = 0 | |
240 | if not os.path.isdir(path): |
|
257 | if not os.path.isdir(path): | |
241 | raise ValueError, "[Reading] Directory %s does not exist" %path |
|
258 | raise ValueError, "[Reading] Directory %s does not exist" % path | |
242 |
|
259 | |||
243 | try: |
|
260 | try: | |
244 |
self.digitalReadObj = digital_rf.DigitalRFReader( |
|
261 | self.digitalReadObj = digital_rf.DigitalRFReader( | |
|
262 | path, load_all_metadata=True) | |||
245 | except: |
|
263 | except: | |
246 | self.digitalReadObj = digital_rf.DigitalRFReader(path) |
|
264 | self.digitalReadObj = digital_rf.DigitalRFReader(path) | |
247 |
|
265 | |||
@@ -253,20 +271,23 class DigitalRFReader(ProcessingUnit): | |||||
253 | if not channelList: |
|
271 | if not channelList: | |
254 | channelList = range(len(channelNameList)) |
|
272 | channelList = range(len(channelNameList)) | |
255 |
|
273 | |||
256 |
|
||||
257 | ########## Reading metadata ###################### |
|
274 | ########## Reading metadata ###################### | |
258 |
|
275 | |||
259 |
top_properties = self.digitalReadObj.get_properties( |
|
276 | top_properties = self.digitalReadObj.get_properties( | |
260 |
|
277 | channelNameList[channelList[0]]) | ||
261 |
|
278 | |||
262 | self.__num_subchannels = top_properties['num_subchannels'] |
|
279 | self.__num_subchannels = top_properties['num_subchannels'] | |
263 | self.__sample_rate = 1.0 * top_properties['sample_rate_numerator'] / top_properties['sample_rate_denominator'] |
|
280 | self.__sample_rate = 1.0 * \ | |
|
281 | top_properties['sample_rate_numerator'] / \ | |||
|
282 | top_properties['sample_rate_denominator'] | |||
264 | # self.__samples_per_file = top_properties['samples_per_file'][0] |
|
283 | # self.__samples_per_file = top_properties['samples_per_file'][0] | |
265 |
self.__deltaHeigth = 1e6*0.15/self.__sample_rate |
|
284 | self.__deltaHeigth = 1e6 * 0.15 / self.__sample_rate # why 0.15? | |
266 |
|
285 | |||
267 |
this_metadata_file = self.digitalReadObj.get_digital_metadata( |
|
286 | this_metadata_file = self.digitalReadObj.get_digital_metadata( | |
|
287 | channelNameList[channelList[0]]) | |||
268 | metadata_bounds = this_metadata_file.get_bounds() |
|
288 | metadata_bounds = this_metadata_file.get_bounds() | |
269 |
self.fixed_metadata_dict = this_metadata_file.read( |
|
289 | self.fixed_metadata_dict = this_metadata_file.read( | |
|
290 | metadata_bounds[0])[metadata_bounds[0]] # GET FIRST HEADER | |||
270 |
|
291 | |||
271 | try: |
|
292 | try: | |
272 | self.__processingHeader = self.fixed_metadata_dict['processingHeader'] |
|
293 | self.__processingHeader = self.fixed_metadata_dict['processingHeader'] | |
@@ -276,14 +297,12 class DigitalRFReader(ProcessingUnit): | |||||
276 | except: |
|
297 | except: | |
277 | pass |
|
298 | pass | |
278 |
|
299 | |||
279 |
|
||||
280 | self.__frequency = None |
|
300 | self.__frequency = None | |
281 |
|
301 | |||
282 | self.__frequency = self.fixed_metadata_dict.get('frequency', 1) |
|
302 | self.__frequency = self.fixed_metadata_dict.get('frequency', 1) | |
283 |
|
303 | |||
284 | self.__timezone = self.fixed_metadata_dict.get('timezone', 300) |
|
304 | self.__timezone = self.fixed_metadata_dict.get('timezone', 300) | |
285 |
|
305 | |||
286 |
|
||||
287 | try: |
|
306 | try: | |
288 | nSamples = self.fixed_metadata_dict['nSamples'] |
|
307 | nSamples = self.fixed_metadata_dict['nSamples'] | |
289 | except: |
|
308 | except: | |
@@ -296,10 +315,6 class DigitalRFReader(ProcessingUnit): | |||||
296 | except: |
|
315 | except: | |
297 | codeType = 0 |
|
316 | codeType = 0 | |
298 |
|
317 | |||
299 | nCode = 1 |
|
|||
300 | nBaud = 1 |
|
|||
301 | code = numpy.ones((nCode, nBaud), dtype=numpy.int) |
|
|||
302 |
|
||||
303 | try: |
|
318 | try: | |
304 | if codeType: |
|
319 | if codeType: | |
305 | nCode = self.__radarControllerHeader['nCode'] |
|
320 | nCode = self.__radarControllerHeader['nCode'] | |
@@ -308,7 +323,6 class DigitalRFReader(ProcessingUnit): | |||||
308 | except: |
|
323 | except: | |
309 | pass |
|
324 | pass | |
310 |
|
325 | |||
311 |
|
||||
312 | if not ippKm: |
|
326 | if not ippKm: | |
313 | try: |
|
327 | try: | |
314 | # seconds to km |
|
328 | # seconds to km | |
@@ -322,13 +336,16 class DigitalRFReader(ProcessingUnit): | |||||
322 |
|
336 | |||
323 | if startDate: |
|
337 | if startDate: | |
324 | startDatetime = datetime.datetime.combine(startDate, startTime) |
|
338 | startDatetime = datetime.datetime.combine(startDate, startTime) | |
325 | startUTCSecond = (startDatetime-datetime.datetime(1970,1,1)).total_seconds() + self.__timezone |
|
339 | startUTCSecond = ( | |
|
340 | startDatetime - datetime.datetime(1970, 1, 1)).total_seconds() + self.__timezone | |||
326 |
|
341 | |||
327 | if endDate: |
|
342 | if endDate: | |
328 | endDatetime = datetime.datetime.combine(endDate, endTime) |
|
343 | endDatetime = datetime.datetime.combine(endDate, endTime) | |
329 |
endUTCSecond = (endDatetime-datetime.datetime(1970, |
|
344 | endUTCSecond = (endDatetime - datetime.datetime(1970, | |
|
345 | 1, 1)).total_seconds() + self.__timezone | |||
330 |
|
346 | |||
331 |
start_index, end_index = self.digitalReadObj.get_bounds( |
|
347 | start_index, end_index = self.digitalReadObj.get_bounds( | |
|
348 | channelNameList[channelList[0]]) | |||
332 |
|
349 | |||
333 | if not startUTCSecond: |
|
350 | if not startUTCSecond: | |
334 |
startUTCSecond = start_index/self.__sample_rate |
|
351 | startUTCSecond = start_index / self.__sample_rate | |
@@ -350,7 +367,8 class DigitalRFReader(ProcessingUnit): | |||||
350 |
|
367 | |||
351 | for thisIndexChannel in channelList: |
|
368 | for thisIndexChannel in channelList: | |
352 |
thisChannelName = |
|
369 | thisChannelName = channelNameList[thisIndexChannel] | |
353 |
start_index, end_index = self.digitalReadObj.get_bounds( |
|
370 | start_index, end_index = self.digitalReadObj.get_bounds( | |
|
371 | thisChannelName) | |||
354 | channelBoundList.append((start_index, end_index)) |
|
372 | channelBoundList.append((start_index, end_index)) | |
355 | channelNameListFiltered.append(thisChannelName) |
|
373 | channelNameListFiltered.append(thisChannelName) | |
356 |
|
374 | |||
@@ -375,30 +393,38 class DigitalRFReader(ProcessingUnit): | |||||
375 | self.__startUTCSecond = startUTCSecond |
|
393 | self.__startUTCSecond = startUTCSecond | |
376 | self.__endUTCSecond = endUTCSecond |
|
394 | self.__endUTCSecond = endUTCSecond | |
377 |
|
395 | |||
378 |
self.__timeInterval = 1.0 * self.__samples_to_read/ |
|
396 | self.__timeInterval = 1.0 * self.__samples_to_read / \ | |
|
397 | self.__sample_rate # Time interval | |||
379 |
|
398 | |||
380 | if online: |
|
399 | if online: | |
381 | # self.__thisUnixSample = int(endUTCSecond*self.__sample_rate - 4*self.__samples_to_read) |
|
400 | # self.__thisUnixSample = int(endUTCSecond*self.__sample_rate - 4*self.__samples_to_read) | |
382 | startUTCSecond = numpy.floor(endUTCSecond) |
|
401 | startUTCSecond = numpy.floor(endUTCSecond) | |
383 |
|
402 | |||
384 |
|
|
403 | # por que en el otro metodo lo primero q se hace es sumar samplestoread | |
|
404 | self.__thisUnixSample = long( | |||
|
405 | startUTCSecond * self.__sample_rate) - self.__samples_to_read | |||
385 |
|
406 | |||
386 | self.__data_buffer = numpy.zeros((self.__num_subchannels, self.__samples_to_read), dtype = numpy.complex) |
|
407 | self.__data_buffer = numpy.zeros( | |
|
408 | (self.__num_subchannels, self.__samples_to_read), dtype=numpy.complex) | |||
387 |
|
409 | |||
388 | self.__setFileHeader() |
|
410 | self.__setFileHeader() | |
389 | self.isConfig = True |
|
411 | self.isConfig = True | |
390 |
|
412 | |||
391 | print "[Reading] Digital RF Data was found from %s to %s " %( |
|
413 | print "[Reading] Digital RF Data was found from %s to %s " % ( | |
392 | datetime.datetime.utcfromtimestamp(self.__startUTCSecond - self.__timezone), |
|
414 | datetime.datetime.utcfromtimestamp( | |
393 | datetime.datetime.utcfromtimestamp(self.__endUTCSecond - self.__timezone) |
|
415 | self.__startUTCSecond - self.__timezone), | |
|
416 | datetime.datetime.utcfromtimestamp( | |||
|
417 | self.__endUTCSecond - self.__timezone) | |||
394 | ) |
|
418 | ) | |
395 |
|
419 | |||
396 | print "[Reading] Starting process from %s to %s" %(datetime.datetime.utcfromtimestamp(startUTCSecond - self.__timezone), |
|
420 | print "[Reading] Starting process from %s to %s" % (datetime.datetime.utcfromtimestamp(startUTCSecond - self.__timezone), | |
397 |
datetime.datetime.utcfromtimestamp( |
|
421 | datetime.datetime.utcfromtimestamp( | |
|
422 | endUTCSecond - self.__timezone) | |||
398 | ) |
|
423 | ) | |
399 | self.oldAverage = None |
|
424 | self.oldAverage = None | |
400 | self.count = 0 |
|
425 | self.count = 0 | |
401 | self.executionTime = 0 |
|
426 | self.executionTime = 0 | |
|
427 | ||||
402 | def __reload(self): |
|
428 | def __reload(self): | |
403 |
|
429 | |||
404 | # print "%s not in range [%s, %s]" %( |
|
430 | # print "%s not in range [%s, %s]" %( | |
@@ -413,7 +439,8 class DigitalRFReader(ProcessingUnit): | |||||
413 | except: |
|
439 | except: | |
414 | self.digitalReadObj.reload() |
|
440 | self.digitalReadObj.reload() | |
415 |
|
441 | |||
416 |
start_index, end_index = self.digitalReadObj.get_bounds( |
|
442 | start_index, end_index = self.digitalReadObj.get_bounds( | |
|
443 | self.__channelNameList[self.__channelList[0]]) | |||
417 |
|
444 | |||
418 | if start_index > self.__startUTCSecond*self.__sample_rate: |
|
445 | if start_index > self.__startUTCSecond * self.__sample_rate: | |
419 | self.__startUTCSecond = 1.0*start_index/self.__sample_rate |
|
446 | self.__startUTCSecond = 1.0 * start_index / self.__sample_rate | |
@@ -422,8 +449,10 class DigitalRFReader(ProcessingUnit): | |||||
422 | self.__endUTCSecond = 1.0*end_index/self.__sample_rate |
|
449 | self.__endUTCSecond = 1.0 * end_index / self.__sample_rate | |
423 |
|
450 | |||
424 | print "[Reading] New timerange found [%s, %s] " %( |
|
451 | print "[Reading] New timerange found [%s, %s] " % ( | |
425 | datetime.datetime.utcfromtimestamp(self.__startUTCSecond - self.__timezone), |
|
452 | datetime.datetime.utcfromtimestamp( | |
426 | datetime.datetime.utcfromtimestamp(self.__endUTCSecond - self.__timezone) |
|
453 | self.__startUTCSecond - self.__timezone), | |
|
454 | datetime.datetime.utcfromtimestamp( | |||
|
455 | self.__endUTCSecond - self.__timezone) | |||
427 | ) |
|
456 | ) | |
428 |
|
457 | |||
429 | return True |
|
458 | return True | |
@@ -434,8 +463,10 class DigitalRFReader(ProcessingUnit): | |||||
434 | t0 = time() |
|
463 | t0 = time() | |
435 | toExecute() |
|
464 | toExecute() | |
436 | self.executionTime = time() - t0 |
|
465 | self.executionTime = time() - t0 | |
437 |
if self.oldAverage is None: |
|
466 | if self.oldAverage is None: | |
438 |
self.oldAverage = |
|
467 | self.oldAverage = self.executionTime | |
|
468 | self.oldAverage = (self.executionTime + self.count * | |||
|
469 | self.oldAverage) / (self.count + 1.0) | |||
439 | self.count = self.count + 1.0 |
|
470 | self.count = self.count + 1.0 | |
440 | return |
|
471 | return | |
441 |
|
472 | |||
@@ -461,7 +492,7 class DigitalRFReader(ProcessingUnit): | |||||
461 | indexChannel = 0 |
|
492 | indexChannel = 0 | |
462 |
|
493 | |||
463 | dataOk = False |
|
494 | dataOk = False | |
464 |
for thisChannelName in self.__channelNameList: |
|
495 | for thisChannelName in self.__channelNameList: # TODO VARIOS CHANNELS? | |
465 | for indexSubchannel in range(self.__num_subchannels): |
|
496 | for indexSubchannel in range(self.__num_subchannels): | |
466 | try: |
|
497 | try: | |
467 | t0 = time() |
|
498 | t0 = time() | |
@@ -469,8 +500,10 class DigitalRFReader(ProcessingUnit): | |||||
469 | self.__samples_to_read, |
|
500 | self.__samples_to_read, | |
470 | thisChannelName, sub_channel=indexSubchannel) |
|
501 | thisChannelName, sub_channel=indexSubchannel) | |
471 | self.executionTime = time() - t0 |
|
502 | self.executionTime = time() - t0 | |
472 |
if self.oldAverage is None: |
|
503 | if self.oldAverage is None: | |
473 |
self.oldAverage = |
|
504 | self.oldAverage = self.executionTime | |
|
505 | self.oldAverage = ( | |||
|
506 | self.executionTime + self.count * self.oldAverage) / (self.count + 1.0) | |||
474 | self.count = self.count + 1.0 |
|
507 | self.count = self.count + 1.0 | |
475 |
|
508 | |||
476 | except IOError, e: |
|
509 | except IOError, e: | |
@@ -509,7 +542,6 class DigitalRFReader(ProcessingUnit): | |||||
509 | return self.__bufferIndex > self.__samples_to_read - self.__nSamples #40960 - 40 |
|
542 | return self.__bufferIndex > self.__samples_to_read - self.__nSamples # 40960 - 40 | |
510 |
|
543 | |||
511 | def getData(self, seconds=30, nTries=5): |
|
544 | def getData(self, seconds=30, nTries=5): | |
512 |
|
||||
513 | ''' |
|
545 | ''' | |
514 | This method gets the data from files and put the data into the dataOut object |
|
546 | This method gets the data from files and put the data into the dataOut object | |
515 |
|
547 | |||
@@ -552,8 +584,10 class DigitalRFReader(ProcessingUnit): | |||||
552 | print '[Reading] waiting %d seconds to read a new block' %seconds |
|
584 | print '[Reading] waiting %d seconds to read a new block' % seconds | |
553 | sleep(seconds) |
|
585 | sleep(seconds) | |
554 |
|
586 | |||
555 |
self.dataOut.data = self.__data_buffer[:, |
|
587 | self.dataOut.data = self.__data_buffer[:, | |
556 | self.dataOut.utctime = (self.__thisUnixSample + self.__bufferIndex)/self.__sample_rate |
|
588 | self.__bufferIndex:self.__bufferIndex + self.__nSamples] | |
|
589 | self.dataOut.utctime = ( | |||
|
590 | self.__thisUnixSample + self.__bufferIndex) / self.__sample_rate | |||
557 | self.dataOut.flagNoData = False |
|
591 | self.dataOut.flagNoData = False | |
558 | self.dataOut.flagDiscontinuousBlock = self.__flagDiscontinuousBlock |
|
592 | self.dataOut.flagDiscontinuousBlock = self.__flagDiscontinuousBlock | |
559 | self.dataOut.profileIndex = self.profileIndex |
|
593 | self.dataOut.profileIndex = self.profileIndex | |
@@ -583,7 +617,6 class DigitalRFReader(ProcessingUnit): | |||||
583 | return |
|
617 | return | |
584 | # print self.profileIndex |
|
618 | # print self.profileIndex | |
585 |
|
619 | |||
586 |
|
||||
587 | def run(self, **kwargs): |
|
620 | def run(self, **kwargs): | |
588 | ''' |
|
621 | ''' | |
589 | This method will be called many times so here you should put all your code |
|
622 | This method will be called many times so here you should put all your code | |
@@ -596,6 +629,7 class DigitalRFReader(ProcessingUnit): | |||||
596 |
|
629 | |||
597 | return |
|
630 | return | |
598 |
|
631 | |||
|
632 | ||||
599 | class DigitalRFWriter(Operation): |
|
633 | class DigitalRFWriter(Operation): | |
600 | ''' |
|
634 | ''' | |
601 | classdocs |
|
635 | classdocs | |
@@ -644,9 +678,11 class DigitalRFWriter(Operation): | |||||
644 | self.__nProfiles = dataOut.nProfiles |
|
678 | self.__nProfiles = dataOut.nProfiles | |
645 | self.__blocks_per_file = dataOut.processingHeaderObj.dataBlocksPerFile |
|
679 | self.__blocks_per_file = dataOut.processingHeaderObj.dataBlocksPerFile | |
646 |
|
680 | |||
647 |
self.arr_data = arr_data = numpy.ones((self.__nSamples, len( |
|
681 | self.arr_data = arr_data = numpy.ones((self.__nSamples, len( | |
|
682 | self.dataOut.channelList)), dtype=[('r', self.__dtype), ('i', self.__dtype)]) | |||
648 |
|
683 | |||
649 | file_cadence_millisecs = long(1.0 * self.__blocks_per_file * self.__nProfiles * self.__nSamples / self.__sample_rate) * 1000 |
|
684 | file_cadence_millisecs = long( | |
|
685 | 1.0 * self.__blocks_per_file * self.__nProfiles * self.__nSamples / self.__sample_rate) * 1000 | |||
650 | sub_cadence_secs = file_cadence_millisecs / 500 |
|
686 | sub_cadence_secs = file_cadence_millisecs / 500 | |
651 |
|
687 | |||
652 | sample_rate_fraction = Fraction(self.__sample_rate).limit_denominator() |
|
688 | sample_rate_fraction = Fraction(self.__sample_rate).limit_denominator() | |
@@ -670,11 +706,10 class DigitalRFWriter(Operation): | |||||
670 | metadata_dir = os.path.join(path, 'metadata') |
|
706 | metadata_dir = os.path.join(path, 'metadata') | |
671 | os.system('mkdir %s' % (metadata_dir)) |
|
707 | os.system('mkdir %s' % (metadata_dir)) | |
672 |
|
708 | |||
673 |
self.digitalMetadataWriteObj = digital_rf.DigitalMetadataWriter(metadata_dir, dirCadence, 1, |
|
709 | self.digitalMetadataWriteObj = digital_rf.DigitalMetadataWriter(metadata_dir, dirCadence, 1, # 236, file_cadence_millisecs / 1000 | |
674 | sample_rate_numerator, sample_rate_denominator, |
|
710 | sample_rate_numerator, sample_rate_denominator, | |
675 | metadataFile) |
|
711 | metadataFile) | |
676 |
|
712 | |||
677 |
|
||||
678 | self.isConfig = True |
|
713 | self.isConfig = True | |
679 | self.currentSample = 0 |
|
714 | self.currentSample = 0 | |
680 | self.oldAverage = 0 |
|
715 | self.oldAverage = 0 | |
@@ -685,23 +720,26 class DigitalRFWriter(Operation): | |||||
685 | print '[Writing] - Writing metadata' |
|
720 | print '[Writing] - Writing metadata' | |
686 | start_idx = self.__sample_rate * self.dataOut.utctime |
|
721 | start_idx = self.__sample_rate * self.dataOut.utctime | |
687 |
|
722 | |||
688 |
self.metadata_dict['processingHeader'] = self.dataOut.processingHeaderObj.getAsDict( |
|
723 | self.metadata_dict['processingHeader'] = self.dataOut.processingHeaderObj.getAsDict( | |
689 | self.metadata_dict['radarControllerHeader'] = self.dataOut.radarControllerHeaderObj.getAsDict() |
|
724 | ) | |
690 |
self.metadata_dict[' |
|
725 | self.metadata_dict['radarControllerHeader'] = self.dataOut.radarControllerHeaderObj.getAsDict( | |
|
726 | ) | |||
|
727 | self.metadata_dict['systemHeader'] = self.dataOut.systemHeaderObj.getAsDict( | |||
|
728 | ) | |||
691 | self.digitalMetadataWriteObj.write(start_idx, self.metadata_dict) |
|
729 | self.digitalMetadataWriteObj.write(start_idx, self.metadata_dict) | |
692 | return |
|
730 | return | |
693 |
|
731 | |||
694 |
|
||||
695 | def timeit(self, toExecute): |
|
732 | def timeit(self, toExecute): | |
696 | t0 = time() |
|
733 | t0 = time() | |
697 | toExecute() |
|
734 | toExecute() | |
698 | self.executionTime = time() - t0 |
|
735 | self.executionTime = time() - t0 | |
699 |
if self.oldAverage is None: |
|
736 | if self.oldAverage is None: | |
700 |
self.oldAverage = |
|
737 | self.oldAverage = self.executionTime | |
|
738 | self.oldAverage = (self.executionTime + self.count * | |||
|
739 | self.oldAverage) / (self.count + 1.0) | |||
701 | self.count = self.count + 1.0 |
|
740 | self.count = self.count + 1.0 | |
702 | return |
|
741 | return | |
703 |
|
742 | |||
704 |
|
||||
705 | def writeData(self): |
|
743 | def writeData(self): | |
706 | for i in range(self.dataOut.systemHeaderObj.nSamples): |
|
744 | for i in range(self.dataOut.systemHeaderObj.nSamples): | |
707 | for channel in self.dataOut.channelList: |
|
745 | for channel in self.dataOut.channelList: | |
@@ -722,14 +760,15 class DigitalRFWriter(Operation): | |||||
722 | # print dataOut.__dict__ |
|
760 | # print dataOut.__dict__ | |
723 | self.dataOut = dataOut |
|
761 | self.dataOut = dataOut | |
724 | if not self.isConfig: |
|
762 | if not self.isConfig: | |
725 |
self.setup(dataOut, path, frequency, fileCadence, |
|
763 | self.setup(dataOut, path, frequency, fileCadence, | |
|
764 | dirCadence, metadataCadence, **kwargs) | |||
726 | self.writeMetadata() |
|
765 | self.writeMetadata() | |
727 |
|
766 | |||
728 | self.writeData() |
|
767 | self.writeData() | |
729 |
|
768 | |||
730 | ## self.currentSample += 1 |
|
769 | ## self.currentSample += 1 | |
731 |
|
|
770 | # if self.dataOut.flagDataAsBlock or self.currentSample == 1: | |
732 |
|
|
771 | # self.writeMetadata() | |
733 | ## if self.currentSample == self.__nProfiles: self.currentSample = 0 |
|
772 | ## if self.currentSample == self.__nProfiles: self.currentSample = 0 | |
734 |
|
773 | |||
735 | def close(self): |
|
774 | def close(self): |
@@ -616,7 +616,6 class Decoder(Operation): | |||||
616 | def __convolutionInTime(self, data): |
|
616 | def __convolutionInTime(self, data): | |
617 |
|
617 | |||
618 | code = self.code[self.__profIndex] |
|
618 | code = self.code[self.__profIndex] | |
619 |
|
||||
620 | for i in range(self.__nChannels): |
|
619 | for i in range(self.__nChannels): | |
621 | self.datadecTime[i,:] = numpy.correlate(data[i,:], code, mode='full')[self.nBaud-1:] |
|
620 | self.datadecTime[i,:] = numpy.correlate(data[i,:], code, mode='full')[self.nBaud-1:] | |
622 |
|
621 | |||
@@ -666,7 +665,6 class Decoder(Operation): | |||||
666 | code = dataOut.code |
|
665 | code = dataOut.code | |
667 | else: |
|
666 | else: | |
668 | code = numpy.array(code).reshape(nCode,nBaud) |
|
667 | code = numpy.array(code).reshape(nCode,nBaud) | |
669 |
|
||||
670 | self.setup(code, osamp, dataOut) |
|
668 | self.setup(code, osamp, dataOut) | |
671 |
|
669 | |||
672 | self.isConfig = True |
|
670 | self.isConfig = True |
General Comments 0
You need to be logged in to leave comments.
Login now