@@ -614,7 +614,8 class AMISRReader(ProcessingUnit): | |||
|
614 | 614 | self.dataOut.flagNoData = True |
|
615 | 615 | return 0 |
|
616 | 616 | |
|
617 | if self.__hasNotDataInBuffer(): | |
|
617 | if self.profileIndex >= (self.newProfiles*self.nblocks): # | |
|
618 | #if self.__hasNotDataInBuffer(): | |
|
618 | 619 | if not (self.readNextFile(self.online)): |
|
619 | 620 | return 0 |
|
620 | 621 |
@@ -664,7 +664,7 class getNoiseB(Operation): | |||
|
664 | 664 | self.isConfig = True |
|
665 | 665 | if offset!=None: |
|
666 | 666 | self.offset = 10**(offset/10) |
|
667 | #print("config getNoise Done") | |
|
667 | #print("config getNoiseB Done") | |
|
668 | 668 | |
|
669 | 669 | def run(self, dataOut, offset=None, minHei=None, maxHei=None,minVel=None, maxVel=None, minFreq= None, maxFreq=None, warnings=False): |
|
670 | 670 | self.dataOut = dataOut |
@@ -676,19 +676,28 class getNoiseB(Operation): | |||
|
676 | 676 | noise = None |
|
677 | 677 | if self.dataOut.type == 'Voltage': |
|
678 | 678 | noise = self.dataOut.getNoise(ymin_index=self.minIndex, ymax_index=self.maxIndex) |
|
679 | #print(minIndex, maxIndex,minIndexVel, maxIndexVel) | |
|
679 | #print(minIndex, maxIndex,minIndexVel, maxIndexVel) | |
|
680 | 680 | elif self.dataOut.type == 'Spectra': |
|
681 | ||
|
681 | #print(self.minIndex, self.maxIndex,self.minIndexFFT, self.maxIndexFFT, self.dataOut.nIncohInt) | |
|
682 | 682 | noise = numpy.zeros( self.dataOut.nChannels) |
|
683 | norm = 1 | |
|
683 | 684 | for channel in range( self.dataOut.nChannels): |
|
684 | norm = self.dataOut.max_nIncohInt/self.dataOut.nIncohInt[channel, self.minIndex:self.maxIndex] | |
|
685 |
|
|
|
685 | if not hasattr(self.dataOut.nIncohInt,'__len__'): | |
|
686 | norm = 1 | |
|
687 | else: | |
|
688 | norm = self.dataOut.max_nIncohInt/self.dataOut.nIncohInt[channel, self.minIndex:self.maxIndex] | |
|
689 | #print("norm nIncoh: ", norm ,self.dataOut.data_spc.shape) | |
|
686 | 690 | daux = self.dataOut.data_spc[channel,self.minIndexFFT:self.maxIndexFFT, self.minIndex:self.maxIndex] |
|
687 | 691 | daux = numpy.multiply(daux, norm) |
|
688 | 692 | #print("offset: ", self.offset, 10*numpy.log10(self.offset)) |
|
689 | 693 | #noise[channel] = self.getNoiseByMean(daux)/self.offset |
|
694 | #print(daux.shape, daux) | |
|
690 | 695 | noise[channel] = self.getNoiseByHS(daux, self.dataOut.max_nIncohInt)/self.offset |
|
691 | 696 | |
|
697 | # data = numpy.mean(daux,axis=1) | |
|
698 | # sortdata = numpy.sort(data, axis=None) | |
|
699 | # noise[channel] = _noise.hildebrand_sekhon(sortdata, self.dataOut.max_nIncohInt)/self.offset | |
|
700 | ||
|
692 | 701 | #noise = self.dataOut.getNoise(xmin_index=self.minIndexFFT, xmax_index=self.maxIndexFFT, ymin_index=self.minIndex, ymax_index=self.maxIndex) |
|
693 | 702 | else: |
|
694 | 703 | 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): | |||
|
696 | 705 | #print("2: ",10*numpy.log10(self.dataOut.noise_estimation/64)) |
|
697 | 706 | |
|
698 | 707 | #print(self.dataOut.flagNoData) |
|
708 | print("getNoise Done") | |
|
699 | 709 | return self.dataOut |
|
700 | 710 | |
|
701 | 711 | def getNoiseByMean(self,data): |
@@ -2050,7 +2060,7 class IncohInt(Operation): | |||
|
2050 | 2060 | self.incohInt = 0 |
|
2051 | 2061 | self.nOutliers = 0 |
|
2052 | 2062 | self.__profIndex = 0 |
|
2053 | ||
|
2063 | #print("IncohInt Done") | |
|
2054 | 2064 | return dataOut |
|
2055 | 2065 | |
|
2056 | 2066 | class dopplerFlip(Operation): |
@@ -1898,24 +1898,14 class removeProfileByFaradayHS(Operation): | |||
|
1898 | 1898 | ''' |
|
1899 | 1899 | |
|
1900 | 1900 | ''' |
|
1901 | #isConfig = False | |
|
1902 | #n = None | |
|
1903 | 1901 | |
|
1904 | #__dataReady = False | |
|
1905 | 1902 | __buffer_data = [] |
|
1906 | 1903 | __buffer_times = [] |
|
1907 | #__initime = None | |
|
1908 | #__count_exec = 0 | |
|
1909 | #__profIndex = 0 | |
|
1910 | buffer = None | |
|
1911 | #lenProfileOut = 1 | |
|
1912 | 1904 | |
|
1913 | #init_prof = 0 | |
|
1914 | #end_prof = 0 | |
|
1905 | buffer = None | |
|
1915 | 1906 | |
|
1916 | #first_utcBlock = None | |
|
1917 | 1907 | outliers_IDs_list = [] |
|
1918 | #__dh = 0 | |
|
1908 | ||
|
1919 | 1909 | |
|
1920 | 1910 | __slots__ = ('n','navg','profileMargin','thHistOutlier','minHei_idx','maxHei_idx','nHeights', |
|
1921 | 1911 | '__dh','first_utcBlock','__profIndex','init_prof','end_prof','lenProfileOut','nChannels', |
@@ -1984,6 +1974,7 class removeProfileByFaradayHS(Operation): | |||
|
1984 | 1974 | # plt.grid() |
|
1985 | 1975 | # plt.show() |
|
1986 | 1976 | |
|
1977 | ||
|
1987 | 1978 | outliers_IDs = outliers_IDs.astype(numpy.dtype('int64')) |
|
1988 | 1979 | outliers_IDs = numpy.unique(outliers_IDs) |
|
1989 | 1980 | outs_lines = numpy.sort(outliers_IDs) |
@@ -1992,9 +1983,9 class removeProfileByFaradayHS(Operation): | |||
|
1992 | 1983 | |
|
1993 | 1984 | |
|
1994 | 1985 | #Agrupando el histograma de outliers, |
|
1986 | #my_bins = numpy.linspace(0,int(profiles), int(profiles/100), endpoint=False) | |
|
1995 | 1987 | my_bins = numpy.linspace(0,9600, 96, endpoint=False) |
|
1996 | 1988 | |
|
1997 | ||
|
1998 | 1989 | hist, bins = numpy.histogram(outs_lines,bins=my_bins) |
|
1999 | 1990 | hist_outliers_indexes = numpy.where(hist > self.thHistOutlier) #es outlier |
|
2000 | 1991 | #print(hist_outliers_indexes[0]) |
@@ -2002,14 +1993,15 class removeProfileByFaradayHS(Operation): | |||
|
2002 | 1993 | #print(bins_outliers_indexes) |
|
2003 | 1994 | outlier_loc_index = [] |
|
2004 | 1995 | |
|
2005 | #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) ] | |
|
2006 | for n in range(len(bins_outliers_indexes)-1): | |
|
2007 |
|
|
|
2008 | for k in range(bins_outliers_indexes[n]-self.profileMargin,bins_outliers_indexes[n+1]+self.profileMargin): | |
|
2009 | outlier_loc_index.append(k) | |
|
1996 | ||
|
1997 | # for n in range(len(bins_outliers_indexes)-1): | |
|
1998 | # for k in range(bins_outliers_indexes[n]-self.profileMargin,bins_outliers_indexes[n+1]+self.profileMargin): | |
|
1999 | # outlier_loc_index.append(k) | |
|
2000 | ||
|
2001 | 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) ] | |
|
2010 | 2002 | |
|
2011 | 2003 | outlier_loc_index = numpy.asarray(outlier_loc_index) |
|
2012 | #print(numpy.unique(outlier_loc_index)) | |
|
2004 | #print(len(numpy.unique(outlier_loc_index)), numpy.unique(outlier_loc_index)) | |
|
2013 | 2005 | |
|
2014 | 2006 | |
|
2015 | 2007 |
General Comments 0
You need to be logged in to leave comments.
Login now