##// END OF EJS Templates
Correcion de plot eje, graficos centrados, seleccion de ploteo real,imag, abs por defecto, pruebas integrando5 min
avaldez -
r1244:464f48b8a1f9
parent child
Show More
@@ -297,7 +297,6 class JROData(GenericData):
297
297
298 def getFmax(self):
298 def getFmax(self):
299 PRF = 1. / (self.ippSeconds * self.nCohInt)
299 PRF = 1. / (self.ippSeconds * self.nCohInt)
300
301 fmax = PRF
300 fmax = PRF
302 return fmax
301 return fmax
303
302
@@ -605,11 +604,9 class Spectra(JROData):
605 noise = numpy.zeros(self.nChannels)
604 noise = numpy.zeros(self.nChannels)
606
605
607 for channel in range(self.nChannels):
606 for channel in range(self.nChannels):
608 #print "confuse",self.data_spc.dtype
609 daux = self.data_spc[channel,
607 daux = self.data_spc[channel,
610 xmin_index:xmax_index, ymin_index:ymax_index]
608 xmin_index:xmax_index, ymin_index:ymax_index]
611
609
612 #print "HI3.0",(daux.dtype),daux.shape
613 noise[channel] = hildebrand_sekhon(daux, self.nIncohInt)
610 noise[channel] = hildebrand_sekhon(daux, self.nIncohInt)
614
611
615 return noise
612 return noise
@@ -634,9 +631,7 class Spectra(JROData):
634 return freqrange
631 return freqrange
635
632
636 def getAcfRange(self, extrapoints=0):
633 def getAcfRange(self, extrapoints=0):
637 #print "miay",self.ippFactor
634 deltafreq = 10. / ( self.getFmax() / (self.nFFTPoints * self.ippFactor) )
638 deltafreq = 10. / (self.getFmax() / (self.nFFTPoints * self.ippFactor))
639 #print deltafreq
640 freqrange = deltafreq * \
635 freqrange = deltafreq * \
641 (numpy.arange(self.nFFTPoints + extrapoints) -
636 (numpy.arange(self.nFFTPoints + extrapoints) -
642 self.nFFTPoints / 2.) - deltafreq / 2
637 self.nFFTPoints / 2.) - deltafreq / 2
@@ -646,10 +641,11 class Spectra(JROData):
646 def getFreqRange(self, extrapoints=0):
641 def getFreqRange(self, extrapoints=0):
647
642
648 deltafreq = self.getFmax() / (self.nFFTPoints * self.ippFactor)
643 deltafreq = self.getFmax() / (self.nFFTPoints * self.ippFactor)
644 #print "deltafreq", deltafreq
649 freqrange = deltafreq * \
645 freqrange = deltafreq * \
650 (numpy.arange(self.nFFTPoints + extrapoints) -
646 (numpy.arange(self.nFFTPoints + extrapoints) -
651 self.nFFTPoints / 2.) - deltafreq / 2
647 self.nFFTPoints / 2.) - deltafreq / 2
652
648 #print "freqrange",freqrange
653 return freqrange
649 return freqrange
654
650
655 def getVelRange(self, extrapoints=0):
651 def getVelRange(self, extrapoints=0):
@@ -274,7 +274,6 class ACFPlot(Figure):
274 folder=None, username=None, password=None,
274 folder=None, username=None, password=None,
275 xaxis="frequency"):
275 xaxis="frequency"):
276
276
277
278 channel0 = channel
277 channel0 = channel
279 nSamples = nSamples
278 nSamples = nSamples
280 resFactor = resolutionFactor
279 resFactor = resolutionFactor
@@ -313,12 +312,6 class ACFPlot(Figure):
313 shape = dataOut.data_acf.shape
312 shape = dataOut.data_acf.shape
314 hei_index = numpy.arange(shape[2])
313 hei_index = numpy.arange(shape[2])
315 hei_plot = numpy.arange(nSamples)*resFactor
314 hei_plot = numpy.arange(nSamples)*resFactor
316 #print hei_plot
317 #import matplotlib.pyplot as plt
318 #c=z[0,:,0]*15+15
319 #plt.plot(c)
320 #plt.show()
321 #print "HOLA#
322
315
323 if nSampleList is not None:
316 if nSampleList is not None:
324 for nsample in nSampleList:
317 for nsample in nSampleList:
@@ -335,18 +328,9 class ACFPlot(Figure):
335 #escalamiento -1 a 1 a resolucion (factor de resolucion en altura)* deltaHeight
328 #escalamiento -1 a 1 a resolucion (factor de resolucion en altura)* deltaHeight
336 min = numpy.min(z[0,:,0])
329 min = numpy.min(z[0,:,0])
337 max =numpy.max(z[0,:,0])
330 max =numpy.max(z[0,:,0])
338
339 for i in range(shape[0]):
331 for i in range(shape[0]):
340 for j in range(shape[2]):
332 for j in range(shape[2]):
341 z[i,:,j]= (((z[i,:,j]-min)/(max-min))*deltaHeight*resFactor + j*deltaHeight)
333 z[i,:,j]= (((z[i,:,j]-min)/(max-min))*deltaHeight*resFactor + j*deltaHeight)
342 #z[i,:,j]= (z[i,:,j]+1.0)*deltaHeight*dataOut.step/2.0 + j*deltaHeight*dataOut.step
343
344 #print deltaHeight
345 #print resFactor
346 #print numpy.max(z[0,:,0])
347 #import matplotlib.pyplot as plt
348 #plt.plot((z[0,:,0])*deltaHeight)
349 #plt.show()
350
334
351 if xaxis == "frequency":
335 if xaxis == "frequency":
352 x = dataOut.getFreqRange()/1000.
336 x = dataOut.getFreqRange()/1000.
@@ -355,7 +339,8 class ACFPlot(Figure):
355 ylabel = "Power (dB)"
339 ylabel = "Power (dB)"
356
340
357 elif xaxis == "time":
341 elif xaxis == "time":
358 x = dataOut.getAcfRange()
342 delta= dataOut.getAcfRange()[1]-dataOut.getAcfRange()[0]
343 x = dataOut.getAcfRange()+delta/2.0
359 zdB = z[channel0,:,hei_plot]
344 zdB = z[channel0,:,hei_plot]
360 xlabel = "Time (ms)"
345 xlabel = "Time (ms)"
361 ylabel = "ACF"
346 ylabel = "ACF"
@@ -22,20 +22,19 class SpectraProc(ProcessingUnit):
22
22
23 def __updateSpecFromVoltage(self):
23 def __updateSpecFromVoltage(self):
24
24
25 self.dataOut.timeZone = self.dataIn.timeZone
25 self.dataOut.timeZone = self.dataIn.timeZone
26 self.dataOut.dstFlag = self.dataIn.dstFlag
26 self.dataOut.dstFlag = self.dataIn.dstFlag
27 self.dataOut.errorCount = self.dataIn.errorCount
27 self.dataOut.errorCount = self.dataIn.errorCount
28 self.dataOut.useLocalTime = self.dataIn.useLocalTime
28 self.dataOut.useLocalTime= self.dataIn.useLocalTime
29 try:
29 try:
30 self.dataOut.processingHeaderObj = self.dataIn.processingHeaderObj.copy()
30 self.dataOut.processingHeaderObj = self.dataIn.processingHeaderObj.copy()
31 except:
31 except:
32 pass
32 pass
33 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
33 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
34 self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy()
34 self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy()
35 self.dataOut.channelList = self.dataIn.channelList
35 self.dataOut.channelList = self.dataIn.channelList
36 self.dataOut.heightList = self.dataIn.heightList
36 self.dataOut.heightList = self.dataIn.heightList
37 #print self.dataOut.heightList.shape,"spec4"
37 self.dataOut.dtype = numpy.dtype([('real', '<f4'), ('imag', '<f4')])
38 self.dataOut.dtype = numpy.dtype([('real', '<f4'), ('imag', '<f4')])
39
38
40 self.dataOut.nBaud = self.dataIn.nBaud
39 self.dataOut.nBaud = self.dataIn.nBaud
41 self.dataOut.nCode = self.dataIn.nCode
40 self.dataOut.nCode = self.dataIn.nCode
@@ -65,8 +64,6 class SpectraProc(ProcessingUnit):
65 self.dataOut.beam.azimuthList = self.dataIn.beam.azimuthList
64 self.dataOut.beam.azimuthList = self.dataIn.beam.azimuthList
66 self.dataOut.beam.zenithList = self.dataIn.beam.zenithList
65 self.dataOut.beam.zenithList = self.dataIn.beam.zenithList
67
66
68 self.dataOut.step = self.dataIn.step #
69
70 def __getFft(self):
67 def __getFft(self):
71 """
68 """
72 Convierte valores de Voltaje a Spectra
69 Convierte valores de Voltaje a Spectra
@@ -125,7 +122,7 class SpectraProc(ProcessingUnit):
125
122
126 if self.dataIn.type == "Spectra":
123 if self.dataIn.type == "Spectra":
127 self.dataOut.copy(self.dataIn)
124 self.dataOut.copy(self.dataIn)
128 print "hi",self.dataOut.ippSeconds
125
129 if shift_fft:
126 if shift_fft:
130 #desplaza a la derecha en el eje 2 determinadas posiciones
127 #desplaza a la derecha en el eje 2 determinadas posiciones
131 shift = int(self.dataOut.nFFTPoints/2)
128 shift = int(self.dataOut.nFFTPoints/2)
@@ -156,7 +153,7 class SpectraProc(ProcessingUnit):
156 if self.buffer is None:
153 if self.buffer is None:
157 self.buffer = numpy.zeros((self.dataIn.nChannels,
154 self.buffer = numpy.zeros((self.dataIn.nChannels,
158 nProfiles,
155 nProfiles,
159 self.dataIn.heightList.shape[0]),
156 self.dataIn.heightList.shape[0]),#update heightlist
160 dtype='complex')
157 dtype='complex')
161
158
162
159
@@ -134,34 +134,27 class SpectraAFCProc(ProcessingUnit):
134 self.dataOut.blockSize = blocksize
134 self.dataOut.blockSize = blocksize
135 self.dataOut.flagShiftFFT = True
135 self.dataOut.flagShiftFFT = True
136
136
137 def run(self, nProfiles=None, nFFTPoints=None, pairsList=[], code=None, nCode=1, nBaud=1):
137 def run(self, nProfiles=None, nFFTPoints=None, pairsList=[], code=None, nCode=1, nBaud=1,real= None, imag=None):
138
138
139 self.dataOut.flagNoData = True
139 self.dataOut.flagNoData = True
140
140
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 #print "hi",self.dataOut.ippSeconds
143 spc = self.dataOut.data_spc
144
144 data = numpy.fft.ifft(spc, axis=1)
145 spc = self.dataOut.data_spc
145 data = numpy.fft.fftshift(data, axes=(1,))
146 data = numpy.fft.ifft(spc, axis=1)
146 acf = numpy.abs(data) # Autocorrelacion LLAMAR A ESTE VALOR ACF
147 data = numpy.fft.fftshift(data, axes=(1,))
147 if real:
148 acf = numpy.abs(data) # Autocorrelacion LLAMAR A ESTE VALOR ACF
148 acf = data.real
149 #acf = data.imag
149 if imag:
150 shape = acf.shape #nchannels, nprofiles, nsamples
150 acf = data.imag
151
151 shape = acf.shape # nchannels, nprofiles, nsamples
152 #import matplotlib.pyplot as plt
153 #plt.plot(acf[0,:,0] / numpy.max(numpy.abs(acf[0,:,0])))
154 #plt.show()
155
152
156 # Normalizando
153 # Normalizando
157 for i in range(shape[0]):
154 for i in range(shape[0]):
158 for j in range(shape[2]):
155 for j in range(shape[2]):
159 acf[i,:,j]= acf[i,:,j] / numpy.max(numpy.abs(acf[i,:,j]))
156 acf[i,:,j]= acf[i,:,j] / numpy.max(numpy.abs(acf[i,:,j]))
160
157
161 #import matplotlib.pyplot as plt
162 #plt.plot(acf[0,:,0])
163 #plt.show()
164
165 self.dataOut.data_acf = acf
158 self.dataOut.data_acf = acf
166 return True
159 return True
167
160
@@ -1186,12 +1186,12 class CombineProfiles(Operation):
1186
1186
1187 class SSheightProfiles(Operation):
1187 class SSheightProfiles(Operation):
1188
1188
1189 step = None
1189 step = None
1190 nsamples = None
1190 nsamples = None
1191 bufferShape = None
1191 bufferShape = None
1192 profileShape= None
1192 profileShape = None
1193 sshProfiles = None
1193 sshProfiles = None
1194 profileIndex= None
1194 profileIndex = None
1195
1195
1196 def __init__(self, **kwargs):
1196 def __init__(self, **kwargs):
1197
1197
@@ -1203,35 +1203,35 class SSheightProfiles(Operation):
1203 if step == None and nsamples == None:
1203 if step == None and nsamples == None:
1204 raise ValueError, "step or nheights should be specified ..."
1204 raise ValueError, "step or nheights should be specified ..."
1205
1205
1206 self.step = step
1206 self.step = step
1207 self.nsamples = nsamples
1207 self.nsamples = nsamples
1208 self.__nChannels = dataOut.nChannels
1208 self.__nChannels = dataOut.nChannels
1209 self.__nProfiles = dataOut.nProfiles
1209 self.__nProfiles = dataOut.nProfiles
1210 self.__nHeis = dataOut.nHeights
1210 self.__nHeis = dataOut.nHeights
1211 shape = dataOut.data.shape #nchannels, nprofiles, nsamples
1211 shape = dataOut.data.shape #nchannels, nprofiles, nsamples
1212 #print "shape",shape
1212
1213 #last test
1213
1214 residue = (shape[1] - self.nsamples) % self.step
1214 residue = (shape[1] - self.nsamples) % self.step
1215 if residue != 0:
1215 if residue != 0:
1216 print "The residue is %d, step=%d should be multiple of %d to avoid loss of %d samples"%(residue,step,shape[1] - self.nsamples,residue)
1216 print "The residue is %d, step=%d should be multiple of %d to avoid loss of %d samples"%(residue,step,shape[1] - self.nsamples,residue)
1217
1217
1218 deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
1218 deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
1219 numberProfile = self.nsamples
1219 numberProfile = self.nsamples
1220 numberSamples = (shape[1] - self.nsamples)/self.step
1220 numberSamples = (shape[1] - self.nsamples)/self.step
1221
1221
1222 print "New number of profile: %d, number of height: %d, Resolution %d Km"%(numberProfile,numberSamples,deltaHeight*self.step)
1222 print "New number of profile: %d, number of height: %d, Resolution %d Km"%(numberProfile,numberSamples,deltaHeight*self.step)
1223
1223
1224 self.bufferShape = shape[0], numberSamples, numberProfile # nchannels, nsamples , nprofiles
1224 self.bufferShape = shape[0], numberSamples, numberProfile # nchannels, nsamples , nprofiles
1225 self.profileShape = shape[0], numberProfile, numberSamples # nchannels, nprofiles, nsamples
1225 self.profileShape = shape[0], numberProfile, numberSamples # nchannels, nprofiles, nsamples
1226
1226
1227 self.buffer = numpy.zeros(self.bufferShape , dtype=numpy.complex)
1227 self.buffer = numpy.zeros(self.bufferShape , dtype=numpy.complex)
1228 self.sshProfiles = numpy.zeros(self.profileShape, dtype=numpy.complex)
1228 self.sshProfiles = numpy.zeros(self.profileShape, dtype=numpy.complex)
1229
1229
1230 def run(self, dataOut, step, nsamples):
1230 def run(self, dataOut, step, nsamples):
1231
1231
1232 dataOut.flagNoData = True
1232 dataOut.flagNoData = True
1233 dataOut.flagDataAsBlock =False
1233 dataOut.flagDataAsBlock = False
1234 profileIndex = None
1234 profileIndex = None
1235
1235
1236 if not self.isConfig:
1236 if not self.isConfig:
1237 self.setup(dataOut, step=step , nsamples=nsamples)
1237 self.setup(dataOut, step=step , nsamples=nsamples)
@@ -1244,12 +1244,10 class SSheightProfiles(Operation):
1244 for j in range(self.buffer.shape[0]):
1244 for j in range(self.buffer.shape[0]):
1245 self.sshProfiles[j] = numpy.transpose(self.buffer[j])
1245 self.sshProfiles[j] = numpy.transpose(self.buffer[j])
1246
1246
1247 profileIndex = self.nsamples
1247 profileIndex = self.nsamples
1248 deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
1248 deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
1249 ippSeconds = (deltaHeight*1.0e-6)/(0.15)
1249 ippSeconds = (deltaHeight*1.0e-6)/(0.15)
1250
1250
1251 #print "hi",dataOut.ippSeconds
1252 #print ippSeconds
1253 dataOut.data = self.sshProfiles
1251 dataOut.data = self.sshProfiles
1254 dataOut.flagNoData = False
1252 dataOut.flagNoData = False
1255 dataOut.heightList = numpy.arange(self.buffer.shape[1]) *self.step*deltaHeight + dataOut.heightList[0]
1253 dataOut.heightList = numpy.arange(self.buffer.shape[1]) *self.step*deltaHeight + dataOut.heightList[0]
@@ -1258,7 +1256,6 class SSheightProfiles(Operation):
1258 dataOut.flagDataAsBlock = True
1256 dataOut.flagDataAsBlock = True
1259 dataOut.ippSeconds = ippSeconds
1257 dataOut.ippSeconds = ippSeconds
1260 dataOut.step = self.step
1258 dataOut.step = self.step
1261 #print dataOut.ippSeconds
1262
1259
1263
1260
1264 # import collections
1261 # import collections
General Comments 0
You need to be logged in to leave comments. Login now