##// END OF EJS Templates
Desplazamiento automatico de los puntos de FFT en el modulo de lectura de espectros.
Miguel Valdez -
r26:0d3203b6912d
parent child
Show More
@@ -211,7 +211,7 class BaseGraph:
211 211 self.ylabel = ylabel
212 212 self.__colormap = colormap
213 213
214 def plotBox(self, xmin, xmax, ymin, ymax):
214 def plotBox(self, xmin, xmax, ymin, ymax, xopt=None, yopt=None):
215 215 """
216 216
217 217 """
@@ -224,7 +224,12 class BaseGraph:
224 224 float(ymin),
225 225 float(ymax)
226 226 )
227 plplot.plbox(self.__xopt, 0.0, 0, self.__yopt, 0.0, 0)
227
228 if xopt == None: xopt = self.__xopt
229 if yopt == None: yopt = self.__yopt
230
231 plplot.plbox(xopt, 0.0, 0, yopt, 0.0, 0)
232
228 233 plplot.pllab(self.xlabel, self.ylabel, self.title)
229 234
230 235
@@ -497,7 +502,7 class ColorPlot():
497 502 powObj.setName(key)
498 503 powObj.setOpt("bcntg","bc")
499 504 powObj.setup(title="Power Profile",
500 xlabel="dBs",
505 xlabel="dB",
501 506 ylabel="")
502 507
503 508 self.graphObjDict[key] = powObj
@@ -529,7 +534,7 class ColorPlot():
529 534 def setScreenPos(self, width='small'):
530 535
531 536 if width == 'small':
532 xi = 0.12; yi = 0.12; xw = 0.86; yw = 0.70; xcmapw = 0.05; xpoww = 0.26; deltaxcmap = 0.02; deltaxpow = 0.06
537 xi = 0.13; yi = 0.12; xw = 0.86; yw = 0.70; xcmapw = 0.05; xpoww = 0.26; deltaxcmap = 0.02; deltaxpow = 0.05
533 538
534 539 if width == 'medium':
535 540 xi = 0.07; yi = 0.10; xw = 0.90; yw = 0.60; xcmapw = 0.05; xpoww = 0.24; deltaxcmap = 0.02; deltaxpow = 0.06
@@ -599,7 +604,7 class ColorPlot():
599 604 cmapObj.colorbarPlot(0., 1., zmin, zmax)
600 605
601 606 if self.__showPowerProfile:
602 power = numpy.average(data, axis=0)
607 power = numpy.max(data, axis=0)
603 608
604 609 step = (ymax - ymin)/(nY-1)
605 610 heis = numpy.arange(ymin, ymax + step, step)
@@ -610,7 +615,10 class ColorPlot():
610 615 plplot.pllsty(2)
611 616 powObj.plotBox(zmin, zmax, ymin, ymax)
612 617 plplot.pllsty(1)
618 powObj.plotBox(zmin, zmax, ymin, ymax, xopt='bc', yopt='bc')
619 plplot.plcol0(9)
613 620 powObj.basicXYPlot(power, heis)
621 plplot.plcol0(1)
614 622
615 623
616 624 class ColorPlotX():
@@ -59,16 +59,23 class Spectrum():
59 59 def setup(self, titleList=None, xlabelList=None, ylabelList=None, showColorbar=False, showPowerProfile=True, XAxisAsTime=False):
60 60
61 61 nChan = int(self.m_Spectra.m_SystemHeader.numChannels)
62 channels = range(nChan)
62 63
63 myTitle = ""
64 myXlabel = ""
65 myYlabel = ""
64 myXlabel = "Radial Velocity (m/s)"
65 myYlabel = "Range (km)"
66 66
67 for i in range(nChan):
67 for i in channels:
68 68 if titleList != None:
69 69 myTitle = titleList[i]
70 70 myXlabel = xlabelList[i]
71 71 myYlabel = ylabelList[i]
72
73 if self.m_Spectra.noise != None:
74 noise = '%4.2fdB' %(self.m_Spectra.noise[i])
75 else:
76 noise = '--'
77
78 myTitle = "Channel: %d - Noise: %s" %(i, noise)
72 79
73 80 self.__addGraph(i+1,
74 81 title=myTitle,
@@ -86,7 +93,7 class Spectrum():
86 93 nx = int(numpy.sqrt(self.nGraphs)+1)
87 94 #ny = int(self.nGraphs/nx)
88 95
89 plplot.plsetopt("geometry", "%dx%d" %(400*nx, 300*nx))
96 plplot.plsetopt("geometry", "%dx%d" %(300*nx, 240*nx))
90 97 plplot.plsdev("xcairo")
91 98 plplot.plscolbg(255,255,255)
92 99 plplot.plscol0(1,0,0,0)
@@ -110,7 +117,7 class Spectrum():
110 117 if not(self.__isPlotIni):
111 118 self.iniPlot()
112 119
113 data = numpy.log10(self.m_Spectra.data_spc)
120 data = 10.*numpy.log10(self.m_Spectra.data_spc)
114 121
115 122 nX, nY, nChan = numpy.shape(data)
116 123
@@ -127,7 +134,7 class Spectrum():
127 134 plplot.plbop()
128 135 for i in range(self.nGraphs):
129 136 self.graphObjList[i].iniSubpage()
130 self.graphObjList[i].plotData(data[:,:,i],
137 self.graphObjList[i].plotData(data[i,:,:],
131 138 x,
132 139 y,
133 140 xmin=xmin,
@@ -291,11 +291,17 class ProcessingHeader:
291 291 self.deltaHeight = self.samplingWindow['dh']
292 292 self.samplesWin = self.samplingWindow['nsa']
293 293 self.spectraComb = numpy.fromfile(fp,'u1',2*self.totalSpectra)
294
294 295 if self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE == PROCFLAG.DEFINE_PROCESS_CODE:
295 296 self.numCode = numpy.fromfile(fp,'<u4',1)
296 297 self.numBaud = numpy.fromfile(fp,'<u4',1)
297 298 self.codes = numpy.fromfile(fp,'<f4',self.numCode*self.numBaud).reshape(self.numBaud,self.numCode)
298
299
300 if self.processFlags & PROCFLAG.SHIFT_FFT_DATA == PROCFLAG.SHIFT_FFT_DATA:
301 self.shif_fft = True
302 else:
303 self.shif_fft = False
304
299 305
300 306 return 1
301 307
@@ -322,6 +328,7 class ProcessingHeader:
322 328 obj.numBaud = self.numBaud
323 329 obj.codes = self.codes
324 330
331 obj.shif_fft = self.shif_fft
325 332 return obj
326 333
327 334 def write(self, fp):
@@ -385,9 +385,17 class SpectraReader(DataReader):
385 385 cspc = numpy.fromfile(self.__fp, self.__dataType, int(pts2read*Npair_CrossSpectra))
386 386 dc = numpy.fromfile(self.__fp, self.__dataType, int(self.m_ProcessingHeader.numHeights*self.m_SystemHeader.numChannels) )
387 387
388 spc = spc.reshape((self.m_ProcessingHeader.profilesPerBlock, self.m_ProcessingHeader.numHeights, Npair_SelfSpectra))
389 cspc = cspc.reshape((self.m_ProcessingHeader.profilesPerBlock, self.m_ProcessingHeader.numHeights, Npair_CrossSpectra))
390 dc = dc.reshape((self.m_ProcessingHeader.numHeights, self.m_SystemHeader.numChannels))
388 spc = spc.reshape((Npair_SelfSpectra, self.m_ProcessingHeader.numHeights, self.m_ProcessingHeader.profilesPerBlock))
389 cspc = cspc.reshape((Npair_CrossSpectra, self.m_ProcessingHeader.numHeights, self.m_ProcessingHeader.profilesPerBlock))
390 dc = dc.reshape((self.m_SystemHeader.numChannels, self.m_ProcessingHeader.numHeights))
391
392 if not(self.m_ProcessingHeader.shif_fft):
393 spc = numpy.roll(spc, self.m_ProcessingHeader.profilesPerBlock/2, axis=2)
394 cspc = numpy.roll(cspc, self.m_ProcessingHeader.profilesPerBlock/2, axis=2)
395
396 spc = numpy.transpose(spc, (0,2,1))
397 cspc = numpy.transpose(cspc, (0,2,1))
398 #dc = numpy.transpose(dc, (0,2,1))
391 399
392 400 data_spc = spc
393 401 data_cspc = cspc['real'] + cspc['imag']*1j
@@ -46,6 +46,8 class Spectra(Data):
46 46 self.nProfiles = None
47 47
48 48 self.dataType = None
49
50 self.noise = None
49 51
50 52 def copy(self):
51 53 obj = Spectra()
@@ -63,5 +65,7 class Spectra(Data):
63 65
64 66 obj.nProfiles = self.nProfiles
65 67
68 obj.noise = self.noise
69
66 70 return obj
67 71 No newline at end of file
@@ -45,6 +45,8 class Voltage(Data):
45 45
46 46 self.flagResetProcessing = False
47 47
48 self.noise = noise
49
48 50 def copy(self):
49 51 obj = Voltage()
50 52 obj.m_BasicHeader = self.m_BasicHeader.copy()
@@ -61,5 +63,7 class Voltage(Data):
61 63 obj.dataType = self.dataType
62 64 obj.flagResetProcessing = self.flagResetProcessing
63 65
66 obj.noise = self.noise
67
64 68 return obj
65 69 No newline at end of file
@@ -33,7 +33,7 class TestSChain():
33 33 #self.path = '/remote/puma/2004_11/DVD/'
34 34
35 35 self.ppath = "/home/roj-idl71/tmp/data"
36 self.startDateTime = datetime.datetime(2011,1,1,17,49,0)
36 self.startDateTime = datetime.datetime(2011,1,24,18,20,0)
37 37 self.endDateTime = datetime.datetime(2011,1,30,18,10,0)
38 38
39 39 def createObjects(self):
@@ -54,7 +54,7 class TestSChain():
54 54 ini = time.time()
55 55 while(True):
56 56 self.readerObj.getData()
57 self.plotObj.plotData(showColorbar=False, showPowerProfile=True)
57 self.plotObj.plotData(zmin=40, zmax=140, showColorbar=True, showPowerProfile=True)
58 58
59 59 # self.writerObj.putData()
60 60
General Comments 0
You need to be logged in to leave comments. Login now