@@ -1,1425 +1,1425 | |||||
1 |
|
1 | |||
2 | import os |
|
2 | import os | |
3 | import time |
|
3 | import time | |
4 | import math |
|
4 | import math | |
5 | import datetime |
|
5 | import datetime | |
6 | import numpy |
|
6 | import numpy | |
7 | from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator #YONG |
|
7 | from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator #YONG | |
8 |
|
8 | |||
9 | from .jroplot_spectra import RTIPlot, NoisePlot |
|
9 | from .jroplot_spectra import RTIPlot, NoisePlot | |
10 |
|
10 | |||
11 | from schainpy.utils import log |
|
11 | from schainpy.utils import log | |
12 | from .plotting_codes import * |
|
12 | from .plotting_codes import * | |
13 |
|
13 | |||
14 | from schainpy.model.graphics.jroplot_base import Plot, plt |
|
14 | from schainpy.model.graphics.jroplot_base import Plot, plt | |
15 |
|
15 | |||
16 | import matplotlib.pyplot as plt |
|
16 | import matplotlib.pyplot as plt | |
17 | import matplotlib.colors as colors |
|
17 | import matplotlib.colors as colors | |
18 | from matplotlib.ticker import MultipleLocator, LogLocator, NullFormatter |
|
18 | from matplotlib.ticker import MultipleLocator, LogLocator, NullFormatter | |
19 |
|
19 | |||
20 |
|
20 | |||
21 | class RTIDPPlot(RTIPlot): |
|
21 | class RTIDPPlot(RTIPlot): | |
22 | ''' |
|
22 | ''' | |
23 | Written by R. Flores |
|
23 | Written by R. Flores | |
24 | ''' |
|
24 | ''' | |
25 | '''Plot for RTI Double Pulse Experiment Using Cross Products Analysis |
|
25 | '''Plot for RTI Double Pulse Experiment Using Cross Products Analysis | |
26 | ''' |
|
26 | ''' | |
27 |
|
27 | |||
28 | CODE = 'RTIDP' |
|
28 | CODE = 'RTIDP' | |
29 | colormap = 'jro' |
|
29 | colormap = 'jro' | |
30 | plot_name = 'RTI' |
|
30 | plot_name = 'RTI' | |
31 |
|
31 | |||
32 | def setup(self): |
|
32 | def setup(self): | |
33 | self.xaxis = 'time' |
|
33 | self.xaxis = 'time' | |
34 | self.ncols = 1 |
|
34 | self.ncols = 1 | |
35 | self.nrows = 3 |
|
35 | self.nrows = 3 | |
36 | self.nplots = self.nrows |
|
36 | self.nplots = self.nrows | |
37 | #self.height=10 |
|
37 | #self.height=10 | |
38 | if self.showSNR: |
|
38 | if self.showSNR: | |
39 | self.nrows += 1 |
|
39 | self.nrows += 1 | |
40 | self.nplots += 1 |
|
40 | self.nplots += 1 | |
41 |
|
41 | |||
42 | self.ylabel = 'Height [km]' |
|
42 | self.ylabel = 'Height [km]' | |
43 | self.xlabel = 'Time (LT)' |
|
43 | self.xlabel = 'Time (LT)' | |
44 |
|
44 | |||
45 | self.cb_label = 'Intensity (dB)' |
|
45 | self.cb_label = 'Intensity (dB)' | |
46 |
|
46 | |||
47 | self.titles = ['{} Channel {}'.format( |
|
47 | self.titles = ['{} Channel {}'.format( | |
48 | self.plot_name.upper(), '0x1'),'{} Channel {}'.format( |
|
48 | self.plot_name.upper(), '0x1'),'{} Channel {}'.format( | |
49 | self.plot_name.upper(), '0'),'{} Channel {}'.format( |
|
49 | self.plot_name.upper(), '0'),'{} Channel {}'.format( | |
50 | self.plot_name.upper(), '1')] |
|
50 | self.plot_name.upper(), '1')] | |
51 |
|
51 | |||
52 | def update(self, dataOut): |
|
52 | def update(self, dataOut): | |
53 |
|
53 | |||
54 | data = {} |
|
54 | data = {} | |
55 | meta = {} |
|
55 | meta = {} | |
56 | data[self.CODE] = dataOut.data_for_RTI_DP |
|
56 | data[self.CODE] = dataOut.data_for_RTI_DP | |
57 | data['NRANGE'] = dataOut.NDP |
|
57 | data['NRANGE'] = dataOut.NDP | |
58 |
|
58 | |||
59 | return data, meta |
|
59 | return data, meta | |
60 |
|
60 | |||
61 | def plot(self): |
|
61 | def plot(self): | |
62 |
|
62 | |||
63 | self.x = self.data.times |
|
63 | self.x = self.data.times | |
64 | self.y = self.data.yrange[0: self.data['NRANGE']] |
|
64 | self.y = self.data.yrange[0: self.data['NRANGE']] | |
65 | self.z = self.data[self.CODE] |
|
65 | self.z = self.data[self.CODE] | |
66 | self.z = numpy.ma.masked_invalid(self.z) |
|
66 | self.z = numpy.ma.masked_invalid(self.z) | |
67 |
|
67 | |||
68 | if self.decimation is None: |
|
68 | if self.decimation is None: | |
69 | x, y, z = self.fill_gaps(self.x, self.y, self.z) |
|
69 | x, y, z = self.fill_gaps(self.x, self.y, self.z) | |
70 | else: |
|
70 | else: | |
71 | x, y, z = self.fill_gaps(*self.decimate()) |
|
71 | x, y, z = self.fill_gaps(*self.decimate()) | |
72 |
|
72 | |||
73 | for n, ax in enumerate(self.axes): |
|
73 | for n, ax in enumerate(self.axes): | |
74 |
|
74 | |||
75 | self.zmax = self.zmax if self.zmax is not None else numpy.max( |
|
75 | self.zmax = self.zmax if self.zmax is not None else numpy.max( | |
76 | self.z[1][0,12:40]) |
|
76 | self.z[1][0,12:40]) | |
77 | self.zmin = self.zmin if self.zmin is not None else numpy.min( |
|
77 | self.zmin = self.zmin if self.zmin is not None else numpy.min( | |
78 | self.z[1][0,12:40]) |
|
78 | self.z[1][0,12:40]) | |
79 |
|
79 | |||
80 | if ax.firsttime: |
|
80 | if ax.firsttime: | |
81 |
|
81 | |||
82 | if self.zlimits is not None: |
|
82 | if self.zlimits is not None: | |
83 | self.zmin, self.zmax = self.zlimits[n] |
|
83 | self.zmin, self.zmax = self.zlimits[n] | |
84 |
|
84 | |||
85 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], |
|
85 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], | |
86 | vmin=self.zmin, |
|
86 | vmin=self.zmin, | |
87 | vmax=self.zmax, |
|
87 | vmax=self.zmax, | |
88 | cmap=self.cmaps[n] |
|
88 | cmap=self.cmaps[n] | |
89 | ) |
|
89 | ) | |
90 | else: |
|
90 | else: | |
91 | if self.zlimits is not None: |
|
91 | if self.zlimits is not None: | |
92 | self.zmin, self.zmax = self.zlimits[n] |
|
92 | self.zmin, self.zmax = self.zlimits[n] | |
93 | ax.plt.remove() |
|
93 | ax.plt.remove() | |
94 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], |
|
94 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], | |
95 | vmin=self.zmin, |
|
95 | vmin=self.zmin, | |
96 | vmax=self.zmax, |
|
96 | vmax=self.zmax, | |
97 | cmap=self.cmaps[n] |
|
97 | cmap=self.cmaps[n] | |
98 | ) |
|
98 | ) | |
99 |
|
99 | |||
100 |
|
100 | |||
101 | class RTILPPlot(RTIPlot): |
|
101 | class RTILPPlot(RTIPlot): | |
102 |
|
102 | |||
103 | ''' |
|
103 | ''' | |
104 | Written by R. Flores |
|
104 | Written by R. Flores | |
105 | ''' |
|
105 | ''' | |
106 | ''' |
|
106 | ''' | |
107 | Plot for RTI Long Pulse Using Cross Products Analysis |
|
107 | Plot for RTI Long Pulse Using Cross Products Analysis | |
108 | ''' |
|
108 | ''' | |
109 |
|
109 | |||
110 | CODE = 'RTILP' |
|
110 | CODE = 'RTILP' | |
111 | colormap = 'jro' |
|
111 | colormap = 'jro' | |
112 | plot_name = 'RTI LP' |
|
112 | plot_name = 'RTI LP' | |
113 |
|
113 | |||
114 | def setup(self): |
|
114 | def setup(self): | |
115 | self.xaxis = 'time' |
|
115 | self.xaxis = 'time' | |
116 | self.ncols = 1 |
|
116 | self.ncols = 1 | |
117 | self.nrows = 2 |
|
117 | self.nrows = 2 | |
118 | self.nplots = self.nrows |
|
118 | self.nplots = self.nrows | |
119 | if self.showSNR: |
|
119 | if self.showSNR: | |
120 | self.nrows += 1 |
|
120 | self.nrows += 1 | |
121 | self.nplots += 1 |
|
121 | self.nplots += 1 | |
122 |
|
122 | |||
123 | self.ylabel = 'Height [km]' |
|
123 | self.ylabel = 'Height [km]' | |
124 | self.xlabel = 'Time (LT)' |
|
124 | self.xlabel = 'Time (LT)' | |
125 |
|
125 | |||
126 | self.cb_label = 'Intensity (dB)' |
|
126 | self.cb_label = 'Intensity (dB)' | |
127 |
|
127 | |||
128 | self.titles = ['{} Channel {}'.format( |
|
128 | self.titles = ['{} Channel {}'.format( | |
129 | self.plot_name.upper(), '0'),'{} Channel {}'.format( |
|
129 | self.plot_name.upper(), '0'),'{} Channel {}'.format( | |
130 | self.plot_name.upper(), '1'),'{} Channel {}'.format( |
|
130 | self.plot_name.upper(), '1'),'{} Channel {}'.format( | |
131 | self.plot_name.upper(), '2'),'{} Channel {}'.format( |
|
131 | self.plot_name.upper(), '2'),'{} Channel {}'.format( | |
132 | self.plot_name.upper(), '3')] |
|
132 | self.plot_name.upper(), '3')] | |
133 |
|
133 | |||
134 |
|
134 | |||
135 | def update(self, dataOut): |
|
135 | def update(self, dataOut): | |
136 |
|
136 | |||
137 | data = {} |
|
137 | data = {} | |
138 | meta = {} |
|
138 | meta = {} | |
139 | data['rti'] = dataOut.data_for_RTI_LP |
|
139 | data['rti'] = dataOut.data_for_RTI_LP | |
140 | data['NRANGE'] = dataOut.NRANGE |
|
140 | data['NRANGE'] = dataOut.NRANGE | |
141 |
|
141 | |||
142 | return data, meta |
|
142 | return data, meta | |
143 | def plot(self): |
|
143 | def plot(self): | |
144 |
|
144 | |||
145 | NRANGE = self.data['NRANGE'][-1] |
|
145 | NRANGE = self.data['NRANGE'][-1] | |
146 | self.x = self.data.times |
|
146 | self.x = self.data.times | |
147 | self.y = self.data.yrange[0:NRANGE] |
|
147 | self.y = self.data.yrange[0:NRANGE] | |
148 |
|
148 | |||
149 | self.z = self.data['rti'] |
|
149 | self.z = self.data['rti'] | |
150 |
|
150 | |||
151 | self.z = numpy.ma.masked_invalid(self.z) |
|
151 | self.z = numpy.ma.masked_invalid(self.z) | |
152 |
|
152 | |||
153 | if self.decimation is None: |
|
153 | if self.decimation is None: | |
154 | x, y, z = self.fill_gaps(self.x, self.y, self.z) |
|
154 | x, y, z = self.fill_gaps(self.x, self.y, self.z) | |
155 | else: |
|
155 | else: | |
156 | x, y, z = self.fill_gaps(*self.decimate()) |
|
156 | x, y, z = self.fill_gaps(*self.decimate()) | |
157 |
|
157 | |||
158 | for n, ax in enumerate(self.axes): |
|
158 | for n, ax in enumerate(self.axes): | |
159 |
|
159 | |||
160 | self.zmax = self.zmax if self.zmax is not None else numpy.max( |
|
160 | self.zmax = self.zmax if self.zmax is not None else numpy.max( | |
161 | self.z[1][0,12:40]) |
|
161 | self.z[1][0,12:40]) | |
162 | self.zmin = self.zmin if self.zmin is not None else numpy.min( |
|
162 | self.zmin = self.zmin if self.zmin is not None else numpy.min( | |
163 | self.z[1][0,12:40]) |
|
163 | self.z[1][0,12:40]) | |
164 |
|
164 | |||
165 | if ax.firsttime: |
|
165 | if ax.firsttime: | |
166 |
|
166 | |||
167 | if self.zlimits is not None: |
|
167 | if self.zlimits is not None: | |
168 | self.zmin, self.zmax = self.zlimits[n] |
|
168 | self.zmin, self.zmax = self.zlimits[n] | |
169 |
|
169 | |||
170 |
|
170 | |||
171 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], |
|
171 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], | |
172 | vmin=self.zmin, |
|
172 | vmin=self.zmin, | |
173 | vmax=self.zmax, |
|
173 | vmax=self.zmax, | |
174 | cmap=self.cmaps[n] |
|
174 | cmap=self.cmaps[n] | |
175 | ) |
|
175 | ) | |
176 | #plt.tight_layout() |
|
176 | #plt.tight_layout() | |
177 | else: |
|
177 | else: | |
178 | if self.zlimits is not None: |
|
178 | if self.zlimits is not None: | |
179 | self.zmin, self.zmax = self.zlimits[n] |
|
179 | self.zmin, self.zmax = self.zlimits[n] | |
180 | ax.plt.remove() |
|
180 | ax.plt.remove() | |
181 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], |
|
181 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], | |
182 | vmin=self.zmin, |
|
182 | vmin=self.zmin, | |
183 | vmax=self.zmax, |
|
183 | vmax=self.zmax, | |
184 | cmap=self.cmaps[n] |
|
184 | cmap=self.cmaps[n] | |
185 | ) |
|
185 | ) | |
186 | #plt.tight_layout() |
|
186 | #plt.tight_layout() | |
187 |
|
187 | |||
188 |
|
188 | |||
189 | class DenRTIPlot(RTIPlot): |
|
189 | class DenRTIPlot(RTIPlot): | |
190 | ''' |
|
190 | ''' | |
191 | Written by R. Flores |
|
191 | Written by R. Flores | |
192 | ''' |
|
192 | ''' | |
193 | ''' |
|
193 | ''' | |
194 | RTI Plot for Electron Densities |
|
194 | RTI Plot for Electron Densities | |
195 | ''' |
|
195 | ''' | |
196 |
|
196 | |||
197 | CODE = 'denrti' |
|
197 | CODE = 'denrti' | |
198 | colormap = 'jet' |
|
198 | colormap = 'jet' | |
199 |
|
199 | |||
200 | def setup(self): |
|
200 | def setup(self): | |
201 | self.xaxis = 'time' |
|
201 | self.xaxis = 'time' | |
202 | self.ncols = 1 |
|
202 | self.ncols = 1 | |
203 | self.nrows = self.data.shape(self.CODE)[0] |
|
203 | self.nrows = self.data.shape(self.CODE)[0] | |
204 | self.nplots = self.nrows |
|
204 | self.nplots = self.nrows | |
205 |
|
205 | |||
206 | self.ylabel = 'Range [km]' |
|
206 | self.ylabel = 'Range [km]' | |
207 | self.xlabel = 'Time (LT)' |
|
207 | self.xlabel = 'Time (LT)' | |
208 |
|
208 | |||
209 | self.plots_adjust.update({'wspace': 0.8, 'hspace':0.2, 'left': 0.2, 'right': 0.9, 'bottom': 0.18}) |
|
209 | self.plots_adjust.update({'wspace': 0.8, 'hspace':0.2, 'left': 0.2, 'right': 0.9, 'bottom': 0.18}) | |
210 |
|
210 | |||
211 | if self.CODE == 'denrti': |
|
211 | if self.CODE == 'denrti': | |
212 | self.cb_label = r'$\mathrm{N_e}$ Electron Density ($\mathrm{1/cm^3}$)' |
|
212 | self.cb_label = r'$\mathrm{N_e}$ Electron Density ($\mathrm{1/cm^3}$)' | |
213 |
|
213 | |||
214 | self.titles = ['Electron Density RTI'] |
|
214 | self.titles = ['Electron Density RTI'] | |
215 |
|
215 | |||
216 | def update(self, dataOut): |
|
216 | def update(self, dataOut): | |
217 |
|
217 | |||
218 | data = {} |
|
218 | data = {} | |
219 | meta = {} |
|
219 | meta = {} | |
220 |
|
220 | |||
221 | data['denrti'] = dataOut.DensityFinal*1.e-6 #To Plot in cm^-3 |
|
221 | data['denrti'] = dataOut.DensityFinal*1.e-6 #To Plot in cm^-3 | |
222 |
|
222 | |||
223 | return data, meta |
|
223 | return data, meta | |
224 |
|
224 | |||
225 | def plot(self): |
|
225 | def plot(self): | |
226 |
|
226 | |||
227 | self.x = self.data.times |
|
227 | self.x = self.data.times | |
228 | self.y = self.data.yrange |
|
228 | self.y = self.data.yrange | |
229 |
|
229 | |||
230 | self.z = self.data[self.CODE] |
|
230 | self.z = self.data[self.CODE] | |
231 |
|
231 | |||
232 | self.z = numpy.ma.masked_invalid(self.z) |
|
232 | self.z = numpy.ma.masked_invalid(self.z) | |
233 |
|
233 | |||
234 | if self.decimation is None: |
|
234 | if self.decimation is None: | |
235 | x, y, z = self.fill_gaps(self.x, self.y, self.z) |
|
235 | x, y, z = self.fill_gaps(self.x, self.y, self.z) | |
236 | else: |
|
236 | else: | |
237 | x, y, z = self.fill_gaps(*self.decimate()) |
|
237 | x, y, z = self.fill_gaps(*self.decimate()) | |
238 |
|
238 | |||
239 | for n, ax in enumerate(self.axes): |
|
239 | for n, ax in enumerate(self.axes): | |
240 |
|
240 | |||
241 | self.zmax = self.zmax if self.zmax is not None else numpy.max( |
|
241 | self.zmax = self.zmax if self.zmax is not None else numpy.max( | |
242 | self.z[n]) |
|
242 | self.z[n]) | |
243 | self.zmin = self.zmin if self.zmin is not None else numpy.min( |
|
243 | self.zmin = self.zmin if self.zmin is not None else numpy.min( | |
244 | self.z[n]) |
|
244 | self.z[n]) | |
245 |
|
245 | |||
246 | if ax.firsttime: |
|
246 | if ax.firsttime: | |
247 |
|
247 | |||
248 | if self.zlimits is not None: |
|
248 | if self.zlimits is not None: | |
249 | self.zmin, self.zmax = self.zlimits[n] |
|
249 | self.zmin, self.zmax = self.zlimits[n] | |
250 | if numpy.log10(self.zmin)<0: |
|
250 | if numpy.log10(self.zmin)<0: | |
251 | self.zmin=1 |
|
251 | self.zmin=1 | |
252 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], |
|
252 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], | |
253 | vmin=self.zmin, |
|
253 | #vmin=self.zmin, | |
254 | vmax=self.zmax, |
|
254 | #vmax=self.zmax, | |
255 | cmap=self.cmaps[n], |
|
255 | cmap=self.cmaps[n], | |
256 | norm=colors.LogNorm() |
|
256 | norm=colors.LogNorm(vmin=self.zmin,vmax=self.zmax) | |
257 | ) |
|
257 | ) | |
258 |
|
258 | |||
259 | else: |
|
259 | else: | |
260 | if self.zlimits is not None: |
|
260 | if self.zlimits is not None: | |
261 | self.zmin, self.zmax = self.zlimits[n] |
|
261 | self.zmin, self.zmax = self.zlimits[n] | |
262 | ax.plt.remove() |
|
262 | ax.plt.remove() | |
263 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], |
|
263 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], | |
264 | vmin=self.zmin, |
|
264 | #vmin=self.zmin, | |
265 | vmax=self.zmax, |
|
265 | #vmax=self.zmax, | |
266 | cmap=self.cmaps[n], |
|
266 | cmap=self.cmaps[n], | |
267 | norm=colors.LogNorm() |
|
267 | norm=colors.LogNorm(vmin=self.zmin,vmax=self.zmax) | |
268 | ) |
|
268 | ) | |
269 |
|
269 | |||
270 |
|
270 | |||
271 | class ETempRTIPlot(RTIPlot): |
|
271 | class ETempRTIPlot(RTIPlot): | |
272 | ''' |
|
272 | ''' | |
273 | Written by R. Flores |
|
273 | Written by R. Flores | |
274 | ''' |
|
274 | ''' | |
275 | ''' |
|
275 | ''' | |
276 | Plot for Electron Temperature |
|
276 | Plot for Electron Temperature | |
277 | ''' |
|
277 | ''' | |
278 |
|
278 | |||
279 | CODE = 'ETemp' |
|
279 | CODE = 'ETemp' | |
280 | colormap = 'jet' |
|
280 | colormap = 'jet' | |
281 |
|
281 | |||
282 | def setup(self): |
|
282 | def setup(self): | |
283 | self.xaxis = 'time' |
|
283 | self.xaxis = 'time' | |
284 | self.ncols = 1 |
|
284 | self.ncols = 1 | |
285 | self.nrows = self.data.shape(self.CODE)[0] |
|
285 | self.nrows = self.data.shape(self.CODE)[0] | |
286 | self.nplots = self.nrows |
|
286 | self.nplots = self.nrows | |
287 |
|
287 | |||
288 | self.ylabel = 'Range [km]' |
|
288 | self.ylabel = 'Range [km]' | |
289 | self.xlabel = 'Time (LT)' |
|
289 | self.xlabel = 'Time (LT)' | |
290 | self.plots_adjust.update({'wspace': 0.8, 'hspace':0.2, 'left': 0.2, 'right': 0.9, 'bottom': 0.18}) |
|
290 | self.plots_adjust.update({'wspace': 0.8, 'hspace':0.2, 'left': 0.2, 'right': 0.9, 'bottom': 0.18}) | |
291 | if self.CODE == 'ETemp': |
|
291 | if self.CODE == 'ETemp': | |
292 | self.cb_label = 'Electron Temperature (K)' |
|
292 | self.cb_label = 'Electron Temperature (K)' | |
293 | self.titles = ['Electron Temperature RTI'] |
|
293 | self.titles = ['Electron Temperature RTI'] | |
294 | if self.CODE == 'ITemp': |
|
294 | if self.CODE == 'ITemp': | |
295 | self.cb_label = 'Ion Temperature (K)' |
|
295 | self.cb_label = 'Ion Temperature (K)' | |
296 | self.titles = ['Ion Temperature RTI'] |
|
296 | self.titles = ['Ion Temperature RTI'] | |
297 | if self.CODE == 'HeFracLP': |
|
297 | if self.CODE == 'HeFracLP': | |
298 | self.cb_label ='He+ Fraction' |
|
298 | self.cb_label ='He+ Fraction' | |
299 | self.titles = ['He+ Fraction RTI'] |
|
299 | self.titles = ['He+ Fraction RTI'] | |
300 | self.zmax=0.16 |
|
300 | self.zmax=0.16 | |
301 | if self.CODE == 'HFracLP': |
|
301 | if self.CODE == 'HFracLP': | |
302 | self.cb_label ='H+ Fraction' |
|
302 | self.cb_label ='H+ Fraction' | |
303 | self.titles = ['H+ Fraction RTI'] |
|
303 | self.titles = ['H+ Fraction RTI'] | |
304 |
|
304 | |||
305 | def update(self, dataOut): |
|
305 | def update(self, dataOut): | |
306 |
|
306 | |||
307 | data = {} |
|
307 | data = {} | |
308 | meta = {} |
|
308 | meta = {} | |
309 |
|
309 | |||
310 | data['ETemp'] = dataOut.ElecTempFinal |
|
310 | data['ETemp'] = dataOut.ElecTempFinal | |
311 |
|
311 | |||
312 | return data, meta |
|
312 | return data, meta | |
313 |
|
313 | |||
314 | def plot(self): |
|
314 | def plot(self): | |
315 |
|
315 | |||
316 | self.x = self.data.times |
|
316 | self.x = self.data.times | |
317 | self.y = self.data.yrange |
|
317 | self.y = self.data.yrange | |
318 | self.z = self.data[self.CODE] |
|
318 | self.z = self.data[self.CODE] | |
319 |
|
319 | |||
320 | self.z = numpy.ma.masked_invalid(self.z) |
|
320 | self.z = numpy.ma.masked_invalid(self.z) | |
321 |
|
321 | |||
322 | if self.decimation is None: |
|
322 | if self.decimation is None: | |
323 | x, y, z = self.fill_gaps(self.x, self.y, self.z) |
|
323 | x, y, z = self.fill_gaps(self.x, self.y, self.z) | |
324 | else: |
|
324 | else: | |
325 | x, y, z = self.fill_gaps(*self.decimate()) |
|
325 | x, y, z = self.fill_gaps(*self.decimate()) | |
326 |
|
326 | |||
327 | for n, ax in enumerate(self.axes): |
|
327 | for n, ax in enumerate(self.axes): | |
328 |
|
328 | |||
329 | self.zmax = self.zmax if self.zmax is not None else numpy.max( |
|
329 | self.zmax = self.zmax if self.zmax is not None else numpy.max( | |
330 | self.z[n]) |
|
330 | self.z[n]) | |
331 | self.zmin = self.zmin if self.zmin is not None else numpy.min( |
|
331 | self.zmin = self.zmin if self.zmin is not None else numpy.min( | |
332 | self.z[n]) |
|
332 | self.z[n]) | |
333 |
|
333 | |||
334 | if ax.firsttime: |
|
334 | if ax.firsttime: | |
335 |
|
335 | |||
336 | if self.zlimits is not None: |
|
336 | if self.zlimits is not None: | |
337 | self.zmin, self.zmax = self.zlimits[n] |
|
337 | self.zmin, self.zmax = self.zlimits[n] | |
338 |
|
338 | |||
339 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], |
|
339 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], | |
340 | vmin=self.zmin, |
|
340 | vmin=self.zmin, | |
341 | vmax=self.zmax, |
|
341 | vmax=self.zmax, | |
342 | cmap=self.cmaps[n] |
|
342 | cmap=self.cmaps[n] | |
343 | ) |
|
343 | ) | |
344 | #plt.tight_layout() |
|
344 | #plt.tight_layout() | |
345 |
|
345 | |||
346 | else: |
|
346 | else: | |
347 | if self.zlimits is not None: |
|
347 | if self.zlimits is not None: | |
348 | self.zmin, self.zmax = self.zlimits[n] |
|
348 | self.zmin, self.zmax = self.zlimits[n] | |
349 | ax.plt.remove() |
|
349 | ax.plt.remove() | |
350 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], |
|
350 | ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n], | |
351 | vmin=self.zmin, |
|
351 | vmin=self.zmin, | |
352 | vmax=self.zmax, |
|
352 | vmax=self.zmax, | |
353 | cmap=self.cmaps[n] |
|
353 | cmap=self.cmaps[n] | |
354 | ) |
|
354 | ) | |
355 |
|
355 | |||
356 |
|
356 | |||
357 | class ITempRTIPlot(ETempRTIPlot): |
|
357 | class ITempRTIPlot(ETempRTIPlot): | |
358 | ''' |
|
358 | ''' | |
359 | Written by R. Flores |
|
359 | Written by R. Flores | |
360 | ''' |
|
360 | ''' | |
361 | ''' |
|
361 | ''' | |
362 | Plot for Ion Temperature |
|
362 | Plot for Ion Temperature | |
363 | ''' |
|
363 | ''' | |
364 |
|
364 | |||
365 | CODE = 'ITemp' |
|
365 | CODE = 'ITemp' | |
366 | colormap = 'jet' |
|
366 | colormap = 'jet' | |
367 | plot_name = 'Ion Temperature' |
|
367 | plot_name = 'Ion Temperature' | |
368 |
|
368 | |||
369 | def update(self, dataOut): |
|
369 | def update(self, dataOut): | |
370 |
|
370 | |||
371 | data = {} |
|
371 | data = {} | |
372 | meta = {} |
|
372 | meta = {} | |
373 |
|
373 | |||
374 | data['ITemp'] = dataOut.IonTempFinal |
|
374 | data['ITemp'] = dataOut.IonTempFinal | |
375 |
|
375 | |||
376 | return data, meta |
|
376 | return data, meta | |
377 |
|
377 | |||
378 |
|
378 | |||
379 | class HFracRTIPlot(ETempRTIPlot): |
|
379 | class HFracRTIPlot(ETempRTIPlot): | |
380 | ''' |
|
380 | ''' | |
381 | Written by R. Flores |
|
381 | Written by R. Flores | |
382 | ''' |
|
382 | ''' | |
383 | ''' |
|
383 | ''' | |
384 | Plot for H+ LP |
|
384 | Plot for H+ LP | |
385 | ''' |
|
385 | ''' | |
386 |
|
386 | |||
387 | CODE = 'HFracLP' |
|
387 | CODE = 'HFracLP' | |
388 | colormap = 'jet' |
|
388 | colormap = 'jet' | |
389 | plot_name = 'H+ Frac' |
|
389 | plot_name = 'H+ Frac' | |
390 |
|
390 | |||
391 | def update(self, dataOut): |
|
391 | def update(self, dataOut): | |
392 |
|
392 | |||
393 | data = {} |
|
393 | data = {} | |
394 | meta = {} |
|
394 | meta = {} | |
395 | data['HFracLP'] = dataOut.PhyFinal |
|
395 | data['HFracLP'] = dataOut.PhyFinal | |
396 |
|
396 | |||
397 | return data, meta |
|
397 | return data, meta | |
398 |
|
398 | |||
399 |
|
399 | |||
400 | class HeFracRTIPlot(ETempRTIPlot): |
|
400 | class HeFracRTIPlot(ETempRTIPlot): | |
401 | ''' |
|
401 | ''' | |
402 | Written by R. Flores |
|
402 | Written by R. Flores | |
403 | ''' |
|
403 | ''' | |
404 | ''' |
|
404 | ''' | |
405 | Plot for He+ LP |
|
405 | Plot for He+ LP | |
406 | ''' |
|
406 | ''' | |
407 |
|
407 | |||
408 | CODE = 'HeFracLP' |
|
408 | CODE = 'HeFracLP' | |
409 | colormap = 'jet' |
|
409 | colormap = 'jet' | |
410 | plot_name = 'He+ Frac' |
|
410 | plot_name = 'He+ Frac' | |
411 |
|
411 | |||
412 | def update(self, dataOut): |
|
412 | def update(self, dataOut): | |
413 |
|
413 | |||
414 | data = {} |
|
414 | data = {} | |
415 | meta = {} |
|
415 | meta = {} | |
416 | data['HeFracLP'] = dataOut.PheFinal |
|
416 | data['HeFracLP'] = dataOut.PheFinal | |
417 |
|
417 | |||
418 | return data, meta |
|
418 | return data, meta | |
419 |
|
419 | |||
420 |
|
420 | |||
421 | class TempsDPPlot(Plot): |
|
421 | class TempsDPPlot(Plot): | |
422 | ''' |
|
422 | ''' | |
423 | Written by R. Flores |
|
423 | Written by R. Flores | |
424 | ''' |
|
424 | ''' | |
425 | ''' |
|
425 | ''' | |
426 | Plot for Electron - Ion Temperatures |
|
426 | Plot for Electron - Ion Temperatures | |
427 | ''' |
|
427 | ''' | |
428 |
|
428 | |||
429 | CODE = 'tempsDP' |
|
429 | CODE = 'tempsDP' | |
430 | #plot_name = 'Temperatures' |
|
430 | #plot_name = 'Temperatures' | |
431 | plot_type = 'scatterbuffer' |
|
431 | plot_type = 'scatterbuffer' | |
432 |
|
432 | |||
433 | def setup(self): |
|
433 | def setup(self): | |
434 |
|
434 | |||
435 | self.ncols = 1 |
|
435 | self.ncols = 1 | |
436 | self.nrows = 1 |
|
436 | self.nrows = 1 | |
437 | self.nplots = 1 |
|
437 | self.nplots = 1 | |
438 | self.ylabel = 'Range [km]' |
|
438 | self.ylabel = 'Range [km]' | |
439 | self.xlabel = 'Temperature (K)' |
|
439 | self.xlabel = 'Temperature (K)' | |
440 | self.titles = ['Electron/Ion Temperatures'] |
|
440 | self.titles = ['Electron/Ion Temperatures'] | |
441 | self.width = 3.5 |
|
441 | self.width = 3.5 | |
442 | self.height = 5.5 |
|
442 | self.height = 5.5 | |
443 | self.colorbar = False |
|
443 | self.colorbar = False | |
444 | self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) |
|
444 | self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) | |
445 |
|
445 | |||
446 | def update(self, dataOut): |
|
446 | def update(self, dataOut): | |
447 | data = {} |
|
447 | data = {} | |
448 | meta = {} |
|
448 | meta = {} | |
449 |
|
449 | |||
450 | data['Te'] = dataOut.te2 |
|
450 | data['Te'] = dataOut.te2 | |
451 | data['Ti'] = dataOut.ti2 |
|
451 | data['Ti'] = dataOut.ti2 | |
452 | data['Te_error'] = dataOut.ete2 |
|
452 | data['Te_error'] = dataOut.ete2 | |
453 | data['Ti_error'] = dataOut.eti2 |
|
453 | data['Ti_error'] = dataOut.eti2 | |
454 |
|
454 | |||
455 | meta['yrange'] = dataOut.heightList[0:dataOut.NSHTS] |
|
455 | meta['yrange'] = dataOut.heightList[0:dataOut.NSHTS] | |
456 |
|
456 | |||
457 | return data, meta |
|
457 | return data, meta | |
458 |
|
458 | |||
459 | def plot(self): |
|
459 | def plot(self): | |
460 |
|
460 | |||
461 | y = self.data.yrange |
|
461 | y = self.data.yrange | |
462 |
|
462 | |||
463 | self.xmin = -100 |
|
463 | self.xmin = -100 | |
464 | self.xmax = 5000 |
|
464 | self.xmax = 5000 | |
465 |
|
465 | |||
466 | ax = self.axes[0] |
|
466 | ax = self.axes[0] | |
467 |
|
467 | |||
468 | data = self.data[-1] |
|
468 | data = self.data[-1] | |
469 |
|
469 | |||
470 | Te = data['Te'] |
|
470 | Te = data['Te'] | |
471 | Ti = data['Ti'] |
|
471 | Ti = data['Ti'] | |
472 | errTe = data['Te_error'] |
|
472 | errTe = data['Te_error'] | |
473 | errTi = data['Ti_error'] |
|
473 | errTi = data['Ti_error'] | |
474 |
|
474 | |||
475 | if ax.firsttime: |
|
475 | if ax.firsttime: | |
476 | ax.errorbar(Te, y, xerr=errTe, fmt='r^',elinewidth=1.0,color='b',linewidth=2.0, label='Te') |
|
476 | ax.errorbar(Te, y, xerr=errTe, fmt='r^',elinewidth=1.0,color='b',linewidth=2.0, label='Te') | |
477 | ax.errorbar(Ti, y, fmt='k^', xerr=errTi,elinewidth=1.0,color='b',linewidth=2.0, label='Ti') |
|
477 | ax.errorbar(Ti, y, fmt='k^', xerr=errTi,elinewidth=1.0,color='b',linewidth=2.0, label='Ti') | |
478 | plt.legend(loc='lower right') |
|
478 | plt.legend(loc='lower right') | |
479 | self.ystep_given = 50 |
|
479 | self.ystep_given = 50 | |
480 | ax.yaxis.set_minor_locator(MultipleLocator(15)) |
|
480 | ax.yaxis.set_minor_locator(MultipleLocator(15)) | |
481 | ax.grid(which='minor') |
|
481 | ax.grid(which='minor') | |
482 |
|
482 | |||
483 | else: |
|
483 | else: | |
484 | self.clear_figures() |
|
484 | self.clear_figures() | |
485 | ax.errorbar(Te, y, xerr=errTe, fmt='r^',elinewidth=1.0,color='b',linewidth=2.0, label='Te') |
|
485 | ax.errorbar(Te, y, xerr=errTe, fmt='r^',elinewidth=1.0,color='b',linewidth=2.0, label='Te') | |
486 | ax.errorbar(Ti, y, fmt='k^', xerr=errTi,elinewidth=1.0,color='b',linewidth=2.0, label='Ti') |
|
486 | ax.errorbar(Ti, y, fmt='k^', xerr=errTi,elinewidth=1.0,color='b',linewidth=2.0, label='Ti') | |
487 | plt.legend(loc='lower right') |
|
487 | plt.legend(loc='lower right') | |
488 | ax.yaxis.set_minor_locator(MultipleLocator(15)) |
|
488 | ax.yaxis.set_minor_locator(MultipleLocator(15)) | |
489 |
|
489 | |||
490 |
|
490 | |||
491 | class TempsHPPlot(Plot): |
|
491 | class TempsHPPlot(Plot): | |
492 | ''' |
|
492 | ''' | |
493 | Written by R. Flores |
|
493 | Written by R. Flores | |
494 | ''' |
|
494 | ''' | |
495 | ''' |
|
495 | ''' | |
496 | Plot for Temperatures Hybrid Experiment |
|
496 | Plot for Temperatures Hybrid Experiment | |
497 | ''' |
|
497 | ''' | |
498 |
|
498 | |||
499 | CODE = 'temps_LP' |
|
499 | CODE = 'temps_LP' | |
500 | #plot_name = 'Temperatures' |
|
500 | #plot_name = 'Temperatures' | |
501 | plot_type = 'scatterbuffer' |
|
501 | plot_type = 'scatterbuffer' | |
502 |
|
502 | |||
503 |
|
503 | |||
504 | def setup(self): |
|
504 | def setup(self): | |
505 |
|
505 | |||
506 | self.ncols = 1 |
|
506 | self.ncols = 1 | |
507 | self.nrows = 1 |
|
507 | self.nrows = 1 | |
508 | self.nplots = 1 |
|
508 | self.nplots = 1 | |
509 | self.ylabel = 'Range [km]' |
|
509 | self.ylabel = 'Range [km]' | |
510 | self.xlabel = 'Temperature (K)' |
|
510 | self.xlabel = 'Temperature (K)' | |
511 | self.titles = ['Electron/Ion Temperatures'] |
|
511 | self.titles = ['Electron/Ion Temperatures'] | |
512 | self.width = 3.5 |
|
512 | self.width = 3.5 | |
513 | self.height = 6.5 |
|
513 | self.height = 6.5 | |
514 | self.colorbar = False |
|
514 | self.colorbar = False | |
515 | self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) |
|
515 | self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) | |
516 |
|
516 | |||
517 | def update(self, dataOut): |
|
517 | def update(self, dataOut): | |
518 | data = {} |
|
518 | data = {} | |
519 | meta = {} |
|
519 | meta = {} | |
520 |
|
520 | |||
521 |
|
521 | |||
522 | data['Te'] = numpy.concatenate((dataOut.te2[:dataOut.cut],dataOut.te[dataOut.cut:])) |
|
522 | data['Te'] = numpy.concatenate((dataOut.te2[:dataOut.cut],dataOut.te[dataOut.cut:])) | |
523 | data['Ti'] = numpy.concatenate((dataOut.ti2[:dataOut.cut],dataOut.ti[dataOut.cut:])) |
|
523 | data['Ti'] = numpy.concatenate((dataOut.ti2[:dataOut.cut],dataOut.ti[dataOut.cut:])) | |
524 | data['Te_error'] = numpy.concatenate((dataOut.ete2[:dataOut.cut],dataOut.ete[dataOut.cut:])) |
|
524 | data['Te_error'] = numpy.concatenate((dataOut.ete2[:dataOut.cut],dataOut.ete[dataOut.cut:])) | |
525 | data['Ti_error'] = numpy.concatenate((dataOut.eti2[:dataOut.cut],dataOut.eti[dataOut.cut:])) |
|
525 | data['Ti_error'] = numpy.concatenate((dataOut.eti2[:dataOut.cut],dataOut.eti[dataOut.cut:])) | |
526 |
|
526 | |||
527 | meta['yrange'] = dataOut.heightList[0:dataOut.NACF] |
|
527 | meta['yrange'] = dataOut.heightList[0:dataOut.NACF] | |
528 |
|
528 | |||
529 | return data, meta |
|
529 | return data, meta | |
530 |
|
530 | |||
531 | def plot(self): |
|
531 | def plot(self): | |
532 |
|
532 | |||
533 |
|
533 | |||
534 | self.y = self.data.yrange |
|
534 | self.y = self.data.yrange | |
535 | self.xmin = -100 |
|
535 | self.xmin = -100 | |
536 | self.xmax = 4500 |
|
536 | self.xmax = 4500 | |
537 | ax = self.axes[0] |
|
537 | ax = self.axes[0] | |
538 |
|
538 | |||
539 | data = self.data[-1] |
|
539 | data = self.data[-1] | |
540 |
|
540 | |||
541 | Te = data['Te'] |
|
541 | Te = data['Te'] | |
542 | Ti = data['Ti'] |
|
542 | Ti = data['Ti'] | |
543 | errTe = data['Te_error'] |
|
543 | errTe = data['Te_error'] | |
544 | errTi = data['Ti_error'] |
|
544 | errTi = data['Ti_error'] | |
545 |
|
545 | |||
546 | if ax.firsttime: |
|
546 | if ax.firsttime: | |
547 |
|
547 | |||
548 | ax.errorbar(Te, self.y, xerr=errTe, fmt='r^',elinewidth=1.0,color='b',linewidth=2.0, label='Te') |
|
548 | ax.errorbar(Te, self.y, xerr=errTe, fmt='r^',elinewidth=1.0,color='b',linewidth=2.0, label='Te') | |
549 | ax.errorbar(Ti, self.y, fmt='k^', xerr=errTi,elinewidth=1.0,color='b',linewidth=2.0, label='Ti') |
|
549 | ax.errorbar(Ti, self.y, fmt='k^', xerr=errTi,elinewidth=1.0,color='b',linewidth=2.0, label='Ti') | |
550 | plt.legend(loc='lower right') |
|
550 | plt.legend(loc='lower right') | |
551 | self.ystep_given = 200 |
|
551 | self.ystep_given = 200 | |
552 | ax.yaxis.set_minor_locator(MultipleLocator(15)) |
|
552 | ax.yaxis.set_minor_locator(MultipleLocator(15)) | |
553 | ax.grid(which='minor') |
|
553 | ax.grid(which='minor') | |
554 |
|
554 | |||
555 | else: |
|
555 | else: | |
556 | self.clear_figures() |
|
556 | self.clear_figures() | |
557 | ax.errorbar(Te, self.y, xerr=errTe, fmt='r^',elinewidth=1.0,color='b',linewidth=2.0, label='Te') |
|
557 | ax.errorbar(Te, self.y, xerr=errTe, fmt='r^',elinewidth=1.0,color='b',linewidth=2.0, label='Te') | |
558 | ax.errorbar(Ti, self.y, fmt='k^', xerr=errTi,elinewidth=1.0,color='b',linewidth=2.0, label='Ti') |
|
558 | ax.errorbar(Ti, self.y, fmt='k^', xerr=errTi,elinewidth=1.0,color='b',linewidth=2.0, label='Ti') | |
559 | plt.legend(loc='lower right') |
|
559 | plt.legend(loc='lower right') | |
560 | ax.yaxis.set_minor_locator(MultipleLocator(15)) |
|
560 | ax.yaxis.set_minor_locator(MultipleLocator(15)) | |
561 | ax.grid(which='minor') |
|
561 | ax.grid(which='minor') | |
562 |
|
562 | |||
563 |
|
563 | |||
564 | class FracsHPPlot(Plot): |
|
564 | class FracsHPPlot(Plot): | |
565 | ''' |
|
565 | ''' | |
566 | Written by R. Flores |
|
566 | Written by R. Flores | |
567 | ''' |
|
567 | ''' | |
568 | ''' |
|
568 | ''' | |
569 | Plot for Composition LP |
|
569 | Plot for Composition LP | |
570 | ''' |
|
570 | ''' | |
571 |
|
571 | |||
572 | CODE = 'fracs_LP' |
|
572 | CODE = 'fracs_LP' | |
573 | plot_type = 'scatterbuffer' |
|
573 | plot_type = 'scatterbuffer' | |
574 |
|
574 | |||
575 |
|
575 | |||
576 | def setup(self): |
|
576 | def setup(self): | |
577 |
|
577 | |||
578 | self.ncols = 1 |
|
578 | self.ncols = 1 | |
579 | self.nrows = 1 |
|
579 | self.nrows = 1 | |
580 | self.nplots = 1 |
|
580 | self.nplots = 1 | |
581 | self.ylabel = 'Range [km]' |
|
581 | self.ylabel = 'Range [km]' | |
582 | self.xlabel = 'Frac' |
|
582 | self.xlabel = 'Frac' | |
583 | self.titles = ['Composition'] |
|
583 | self.titles = ['Composition'] | |
584 | self.width = 3.5 |
|
584 | self.width = 3.5 | |
585 | self.height = 6.5 |
|
585 | self.height = 6.5 | |
586 | self.colorbar = False |
|
586 | self.colorbar = False | |
587 | self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) |
|
587 | self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) | |
588 |
|
588 | |||
589 | def update(self, dataOut): |
|
589 | def update(self, dataOut): | |
590 | data = {} |
|
590 | data = {} | |
591 | meta = {} |
|
591 | meta = {} | |
592 |
|
592 | |||
593 | #aux_nan=numpy.zeros(dataOut.cut,'float32') |
|
593 | #aux_nan=numpy.zeros(dataOut.cut,'float32') | |
594 | #aux_nan[:]=numpy.nan |
|
594 | #aux_nan[:]=numpy.nan | |
595 | #data['ph'] = numpy.concatenate((aux_nan,dataOut.ph[dataOut.cut:])) |
|
595 | #data['ph'] = numpy.concatenate((aux_nan,dataOut.ph[dataOut.cut:])) | |
596 | #data['eph'] = numpy.concatenate((aux_nan,dataOut.eph[dataOut.cut:])) |
|
596 | #data['eph'] = numpy.concatenate((aux_nan,dataOut.eph[dataOut.cut:])) | |
597 |
|
597 | |||
598 | data['ph'] = dataOut.ph[dataOut.cut:] |
|
598 | data['ph'] = dataOut.ph[dataOut.cut:] | |
599 | data['eph'] = dataOut.eph[dataOut.cut:] |
|
599 | data['eph'] = dataOut.eph[dataOut.cut:] | |
600 | data['phe'] = dataOut.phe[dataOut.cut:] |
|
600 | data['phe'] = dataOut.phe[dataOut.cut:] | |
601 | data['ephe'] = dataOut.ephe[dataOut.cut:] |
|
601 | data['ephe'] = dataOut.ephe[dataOut.cut:] | |
602 |
|
602 | |||
603 | data['cut'] = dataOut.cut |
|
603 | data['cut'] = dataOut.cut | |
604 |
|
604 | |||
605 | meta['yrange'] = dataOut.heightList[0:dataOut.NACF] |
|
605 | meta['yrange'] = dataOut.heightList[0:dataOut.NACF] | |
606 |
|
606 | |||
607 |
|
607 | |||
608 | return data, meta |
|
608 | return data, meta | |
609 |
|
609 | |||
610 | def plot(self): |
|
610 | def plot(self): | |
611 |
|
611 | |||
612 | data = self.data[-1] |
|
612 | data = self.data[-1] | |
613 |
|
613 | |||
614 | ph = data['ph'] |
|
614 | ph = data['ph'] | |
615 | eph = data['eph'] |
|
615 | eph = data['eph'] | |
616 | phe = data['phe'] |
|
616 | phe = data['phe'] | |
617 | ephe = data['ephe'] |
|
617 | ephe = data['ephe'] | |
618 | cut = data['cut'] |
|
618 | cut = data['cut'] | |
619 | self.y = self.data.yrange |
|
619 | self.y = self.data.yrange | |
620 |
|
620 | |||
621 | self.xmin = 0 |
|
621 | self.xmin = 0 | |
622 | self.xmax = 1 |
|
622 | self.xmax = 1 | |
623 | ax = self.axes[0] |
|
623 | ax = self.axes[0] | |
624 |
|
624 | |||
625 | if ax.firsttime: |
|
625 | if ax.firsttime: | |
626 |
|
626 | |||
627 | ax.errorbar(ph, self.y[cut:], xerr=eph, fmt='r^',elinewidth=1.0,color='b',linewidth=2.0, label='H+') |
|
627 | ax.errorbar(ph, self.y[cut:], xerr=eph, fmt='r^',elinewidth=1.0,color='b',linewidth=2.0, label='H+') | |
628 | ax.errorbar(phe, self.y[cut:], fmt='k^', xerr=ephe,elinewidth=1.0,color='b',linewidth=2.0, label='He+') |
|
628 | ax.errorbar(phe, self.y[cut:], fmt='k^', xerr=ephe,elinewidth=1.0,color='b',linewidth=2.0, label='He+') | |
629 | plt.legend(loc='lower right') |
|
629 | plt.legend(loc='lower right') | |
630 | self.xstep_given = 0.2 |
|
630 | self.xstep_given = 0.2 | |
631 | self.ystep_given = 200 |
|
631 | self.ystep_given = 200 | |
632 | ax.yaxis.set_minor_locator(MultipleLocator(15)) |
|
632 | ax.yaxis.set_minor_locator(MultipleLocator(15)) | |
633 | ax.grid(which='minor') |
|
633 | ax.grid(which='minor') | |
634 |
|
634 | |||
635 | else: |
|
635 | else: | |
636 | self.clear_figures() |
|
636 | self.clear_figures() | |
637 | ax.errorbar(ph, self.y[cut:], xerr=eph, fmt='r^',elinewidth=1.0,color='b',linewidth=2.0, label='H+') |
|
637 | ax.errorbar(ph, self.y[cut:], xerr=eph, fmt='r^',elinewidth=1.0,color='b',linewidth=2.0, label='H+') | |
638 | ax.errorbar(phe, self.y[cut:], fmt='k^', xerr=ephe,elinewidth=1.0,color='b',linewidth=2.0, label='He+') |
|
638 | ax.errorbar(phe, self.y[cut:], fmt='k^', xerr=ephe,elinewidth=1.0,color='b',linewidth=2.0, label='He+') | |
639 | plt.legend(loc='lower right') |
|
639 | plt.legend(loc='lower right') | |
640 | ax.yaxis.set_minor_locator(MultipleLocator(15)) |
|
640 | ax.yaxis.set_minor_locator(MultipleLocator(15)) | |
641 | ax.grid(which='minor') |
|
641 | ax.grid(which='minor') | |
642 |
|
642 | |||
643 | class EDensityPlot(Plot): |
|
643 | class EDensityPlot(Plot): | |
644 | ''' |
|
644 | ''' | |
645 | Written by R. Flores |
|
645 | Written by R. Flores | |
646 | ''' |
|
646 | ''' | |
647 | ''' |
|
647 | ''' | |
648 | Plot for electron density |
|
648 | Plot for electron density | |
649 | ''' |
|
649 | ''' | |
650 |
|
650 | |||
651 | CODE = 'den' |
|
651 | CODE = 'den' | |
652 | #plot_name = 'Electron Density' |
|
652 | #plot_name = 'Electron Density' | |
653 | plot_type = 'scatterbuffer' |
|
653 | plot_type = 'scatterbuffer' | |
654 |
|
654 | |||
655 | def setup(self): |
|
655 | def setup(self): | |
656 |
|
656 | |||
657 | self.ncols = 1 |
|
657 | self.ncols = 1 | |
658 | self.nrows = 1 |
|
658 | self.nrows = 1 | |
659 | self.nplots = 1 |
|
659 | self.nplots = 1 | |
660 | self.ylabel = 'Range [km]' |
|
660 | self.ylabel = 'Range [km]' | |
661 | self.xlabel = r'$\mathrm{N_e}$ Electron Density ($\mathrm{1/cm^3}$)' |
|
661 | self.xlabel = r'$\mathrm{N_e}$ Electron Density ($\mathrm{1/cm^3}$)' | |
662 | self.titles = ['Electron Density'] |
|
662 | self.titles = ['Electron Density'] | |
663 | self.width = 3.5 |
|
663 | self.width = 3.5 | |
664 | self.height = 5.5 |
|
664 | self.height = 5.5 | |
665 | self.colorbar = False |
|
665 | self.colorbar = False | |
666 | self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) |
|
666 | self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) | |
667 |
|
667 | |||
668 | def update(self, dataOut): |
|
668 | def update(self, dataOut): | |
669 | data = {} |
|
669 | data = {} | |
670 | meta = {} |
|
670 | meta = {} | |
671 |
|
671 | |||
672 | data['den_power'] = dataOut.ph2[:dataOut.NSHTS] |
|
672 | data['den_power'] = dataOut.ph2[:dataOut.NSHTS] | |
673 | data['den_Faraday'] = dataOut.dphi[:dataOut.NSHTS] |
|
673 | data['den_Faraday'] = dataOut.dphi[:dataOut.NSHTS] | |
674 | data['den_error'] = dataOut.sdp2[:dataOut.NSHTS] |
|
674 | data['den_error'] = dataOut.sdp2[:dataOut.NSHTS] | |
675 | #data['err_Faraday'] = dataOut.sdn1[:dataOut.NSHTS] |
|
675 | #data['err_Faraday'] = dataOut.sdn1[:dataOut.NSHTS] | |
676 | #print(numpy.shape(data['den_power'])) |
|
676 | #print(numpy.shape(data['den_power'])) | |
677 | #print(numpy.shape(data['den_Faraday'])) |
|
677 | #print(numpy.shape(data['den_Faraday'])) | |
678 | #print(numpy.shape(data['den_error'])) |
|
678 | #print(numpy.shape(data['den_error'])) | |
679 |
|
679 | |||
680 | data['NSHTS'] = dataOut.NSHTS |
|
680 | data['NSHTS'] = dataOut.NSHTS | |
681 |
|
681 | |||
682 | meta['yrange'] = dataOut.heightList[0:dataOut.NSHTS] |
|
682 | meta['yrange'] = dataOut.heightList[0:dataOut.NSHTS] | |
683 |
|
683 | |||
684 | return data, meta |
|
684 | return data, meta | |
685 |
|
685 | |||
686 | def plot(self): |
|
686 | def plot(self): | |
687 |
|
687 | |||
688 | y = self.data.yrange |
|
688 | y = self.data.yrange | |
689 |
|
689 | |||
690 | #self.xmin = 1e3 |
|
690 | #self.xmin = 1e3 | |
691 | #self.xmax = 1e7 |
|
691 | #self.xmax = 1e7 | |
692 |
|
692 | |||
693 | ax = self.axes[0] |
|
693 | ax = self.axes[0] | |
694 |
|
694 | |||
695 | data = self.data[-1] |
|
695 | data = self.data[-1] | |
696 |
|
696 | |||
697 | DenPow = data['den_power'] |
|
697 | DenPow = data['den_power'] | |
698 | DenFar = data['den_Faraday'] |
|
698 | DenFar = data['den_Faraday'] | |
699 | errDenPow = data['den_error'] |
|
699 | errDenPow = data['den_error'] | |
700 | #errFaraday = data['err_Faraday'] |
|
700 | #errFaraday = data['err_Faraday'] | |
701 |
|
701 | |||
702 | NSHTS = data['NSHTS'] |
|
702 | NSHTS = data['NSHTS'] | |
703 |
|
703 | |||
704 | if self.CODE == 'denLP': |
|
704 | if self.CODE == 'denLP': | |
705 | DenPowLP = data['den_LP'] |
|
705 | DenPowLP = data['den_LP'] | |
706 | errDenPowLP = data['den_LP_error'] |
|
706 | errDenPowLP = data['den_LP_error'] | |
707 | cut = data['cut'] |
|
707 | cut = data['cut'] | |
708 |
|
708 | |||
709 | if ax.firsttime: |
|
709 | if ax.firsttime: | |
710 | self.autoxticks=False |
|
710 | self.autoxticks=False | |
711 | #ax.errorbar(DenFar, y[:NSHTS], xerr=1, fmt='h-',elinewidth=1.0,color='g',linewidth=1.0, label='Faraday Profile',markersize=2) |
|
711 | #ax.errorbar(DenFar, y[:NSHTS], xerr=1, fmt='h-',elinewidth=1.0,color='g',linewidth=1.0, label='Faraday Profile',markersize=2) | |
712 | ax.errorbar(DenFar, y[:NSHTS], xerr=1, fmt='h-',elinewidth=1.0,color='g',linewidth=1.0, label='Faraday',markersize=2,linestyle='-') |
|
712 | ax.errorbar(DenFar, y[:NSHTS], xerr=1, fmt='h-',elinewidth=1.0,color='g',linewidth=1.0, label='Faraday',markersize=2,linestyle='-') | |
713 | #ax.errorbar(DenPow, y[:NSHTS], fmt='k^-', xerr=errDenPow,elinewidth=1.0,color='b',linewidth=1.0, label='Power Profile',markersize=2) |
|
713 | #ax.errorbar(DenPow, y[:NSHTS], fmt='k^-', xerr=errDenPow,elinewidth=1.0,color='b',linewidth=1.0, label='Power Profile',markersize=2) | |
714 | ax.errorbar(DenPow, y[:NSHTS], fmt='k^-', xerr=errDenPow,elinewidth=1.0,color='b',linewidth=1.0, label='Power',markersize=2,linestyle='-') |
|
714 | ax.errorbar(DenPow, y[:NSHTS], fmt='k^-', xerr=errDenPow,elinewidth=1.0,color='b',linewidth=1.0, label='Power',markersize=2,linestyle='-') | |
715 |
|
715 | |||
716 | if self.CODE=='denLP': |
|
716 | if self.CODE=='denLP': | |
717 | ax.errorbar(DenPowLP[cut:], y[cut:], xerr=errDenPowLP[cut:], fmt='r^-',elinewidth=1.0,color='r',linewidth=1.0, label='LP Profile',markersize=2) |
|
717 | ax.errorbar(DenPowLP[cut:], y[cut:], xerr=errDenPowLP[cut:], fmt='r^-',elinewidth=1.0,color='r',linewidth=1.0, label='LP Profile',markersize=2) | |
718 |
|
718 | |||
719 | plt.legend(loc='upper left',fontsize=8.5) |
|
719 | plt.legend(loc='upper left',fontsize=8.5) | |
720 | #plt.legend(loc='lower left',fontsize=8.5) |
|
720 | #plt.legend(loc='lower left',fontsize=8.5) | |
721 | ax.set_xscale("log")#, nonposx='clip') |
|
721 | ax.set_xscale("log")#, nonposx='clip') | |
722 | grid_y_ticks=numpy.arange(numpy.nanmin(y),numpy.nanmax(y),50) |
|
722 | grid_y_ticks=numpy.arange(numpy.nanmin(y),numpy.nanmax(y),50) | |
723 | self.ystep_given=100 |
|
723 | self.ystep_given=100 | |
724 | if self.CODE=='denLP': |
|
724 | if self.CODE=='denLP': | |
725 | self.ystep_given=200 |
|
725 | self.ystep_given=200 | |
726 | ax.set_yticks(grid_y_ticks,minor=True) |
|
726 | ax.set_yticks(grid_y_ticks,minor=True) | |
727 | locmaj = LogLocator(base=10,numticks=12) |
|
727 | locmaj = LogLocator(base=10,numticks=12) | |
728 | ax.xaxis.set_major_locator(locmaj) |
|
728 | ax.xaxis.set_major_locator(locmaj) | |
729 | locmin = LogLocator(base=10.0,subs=(0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9),numticks=12) |
|
729 | locmin = LogLocator(base=10.0,subs=(0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9),numticks=12) | |
730 | ax.xaxis.set_minor_locator(locmin) |
|
730 | ax.xaxis.set_minor_locator(locmin) | |
731 | ax.xaxis.set_minor_formatter(NullFormatter()) |
|
731 | ax.xaxis.set_minor_formatter(NullFormatter()) | |
732 | ax.grid(which='minor') |
|
732 | ax.grid(which='minor') | |
733 |
|
733 | |||
734 | else: |
|
734 | else: | |
735 | dataBefore = self.data[-2] |
|
735 | dataBefore = self.data[-2] | |
736 | DenPowBefore = dataBefore['den_power'] |
|
736 | DenPowBefore = dataBefore['den_power'] | |
737 | self.clear_figures() |
|
737 | self.clear_figures() | |
738 | #ax.errorbar(DenFar, y[:NSHTS], xerr=1, fmt='h-',elinewidth=1.0,color='g',linewidth=1.0, label='Faraday Profile',markersize=2) |
|
738 | #ax.errorbar(DenFar, y[:NSHTS], xerr=1, fmt='h-',elinewidth=1.0,color='g',linewidth=1.0, label='Faraday Profile',markersize=2) | |
739 | ax.errorbar(DenFar, y[:NSHTS], xerr=1, fmt='h-',elinewidth=1.0,color='g',linewidth=1.0, label='Faraday',markersize=2,linestyle='-') |
|
739 | ax.errorbar(DenFar, y[:NSHTS], xerr=1, fmt='h-',elinewidth=1.0,color='g',linewidth=1.0, label='Faraday',markersize=2,linestyle='-') | |
740 | #ax.errorbar(DenPow, y[:NSHTS], fmt='k^-', xerr=errDenPow,elinewidth=1.0,color='b',linewidth=1.0, label='Power Profile',markersize=2) |
|
740 | #ax.errorbar(DenPow, y[:NSHTS], fmt='k^-', xerr=errDenPow,elinewidth=1.0,color='b',linewidth=1.0, label='Power Profile',markersize=2) | |
741 | ax.errorbar(DenPow, y[:NSHTS], fmt='k^-', xerr=errDenPow,elinewidth=1.0,color='b',linewidth=1.0, label='Power',markersize=2,linestyle='-') |
|
741 | ax.errorbar(DenPow, y[:NSHTS], fmt='k^-', xerr=errDenPow,elinewidth=1.0,color='b',linewidth=1.0, label='Power',markersize=2,linestyle='-') | |
742 | ax.errorbar(DenPowBefore, y[:NSHTS], elinewidth=1.0,color='r',linewidth=0.5,linestyle="dashed") |
|
742 | ax.errorbar(DenPowBefore, y[:NSHTS], elinewidth=1.0,color='r',linewidth=0.5,linestyle="dashed") | |
743 |
|
743 | |||
744 | if self.CODE=='denLP': |
|
744 | if self.CODE=='denLP': | |
745 | ax.errorbar(DenPowLP[cut:], y[cut:], fmt='r^-', xerr=errDenPowLP[cut:],elinewidth=1.0,color='r',linewidth=1.0, label='LP Profile',markersize=2) |
|
745 | ax.errorbar(DenPowLP[cut:], y[cut:], fmt='r^-', xerr=errDenPowLP[cut:],elinewidth=1.0,color='r',linewidth=1.0, label='LP Profile',markersize=2) | |
746 |
|
746 | |||
747 | ax.set_xscale("log")#, nonposx='clip') |
|
747 | ax.set_xscale("log")#, nonposx='clip') | |
748 | grid_y_ticks=numpy.arange(numpy.nanmin(y),numpy.nanmax(y),50) |
|
748 | grid_y_ticks=numpy.arange(numpy.nanmin(y),numpy.nanmax(y),50) | |
749 | ax.set_yticks(grid_y_ticks,minor=True) |
|
749 | ax.set_yticks(grid_y_ticks,minor=True) | |
750 | locmaj = LogLocator(base=10,numticks=12) |
|
750 | locmaj = LogLocator(base=10,numticks=12) | |
751 | ax.xaxis.set_major_locator(locmaj) |
|
751 | ax.xaxis.set_major_locator(locmaj) | |
752 | locmin = LogLocator(base=10.0,subs=(0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9),numticks=12) |
|
752 | locmin = LogLocator(base=10.0,subs=(0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9),numticks=12) | |
753 | ax.xaxis.set_minor_locator(locmin) |
|
753 | ax.xaxis.set_minor_locator(locmin) | |
754 | ax.xaxis.set_minor_formatter(NullFormatter()) |
|
754 | ax.xaxis.set_minor_formatter(NullFormatter()) | |
755 | ax.grid(which='minor') |
|
755 | ax.grid(which='minor') | |
756 | plt.legend(loc='upper left',fontsize=8.5) |
|
756 | plt.legend(loc='upper left',fontsize=8.5) | |
757 | #plt.legend(loc='lower left',fontsize=8.5) |
|
757 | #plt.legend(loc='lower left',fontsize=8.5) | |
758 |
|
758 | |||
759 | class RelativeDenPlot(Plot): |
|
759 | class RelativeDenPlot(Plot): | |
760 | ''' |
|
760 | ''' | |
761 | Written by R. Flores |
|
761 | Written by R. Flores | |
762 | ''' |
|
762 | ''' | |
763 | ''' |
|
763 | ''' | |
764 | Plot for electron density |
|
764 | Plot for electron density | |
765 | ''' |
|
765 | ''' | |
766 |
|
766 | |||
767 | CODE = 'den' |
|
767 | CODE = 'den' | |
768 | #plot_name = 'Electron Density' |
|
768 | #plot_name = 'Electron Density' | |
769 | plot_type = 'scatterbuffer' |
|
769 | plot_type = 'scatterbuffer' | |
770 |
|
770 | |||
771 | def setup(self): |
|
771 | def setup(self): | |
772 |
|
772 | |||
773 | self.ncols = 1 |
|
773 | self.ncols = 1 | |
774 | self.nrows = 1 |
|
774 | self.nrows = 1 | |
775 | self.nplots = 1 |
|
775 | self.nplots = 1 | |
776 | self.ylabel = 'Range [km]' |
|
776 | self.ylabel = 'Range [km]' | |
777 | self.xlabel = r'$\mathrm{N_e}$ Relative Electron Density ($\mathrm{1/cm^3}$)' |
|
777 | self.xlabel = r'$\mathrm{N_e}$ Relative Electron Density ($\mathrm{1/cm^3}$)' | |
778 | self.titles = ['Electron Density'] |
|
778 | self.titles = ['Electron Density'] | |
779 | self.width = 3.5 |
|
779 | self.width = 3.5 | |
780 | self.height = 5.5 |
|
780 | self.height = 5.5 | |
781 | self.colorbar = False |
|
781 | self.colorbar = False | |
782 | self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) |
|
782 | self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) | |
783 |
|
783 | |||
784 | def update(self, dataOut): |
|
784 | def update(self, dataOut): | |
785 | data = {} |
|
785 | data = {} | |
786 | meta = {} |
|
786 | meta = {} | |
787 |
|
787 | |||
788 | data['den_power'] = dataOut.ph2 |
|
788 | data['den_power'] = dataOut.ph2 | |
789 | data['den_error'] = dataOut.sdp2 |
|
789 | data['den_error'] = dataOut.sdp2 | |
790 |
|
790 | |||
791 | meta['yrange'] = dataOut.heightList |
|
791 | meta['yrange'] = dataOut.heightList | |
792 |
|
792 | |||
793 | return data, meta |
|
793 | return data, meta | |
794 |
|
794 | |||
795 | def plot(self): |
|
795 | def plot(self): | |
796 |
|
796 | |||
797 | y = self.data.yrange |
|
797 | y = self.data.yrange | |
798 |
|
798 | |||
799 | ax = self.axes[0] |
|
799 | ax = self.axes[0] | |
800 |
|
800 | |||
801 | data = self.data[-1] |
|
801 | data = self.data[-1] | |
802 |
|
802 | |||
803 | DenPow = data['den_power'] |
|
803 | DenPow = data['den_power'] | |
804 | errDenPow = data['den_error'] |
|
804 | errDenPow = data['den_error'] | |
805 |
|
805 | |||
806 | if ax.firsttime: |
|
806 | if ax.firsttime: | |
807 | self.autoxticks=False |
|
807 | self.autoxticks=False | |
808 | ax.errorbar(DenPow, y, fmt='k^-', xerr=errDenPow,elinewidth=1.0,color='b',linewidth=1.0, label='Power',markersize=2,linestyle='-') |
|
808 | ax.errorbar(DenPow, y, fmt='k^-', xerr=errDenPow,elinewidth=1.0,color='b',linewidth=1.0, label='Power',markersize=2,linestyle='-') | |
809 |
|
809 | |||
810 | plt.legend(loc='upper left',fontsize=8.5) |
|
810 | plt.legend(loc='upper left',fontsize=8.5) | |
811 | #plt.legend(loc='lower left',fontsize=8.5) |
|
811 | #plt.legend(loc='lower left',fontsize=8.5) | |
812 | ax.set_xscale("log")#, nonposx='clip') |
|
812 | ax.set_xscale("log")#, nonposx='clip') | |
813 | grid_y_ticks=numpy.arange(numpy.nanmin(y),numpy.nanmax(y),50) |
|
813 | grid_y_ticks=numpy.arange(numpy.nanmin(y),numpy.nanmax(y),50) | |
814 | self.ystep_given=100 |
|
814 | self.ystep_given=100 | |
815 | ax.set_yticks(grid_y_ticks,minor=True) |
|
815 | ax.set_yticks(grid_y_ticks,minor=True) | |
816 | locmaj = LogLocator(base=10,numticks=12) |
|
816 | locmaj = LogLocator(base=10,numticks=12) | |
817 | ax.xaxis.set_major_locator(locmaj) |
|
817 | ax.xaxis.set_major_locator(locmaj) | |
818 | locmin = LogLocator(base=10.0,subs=(0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9),numticks=12) |
|
818 | locmin = LogLocator(base=10.0,subs=(0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9),numticks=12) | |
819 | ax.xaxis.set_minor_locator(locmin) |
|
819 | ax.xaxis.set_minor_locator(locmin) | |
820 | ax.xaxis.set_minor_formatter(NullFormatter()) |
|
820 | ax.xaxis.set_minor_formatter(NullFormatter()) | |
821 | ax.grid(which='minor') |
|
821 | ax.grid(which='minor') | |
822 |
|
822 | |||
823 | else: |
|
823 | else: | |
824 | dataBefore = self.data[-2] |
|
824 | dataBefore = self.data[-2] | |
825 | DenPowBefore = dataBefore['den_power'] |
|
825 | DenPowBefore = dataBefore['den_power'] | |
826 | self.clear_figures() |
|
826 | self.clear_figures() | |
827 | ax.errorbar(DenPow, y, fmt='k^-', xerr=errDenPow,elinewidth=1.0,color='b',linewidth=1.0, label='Power',markersize=2,linestyle='-') |
|
827 | ax.errorbar(DenPow, y, fmt='k^-', xerr=errDenPow,elinewidth=1.0,color='b',linewidth=1.0, label='Power',markersize=2,linestyle='-') | |
828 | ax.errorbar(DenPowBefore, y, elinewidth=1.0,color='r',linewidth=0.5,linestyle="dashed") |
|
828 | ax.errorbar(DenPowBefore, y, elinewidth=1.0,color='r',linewidth=0.5,linestyle="dashed") | |
829 |
|
829 | |||
830 | ax.set_xscale("log")#, nonposx='clip') |
|
830 | ax.set_xscale("log")#, nonposx='clip') | |
831 | grid_y_ticks=numpy.arange(numpy.nanmin(y),numpy.nanmax(y),50) |
|
831 | grid_y_ticks=numpy.arange(numpy.nanmin(y),numpy.nanmax(y),50) | |
832 | ax.set_yticks(grid_y_ticks,minor=True) |
|
832 | ax.set_yticks(grid_y_ticks,minor=True) | |
833 | locmaj = LogLocator(base=10,numticks=12) |
|
833 | locmaj = LogLocator(base=10,numticks=12) | |
834 | ax.xaxis.set_major_locator(locmaj) |
|
834 | ax.xaxis.set_major_locator(locmaj) | |
835 | locmin = LogLocator(base=10.0,subs=(0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9),numticks=12) |
|
835 | locmin = LogLocator(base=10.0,subs=(0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9),numticks=12) | |
836 | ax.xaxis.set_minor_locator(locmin) |
|
836 | ax.xaxis.set_minor_locator(locmin) | |
837 | ax.xaxis.set_minor_formatter(NullFormatter()) |
|
837 | ax.xaxis.set_minor_formatter(NullFormatter()) | |
838 | ax.grid(which='minor') |
|
838 | ax.grid(which='minor') | |
839 | plt.legend(loc='upper left',fontsize=8.5) |
|
839 | plt.legend(loc='upper left',fontsize=8.5) | |
840 | #plt.legend(loc='lower left',fontsize=8.5) |
|
840 | #plt.legend(loc='lower left',fontsize=8.5) | |
841 |
|
841 | |||
842 | class FaradayAnglePlot(Plot): |
|
842 | class FaradayAnglePlot(Plot): | |
843 | ''' |
|
843 | ''' | |
844 | Written by R. Flores |
|
844 | Written by R. Flores | |
845 | ''' |
|
845 | ''' | |
846 | ''' |
|
846 | ''' | |
847 | Plot for electron density |
|
847 | Plot for electron density | |
848 | ''' |
|
848 | ''' | |
849 |
|
849 | |||
850 | CODE = 'angle' |
|
850 | CODE = 'angle' | |
851 | plot_name = 'Faraday Angle' |
|
851 | plot_name = 'Faraday Angle' | |
852 | plot_type = 'scatterbuffer' |
|
852 | plot_type = 'scatterbuffer' | |
853 |
|
853 | |||
854 | def setup(self): |
|
854 | def setup(self): | |
855 |
|
855 | |||
856 | self.ncols = 1 |
|
856 | self.ncols = 1 | |
857 | self.nrows = 1 |
|
857 | self.nrows = 1 | |
858 | self.nplots = 1 |
|
858 | self.nplots = 1 | |
859 | self.ylabel = 'Range [km]' |
|
859 | self.ylabel = 'Range [km]' | |
860 | self.xlabel = 'Faraday Angle (ΒΊ)' |
|
860 | self.xlabel = 'Faraday Angle (ΒΊ)' | |
861 | self.titles = ['Electron Density'] |
|
861 | self.titles = ['Electron Density'] | |
862 | self.width = 3.5 |
|
862 | self.width = 3.5 | |
863 | self.height = 5.5 |
|
863 | self.height = 5.5 | |
864 | self.colorbar = False |
|
864 | self.colorbar = False | |
865 | self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) |
|
865 | self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) | |
866 |
|
866 | |||
867 | def update(self, dataOut): |
|
867 | def update(self, dataOut): | |
868 | data = {} |
|
868 | data = {} | |
869 | meta = {} |
|
869 | meta = {} | |
870 |
|
870 | |||
871 | data['angle'] = numpy.degrees(dataOut.phi) |
|
871 | data['angle'] = numpy.degrees(dataOut.phi) | |
872 | #''' |
|
872 | #''' | |
873 | #print(dataOut.phi_uwrp) |
|
873 | #print(dataOut.phi_uwrp) | |
874 | #print(data['angle']) |
|
874 | #print(data['angle']) | |
875 | #exit(1) |
|
875 | #exit(1) | |
876 | #''' |
|
876 | #''' | |
877 | data['dphi'] = dataOut.dphi_uc*10 |
|
877 | data['dphi'] = dataOut.dphi_uc*10 | |
878 | #print(dataOut.dphi) |
|
878 | #print(dataOut.dphi) | |
879 |
|
879 | |||
880 | #data['NSHTS'] = dataOut.NSHTS |
|
880 | #data['NSHTS'] = dataOut.NSHTS | |
881 |
|
881 | |||
882 | #meta['yrange'] = dataOut.heightList[0:dataOut.NSHTS] |
|
882 | #meta['yrange'] = dataOut.heightList[0:dataOut.NSHTS] | |
883 |
|
883 | |||
884 | return data, meta |
|
884 | return data, meta | |
885 |
|
885 | |||
886 | def plot(self): |
|
886 | def plot(self): | |
887 |
|
887 | |||
888 | data = self.data[-1] |
|
888 | data = self.data[-1] | |
889 | self.x = data[self.CODE] |
|
889 | self.x = data[self.CODE] | |
890 | dphi = data['dphi'] |
|
890 | dphi = data['dphi'] | |
891 | self.y = self.data.yrange |
|
891 | self.y = self.data.yrange | |
892 | self.xmin = -360#-180 |
|
892 | self.xmin = -360#-180 | |
893 | self.xmax = 360#180 |
|
893 | self.xmax = 360#180 | |
894 | ax = self.axes[0] |
|
894 | ax = self.axes[0] | |
895 |
|
895 | |||
896 | if ax.firsttime: |
|
896 | if ax.firsttime: | |
897 | self.autoxticks=False |
|
897 | self.autoxticks=False | |
898 | #if self.CODE=='den': |
|
898 | #if self.CODE=='den': | |
899 | ax.plot(self.x, self.y,marker='o',color='g',linewidth=1.0,markersize=2) |
|
899 | ax.plot(self.x, self.y,marker='o',color='g',linewidth=1.0,markersize=2) | |
900 | ax.plot(dphi, self.y,marker='o',color='blue',linewidth=1.0,markersize=2) |
|
900 | ax.plot(dphi, self.y,marker='o',color='blue',linewidth=1.0,markersize=2) | |
901 |
|
901 | |||
902 | grid_y_ticks=numpy.arange(numpy.nanmin(self.y),numpy.nanmax(self.y),50) |
|
902 | grid_y_ticks=numpy.arange(numpy.nanmin(self.y),numpy.nanmax(self.y),50) | |
903 | self.ystep_given=100 |
|
903 | self.ystep_given=100 | |
904 | if self.CODE=='denLP': |
|
904 | if self.CODE=='denLP': | |
905 | self.ystep_given=200 |
|
905 | self.ystep_given=200 | |
906 | ax.set_yticks(grid_y_ticks,minor=True) |
|
906 | ax.set_yticks(grid_y_ticks,minor=True) | |
907 | ax.grid(which='minor') |
|
907 | ax.grid(which='minor') | |
908 | #plt.tight_layout() |
|
908 | #plt.tight_layout() | |
909 | else: |
|
909 | else: | |
910 |
|
910 | |||
911 | self.clear_figures() |
|
911 | self.clear_figures() | |
912 | #if self.CODE=='den': |
|
912 | #if self.CODE=='den': | |
913 | #print(numpy.shape(self.x)) |
|
913 | #print(numpy.shape(self.x)) | |
914 | ax.plot(self.x, self.y, marker='o',color='g',linewidth=1.0, markersize=2) |
|
914 | ax.plot(self.x, self.y, marker='o',color='g',linewidth=1.0, markersize=2) | |
915 | ax.plot(dphi, self.y,marker='o',color='blue',linewidth=1.0,markersize=2) |
|
915 | ax.plot(dphi, self.y,marker='o',color='blue',linewidth=1.0,markersize=2) | |
916 |
|
916 | |||
917 | grid_y_ticks=numpy.arange(numpy.nanmin(self.y),numpy.nanmax(self.y),50) |
|
917 | grid_y_ticks=numpy.arange(numpy.nanmin(self.y),numpy.nanmax(self.y),50) | |
918 | ax.set_yticks(grid_y_ticks,minor=True) |
|
918 | ax.set_yticks(grid_y_ticks,minor=True) | |
919 | ax.grid(which='minor') |
|
919 | ax.grid(which='minor') | |
920 |
|
920 | |||
921 | class EDensityHPPlot(EDensityPlot): |
|
921 | class EDensityHPPlot(EDensityPlot): | |
922 | ''' |
|
922 | ''' | |
923 | Written by R. Flores |
|
923 | Written by R. Flores | |
924 | ''' |
|
924 | ''' | |
925 | ''' |
|
925 | ''' | |
926 | Plot for Electron Density Hybrid Experiment |
|
926 | Plot for Electron Density Hybrid Experiment | |
927 | ''' |
|
927 | ''' | |
928 |
|
928 | |||
929 | CODE = 'denLP' |
|
929 | CODE = 'denLP' | |
930 | plot_name = 'Electron Density' |
|
930 | plot_name = 'Electron Density' | |
931 | plot_type = 'scatterbuffer' |
|
931 | plot_type = 'scatterbuffer' | |
932 |
|
932 | |||
933 | def update(self, dataOut): |
|
933 | def update(self, dataOut): | |
934 | data = {} |
|
934 | data = {} | |
935 | meta = {} |
|
935 | meta = {} | |
936 |
|
936 | |||
937 | data['den_power'] = dataOut.ph2[:dataOut.NSHTS] |
|
937 | data['den_power'] = dataOut.ph2[:dataOut.NSHTS] | |
938 | data['den_Faraday']=dataOut.dphi[:dataOut.NSHTS] |
|
938 | data['den_Faraday']=dataOut.dphi[:dataOut.NSHTS] | |
939 | data['den_error']=dataOut.sdp2[:dataOut.NSHTS] |
|
939 | data['den_error']=dataOut.sdp2[:dataOut.NSHTS] | |
940 | data['den_LP']=dataOut.ne[:dataOut.NACF] |
|
940 | data['den_LP']=dataOut.ne[:dataOut.NACF] | |
941 | data['den_LP_error']=dataOut.ene[:dataOut.NACF]*dataOut.ne[:dataOut.NACF]*0.434 |
|
941 | data['den_LP_error']=dataOut.ene[:dataOut.NACF]*dataOut.ne[:dataOut.NACF]*0.434 | |
942 | #self.ene=10**dataOut.ene[:dataOut.NACF] |
|
942 | #self.ene=10**dataOut.ene[:dataOut.NACF] | |
943 | data['NSHTS']=dataOut.NSHTS |
|
943 | data['NSHTS']=dataOut.NSHTS | |
944 | data['cut']=dataOut.cut |
|
944 | data['cut']=dataOut.cut | |
945 |
|
945 | |||
946 | return data, meta |
|
946 | return data, meta | |
947 |
|
947 | |||
948 |
|
948 | |||
949 | class ACFsPlot(Plot): |
|
949 | class ACFsPlot(Plot): | |
950 | ''' |
|
950 | ''' | |
951 | Written by R. Flores |
|
951 | Written by R. Flores | |
952 | ''' |
|
952 | ''' | |
953 | ''' |
|
953 | ''' | |
954 | Plot for ACFs Double Pulse Experiment |
|
954 | Plot for ACFs Double Pulse Experiment | |
955 | ''' |
|
955 | ''' | |
956 |
|
956 | |||
957 | CODE = 'acfs' |
|
957 | CODE = 'acfs' | |
958 | #plot_name = 'ACF' |
|
958 | #plot_name = 'ACF' | |
959 | plot_type = 'scatterbuffer' |
|
959 | plot_type = 'scatterbuffer' | |
960 |
|
960 | |||
961 |
|
961 | |||
962 | def setup(self): |
|
962 | def setup(self): | |
963 | self.ncols = 1 |
|
963 | self.ncols = 1 | |
964 | self.nrows = 1 |
|
964 | self.nrows = 1 | |
965 | self.nplots = 1 |
|
965 | self.nplots = 1 | |
966 | self.ylabel = 'Range [km]' |
|
966 | self.ylabel = 'Range [km]' | |
967 | self.xlabel = 'Lag (ms)' |
|
967 | self.xlabel = 'Lag (ms)' | |
968 | self.titles = ['ACFs'] |
|
968 | self.titles = ['ACFs'] | |
969 | self.width = 3.5 |
|
969 | self.width = 3.5 | |
970 | self.height = 5.5 |
|
970 | self.height = 5.5 | |
971 | self.colorbar = False |
|
971 | self.colorbar = False | |
972 | self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) |
|
972 | self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) | |
973 |
|
973 | |||
974 | def update(self, dataOut): |
|
974 | def update(self, dataOut): | |
975 | data = {} |
|
975 | data = {} | |
976 | meta = {} |
|
976 | meta = {} | |
977 |
|
977 | |||
978 | data['ACFs'] = dataOut.acfs_to_plot |
|
978 | data['ACFs'] = dataOut.acfs_to_plot | |
979 | data['ACFs_error'] = dataOut.acfs_error_to_plot |
|
979 | data['ACFs_error'] = dataOut.acfs_error_to_plot | |
980 | data['lags'] = dataOut.lags_to_plot |
|
980 | data['lags'] = dataOut.lags_to_plot | |
981 | data['Lag_contaminated_1'] = dataOut.x_igcej_to_plot |
|
981 | data['Lag_contaminated_1'] = dataOut.x_igcej_to_plot | |
982 | data['Lag_contaminated_2'] = dataOut.x_ibad_to_plot |
|
982 | data['Lag_contaminated_2'] = dataOut.x_ibad_to_plot | |
983 | data['Height_contaminated_1'] = dataOut.y_igcej_to_plot |
|
983 | data['Height_contaminated_1'] = dataOut.y_igcej_to_plot | |
984 | data['Height_contaminated_2'] = dataOut.y_ibad_to_plot |
|
984 | data['Height_contaminated_2'] = dataOut.y_ibad_to_plot | |
985 |
|
985 | |||
986 | meta['yrange'] = numpy.array([]) |
|
986 | meta['yrange'] = numpy.array([]) | |
987 | #meta['NSHTS'] = dataOut.NSHTS |
|
987 | #meta['NSHTS'] = dataOut.NSHTS | |
988 | #meta['DPL'] = dataOut.DPL |
|
988 | #meta['DPL'] = dataOut.DPL | |
989 | data['NSHTS'] = dataOut.NSHTS #This is metadata |
|
989 | data['NSHTS'] = dataOut.NSHTS #This is metadata | |
990 | data['DPL'] = dataOut.DPL #This is metadata |
|
990 | data['DPL'] = dataOut.DPL #This is metadata | |
991 |
|
991 | |||
992 | return data, meta |
|
992 | return data, meta | |
993 |
|
993 | |||
994 | def plot(self): |
|
994 | def plot(self): | |
995 |
|
995 | |||
996 | data = self.data[-1] |
|
996 | data = self.data[-1] | |
997 | #NSHTS = self.meta['NSHTS'] |
|
997 | #NSHTS = self.meta['NSHTS'] | |
998 | #DPL = self.meta['DPL'] |
|
998 | #DPL = self.meta['DPL'] | |
999 | NSHTS = data['NSHTS'] #This is metadata |
|
999 | NSHTS = data['NSHTS'] #This is metadata | |
1000 | DPL = data['DPL'] #This is metadata |
|
1000 | DPL = data['DPL'] #This is metadata | |
1001 |
|
1001 | |||
1002 | lags = data['lags'] |
|
1002 | lags = data['lags'] | |
1003 | ACFs = data['ACFs'] |
|
1003 | ACFs = data['ACFs'] | |
1004 | errACFs = data['ACFs_error'] |
|
1004 | errACFs = data['ACFs_error'] | |
1005 | BadLag1 = data['Lag_contaminated_1'] |
|
1005 | BadLag1 = data['Lag_contaminated_1'] | |
1006 | BadLag2 = data['Lag_contaminated_2'] |
|
1006 | BadLag2 = data['Lag_contaminated_2'] | |
1007 | BadHei1 = data['Height_contaminated_1'] |
|
1007 | BadHei1 = data['Height_contaminated_1'] | |
1008 | BadHei2 = data['Height_contaminated_2'] |
|
1008 | BadHei2 = data['Height_contaminated_2'] | |
1009 |
|
1009 | |||
1010 | self.xmin = 0.0 |
|
1010 | self.xmin = 0.0 | |
1011 | self.xmax = 2.0 |
|
1011 | self.xmax = 2.0 | |
1012 | self.y = ACFs |
|
1012 | self.y = ACFs | |
1013 |
|
1013 | |||
1014 | ax = self.axes[0] |
|
1014 | ax = self.axes[0] | |
1015 |
|
1015 | |||
1016 | if ax.firsttime: |
|
1016 | if ax.firsttime: | |
1017 |
|
1017 | |||
1018 | for i in range(NSHTS): |
|
1018 | for i in range(NSHTS): | |
1019 | x_aux = numpy.isfinite(lags[i,:]) |
|
1019 | x_aux = numpy.isfinite(lags[i,:]) | |
1020 | y_aux = numpy.isfinite(ACFs[i,:]) |
|
1020 | y_aux = numpy.isfinite(ACFs[i,:]) | |
1021 | yerr_aux = numpy.isfinite(errACFs[i,:]) |
|
1021 | yerr_aux = numpy.isfinite(errACFs[i,:]) | |
1022 | x_igcej_aux = numpy.isfinite(BadLag1[i,:]) |
|
1022 | x_igcej_aux = numpy.isfinite(BadLag1[i,:]) | |
1023 | y_igcej_aux = numpy.isfinite(BadHei1[i,:]) |
|
1023 | y_igcej_aux = numpy.isfinite(BadHei1[i,:]) | |
1024 | x_ibad_aux = numpy.isfinite(BadLag2[i,:]) |
|
1024 | x_ibad_aux = numpy.isfinite(BadLag2[i,:]) | |
1025 | y_ibad_aux = numpy.isfinite(BadHei2[i,:]) |
|
1025 | y_ibad_aux = numpy.isfinite(BadHei2[i,:]) | |
1026 | if lags[i,:][~numpy.isnan(lags[i,:])].shape[0]>2: |
|
1026 | if lags[i,:][~numpy.isnan(lags[i,:])].shape[0]>2: | |
1027 | ax.errorbar(lags[i,x_aux], ACFs[i,y_aux], yerr=errACFs[i,x_aux],color='b',marker='o',linewidth=1.0,markersize=2) |
|
1027 | ax.errorbar(lags[i,x_aux], ACFs[i,y_aux], yerr=errACFs[i,x_aux],color='b',marker='o',linewidth=1.0,markersize=2) | |
1028 | ax.plot(BadLag1[i,x_igcej_aux],BadHei1[i,y_igcej_aux],'x',color='red',markersize=2) |
|
1028 | ax.plot(BadLag1[i,x_igcej_aux],BadHei1[i,y_igcej_aux],'x',color='red',markersize=2) | |
1029 | ax.plot(BadLag2[i,x_ibad_aux],BadHei2[i,y_ibad_aux],'X',color='red',markersize=2) |
|
1029 | ax.plot(BadLag2[i,x_ibad_aux],BadHei2[i,y_ibad_aux],'X',color='red',markersize=2) | |
1030 |
|
1030 | |||
1031 | self.xstep_given = (self.xmax-self.xmin)/(DPL-1) |
|
1031 | self.xstep_given = (self.xmax-self.xmin)/(DPL-1) | |
1032 | self.ystep_given = 50 |
|
1032 | self.ystep_given = 50 | |
1033 | ax.yaxis.set_minor_locator(MultipleLocator(15)) |
|
1033 | ax.yaxis.set_minor_locator(MultipleLocator(15)) | |
1034 | ax.grid(which='minor') |
|
1034 | ax.grid(which='minor') | |
1035 |
|
1035 | |||
1036 | else: |
|
1036 | else: | |
1037 | self.clear_figures() |
|
1037 | self.clear_figures() | |
1038 | for i in range(NSHTS): |
|
1038 | for i in range(NSHTS): | |
1039 | x_aux = numpy.isfinite(lags[i,:]) |
|
1039 | x_aux = numpy.isfinite(lags[i,:]) | |
1040 | y_aux = numpy.isfinite(ACFs[i,:]) |
|
1040 | y_aux = numpy.isfinite(ACFs[i,:]) | |
1041 | yerr_aux = numpy.isfinite(errACFs[i,:]) |
|
1041 | yerr_aux = numpy.isfinite(errACFs[i,:]) | |
1042 | x_igcej_aux = numpy.isfinite(BadLag1[i,:]) |
|
1042 | x_igcej_aux = numpy.isfinite(BadLag1[i,:]) | |
1043 | y_igcej_aux = numpy.isfinite(BadHei1[i,:]) |
|
1043 | y_igcej_aux = numpy.isfinite(BadHei1[i,:]) | |
1044 | x_ibad_aux = numpy.isfinite(BadLag2[i,:]) |
|
1044 | x_ibad_aux = numpy.isfinite(BadLag2[i,:]) | |
1045 | y_ibad_aux = numpy.isfinite(BadHei2[i,:]) |
|
1045 | y_ibad_aux = numpy.isfinite(BadHei2[i,:]) | |
1046 | if lags[i,:][~numpy.isnan(lags[i,:])].shape[0]>2: |
|
1046 | if lags[i,:][~numpy.isnan(lags[i,:])].shape[0]>2: | |
1047 | ax.errorbar(lags[i,x_aux], ACFs[i,y_aux], yerr=errACFs[i,x_aux],linewidth=1.0,markersize=2,color='b',marker='o') |
|
1047 | ax.errorbar(lags[i,x_aux], ACFs[i,y_aux], yerr=errACFs[i,x_aux],linewidth=1.0,markersize=2,color='b',marker='o') | |
1048 | ax.plot(BadLag1[i,x_igcej_aux],BadHei1[i,y_igcej_aux],'x',color='red',markersize=2) |
|
1048 | ax.plot(BadLag1[i,x_igcej_aux],BadHei1[i,y_igcej_aux],'x',color='red',markersize=2) | |
1049 | ax.plot(BadLag2[i,x_ibad_aux],BadHei2[i,y_ibad_aux],'X',color='red',markersize=2) |
|
1049 | ax.plot(BadLag2[i,x_ibad_aux],BadHei2[i,y_ibad_aux],'X',color='red',markersize=2) | |
1050 | ax.yaxis.set_minor_locator(MultipleLocator(15)) |
|
1050 | ax.yaxis.set_minor_locator(MultipleLocator(15)) | |
1051 |
|
1051 | |||
1052 | class ACFsLPPlot(Plot): |
|
1052 | class ACFsLPPlot(Plot): | |
1053 | ''' |
|
1053 | ''' | |
1054 | Written by R. Flores |
|
1054 | Written by R. Flores | |
1055 | ''' |
|
1055 | ''' | |
1056 | ''' |
|
1056 | ''' | |
1057 | Plot for ACFs Double Pulse Experiment |
|
1057 | Plot for ACFs Double Pulse Experiment | |
1058 | ''' |
|
1058 | ''' | |
1059 |
|
1059 | |||
1060 | CODE = 'acfs_LP' |
|
1060 | CODE = 'acfs_LP' | |
1061 | #plot_name = 'ACF' |
|
1061 | #plot_name = 'ACF' | |
1062 | plot_type = 'scatterbuffer' |
|
1062 | plot_type = 'scatterbuffer' | |
1063 |
|
1063 | |||
1064 |
|
1064 | |||
1065 | def setup(self): |
|
1065 | def setup(self): | |
1066 | self.ncols = 1 |
|
1066 | self.ncols = 1 | |
1067 | self.nrows = 1 |
|
1067 | self.nrows = 1 | |
1068 | self.nplots = 1 |
|
1068 | self.nplots = 1 | |
1069 | self.ylabel = 'Range [km]' |
|
1069 | self.ylabel = 'Range [km]' | |
1070 | self.xlabel = 'Lag (ms)' |
|
1070 | self.xlabel = 'Lag (ms)' | |
1071 | self.titles = ['ACFs'] |
|
1071 | self.titles = ['ACFs'] | |
1072 | self.width = 3.5 |
|
1072 | self.width = 3.5 | |
1073 | self.height = 5.5 |
|
1073 | self.height = 5.5 | |
1074 | self.colorbar = False |
|
1074 | self.colorbar = False | |
1075 | self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) |
|
1075 | self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) | |
1076 |
|
1076 | |||
1077 | def update(self, dataOut): |
|
1077 | def update(self, dataOut): | |
1078 | data = {} |
|
1078 | data = {} | |
1079 | meta = {} |
|
1079 | meta = {} | |
1080 |
|
1080 | |||
1081 | aux=numpy.zeros((dataOut.NACF,dataOut.IBITS),'float32') |
|
1081 | aux=numpy.zeros((dataOut.NACF,dataOut.IBITS),'float32') | |
1082 | errors=numpy.zeros((dataOut.NACF,dataOut.IBITS),'float32') |
|
1082 | errors=numpy.zeros((dataOut.NACF,dataOut.IBITS),'float32') | |
1083 | lags_LP_to_plot=numpy.zeros((dataOut.NACF,dataOut.IBITS),'float32') |
|
1083 | lags_LP_to_plot=numpy.zeros((dataOut.NACF,dataOut.IBITS),'float32') | |
1084 |
|
1084 | |||
1085 | for i in range(dataOut.NACF): |
|
1085 | for i in range(dataOut.NACF): | |
1086 | for j in range(dataOut.IBITS): |
|
1086 | for j in range(dataOut.IBITS): | |
1087 | if numpy.abs(dataOut.errors[j,i]/dataOut.output_LP_integrated.real[0,i,0])<1.0: |
|
1087 | if numpy.abs(dataOut.errors[j,i]/dataOut.output_LP_integrated.real[0,i,0])<1.0: | |
1088 | aux[i,j]=dataOut.output_LP_integrated.real[j,i,0]/dataOut.output_LP_integrated.real[0,i,0] |
|
1088 | aux[i,j]=dataOut.output_LP_integrated.real[j,i,0]/dataOut.output_LP_integrated.real[0,i,0] | |
1089 | aux[i,j]=max(min(aux[i,j],1.0),-1.0)*dataOut.DH+dataOut.heightList[i] |
|
1089 | aux[i,j]=max(min(aux[i,j],1.0),-1.0)*dataOut.DH+dataOut.heightList[i] | |
1090 | lags_LP_to_plot[i,j]=dataOut.lags_LP[j] |
|
1090 | lags_LP_to_plot[i,j]=dataOut.lags_LP[j] | |
1091 | errors[i,j]=dataOut.errors[j,i]/dataOut.output_LP_integrated.real[0,i,0]*dataOut.DH |
|
1091 | errors[i,j]=dataOut.errors[j,i]/dataOut.output_LP_integrated.real[0,i,0]*dataOut.DH | |
1092 | else: |
|
1092 | else: | |
1093 | aux[i,j]=numpy.nan |
|
1093 | aux[i,j]=numpy.nan | |
1094 | lags_LP_to_plot[i,j]=numpy.nan |
|
1094 | lags_LP_to_plot[i,j]=numpy.nan | |
1095 | errors[i,j]=numpy.nan |
|
1095 | errors[i,j]=numpy.nan | |
1096 |
|
1096 | |||
1097 | data['ACFs'] = aux |
|
1097 | data['ACFs'] = aux | |
1098 | data['ACFs_error'] = errors |
|
1098 | data['ACFs_error'] = errors | |
1099 | data['lags'] = lags_LP_to_plot |
|
1099 | data['lags'] = lags_LP_to_plot | |
1100 |
|
1100 | |||
1101 | meta['yrange'] = numpy.array([]) |
|
1101 | meta['yrange'] = numpy.array([]) | |
1102 | #meta['NACF'] = dataOut.NACF |
|
1102 | #meta['NACF'] = dataOut.NACF | |
1103 | #meta['NLAG'] = dataOut.NLAG |
|
1103 | #meta['NLAG'] = dataOut.NLAG | |
1104 | data['NACF'] = dataOut.NACF #This is metadata |
|
1104 | data['NACF'] = dataOut.NACF #This is metadata | |
1105 | data['NLAG'] = dataOut.NLAG #This is metadata |
|
1105 | data['NLAG'] = dataOut.NLAG #This is metadata | |
1106 |
|
1106 | |||
1107 | return data, meta |
|
1107 | return data, meta | |
1108 |
|
1108 | |||
1109 | def plot(self): |
|
1109 | def plot(self): | |
1110 |
|
1110 | |||
1111 | data = self.data[-1] |
|
1111 | data = self.data[-1] | |
1112 | #NACF = self.meta['NACF'] |
|
1112 | #NACF = self.meta['NACF'] | |
1113 | #NLAG = self.meta['NLAG'] |
|
1113 | #NLAG = self.meta['NLAG'] | |
1114 | NACF = data['NACF'] #This is metadata |
|
1114 | NACF = data['NACF'] #This is metadata | |
1115 | NLAG = data['NLAG'] #This is metadata |
|
1115 | NLAG = data['NLAG'] #This is metadata | |
1116 |
|
1116 | |||
1117 | lags = data['lags'] |
|
1117 | lags = data['lags'] | |
1118 | ACFs = data['ACFs'] |
|
1118 | ACFs = data['ACFs'] | |
1119 | errACFs = data['ACFs_error'] |
|
1119 | errACFs = data['ACFs_error'] | |
1120 |
|
1120 | |||
1121 | self.xmin = 0.0 |
|
1121 | self.xmin = 0.0 | |
1122 | self.xmax = 1.5 |
|
1122 | self.xmax = 1.5 | |
1123 |
|
1123 | |||
1124 | self.y = ACFs |
|
1124 | self.y = ACFs | |
1125 |
|
1125 | |||
1126 | ax = self.axes[0] |
|
1126 | ax = self.axes[0] | |
1127 |
|
1127 | |||
1128 | if ax.firsttime: |
|
1128 | if ax.firsttime: | |
1129 |
|
1129 | |||
1130 | for i in range(NACF): |
|
1130 | for i in range(NACF): | |
1131 | x_aux = numpy.isfinite(lags[i,:]) |
|
1131 | x_aux = numpy.isfinite(lags[i,:]) | |
1132 | y_aux = numpy.isfinite(ACFs[i,:]) |
|
1132 | y_aux = numpy.isfinite(ACFs[i,:]) | |
1133 | yerr_aux = numpy.isfinite(errACFs[i,:]) |
|
1133 | yerr_aux = numpy.isfinite(errACFs[i,:]) | |
1134 |
|
1134 | |||
1135 | if lags[i,:][~numpy.isnan(lags[i,:])].shape[0]>2: |
|
1135 | if lags[i,:][~numpy.isnan(lags[i,:])].shape[0]>2: | |
1136 | ax.errorbar(lags[i,x_aux], ACFs[i,y_aux], yerr=errACFs[i,x_aux],color='b',linewidth=1.0,markersize=2,ecolor='r') |
|
1136 | ax.errorbar(lags[i,x_aux], ACFs[i,y_aux], yerr=errACFs[i,x_aux],color='b',linewidth=1.0,markersize=2,ecolor='r') | |
1137 |
|
1137 | |||
1138 | #self.xstep_given = (self.xmax-self.xmin)/(self.data.NLAG-1) |
|
1138 | #self.xstep_given = (self.xmax-self.xmin)/(self.data.NLAG-1) | |
1139 | self.xstep_given=0.3 |
|
1139 | self.xstep_given=0.3 | |
1140 | self.ystep_given = 200 |
|
1140 | self.ystep_given = 200 | |
1141 | ax.yaxis.set_minor_locator(MultipleLocator(15)) |
|
1141 | ax.yaxis.set_minor_locator(MultipleLocator(15)) | |
1142 | ax.grid(which='minor') |
|
1142 | ax.grid(which='minor') | |
1143 |
|
1143 | |||
1144 | else: |
|
1144 | else: | |
1145 | self.clear_figures() |
|
1145 | self.clear_figures() | |
1146 |
|
1146 | |||
1147 | for i in range(NACF): |
|
1147 | for i in range(NACF): | |
1148 | x_aux = numpy.isfinite(lags[i,:]) |
|
1148 | x_aux = numpy.isfinite(lags[i,:]) | |
1149 | y_aux = numpy.isfinite(ACFs[i,:]) |
|
1149 | y_aux = numpy.isfinite(ACFs[i,:]) | |
1150 | yerr_aux = numpy.isfinite(errACFs[i,:]) |
|
1150 | yerr_aux = numpy.isfinite(errACFs[i,:]) | |
1151 |
|
1151 | |||
1152 | if lags[i,:][~numpy.isnan(lags[i,:])].shape[0]>2: |
|
1152 | if lags[i,:][~numpy.isnan(lags[i,:])].shape[0]>2: | |
1153 | ax.errorbar(lags[i,x_aux], ACFs[i,y_aux], yerr=errACFs[i,x_aux],color='b',linewidth=1.0,markersize=2,ecolor='r') |
|
1153 | ax.errorbar(lags[i,x_aux], ACFs[i,y_aux], yerr=errACFs[i,x_aux],color='b',linewidth=1.0,markersize=2,ecolor='r') | |
1154 |
|
1154 | |||
1155 | ax.yaxis.set_minor_locator(MultipleLocator(15)) |
|
1155 | ax.yaxis.set_minor_locator(MultipleLocator(15)) | |
1156 |
|
1156 | |||
1157 |
|
1157 | |||
1158 | class CrossProductsPlot(Plot): |
|
1158 | class CrossProductsPlot(Plot): | |
1159 | ''' |
|
1159 | ''' | |
1160 | Written by R. Flores |
|
1160 | Written by R. Flores | |
1161 | ''' |
|
1161 | ''' | |
1162 | ''' |
|
1162 | ''' | |
1163 | Plot for cross products |
|
1163 | Plot for cross products | |
1164 | ''' |
|
1164 | ''' | |
1165 |
|
1165 | |||
1166 | CODE = 'crossprod' |
|
1166 | CODE = 'crossprod' | |
1167 | plot_name = 'Cross Products' |
|
1167 | plot_name = 'Cross Products' | |
1168 | plot_type = 'scatterbuffer' |
|
1168 | plot_type = 'scatterbuffer' | |
1169 |
|
1169 | |||
1170 | def setup(self): |
|
1170 | def setup(self): | |
1171 |
|
1171 | |||
1172 | self.ncols = 3 |
|
1172 | self.ncols = 3 | |
1173 | self.nrows = 1 |
|
1173 | self.nrows = 1 | |
1174 | self.nplots = 3 |
|
1174 | self.nplots = 3 | |
1175 | self.ylabel = 'Range [km]' |
|
1175 | self.ylabel = 'Range [km]' | |
1176 | self.width = 3.5*self.nplots |
|
1176 | self.width = 3.5*self.nplots | |
1177 | self.height = 5.5 |
|
1177 | self.height = 5.5 | |
1178 | self.colorbar = False |
|
1178 | self.colorbar = False | |
1179 | self.titles = [] |
|
1179 | self.titles = [] | |
1180 |
|
1180 | |||
1181 | def update(self, dataOut): |
|
1181 | def update(self, dataOut): | |
1182 |
|
1182 | |||
1183 | data = {} |
|
1183 | data = {} | |
1184 | meta = {} |
|
1184 | meta = {} | |
1185 |
|
1185 | |||
1186 | data['crossprod'] = dataOut.crossprods |
|
1186 | data['crossprod'] = dataOut.crossprods | |
1187 | data['NDP'] = dataOut.NDP |
|
1187 | data['NDP'] = dataOut.NDP | |
1188 |
|
1188 | |||
1189 | return data, meta |
|
1189 | return data, meta | |
1190 |
|
1190 | |||
1191 | def plot(self): |
|
1191 | def plot(self): | |
1192 |
|
1192 | |||
1193 | self.x = self.data['crossprod'][:,-1,:,:,:,:] |
|
1193 | self.x = self.data['crossprod'][:,-1,:,:,:,:] | |
1194 | self.y = self.data.heights[0:self.data['NDP']] |
|
1194 | self.y = self.data.heights[0:self.data['NDP']] | |
1195 |
|
1195 | |||
1196 | for n, ax in enumerate(self.axes): |
|
1196 | for n, ax in enumerate(self.axes): | |
1197 |
|
1197 | |||
1198 | self.xmin=numpy.min(numpy.concatenate((self.x[n][0,20:30,0,0],self.x[n][1,20:30,0,0],self.x[n][2,20:30,0,0],self.x[n][3,20:30,0,0]))) |
|
1198 | self.xmin=numpy.min(numpy.concatenate((self.x[n][0,20:30,0,0],self.x[n][1,20:30,0,0],self.x[n][2,20:30,0,0],self.x[n][3,20:30,0,0]))) | |
1199 | self.xmax=numpy.max(numpy.concatenate((self.x[n][0,20:30,0,0],self.x[n][1,20:30,0,0],self.x[n][2,20:30,0,0],self.x[n][3,20:30,0,0]))) |
|
1199 | self.xmax=numpy.max(numpy.concatenate((self.x[n][0,20:30,0,0],self.x[n][1,20:30,0,0],self.x[n][2,20:30,0,0],self.x[n][3,20:30,0,0]))) | |
1200 |
|
1200 | |||
1201 | if ax.firsttime: |
|
1201 | if ax.firsttime: | |
1202 |
|
1202 | |||
1203 | self.autoxticks=False |
|
1203 | self.autoxticks=False | |
1204 | if n==0: |
|
1204 | if n==0: | |
1205 | label1='kax' |
|
1205 | label1='kax' | |
1206 | label2='kay' |
|
1206 | label2='kay' | |
1207 | label3='kbx' |
|
1207 | label3='kbx' | |
1208 | label4='kby' |
|
1208 | label4='kby' | |
1209 | self.xlimits=[(self.xmin,self.xmax)] |
|
1209 | self.xlimits=[(self.xmin,self.xmax)] | |
1210 | elif n==1: |
|
1210 | elif n==1: | |
1211 | label1='kax2' |
|
1211 | label1='kax2' | |
1212 | label2='kay2' |
|
1212 | label2='kay2' | |
1213 | label3='kbx2' |
|
1213 | label3='kbx2' | |
1214 | label4='kby2' |
|
1214 | label4='kby2' | |
1215 | self.xlimits.append((self.xmin,self.xmax)) |
|
1215 | self.xlimits.append((self.xmin,self.xmax)) | |
1216 | elif n==2: |
|
1216 | elif n==2: | |
1217 | label1='kaxay' |
|
1217 | label1='kaxay' | |
1218 | label2='kbxby' |
|
1218 | label2='kbxby' | |
1219 | label3='kaxbx' |
|
1219 | label3='kaxbx' | |
1220 | label4='kaxby' |
|
1220 | label4='kaxby' | |
1221 | self.xlimits.append((self.xmin,self.xmax)) |
|
1221 | self.xlimits.append((self.xmin,self.xmax)) | |
1222 |
|
1222 | |||
1223 | ax.plotline1 = ax.plot(self.x[n][0,:,0,0], self.y, color='r',linewidth=2.0, label=label1) |
|
1223 | ax.plotline1 = ax.plot(self.x[n][0,:,0,0], self.y, color='r',linewidth=2.0, label=label1) | |
1224 | ax.plotline2 = ax.plot(self.x[n][1,:,0,0], self.y, color='k',linewidth=2.0, label=label2) |
|
1224 | ax.plotline2 = ax.plot(self.x[n][1,:,0,0], self.y, color='k',linewidth=2.0, label=label2) | |
1225 | ax.plotline3 = ax.plot(self.x[n][2,:,0,0], self.y, color='b',linewidth=2.0, label=label3) |
|
1225 | ax.plotline3 = ax.plot(self.x[n][2,:,0,0], self.y, color='b',linewidth=2.0, label=label3) | |
1226 | ax.plotline4 = ax.plot(self.x[n][3,:,0,0], self.y, color='m',linewidth=2.0, label=label4) |
|
1226 | ax.plotline4 = ax.plot(self.x[n][3,:,0,0], self.y, color='m',linewidth=2.0, label=label4) | |
1227 | ax.legend(loc='upper right') |
|
1227 | ax.legend(loc='upper right') | |
1228 | ax.set_xlim(self.xmin, self.xmax) |
|
1228 | ax.set_xlim(self.xmin, self.xmax) | |
1229 | self.titles.append('{}'.format(self.plot_name.upper())) |
|
1229 | self.titles.append('{}'.format(self.plot_name.upper())) | |
1230 |
|
1230 | |||
1231 | else: |
|
1231 | else: | |
1232 |
|
1232 | |||
1233 | if n==0: |
|
1233 | if n==0: | |
1234 | self.xlimits=[(self.xmin,self.xmax)] |
|
1234 | self.xlimits=[(self.xmin,self.xmax)] | |
1235 | else: |
|
1235 | else: | |
1236 | self.xlimits.append((self.xmin,self.xmax)) |
|
1236 | self.xlimits.append((self.xmin,self.xmax)) | |
1237 |
|
1237 | |||
1238 | ax.set_xlim(self.xmin, self.xmax) |
|
1238 | ax.set_xlim(self.xmin, self.xmax) | |
1239 |
|
1239 | |||
1240 | ax.plotline1[0].set_data(self.x[n][0,:,0,0],self.y) |
|
1240 | ax.plotline1[0].set_data(self.x[n][0,:,0,0],self.y) | |
1241 | ax.plotline2[0].set_data(self.x[n][1,:,0,0],self.y) |
|
1241 | ax.plotline2[0].set_data(self.x[n][1,:,0,0],self.y) | |
1242 | ax.plotline3[0].set_data(self.x[n][2,:,0,0],self.y) |
|
1242 | ax.plotline3[0].set_data(self.x[n][2,:,0,0],self.y) | |
1243 | ax.plotline4[0].set_data(self.x[n][3,:,0,0],self.y) |
|
1243 | ax.plotline4[0].set_data(self.x[n][3,:,0,0],self.y) | |
1244 | self.titles.append('{}'.format(self.plot_name.upper())) |
|
1244 | self.titles.append('{}'.format(self.plot_name.upper())) | |
1245 |
|
1245 | |||
1246 |
|
1246 | |||
1247 | class CrossProductsLPPlot(Plot): |
|
1247 | class CrossProductsLPPlot(Plot): | |
1248 | ''' |
|
1248 | ''' | |
1249 | Written by R. Flores |
|
1249 | Written by R. Flores | |
1250 | ''' |
|
1250 | ''' | |
1251 | ''' |
|
1251 | ''' | |
1252 | Plot for cross products LP |
|
1252 | Plot for cross products LP | |
1253 | ''' |
|
1253 | ''' | |
1254 |
|
1254 | |||
1255 | CODE = 'crossprodslp' |
|
1255 | CODE = 'crossprodslp' | |
1256 | plot_name = 'Cross Products LP' |
|
1256 | plot_name = 'Cross Products LP' | |
1257 | plot_type = 'scatterbuffer' |
|
1257 | plot_type = 'scatterbuffer' | |
1258 |
|
1258 | |||
1259 |
|
1259 | |||
1260 | def setup(self): |
|
1260 | def setup(self): | |
1261 |
|
1261 | |||
1262 | self.ncols = 2 |
|
1262 | self.ncols = 2 | |
1263 | self.nrows = 1 |
|
1263 | self.nrows = 1 | |
1264 | self.nplots = 2 |
|
1264 | self.nplots = 2 | |
1265 | self.ylabel = 'Range [km]' |
|
1265 | self.ylabel = 'Range [km]' | |
1266 | self.xlabel = 'dB' |
|
1266 | self.xlabel = 'dB' | |
1267 | self.width = 3.5*self.nplots |
|
1267 | self.width = 3.5*self.nplots | |
1268 | self.height = 5.5 |
|
1268 | self.height = 5.5 | |
1269 | self.colorbar = False |
|
1269 | self.colorbar = False | |
1270 | self.titles = [] |
|
1270 | self.titles = [] | |
1271 | self.plots_adjust.update({'wspace': .8 ,'left': 0.17, 'right': 0.88, 'bottom': 0.1}) |
|
1271 | self.plots_adjust.update({'wspace': .8 ,'left': 0.17, 'right': 0.88, 'bottom': 0.1}) | |
1272 |
|
1272 | |||
1273 | def update(self, dataOut): |
|
1273 | def update(self, dataOut): | |
1274 | data = {} |
|
1274 | data = {} | |
1275 | meta = {} |
|
1275 | meta = {} | |
1276 |
|
1276 | |||
1277 | data['crossprodslp'] = 10*numpy.log10(numpy.abs(dataOut.output_LP)) |
|
1277 | data['crossprodslp'] = 10*numpy.log10(numpy.abs(dataOut.output_LP)) | |
1278 |
|
1278 | |||
1279 | data['NRANGE'] = dataOut.NRANGE #This is metadata |
|
1279 | data['NRANGE'] = dataOut.NRANGE #This is metadata | |
1280 | data['NLAG'] = dataOut.NLAG #This is metadata |
|
1280 | data['NLAG'] = dataOut.NLAG #This is metadata | |
1281 |
|
1281 | |||
1282 | return data, meta |
|
1282 | return data, meta | |
1283 |
|
1283 | |||
1284 | def plot(self): |
|
1284 | def plot(self): | |
1285 |
|
1285 | |||
1286 | NRANGE = self.data['NRANGE'][-1] |
|
1286 | NRANGE = self.data['NRANGE'][-1] | |
1287 | NLAG = self.data['NLAG'][-1] |
|
1287 | NLAG = self.data['NLAG'][-1] | |
1288 |
|
1288 | |||
1289 | x = self.data[self.CODE][:,-1,:,:] |
|
1289 | x = self.data[self.CODE][:,-1,:,:] | |
1290 | self.y = self.data.yrange[0:NRANGE] |
|
1290 | self.y = self.data.yrange[0:NRANGE] | |
1291 |
|
1291 | |||
1292 | label_array=numpy.array(['lag '+ str(x) for x in range(NLAG)]) |
|
1292 | label_array=numpy.array(['lag '+ str(x) for x in range(NLAG)]) | |
1293 | color_array=['r','k','g','b','c','m','y','orange','steelblue','purple','peru','darksalmon','grey','limegreen','olive','midnightblue'] |
|
1293 | color_array=['r','k','g','b','c','m','y','orange','steelblue','purple','peru','darksalmon','grey','limegreen','olive','midnightblue'] | |
1294 |
|
1294 | |||
1295 |
|
1295 | |||
1296 | for n, ax in enumerate(self.axes): |
|
1296 | for n, ax in enumerate(self.axes): | |
1297 |
|
1297 | |||
1298 | self.xmin=28#30 |
|
1298 | self.xmin=28#30 | |
1299 | self.xmax=70#70 |
|
1299 | self.xmax=70#70 | |
1300 | #self.xmin=numpy.min(numpy.concatenate((self.x[0,:,n],self.x[1,:,n]))) |
|
1300 | #self.xmin=numpy.min(numpy.concatenate((self.x[0,:,n],self.x[1,:,n]))) | |
1301 | #self.xmax=numpy.max(numpy.concatenate((self.x[0,:,n],self.x[1,:,n]))) |
|
1301 | #self.xmax=numpy.max(numpy.concatenate((self.x[0,:,n],self.x[1,:,n]))) | |
1302 |
|
1302 | |||
1303 | if ax.firsttime: |
|
1303 | if ax.firsttime: | |
1304 |
|
1304 | |||
1305 | self.autoxticks=False |
|
1305 | self.autoxticks=False | |
1306 | if n == 0: |
|
1306 | if n == 0: | |
1307 | self.plotline_array=numpy.zeros((2,NLAG),dtype=object) |
|
1307 | self.plotline_array=numpy.zeros((2,NLAG),dtype=object) | |
1308 |
|
1308 | |||
1309 | for i in range(NLAG): |
|
1309 | for i in range(NLAG): | |
1310 | self.plotline_array[n,i], = ax.plot(x[i,:,n], self.y, color=color_array[i],linewidth=1.0, label=label_array[i]) |
|
1310 | self.plotline_array[n,i], = ax.plot(x[i,:,n], self.y, color=color_array[i],linewidth=1.0, label=label_array[i]) | |
1311 |
|
1311 | |||
1312 | ax.legend(loc='upper right') |
|
1312 | ax.legend(loc='upper right') | |
1313 | ax.set_xlim(self.xmin, self.xmax) |
|
1313 | ax.set_xlim(self.xmin, self.xmax) | |
1314 | if n==0: |
|
1314 | if n==0: | |
1315 | self.titles.append('{} CH0'.format(self.plot_name.upper())) |
|
1315 | self.titles.append('{} CH0'.format(self.plot_name.upper())) | |
1316 | if n==1: |
|
1316 | if n==1: | |
1317 | self.titles.append('{} CH1'.format(self.plot_name.upper())) |
|
1317 | self.titles.append('{} CH1'.format(self.plot_name.upper())) | |
1318 | else: |
|
1318 | else: | |
1319 | for i in range(NLAG): |
|
1319 | for i in range(NLAG): | |
1320 | self.plotline_array[n,i].set_data(x[i,:,n],self.y) |
|
1320 | self.plotline_array[n,i].set_data(x[i,:,n],self.y) | |
1321 |
|
1321 | |||
1322 | if n==0: |
|
1322 | if n==0: | |
1323 | self.titles.append('{} CH0'.format(self.plot_name.upper())) |
|
1323 | self.titles.append('{} CH0'.format(self.plot_name.upper())) | |
1324 | if n==1: |
|
1324 | if n==1: | |
1325 | self.titles.append('{} CH1'.format(self.plot_name.upper())) |
|
1325 | self.titles.append('{} CH1'.format(self.plot_name.upper())) | |
1326 |
|
1326 | |||
1327 |
|
1327 | |||
1328 | class NoiseDPPlot(NoisePlot): |
|
1328 | class NoiseDPPlot(NoisePlot): | |
1329 | ''' |
|
1329 | ''' | |
1330 | Written by R. Flores |
|
1330 | Written by R. Flores | |
1331 | ''' |
|
1331 | ''' | |
1332 | ''' |
|
1332 | ''' | |
1333 | Plot for noise Double Pulse |
|
1333 | Plot for noise Double Pulse | |
1334 | ''' |
|
1334 | ''' | |
1335 |
|
1335 | |||
1336 | CODE = 'noise' |
|
1336 | CODE = 'noise' | |
1337 | #plot_name = 'Noise' |
|
1337 | #plot_name = 'Noise' | |
1338 | #plot_type = 'scatterbuffer' |
|
1338 | #plot_type = 'scatterbuffer' | |
1339 |
|
1339 | |||
1340 | def update(self, dataOut): |
|
1340 | def update(self, dataOut): | |
1341 |
|
1341 | |||
1342 | data = {} |
|
1342 | data = {} | |
1343 | meta = {} |
|
1343 | meta = {} | |
1344 | data['noise'] = 10*numpy.log10(dataOut.noise_final) |
|
1344 | data['noise'] = 10*numpy.log10(dataOut.noise_final) | |
1345 |
|
1345 | |||
1346 | return data, meta |
|
1346 | return data, meta | |
1347 |
|
1347 | |||
1348 |
|
1348 | |||
1349 | class XmitWaveformPlot(Plot): |
|
1349 | class XmitWaveformPlot(Plot): | |
1350 | ''' |
|
1350 | ''' | |
1351 | Written by R. Flores |
|
1351 | Written by R. Flores | |
1352 | ''' |
|
1352 | ''' | |
1353 | ''' |
|
1353 | ''' | |
1354 | Plot for xmit waveform |
|
1354 | Plot for xmit waveform | |
1355 | ''' |
|
1355 | ''' | |
1356 |
|
1356 | |||
1357 | CODE = 'xmit' |
|
1357 | CODE = 'xmit' | |
1358 | plot_name = 'Xmit Waveform' |
|
1358 | plot_name = 'Xmit Waveform' | |
1359 | plot_type = 'scatterbuffer' |
|
1359 | plot_type = 'scatterbuffer' | |
1360 |
|
1360 | |||
1361 |
|
1361 | |||
1362 | def setup(self): |
|
1362 | def setup(self): | |
1363 |
|
1363 | |||
1364 | self.ncols = 1 |
|
1364 | self.ncols = 1 | |
1365 | self.nrows = 1 |
|
1365 | self.nrows = 1 | |
1366 | self.nplots = 1 |
|
1366 | self.nplots = 1 | |
1367 | self.ylabel = '' |
|
1367 | self.ylabel = '' | |
1368 | self.xlabel = 'Number of Lag' |
|
1368 | self.xlabel = 'Number of Lag' | |
1369 | self.width = 5.5 |
|
1369 | self.width = 5.5 | |
1370 | self.height = 3.5 |
|
1370 | self.height = 3.5 | |
1371 | self.colorbar = False |
|
1371 | self.colorbar = False | |
1372 | self.plots_adjust.update({'right': 0.85 }) |
|
1372 | self.plots_adjust.update({'right': 0.85 }) | |
1373 | self.titles = [self.plot_name] |
|
1373 | self.titles = [self.plot_name] | |
1374 | #self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) |
|
1374 | #self.plots_adjust.update({'left': 0.17, 'right': 0.88, 'bottom': 0.1}) | |
1375 |
|
1375 | |||
1376 | #if not self.titles: |
|
1376 | #if not self.titles: | |
1377 | #self.titles = self.data.parameters \ |
|
1377 | #self.titles = self.data.parameters \ | |
1378 | #if self.data.parameters else ['{}'.format(self.plot_name.upper())] |
|
1378 | #if self.data.parameters else ['{}'.format(self.plot_name.upper())] | |
1379 |
|
1379 | |||
1380 | def update(self, dataOut): |
|
1380 | def update(self, dataOut): | |
1381 |
|
1381 | |||
1382 | data = {} |
|
1382 | data = {} | |
1383 | meta = {} |
|
1383 | meta = {} | |
1384 |
|
1384 | |||
1385 | y_1=numpy.arctan2(dataOut.output_LP[:,0,2].imag,dataOut.output_LP[:,0,2].real)* 180 / (numpy.pi*10) |
|
1385 | y_1=numpy.arctan2(dataOut.output_LP[:,0,2].imag,dataOut.output_LP[:,0,2].real)* 180 / (numpy.pi*10) | |
1386 | y_2=numpy.abs(dataOut.output_LP[:,0,2]) |
|
1386 | y_2=numpy.abs(dataOut.output_LP[:,0,2]) | |
1387 | norm=numpy.max(y_2) |
|
1387 | norm=numpy.max(y_2) | |
1388 | norm=max(norm,0.1) |
|
1388 | norm=max(norm,0.1) | |
1389 | y_2=y_2/norm |
|
1389 | y_2=y_2/norm | |
1390 |
|
1390 | |||
1391 | meta['yrange'] = numpy.array([]) |
|
1391 | meta['yrange'] = numpy.array([]) | |
1392 |
|
1392 | |||
1393 | data['xmit'] = numpy.vstack((y_1,y_2)) |
|
1393 | data['xmit'] = numpy.vstack((y_1,y_2)) | |
1394 | data['NLAG'] = dataOut.NLAG |
|
1394 | data['NLAG'] = dataOut.NLAG | |
1395 |
|
1395 | |||
1396 | return data, meta |
|
1396 | return data, meta | |
1397 |
|
1397 | |||
1398 | def plot(self): |
|
1398 | def plot(self): | |
1399 |
|
1399 | |||
1400 | data = self.data[-1] |
|
1400 | data = self.data[-1] | |
1401 | NLAG = data['NLAG'] |
|
1401 | NLAG = data['NLAG'] | |
1402 | x = numpy.arange(0,NLAG,1,'float32') |
|
1402 | x = numpy.arange(0,NLAG,1,'float32') | |
1403 | y = data['xmit'] |
|
1403 | y = data['xmit'] | |
1404 |
|
1404 | |||
1405 | self.xmin = 0 |
|
1405 | self.xmin = 0 | |
1406 | self.xmax = NLAG-1 |
|
1406 | self.xmax = NLAG-1 | |
1407 | self.ymin = -1.0 |
|
1407 | self.ymin = -1.0 | |
1408 | self.ymax = 1.0 |
|
1408 | self.ymax = 1.0 | |
1409 | ax = self.axes[0] |
|
1409 | ax = self.axes[0] | |
1410 |
|
1410 | |||
1411 | if ax.firsttime: |
|
1411 | if ax.firsttime: | |
1412 | ax.plotline0=ax.plot(x,y[0,:],color='blue') |
|
1412 | ax.plotline0=ax.plot(x,y[0,:],color='blue') | |
1413 | ax.plotline1=ax.plot(x,y[1,:],color='red') |
|
1413 | ax.plotline1=ax.plot(x,y[1,:],color='red') | |
1414 | secax=ax.secondary_xaxis(location=0.5) |
|
1414 | secax=ax.secondary_xaxis(location=0.5) | |
1415 | secax.xaxis.tick_bottom() |
|
1415 | secax.xaxis.tick_bottom() | |
1416 | secax.tick_params( labelleft=False, labeltop=False, |
|
1416 | secax.tick_params( labelleft=False, labeltop=False, | |
1417 | labelright=False, labelbottom=False) |
|
1417 | labelright=False, labelbottom=False) | |
1418 |
|
1418 | |||
1419 | self.xstep_given = 3 |
|
1419 | self.xstep_given = 3 | |
1420 | self.ystep_given = .25 |
|
1420 | self.ystep_given = .25 | |
1421 | secax.set_xticks(numpy.linspace(self.xmin, self.xmax, 6)) #only works on matplotlib.version>3.2 |
|
1421 | secax.set_xticks(numpy.linspace(self.xmin, self.xmax, 6)) #only works on matplotlib.version>3.2 | |
1422 |
|
1422 | |||
1423 | else: |
|
1423 | else: | |
1424 | ax.plotline0[0].set_data(x,y[0,:]) |
|
1424 | ax.plotline0[0].set_data(x,y[0,:]) | |
1425 | ax.plotline1[0].set_data(x,y[1,:]) |
|
1425 | ax.plotline1[0].set_data(x,y[1,:]) |
General Comments 0
You need to be logged in to leave comments.
Login now