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