@@ -5,7 +5,7 Created on Feb 7, 2012 | |||||
5 | @version $Id$ |
|
5 | @version $Id$ | |
6 |
|
6 | |||
7 | """ |
|
7 | """ | |
8 |
|
8 | import os | ||
9 | import numpy |
|
9 | import numpy | |
10 | import sys |
|
10 | import sys | |
11 | import time |
|
11 | import time | |
@@ -191,6 +191,19 def cmap1_init(colormap="gray"): | |||||
191 | def setColormap(colormap="jet"): |
|
191 | def setColormap(colormap="jet"): | |
192 | cmap1_init(colormap) |
|
192 | cmap1_init(colormap) | |
193 |
|
193 | |||
|
194 | def savePlplot(indexPlot,filename,ncol,nrow,width,height): | |||
|
195 | curr_strm = plplot.plgstrm() | |||
|
196 | save_strm = plplot.plmkstrm() | |||
|
197 | plplot.plsetopt("geometry", "%dx%d"%(width*ncol,height*nrow)) | |||
|
198 | plplot.plsdev("pngcairo") | |||
|
199 | plplot.plsfnam(filename) | |||
|
200 | plplot.plcpstrm(curr_strm,0) | |||
|
201 | plplot.plreplot() | |||
|
202 | plplot.plend1() | |||
|
203 | plplot.plsstrm(indexPlot) | |||
|
204 | print '' | |||
|
205 | ||||
|
206 | ||||
194 | def initPlplot(indexPlot,ncol,nrow,winTitle,width,height): |
|
207 | def initPlplot(indexPlot,ncol,nrow,winTitle,width,height): | |
195 | plplot.plsstrm(indexPlot) |
|
208 | plplot.plsstrm(indexPlot) | |
196 | plplot.plparseopts([winTitle],plplot.PL_PARSE_FULL) |
|
209 | plplot.plparseopts([winTitle],plplot.PL_PARSE_FULL) | |
@@ -547,7 +560,7 class SpectraPlot: | |||||
547 | showColorbar = None |
|
560 | showColorbar = None | |
548 | showPowerProfile = None |
|
561 | showPowerProfile = None | |
549 | XAxisAsTime = None |
|
562 | XAxisAsTime = None | |
550 |
wid |
|
563 | width = None | |
551 | height = None |
|
564 | height = None | |
552 | __spcxpos = None |
|
565 | __spcxpos = None | |
553 | __spcypos = None |
|
566 | __spcypos = None | |
@@ -722,6 +735,15 class SpectraPlot: | |||||
722 | powObj.basicXYPlot(power,y) |
|
735 | powObj.basicXYPlot(power,y) | |
723 | powObj.setXYData(power,y) |
|
736 | powObj.setXYData(power,y) | |
724 |
|
737 | |||
|
738 | def savePlot(self,indexPlot,path): | |||
|
739 | ||||
|
740 | now = datetime.datetime.now().timetuple() | |||
|
741 | file = "spc_img%02d_%03d_%02d%02d%02d"%(indexPlot,now[7],now[3],now[4],now[5]) | |||
|
742 | filename = os.path.join(path,file+".png") | |||
|
743 | savePlplot(indexPlot,filename,self.ncol,self.nrow,self.width,self.height) | |||
|
744 | ||||
|
745 | ||||
|
746 | ||||
725 | def refresh(self): |
|
747 | def refresh(self): | |
726 | plFlush() |
|
748 | plFlush() | |
727 |
|
749 |
@@ -57,7 +57,8 class Spectrum: | |||||
57 | colormap = "br_green", |
|
57 | colormap = "br_green", | |
58 | showColorbar = True, |
|
58 | showColorbar = True, | |
59 | showPowerProfile = True, |
|
59 | showPowerProfile = True, | |
60 |
XAxisAsTime = False |
|
60 | XAxisAsTime = False, | |
|
61 | save = False): | |||
61 |
|
62 | |||
62 | databuffer = 10.*numpy.log10(self.spectraObj.data_spc) |
|
63 | databuffer = 10.*numpy.log10(self.spectraObj.data_spc) | |
63 | noise = 10.*numpy.log10(self.spectraObj.noise) |
|
64 | noise = 10.*numpy.log10(self.spectraObj.noise) | |
@@ -115,5 +116,11 class Spectrum: | |||||
115 |
|
116 | |||
116 |
|
117 | |||
117 | self.colorplotObj.refresh() |
|
118 | self.colorplotObj.refresh() | |
|
119 | ||||
|
120 | if save: | |||
|
121 | self.colorplotObj.setFigure(indexPlot) | |||
|
122 | path4plot = "/Users/jro/Pictures" | |||
|
123 | self.colorplotObj.savePlot(indexPlot,path4plot) | |||
|
124 | ||||
118 |
|
125 | |||
119 |
|
126 |
@@ -284,6 +284,7 class SpectraProcessor: | |||||
284 | showColorbar=False, |
|
284 | showColorbar=False, | |
285 | showPowerProfile=False, |
|
285 | showPowerProfile=False, | |
286 | XAxisAsTime=False, |
|
286 | XAxisAsTime=False, | |
|
287 | save=False, | |||
287 | index=None): |
|
288 | index=None): | |
288 |
|
289 | |||
289 | if self.dataOutObj.flagNoData: |
|
290 | if self.dataOutObj.flagNoData: | |
@@ -305,7 +306,8 class SpectraProcessor: | |||||
305 | colormap, |
|
306 | colormap, | |
306 | showColorbar, |
|
307 | showColorbar, | |
307 | showPowerProfile, |
|
308 | showPowerProfile, | |
308 |
XAxisAsTime |
|
309 | XAxisAsTime, | |
|
310 | save) | |||
309 |
|
311 | |||
310 | self.plotterObjIndex += 1 |
|
312 | self.plotterObjIndex += 1 | |
311 |
|
313 |
@@ -79,7 +79,7 class TestSChain(): | |||||
79 | self.specProcObj.integrator(N=4) |
|
79 | self.specProcObj.integrator(N=4) | |
80 |
|
80 | |||
81 | # self.specProcObj.plotSpec(winTitle='Spectra Test', showColorbar=True,showPowerProfile=True,index=3) |
|
81 | # self.specProcObj.plotSpec(winTitle='Spectra Test', showColorbar=True,showPowerProfile=True,index=3) | |
82 | self.specProcObj.plotData(winTitle='Spectra Test', showColorbar=True,showPowerProfile=True,index=3) |
|
82 | self.specProcObj.plotData(winTitle='Spectra Test', showColorbar=True,showPowerProfile=True,save=False,index=3) | |
83 |
|
83 | |||
84 | if self.readerObj.flagNoMoreFiles: |
|
84 | if self.readerObj.flagNoMoreFiles: | |
85 | break |
|
85 | break |
General Comments 0
You need to be logged in to leave comments.
Login now