##// END OF EJS Templates
Correcciones y se agrega metodo para guardar plots en disco, aun no funciona satisfactoriamente
Daniel Valdez -
r110:fcb6f29e1f37
parent child
Show More
@@ -5,7 +5,7 Created on Feb 7, 2012
5 5 @version $Id$
6 6
7 7 """
8
8 import os
9 9 import numpy
10 10 import sys
11 11 import time
@@ -191,6 +191,19 def cmap1_init(colormap="gray"):
191 191 def setColormap(colormap="jet"):
192 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 207 def initPlplot(indexPlot,ncol,nrow,winTitle,width,height):
195 208 plplot.plsstrm(indexPlot)
196 209 plplot.plparseopts([winTitle],plplot.PL_PARSE_FULL)
@@ -547,7 +560,7 class SpectraPlot:
547 560 showColorbar = None
548 561 showPowerProfile = None
549 562 XAxisAsTime = None
550 widht = None
563 width = None
551 564 height = None
552 565 __spcxpos = None
553 566 __spcypos = None
@@ -722,6 +735,15 class SpectraPlot:
722 735 powObj.basicXYPlot(power,y)
723 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 747 def refresh(self):
726 748 plFlush()
727 749
@@ -57,7 +57,8 class Spectrum:
57 57 colormap = "br_green",
58 58 showColorbar = True,
59 59 showPowerProfile = True,
60 XAxisAsTime = False):
60 XAxisAsTime = False,
61 save = False):
61 62
62 63 databuffer = 10.*numpy.log10(self.spectraObj.data_spc)
63 64 noise = 10.*numpy.log10(self.spectraObj.noise)
@@ -115,5 +116,11 class Spectrum:
115 116
116 117
117 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 284 showColorbar=False,
285 285 showPowerProfile=False,
286 286 XAxisAsTime=False,
287 save=False,
287 288 index=None):
288 289
289 290 if self.dataOutObj.flagNoData:
@@ -305,7 +306,8 class SpectraProcessor:
305 306 colormap,
306 307 showColorbar,
307 308 showPowerProfile,
308 XAxisAsTime)
309 XAxisAsTime,
310 save)
309 311
310 312 self.plotterObjIndex += 1
311 313
@@ -79,7 +79,7 class TestSChain():
79 79 self.specProcObj.integrator(N=4)
80 80
81 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 84 if self.readerObj.flagNoMoreFiles:
85 85 break
General Comments 0
You need to be logged in to leave comments. Login now