@@ -0,0 +1,11 | |||
|
1 | #!/home/soporte/workspace/schain/ENV_DIR/bin/python3 | |
|
2 | ||
|
3 | # -*- coding: utf-8 -*- | |
|
4 | import re | |
|
5 | import sys | |
|
6 | ||
|
7 | from setuptools.command.easy_install import main | |
|
8 | ||
|
9 | if __name__ == '__main__': | |
|
10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) | |
|
11 | sys.exit(main()) |
@@ -0,0 +1,11 | |||
|
1 | #!/home/soporte/workspace/schain/ENV_DIR/bin/python3 | |
|
2 | ||
|
3 | # -*- coding: utf-8 -*- | |
|
4 | import re | |
|
5 | import sys | |
|
6 | ||
|
7 | from setuptools.command.easy_install import main | |
|
8 | ||
|
9 | if __name__ == '__main__': | |
|
10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) | |
|
11 | sys.exit(main()) |
@@ -0,0 +1,11 | |||
|
1 | #!/home/soporte/workspace/schain/ENV_DIR/bin/python3 | |
|
2 | ||
|
3 | # -*- coding: utf-8 -*- | |
|
4 | import re | |
|
5 | import sys | |
|
6 | ||
|
7 | from pip import main | |
|
8 | ||
|
9 | if __name__ == '__main__': | |
|
10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) | |
|
11 | sys.exit(main()) |
@@ -0,0 +1,11 | |||
|
1 | #!/home/soporte/workspace/schain/ENV_DIR/bin/python3 | |
|
2 | ||
|
3 | # -*- coding: utf-8 -*- | |
|
4 | import re | |
|
5 | import sys | |
|
6 | ||
|
7 | from pip import main | |
|
8 | ||
|
9 | if __name__ == '__main__': | |
|
10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) | |
|
11 | sys.exit(main()) |
@@ -0,0 +1,11 | |||
|
1 | #!/home/soporte/workspace/schain/ENV_DIR/bin/python3 | |
|
2 | ||
|
3 | # -*- coding: utf-8 -*- | |
|
4 | import re | |
|
5 | import sys | |
|
6 | ||
|
7 | from pip import main | |
|
8 | ||
|
9 | if __name__ == '__main__': | |
|
10 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) | |
|
11 | sys.exit(main()) |
@@ -0,0 +1,1 | |||
|
1 | python3 No newline at end of file |
@@ -0,0 +1,1 | |||
|
1 | /usr/bin/python3 No newline at end of file |
@@ -0,0 +1,1 | |||
|
1 | lib No newline at end of file |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
|
1 | NO CONTENT: new file 100644, binary diff hidden |
@@ -478,7 +478,6 class Spectra(JROData): | |||
|
478 | 478 | """ |
|
479 | 479 | |
|
480 | 480 | noise = numpy.zeros(self.nChannels) |
|
481 | ||
|
482 | 481 | for channel in range(self.nChannels): |
|
483 | 482 | daux = self.data_spc[channel, |
|
484 | 483 | xmin_index:xmax_index, ymin_index:ymax_index] |
@@ -236,7 +236,7 class Plot(Operation): | |||
|
236 | 236 | self.width = kwargs.get('width', None) |
|
237 | 237 | self.height = kwargs.get('height', None) |
|
238 | 238 | self.colorbar = kwargs.get('colorbar', True) |
|
239 |
self.factors = kwargs.get('factors', |
|
|
239 | self.factors = kwargs.get('factors', range(18)) | |
|
240 | 240 | self.channels = kwargs.get('channels', None) |
|
241 | 241 | self.titles = kwargs.get('titles', []) |
|
242 | 242 | self.polar = False |
@@ -48,7 +48,8 class SnrPlot(RTIPlot): | |||
|
48 | 48 | colormap = 'jet' |
|
49 | 49 | |
|
50 | 50 | def update(self, dataOut): |
|
51 | ||
|
51 | if len(self.channelList) == 0: | |
|
52 | self.channelList = dataOut.channelList | |
|
52 | 53 | data = { |
|
53 | 54 | 'snr': 10*numpy.log10(dataOut.data_snr) |
|
54 | 55 | } |
@@ -80,11 +81,12 class PowerPlot(RTIPlot): | |||
|
80 | 81 | colormap = 'jet' |
|
81 | 82 | |
|
82 | 83 | def update(self, dataOut): |
|
83 | ||
|
84 | if len(self.channelList) == 0: | |
|
85 | self.channelList = dataOut.channelList | |
|
84 | 86 | data = { |
|
85 | 87 | 'pow': 10*numpy.log10(dataOut.data_pow) |
|
86 | 88 | } |
|
87 | print("data",data) | |
|
89 | #print("data",data) | |
|
88 | 90 | return data, {} |
|
89 | 91 | |
|
90 | 92 | class SpectralWidthPlot(RTIPlot): |
@@ -10,7 +10,7 import os | |||
|
10 | 10 | import numpy |
|
11 | 11 | |
|
12 | 12 | from schainpy.model.graphics.jroplot_base import Plot, plt, log |
|
13 | ||
|
13 | from itertools import combinations | |
|
14 | 14 | |
|
15 | 15 | class SpectraPlot(Plot): |
|
16 | 16 | ''' |
@@ -43,6 +43,7 class SpectraPlot(Plot): | |||
|
43 | 43 | data = {} |
|
44 | 44 | meta = {} |
|
45 | 45 | spc = 10*numpy.log10(dataOut.data_spc/dataOut.normFactor) |
|
46 | ||
|
46 | 47 | data['spc'] = spc |
|
47 | 48 | data['rti'] = dataOut.getPower() |
|
48 | 49 | data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor) |
@@ -139,7 +140,6 class CrossSpectraPlot(Plot): | |||
|
139 | 140 | cspc = dataOut.data_cspc |
|
140 | 141 | meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1)) |
|
141 | 142 | rawPairs = list(combinations(list(range(dataOut.nChannels)), 2)) |
|
142 | #print(rawPairs) | |
|
143 | 143 | meta['pairs'] = rawPairs |
|
144 | 144 | |
|
145 | 145 | if self.crossPairs == None: |
@@ -224,7 +224,7 class RTIPlot(Plot): | |||
|
224 | 224 | def setup(self): |
|
225 | 225 | self.xaxis = 'time' |
|
226 | 226 | self.ncols = 1 |
|
227 | print("dataChannels ",self.data.channels) | |
|
227 | #print("dataChannels ",self.data.channels) | |
|
228 | 228 | self.nrows = len(self.data.channels) |
|
229 | 229 | self.nplots = len(self.data.channels) |
|
230 | 230 | self.ylabel = 'Range [km]' |
@@ -233,7 +233,7 class RTIPlot(Plot): | |||
|
233 | 233 | self.plots_adjust.update({'hspace':0.8, 'left': 0.1, 'bottom': 0.08, 'right':0.95}) |
|
234 | 234 | self.titles = ['{} Channel {}'.format( |
|
235 | 235 | self.CODE.upper(), x) for x in range(self.nplots)] |
|
236 | print("SETUP") | |
|
236 | ||
|
237 | 237 | def update(self, dataOut): |
|
238 | 238 | if len(self.channelList) == 0: |
|
239 | 239 | self.channelList = dataOut.channelList |
@@ -241,10 +241,10 class RTIPlot(Plot): | |||
|
241 | 241 | meta = {} |
|
242 | 242 | data['rti'] = dataOut.getPower() |
|
243 | 243 | data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor) |
|
244 | ||
|
245 | 244 | return data, meta |
|
246 | 245 | |
|
247 | 246 | def plot(self): |
|
247 | ||
|
248 | 248 | self.x = self.data.times |
|
249 | 249 | self.y = self.data.yrange |
|
250 | 250 | self.z = self.data[self.CODE] |
@@ -585,7 +585,7 class Reader(object): | |||
|
585 | 585 | path, startDate, endDate, folderfmt, last=True) |
|
586 | 586 | else: |
|
587 | 587 | folders = path.split(',') |
|
588 | ||
|
588 | ||
|
589 | 589 | return self.find_files( |
|
590 | 590 | folders, ext, filefmt, startDate, endDate, expLabel, last=True) |
|
591 | 591 | |
@@ -1431,6 +1431,7 class JRODataWriter(Reader): | |||
|
1431 | 1431 | if self.fp != None: |
|
1432 | 1432 | self.fp.close() |
|
1433 | 1433 | |
|
1434 | ||
|
1434 | 1435 | if not os.path.exists(path): |
|
1435 | 1436 | os.mkdir(path) |
|
1436 | 1437 |
@@ -1,4 +1,4 | |||
|
1 | ''' | |
|
1 | '''' | |
|
2 | 2 | Created on Set 9, 2015 |
|
3 | 3 | |
|
4 | 4 | @author: roj-idl71 Karim Kuyeng |
@@ -245,8 +245,8 class AMISRReader(ProcessingUnit): | |||
|
245 | 245 | month = int(amisr_dirname_format[4:6]) |
|
246 | 246 | dom = int(amisr_dirname_format[6:8]) |
|
247 | 247 | thisDate = datetime.date(year,month,dom) |
|
248 | ||
|
249 | if (thisDate>=self.startDate and thisDate <= self.endDate): | |
|
248 | #margen de un día extra, igual luego se filtra for fecha y hora | |
|
249 | if (thisDate>=(self.startDate - datetime.timedelta(days=1)) and thisDate <= (self.endDate)+ datetime.timedelta(days=1)): | |
|
250 | 250 | return amisr_dirname_format |
|
251 | 251 | except: |
|
252 | 252 | return None |
@@ -302,15 +302,16 class AMISRReader(ProcessingUnit): | |||
|
302 | 302 | if self.timezone == 'lt': |
|
303 | 303 | startDateTime_File = startDateTime_File - datetime.timedelta(minutes = 300) |
|
304 | 304 | endDateTime_File = endDateTime_File - datetime.timedelta(minutes = 300) |
|
305 |
if ( |
|
|
305 | if (startDateTime_File >=startDateTime_Reader and endDateTime_File<=endDateTime_Reader): | |
|
306 | 306 | filter_filenameList.append(filename) |
|
307 | 307 | |
|
308 |
if ( |
|
|
308 | if (startDateTime_File>endDateTime_Reader): | |
|
309 | 309 | break |
|
310 | 310 | |
|
311 | 311 | |
|
312 | 312 | filter_filenameList.sort() |
|
313 | 313 | self.filenameList = filter_filenameList |
|
314 | ||
|
314 | 315 | return 1 |
|
315 | 316 | |
|
316 | 317 | def __filterByGlob1(self, dirName): |
@@ -335,9 +336,7 class AMISRReader(ProcessingUnit): | |||
|
335 | 336 | return None |
|
336 | 337 | |
|
337 | 338 | dirList = [os.path.join(self.path,x) for x in self.dirnameList] |
|
338 | ||
|
339 | 339 | fileListInKeys = [self.__filterByGlob1(x) for x in dirList] |
|
340 | ||
|
341 | 340 | self.__getFilenameList(fileListInKeys, dirList) |
|
342 | 341 | if not(online): |
|
343 | 342 | #filtro por tiempo |
@@ -629,7 +628,6 class AMISRReader(ProcessingUnit): | |||
|
629 | 628 | indexprof = numpy.mod(self.profileIndex, self.newProfiles) |
|
630 | 629 | indexblock = self.profileIndex/self.newProfiles |
|
631 | 630 | #print (indexblock, indexprof) |
|
632 | diffUTC = 1.8e4 #UTC diference from peru in seconds --Joab | |
|
633 | 631 | diffUTC = 0 |
|
634 | 632 | t_comp = (indexprof * self.ippSeconds * self.nchannels) + diffUTC # |
|
635 | 633 | |
@@ -637,12 +635,12 class AMISRReader(ProcessingUnit): | |||
|
637 | 635 | #print(numpy.shape(self.timeset)) |
|
638 | 636 | self.dataOut.utctime = self.timeset[numpy.int_(indexblock)] + t_comp |
|
639 | 637 | #self.dataOut.utctime = self.timeset[self.profileIndex] + t_comp |
|
640 | #print(self.dataOut.utctime) | |
|
638 | ||
|
641 | 639 | self.dataOut.profileIndex = self.profileIndex |
|
642 | 640 | #print("N profile:",self.profileIndex,self.newProfiles,self.nblocks,self.dataOut.utctime) |
|
643 | 641 | self.dataOut.flagNoData = False |
|
644 |
|
|
|
645 |
|
|
|
642 | # if indexprof == 0: | |
|
643 | # print("kamisr: ",self.dataOut.utctime) | |
|
646 | 644 | |
|
647 | 645 | self.profileIndex += 1 |
|
648 | 646 |
@@ -109,7 +109,7 class HDFReader(Reader, ProcessingUnit): | |||
|
109 | 109 | self.endDate, self.expLabel, self.ext, self.walk, |
|
110 | 110 | self.filefmt, self.folderfmt) |
|
111 | 111 | pathname, filename = os.path.split(fullpath) |
|
112 | print(pathname,filename) | |
|
112 | #print(pathname,filename) | |
|
113 | 113 | try: |
|
114 | 114 | fullpath = next(fullpath) |
|
115 | 115 | |
@@ -180,7 +180,6 class HDFReader(Reader, ProcessingUnit): | |||
|
180 | 180 | self.interval = numpy.min(thisUtcTime[1:] - thisUtcTime[:-1]) |
|
181 | 181 | thisDatetime = datetime.datetime.utcfromtimestamp(thisUtcTime[0]) |
|
182 | 182 | self.startFileDatetime = thisDatetime |
|
183 | print("datee ",self.startFileDatetime) | |
|
184 | 183 | thisDate = thisDatetime.date() |
|
185 | 184 | thisTime = thisDatetime.time() |
|
186 | 185 | |
@@ -427,7 +426,7 class HDFWriter(Operation): | |||
|
427 | 426 | currentTime = self.dataOut.utctime |
|
428 | 427 | timeTuple = time.localtime(currentTime) |
|
429 | 428 | dataDay = timeTuple.tm_yday |
|
430 | ||
|
429 | #print("time UTC: ",currentTime, self.dataOut.datatime) | |
|
431 | 430 | if self.lastTime is None: |
|
432 | 431 | self.lastTime = currentTime |
|
433 | 432 | self.currentDay = dataDay |
@@ -467,7 +466,8 class HDFWriter(Operation): | |||
|
467 | 466 | path = self.path |
|
468 | 467 | setFile = self.setFile |
|
469 | 468 | |
|
470 |
timeTuple = time. |
|
|
469 | timeTuple = time.gmtime(self.dataOut.utctime) | |
|
470 | #print("path: ",timeTuple) | |
|
471 | 471 | subfolder = 'd%4.4d%3.3d' % (timeTuple.tm_year,timeTuple.tm_yday) |
|
472 | 472 | fullpath = os.path.join(path, subfolder) |
|
473 | 473 |
@@ -60,7 +60,7 class ParametersProc(ProcessingUnit): | |||
|
60 | 60 | self.profIndex = 0 |
|
61 | 61 | self.dataOut = Parameters() |
|
62 | 62 | self.setupReq = False #Agregar a todas las unidades de proc |
|
63 | print("INIT PROC") | |
|
63 | ||
|
64 | 64 | def __updateObjFromInput(self): |
|
65 | 65 | |
|
66 | 66 | self.dataOut.inputUnit = self.dataIn.type |
@@ -99,7 +99,6 class ParametersProc(ProcessingUnit): | |||
|
99 | 99 | self.dataOut.elevationList = self.dataIn.elevationList |
|
100 | 100 | |
|
101 | 101 | def run(self): |
|
102 | print("run proc param") | |
|
103 | 102 | |
|
104 | 103 | #---------------------- Voltage Data --------------------------- |
|
105 | 104 |
@@ -643,11 +643,12 class CleanRayleigh(Operation): | |||
|
643 | 643 | |
|
644 | 644 | def cleanRayleigh(self,dataOut,spectra,cspectra,factor_stdv): |
|
645 | 645 | #print("OP cleanRayleigh") |
|
646 | import matplotlib.pyplot as plt | |
|
646 | #import matplotlib.pyplot as plt | |
|
647 | 647 | #for k in range(149): |
|
648 | channelsProcssd = [] | |
|
649 | channelA_ok = False | |
|
650 | rfunc = cspectra.copy() #self.bloques | |
|
648 | #channelsProcssd = [] | |
|
649 | #channelA_ok = False | |
|
650 | #rfunc = cspectra.copy() #self.bloques | |
|
651 | rfunc = spectra.copy() | |
|
651 | 652 | #rfunc = cspectra |
|
652 | 653 | #val_spc = spectra*0.0 #self.bloque0*0.0 |
|
653 | 654 | #val_cspc = cspectra*0.0 #self.bloques*0.0 |
@@ -672,22 +673,27 class CleanRayleigh(Operation): | |||
|
672 | 673 | gauss_fit, covariance = None, None |
|
673 | 674 | for ih in range(self.minAltInd,self.maxAltInd): |
|
674 | 675 | for ifreq in range(self.nFFTPoints): |
|
676 | ''' | |
|
675 | 677 | ###ONLY FOR TEST: |
|
676 | 678 | if ifreq ==fft_rev and ih==hei_rev: #TO VIEW A SIGNLE FREQUENCY |
|
677 | 679 | fig, axs = plt.subplots(raxs, caxs) |
|
678 | 680 | fig2, axs2 = plt.subplots(raxs, caxs) |
|
679 | 681 | col_ax = 0 |
|
680 | 682 | row_ax = 0 |
|
683 | ''' | |
|
681 | 684 | #print(self.nPairs) |
|
682 |
for ii in range(self.n |
|
|
683 | if self.crosspairs[ii][1]-self.crosspairs[ii][0] > 1: # APLICAR SOLO EN PARES CONTIGUOS | |
|
684 | continue | |
|
685 | if not self.crosspairs[ii][0] in channelsProcssd: | |
|
686 | channelA_ok = True | |
|
685 | for ii in range(self.nChan): #PARES DE CANALES SELF y CROSS | |
|
686 | # if self.crosspairs[ii][1]-self.crosspairs[ii][0] > 1: # APLICAR SOLO EN PARES CONTIGUOS | |
|
687 | # continue | |
|
688 | # if not self.crosspairs[ii][0] in channelsProcssd: | |
|
689 | # channelA_ok = True | |
|
687 | 690 | #print("pair: ",self.crosspairs[ii]) |
|
688 | if (col_ax%caxs==0 and col_ax!=0 and self.nPairs !=1): ###ONLY FOR TEST: | |
|
691 | ''' | |
|
692 | ###ONLY FOR TEST: | |
|
693 | if (col_ax%caxs==0 and col_ax!=0 and self.nPairs !=1): | |
|
689 | 694 | col_ax = 0 |
|
690 | 695 | row_ax += 1 |
|
696 | ''' | |
|
691 | 697 | func2clean = 10*numpy.log10(numpy.absolute(rfunc[:,ii,ifreq,ih])) #Potencia? |
|
692 | 698 | #print(func2clean.shape) |
|
693 | 699 | val = (numpy.isfinite(func2clean)==True).nonzero() |
@@ -718,31 +724,31 class CleanRayleigh(Operation): | |||
|
718 | 724 | mode = gauss_fit[1] |
|
719 | 725 | stdv = gauss_fit[2] |
|
720 | 726 | #print(" FIT OK",gauss_fit) |
|
721 | ||
|
727 | ''' | |
|
722 | 728 | ###ONLY FOR TEST: |
|
723 | 729 | if ifreq ==fft_rev and ih==hei_rev: #TO VIEW A SIGNLE FREQUENCY |
|
724 | 730 | newY = fit_func(x_dist,gauss_fit[0],gauss_fit[1],gauss_fit[2]) |
|
725 | 731 | axs[row_ax,col_ax].plot(binstep[:-1],y_dist,color='green') |
|
726 | 732 | axs[row_ax,col_ax].plot(binstep[:-1],newY,color='red') |
|
727 |
axs[row_ax,col_ax].set_title(" |
|
|
728 | ||
|
733 | axs[row_ax,col_ax].set_title("CH "+str(self.channels[ii])) | |
|
734 | ''' | |
|
729 | 735 | except: |
|
730 | 736 | mode = mean |
|
731 | 737 | stdv = sigma |
|
732 | 738 | #print("FIT FAIL") |
|
733 | continue | |
|
739 | #continue | |
|
734 | 740 | |
|
735 | 741 | |
|
736 | 742 | #print(mode,stdv) |
|
737 | 743 | #Removing echoes greater than mode + std_factor*stdv |
|
738 | 744 | noval = (abs(func2clean - mode)>=(factor_stdv*stdv)).nonzero() |
|
739 | 745 | #noval tiene los indices que se van a remover |
|
740 |
#print(" |
|
|
746 | #print("Chan ",ii," novals: ",len(noval[0])) | |
|
741 | 747 | if len(noval[0]) > 0: #forma de array (N,) es igual a longitud (N) |
|
742 | 748 | novall = ((func2clean - mode) >= (factor_stdv*stdv)).nonzero() |
|
743 | 749 | #print(novall) |
|
744 | 750 | #print(" ",self.pairsArray[ii]) |
|
745 | cross_pairs = self.pairsArray[ii] | |
|
751 | #cross_pairs = self.pairsArray[ii] | |
|
746 | 752 | #Getting coherent echoes which are removed. |
|
747 | 753 | # if len(novall[0]) > 0: |
|
748 | 754 | # |
@@ -750,30 +756,39 class CleanRayleigh(Operation): | |||
|
750 | 756 | # val_spc[novall[0],cross_pairs[1],ifreq,ih] = 1 |
|
751 | 757 | # val_cspc[novall[0],ii,ifreq,ih] = 1 |
|
752 | 758 | #print("OUT NOVALL 1") |
|
753 | ||
|
754 | new_a = numpy.delete(cspectra[:,ii,ifreq,ih], noval[0]) | |
|
755 | cspectra[noval,ii,ifreq,ih] = numpy.mean(new_a) #mean CrossSpectra | |
|
756 | ||
|
757 |
|
|
|
758 |
|
|
|
759 | new_b = numpy.delete(spectra[:,chA,ifreq,ih], noval[0]) | |
|
760 | spectra[noval,chA,ifreq,ih] = numpy.mean(new_b) #mean Spectra Pair A | |
|
761 | channelA_ok = False | |
|
762 | chB = self.channels.index(cross_pairs[1]) | |
|
763 | new_c = numpy.delete(spectra[:,chB,ifreq,ih], noval[0]) | |
|
764 | spectra[noval,chB,ifreq,ih] = numpy.mean(new_c) #mean Spectra Pair B | |
|
765 | ||
|
766 | channelsProcssd.append(self.crosspairs[ii][0]) # save channel A | |
|
767 | channelsProcssd.append(self.crosspairs[ii][1]) # save channel B | |
|
768 | ||
|
759 | try: | |
|
760 | pair = (self.channels[ii],self.channels[ii + 1]) | |
|
761 | except: | |
|
762 | pair = (99,99) | |
|
763 | #print("par ", pair) | |
|
764 | if ( pair in self.crosspairs): | |
|
765 | q = self.crosspairs.index(pair) | |
|
766 | #print("está aqui: ", q, (ii,ii + 1)) | |
|
767 | new_a = numpy.delete(cspectra[:,q,ifreq,ih], noval[0]) | |
|
768 | cspectra[noval,q,ifreq,ih] = numpy.mean(new_a) #mean CrossSpectra | |
|
769 | ||
|
770 | #if channelA_ok: | |
|
771 | #chA = self.channels.index(cross_pairs[0]) | |
|
772 | new_b = numpy.delete(spectra[:,ii,ifreq,ih], noval[0]) | |
|
773 | spectra[noval,ii,ifreq,ih] = numpy.mean(new_b) #mean Spectra Pair A | |
|
774 | #channelA_ok = False | |
|
775 | ||
|
776 | # chB = self.channels.index(cross_pairs[1]) | |
|
777 | # new_c = numpy.delete(spectra[:,chB,ifreq,ih], noval[0]) | |
|
778 | # spectra[noval,chB,ifreq,ih] = numpy.mean(new_c) #mean Spectra Pair B | |
|
779 | # | |
|
780 | # channelsProcssd.append(self.crosspairs[ii][0]) # save channel A | |
|
781 | # channelsProcssd.append(self.crosspairs[ii][1]) # save channel B | |
|
782 | ''' | |
|
769 | 783 | ###ONLY FOR TEST: |
|
770 | 784 | if ifreq ==fft_rev and ih==hei_rev: #TO VIEW A SIGNLE FREQUENCY |
|
771 |
func2clean = 10*numpy.log10(numpy.absolute( |
|
|
785 | func2clean = 10*numpy.log10(numpy.absolute(spectra[:,ii,ifreq,ih])) | |
|
772 | 786 | y_dist,binstep = numpy.histogram(func2clean,bins=range(int(min_val),int(max_val+2),step)) |
|
773 | 787 | axs2[row_ax,col_ax].plot(binstep[:-1],newY,color='red') |
|
774 | 788 | axs2[row_ax,col_ax].plot(binstep[:-1],y_dist,color='green') |
|
775 |
axs2[row_ax,col_ax].set_title(" |
|
|
776 | ||
|
789 | axs2[row_ax,col_ax].set_title("CH "+str(self.channels[ii])) | |
|
790 | ''' | |
|
791 | ''' | |
|
777 | 792 | ###ONLY FOR TEST: |
|
778 | 793 | col_ax += 1 #contador de ploteo columnas |
|
779 | 794 | ##print(col_ax) |
@@ -784,31 +799,8 class CleanRayleigh(Operation): | |||
|
784 | 799 | fig.suptitle(title) |
|
785 | 800 | fig2.suptitle(title2) |
|
786 | 801 | plt.show() |
|
787 | ||
|
788 | ||
|
789 | ''' | |
|
790 | ||
|
791 | channels = channels | |
|
792 | cross_pairs = cross_pairs | |
|
793 | #print("OUT NOVALL 2") | |
|
794 | ||
|
795 | vcross0 = (cross_pairs[0] == channels[ii]).nonzero() | |
|
796 | vcross1 = (cross_pairs[1] == channels[ii]).nonzero() | |
|
797 | vcross = numpy.concatenate((vcross0,vcross1),axis=None) | |
|
798 | #print('vcros =', vcross) | |
|
799 | ||
|
800 | #Getting coherent echoes which are removed. | |
|
801 | if len(novall) > 0: | |
|
802 | #val_spc[novall,ii,ifreq,ih] = 1 | |
|
803 | val_spc[ii,ifreq,ih,novall] = 1 | |
|
804 | if len(vcross) > 0: | |
|
805 | val_cspc[vcross,ifreq,ih,novall] = 1 | |
|
806 | ||
|
807 | #Removing coherent from ISR data. | |
|
808 | self.bloque0[ii,ifreq,ih,noval] = numpy.nan | |
|
809 | if len(vcross) > 0: | |
|
810 | self.bloques[vcross,ifreq,ih,noval] = numpy.nan | |
|
811 | 802 | ''' |
|
803 | ################################################################################################## | |
|
812 | 804 | |
|
813 | 805 | #print("Getting average of the spectra and cross-spectra from incoherent echoes.") |
|
814 | 806 | out_spectra = numpy.zeros([self.nChan,self.nFFTPoints,self.nHeights], dtype=float) #+numpy.nan |
@@ -827,88 +819,14 class CleanRayleigh(Operation): | |||
|
827 | 819 | valid = (numpy.isfinite(tmp)==True).nonzero() |
|
828 | 820 | if len(valid[0]) > 0: |
|
829 | 821 | out_cspectra[icr,ifreq,ih] = numpy.nansum(tmp)#/len(valid[0]) |
|
830 | ''' | |
|
831 | # print('##########################################################') | |
|
832 | print("Removing fake coherent echoes (at least 4 points around the point)") | |
|
833 | ||
|
834 | val_spectra = numpy.sum(val_spc,0) | |
|
835 | val_cspectra = numpy.sum(val_cspc,0) | |
|
836 | ||
|
837 | val_spectra = self.REM_ISOLATED_POINTS(val_spectra,4) | |
|
838 | val_cspectra = self.REM_ISOLATED_POINTS(val_cspectra,4) | |
|
839 | ||
|
840 | for i in range(nChan): | |
|
841 | for j in range(nProf): | |
|
842 | for k in range(nHeights): | |
|
843 | if numpy.isfinite(val_spectra[i,j,k]) and val_spectra[i,j,k] < 1 : | |
|
844 | val_spc[:,i,j,k] = 0.0 | |
|
845 | for i in range(nPairs): | |
|
846 | for j in range(nProf): | |
|
847 | for k in range(nHeights): | |
|
848 | if numpy.isfinite(val_cspectra[i,j,k]) and val_cspectra[i,j,k] < 1 : | |
|
849 | val_cspc[:,i,j,k] = 0.0 | |
|
850 | ||
|
851 | # val_spc = numpy.reshape(val_spc, (len(spectra[:,0,0,0]),nProf*nHeights*nChan)) | |
|
852 | # if numpy.isfinite(val_spectra)==str(True): | |
|
853 | # noval = (val_spectra<1).nonzero() | |
|
854 | # if len(noval) > 0: | |
|
855 | # val_spc[:,noval] = 0.0 | |
|
856 | # val_spc = numpy.reshape(val_spc, (149,nChan,nProf,nHeights)) | |
|
857 | ||
|
858 | #val_cspc = numpy.reshape(val_spc, (149,nChan*nHeights*nProf)) | |
|
859 | #if numpy.isfinite(val_cspectra)==str(True): | |
|
860 | # noval = (val_cspectra<1).nonzero() | |
|
861 | # if len(noval) > 0: | |
|
862 | # val_cspc[:,noval] = 0.0 | |
|
863 | # val_cspc = numpy.reshape(val_cspc, (149,nChan,nProf,nHeights)) | |
|
864 | tmp_sat_spectra = spectra.copy() | |
|
865 | tmp_sat_spectra = tmp_sat_spectra*numpy.nan | |
|
866 | tmp_sat_cspectra = cspectra.copy() | |
|
867 | tmp_sat_cspectra = tmp_sat_cspectra*numpy.nan | |
|
868 | ''' | |
|
869 | # fig = plt.figure(figsize=(6,5)) | |
|
870 | # left, bottom, width, height = 0.1, 0.1, 0.8, 0.8 | |
|
871 | # ax = fig.add_axes([left, bottom, width, height]) | |
|
872 | # cp = ax.contour(10*numpy.log10(numpy.absolute(spectra[0,0,:,:]))) | |
|
873 | # ax.clabel(cp, inline=True,fontsize=10) | |
|
874 | # plt.show() | |
|
875 | ''' | |
|
876 | val = (val_spc > 0).nonzero() | |
|
877 | if len(val[0]) > 0: | |
|
878 | tmp_sat_spectra[val] = in_sat_spectra[val] | |
|
879 | val = (val_cspc > 0).nonzero() | |
|
880 | if len(val[0]) > 0: | |
|
881 | tmp_sat_cspectra[val] = in_sat_cspectra[val] | |
|
882 | ||
|
883 | print("Getting average of the spectra and cross-spectra from incoherent echoes 2") | |
|
884 | sat_spectra = numpy.zeros((nChan,nProf,nHeights), dtype=float) | |
|
885 | sat_cspectra = numpy.zeros((nPairs,nProf,nHeights), dtype=complex) | |
|
886 | for ih in range(nHeights): | |
|
887 | for ifreq in range(nProf): | |
|
888 | for ich in range(nChan): | |
|
889 | tmp = numpy.squeeze(tmp_sat_spectra[:,ich,ifreq,ih]) | |
|
890 | valid = (numpy.isfinite(tmp)).nonzero() | |
|
891 | if len(valid[0]) > 0: | |
|
892 | sat_spectra[ich,ifreq,ih] = numpy.nansum(tmp)/len(valid[0]) | |
|
893 | 822 | |
|
894 | for icr in range(nPairs): | |
|
895 | tmp = numpy.squeeze(tmp_sat_cspectra[:,icr,ifreq,ih]) | |
|
896 | valid = (numpy.isfinite(tmp)).nonzero() | |
|
897 | if len(valid[0]) > 0: | |
|
898 | sat_cspectra[icr,ifreq,ih] = numpy.nansum(tmp)/len(valid[0]) | |
|
899 | ''' | |
|
900 | #self.__dataReady= True | |
|
901 | #sat_spectra, sat_cspectra= sat_spectra, sat_cspectra | |
|
902 | #if not self.__dataReady: | |
|
903 | #return None, None | |
|
904 | #return out_spectra, out_cspectra ,sat_spectra,sat_cspectra | |
|
905 | 823 | return out_spectra, out_cspectra |
|
906 | 824 | |
|
907 | 825 | def REM_ISOLATED_POINTS(self,array,rth): |
|
908 | 826 | # import matplotlib.pyplot as plt |
|
909 | 827 | if rth == None : |
|
910 | 828 | rth = 4 |
|
911 | print("REM ISO") | |
|
829 | #print("REM ISO") | |
|
912 | 830 | num_prof = len(array[0,:,0]) |
|
913 | 831 | num_hei = len(array[0,0,:]) |
|
914 | 832 | n2d = len(array[:,0,0]) |
@@ -1335,9 +1335,7 class PulsePairVoltage(Operation): | |||
|
1335 | 1335 | self.lambda_ = 3.0e8/(9345.0e6) |
|
1336 | 1336 | self.ippSec = dataOut.ippSeconds |
|
1337 | 1337 | self.nCohInt = dataOut.nCohInt |
|
1338 | print("IPPseconds",dataOut.ippSeconds) | |
|
1339 | ||
|
1340 | print("ELVALOR DE n es:", n) | |
|
1338 | ||
|
1341 | 1339 | if n == None: |
|
1342 | 1340 | raise ValueError("n should be specified.") |
|
1343 | 1341 |
General Comments 0
You need to be logged in to leave comments.
Login now