##// END OF EJS Templates
Danny Scipión -
r1362:036afbeb089e merge
parent child
Show More
@@ -231,7 +231,6 class Plot(Operation):
231 231 self.attr_time = kwargs.get('attr_time', 'utctime')
232 232 self.attr_data = kwargs.get('attr_data', 'data_param')
233 233 self.decimation = kwargs.get('decimation', None)
234 self.showSNR = kwargs.get('showSNR', False)
235 234 self.oneFigure = kwargs.get('oneFigure', True)
236 235 self.width = kwargs.get('width', None)
237 236 self.height = kwargs.get('height', None)
@@ -262,6 +261,9 class Plot(Operation):
262 261 self.name
263 262 )
264 263
264 if isinstance(self.attr_data, str):
265 self.attr_data = [self.attr_data]
266
265 267 def __setup_plot(self):
266 268 '''
267 269 Common setup for all figures, here figures and axes are created
@@ -322,6 +324,7 class Plot(Operation):
322 324 self.pf_axes.append(cax)
323 325
324 326 for n in range(self.nrows):
327 print(self.nrows)
325 328 if self.colormaps is not None:
326 329 cmap = plt.get_cmap(self.colormaps[n])
327 330 else:
@@ -503,33 +506,33 class Plot(Operation):
503 506
504 507 fig = self.figures[n]
505 508
506 figname = os.path.join(
507 self.save,
508 self.save_code,
509 '{}_{}.png'.format(
510 self.save_code,
511 self.getDateTime(self.data.max_time).strftime(
512 '%Y%m%d_%H%M%S'
513 ),
514 )
515 )
516 log.log('Saving figure: {}'.format(figname), self.name)
517 if not os.path.isdir(os.path.dirname(figname)):
518 os.makedirs(os.path.dirname(figname))
519 fig.savefig(figname)
520
521 509 if self.throttle == 0:
522 510 figname = os.path.join(
523 511 self.save,
524 '{}_{}.png'.format(
512 self.save_code,
513 '{}_{}.png'.format(
525 514 self.save_code,
526 self.getDateTime(self.data.min_time).strftime(
527 '%Y%m%d'
515 self.getDateTime(self.data.max_time).strftime(
516 '%Y%m%d_%H%M%S'
528 517 ),
529 518 )
530 519 )
520 log.log('Saving figure: {}'.format(figname), self.name)
521 if not os.path.isdir(os.path.dirname(figname)):
522 os.makedirs(os.path.dirname(figname))
531 523 fig.savefig(figname)
532 524
525 figname = os.path.join(
526 self.save,
527 '{}_{}.png'.format(
528 self.save_code,
529 self.getDateTime(self.data.min_time).strftime(
530 '%Y%m%d'
531 ),
532 )
533 )
534 fig.savefig(figname)
535
533 536 def send_to_server(self):
534 537 '''
535 538 '''
@@ -176,7 +176,7 class GenericRTIPlot(Plot):
176 176 def setup(self):
177 177 self.xaxis = 'time'
178 178 self.ncols = 1
179 self.nrows = self.data.shape(self.attr_data)[0]
179 self.nrows = self.data.shape('param')[0]
180 180 self.nplots = self.nrows
181 181 self.plots_adjust.update({'hspace':0.8, 'left': 0.1, 'bottom': 0.08, 'right':0.95, 'top': 0.95})
182 182
@@ -185,13 +185,12 class GenericRTIPlot(Plot):
185 185
186 186 self.ylabel = 'Range [km]'
187 187 if not self.titles:
188 self.titles = self.data.parameters \
189 if self.data.parameters else ['Param {}'.format(x) for x in range(self.nrows)]
188 self.titles = ['Param {}'.format(x) for x in range(self.nrows)]
190 189
191 190 def update(self, dataOut):
192 191
193 192 data = {
194 self.attr_data : getattr(dataOut, self.attr_data)
193 'param' : numpy.concatenate([getattr(dataOut, attr) for attr in self.attr_data], axis=0)
195 194 }
196 195
197 196 meta = {}
@@ -202,7 +201,7 class GenericRTIPlot(Plot):
202 201 # self.data.normalize_heights()
203 202 self.x = self.data.times
204 203 self.y = self.data.yrange
205 self.z = self.data[self.attr_data]
204 self.z = self.data['param']
206 205
207 206 self.z = numpy.ma.masked_invalid(self.z)
208 207
@@ -1,16 +1,8
1 1 import os
2 2 import sys
3 3 import glob
4 import fnmatch
5 import datetime
6 import time
7 import re
8 import h5py
9 4 import numpy
10 5
11 import pylab as plb
12 from scipy.optimize import curve_fit
13 from scipy import asarray as ar, exp
14 6
15 7 SPEED_OF_LIGHT = 299792458
16 8 SPEED_OF_LIGHT = 3e8
@@ -19,9 +11,9 from .utils import folder_in_range
19 11
20 12 import schainpy.admin
21 13 from schainpy.model.data.jrodata import Spectra
22 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator
14 from schainpy.model.proc.jroproc_base import ProcessingUnit
23 15 from schainpy.utils import log
24 from schainpy.model.io.jroIO_base import JRODataReader
16
25 17
26 18 def pol2cart(rho, phi):
27 19 x = rho * numpy.cos(phi)
@@ -423,7 +415,6 class BLTRSpectraReader (ProcessingUnit):
423 415 copy = self.data_block.copy()
424 416 spc = copy * numpy.conjugate(copy)
425 417 self.data_spc = numpy.absolute(spc) # valor absoluto o magnitud
426 self.dataOut.data_spc = self.data_spc
427 418
428 419 cspc = self.data_block.copy()
429 420 self.data_cspc = self.data_block.copy()
@@ -196,11 +196,11 class HDFReader(Reader, ProcessingUnit):
196 196
197 197 if self.description:
198 198 for key, value in self.description['Metadata'].items():
199 meta[key] = self.fp[value].value
199 meta[key] = self.fp[value][()]
200 200 else:
201 201 grp = self.fp['Metadata']
202 202 for name in grp:
203 meta[name] = grp[name].value
203 meta[name] = grp[name][()]
204 204
205 205 if self.extras:
206 206 for key, value in self.extras.items():
@@ -217,26 +217,26 class HDFReader(Reader, ProcessingUnit):
217 217 for key, value in self.description['Data'].items():
218 218 if isinstance(value, str):
219 219 if isinstance(self.fp[value], h5py.Dataset):
220 data[key] = self.fp[value].value
220 data[key] = self.fp[value][()]
221 221 elif isinstance(self.fp[value], h5py.Group):
222 222 array = []
223 223 for ch in self.fp[value]:
224 array.append(self.fp[value][ch].value)
224 array.append(self.fp[value][ch][()])
225 225 data[key] = numpy.array(array)
226 226 elif isinstance(value, list):
227 227 array = []
228 228 for ch in value:
229 array.append(self.fp[ch].value)
229 array.append(self.fp[ch][()])
230 230 data[key] = numpy.array(array)
231 231 else:
232 232 grp = self.fp['Data']
233 233 for name in grp:
234 234 if isinstance(grp[name], h5py.Dataset):
235 array = grp[name].value
235 array = grp[name][()]
236 236 elif isinstance(grp[name], h5py.Group):
237 237 array = []
238 238 for ch in grp[name]:
239 array.append(grp[name][ch].value)
239 array.append(grp[name][ch][()])
240 240 array = numpy.array(array)
241 241 else:
242 242 log.warning('Unknown type: {}'.format(name))
@@ -5,14 +5,10 Created on Oct 24, 2016
5 5 '''
6 6
7 7 import numpy
8 import copy
9 8 import datetime
10 9 import time
11 from time import gmtime
12 10
13 from numpy import transpose
14
15 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator
11 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation
16 12 from schainpy.model.data.jrodata import Parameters
17 13
18 14
@@ -68,23 +64,14 class BLTRParametersProc(ProcessingUnit):
68 64 self.dataOut.data_param = self.dataOut.data[mode]
69 65 self.dataOut.heightList = self.dataOut.height[0]
70 66 self.dataOut.data_snr = self.dataOut.data_snr[mode]
71
72 data_param = numpy.zeros([4, len(self.dataOut.heightList)])
73
74 67 SNRavg = numpy.average(self.dataOut.data_snr, axis=0)
75 68 SNRavgdB = 10*numpy.log10(SNRavg)
69 self.dataOut.data_snr_avg_db = SNRavgdB.reshape(1, *SNRavgdB.shape)
70
76 71 # Censoring Data
77 72 if snr_threshold is not None:
78 73 for i in range(3):
79 74 self.dataOut.data_param[i][SNRavgdB <= snr_threshold] = numpy.nan
80 # Including AvgSNR in data_param
81 for i in range(data_param.shape[0]):
82 if i == 3:
83 data_param[i] = SNRavgdB
84 else:
85 data_param[i] = self.dataOut.data_param[i]
86
87 self.dataOut.data_param = data_param
88 75
89 76 # TODO
90 77
General Comments 0
You need to be logged in to leave comments. Login now