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