diff --git a/schainpy2/Graphics/schainPlot.py b/schainpy2/Graphics/schainPlot.py index 7bdc643..e9fc691 100644 --- a/schainpy2/Graphics/schainPlot.py +++ b/schainpy2/Graphics/schainPlot.py @@ -68,13 +68,18 @@ class Figure: self.drvObj.driver.openDriver() - def __initFigure(self): + def __newPage(self): + + self.drvObj.driver.openPage() nrows, ncolumns = self.getSubplots() - self.drvObj.driver.openFigure() self.drvObj.driver.setFigTitle(self.figuretitle) self.drvObj.driver.setSubPlots(nrows, ncolumns) - + + def __closePage(self): + + self.drvObj.driver.closeFigure() + def selectFigure(self): self.drvObj.driver.selectFigure() @@ -96,6 +101,9 @@ class Figure: self.drvObj.driver.refresh() def createFrames(self): + + self.frameObjList = [] + raise ValueError, "No implemented" def save(self,filename): @@ -174,7 +182,7 @@ class Figure: filename = os.path.join(path,file) self.save(filename) - + self.__closeFigure() def plotPcolor(self,data, @@ -201,7 +209,6 @@ class Figure: else: self.figuretitle = figuretitle - if not(self.__isDriverOpen): self.__openDriver() @@ -219,12 +226,12 @@ class Figure: if not(self.changeXRange(x)): return 0 - self.__isFigureOpen = False + self.__closeFigure() + + self.selectFigure() if not(self.__isFigureOpen): - - - self.__initFigure() + self.__newPage() self.__isFigureOpen = True for channel in channelList: @@ -242,7 +249,7 @@ class Figure: self.deltay, self.colorbar, value) - self.selectFigure() + for channel in channelList: dataCh = data[channel,:] @@ -252,7 +259,9 @@ class Figure: self.__refresh() if clearData == True: + self.__closePage() self.__isFigureOpen = False + diff --git a/schainpy2/Graphics/schainPlotTypes.py b/schainpy2/Graphics/schainPlotTypes.py index e9b2b8d..f68e031 100644 --- a/schainpy2/Graphics/schainPlotTypes.py +++ b/schainpy2/Graphics/schainPlotTypes.py @@ -43,6 +43,9 @@ class SpcFigure(Figure): pass def createFrames(self): + + self.frameObjList = [] + for frame in range(self.nframes): frameObj = SpcFrame(self.drvObj,frame + 1, self.colorbar, self.showprofile) self.frameObjList.append(frameObj) @@ -267,6 +270,9 @@ class RTIFigure(Figure): return 0 def createFrames(self): + + self.frameObjList = [] + for frame in range(self.nframes): frameObj = RTIFrame(self.drvObj,frame + 1, self.colorbar, self.showprofile) self.frameObjList.append(frameObj) @@ -427,6 +433,9 @@ class ScopeFigure(Figure): return nrows, ncolumns def createFrames(self): + + self.frameObjList = [] + for frame in range(self.nframes): frameObj = ScopeFrame(self.drvObj,frame + 1) self.frameObjList.append(frameObj) diff --git a/schainpy2/Processing/SpectraProcessor.py b/schainpy2/Processing/SpectraProcessor.py index b36f54e..5cbc80e 100644 --- a/schainpy2/Processing/SpectraProcessor.py +++ b/schainpy2/Processing/SpectraProcessor.py @@ -277,21 +277,22 @@ class SpectraProcessor: plotObj = self.plotObjList[self.plotObjIndex] plotObj.plotPcolor(data, - x, - y, - channelList, - xmin, - xmax, - ymin, - ymax, - minvalue, - maxvalue, - figuretitle, - None, - save, - gpath, - cleardata, - titleList) + x=x, + y=y, + channelList=channelList, + xmin=xmin, + xmax=xmax, + ymin=ymin, + ymax=ymax, + minvalue=minvalue, + maxvalue=maxvalue, + figuretitle=figuretitle, + xrangestep=None, + deltax=None, + save=False, + gpath='./', + clearData=True + ) self.plotObjIndex += 1 diff --git a/schainpy2/testSchainExp.py b/schainpy2/testSchainExp.py index 873c7ac..96a316e 100644 --- a/schainpy2/testSchainExp.py +++ b/schainpy2/testSchainExp.py @@ -13,7 +13,7 @@ from Data.JROData import Voltage from IO.VoltageIO import * from Processing.VoltageProcessor import * - +from Processing.SpectraProcessor import * class TestSChain(): @@ -24,13 +24,16 @@ class TestSChain(): def setValues(self): self.path = "/home/roj-idl71/Data/RAWDATA/Meteors" + self.path = "/remote/puma/2012_06/Meteors" - self.startDate = datetime.date(2005,1,1) - self.endDate = datetime.date(2012,7,30) + self.startDate = datetime.date(2012,1,1) + self.endDate = datetime.date(2012,12,30) self.startTime = datetime.time(0,0,0) self.endTime = datetime.time(23,59,59) + self.nFFTPoints = 64 + self.wrpath = "/home/roj-idl71/tmp/results" self.profilesPerBlock = 40 self.blocksPerFile = 50 @@ -51,6 +54,7 @@ class TestSChain(): online = 0) self.voltObj2 = self.voltProcObj.setup(dataInObj = self.voltObj1) + self.specObj1 = self.specProcObj.setup(dataInObj = self.voltObj2, nFFTPoints = self.nFFTPoints) def testSChain(self): @@ -61,17 +65,28 @@ class TestSChain(): self.voltProcObj.init() - self.voltProcObj.integrator(1000, overlapping=True) + self.voltProcObj.integrator(10, overlapping=False) # # self.voltProcObj.writeData(self.wrpath,self.profilesPerBlock,self.blocksPerFile) - self.voltProcObj.plotScope(idfigure=1, - wintitle='test plot library', - driver='plplot', - save=False, - gpath=None, - type="power") +# self.voltProcObj.plotScope(idfigure=0, +# wintitle='test plot library', +# driver='plplot', +# save=False, +# gpath=None, +# type="power") + + self.specProcObj.init() + + self.specProcObj.plotSpc(idfigure=1, + wintitle='Spectra', + driver='plplot', + colormap='br_green', + colorbar=True, + showprofile=False, + save=False, + gpath=None) if self.readerObj.flagNoMoreFiles: break @@ -79,7 +94,7 @@ class TestSChain(): if self.readerObj.flagIsNewBlock: # print 'Block No %04d, Time: %s' %(self.readerObj.nTotalBlocks, datetime.datetime.fromtimestamp(self.readerObj.basicHeaderObj.utc),) print 'Block No %04d, Time: %s' %(self.readerObj.nTotalBlocks, - datetime.datetime.utcfromtimestamp(self.readerObj.basicHeaderObj.utc + self.readerObj.basicHeaderObj.miliSecond/1000.0),) + datetime.datetime.fromtimestamp(self.readerObj.basicHeaderObj.utc + self.readerObj.basicHeaderObj.miliSecond/1000.0),) if __name__ == '__main__':