@@ -599,7 +599,7 class Spectra(JROData): | |||||
599 | normFactor = self.nProfiles * self.nIncohInt * self.nCohInt * pwcode * self.windowOfFilter |
|
599 | normFactor = self.nProfiles * self.nIncohInt * self.nCohInt * pwcode * self.windowOfFilter | |
600 | if self.flagProfilesByRange: |
|
600 | if self.flagProfilesByRange: | |
601 | normFactor *= (self.nProfilesByRange/self.nProfilesByRange.max()) |
|
601 | normFactor *= (self.nProfilesByRange/self.nProfilesByRange.max()) | |
602 |
|
602 | #print("normFactor: ", normFactor) | ||
603 | return normFactor |
|
603 | return normFactor | |
604 |
|
604 | |||
605 | @property |
|
605 | @property |
@@ -1062,7 +1062,7 class NoiselessRTIPlot(RTIPlot): | |||||
1062 | data = {} |
|
1062 | data = {} | |
1063 | meta = {} |
|
1063 | meta = {} | |
1064 | #print(dataOut.max_nIncohInt, dataOut.nIncohInt) |
|
1064 | #print(dataOut.max_nIncohInt, dataOut.nIncohInt) | |
1065 |
#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 | |
1066 | norm = dataOut.nProfiles * dataOut.max_nIncohInt * dataOut.nCohInt * dataOut.windowOfFilter |
|
1066 | norm = dataOut.nProfiles * dataOut.max_nIncohInt * dataOut.nCohInt * dataOut.windowOfFilter | |
1067 | n0 = 10*numpy.log10(dataOut.getNoise()/norm) |
|
1067 | n0 = 10*numpy.log10(dataOut.getNoise()/norm) | |
1068 | data['noise'] = n0 |
|
1068 | data['noise'] = n0 | |
@@ -1342,20 +1342,19 class NoiselessRTILinePlot(Plot): | |||||
1342 | #print(dataOut.windowOfFilter,dataOut.nCohInt,dataOut.nProfiles,dataOut.max_nIncohInt,dataOut.nIncohInt) |
|
1342 | #print(dataOut.windowOfFilter,dataOut.nCohInt,dataOut.nProfiles,dataOut.max_nIncohInt,dataOut.nIncohInt) | |
1343 | norm = dataOut.nProfiles * dataOut.max_nIncohInt * dataOut.nCohInt * dataOut.windowOfFilter |
|
1343 | norm = dataOut.nProfiles * dataOut.max_nIncohInt * dataOut.nCohInt * dataOut.windowOfFilter | |
1344 |
|
1344 | |||
1345 |
|
||||
1346 | n0 = 10*numpy.log10(dataOut.getNoise()/norm) |
|
1345 | n0 = 10*numpy.log10(dataOut.getNoise()/norm) | |
1347 | data['noise'] = n0 |
|
1346 | data['noise'] = n0 | |
1348 |
|
1347 | |||
1349 | noise = numpy.repeat(n0,dataOut.nHeights).reshape(dataOut.nChannels,dataOut.nHeights) |
|
1348 | noise = numpy.repeat(n0,dataOut.nHeights).reshape(dataOut.nChannels,dataOut.nHeights) | |
1350 | noiseless_data = dataOut.getPower() - noise |
|
1349 | noiseless_data = dataOut.getPower() - noise | |
1351 |
|
1350 | |||
1352 | #print("power, noise:", dataOut.getPower(), n0) |
|
1351 | #print("power, noise:", dataOut.getPower(), n0) | |
1353 | #print(noise) |
|
1352 | #print(noise) | |
1354 | #print(noiseless_data) |
|
1353 | #print(noiseless_data) | |
1355 |
|
1354 | |||
1356 | data['noiseless_rtiLine'] = noiseless_data |
|
1355 | data['noiseless_rtiLine'] = noiseless_data | |
1357 |
|
1356 | |||
1358 | print(noiseless_data.shape, self.name) |
|
1357 | #print(noiseless_data.shape, self.name) | |
1359 | data['time'] = dataOut.utctime |
|
1358 | data['time'] = dataOut.utctime | |
1360 |
|
1359 | |||
1361 | return data, meta |
|
1360 | return data, meta | |
@@ -1364,7 +1363,7 class NoiselessRTILinePlot(Plot): | |||||
1364 |
|
1363 | |||
1365 | self.x = self.data.times |
|
1364 | self.x = self.data.times | |
1366 | self.y = self.data.yrange |
|
1365 | self.y = self.data.yrange | |
1367 | print(self.data['noiseless_rtiLine'].shape, self.y.shape, self.name) |
|
1366 | #print(self.data['noiseless_rtiLine'].shape, self.y.shape, self.name) | |
1368 | #ts = self.data['time'][0].squeeze() |
|
1367 | #ts = self.data['time'][0].squeeze() | |
1369 | if len(self.data['noiseless_rtiLine'])>2 : |
|
1368 | if len(self.data['noiseless_rtiLine'])>2 : | |
1370 | self.z = self.data['noiseless_rtiLine'][:, -1,:] |
|
1369 | self.z = self.data['noiseless_rtiLine'][:, -1,:] | |
@@ -1435,7 +1434,7 class GeneralProfilePlot(Plot): | |||||
1435 |
|
1434 | |||
1436 | data['noiseless_rtiLine'] = noiseless_data |
|
1435 | data['noiseless_rtiLine'] = noiseless_data | |
1437 |
|
1436 | |||
1438 | print(noiseless_data.shape, self.name) |
|
1437 | #print(noiseless_data.shape, self.name) | |
1439 | data['time'] = dataOut.utctime |
|
1438 | data['time'] = dataOut.utctime | |
1440 |
|
1439 | |||
1441 | return data, meta |
|
1440 | return data, meta | |
@@ -1444,7 +1443,7 class GeneralProfilePlot(Plot): | |||||
1444 |
|
1443 | |||
1445 | self.x = self.data.times |
|
1444 | self.x = self.data.times | |
1446 | self.y = self.data.yrange |
|
1445 | self.y = self.data.yrange | |
1447 | print(self.data['noiseless_rtiLine'].shape, self.y.shape, self.name) |
|
1446 | #print(self.data['noiseless_rtiLine'].shape, self.y.shape, self.name) | |
1448 | #ts = self.data['time'][0].squeeze() |
|
1447 | #ts = self.data['time'][0].squeeze() | |
1449 | if len(self.data['noiseless_rtiLine'])>2 : |
|
1448 | if len(self.data['noiseless_rtiLine'])>2 : | |
1450 | self.z = self.data['noiseless_rtiLine'][:, -1,:] |
|
1449 | self.z = self.data['noiseless_rtiLine'][:, -1,:] |
@@ -727,6 +727,7 class getNoiseB(Operation): | |||||
727 | norm = 1 |
|
727 | norm = 1 | |
728 | else: |
|
728 | else: | |
729 | norm = self.dataOut.max_nIncohInt[channel]/self.dataOut.nIncohInt[channel, self.minIndex:self.maxIndex] |
|
729 | norm = self.dataOut.max_nIncohInt[channel]/self.dataOut.nIncohInt[channel, self.minIndex:self.maxIndex] | |
|
730 | ||||
730 | #print("norm nIncoh: ", norm ,self.dataOut.data_spc.shape, self.dataOut.max_nIncohInt) |
|
731 | #print("norm nIncoh: ", norm ,self.dataOut.data_spc.shape, self.dataOut.max_nIncohInt) | |
731 | daux = self.dataOut.data_spc[channel,self.minIndexFFT:self.maxIndexFFT, self.minIndex:self.maxIndex] |
|
732 | daux = self.dataOut.data_spc[channel,self.minIndexFFT:self.maxIndexFFT, self.minIndex:self.maxIndex] | |
732 | daux = numpy.multiply(daux, norm) |
|
733 | daux = numpy.multiply(daux, norm) | |
@@ -742,11 +743,12 class getNoiseB(Operation): | |||||
742 | #noise = self.dataOut.getNoise(xmin_index=self.minIndexFFT, xmax_index=self.maxIndexFFT, ymin_index=self.minIndex, ymax_index=self.maxIndex) |
|
743 | #noise = self.dataOut.getNoise(xmin_index=self.minIndexFFT, xmax_index=self.maxIndexFFT, ymin_index=self.minIndex, ymax_index=self.maxIndex) | |
743 | else: |
|
744 | else: | |
744 | noise = self.dataOut.getNoise(xmin_index=self.minIndexFFT, xmax_index=self.maxIndexFFT, ymin_index=self.minIndex, ymax_index=self.maxIndex) |
|
745 | noise = self.dataOut.getNoise(xmin_index=self.minIndexFFT, xmax_index=self.maxIndexFFT, ymin_index=self.minIndex, ymax_index=self.maxIndex) | |
|
746 | ||||
745 | self.dataOut.noise_estimation = noise.copy() # dataOut.noise |
|
747 | self.dataOut.noise_estimation = noise.copy() # dataOut.noise | |
746 | #print("2: ",10*numpy.log10(self.dataOut.noise_estimation/64)) |
|
748 | #print("2: ",10*numpy.log10(self.dataOut.noise_estimation/64)) | |
747 | #print("2: ",self.dataOut.noise_estimation) |
|
749 | #print("2: ",self.dataOut.noise_estimation) | |
748 | #print(self.dataOut.flagNoData) |
|
750 | #print(self.dataOut.flagNoData) | |
749 | #print("getNoise Done", noise, self.dataOut.nProfiles ,self.dataOut.ippFactor) |
|
751 | #print("getNoise Done", 10*numpy.log10(noise)) | |
750 | return self.dataOut |
|
752 | return self.dataOut | |
751 |
|
753 | |||
752 | def getNoiseByMean(self,data): |
|
754 | def getNoiseByMean(self,data): | |
@@ -1381,7 +1383,6 class IntegrationFaradaySpectra(Operation): | |||||
1381 | self.minHei_ind = ind_list1[0][0] |
|
1383 | self.minHei_ind = ind_list1[0][0] | |
1382 | self.maxHei_ind = ind_list2[0][-1] |
|
1384 | self.maxHei_ind = ind_list2[0][-1] | |
1383 |
|
1385 | |||
1384 |
|
||||
1385 | def putData(self, data_spc, data_cspc, data_dc): |
|
1386 | def putData(self, data_spc, data_cspc, data_dc): | |
1386 | """ |
|
1387 | """ | |
1387 | Add a profile to the __buffer_spc and increase in one the __profileIndex |
|
1388 | Add a profile to the __buffer_spc and increase in one the __profileIndex | |
@@ -1637,7 +1638,7 class IntegrationFaradaySpectra(Operation): | |||||
1637 | return self.dataOut |
|
1638 | return self.dataOut | |
1638 | self.dataOut.processingHeaderObj.timeIncohInt = timeInterval |
|
1639 | self.dataOut.processingHeaderObj.timeIncohInt = timeInterval | |
1639 |
|
1640 | |||
1640 |
if dataOut.flagProfilesByRange |
|
1641 | if dataOut.flagProfilesByRange: | |
1641 | self._flagProfilesByRange = True |
|
1642 | self._flagProfilesByRange = True | |
1642 |
|
1643 | |||
1643 | if self.dataOut.nChannels == 1: |
|
1644 | if self.dataOut.nChannels == 1: | |
@@ -1700,7 +1701,7 class IntegrationFaradaySpectra(Operation): | |||||
1700 | self.dataOut.flagNoData = False |
|
1701 | self.dataOut.flagNoData = False | |
1701 |
|
1702 | |||
1702 | dataOut.nProfilesByRange = self._nProfilesByRange |
|
1703 | dataOut.nProfilesByRange = self._nProfilesByRange | |
1703 |
self._nProfilesByRange = |
|
1704 | self._nProfilesByRange = numpy.zeros(len(dataOut.heightList)) | |
1704 | self._flagProfilesByRange = False |
|
1705 | self._flagProfilesByRange = False | |
1705 |
|
1706 | |||
1706 | # #update Processing Header: |
|
1707 | # #update Processing Header: | |
@@ -1849,7 +1850,7 class removeInterference(Operation): | |||||
1849 | power = power[:, hei_interf] |
|
1850 | power = power[:, hei_interf] | |
1850 | power = power.sum(axis=0) |
|
1851 | power = power.sum(axis=0) | |
1851 | psort = power.ravel().argsort() |
|
1852 | psort = power.ravel().argsort() | |
1852 | print(hei_interf[psort[list(range(offhei_interf, nhei_interf + offhei_interf))]]) |
|
1853 | #print(hei_interf[psort[list(range(offhei_interf, nhei_interf + offhei_interf))]]) | |
1853 | # Se estima la interferencia promedio en los Espectros de Potencia empleando |
|
1854 | # Se estima la interferencia promedio en los Espectros de Potencia empleando | |
1854 | junkspc_interf = jspectra[ich, :, hei_interf[psort[list(range( |
|
1855 | junkspc_interf = jspectra[ich, :, hei_interf[psort[list(range( | |
1855 | offhei_interf, nhei_interf + offhei_interf))]]] |
|
1856 | offhei_interf, nhei_interf + offhei_interf))]]] | |
@@ -1859,7 +1860,7 class removeInterference(Operation): | |||||
1859 | tmp_noise = jnoise[ich] |
|
1860 | tmp_noise = jnoise[ich] | |
1860 | junkspc_interf = junkspc_interf - tmp_noise |
|
1861 | junkspc_interf = junkspc_interf - tmp_noise | |
1861 | #junkspc_interf[:,comp_mask_prof] = 0 |
|
1862 | #junkspc_interf[:,comp_mask_prof] = 0 | |
1862 | print(junkspc_interf.shape) |
|
1863 | #print(junkspc_interf.shape) | |
1863 | jspc_interf = junkspc_interf.sum(axis=0) / nhei_interf |
|
1864 | jspc_interf = junkspc_interf.sum(axis=0) / nhei_interf | |
1864 | jspc_interf = jspc_interf.transpose() |
|
1865 | jspc_interf = jspc_interf.transpose() | |
1865 | # Calculando el espectro de interferencia promedio |
|
1866 | # Calculando el espectro de interferencia promedio | |
@@ -1892,7 +1893,7 class removeInterference(Operation): | |||||
1892 | # Removiendo la interferencia del punto de mayor interferencia |
|
1893 | # Removiendo la interferencia del punto de mayor interferencia | |
1893 | ListAux = jspc_interf[mask_prof].tolist() |
|
1894 | ListAux = jspc_interf[mask_prof].tolist() | |
1894 | maxid = ListAux.index(max(ListAux)) |
|
1895 | maxid = ListAux.index(max(ListAux)) | |
1895 | print(cinterfid) |
|
1896 | #print(cinterfid) | |
1896 | if cinterfid > 0: |
|
1897 | if cinterfid > 0: | |
1897 | for ip in range(cinterfid * (interf == 2) - 1): |
|
1898 | for ip in range(cinterfid * (interf == 2) - 1): | |
1898 | ind = (jspectra[ich, interfid[ip], :] < tmp_noise * |
|
1899 | ind = (jspectra[ich, interfid[ip], :] < tmp_noise * | |
@@ -1917,7 +1918,7 class removeInterference(Operation): | |||||
1917 |
|
1918 | |||
1918 | indAux = (jspectra[ich, :, :] < tmp_noise * |
|
1919 | indAux = (jspectra[ich, :, :] < tmp_noise * | |
1919 | (1 - 1 / numpy.sqrt(num_incoh))).nonzero() |
|
1920 | (1 - 1 / numpy.sqrt(num_incoh))).nonzero() | |
1920 | print(indAux) |
|
1921 | #print(indAux) | |
1921 | jspectra[ich, indAux[0], indAux[1]] = tmp_noise * \ |
|
1922 | jspectra[ich, indAux[0], indAux[1]] = tmp_noise * \ | |
1922 | (1 - 1 / numpy.sqrt(num_incoh)) |
|
1923 | (1 - 1 / numpy.sqrt(num_incoh)) | |
1923 |
|
1924 | |||
@@ -2056,6 +2057,7 class IncohInt(Operation): | |||||
2056 | self.n = None |
|
2057 | self.n = None | |
2057 | self.__byTime = True |
|
2058 | self.__byTime = True | |
2058 |
|
2059 | |||
|
2060 | ||||
2059 |
|
2061 | |||
2060 | def putData(self, data_spc, data_cspc, data_dc): |
|
2062 | def putData(self, data_spc, data_cspc, data_dc): | |
2061 | """ |
|
2063 | """ | |
@@ -2165,6 +2167,7 class IncohInt(Operation): | |||||
2165 | dataOut.flagNoData = True |
|
2167 | dataOut.flagNoData = True | |
2166 | dataOut.processingHeaderObj.timeIncohInt = timeInterval |
|
2168 | dataOut.processingHeaderObj.timeIncohInt = timeInterval | |
2167 | if not self.isConfig: |
|
2169 | if not self.isConfig: | |
|
2170 | self._nProfilesByRange = numpy.zeros(len(dataOut.heightList)) | |||
2168 | self.setup(n, timeInterval, overlapping) |
|
2171 | self.setup(n, timeInterval, overlapping) | |
2169 | self.isConfig = True |
|
2172 | self.isConfig = True | |
2170 |
|
2173 | |||
@@ -2197,7 +2200,7 class IncohInt(Operation): | |||||
2197 | self.nOutliers = 0 |
|
2200 | self.nOutliers = 0 | |
2198 | self.__profIndex = 0 |
|
2201 | self.__profIndex = 0 | |
2199 | dataOut.nProfilesByRange = self._nProfilesByRange |
|
2202 | dataOut.nProfilesByRange = self._nProfilesByRange | |
2200 |
self._nProfilesByRange = |
|
2203 | self._nProfilesByRange = numpy.zeros(len(dataOut.heightList)) | |
2201 | self._flagProfilesByRange = False |
|
2204 | self._flagProfilesByRange = False | |
2202 | #print("IncohInt Done") |
|
2205 | #print("IncohInt Done") | |
2203 | return dataOut |
|
2206 | return dataOut |
@@ -2024,10 +2024,8 class SSheightProfiles2(Operation): | |||||
2024 | # #assuming the same remotion for all channels |
|
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))] |
|
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) |
|
2026 | dataOut.nProfilesByRange = numpy.asarray(aux) | |
2027 | #print(dataOut.nProfilesByRange) |
|
|||
2028 | else: |
|
2027 | else: | |
2029 | dataOut.nProfilesByRange = numpy.ones(len(dataOut.heightList))*dataOut.nProfiles |
|
2028 | dataOut.nProfilesByRange = numpy.ones(len(dataOut.heightList))*dataOut.nProfiles | |
2030 | print(dataOut.nProfilesByRange) |
|
|||
2031 | return dataOut |
|
2029 | return dataOut | |
2032 |
|
2030 | |||
2033 |
|
2031 | |||
@@ -3581,9 +3579,12 class RemoveProfileSats2(Operation): | |||||
3581 |
|
3579 | |||
3582 | class remHeightsIppInterf(Operation): |
|
3580 | class remHeightsIppInterf(Operation): | |
3583 |
|
3581 | |||
3584 | def __init__(self): |
|
3582 | def __init__(self, **kwargs): | |
|
3583 | ||||
3585 |
|
3584 | |||
3586 | self.config = False |
|
3585 | Operation.__init__(self, **kwargs) | |
|
3586 | ||||
|
3587 | self.isConfig = False | |||
3587 |
|
3588 | |||
3588 | self.heights_indx = None |
|
3589 | self.heights_indx = None | |
3589 | self.heightsList = [] |
|
3590 | self.heightsList = [] | |
@@ -3618,12 +3619,15 class remHeightsIppInterf(Operation): | |||||
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 | 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 | |||
3620 | self.heights_indx = numpy.asarray(self.heights_indx ) |
|
3621 | self.heights_indx = numpy.asarray(self.heights_indx ) | |
3621 |
self. |
|
3622 | self.isConfig = True | |
3622 | self.startTime = datetime.datetime.combine(idate,startH) |
|
3623 | self.startTime = datetime.datetime.combine(idate,startH) | |
3623 | self.endTime = datetime.datetime.combine(idate,endH) |
|
3624 | self.endTime = datetime.datetime.combine(idate,endH) | |
3624 | #print(self.startTime, self.endTime) |
|
3625 | #print(self.startTime, self.endTime) | |
3625 | #print("nrepeats: ", _n_repeats, " _nH: ",_n_hIntf ) |
|
3626 | #print("nrepeats: ", _n_repeats, " _nH: ",_n_hIntf ) | |
3626 | #print("H interf:",self.heightsList, dataOut.heightList[self.heights_indx] ) |
|
3627 | ||
|
3628 | log.warning("Heights set to zero (km): ", self.name) | |||
|
3629 | log.warning(str((dataOut.heightList[self.heights_indx].flatten())), self.name) | |||
|
3630 | log.warning("Be careful with the selection of heights for noise calculation!") | |||
3627 |
|
3631 | |||
3628 | def run(self, dataOut, ipp1=None, ipp2=None, tx1=None, tx2=None, dh1=None, idate=None, |
|
3632 | def run(self, dataOut, ipp1=None, ipp2=None, tx1=None, tx2=None, dh1=None, idate=None, | |
3629 | startH=None, endH=None): |
|
3633 | startH=None, endH=None): | |
@@ -3633,17 +3637,16 class remHeightsIppInterf(Operation): | |||||
3633 | return dataOut |
|
3637 | return dataOut | |
3634 |
|
3638 | |||
3635 |
|
3639 | |||
3636 |
if not self. |
|
3640 | if not self.isConfig: | |
3637 | self.setup(dataOut, ipp1=ipp1, ipp2=ipp2, tx1=tx1, tx2=tx2, dh1=dh1, |
|
3641 | self.setup(dataOut, ipp1=ipp1, ipp2=ipp2, tx1=tx1, tx2=tx2, dh1=dh1, | |
3638 | idate=idate, startH=startH, endH=endH) |
|
3642 | idate=idate, startH=startH, endH=endH) | |
3639 |
|
3643 | |||
3640 | flagProfilesByRange = False |
|
3644 | dataOut.flagProfilesByRange = False | |
3641 | currentTime = datetime.datetime.fromtimestamp(dataOut.utctime) |
|
3645 | currentTime = datetime.datetime.fromtimestamp(dataOut.utctime) | |
3642 |
|
3646 | |||
3643 | if currentTime < self.startTime or currentTime > self.endTime: |
|
3647 | if currentTime < self.startTime or currentTime > self.endTime: | |
3644 | return dataOut |
|
3648 | return dataOut | |
3645 |
|
3649 | |||
3646 |
|
||||
3647 | for ch in range(dataOut.data.shape[0]): |
|
3650 | for ch in range(dataOut.data.shape[0]): | |
3648 |
|
3651 | |||
3649 | for hk in self.heights_indx.flatten(): |
|
3652 | for hk in self.heights_indx.flatten(): | |
@@ -3653,5 +3656,5 class remHeightsIppInterf(Operation): | |||||
3653 | dataOut.data[ch,:,hk] = 0 + 0j |
|
3656 | dataOut.data[ch,:,hk] = 0 + 0j | |
3654 |
|
3657 | |||
3655 | dataOut.flagProfilesByRange = True |
|
3658 | dataOut.flagProfilesByRange = True | |
3656 |
|
3659 | |||
3657 | return dataOut No newline at end of file |
|
3660 | return dataOut |
General Comments 0
You need to be logged in to leave comments.
Login now