@@ -8,7 +8,7 Created on Feb 7, 2012 | |||||
8 | import numpy |
|
8 | import numpy | |
9 | import plplot |
|
9 | import plplot | |
10 |
|
10 | |||
11 |
from Bas |
|
11 | from BaseGraph import * | |
12 |
|
12 | |||
13 | class Spectrum: |
|
13 | class Spectrum: | |
14 |
|
14 | |||
@@ -20,17 +20,17 class Spectrum: | |||||
20 | __xrange = None |
|
20 | __xrange = None | |
21 | __yrange = None |
|
21 | __yrange = None | |
22 | __zrange = None |
|
22 | __zrange = None | |
23 |
s |
|
23 | baseObj = BaseGraph() | |
24 |
|
24 | |||
25 |
|
25 | |||
26 | def __init__(self): |
|
26 | def __init__(self): | |
27 |
|
27 | |||
28 | key = "spec" |
|
28 | key = "spec" | |
29 |
|
29 | |||
30 |
s |
|
30 | baseObj = BaseGraph() | |
31 |
s |
|
31 | baseObj.setName(key) | |
32 |
|
32 | |||
33 |
self.graphObjDict[key] = s |
|
33 | self.graphObjDict[key] = baseObj | |
34 |
|
34 | |||
35 |
|
35 | |||
36 | def setup(self, subpage, title="", xlabel="", ylabel="", colormap="jet", showColorbar=False, showPowerProfile=False): |
|
36 | def setup(self, subpage, title="", xlabel="", ylabel="", colormap="jet", showColorbar=False, showPowerProfile=False): | |
@@ -43,11 +43,11 class Spectrum: | |||||
43 | xcmapi = xcmapf = 0.; xpowi = xpowf = 0. |
|
43 | xcmapi = xcmapf = 0.; xpowi = xpowf = 0. | |
44 |
|
44 | |||
45 | key = "spec" |
|
45 | key = "spec" | |
46 |
s |
|
46 | baseObj = self.graphObjDict[key] | |
47 |
s |
|
47 | baseObj.setSubpage(subpage) | |
48 |
s |
|
48 | baseObj.setSzchar(self.__szchar) | |
49 |
s |
|
49 | baseObj.setOpt("bcnts","bcnts") | |
50 |
s |
|
50 | baseObj.setup(title, | |
51 | xlabel, |
|
51 | xlabel, | |
52 | ylabel, |
|
52 | ylabel, | |
53 | colormap) |
|
53 | colormap) | |
@@ -55,7 +55,7 class Spectrum: | |||||
55 | if showColorbar: |
|
55 | if showColorbar: | |
56 | key = "colorbar" |
|
56 | key = "colorbar" | |
57 |
|
57 | |||
58 |
cmapObj = Bas |
|
58 | cmapObj = BaseGraph() | |
59 | cmapObj.setName(key) |
|
59 | cmapObj.setName(key) | |
60 | cmapObj.setSubpage(subpage) |
|
60 | cmapObj.setSubpage(subpage) | |
61 | cmapObj.setSzchar(self.__szchar) |
|
61 | cmapObj.setSzchar(self.__szchar) | |
@@ -74,7 +74,7 class Spectrum: | |||||
74 | if showPowerProfile: |
|
74 | if showPowerProfile: | |
75 | key = "powerprof" |
|
75 | key = "powerprof" | |
76 |
|
76 | |||
77 |
powObj = Bas |
|
77 | powObj = BaseGraph() | |
78 | powObj.setName(key) |
|
78 | powObj.setName(key) | |
79 | powObj.setSubpage(subpage) |
|
79 | powObj.setSubpage(subpage) | |
80 | powObj.setSzchar(self.__szchar) |
|
80 | powObj.setSzchar(self.__szchar) | |
@@ -95,7 +95,7 class Spectrum: | |||||
95 | yf = yi + yw |
|
95 | yf = yi + yw | |
96 | xcmapf = xf |
|
96 | xcmapf = xf | |
97 |
|
97 | |||
98 |
s |
|
98 | baseObj.setScreenPos([xi, xf], [yi, yf]) | |
99 |
|
99 | |||
100 | if showColorbar: |
|
100 | if showColorbar: | |
101 | xcmapi = xf + 0.02 |
|
101 | xcmapi = xf + 0.02 | |
@@ -108,7 +108,7 class Spectrum: | |||||
108 | powObj.setScreenPos([xpowi, xpowf], [yi, yf]) |
|
108 | powObj.setScreenPos([xpowi, xpowf], [yi, yf]) | |
109 |
|
109 | |||
110 |
|
110 | |||
111 |
# s |
|
111 | # baseObj.initSubpage() | |
112 | # |
|
112 | # | |
113 | # if showColorbar: |
|
113 | # if showColorbar: | |
114 | # cmapObj.initPlot() |
|
114 | # cmapObj.initPlot() | |
@@ -122,8 +122,8 class Spectrum: | |||||
122 | def setRanges(self, xrange, yrange, zrange): |
|
122 | def setRanges(self, xrange, yrange, zrange): | |
123 |
|
123 | |||
124 | key = "spec" |
|
124 | key = "spec" | |
125 |
s |
|
125 | baseObj = self.graphObjDict[key] | |
126 |
s |
|
126 | baseObj.setRanges(xrange, yrange, zrange) | |
127 |
|
127 | |||
128 | keyList = self.graphObjDict.keys() |
|
128 | keyList = self.graphObjDict.keys() | |
129 |
|
129 | |||
@@ -140,8 +140,8 class Spectrum: | |||||
140 | def plotData(self, data , xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None): |
|
140 | def plotData(self, data , xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None): | |
141 |
|
141 | |||
142 | key = "spec" |
|
142 | key = "spec" | |
143 |
s |
|
143 | baseObj = self.graphObjDict[key] | |
144 |
s |
|
144 | baseObj.initSubpage() | |
145 |
|
145 | |||
146 | if xmin == None: |
|
146 | if xmin == None: | |
147 | xmin = 0. |
|
147 | xmin = 0. | |
@@ -161,10 +161,10 class Spectrum: | |||||
161 | if zmax == None: |
|
161 | if zmax == None: | |
162 | zmax = numpy.nanmax(data) |
|
162 | zmax = numpy.nanmax(data) | |
163 |
|
163 | |||
164 |
if not(s |
|
164 | if not(baseObj.hasRange): | |
165 | self.setRanges([xmin, xmax], [ymin,ymax], [zmin,zmax]) |
|
165 | self.setRanges([xmin, xmax], [ymin,ymax], [zmin,zmax]) | |
166 |
|
166 | |||
167 |
s |
|
167 | baseObj.basicPcolorPlot(data, xmin, xmax, ymin, ymax, baseObj.zrange[0], baseObj.zrange[1]) | |
168 |
|
168 | |||
169 | if self.showColorbar: |
|
169 | if self.showColorbar: | |
170 | key = "colorbar" |
|
170 | key = "colorbar" | |
@@ -191,7 +191,7 class CrossSpectrum: | |||||
191 | __xrange = None |
|
191 | __xrange = None | |
192 | __yrange = None |
|
192 | __yrange = None | |
193 | __zrange = None |
|
193 | __zrange = None | |
194 |
m_Bas |
|
194 | m_BaseGraph= BaseGraph() | |
195 |
|
195 | |||
196 | def __init__(self): |
|
196 | def __init__(self): | |
197 | pass |
|
197 | pass | |
@@ -220,13 +220,13 if __name__ == '__main__': | |||||
220 |
|
220 | |||
221 | data = numpy.random.uniform(-50,50,(nx,ny)) |
|
221 | data = numpy.random.uniform(-50,50,(nx,ny)) | |
222 |
|
222 | |||
223 |
s |
|
223 | baseObj = ColorPlot() | |
224 |
s |
|
224 | baseObj.setup(1, "Spectrum", "Frequency", "Range", "br_green", False, False) | |
225 |
s |
|
225 | baseObj.plotData(data) | |
226 |
|
226 | |||
227 | data = numpy.random.uniform(-50,50,(nx,ny)) |
|
227 | data = numpy.random.uniform(-50,50,(nx,ny)) | |
228 |
|
228 | |||
229 |
spec2Obj = |
|
229 | spec2Obj = ColorPlot() | |
230 | spec2Obj.setup(2, "Spectrum", "Frequency", "Range", "br_green", True, True) |
|
230 | spec2Obj.setup(2, "Spectrum", "Frequency", "Range", "br_green", True, True) | |
231 | spec2Obj.plotData(data) |
|
231 | spec2Obj.plotData(data) | |
232 |
|
232 |
@@ -4,15 +4,93 Created on Feb 7, 2012 | |||||
4 | @author $Author$ |
|
4 | @author $Author$ | |
5 | @version $Id$ |
|
5 | @version $Id$ | |
6 | ''' |
|
6 | ''' | |
|
7 | import os, sys | |||
|
8 | import numpy | |||
|
9 | import plplot | |||
7 |
|
10 | |||
|
11 | path = os.path.split(os.getcwd())[0] | |||
|
12 | sys.path.append(path) | |||
|
13 | ||||
|
14 | from Graphics.BasicGraph import * | |||
|
15 | from Model.Voltage import Voltage | |||
|
16 | ||||
|
17 | class Osciloscope(): | |||
|
18 | ||||
|
19 | graphObjDict = {} | |||
|
20 | showPower = True | |||
|
21 | ||||
|
22 | __szchar = 0.7 | |||
|
23 | __xrange = None | |||
|
24 | __yrange = None | |||
|
25 | __zrange = None | |||
|
26 | ||||
|
27 | def __init__(self): | |||
|
28 | key = "osc" | |||
|
29 | ||||
|
30 | baseObj = BasicGraph() | |||
|
31 | baseObj.setName(key) | |||
|
32 | ||||
|
33 | self.graphObjDict[key] = baseObj | |||
|
34 | ||||
|
35 | ||||
|
36 | def setup(self, subpage, title="", xlabel="", ylabel="", colormap="jet", showColorbar=False, showPowerProfile=False): | |||
|
37 | pass | |||
|
38 | ||||
|
39 | def setRanges(self, xrange, yrange, zrange): | |||
|
40 | pass | |||
|
41 | ||||
|
42 | def plotData(self, data , xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None): | |||
|
43 | pass | |||
|
44 | ||||
|
45 | ||||
|
46 | ||||
8 | class VoltagePlot(object): |
|
47 | class VoltagePlot(object): | |
9 | ''' |
|
48 | ''' | |
10 | classdocs |
|
49 | classdocs | |
11 | ''' |
|
50 | ''' | |
12 |
|
51 | |||
13 |
|
52 | __m_Voltage = None | ||
14 | def __init__(self): |
|
53 | ||
|
54 | def __init__(self, m_Voltage): | |||
15 | ''' |
|
55 | ''' | |
16 | Constructor |
|
56 | Constructor | |
17 | ''' |
|
57 | ''' | |
18 | pass No newline at end of file |
|
58 | self.__m_Voltage = m_Voltage | |
|
59 | ||||
|
60 | def setup(self): | |||
|
61 | pass | |||
|
62 | ||||
|
63 | def addGraph(self, type, xrange=None, yrange=None, zrange=None): | |||
|
64 | pass | |||
|
65 | ||||
|
66 | def plotData(self): | |||
|
67 | pass | |||
|
68 | ||||
|
69 | if __name__ == '__main__': | |||
|
70 | ||||
|
71 | import numpy | |||
|
72 | ||||
|
73 | plplot.plsetopt("geometry", "%dx%d" %(450*2, 200*2)) | |||
|
74 | plplot.plsdev("xcairo") | |||
|
75 | plplot.plscolbg(255,255,255) | |||
|
76 | plplot.plscol0(1,0,0,0) | |||
|
77 | plplot.plinit() | |||
|
78 | plplot.plssub(1, 2) | |||
|
79 | ||||
|
80 | nx = 64 | |||
|
81 | ny = 100 | |||
|
82 | ||||
|
83 | data = numpy.random.uniform(-50,50,(nx,ny)) | |||
|
84 | ||||
|
85 | baseObj = RTI() | |||
|
86 | baseObj.setup(1, "Spectrum", "Frequency", "Range", "br_green", False, False) | |||
|
87 | baseObj.plotData(data) | |||
|
88 | ||||
|
89 | data = numpy.random.uniform(-50,50,(nx,ny)) | |||
|
90 | ||||
|
91 | base2Obj = RTI() | |||
|
92 | base2Obj.setup(2, "Spectrum", "Frequency", "Range", "br_green", True, True) | |||
|
93 | base2Obj.plotData(data) | |||
|
94 | ||||
|
95 | plplot.plend() | |||
|
96 | exit(0) No newline at end of file |
@@ -12,13 +12,13 import fnmatch | |||||
12 | import time |
|
12 | import time | |
13 | import datetime |
|
13 | import datetime | |
14 |
|
14 | |||
|
15 | path = os.path.split(os.getcwd())[0] | |||
|
16 | sys.path.append(path) | |||
|
17 | ||||
15 | from IO.Header import * |
|
18 | from IO.Header import * | |
16 | from IO.Data import DataReader |
|
19 | from IO.Data import DataReader | |
17 | from IO.Data import DataWriter |
|
20 | from IO.Data import DataWriter | |
18 |
|
21 | |||
19 | path = os.path.split(os.getcwd())[0] |
|
|||
20 | sys.path.append(path) |
|
|||
21 |
|
||||
22 | from Model.Voltage import Voltage |
|
22 | from Model.Voltage import Voltage | |
23 |
|
23 | |||
24 | class VoltageReader(DataReader): |
|
24 | class VoltageReader(DataReader): | |
@@ -382,6 +382,7 class VoltageReader(DataReader): | |||||
382 | print 'Process finished' |
|
382 | print 'Process finished' | |
383 | return None |
|
383 | return None | |
384 |
|
384 | |||
|
385 | #data es un numpy array de 3 dmensiones (perfiles, alturas y canales) | |||
385 | data = self.__buffer[self.__buffer_id,:,:] |
|
386 | data = self.__buffer[self.__buffer_id,:,:] | |
386 |
|
387 | |||
387 | time = self.m_BasicHeader.utc + self.__buffer_id*self.__ippSeconds |
|
388 | time = self.m_BasicHeader.utc + self.__buffer_id*self.__ippSeconds |
@@ -26,6 +26,7 class Voltage(Data): | |||||
26 |
|
26 | |||
27 | m_BasicHeader= BasicHeader() |
|
27 | m_BasicHeader= BasicHeader() | |
28 |
|
28 | |||
|
29 | #data es un numpy array de 3 dmensiones (perfiles, alturas y canales) | |||
29 | data = None |
|
30 | data = None | |
30 |
|
31 | |||
31 | noData = True |
|
32 | noData = True |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now