@@ -1112,7 +1112,7 class PlotterData(object): | |||
|
1112 | 1112 | MAXNUMY = 100 |
|
1113 | 1113 | |
|
1114 | 1114 | def __init__(self, code, throttle_value, exp_code, buffering=True): |
|
1115 | ||
|
1115 | ||
|
1116 | 1116 | self.throttle = throttle_value |
|
1117 | 1117 | self.exp_code = exp_code |
|
1118 | 1118 | self.buffering = buffering |
@@ -1173,11 +1173,11 class PlotterData(object): | |||
|
1173 | 1173 | plot = 'snr' |
|
1174 | 1174 | self.data[plot] = {} |
|
1175 | 1175 | |
|
1176 | if 'spc' in self.data or 'rti' in self.data: | |
|
1176 | if 'spc' in self.data or 'rti' in self.data or 'cspc' in self.data: | |
|
1177 | 1177 | self.data['noise'] = {} |
|
1178 | 1178 | if 'noise' not in self.plottypes: |
|
1179 | 1179 | self.plottypes.append('noise') |
|
1180 | ||
|
1180 | ||
|
1181 | 1181 | def shape(self, key): |
|
1182 | 1182 | ''' |
|
1183 | 1183 | Get the shape of the one-element data for the given key |
@@ -1193,10 +1193,10 class PlotterData(object): | |||
|
1193 | 1193 | ''' |
|
1194 | 1194 | Update data object with new dataOut |
|
1195 | 1195 | ''' |
|
1196 | ||
|
1196 | ||
|
1197 | 1197 | if tm in self.__times: |
|
1198 | 1198 | return |
|
1199 | ||
|
1199 | ||
|
1200 | 1200 | self.type = dataOut.type |
|
1201 | 1201 | self.parameters = getattr(dataOut, 'parameters', []) |
|
1202 | 1202 | if hasattr(dataOut, 'pairsList'): |
@@ -1209,16 +1209,18 class PlotterData(object): | |||
|
1209 | 1209 | if 'spc' in self.plottypes or 'cspc' in self.plottypes: |
|
1210 | 1210 | self.xrange = (dataOut.getFreqRange(1)/1000., |
|
1211 | 1211 | dataOut.getAcfRange(1), dataOut.getVelRange(1)) |
|
1212 | self.factor = dataOut.normFactor | |
|
1212 | 1213 | self.__heights.append(dataOut.heightList) |
|
1213 | 1214 | self.__all_heights.update(dataOut.heightList) |
|
1214 | 1215 | self.__times.append(tm) |
|
1215 | ||
|
1216 | ||
|
1216 | 1217 | for plot in self.plottypes: |
|
1217 | 1218 | if plot == 'spc': |
|
1218 | 1219 | z = dataOut.data_spc/dataOut.normFactor |
|
1219 | 1220 | buffer = 10*numpy.log10(z) |
|
1220 | 1221 | if plot == 'cspc': |
|
1221 |
|
|
|
1222 | z = dataOut.data_spc/dataOut.normFactor | |
|
1223 | buffer = (dataOut.data_spc, dataOut.data_cspc) | |
|
1222 | 1224 | if plot == 'noise': |
|
1223 | 1225 | buffer = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor) |
|
1224 | 1226 | if plot == 'rti': |
@@ -1242,8 +1244,11 class PlotterData(object): | |||
|
1242 | 1244 | if plot == 'param': |
|
1243 | 1245 | buffer = dataOut.data_param |
|
1244 | 1246 | |
|
1245 |
if 'spc' |
|
|
1247 | if plot == 'spc': | |
|
1246 | 1248 | self.data[plot] = buffer |
|
1249 | elif plot == 'cspc': | |
|
1250 | self.data['spc'] = buffer[0] | |
|
1251 | self.data['cspc'] = buffer[1] | |
|
1247 | 1252 | else: |
|
1248 | 1253 | if self.buffering: |
|
1249 | 1254 | self.data[plot][tm] = buffer |
@@ -672,7 +672,7 class Plot(Operation): | |||
|
672 | 672 | ax.set_title('{} {} {}'.format( |
|
673 | 673 | self.titles[n], |
|
674 | 674 | self.getDateTime(self.data.max_time).strftime( |
|
675 |
' |
|
|
675 | '%H:%M:%S'), | |
|
676 | 676 | self.time_label), |
|
677 | 677 | size=8) |
|
678 | 678 | else: |
@@ -112,6 +112,7 class SpectraPlot(Plot): | |||
|
112 | 112 | class CrossSpectraPlot(Plot): |
|
113 | 113 | |
|
114 | 114 | CODE = 'cspc' |
|
115 | colormap = 'jet' | |
|
115 | 116 | zmin_coh = None |
|
116 | 117 | zmax_coh = None |
|
117 | 118 | zmin_phase = None |
@@ -138,7 +139,7 class CrossSpectraPlot(Plot): | |||
|
138 | 139 | else: |
|
139 | 140 | x = self.data.xrange[2] |
|
140 | 141 | self.xlabel = "Velocity (m/s)" |
|
141 | ||
|
142 | ||
|
142 | 143 | self.titles = [] |
|
143 | 144 | |
|
144 | 145 | y = self.data.heights |
@@ -150,32 +151,33 class CrossSpectraPlot(Plot): | |||
|
150 | 151 | noise = self.data['noise'][n][-1] |
|
151 | 152 | pair = self.data.pairs[n] |
|
152 | 153 | ax = self.axes[4 * n] |
|
153 | ax3 = self.axes[4 * n + 3] | |
|
154 | if ax.firsttime: | |
|
155 | self.xmax = self.xmax if self.xmax else numpy.nanmax(x) | |
|
156 | self.xmin = self.xmin if self.xmin else -self.xmax | |
|
157 | self.zmin = self.zmin if self.zmin else numpy.nanmin(spc) | |
|
158 | self.zmax = self.zmax if self.zmax else numpy.nanmax(spc) | |
|
159 |
ax.plt = ax.pcolormesh(x, y, spc |
|
|
154 | spc0 = 10.*numpy.log10(spc[pair[0]]/self.data.factor) | |
|
155 | if ax.firsttime: | |
|
156 | self.xmax = self.xmax if self.xmax else numpy.nanmax(x) | |
|
157 | self.xmin = self.xmin if self.xmin else -self.xmax | |
|
158 | self.zmin = self.zmin if self.zmin else numpy.nanmin(spc) | |
|
159 | self.zmax = self.zmax if self.zmax else numpy.nanmax(spc) | |
|
160 | ax.plt = ax.pcolormesh(x , y , spc0.T, | |
|
160 | 161 | vmin=self.zmin, |
|
161 | 162 | vmax=self.zmax, |
|
162 | 163 | cmap=plt.get_cmap(self.colormap) |
|
163 | ) | |
|
164 | else: | |
|
165 |
ax.plt.set_array(spc |
|
|
166 |
self.titles.append('CH {}: {:3.2f}dB'.format( |
|
|
164 | ) | |
|
165 | else: | |
|
166 | ax.plt.set_array(spc0.T.ravel()) | |
|
167 | self.titles.append('CH {}: {:3.2f}dB'.format(pair[0], noise)) | |
|
167 | 168 | |
|
168 | 169 | ax = self.axes[4 * n + 1] |
|
170 | spc1 = 10.*numpy.log10(spc[pair[1]]/self.data.factor) | |
|
169 | 171 | if ax.firsttime: |
|
170 |
ax.plt = ax.pcolormesh(x, y, spc |
|
|
172 | ax.plt = ax.pcolormesh(x , y, spc1.T, | |
|
171 | 173 | vmin=self.zmin, |
|
172 | 174 | vmax=self.zmax, |
|
173 | 175 | cmap=plt.get_cmap(self.colormap) |
|
174 | 176 | ) |
|
175 | else: | |
|
176 |
ax.plt.set_array(spc |
|
|
177 |
self.titles.append('CH {}: {:3.2f}dB'.format( |
|
|
178 | ||
|
177 | else: | |
|
178 | ax.plt.set_array(spc1.T.ravel()) | |
|
179 | self.titles.append('CH {}: {:3.2f}dB'.format(pair[1], noise)) | |
|
180 | ||
|
179 | 181 | out = cspc[n] / numpy.sqrt(spc[pair[0]] * spc[pair[1]]) |
|
180 | 182 | coh = numpy.abs(out) |
|
181 | 183 | phase = numpy.arctan2(out.imag, out.real) * 180 / numpy.pi |
@@ -191,13 +193,13 class CrossSpectraPlot(Plot): | |||
|
191 | 193 | ax.plt.set_array(coh.T.ravel()) |
|
192 | 194 | self.titles.append( |
|
193 | 195 | 'Coherence Ch{} * Ch{}'.format(pair[0], pair[1])) |
|
194 | ||
|
196 | ||
|
195 | 197 | ax = self.axes[4 * n + 3] |
|
196 | 198 | if ax.firsttime: |
|
197 | 199 | ax.plt = ax.pcolormesh(x, y, phase.T, |
|
198 | 200 | vmin=-180, |
|
199 | 201 | vmax=180, |
|
200 | cmap=plt.get_cmap(self.colormap_phase) | |
|
202 | cmap=plt.get_cmap(self.colormap_phase) | |
|
201 | 203 | ) |
|
202 | 204 | else: |
|
203 | 205 | ax.plt.set_array(phase.T.ravel()) |
@@ -611,3 +613,4 class PolarMapPlot(Plot): | |||
|
611 | 613 | self.save_labels = ['{}-{}'.format(lbl, label) for lbl in self.labels] |
|
612 | 614 | self.titles = ['{} {}'.format( |
|
613 | 615 | self.data.parameters[x], title) for x in self.channels] |
|
616 | No newline at end of file |
@@ -190,9 +190,8 def MPDecorator(BaseClass): | |||
|
190 | 190 | self.sender = None |
|
191 | 191 | self.receiver = None |
|
192 | 192 | self.name = BaseClass.__name__ |
|
193 | if 'plot' in self.name.lower(): | |
|
194 | if not self.name.endswith('_'): | |
|
195 | self.name = '{}{}'.format(self.CODE.upper(), 'Plot') | |
|
193 | if 'plot' in self.name.lower() and not self.name.endswith('_'): | |
|
194 | self.name = '{}{}'.format(self.CODE.upper(), 'Plot') | |
|
196 | 195 | self.start_time = time.time() |
|
197 | 196 | |
|
198 | 197 | if len(self.args) is 3: |
@@ -294,7 +293,7 def MPDecorator(BaseClass): | |||
|
294 | 293 | op(**kwargs) |
|
295 | 294 | elif optype == 'other' and not self.dataOut.flagNoData: |
|
296 | 295 | self.dataOut = op.run(self.dataOut, **kwargs) |
|
297 | elif optype == 'external': | |
|
296 | elif optype == 'external' and not self.dataOut.flagNoData: | |
|
298 | 297 | if not self.dataOut.flagNoData or self.dataOut.error: |
|
299 | 298 | self.publish(self.dataOut, opId) |
|
300 | 299 |
General Comments 0
You need to be logged in to leave comments.
Login now