@@ -368,6 +368,8 class Voltage(JROData): | |||||
368 | dataPP_DOP = None |
|
368 | dataPP_DOP = None | |
369 | dataPP_WIDTH = None |
|
369 | dataPP_WIDTH = None | |
370 | dataPP_SNR = None |
|
370 | dataPP_SNR = None | |
|
371 | flagProfilesByRange = False | |||
|
372 | nProfilesByRange = None | |||
371 |
|
373 | |||
372 | def __init__(self): |
|
374 | def __init__(self): | |
373 | ''' |
|
375 | ''' | |
@@ -458,6 +460,8 class Voltage(JROData): | |||||
458 | class Spectra(JROData): |
|
460 | class Spectra(JROData): | |
459 |
|
461 | |||
460 | data_outlier = None |
|
462 | data_outlier = None | |
|
463 | flagProfilesByRange = False | |||
|
464 | nProfilesByRange = None | |||
461 |
|
465 | |||
462 | def __init__(self): |
|
466 | def __init__(self): | |
463 | ''' |
|
467 | ''' | |
@@ -588,13 +592,13 class Spectra(JROData): | |||||
588 | def normFactor(self): |
|
592 | def normFactor(self): | |
589 |
|
593 | |||
590 | pwcode = 1 |
|
594 | pwcode = 1 | |
591 |
|
||||
592 | if self.flagDecodeData: |
|
595 | if self.flagDecodeData: | |
593 | pwcode = numpy.sum(self.code[0]**2) |
|
596 | pwcode = numpy.sum(self.code[0]**2) | |
594 | #print(self.flagDecodeData, pwcode) |
|
597 | #print(self.flagDecodeData, pwcode) | |
595 | #normFactor = min(self.nFFTPoints,self.nProfiles)*self.nIncohInt*self.nCohInt*pwcode*self.windowOfFilter |
|
598 | #normFactor = min(self.nFFTPoints,self.nProfiles)*self.nIncohInt*self.nCohInt*pwcode*self.windowOfFilter | |
596 | normFactor = self.nProfiles * self.nIncohInt * self.nCohInt * pwcode * self.windowOfFilter |
|
599 | normFactor = self.nProfiles * self.nIncohInt * self.nCohInt * pwcode * self.windowOfFilter | |
597 |
|
600 | if self.flagProfilesByRange: | ||
|
601 | normFactor *= (self.nProfilesByRange/self.nProfilesByRange.max()) | |||
598 |
|
602 | |||
599 | return normFactor |
|
603 | return normFactor | |
600 |
|
604 | |||
@@ -939,7 +943,8 class Parameters(Spectra): | |||||
939 | noise_estimation = None |
|
943 | noise_estimation = None | |
940 | GauSPC = None # Fit gaussian SPC |
|
944 | GauSPC = None # Fit gaussian SPC | |
941 | txPower = None |
|
945 | txPower = None | |
942 |
|
946 | flagProfilesByRange = False | ||
|
947 | nProfilesByRange = None | |||
943 |
|
948 | |||
944 | def __init__(self): |
|
949 | def __init__(self): | |
945 | ''' |
|
950 | ''' |
@@ -943,18 +943,21 class NoiselessSpectraPlot(Plot): | |||||
943 | data = {} |
|
943 | data = {} | |
944 | meta = {} |
|
944 | meta = {} | |
945 |
|
945 | |||
946 |
norm = dataOut.nProfiles * dataOut.max_nIncohInt * dataOut.nCohInt * dataOut.windowOfFilter |
|
946 | norm = dataOut.nProfiles * dataOut.max_nIncohInt * dataOut.nCohInt * dataOut.windowOfFilter | |
947 |
n0 = |
|
947 | n0 = (dataOut.getNoise()/norm) | |
948 | noise = numpy.repeat(n0,(dataOut.nFFTPoints*dataOut.nHeights)).reshape(dataOut.nChannels,dataOut.nFFTPoints,dataOut.nHeights) |
|
948 | noise = numpy.repeat(n0,(dataOut.nFFTPoints*dataOut.nHeights)).reshape(dataOut.nChannels,dataOut.nFFTPoints,dataOut.nHeights) | |
|
949 | noise = 10*numpy.log10(noise) | |||
949 |
|
950 | |||
950 | z = [] |
|
951 | z = numpy.zeros((dataOut.nChannels, dataOut.nFFTPoints, dataOut.nHeights)) | |
951 | for ch in range(dataOut.nChannels): |
|
952 | for ch in range(dataOut.nChannels): | |
952 |
if hasattr(dataOut.normFactor,' |
|
953 | if hasattr(dataOut.normFactor,'ndim'): | |
953 | z.append(numpy.divide(dataOut.data_spc[ch],dataOut.normFactor[ch])) |
|
954 | if dataOut.normFactor.ndim > 1: | |
|
955 | z[ch] = (numpy.divide(dataOut.data_spc[ch],dataOut.normFactor[ch])) | |||
|
956 | else: | |||
|
957 | z[ch] = (numpy.divide(dataOut.data_spc[ch],dataOut.normFactor)) | |||
954 | else: |
|
958 | else: | |
955 |
z |
|
959 | z[ch] = (numpy.divide(dataOut.data_spc[ch],dataOut.normFactor)) | |
956 |
|
960 | |||
957 | z = numpy.asarray(z) |
|
|||
958 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
961 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) | |
959 | spc = 10*numpy.log10(z) |
|
962 | spc = 10*numpy.log10(z) | |
960 |
|
963 | |||
@@ -1061,8 +1064,6 class NoiselessRTIPlot(RTIPlot): | |||||
1061 | #print(dataOut.max_nIncohInt, dataOut.nIncohInt) |
|
1064 | #print(dataOut.max_nIncohInt, dataOut.nIncohInt) | |
1062 | #print(dataOut.windowOfFilter,dataOut.nCohInt,dataOut.nProfiles,dataOut.max_nIncohInt,dataOut.nIncohInt) |
|
1065 | #print(dataOut.windowOfFilter,dataOut.nCohInt,dataOut.nProfiles,dataOut.max_nIncohInt,dataOut.nIncohInt) | |
1063 | norm = dataOut.nProfiles * dataOut.max_nIncohInt * dataOut.nCohInt * dataOut.windowOfFilter |
|
1066 | norm = dataOut.nProfiles * dataOut.max_nIncohInt * dataOut.nCohInt * dataOut.windowOfFilter | |
1064 |
|
||||
1065 |
|
||||
1066 | n0 = 10*numpy.log10(dataOut.getNoise()/norm) |
|
1067 | n0 = 10*numpy.log10(dataOut.getNoise()/norm) | |
1067 | data['noise'] = n0 |
|
1068 | data['noise'] = n0 | |
1068 | noise = numpy.repeat(n0,dataOut.nHeights).reshape(dataOut.nChannels,dataOut.nHeights) |
|
1069 | noise = numpy.repeat(n0,dataOut.nHeights).reshape(dataOut.nChannels,dataOut.nHeights) |
@@ -145,7 +145,8 class ParametersProc(ProcessingUnit): | |||||
145 | self.dataOut.nIncohInt = self.dataIn.nIncohInt |
|
145 | self.dataOut.nIncohInt = self.dataIn.nIncohInt | |
146 | self.dataOut.nFFTPoints = self.dataIn.nFFTPoints |
|
146 | self.dataOut.nFFTPoints = self.dataIn.nFFTPoints | |
147 | self.dataOut.ippFactor = self.dataIn.ippFactor |
|
147 | self.dataOut.ippFactor = self.dataIn.ippFactor | |
148 |
|
148 | self.dataOut.flagProfilesByRange = self.dataIn.flagProfilesByRange | ||
|
149 | self.dataOut.nProfilesByRange = self.dataIn.nProfilesByRange | |||
149 |
|
150 | |||
150 | self.dataOut.deltaHeight = self.dataIn.deltaHeight |
|
151 | self.dataOut.deltaHeight = self.dataIn.deltaHeight | |
151 | self.dataOut.abscissaList = self.dataIn.getVelRange(1) |
|
152 | self.dataOut.abscissaList = self.dataIn.getVelRange(1) |
@@ -76,6 +76,8 class SpectraProc(ProcessingUnit): | |||||
76 | self.dataOut.elevationList = self.dataIn.elevationList |
|
76 | self.dataOut.elevationList = self.dataIn.elevationList | |
77 | self.dataOut.code = self.dataIn.code |
|
77 | self.dataOut.code = self.dataIn.code | |
78 | self.dataOut.nCode = self.dataIn.nCode |
|
78 | self.dataOut.nCode = self.dataIn.nCode | |
|
79 | self.dataOut.flagProfilesByRange = self.dataIn.flagProfilesByRange | |||
|
80 | self.dataOut.nProfilesByRange = self.dataIn.nProfilesByRange | |||
79 |
|
81 | |||
80 |
|
82 | |||
81 | def __getFft(self): |
|
83 | def __getFft(self): | |
@@ -1305,6 +1307,9 class IntegrationFaradaySpectra(Operation): | |||||
1305 | factor = 0.0 |
|
1307 | factor = 0.0 | |
1306 | dataoutliers = None # (CHANNELS, HEIGHTS) |
|
1308 | dataoutliers = None # (CHANNELS, HEIGHTS) | |
1307 |
|
1309 | |||
|
1310 | _flagProfilesByRange = False | |||
|
1311 | _nProfilesByRange = 0 | |||
|
1312 | ||||
1308 | def __init__(self): |
|
1313 | def __init__(self): | |
1309 |
|
1314 | |||
1310 | Operation.__init__(self) |
|
1315 | Operation.__init__(self) | |
@@ -1631,7 +1636,10 class IntegrationFaradaySpectra(Operation): | |||||
1631 | if n == 1: |
|
1636 | if n == 1: | |
1632 | return self.dataOut |
|
1637 | return self.dataOut | |
1633 | self.dataOut.processingHeaderObj.timeIncohInt = timeInterval |
|
1638 | self.dataOut.processingHeaderObj.timeIncohInt = timeInterval | |
1634 | #print("nchannels", self.dataOut.nChannels) |
|
1639 | ||
|
1640 | if dataOut.flagProfilesByRange == True: | |||
|
1641 | self._flagProfilesByRange = True | |||
|
1642 | ||||
1635 | if self.dataOut.nChannels == 1: |
|
1643 | if self.dataOut.nChannels == 1: | |
1636 | self.dataOut.data_cspc = None #si es un solo canal no vale la pena acumular DATOS |
|
1644 | self.dataOut.data_cspc = None #si es un solo canal no vale la pena acumular DATOS | |
1637 | #print("IN spc:", self.dataOut.data_spc.shape, self.dataOut.data_cspc) |
|
1645 | #print("IN spc:", self.dataOut.data_spc.shape, self.dataOut.data_cspc) | |
@@ -1656,6 +1664,11 class IntegrationFaradaySpectra(Operation): | |||||
1656 | self.dataOut.dataLag_cspc, |
|
1664 | self.dataOut.dataLag_cspc, | |
1657 | self.dataOut.dataLag_dc) |
|
1665 | self.dataOut.dataLag_dc) | |
1658 | self.dataOut.flagNoData = True |
|
1666 | self.dataOut.flagNoData = True | |
|
1667 | ||||
|
1668 | if self._flagProfilesByRange: | |||
|
1669 | dataOut.flagProfilesByRange = True | |||
|
1670 | self._nProfilesByRange += dataOut.nProfilesByRange | |||
|
1671 | ||||
1659 | if self.__dataReady: |
|
1672 | if self.__dataReady: | |
1660 |
|
1673 | |||
1661 | if not self.ByLags: |
|
1674 | if not self.ByLags: | |
@@ -1668,6 +1681,7 class IntegrationFaradaySpectra(Operation): | |||||
1668 | self.dataOut.data_cspc = numpy.squeeze(avgdata_cspc) |
|
1681 | self.dataOut.data_cspc = numpy.squeeze(avgdata_cspc) | |
1669 | self.dataOut.data_dc = avgdata_dc |
|
1682 | self.dataOut.data_dc = avgdata_dc | |
1670 | self.dataOut.data_outlier = self.dataOutliers |
|
1683 | self.dataOut.data_outlier = self.dataOutliers | |
|
1684 | ||||
1671 |
|
1685 | |||
1672 | else: |
|
1686 | else: | |
1673 | self.dataOut.dataLag_spc = avgdata_spc |
|
1687 | self.dataOut.dataLag_spc = avgdata_spc | |
@@ -1684,6 +1698,10 class IntegrationFaradaySpectra(Operation): | |||||
1684 |
|
1698 | |||
1685 | self.dataOut.utctime = avgdatatime |
|
1699 | self.dataOut.utctime = avgdatatime | |
1686 | self.dataOut.flagNoData = False |
|
1700 | self.dataOut.flagNoData = False | |
|
1701 | ||||
|
1702 | dataOut.nProfilesByRange = self._nProfilesByRange | |||
|
1703 | self._nProfilesByRange = 0 | |||
|
1704 | self._flagProfilesByRange = False | |||
1687 |
|
1705 | |||
1688 | # #update Processing Header: |
|
1706 | # #update Processing Header: | |
1689 | # self.dataOut.processingHeaderObj.nIncohInt = |
|
1707 | # self.dataOut.processingHeaderObj.nIncohInt = | |
@@ -1996,7 +2014,9 class IncohInt(Operation): | |||||
1996 | incohInt = 0 |
|
2014 | incohInt = 0 | |
1997 | nOutliers = 0 |
|
2015 | nOutliers = 0 | |
1998 | n = None |
|
2016 | n = None | |
1999 |
|
2017 | |||
|
2018 | _flagProfilesByRange = False | |||
|
2019 | _nProfilesByRange = 0 | |||
2000 | def __init__(self): |
|
2020 | def __init__(self): | |
2001 |
|
2021 | |||
2002 | Operation.__init__(self) |
|
2022 | Operation.__init__(self) | |
@@ -2139,6 +2159,9 class IncohInt(Operation): | |||||
2139 | if dataOut.flagNoData == True: |
|
2159 | if dataOut.flagNoData == True: | |
2140 | return dataOut |
|
2160 | return dataOut | |
2141 |
|
2161 | |||
|
2162 | if dataOut.flagProfilesByRange == True: | |||
|
2163 | self._flagProfilesByRange = True | |||
|
2164 | ||||
2142 | dataOut.flagNoData = True |
|
2165 | dataOut.flagNoData = True | |
2143 | dataOut.processingHeaderObj.timeIncohInt = timeInterval |
|
2166 | dataOut.processingHeaderObj.timeIncohInt = timeInterval | |
2144 | if not self.isConfig: |
|
2167 | if not self.isConfig: | |
@@ -2152,10 +2175,15 class IncohInt(Operation): | |||||
2152 | dataOut.data_dc) |
|
2175 | dataOut.data_dc) | |
2153 |
|
2176 | |||
2154 | self.incohInt += dataOut.nIncohInt |
|
2177 | self.incohInt += dataOut.nIncohInt | |
|
2178 | ||||
2155 |
|
2179 | |||
2156 | if isinstance(dataOut.data_outlier,numpy.ndarray) or isinstance(dataOut.data_outlier,int) or isinstance(dataOut.data_outlier, float): |
|
2180 | if isinstance(dataOut.data_outlier,numpy.ndarray) or isinstance(dataOut.data_outlier,int) or isinstance(dataOut.data_outlier, float): | |
2157 | self.nOutliers += dataOut.data_outlier |
|
2181 | self.nOutliers += dataOut.data_outlier | |
2158 |
|
2182 | |||
|
2183 | if self._flagProfilesByRange: | |||
|
2184 | dataOut.flagProfilesByRange = True | |||
|
2185 | self._nProfilesByRange += dataOut.nProfilesByRange | |||
|
2186 | ||||
2159 | if self.__dataReady: |
|
2187 | if self.__dataReady: | |
2160 | #print("prof: ",dataOut.max_nIncohInt,self.__profIndex) |
|
2188 | #print("prof: ",dataOut.max_nIncohInt,self.__profIndex) | |
2161 | dataOut.data_spc = avgdata_spc |
|
2189 | dataOut.data_spc = avgdata_spc | |
@@ -2168,6 +2196,9 class IncohInt(Operation): | |||||
2168 | self.incohInt = 0 |
|
2196 | self.incohInt = 0 | |
2169 | self.nOutliers = 0 |
|
2197 | self.nOutliers = 0 | |
2170 | self.__profIndex = 0 |
|
2198 | self.__profIndex = 0 | |
|
2199 | dataOut.nProfilesByRange = self._nProfilesByRange | |||
|
2200 | self._nProfilesByRange = 0 | |||
|
2201 | self._flagProfilesByRange = False | |||
2171 | #print("IncohInt Done") |
|
2202 | #print("IncohInt Done") | |
2172 | return dataOut |
|
2203 | return dataOut | |
2173 |
|
2204 |
@@ -45,8 +45,7 class VoltageProc(ProcessingUnit): | |||||
45 | self.dataOut.processingHeaderObj.codeList = self.dataOut.nChannels |
|
45 | self.dataOut.processingHeaderObj.codeList = self.dataOut.nChannels | |
46 | self.dataOut.processingHeaderObj.heightList = self.dataOut.heightList |
|
46 | self.dataOut.processingHeaderObj.heightList = self.dataOut.heightList | |
47 | self.dataOut.processingHeaderObj.heightResolution = self.dataOut.heightList[1] - self.dataOut.heightList[0] |
|
47 | self.dataOut.processingHeaderObj.heightResolution = self.dataOut.heightList[1] - self.dataOut.heightList[0] | |
48 |
|
48 | |||
49 |
|
||||
50 |
|
49 | |||
51 |
|
50 | |||
52 | def __updateObjFromAmisrInput(self): |
|
51 | def __updateObjFromAmisrInput(self): | |
@@ -2018,7 +2017,17 class SSheightProfiles2(Operation): | |||||
2018 | dataOut.processingHeaderObj.ipp = ippSeconds |
|
2017 | dataOut.processingHeaderObj.ipp = ippSeconds | |
2019 | dataOut.processingHeaderObj.heightResolution = dataOut.deltaHeight |
|
2018 | dataOut.processingHeaderObj.heightResolution = dataOut.deltaHeight | |
2020 | #dataOut.processingHeaderObj.profilesPerBlock = nProfiles |
|
2019 | #dataOut.processingHeaderObj.profilesPerBlock = nProfiles | |
2021 |
|
2020 | |||
|
2021 | # # dataOut.data = CH, PROFILES, HEIGHTS | |||
|
2022 | #print(dataOut.data .shape) | |||
|
2023 | if dataOut.flagProfilesByRange: | |||
|
2024 | # #assuming the same remotion for all channels | |||
|
2025 | aux = [ self.nsamples - numpy.count_nonzero(dataOut.data[0, :, h]==0) for h in range(len(dataOut.heightList))] | |||
|
2026 | dataOut.nProfilesByRange = numpy.asarray(aux) | |||
|
2027 | #print(dataOut.nProfilesByRange) | |||
|
2028 | else: | |||
|
2029 | dataOut.nProfilesByRange = numpy.ones(len(dataOut.heightList))*dataOut.nProfiles | |||
|
2030 | print(dataOut.nProfilesByRange) | |||
2022 | return dataOut |
|
2031 | return dataOut | |
2023 |
|
2032 | |||
2024 |
|
2033 | |||
@@ -2766,9 +2775,9 class removeProfileByFaradayHS(Operation): | |||||
2766 |
|
2775 | |||
2767 | if self.__profIndex == self.n: |
|
2776 | if self.__profIndex == self.n: | |
2768 | #print("apnd : ",data) |
|
2777 | #print("apnd : ",data) | |
2769 |
|
|
2778 | dataBlock = self.cleanOutliersByBlock() | |
2770 | #dataBlock = self.cleanSpikesFFT2D() |
|
2779 | #dataBlock = self.cleanSpikesFFT2D() | |
2771 | dataBlock = self.filterSatsProfiles2() |
|
2780 | #dataBlock = self.filterSatsProfiles2() | |
2772 | self.__dataReady = True |
|
2781 | self.__dataReady = True | |
2773 |
|
2782 | |||
2774 | return dataBlock |
|
2783 | return dataBlock | |
@@ -3566,3 +3575,83 class RemoveProfileSats2(Operation): | |||||
3566 | #print(self.__count_exec) |
|
3575 | #print(self.__count_exec) | |
3567 |
|
3576 | |||
3568 | return dataOut |
|
3577 | return dataOut | |
|
3578 | ||||
|
3579 | ||||
|
3580 | ||||
|
3581 | ||||
|
3582 | class remHeightsIppInterf(Operation): | |||
|
3583 | ||||
|
3584 | def __init__(self): | |||
|
3585 | ||||
|
3586 | self.config = False | |||
|
3587 | ||||
|
3588 | self.heights_indx = None | |||
|
3589 | self.heightsList = [] | |||
|
3590 | ||||
|
3591 | self.ipp1 = None | |||
|
3592 | self.ipp2 = None | |||
|
3593 | self.tx1 = None | |||
|
3594 | self.tx2 = None | |||
|
3595 | self.dh1 = None | |||
|
3596 | ||||
|
3597 | ||||
|
3598 | def setup(self, dataOut, ipp1=None, ipp2=None, tx1=None, tx2=None, dh1=None, | |||
|
3599 | idate=None, startH=None, endH=None): | |||
|
3600 | ||||
|
3601 | ||||
|
3602 | self.ipp1 = ipp1 | |||
|
3603 | self.ipp2 = ipp2 | |||
|
3604 | self.tx1 = tx1 | |||
|
3605 | self.tx2 = tx2 | |||
|
3606 | self.dh1 = dh1 | |||
|
3607 | ||||
|
3608 | _maxIpp1R = dataOut.heightList.max() | |||
|
3609 | ||||
|
3610 | _n_repeats = int(_maxIpp1R / ipp2) | |||
|
3611 | _init_hIntf = (tx1 + ipp2/2)+ dh1 | |||
|
3612 | _n_hIntf = int(tx2 / dh1) | |||
|
3613 | ||||
|
3614 | self.heightsList = [_init_hIntf+n*ipp2 for n in range(_n_repeats) ] | |||
|
3615 | heiList = dataOut.heightList | |||
|
3616 | self.heights_indx = [getHei_index(h,h,heiList)[0] for h in self.heightsList] | |||
|
3617 | ||||
|
3618 | self.heights_indx = [ numpy.asarray([k for k in range(_n_hIntf+2)])+(getHei_index(h,h,heiList)[0] -1) for h in self.heightsList] | |||
|
3619 | ||||
|
3620 | self.heights_indx = numpy.asarray(self.heights_indx ) | |||
|
3621 | self.config = True | |||
|
3622 | self.startTime = datetime.datetime.combine(idate,startH) | |||
|
3623 | self.endTime = datetime.datetime.combine(idate,endH) | |||
|
3624 | #print(self.startTime, self.endTime) | |||
|
3625 | #print("nrepeats: ", _n_repeats, " _nH: ",_n_hIntf ) | |||
|
3626 | #print("H interf:",self.heightsList, dataOut.heightList[self.heights_indx] ) | |||
|
3627 | ||||
|
3628 | def run(self, dataOut, ipp1=None, ipp2=None, tx1=None, tx2=None, dh1=None, idate=None, | |||
|
3629 | startH=None, endH=None): | |||
|
3630 | #print(locals().values()) | |||
|
3631 | if None in locals().values(): | |||
|
3632 | log.warning('Missing kwargs, invalid values """None""" ', self.name) | |||
|
3633 | return dataOut | |||
|
3634 | ||||
|
3635 | ||||
|
3636 | if not self.config: | |||
|
3637 | self.setup(dataOut, ipp1=ipp1, ipp2=ipp2, tx1=tx1, tx2=tx2, dh1=dh1, | |||
|
3638 | idate=idate, startH=startH, endH=endH) | |||
|
3639 | ||||
|
3640 | flagProfilesByRange = False | |||
|
3641 | currentTime = datetime.datetime.fromtimestamp(dataOut.utctime) | |||
|
3642 | ||||
|
3643 | if currentTime < self.startTime or currentTime > self.endTime: | |||
|
3644 | return dataOut | |||
|
3645 | ||||
|
3646 | ||||
|
3647 | for ch in range(dataOut.data.shape[0]): | |||
|
3648 | ||||
|
3649 | for hk in self.heights_indx.flatten(): | |||
|
3650 | if dataOut.data.ndim < 3: | |||
|
3651 | dataOut.data[ch,hk] = 0 + 0j | |||
|
3652 | else: | |||
|
3653 | dataOut.data[ch,:,hk] = 0 + 0j | |||
|
3654 | ||||
|
3655 | dataOut.flagProfilesByRange = True | |||
|
3656 | ||||
|
3657 | return dataOut No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now