From 0d3203b6912d4a414549237b103e6550c2e9cdfd 2012-02-23 22:34:04 From: Miguel Valdez Date: 2012-02-23 22:34:04 Subject: [PATCH] Desplazamiento automatico de los puntos de FFT en el modulo de lectura de espectros. --- diff --git a/schainpy/Graphics/BaseGraph.py b/schainpy/Graphics/BaseGraph.py index 6fe6017..c6186f8 100644 --- a/schainpy/Graphics/BaseGraph.py +++ b/schainpy/Graphics/BaseGraph.py @@ -211,7 +211,7 @@ class BaseGraph: self.ylabel = ylabel self.__colormap = colormap - def plotBox(self, xmin, xmax, ymin, ymax): + def plotBox(self, xmin, xmax, ymin, ymax, xopt=None, yopt=None): """ """ @@ -224,7 +224,12 @@ class BaseGraph: float(ymin), float(ymax) ) - plplot.plbox(self.__xopt, 0.0, 0, self.__yopt, 0.0, 0) + + if xopt == None: xopt = self.__xopt + if yopt == None: yopt = self.__yopt + + plplot.plbox(xopt, 0.0, 0, yopt, 0.0, 0) + plplot.pllab(self.xlabel, self.ylabel, self.title) @@ -497,7 +502,7 @@ class ColorPlot(): powObj.setName(key) powObj.setOpt("bcntg","bc") powObj.setup(title="Power Profile", - xlabel="dBs", + xlabel="dB", ylabel="") self.graphObjDict[key] = powObj @@ -529,7 +534,7 @@ class ColorPlot(): def setScreenPos(self, width='small'): if width == 'small': - xi = 0.12; yi = 0.12; xw = 0.86; yw = 0.70; xcmapw = 0.05; xpoww = 0.26; deltaxcmap = 0.02; deltaxpow = 0.06 + xi = 0.13; yi = 0.12; xw = 0.86; yw = 0.70; xcmapw = 0.05; xpoww = 0.26; deltaxcmap = 0.02; deltaxpow = 0.05 if width == 'medium': 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(): cmapObj.colorbarPlot(0., 1., zmin, zmax) if self.__showPowerProfile: - power = numpy.average(data, axis=0) + power = numpy.max(data, axis=0) step = (ymax - ymin)/(nY-1) heis = numpy.arange(ymin, ymax + step, step) @@ -610,7 +615,10 @@ class ColorPlot(): plplot.pllsty(2) powObj.plotBox(zmin, zmax, ymin, ymax) plplot.pllsty(1) + powObj.plotBox(zmin, zmax, ymin, ymax, xopt='bc', yopt='bc') + plplot.plcol0(9) powObj.basicXYPlot(power, heis) + plplot.plcol0(1) class ColorPlotX(): diff --git a/schainpy/Graphics/SpectraPlot.py b/schainpy/Graphics/SpectraPlot.py index 918971b..0195ac6 100644 --- a/schainpy/Graphics/SpectraPlot.py +++ b/schainpy/Graphics/SpectraPlot.py @@ -59,16 +59,23 @@ class Spectrum(): def setup(self, titleList=None, xlabelList=None, ylabelList=None, showColorbar=False, showPowerProfile=True, XAxisAsTime=False): nChan = int(self.m_Spectra.m_SystemHeader.numChannels) + channels = range(nChan) - myTitle = "" - myXlabel = "" - myYlabel = "" + myXlabel = "Radial Velocity (m/s)" + myYlabel = "Range (km)" - for i in range(nChan): + for i in channels: if titleList != None: myTitle = titleList[i] myXlabel = xlabelList[i] myYlabel = ylabelList[i] + + if self.m_Spectra.noise != None: + noise = '%4.2fdB' %(self.m_Spectra.noise[i]) + else: + noise = '--' + + myTitle = "Channel: %d - Noise: %s" %(i, noise) self.__addGraph(i+1, title=myTitle, @@ -86,7 +93,7 @@ class Spectrum(): nx = int(numpy.sqrt(self.nGraphs)+1) #ny = int(self.nGraphs/nx) - plplot.plsetopt("geometry", "%dx%d" %(400*nx, 300*nx)) + plplot.plsetopt("geometry", "%dx%d" %(300*nx, 240*nx)) plplot.plsdev("xcairo") plplot.plscolbg(255,255,255) plplot.plscol0(1,0,0,0) @@ -110,7 +117,7 @@ class Spectrum(): if not(self.__isPlotIni): self.iniPlot() - data = numpy.log10(self.m_Spectra.data_spc) + data = 10.*numpy.log10(self.m_Spectra.data_spc) nX, nY, nChan = numpy.shape(data) @@ -127,7 +134,7 @@ class Spectrum(): plplot.plbop() for i in range(self.nGraphs): self.graphObjList[i].iniSubpage() - self.graphObjList[i].plotData(data[:,:,i], + self.graphObjList[i].plotData(data[i,:,:], x, y, xmin=xmin, diff --git a/schainpy/IO/HeaderIO.py b/schainpy/IO/HeaderIO.py index c74e482..dc445ec 100644 --- a/schainpy/IO/HeaderIO.py +++ b/schainpy/IO/HeaderIO.py @@ -291,11 +291,17 @@ class ProcessingHeader: self.deltaHeight = self.samplingWindow['dh'] self.samplesWin = self.samplingWindow['nsa'] self.spectraComb = numpy.fromfile(fp,'u1',2*self.totalSpectra) + if self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE == PROCFLAG.DEFINE_PROCESS_CODE: self.numCode = numpy.fromfile(fp,'