From 77e2d8d2b2efdde8964f14cd1d89ee818b067daa 2022-07-12 20:27:01 From: joabAM Date: 2022-07-12 20:27:01 Subject: [PATCH] para pruebas em PC AMISR --- diff --git a/schainpy/model/io/jroIO_kamisr.py b/schainpy/model/io/jroIO_kamisr.py index d1e722a..a397dd5 100644 --- a/schainpy/model/io/jroIO_kamisr.py +++ b/schainpy/model/io/jroIO_kamisr.py @@ -614,7 +614,8 @@ class AMISRReader(ProcessingUnit): self.dataOut.flagNoData = True return 0 - if self.__hasNotDataInBuffer(): + if self.profileIndex >= (self.newProfiles*self.nblocks): # + #if self.__hasNotDataInBuffer(): if not (self.readNextFile(self.online)): return 0 diff --git a/schainpy/model/proc/jroproc_spectra.py b/schainpy/model/proc/jroproc_spectra.py index b9e31e2..821c1fd 100644 --- a/schainpy/model/proc/jroproc_spectra.py +++ b/schainpy/model/proc/jroproc_spectra.py @@ -664,7 +664,7 @@ class getNoiseB(Operation): self.isConfig = True if offset!=None: self.offset = 10**(offset/10) - #print("config getNoise Done") + #print("config getNoiseB Done") def run(self, dataOut, offset=None, minHei=None, maxHei=None,minVel=None, maxVel=None, minFreq= None, maxFreq=None, warnings=False): self.dataOut = dataOut @@ -676,19 +676,28 @@ class getNoiseB(Operation): noise = None if self.dataOut.type == 'Voltage': noise = self.dataOut.getNoise(ymin_index=self.minIndex, ymax_index=self.maxIndex) - #print(minIndex, maxIndex,minIndexVel, maxIndexVel) + #print(minIndex, maxIndex,minIndexVel, maxIndexVel) elif self.dataOut.type == 'Spectra': - + #print(self.minIndex, self.maxIndex,self.minIndexFFT, self.maxIndexFFT, self.dataOut.nIncohInt) noise = numpy.zeros( self.dataOut.nChannels) + norm = 1 for channel in range( self.dataOut.nChannels): - norm = self.dataOut.max_nIncohInt/self.dataOut.nIncohInt[channel, self.minIndex:self.maxIndex] - #print("norm nIncoh: ", norm ) + if not hasattr(self.dataOut.nIncohInt,'__len__'): + norm = 1 + else: + norm = self.dataOut.max_nIncohInt/self.dataOut.nIncohInt[channel, self.minIndex:self.maxIndex] + #print("norm nIncoh: ", norm ,self.dataOut.data_spc.shape) daux = self.dataOut.data_spc[channel,self.minIndexFFT:self.maxIndexFFT, self.minIndex:self.maxIndex] daux = numpy.multiply(daux, norm) #print("offset: ", self.offset, 10*numpy.log10(self.offset)) #noise[channel] = self.getNoiseByMean(daux)/self.offset + #print(daux.shape, daux) noise[channel] = self.getNoiseByHS(daux, self.dataOut.max_nIncohInt)/self.offset + # data = numpy.mean(daux,axis=1) + # sortdata = numpy.sort(data, axis=None) + # noise[channel] = _noise.hildebrand_sekhon(sortdata, self.dataOut.max_nIncohInt)/self.offset + #noise = self.dataOut.getNoise(xmin_index=self.minIndexFFT, xmax_index=self.maxIndexFFT, ymin_index=self.minIndex, ymax_index=self.maxIndex) else: noise = self.dataOut.getNoise(xmin_index=self.minIndexFFT, xmax_index=self.maxIndexFFT, ymin_index=self.minIndex, ymax_index=self.maxIndex) @@ -696,6 +705,7 @@ class getNoiseB(Operation): #print("2: ",10*numpy.log10(self.dataOut.noise_estimation/64)) #print(self.dataOut.flagNoData) + print("getNoise Done") return self.dataOut def getNoiseByMean(self,data): @@ -2050,7 +2060,7 @@ class IncohInt(Operation): self.incohInt = 0 self.nOutliers = 0 self.__profIndex = 0 - + #print("IncohInt Done") return dataOut class dopplerFlip(Operation): diff --git a/schainpy/model/proc/jroproc_voltage.py b/schainpy/model/proc/jroproc_voltage.py index 3acc37c..22f413d 100644 --- a/schainpy/model/proc/jroproc_voltage.py +++ b/schainpy/model/proc/jroproc_voltage.py @@ -1898,24 +1898,14 @@ class removeProfileByFaradayHS(Operation): ''' ''' - #isConfig = False - #n = None - #__dataReady = False __buffer_data = [] __buffer_times = [] - #__initime = None - #__count_exec = 0 - #__profIndex = 0 - buffer = None - #lenProfileOut = 1 - #init_prof = 0 - #end_prof = 0 + buffer = None - #first_utcBlock = None outliers_IDs_list = [] - #__dh = 0 + __slots__ = ('n','navg','profileMargin','thHistOutlier','minHei_idx','maxHei_idx','nHeights', '__dh','first_utcBlock','__profIndex','init_prof','end_prof','lenProfileOut','nChannels', @@ -1984,6 +1974,7 @@ class removeProfileByFaradayHS(Operation): # plt.grid() # plt.show() + outliers_IDs = outliers_IDs.astype(numpy.dtype('int64')) outliers_IDs = numpy.unique(outliers_IDs) outs_lines = numpy.sort(outliers_IDs) @@ -1992,9 +1983,9 @@ class removeProfileByFaradayHS(Operation): #Agrupando el histograma de outliers, + #my_bins = numpy.linspace(0,int(profiles), int(profiles/100), endpoint=False) my_bins = numpy.linspace(0,9600, 96, endpoint=False) - hist, bins = numpy.histogram(outs_lines,bins=my_bins) hist_outliers_indexes = numpy.where(hist > self.thHistOutlier) #es outlier #print(hist_outliers_indexes[0]) @@ -2002,14 +1993,15 @@ class removeProfileByFaradayHS(Operation): #print(bins_outliers_indexes) outlier_loc_index = [] - #outlier_loc_index = [k for k in range(bins_outliers_indexes[n]-50,bins_outliers_indexes[n+1]+50) for n in range(len(bins_outliers_indexes)-1) ] - for n in range(len(bins_outliers_indexes)-1): - #outlier_loc_index = [k for k in range(bins_outliers_indexes[n]-50,bins_outliers_indexes[n+1]+50)] - for k in range(bins_outliers_indexes[n]-self.profileMargin,bins_outliers_indexes[n+1]+self.profileMargin): - outlier_loc_index.append(k) + + # for n in range(len(bins_outliers_indexes)-1): + # for k in range(bins_outliers_indexes[n]-self.profileMargin,bins_outliers_indexes[n+1]+self.profileMargin): + # outlier_loc_index.append(k) + + outlier_loc_index = [e for n in range(len(bins_outliers_indexes)-1) for e in range(bins_outliers_indexes[n]-self.profileMargin,bins_outliers_indexes[n+1]+self.profileMargin) ] outlier_loc_index = numpy.asarray(outlier_loc_index) - #print(numpy.unique(outlier_loc_index)) + #print(len(numpy.unique(outlier_loc_index)), numpy.unique(outlier_loc_index))