@@ -1,173 +1,174 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Feb 7, 2012 |
|
2 | Created on Feb 7, 2012 | |
3 |
|
3 | |||
4 | @author $Author$ |
|
4 | @author $Author$ | |
5 | @version $Id$ |
|
5 | @version $Id$ | |
6 | ''' |
|
6 | ''' | |
7 |
|
7 | |||
8 | import os, sys |
|
8 | import os, sys | |
9 | import numpy |
|
9 | import numpy | |
10 | import datetime |
|
10 | import datetime | |
11 | import plplot |
|
11 | import plplot | |
12 |
|
12 | |||
13 | path = os.path.split(os.getcwd())[0] |
|
13 | path = os.path.split(os.getcwd())[0] | |
14 | sys.path.append(path) |
|
14 | sys.path.append(path) | |
15 |
|
15 | |||
16 | from Graphics.BaseGraph import * |
|
16 | from Graphics.BaseGraph import * | |
17 | from Model.Spectra import Spectra |
|
17 | from Model.Spectra import Spectra | |
18 |
|
18 | |||
19 | class Spectrum(): |
|
19 | class Spectrum(): | |
20 |
|
20 | |||
21 | def __init__(self, Spectra, index=0): |
|
21 | def __init__(self, Spectra, index=0): | |
22 |
|
22 | |||
23 | """ |
|
23 | """ | |
24 |
|
24 | |||
25 | Inputs: |
|
25 | Inputs: | |
26 |
|
26 | |||
27 | type: "power" ->> Potencia |
|
27 | type: "power" ->> Potencia | |
28 | "iq" ->> Real + Imaginario |
|
28 | "iq" ->> Real + Imaginario | |
29 | """ |
|
29 | """ | |
30 |
|
30 | |||
31 | self.__isPlotConfig = False |
|
31 | self.__isPlotConfig = False | |
32 |
|
32 | |||
33 | self.__isPlotIni = False |
|
33 | self.__isPlotIni = False | |
34 |
|
34 | |||
35 | self.__xrange = None |
|
35 | self.__xrange = None | |
36 |
|
36 | |||
37 | self.__yrange = None |
|
37 | self.__yrange = None | |
38 |
|
38 | |||
39 | self.nGraphs = 0 |
|
39 | self.nGraphs = 0 | |
40 |
|
40 | |||
41 | self.indexPlot = index |
|
41 | self.indexPlot = index | |
42 |
|
42 | |||
43 | self.graphObjList = [] |
|
43 | self.graphObjList = [] | |
44 |
|
44 | |||
45 | self.m_Spectra = Spectra |
|
45 | self.m_Spectra = Spectra | |
46 |
|
46 | |||
47 |
|
47 | |||
48 | def __addGraph(self, subpage, title="", xlabel="", ylabel="", showColorbar=False, showPowerProfile=True, XAxisAsTime=False): |
|
48 | def __addGraph(self, subpage, title="", xlabel="", ylabel="", showColorbar=False, showPowerProfile=True, XAxisAsTime=False): | |
49 |
|
49 | |||
50 | graphObj = ColorPlot() |
|
50 | graphObj = ColorPlot() | |
51 | graphObj.setup(subpage, |
|
51 | graphObj.setup(subpage, | |
52 | title, |
|
52 | title, | |
53 | xlabel, |
|
53 | xlabel, | |
54 | ylabel, |
|
54 | ylabel, | |
55 | showColorbar=showColorbar, |
|
55 | showColorbar=showColorbar, | |
56 | showPowerProfile=showPowerProfile, |
|
56 | showPowerProfile=showPowerProfile, | |
57 | XAxisAsTime=XAxisAsTime) |
|
57 | XAxisAsTime=XAxisAsTime) | |
58 |
|
58 | |||
59 | self.graphObjList.append(graphObj) |
|
59 | self.graphObjList.append(graphObj) | |
60 |
|
60 | |||
61 |
|
61 | |||
62 | def setup(self, titleList=None, xlabelList=None, ylabelList=None, showColorbar=False, showPowerProfile=True, XAxisAsTime=False): |
|
62 | def setup(self, titleList=None, xlabelList=None, ylabelList=None, showColorbar=False, showPowerProfile=True, XAxisAsTime=False): | |
63 |
|
63 | |||
64 | nChan = int(self.m_Spectra.m_SystemHeader.numChannels) |
|
64 | nChan = int(self.m_Spectra.m_SystemHeader.numChannels) | |
65 | channels = range(nChan) |
|
65 | channels = range(nChan) | |
66 |
|
66 | |||
67 | myXlabel = "Radial Velocity (m/s)" |
|
67 | myXlabel = "Radial Velocity (m/s)" | |
68 | myYlabel = "Range (km)" |
|
68 | myYlabel = "Range (km)" | |
69 |
|
69 | |||
70 | for i in channels: |
|
70 | for i in channels: | |
71 | if titleList != None: |
|
71 | if titleList != None: | |
72 | myTitle = titleList[i] |
|
72 | myTitle = titleList[i] | |
73 | myXlabel = xlabelList[i] |
|
73 | myXlabel = xlabelList[i] | |
74 | myYlabel = ylabelList[i] |
|
74 | myYlabel = ylabelList[i] | |
75 |
|
75 | |||
76 | # if self.m_Spectra.m_NoiseObj != None: |
|
76 | # if self.m_Spectra.m_NoiseObj != None: | |
77 | # noise = '%4.2fdB' %(self.m_Spectra.m_NoiseObj[i]) |
|
77 | # noise = '%4.2fdB' %(self.m_Spectra.m_NoiseObj[i]) | |
78 | # else: |
|
78 | # else: | |
79 | noise = '--' |
|
79 | noise = '--' | |
80 |
|
80 | |||
81 | myTitle = "Channel: %d - Noise: %s" %(i, noise) |
|
81 | myTitle = "Channel: %d - Noise: %s" %(i, noise) | |
82 |
|
82 | |||
83 | self.__addGraph(i+1, |
|
83 | self.__addGraph(i+1, | |
84 | title=myTitle, |
|
84 | title=myTitle, | |
85 | xlabel=myXlabel, |
|
85 | xlabel=myXlabel, | |
86 | ylabel=myYlabel, |
|
86 | ylabel=myYlabel, | |
87 | showColorbar=showColorbar, |
|
87 | showColorbar=showColorbar, | |
88 | showPowerProfile=showPowerProfile, |
|
88 | showPowerProfile=showPowerProfile, | |
89 | XAxisAsTime=XAxisAsTime) |
|
89 | XAxisAsTime=XAxisAsTime) | |
90 |
|
90 | |||
91 | self.nGraphs = nChan |
|
91 | self.nGraphs = nChan | |
92 | self.__isPlotConfig = True |
|
92 | self.__isPlotConfig = True | |
93 |
|
93 | |||
94 | def iniPlot(self): |
|
94 | def iniPlot(self, winTitle=""): | |
95 |
|
95 | |||
96 | nx = int(numpy.sqrt(self.nGraphs)+1) |
|
96 | nx = int(numpy.sqrt(self.nGraphs)+1) | |
97 | #ny = int(self.nGraphs/nx) |
|
97 | #ny = int(self.nGraphs/nx) | |
98 |
|
98 | |||
99 | plplot.plsstrm(self.indexPlot) |
|
99 | plplot.plsstrm(self.indexPlot) | |
|
100 | plplot.plparseopts([winTitle], plplot.PL_PARSE_FULL) | |||
100 | plplot.plsetopt("geometry", "%dx%d" %(300*nx, 240*nx)) |
|
101 | plplot.plsetopt("geometry", "%dx%d" %(300*nx, 240*nx)) | |
101 | plplot.plsdev("xwin") |
|
102 | plplot.plsdev("xwin") | |
102 | plplot.plscolbg(255,255,255) |
|
103 | plplot.plscolbg(255,255,255) | |
103 | plplot.plscol0(1,0,0,0) |
|
104 | plplot.plscol0(1,0,0,0) | |
104 | plplot.plinit() |
|
105 | plplot.plinit() | |
105 | plplot.plspause(False) |
|
106 | plplot.plspause(False) | |
106 | plplot.pladv(0) |
|
107 | plplot.pladv(0) | |
107 | plplot.plssub(nx, nx) |
|
108 | plplot.plssub(nx, nx) | |
108 |
|
109 | |||
109 | self.__nx = nx |
|
110 | self.__nx = nx | |
110 | self.__ny = nx |
|
111 | self.__ny = nx | |
111 | self.__isPlotIni = True |
|
112 | self.__isPlotIni = True | |
112 |
|
113 | |||
113 |
|
114 | |||
114 | def plotData(self, xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, titleList=None, xlabelList=None, ylabelList=None, showColorbar=False, showPowerProfile=True, XAxisAsTime=False): |
|
115 | def plotData(self, xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, titleList=None, xlabelList=None, ylabelList=None, showColorbar=False, showPowerProfile=True, XAxisAsTime=False, winTitle="Spectra"): | |
115 |
|
116 | |||
116 | if not(self.__isPlotConfig): |
|
117 | if not(self.__isPlotConfig): | |
117 | self.setup(titleList, |
|
118 | self.setup(titleList, | |
118 | xlabelList, |
|
119 | xlabelList, | |
119 | ylabelList, |
|
120 | ylabelList, | |
120 | showColorbar, |
|
121 | showColorbar, | |
121 | showPowerProfile, |
|
122 | showPowerProfile, | |
122 | XAxisAsTime) |
|
123 | XAxisAsTime) | |
123 |
|
124 | |||
124 | if not(self.__isPlotIni): |
|
125 | if not(self.__isPlotIni): | |
125 | self.iniPlot() |
|
126 | self.iniPlot() | |
126 |
|
127 | |||
127 | plplot.plsstrm(self.indexPlot) |
|
128 | plplot.plsstrm(self.indexPlot) | |
128 |
|
129 | |||
129 | data = 10.*numpy.log10(self.m_Spectra.data_spc) |
|
130 | data = 10.*numpy.log10(self.m_Spectra.data_spc) | |
130 |
|
131 | |||
131 | nX, nY, nChan = numpy.shape(data) |
|
132 | nX, nY, nChan = numpy.shape(data) | |
132 |
|
133 | |||
133 | x = numpy.arange(nX) |
|
134 | x = numpy.arange(nX) | |
134 | y = self.m_Spectra.heights |
|
135 | y = self.m_Spectra.heights | |
135 |
|
136 | |||
136 | thisDatetime = datetime.datetime.fromtimestamp(self.m_Spectra.m_BasicHeader.utc) |
|
137 | thisDatetime = datetime.datetime.fromtimestamp(self.m_Spectra.m_BasicHeader.utc) | |
137 | txtDate = "Self Spectra - Date: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
138 | txtDate = "Self Spectra - Date: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) | |
138 |
|
139 | |||
139 | if xmin == None: xmin = x[0] |
|
140 | if xmin == None: xmin = x[0] | |
140 | if xmax == None: xmax = x[-1] |
|
141 | if xmax == None: xmax = x[-1] | |
141 | if ymin == None: ymin = y[0] |
|
142 | if ymin == None: ymin = y[0] | |
142 | if ymax == None: ymax = y[-1] |
|
143 | if ymax == None: ymax = y[-1] | |
143 | if zmin == None: zmin = numpy.nanmin(abs(data)) |
|
144 | if zmin == None: zmin = numpy.nanmin(abs(data)) | |
144 | if zmax == None: zmax = numpy.nanmax(abs(data)) |
|
145 | if zmax == None: zmax = numpy.nanmax(abs(data)) | |
145 |
|
146 | |||
146 | plplot.plbop() |
|
147 | plplot.plbop() | |
147 |
|
148 | |||
148 | plplot.plssub(self.__nx, self.__ny) |
|
149 | plplot.plssub(self.__nx, self.__ny) | |
149 | for i in range(self.nGraphs): |
|
150 | for i in range(self.nGraphs): | |
150 | self.graphObjList[i].iniSubpage() |
|
151 | self.graphObjList[i].iniSubpage() | |
151 | self.graphObjList[i].plotData(data[i,:,:], |
|
152 | self.graphObjList[i].plotData(data[i,:,:], | |
152 | x, |
|
153 | x, | |
153 | y, |
|
154 | y, | |
154 | xmin=xmin, |
|
155 | xmin=xmin, | |
155 | xmax=xmax, |
|
156 | xmax=xmax, | |
156 | ymin=ymin, |
|
157 | ymin=ymin, | |
157 | ymax=ymax, |
|
158 | ymax=ymax, | |
158 | zmin=zmin, |
|
159 | zmin=zmin, | |
159 | zmax=zmax) |
|
160 | zmax=zmax) | |
160 |
|
161 | |||
161 | plplot.plssub(1,0) |
|
162 | plplot.plssub(1,0) | |
162 | plplot.pladv(0) |
|
163 | plplot.pladv(0) | |
163 | plplot.plvpor(0., 1., 0., 1.) |
|
164 | plplot.plvpor(0., 1., 0., 1.) | |
164 | plplot.plmtex("t",-1., 0.5, 0.5, txtDate) |
|
165 | plplot.plmtex("t",-1., 0.5, 0.5, txtDate) | |
165 | plplot.plflush() |
|
166 | plplot.plflush() | |
166 | plplot.pleop() |
|
167 | plplot.pleop() | |
167 |
|
168 | |||
168 | def end(self): |
|
169 | def end(self): | |
169 | plplot.plend() |
|
170 | plplot.plend() | |
170 |
|
171 | |||
171 |
|
172 | |||
172 | if __name__ == '__main__': |
|
173 | if __name__ == '__main__': | |
173 | pass No newline at end of file |
|
174 | pass |
@@ -1,181 +1,182 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Feb 7, 2012 |
|
2 | Created on Feb 7, 2012 | |
3 |
|
3 | |||
4 | @author $Author$ |
|
4 | @author $Author$ | |
5 | @version $Id$ |
|
5 | @version $Id$ | |
6 | ''' |
|
6 | ''' | |
7 | import os, sys |
|
7 | import os, sys | |
8 | import numpy |
|
8 | import numpy | |
9 | import plplot |
|
9 | import plplot | |
10 |
|
10 | |||
11 | path = os.path.split(os.getcwd())[0] |
|
11 | path = os.path.split(os.getcwd())[0] | |
12 | sys.path.append(path) |
|
12 | sys.path.append(path) | |
13 |
|
13 | |||
14 | from Graphics.BaseGraph import * |
|
14 | from Graphics.BaseGraph import * | |
15 | from Model.Voltage import Voltage |
|
15 | from Model.Voltage import Voltage | |
16 |
|
16 | |||
17 | class Osciloscope(): |
|
17 | class Osciloscope(): | |
18 |
|
18 | |||
19 | def __init__(self, Voltage, index=0): |
|
19 | def __init__(self, Voltage, index=0): | |
20 |
|
20 | |||
21 | """ |
|
21 | """ | |
22 |
|
22 | |||
23 | Inputs: |
|
23 | Inputs: | |
24 |
|
24 | |||
25 | type: "power" ->> Potencia |
|
25 | type: "power" ->> Potencia | |
26 | "iq" ->> Real + Imaginario |
|
26 | "iq" ->> Real + Imaginario | |
27 | """ |
|
27 | """ | |
28 |
|
28 | |||
29 | self.__isPlotConfig = False |
|
29 | self.__isPlotConfig = False | |
30 |
|
30 | |||
31 | self.__isPlotIni = False |
|
31 | self.__isPlotIni = False | |
32 |
|
32 | |||
33 | self.__xrange = None |
|
33 | self.__xrange = None | |
34 |
|
34 | |||
35 | self.__yrange = None |
|
35 | self.__yrange = None | |
36 |
|
36 | |||
37 | self.m_Voltage = None |
|
37 | self.m_Voltage = None | |
38 |
|
38 | |||
39 | self.nGraphs = 0 |
|
39 | self.nGraphs = 0 | |
40 |
|
40 | |||
41 | self.indexPlot = index |
|
41 | self.indexPlot = index | |
42 |
|
42 | |||
43 | self.graphObjList = [] |
|
43 | self.graphObjList = [] | |
44 |
|
44 | |||
45 | self.m_Voltage = Voltage |
|
45 | self.m_Voltage = Voltage | |
46 |
|
46 | |||
47 |
|
47 | |||
48 | def __addGraph(self, subpage, title="", xlabel="", ylabel="", XAxisAsTime=False): |
|
48 | def __addGraph(self, subpage, title="", xlabel="", ylabel="", XAxisAsTime=False): | |
49 |
|
49 | |||
50 | graphObj = LinearPlot() |
|
50 | graphObj = LinearPlot() | |
51 | graphObj.setup(subpage, title="", xlabel="", ylabel="", XAxisAsTime=False) |
|
51 | graphObj.setup(subpage, title="", xlabel="", ylabel="", XAxisAsTime=False) | |
52 | #graphObj.setScreenPos() |
|
52 | #graphObj.setScreenPos() | |
53 |
|
53 | |||
54 | self.graphObjList.append(graphObj) |
|
54 | self.graphObjList.append(graphObj) | |
55 |
|
55 | |||
56 | del graphObj |
|
56 | del graphObj | |
57 |
|
57 | |||
58 | # def setXRange(self, xmin, xmax): |
|
58 | # def setXRange(self, xmin, xmax): | |
59 | # self.__xrange = (xmin, xmax) |
|
59 | # self.__xrange = (xmin, xmax) | |
60 | # |
|
60 | # | |
61 | # def setYRange(self, ymin, ymax): |
|
61 | # def setYRange(self, ymin, ymax): | |
62 | # self.__yrange = (ymin, ymax) |
|
62 | # self.__yrange = (ymin, ymax) | |
63 |
|
63 | |||
64 |
|
64 | |||
65 | def setup(self, titleList=None, xlabelList=None, ylabelList=None, XAxisAsTime=False): |
|
65 | def setup(self, titleList=None, xlabelList=None, ylabelList=None, XAxisAsTime=False): | |
66 |
|
66 | |||
67 | nChan = int(self.m_Voltage.m_SystemHeader.numChannels) |
|
67 | nChan = int(self.m_Voltage.m_SystemHeader.numChannels) | |
68 |
|
68 | |||
69 | myTitle = "" |
|
69 | myTitle = "" | |
70 | myXlabel = "" |
|
70 | myXlabel = "" | |
71 | myYlabel = "" |
|
71 | myYlabel = "" | |
72 |
|
72 | |||
73 | for i in range(nChan): |
|
73 | for i in range(nChan): | |
74 | if titleList != None: |
|
74 | if titleList != None: | |
75 | myTitle = titleList[i] |
|
75 | myTitle = titleList[i] | |
76 | myXlabel = xlabelList[i] |
|
76 | myXlabel = xlabelList[i] | |
77 | myYlabel = ylabelList[i] |
|
77 | myYlabel = ylabelList[i] | |
78 |
|
78 | |||
79 | self.__addGraph(i+1, title=myTitle, xlabel=myXlabel, ylabel=myYlabel, XAxisAsTime=XAxisAsTime) |
|
79 | self.__addGraph(i+1, title=myTitle, xlabel=myXlabel, ylabel=myYlabel, XAxisAsTime=XAxisAsTime) | |
80 |
|
80 | |||
81 | self.nGraphs = nChan |
|
81 | self.nGraphs = nChan | |
82 | self.__isPlotConfig = True |
|
82 | self.__isPlotConfig = True | |
83 |
|
83 | |||
84 | def iniPlot(self): |
|
84 | def iniPlot(self, winTitle=""): | |
85 |
|
85 | |||
86 | plplot.plsstrm(self.indexPlot) |
|
86 | plplot.plsstrm(self.indexPlot) | |
|
87 | plplot.plparseopts([winTitle], plplot.PL_PARSE_FULL) | |||
87 | plplot.plsetopt("geometry", "%dx%d" %(700, 115*self.nGraphs)) |
|
88 | plplot.plsetopt("geometry", "%dx%d" %(700, 115*self.nGraphs)) | |
88 | plplot.plsdev("xwin") |
|
89 | plplot.plsdev("xwin") | |
89 | plplot.plscolbg(255,255,255) |
|
90 | plplot.plscolbg(255,255,255) | |
90 | plplot.plscol0(1,0,0,0) |
|
91 | plplot.plscol0(1,0,0,0) | |
91 | plplot.plinit() |
|
92 | plplot.plinit() | |
92 | plplot.plspause(False) |
|
93 | plplot.plspause(False) | |
93 | plplot.plssub(1, self.nGraphs) |
|
94 | plplot.plssub(1, self.nGraphs) | |
94 |
|
95 | |||
95 | self.__isPlotIni = True |
|
96 | self.__isPlotIni = True | |
96 |
|
97 | |||
97 | def plotData(self, xmin=None, xmax=None, ymin=None, ymax=None, idProfile=None, titleList=None, xlabelList=None, ylabelList=None, XAxisAsTime=False, type='iq'): |
|
98 | def plotData(self, xmin=None, xmax=None, ymin=None, ymax=None, idProfile=None, titleList=None, xlabelList=None, ylabelList=None, XAxisAsTime=False, type='iq', winTitle="Voltage"): | |
98 |
|
99 | |||
99 | if idProfile != None and idProfile != self.m_Voltage.idProfile: |
|
100 | if idProfile != None and idProfile != self.m_Voltage.idProfile: | |
100 | return |
|
101 | return | |
101 |
|
102 | |||
102 | if not(self.__isPlotConfig): |
|
103 | if not(self.__isPlotConfig): | |
103 | self.setup(titleList, xlabelList, ylabelList, XAxisAsTime) |
|
104 | self.setup(titleList, xlabelList, ylabelList, XAxisAsTime) | |
104 |
|
105 | |||
105 | if not(self.__isPlotIni): |
|
106 | if not(self.__isPlotIni): | |
106 | self.iniPlot() |
|
107 | self.iniPlot() | |
107 |
|
108 | |||
108 | plplot.plsstrm(self.indexPlot) |
|
109 | plplot.plsstrm(self.indexPlot) | |
109 |
|
110 | |||
110 | data = self.m_Voltage.data |
|
111 | data = self.m_Voltage.data | |
111 |
|
112 | |||
112 | x = self.m_Voltage.heights |
|
113 | x = self.m_Voltage.heights | |
113 |
|
114 | |||
114 | if xmin == None: xmin = x[0] |
|
115 | if xmin == None: xmin = x[0] | |
115 | if xmax == None: xmax = x[-1] |
|
116 | if xmax == None: xmax = x[-1] | |
116 | if ymin == None: ymin = numpy.nanmin(abs(data)) |
|
117 | if ymin == None: ymin = numpy.nanmin(abs(data)) | |
117 | if ymax == None: ymax = numpy.nanmax(abs(data)) |
|
118 | if ymax == None: ymax = numpy.nanmax(abs(data)) | |
118 |
|
119 | |||
119 | plplot.plbop() |
|
120 | plplot.plbop() | |
120 | for i in range(self.nGraphs): |
|
121 | for i in range(self.nGraphs): | |
121 | y = data[:,i] |
|
122 | y = data[:,i] | |
122 |
|
123 | |||
123 | self.graphObjList[i].iniSubpage() |
|
124 | self.graphObjList[i].iniSubpage() | |
124 | self.graphObjList[i].plotComplexData(x, y, xmin, xmax, ymin, ymax, 8, type) |
|
125 | self.graphObjList[i].plotComplexData(x, y, xmin, xmax, ymin, ymax, 8, type) | |
125 |
|
126 | |||
126 | plplot.plflush() |
|
127 | plplot.plflush() | |
127 | plplot.pleop() |
|
128 | plplot.pleop() | |
128 |
|
129 | |||
129 | def end(self): |
|
130 | def end(self): | |
130 | plplot.plend() |
|
131 | plplot.plend() | |
131 |
|
132 | |||
132 | class VoltagePlot(object): |
|
133 | class VoltagePlot(object): | |
133 | ''' |
|
134 | ''' | |
134 | classdocs |
|
135 | classdocs | |
135 | ''' |
|
136 | ''' | |
136 |
|
137 | |||
137 | __m_Voltage = None |
|
138 | __m_Voltage = None | |
138 |
|
139 | |||
139 | def __init__(self, m_Voltage): |
|
140 | def __init__(self, m_Voltage): | |
140 | ''' |
|
141 | ''' | |
141 | Constructor |
|
142 | Constructor | |
142 | ''' |
|
143 | ''' | |
143 | self.__m_Voltage = m_Voltage |
|
144 | self.__m_Voltage = m_Voltage | |
144 |
|
145 | |||
145 | def setup(self): |
|
146 | def setup(self): | |
146 | pass |
|
147 | pass | |
147 |
|
148 | |||
148 | def addGraph(self, type, xrange=None, yrange=None, zrange=None): |
|
149 | def addGraph(self, type, xrange=None, yrange=None, zrange=None): | |
149 | pass |
|
150 | pass | |
150 |
|
151 | |||
151 | def plotData(self): |
|
152 | def plotData(self): | |
152 | pass |
|
153 | pass | |
153 |
|
154 | |||
154 | if __name__ == '__main__': |
|
155 | if __name__ == '__main__': | |
155 |
|
156 | |||
156 | import numpy |
|
157 | import numpy | |
157 |
|
158 | |||
158 | plplot.plsetopt("geometry", "%dx%d" %(450*2, 200*2)) |
|
159 | plplot.plsetopt("geometry", "%dx%d" %(450*2, 200*2)) | |
159 | plplot.plsdev("xcairo") |
|
160 | plplot.plsdev("xcairo") | |
160 | plplot.plscolbg(255,255,255) |
|
161 | plplot.plscolbg(255,255,255) | |
161 | plplot.plscol0(1,0,0,0) |
|
162 | plplot.plscol0(1,0,0,0) | |
162 | plplot.plinit() |
|
163 | plplot.plinit() | |
163 | plplot.plssub(1, 2) |
|
164 | plplot.plssub(1, 2) | |
164 |
|
165 | |||
165 | nx = 64 |
|
166 | nx = 64 | |
166 | ny = 100 |
|
167 | ny = 100 | |
167 |
|
168 | |||
168 | data = numpy.random.uniform(-50,50,(nx,ny)) |
|
169 | data = numpy.random.uniform(-50,50,(nx,ny)) | |
169 |
|
170 | |||
170 | baseObj = RTI() |
|
171 | baseObj = RTI() | |
171 | baseObj.setup(1, "Spectrum", "Frequency", "Range", "br_green", False, False) |
|
172 | baseObj.setup(1, "Spectrum", "Frequency", "Range", "br_green", False, False) | |
172 | baseObj.plotData(data) |
|
173 | baseObj.plotData(data) | |
173 |
|
174 | |||
174 | data = numpy.random.uniform(-50,50,(nx,ny)) |
|
175 | data = numpy.random.uniform(-50,50,(nx,ny)) | |
175 |
|
176 | |||
176 | base2Obj = RTI() |
|
177 | base2Obj = RTI() | |
177 | base2Obj.setup(2, "Spectrum", "Frequency", "Range", "br_green", True, True) |
|
178 | base2Obj.setup(2, "Spectrum", "Frequency", "Range", "br_green", True, True) | |
178 | base2Obj.plotData(data) |
|
179 | base2Obj.plotData(data) | |
179 |
|
180 | |||
180 | plplot.plend() |
|
181 | plplot.plend() | |
181 | exit(0) No newline at end of file |
|
182 | exit(0) |
General Comments 0
You need to be logged in to leave comments.
Login now