@@ -705,7 +705,7 class getNoiseB(Operation): | |||||
705 | #print("2: ",10*numpy.log10(self.dataOut.noise_estimation/64)) |
|
705 | #print("2: ",10*numpy.log10(self.dataOut.noise_estimation/64)) | |
706 |
|
706 | |||
707 | #print(self.dataOut.flagNoData) |
|
707 | #print(self.dataOut.flagNoData) | |
708 | print("getNoise Done") |
|
708 | print("getNoise Done", noise) | |
709 | return self.dataOut |
|
709 | return self.dataOut | |
710 |
|
710 | |||
711 | def getNoiseByMean(self,data): |
|
711 | def getNoiseByMean(self,data): |
@@ -6,7 +6,7 from schainpy.model.data.jrodata import Voltage,hildebrand_sekhon | |||||
6 | from schainpy.utils import log |
|
6 | from schainpy.utils import log | |
7 | from schainpy.model.io.utils import getHei_index |
|
7 | from schainpy.model.io.utils import getHei_index | |
8 | from time import time |
|
8 | from time import time | |
9 | #import datetime |
|
9 | ||
10 | import numpy |
|
10 | import numpy | |
11 | #import copy |
|
11 | #import copy | |
12 | from schainpy.model.data import _noise |
|
12 | from schainpy.model.data import _noise | |
@@ -1890,9 +1890,6 class SSheightProfiles2(Operation): | |||||
1890 |
|
1890 | |||
1891 |
|
1891 | |||
1892 |
|
1892 | |||
1893 | #import skimage.color |
|
|||
1894 | #import skimage.io |
|
|||
1895 | #import matplotlib.pyplot as plt |
|
|||
1896 |
|
1893 | |||
1897 | class removeProfileByFaradayHS(Operation): |
|
1894 | class removeProfileByFaradayHS(Operation): | |
1898 | ''' |
|
1895 | ''' | |
@@ -2024,14 +2021,16 class removeProfileByFaradayHS(Operation): | |||||
2024 | return data |
|
2021 | return data | |
2025 |
|
2022 | |||
2026 | def cleanOutliersByBlock(self): |
|
2023 | def cleanOutliersByBlock(self): | |
|
2024 | import matplotlib.pyplot as plt | |||
|
2025 | import datetime | |||
2027 | #print(self.__buffer_data[0].shape) |
|
2026 | #print(self.__buffer_data[0].shape) | |
2028 | data = self.__buffer_data#.copy() |
|
2027 | data = self.__buffer_data#.copy() | |
2029 |
|
|
2028 | print("cleaning shape inpt: ",data.shape) | |
2030 | ''' |
|
2029 | ||
2031 | self.__buffer_data = [] |
|
2030 | self.__buffer_data = [] | |
2032 |
|
2031 | |||
2033 | spectrum = numpy.fft.fft2(data, axes=(0,2)) |
|
2032 | spectrum = numpy.fft.fft2(data[:,:,self.minHei_idx:], axes=(0,2)) | |
2034 |
|
|
2033 | print("spc : ",spectrum.shape) | |
2035 | (nch,nsamples, nh) = spectrum.shape |
|
2034 | (nch,nsamples, nh) = spectrum.shape | |
2036 | data2 = None |
|
2035 | data2 = None | |
2037 | #print(data.shape) |
|
2036 | #print(data.shape) | |
@@ -2048,41 +2047,48 class removeProfileByFaradayHS(Operation): | |||||
2048 |
|
2047 | |||
2049 | x, y = numpy.meshgrid(numpy.sort(freqh),numpy.sort(freqv)) |
|
2048 | x, y = numpy.meshgrid(numpy.sort(freqh),numpy.sort(freqv)) | |
2050 | z = numpy.abs(spectrum[ch,:,:]) |
|
2049 | z = numpy.abs(spectrum[ch,:,:]) | |
|
2050 | phase = numpy.angle(spectrum[ch,:,:]) | |||
2051 | # Find all peaks higher than the 98th percentile |
|
2051 | # Find all peaks higher than the 98th percentile | |
2052 |
peaks = z < numpy.percentile(z, 9 |
|
2052 | peaks = z < numpy.percentile(z, 99) | |
2053 | #print(peaks) |
|
2053 | #print(peaks) | |
2054 | # Set those peak coefficients to zero |
|
2054 | # Set those peak coefficients to zero | |
2055 | spectrum2 = spectrum2 * peaks.astype(int) |
|
2055 | spectrum2 = spectrum2 * peaks.astype(int) | |
2056 | data2 = numpy.fft.ifft2(spectrum2) |
|
2056 | data2 = numpy.fft.ifft2(spectrum2,axes=(0,2)) | |
2057 |
|
2057 | |||
2058 | dat = numpy.log10(z.T) |
|
2058 | dat = numpy.log10(z.T) | |
2059 |
dat |
|
2059 | pdat = numpy.log10(phase.T) | |
2060 |
|
2060 | dat2 = numpy.log10(numpy.abs(spectrum2.T)) | ||
2061 | # m = numpy.mean(dat) |
|
2061 | ||
2062 |
|
|
2062 | m = numpy.mean(dat) | |
2063 | # fig, ax = plt.subplots(2,1,figsize=(8, 6)) |
|
2063 | o = numpy.std(dat) | |
2064 | # |
|
2064 | fig, ax = plt.subplots(1,2,figsize=(12, 6)) | |
2065 | # c = ax[0].pcolormesh(x, y, dat, cmap ='YlGnBu', vmin = (m-2*o), vmax = (m+2*o)) |
|
2065 | ||
2066 | # #c = ax.pcolor( z.T , cmap ='gray', vmin = (m-2*o), vmax = (m+2*o)) |
|
2066 | colormap = 'jet' | |
2067 | # date_time = datetime.datetime.fromtimestamp(self.__buffer_times[0]).strftime('%Y-%m-%d %H:%M:%S.%f') |
|
2067 | #c = ax[0].pcolormesh(x, y, dat, cmap =colormap, vmin = (m-2*o)/2, vmax = (m+2*o)) | |
2068 | # #strftime('%Y-%m-%d %H:%M:%S') |
|
2068 | c = ax[0].pcolormesh(x, y, dat, cmap =colormap, vmin = 4.2, vmax = 5.0) | |
|
2069 | fig.colorbar(c, ax=ax[0]) | |||
|
2070 | #print("aqui estoy", dat.shape) | |||
|
2071 | #c = ax.pcolor( z.T , cmap ='gray', vmin = (m-2*o), vmax = (m+2*o)) | |||
|
2072 | date_time = datetime.datetime.fromtimestamp(self.__buffer_times[0]).strftime('%Y-%m-%d %H:%M:%S.%f') | |||
|
2073 | #strftime('%Y-%m-%d %H:%M:%S') | |||
2069 |
# |
|
2074 | #ax[0].set_title('Spectrum magnitude '+date_time) | |
2070 |
|
|
2075 | fig.canvas.set_window_title('Spectrum magnitude {} '.format(self.n)+date_time) | |
2071 | # |
|
2076 | #print("aqui estoy2",dat2[:,:,0].shape) | |
2072 | # |
|
2077 | c = ax[1].pcolormesh(x, y, pdat, cmap =colormap, vmin = -0.0, vmax = 0.5) | |
2073 |
# |
|
2078 | #c = ax[1].pcolormesh(x, y, dat2[:,:,0], cmap =colormap, vmin = (m-2*o)/2, vmax = (m+2*o)-1) | |
2074 | # fig.colorbar(c) |
|
2079 | #print("aqui estoy3") | |
2075 | # plt.show() |
|
2080 | fig.colorbar(c, ax=ax[1]) | |
|
2081 | plt.show() | |||
2076 |
|
2082 | |||
2077 | #print(data2.shape) |
|
2083 | #print(data2.shape) | |
2078 |
|
2084 | |||
2079 | data = data2 |
|
2085 | #data = data2 | |
|
2086 | ||||
|
2087 | #cleanBlock = numpy.fft.ifft2(data, axes=(0,2)).reshape() | |||
2080 |
|
2088 | |||
2081 | #cleanBlock = numpy.fft.ifft2(spectrum, axes=(0,2)).reshape() |
|
|||
2082 | ''' |
|
|||
2083 | #print("cleanOutliersByBlock Done") |
|
2089 | #print("cleanOutliersByBlock Done") | |
2084 |
|
2090 | |||
2085 | return self.filterSatsProfiles() |
|
2091 | return data | |
2086 |
|
2092 | |||
2087 |
|
2093 | |||
2088 |
|
2094 | |||
@@ -2094,7 +2100,7 class removeProfileByFaradayHS(Operation): | |||||
2094 | else: |
|
2100 | else: | |
2095 | self.__buffer_data = numpy.concatenate((self.__buffer_data,data), axis=1)#en perfiles |
|
2101 | self.__buffer_data = numpy.concatenate((self.__buffer_data,data), axis=1)#en perfiles | |
2096 | self.__profIndex += 1 |
|
2102 | self.__profIndex += 1 | |
2097 |
|
|
2103 | self.__buffer_times.append(datatime) | |
2098 |
|
2104 | |||
2099 | def getData(self, data, datatime=None): |
|
2105 | def getData(self, data, datatime=None): | |
2100 |
|
2106 |
General Comments 0
You need to be logged in to leave comments.
Login now