##// END OF EJS Templates
update repository
avaldez -
r1259:c52310cc7d94
parent child
Show More
@@ -636,17 +636,20 class Spectra(JROData):
636 return freqrange
636 return freqrange
637
637
638 def getAcfRange(self, extrapoints=0):
638 def getAcfRange(self, extrapoints=0):
639 #print "GET ACF RANGE"
639 #print "NFFTPoints",self.nFFTPoints
640 #print "NFFTPoints",self.nFFTPoints
640 #print "IPPFactor", self.ippFactor
641 #print "IPPFactor", self.ippFactor
641 deltafreq = 10. / ( self.getFmax() / (self.nFFTPoints * self.ippFactor) )
642 #deltafreq = 10. / ( self.getFmax() / (self.nFFTPoints * self.ippFactor) )
642 #print "deltafreq",deltafreq
643 deltatime = 1./(self.getFmax()/ self.ippFactor)
644 #print "getFmax",self.getFmax()
643 #import time
645 #import time
644 #time.sleep(30)
646 #time.sleep(30)
645 freqrange = deltafreq * \
647 timerange = deltatime * \
646 (numpy.arange(self.nFFTPoints + extrapoints) -
648 (numpy.arange(self.nFFTPoints + extrapoints) -
647 self.nFFTPoints / 2.) - deltafreq / 2
649 self.nFFTPoints / 2.)
648
650 #- deltafreq / 2
649 return freqrange
651 #print "timerange",timerange
652 return timerange
650
653
651 def getFreqRange(self, extrapoints=0):
654 def getFreqRange(self, extrapoints=0):
652
655
@@ -318,7 +318,7 class ACFPlot(Figure):
318
318
319 #z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
319 #z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
320 shape = dataOut.data_acf.shape
320 shape = dataOut.data_acf.shape
321 print "shape_plot",shape
321 #print "shape_plot",shape
322 hei_index = numpy.arange(shape[2])
322 hei_index = numpy.arange(shape[2])
323 hei_plot = numpy.arange(nSamples)*resFactor
323 hei_plot = numpy.arange(nSamples)*resFactor
324
324
@@ -348,8 +348,9 class ACFPlot(Figure):
348 ylabel = "Power (dB)"
348 ylabel = "Power (dB)"
349
349
350 elif xaxis == "time":
350 elif xaxis == "time":
351 delta= dataOut.getAcfRange()[1]-dataOut.getAcfRange()[0]
351 #delta= dataOut.getAcfRange()[1]-dataOut.getAcfRange()[0]
352 x = dataOut.getAcfRange()+delta/2.0
352 #x = dataOut.getAcfRange()+delta/2.0
353 x = dataOut.getAcfRange()*1000
353 zdB = z[channel0,:,hei_plot]
354 zdB = z[channel0,:,hei_plot]
354 xlabel = "Time (ms)"
355 xlabel = "Time (ms)"
355 ylabel = "ACF"
356 ylabel = "ACF"
@@ -372,8 +373,8 class ACFPlot(Figure):
372 wintitle=wintitle,
373 wintitle=wintitle,
373 show=show)
374 show=show)
374
375
375 if xmin == None: xmin = numpy.nanmin(x)*0.9
376 if xmin == None: xmin = numpy.nanmin(x)#*0.9
376 if xmax == None: xmax = numpy.nanmax(x)*1.1
377 if xmax == None: xmax = numpy.nanmax(x)#*1.1
377 if ymin == None: ymin = numpy.nanmin(zdB)
378 if ymin == None: ymin = numpy.nanmin(zdB)
378 if ymax == None: ymax = numpy.nanmax(zdB)
379 if ymax == None: ymax = numpy.nanmax(zdB)
379
380
@@ -141,63 +141,26 class SpectraAFCProc(ProcessingUnit):
141 if self.dataIn.type == "Spectra":
141 if self.dataIn.type == "Spectra":
142 self.dataOut.copy(self.dataIn)
142 self.dataOut.copy(self.dataIn)
143 spc = self.dataOut.data_spc
143 spc = self.dataOut.data_spc
144 data = numpy.fft.ifft(spc, axis=1)
144 data = numpy.fft.fftshift( spc, axes=(1,))
145 data = numpy.fft.fftshift(data, axes=(1,))
145 data = numpy.fft.ifft(data, axis=1)
146 data = numpy.fft.fftshift( data, axes=(1,))
146 acf = numpy.abs(data) # Autocorrelacion LLAMAR A ESTE VALOR ACF
147 acf = numpy.abs(data) # Autocorrelacion LLAMAR A ESTE VALOR ACF
147 if real:
148 if real:
148 acf = data.real
149 acf = data.real
149 if imag:
150 if imag:
150 acf = data.imag
151 acf = data.imag
151 shape = acf.shape # nchannels, nprofiles, nsamples
152 shape = acf.shape # nchannels, nprofiles, nsamples //nchannles, lags , alturas
152
153
153 #import matplotlib.pyplot as plt
154 #print "test",acf.shape
155 #acf_tmp=acf[0,:,]
156 #plt.plot(acf_tmp)
157 #plt.show()
158 #import time
159 #time.sleep(10)
160
161 for j in range(shape[0]):
154 for j in range(shape[0]):
162 for i in range(shape[1]):
155 for i in range(shape[2]):
163 tmp = numpy.argmax(acf[j,:,i])
156 tmp = shape[1]/2
164 if i>30:
157 value = (acf[j,:,i][tmp-1]+acf[j,:,i][tmp+1])/2.0
165 value = (acf[j,:,i][tmp+3]+acf[j,:,i][tmp+4])/2.0
158 acf[j,:,i][tmp] = value
166 acf[j,:,i][tmp] = value
167 acf[j,:,i][tmp-1] = value
168 acf[j,:,i][tmp+1] = value
169 acf[j,:,i][tmp-2] = value
170 acf[j,:,i][tmp+2] = value
171
172 import scipy as sp
173 from scipy import signal
174 #acf[3,:,i] = sp.signal.medfilt(acf[3,:,i],21)
175
176
177
178 #print numpy.argmax(acf[0,:,85])
179 #import matplotlib.pyplot as plt
180 #plt.plot(acf[0,:,85])
181 #a= acf[0,:,85]
182 #b= acf[0,:,0]
183 #print a[200],a[198],a[199], a[201],a[202],a[203]
184 #plt.show()
185 #import time
186 #time.sleep(10)
187
188
189 # Normalizando
159 # Normalizando
190 for i in range(shape[0]):
160 for i in range(shape[0]):
191 for j in range(shape[2]):
161 for j in range(shape[2]):
192 acf[i,:,j]= acf[i,:,j] / numpy.max(numpy.abs(acf[i,:,j]))
162 acf[i,:,j]= acf[i,:,j] / numpy.max(numpy.abs(acf[i,:,j]))
193
163
194 #import matplotlib.pyplot as plt
195 #plt.plot(acf[0,:,85])
196 #plt.show()
197 #import time
198 #time.sleep(20)
199
200
201 self.dataOut.data_acf = acf
164 self.dataOut.data_acf = acf
202 return True
165 return True
203
166
@@ -1316,8 +1316,7 class SSheightProfiles(Operation):
1316 for i in range(self.buffer.shape[1]):
1316 for i in range(self.buffer.shape[1]):
1317 #self.buffer[:,i] = numpy.flip(dataOut.data[:,i*self.step:i*self.step + self.nsamples])
1317 #self.buffer[:,i] = numpy.flip(dataOut.data[:,i*self.step:i*self.step + self.nsamples])
1318 self.buffer[:,i] = dataOut.data[:,i*self.step:i*self.step + self.nsamples]
1318 self.buffer[:,i] = dataOut.data[:,i*self.step:i*self.step + self.nsamples]
1319
1319 #self.buffer[:,j,self.__nHeis-j*self.step - self.nheights:self.__nHeis-j*self.step] = numpy.flip(dataOut.data[:,j*self.step:j*self.step + self.nheights])
1320 #self.buffer[:,j,self.__nHeis-j*self.step - self.nheights:self.__nHeis-j*self.step] = numpy.flip(dataOut.data[:,j*self.step:j*self.step + self.nheights])
1321
1320
1322 for j in range(self.buffer.shape[0]):
1321 for j in range(self.buffer.shape[0]):
1323 self.sshProfiles[j] = numpy.transpose(self.buffer[j])
1322 self.sshProfiles[j] = numpy.transpose(self.buffer[j])
@@ -1325,6 +1324,7 class SSheightProfiles(Operation):
1325 profileIndex = self.nsamples
1324 profileIndex = self.nsamples
1326 deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
1325 deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
1327 ippSeconds = (deltaHeight*1.0e-6)/(0.15)
1326 ippSeconds = (deltaHeight*1.0e-6)/(0.15)
1327 #print "ippSeconds",ippSeconds
1328 try:
1328 try:
1329 if dataOut.concat_m is not None:
1329 if dataOut.concat_m is not None:
1330 ippSeconds= ippSeconds/float(dataOut.concat_m)
1330 ippSeconds= ippSeconds/float(dataOut.concat_m)
@@ -74,9 +74,10 if __name__ == '__main__':
74 # procUnitConfObj1SPC.addParameter(name='pairsList', value='(1,0),(3,2),(5,4),(7,6)', format='pairsList')
74 # procUnitConfObj1SPC.addParameter(name='pairsList', value='(1,0),(3,2),(5,4),(7,6)', format='pairsList')
75
75
76 opObj11 = procUnitConfObj1SPC.addOperation(name='IncohInt', optype='other')
76 opObj11 = procUnitConfObj1SPC.addOperation(name='IncohInt', optype='other')
77 opObj11.addParameter(name='timeInterval', value='5', format='int')
77 opObj11.addParameter(name='timeInterval', value='10', format='int')
78
78
79 procUnitConfObj2SPC = controllerObj.addProcUnit(datatype='SpectraAFCProc', inputId=procUnitConfObj1SPC.getId())
79 procUnitConfObj2SPC = controllerObj.addProcUnit(datatype='SpectraAFCProc', inputId=procUnitConfObj1SPC.getId())
80 procUnitConfObj2SPC.addParameter(name='real', value='1', format='int')
80
81
81 opObj11 = procUnitConfObj1SPC.addOperation(name='SpectraPlot', optype='other')
82 opObj11 = procUnitConfObj1SPC.addOperation(name='SpectraPlot', optype='other')
82 opObj11.addParameter(name='id', value='1', format='int')
83 opObj11.addParameter(name='id', value='1', format='int')
@@ -113,8 +114,8 if __name__ == '__main__':
113 opObj11.addParameter(name='wintitle', value = 'October 2019', format='str')
114 opObj11.addParameter(name='wintitle', value = 'October 2019', format='str')
114 opObj11.addParameter(name='xaxis', value='time', format='str')
115 opObj11.addParameter(name='xaxis', value='time', format='str')
115 opObj11.addParameter(name='channel', value='0', format='int')
116 opObj11.addParameter(name='channel', value='0', format='int')
116 opObj11.addParameter(name='nSampleList', value='(40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70)', format='intList')
117 #opObj11.addParameter(name='nSampleList', value='(50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70)', format='intList')
117 opObj11.addParameter(name='resolutionFactor', value='2', format='int')
118 opObj11.addParameter(name='resolutionFactor', value='15', format='int')
118 #opObj11.addParameter(name='zmin', value=0.5, format='int')
119 #opObj11.addParameter(name='zmin', value=0.5, format='int')
119 #opObj11.addParameter(name='zmax', value=-0.5, format='int')
120 #opObj11.addParameter(name='zmax', value=-0.5, format='int')
120 #opObj11.addParameter(name='ymin', value='0', format='int')
121 #opObj11.addParameter(name='ymin', value='0', format='int')
General Comments 0
You need to be logged in to leave comments. Login now