##// END OF EJS Templates
Daniel Valdez -
r134:99599f9a385b
parent child
Show More
1 NO CONTENT: new file 100644
NO CONTENT: new file 100644
@@ -1,6 +1,6
1
1
2 import numpy
2 import numpy
3 import schainPlplotLib
3 from schainPlotLib import Driver
4
4
5 class Figure:
5 class Figure:
6
6
@@ -18,7 +18,7 class Figure:
18
18
19 idfigure = None
19 idfigure = None
20 nframes = None
20 nframes = None
21 wintitle = wintitle
21 wintitle = None
22 colormap = None
22 colormap = None
23 driver = None
23 driver = None
24 overplot = None
24 overplot = None
@@ -77,14 +77,11 class Figure:
77 nx, ny = data1D.shape
77 nx, ny = data1D.shape
78
78
79 if channelList == None:
79 if channelList == None:
80 chanellList = range(nx)
80 channelList = range(nx)
81
81
82 if x == None:
82 if x == None:
83 x = numpy.arange(data1D.size)
83 x = numpy.arange(data1D.size)
84
84
85
86
87
88 if not(self.__isDriverOpen):
85 if not(self.__isDriverOpen):
89 self.__openDriver()
86 self.__openDriver()
90 self.__isDriverOpen = True
87 self.__isDriverOpen = True
@@ -98,7 +95,6 class Figure:
98 self.__createFrames()
95 self.__createFrames()
99 self.__isConfig = True
96 self.__isConfig = True
100
97
101
102 if not(self.__isOutOfXRange(x)):
98 if not(self.__isOutOfXRange(x)):
103 self.__changeXRange(x)
99 self.__changeXRange(x)
104
100
@@ -117,8 +113,7 class Figure:
117 maxvalue=maxvalue)
113 maxvalue=maxvalue)
118
114
119 self.__isFigureOpen = True
115 self.__isFigureOpen = True
120
116
121
122 for channel in channelList:
117 for channel in channelList:
123 dataCh = data1D[channel]
118 dataCh = data1D[channel]
124 frameObj = self.frameObjList[channel]
119 frameObj = self.frameObjList[channel]
@@ -142,7 +137,6 class Figure:
142
137
143 if not(self.__isConfig):
138 if not(self.__isConfig):
144 self.setRange(xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, minvalue=minvalue, maxvalue=maxvalue)
139 self.setRange(xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, minvalue=minvalue, maxvalue=maxvalue)
145
146 self.__isConfig = True
140 self.__isConfig = True
147
141
148 for channel in channelList:
142 for channel in channelList:
@@ -17,7 +17,7 class PlplotDriver:
17 __isDriverOpen = False
17 __isDriverOpen = False
18 pldriver = None
18 pldriver = None
19
19
20 def __init__(self, idfigure=None, xw, yw, wintitle, overplot, colormap, *showGraphs):
20 def __init__(self, idfigure, xw, yw, wintitle, overplot, colormap, *showGraphs):
21
21
22 if idfigure == None:
22 if idfigure == None:
23 raise ValueError, 'idfigure input must be defined'
23 raise ValueError, 'idfigure input must be defined'
@@ -38,22 +38,25 class PlplotDriver:
38 plplot.plsstrm(self.idfigure)
38 plplot.plsstrm(self.idfigure)
39 plplot.plparseopts([self.wintitle],plplot.PL_PARSE_FULL)
39 plplot.plparseopts([self.wintitle],plplot.PL_PARSE_FULL)
40 plplot.plsetopt("geometry", "%dx%d"%(self.xw, self.yw))
40 plplot.plsetopt("geometry", "%dx%d"%(self.xw, self.yw))
41
41
42 plplot.plscolbg(255,255,255)
43 plplot.plscol0(1,0,0,0)
44
42
45 def openDriver(self, pldriver=None):
43 def openDriver(self, pldriver=None):
46 if pldriver == None:
44 if pldriver == None:
47 if sys.platform == "linux":
45 if sys.platform == "linux":
48 pldriver = "xcairo"
46 pldriver = "xcairo"
49
47
48 if sys.platform == "linux2":
49 pldriver = "xcairo"
50
50 elif sys.platform == "darwin":
51 elif sys.platform == "darwin":
51 pldriver = "xwin"
52 pldriver = "xwin"
52
53
53 else:
54 else:
54 pldriver = ""
55 pldriver = ""
55
56
56 plplot.plsdev(pldriver)
57 plplot.plsdev("xwin") #para pruebas
58 plplot.plscolbg(255,255,255)
59 plplot.plscol0(1,0,0,0)
57 plplot.plinit()
60 plplot.plinit()
58 plplot.plspause(False)
61 plplot.plspause(False)
59
62
@@ -4,22 +4,13 from schainPlot import *
4 class ScopeFigure(Figure):
4 class ScopeFigure(Figure):
5 overplot = 0
5 overplot = 0
6 xw = 700
6 xw = 700
7 yw = 150
7 yw = 600
8
8
9 def __init__(self, idfigure, nframes, wintitle, driver):
9 def __init__(self,idfigure,nframes,wintitle,driver):
10
10
11 showGraphs = (0, 0)
11 args = (0, 0)
12
12 colormap = None
13 Figure.__init__(self,
13 Figure.__init__(self,idfigure,nframes,wintitle,self.xw,self.yw,self.overplot,driver,colormap,*args)
14 idfigure=idfigure,
15 nframes = nframes,
16 wintitle=wintitle,
17 xw=self.xw,
18 yw=self.yw,
19 overplot=self.overplot,
20 driver=driver,
21 colormap=None,
22 *showGraphs)
23
14
24 self.nframes = nframes
15 self.nframes = nframes
25 self.showColorbar = 0
16 self.showColorbar = 0
@@ -89,7 +80,6 class RTIFigure(Figure):
89
80
90 self.frameObjList.append(frameObj)
81 self.frameObjList.append(frameObj)
91
82
92
93 class RTIFrame(Frame):
83 class RTIFrame(Frame):
94 def __init__(self,idFrame, showColorbar, showPowerProfile):
84 def __init__(self,idFrame, showColorbar, showPowerProfile):
95 self.idFrame = idFrame
85 self.idFrame = idFrame
@@ -115,11 +105,12 class CrossSpcFrame(Frame):
115 def __init__(self):
105 def __init__(self):
116 pass
106 pass
117
107
118 class ScopeFigure(Figure):
119 def __init__(self):
120 pass
121
108
122 class ScopeFrame(Frame):
109 if __name__ == '__main__':
123 def __init__(self):
110 idfigure=0
124 pass
111 nframes=2
112 wintitle=''
113 driver='plplot'
114 scopeObj = ScopeFigure(idfigure,nframes,wintitle,driver)
115
125
116
@@ -13,7 +13,7 sys.path.append(path)
13
13
14 from Data.Voltage import Voltage
14 from Data.Voltage import Voltage
15 from IO.VoltageIO import VoltageWriter
15 from IO.VoltageIO import VoltageWriter
16
16 from Graphics.schainPlotTypes import ScopeFigure
17
17
18 class VoltageProcessor:
18 class VoltageProcessor:
19 dataInObj = None
19 dataInObj = None
@@ -26,8 +26,10 class VoltageProcessor:
26 def __init__(self):
26 def __init__(self):
27 self.integratorObjIndex = None
27 self.integratorObjIndex = None
28 self.writerObjIndex = None
28 self.writerObjIndex = None
29 self.plotObjIndex = None
29 self.integratorObjList = []
30 self.integratorObjList = []
30 self.writerObjList = []
31 self.writerObjList = []
32 self.plotObjList = []
31
33
32 def setup(self,dataInObj=None,dataOutObj=None):
34 def setup(self,dataInObj=None,dataOutObj=None):
33 self.dataInObj = dataInObj
35 self.dataInObj = dataInObj
@@ -42,20 +44,64 class VoltageProcessor:
42 def init(self):
44 def init(self):
43 self.integratorObjIndex = 0
45 self.integratorObjIndex = 0
44 self.writerObjIndex = 0
46 self.writerObjIndex = 0
47 self.plotObjIndex = 0
45
48
46 if not(self.dataInObj.flagNoData):
49 if not(self.dataInObj.flagNoData):
47 self.dataOutObj.copy(self.dataInObj)
50 self.dataOutObj.copy(self.dataInObj)
48 # No necesita copiar en cada init() los atributos de dataInObj
51 # No necesita copiar en cada init() los atributos de dataInObj
49 # la copia deberia hacerse por cada nuevo bloque de datos
52 # la copia deberia hacerse por cada nuevo bloque de datos
53
54 def addScope(self, idfigure, nframes, wintitle, driver):
55 if idfigure==None:
56 idfigure = self.plotObjIndex
57
58 scopeObj = ScopeFigure(idfigure, nframes, wintitle, driver)
59 self.plotObjList.append(scopeObj)
60
61 def plotScope(self,
62 idfigure=None,
63 minvalue=None,
64 maxvalue=None,
65 xmin=None,
66 xmax=None,
67 wintitle='',
68 driver='plplot',
69 save=False,
70 gpath=None,
71 titleList=None,
72 xlabelList=None,
73 ylabelList=None,
74 type="power"):
75
76 if self.dataOutObj.flagNoData:
77 return 0
78
79 nframes = len(self.dataOutObj.channelList)
80
81 if len(self.plotObjList) <= self.plotObjIndex:
82 self.addScope(idfigure, nframes, wintitle, driver)
83
84 self.plotObjList[self.plotObjIndex].plot1DArray(data1D=self.dataOutObj.data,
85 x=self.dataOutObj.heightList,
86 channelList=self.dataOutObj.channelList,
87 xmin=xmin,
88 xmax=xmax,
89 minvalue=minvalue,
90 maxvlaue=maxvalue,
91 save=save,
92 gpath=gpath)
93
94 self.plotObjIndex += 1
95
50
96
51 def addIntegrator(self,N,timeInterval):
97 def addIntegrator(self,N,timeInterval):
52 objCohInt = CoherentIntegrator(N,timeInterval)
98 objCohInt = CoherentIntegrator(N,timeInterval)
53 self.integratorObjList.append(objCohInt)
99 self.integratorObjList.append(objCohInt)
54
100
55 def addWriter(self, wrpath, blocksPerFile, profilesPerBlock):
101 def addWriter(self, wrpath, blocksPerFile, profilesPerBlock):
56 objWriter = VoltageWriter(self.dataOutObj)
102 writerObj = VoltageWriter(self.dataOutObj)
57 objWriter.setup(wrpath,blocksPerFile,profilesPerBlock)
103 writerObj.setup(wrpath,blocksPerFile,profilesPerBlock)
58 self.writerObjList.append(objWriter)
104 self.writerObjList.append(writerObj)
59
105
60 def writeData(self, wrpath, blocksPerFile, profilesPerBlock):
106 def writeData(self, wrpath, blocksPerFile, profilesPerBlock):
61
107
@@ -77,6 +123,7 class VoltageProcessor:
77
123
78 myCohIntObj = self.integratorObjList[self.integratorObjIndex]
124 myCohIntObj = self.integratorObjList[self.integratorObjIndex]
79 myCohIntObj.exe(data=self.dataOutObj.data,timeOfData=None)
125 myCohIntObj.exe(data=self.dataOutObj.data,timeOfData=None)
126
80
127
81
128
82 class CoherentIntegrator:
129 class CoherentIntegrator:
@@ -15,7 +15,6 from IO.VoltageIO import *
15 from Processing.VoltageProcessor import *
15 from Processing.VoltageProcessor import *
16
16
17
17
18
19 class TestSChain():
18 class TestSChain():
20
19
21 def __init__(self):
20 def __init__(self):
@@ -24,23 +23,23 class TestSChain():
24 self.testSChain()
23 self.testSChain()
25
24
26 def setValues(self):
25 def setValues(self):
27 self.path = "/Users/danielangelsuarezmunoz/Data/EW_Drifts"
26 self.path = "/home/dsuarez/RadarData/EW_DRIFTS"
28 self.startDate = datetime.date(2011,11,28)
27 self.startDate = datetime.date(2012,6,1)
29 self.endDate = datetime.date(2011,11,30)
28 self.endDate = datetime.date(2012,7,30)
30
29
31 # self.path = "/Users/danielangelsuarezmunoz/Data/Imaging_rawdata"
30 # self.path = "/Users/danielangelsuarezmunoz/Data/Imaging_rawdata"
32 # self.startDate = datetime.date(2011,10,4)
31 # self.startDate = datetime.date(2011,10,4)
33 # self.endDate = datetime.date(2011,10,4)
32 # self.endDate = datetime.date(2011,10,4)
34
33
35 # Probando los escritos por Signal Chain
34 # Probando los escritos por Signal Chain
36 self.path = "/Users/danielangelsuarezmunoz/Data/testWR"
35 # self.path = "/home/dsuarez/RadaData"
37 self.startDate = datetime.date(2011,11,28)
36 # self.startDate = datetime.date(2011,11,28)
38 self.endDate = datetime.date(2011,11,30)
37 # self.endDate = datetime.date(2011,11,30)
39
38
40 self.startTime = datetime.time(0,0,0)
39 self.startTime = datetime.time(0,0,0)
41 self.endTime = datetime.time(23,59,59)
40 self.endTime = datetime.time(23,59,59)
42
41
43 self.wrpath = "/Users/danielangelsuarezmunoz/Data/testWR"
42 self.wrpath = "/home/dsuarez/RadarData"
44 self.profilesPerBlock = 40
43 self.profilesPerBlock = 40
45 self.blocksPerFile = 50
44 self.blocksPerFile = 50
46
45
@@ -68,10 +67,18 class TestSChain():
68 while(True):
67 while(True):
69 self.readerObj.getData()
68 self.readerObj.getData()
70
69
71 # self.voltObjProc.init()
70 self.voltObjProc.init()
72 #
71 #
73 # self.voltObjProc.writeData(self.wrpath,self.profilesPerBlock,self.blocksPerFile)
72 # self.voltObjProc.writeData(self.wrpath,self.profilesPerBlock,self.blocksPerFile)
74
73
74
75 self.voltObjProc.plotScope(idfigure=1,
76 wintitle='test plot library',
77 driver='plplot',
78 save=False,
79 gpath=None,
80 type="power")
81
75 if self.readerObj.flagNoMoreFiles:
82 if self.readerObj.flagNoMoreFiles:
76 break
83 break
77
84
General Comments 0
You need to be logged in to leave comments. Login now