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