|
@@
-1,811
+1,891
|
|
1
|
|
|
1
|
|
|
2
|
import os
|
|
2
|
import os
|
|
3
|
import zmq
|
|
3
|
import zmq
|
|
4
|
import time
|
|
4
|
import time
|
|
5
|
import numpy
|
|
5
|
import numpy
|
|
6
|
import datetime
|
|
6
|
import datetime
|
|
7
|
import numpy as np
|
|
7
|
import numpy as np
|
|
8
|
import matplotlib
|
|
8
|
import matplotlib
|
|
9
|
matplotlib.use('TkAgg')
|
|
9
|
matplotlib.use('TkAgg')
|
|
10
|
import matplotlib.pyplot as plt
|
|
10
|
import matplotlib.pyplot as plt
|
|
11
|
from mpl_toolkits.axes_grid1 import make_axes_locatable
|
|
11
|
from mpl_toolkits.axes_grid1 import make_axes_locatable
|
|
12
|
from matplotlib.ticker import FuncFormatter, LinearLocator
|
|
12
|
from matplotlib.ticker import FuncFormatter, LinearLocator
|
|
13
|
from multiprocessing import Process
|
|
13
|
from multiprocessing import Process
|
|
14
|
|
|
14
|
|
|
15
|
from schainpy.model.proc.jroproc_base import Operation
|
|
15
|
from schainpy.model.proc.jroproc_base import Operation
|
|
16
|
|
|
16
|
|
|
17
|
plt.ion()
|
|
17
|
plt.ion()
|
|
18
|
|
|
18
|
|
|
19
|
func = lambda x, pos: ('%s') %(datetime.datetime.fromtimestamp(x).strftime('%H:%M'))
|
|
19
|
func = lambda x, pos: ('%s') %(datetime.datetime.fromtimestamp(x).strftime('%H:%M'))
|
|
20
|
|
|
20
|
|
|
21
|
d1970 = datetime.datetime(1970,1,1)
|
|
21
|
d1970 = datetime.datetime(1970,1,1)
|
|
22
|
|
|
22
|
|
|
23
|
class PlotData(Operation, Process):
|
|
23
|
class PlotData(Operation, Process):
|
|
24
|
|
|
24
|
|
|
25
|
CODE = 'Figure'
|
|
25
|
CODE = 'Figure'
|
|
26
|
colormap = 'jro'
|
|
26
|
colormap = 'jro'
|
|
27
|
CONFLATE = False
|
|
27
|
CONFLATE = False
|
|
28
|
__MAXNUMX = 80
|
|
28
|
__MAXNUMX = 80
|
|
29
|
__missing = 1E30
|
|
29
|
__missing = 1E30
|
|
30
|
|
|
30
|
|
|
31
|
def __init__(self, **kwargs):
|
|
31
|
def __init__(self, **kwargs):
|
|
32
|
|
|
32
|
|
|
33
|
Operation.__init__(self, plot=True, **kwargs)
|
|
33
|
Operation.__init__(self, plot=True, **kwargs)
|
|
34
|
Process.__init__(self)
|
|
34
|
Process.__init__(self)
|
|
35
|
self.kwargs['code'] = self.CODE
|
|
35
|
self.kwargs['code'] = self.CODE
|
|
36
|
self.mp = False
|
|
36
|
self.mp = False
|
|
37
|
self.dataOut = None
|
|
37
|
self.dataOut = None
|
|
38
|
self.isConfig = False
|
|
38
|
self.isConfig = False
|
|
39
|
self.figure = None
|
|
39
|
self.figure = None
|
|
40
|
self.figure2 = None #JM modificatiom
|
|
|
|
|
41
|
self.axes = []
|
|
40
|
self.axes = []
|
|
42
|
self.localtime = kwargs.pop('localtime', True)
|
|
41
|
self.localtime = kwargs.pop('localtime', True)
|
|
43
|
self.show = kwargs.get('show', True)
|
|
42
|
self.show = kwargs.get('show', True)
|
|
44
|
self.save = kwargs.get('save', False)
|
|
43
|
self.save = kwargs.get('save', False)
|
|
45
|
self.colormap = kwargs.get('colormap', self.colormap)
|
|
44
|
self.colormap = kwargs.get('colormap', self.colormap)
|
|
46
|
self.colormap_coh = kwargs.get('colormap_coh', 'jet')
|
|
45
|
self.colormap_coh = kwargs.get('colormap_coh', 'jet')
|
|
47
|
self.colormap_phase = kwargs.get('colormap_phase', 'RdBu_r')
|
|
46
|
self.colormap_phase = kwargs.get('colormap_phase', 'RdBu_r')
|
|
48
|
self.showprofile = kwargs.get('showprofile', True)
|
|
47
|
self.showprofile = kwargs.get('showprofile', True)
|
|
49
|
self.title = kwargs.get('wintitle', '')
|
|
48
|
self.title = kwargs.get('wintitle', '')
|
|
50
|
self.xaxis = kwargs.get('xaxis', 'frequency')
|
|
49
|
self.xaxis = kwargs.get('xaxis', 'frequency')
|
|
51
|
self.zmin = kwargs.get('zmin', None)
|
|
50
|
self.zmin = kwargs.get('zmin', None)
|
|
52
|
self.zmax = kwargs.get('zmax', None)
|
|
51
|
self.zmax = kwargs.get('zmax', None)
|
|
53
|
self.xmin = kwargs.get('xmin', None)
|
|
52
|
self.xmin = kwargs.get('xmin', None)
|
|
54
|
self.xmax = kwargs.get('xmax', None)
|
|
53
|
self.xmax = kwargs.get('xmax', None)
|
|
55
|
self.xrange = kwargs.get('xrange', 24)
|
|
54
|
self.xrange = kwargs.get('xrange', 24)
|
|
56
|
self.ymin = kwargs.get('ymin', None)
|
|
55
|
self.ymin = kwargs.get('ymin', None)
|
|
57
|
self.ymax = kwargs.get('ymax', None)
|
|
56
|
self.ymax = kwargs.get('ymax', None)
|
|
58
|
self.__MAXNUMY = kwargs.get('decimation', 80)
|
|
57
|
self.__MAXNUMY = kwargs.get('decimation', 80)
|
|
59
|
self.throttle_value = 5
|
|
58
|
self.throttle_value = 5
|
|
60
|
self.times = []
|
|
59
|
self.times = []
|
|
61
|
#self.interactive = self.kwargs['parent']
|
|
60
|
#self.interactive = self.kwargs['parent']
|
|
62
|
|
|
61
|
|
|
|
|
|
62
|
'''
|
|
|
|
|
63
|
this new parameter is created to plot data from varius channels at different figures
|
|
|
|
|
64
|
1. crear una lista de figuras donde se puedan plotear las figuras,
|
|
|
|
|
65
|
2. dar las opciones de configuracion a cada figura, estas opciones son iguales para ambas figuras
|
|
|
|
|
66
|
3. probar?
|
|
|
|
|
67
|
'''
|
|
|
|
|
68
|
self.ind_plt_ch = kwargs.get('ind_plt_ch', False)
|
|
|
|
|
69
|
self.figurelist = None
|
|
|
|
|
70
|
|
|
63
|
|
|
71
|
|
|
64
|
def fill_gaps(self, x_buffer, y_buffer, z_buffer):
|
|
72
|
def fill_gaps(self, x_buffer, y_buffer, z_buffer):
|
|
65
|
|
|
73
|
|
|
66
|
if x_buffer.shape[0] < 2:
|
|
74
|
if x_buffer.shape[0] < 2:
|
|
67
|
return x_buffer, y_buffer, z_buffer
|
|
75
|
return x_buffer, y_buffer, z_buffer
|
|
68
|
|
|
76
|
|
|
69
|
deltas = x_buffer[1:] - x_buffer[0:-1]
|
|
77
|
deltas = x_buffer[1:] - x_buffer[0:-1]
|
|
70
|
x_median = np.median(deltas)
|
|
78
|
x_median = np.median(deltas)
|
|
71
|
|
|
79
|
|
|
72
|
index = np.where(deltas > 5*x_median)
|
|
80
|
index = np.where(deltas > 5*x_median)
|
|
73
|
|
|
81
|
|
|
74
|
if len(index[0]) != 0:
|
|
82
|
if len(index[0]) != 0:
|
|
75
|
z_buffer[::, index[0], ::] = self.__missing
|
|
83
|
z_buffer[::, index[0], ::] = self.__missing
|
|
76
|
z_buffer = np.ma.masked_inside(z_buffer,
|
|
84
|
z_buffer = np.ma.masked_inside(z_buffer,
|
|
77
|
0.99*self.__missing,
|
|
85
|
0.99*self.__missing,
|
|
78
|
1.01*self.__missing)
|
|
86
|
1.01*self.__missing)
|
|
79
|
|
|
87
|
|
|
80
|
return x_buffer, y_buffer, z_buffer
|
|
88
|
return x_buffer, y_buffer, z_buffer
|
|
81
|
|
|
89
|
|
|
82
|
def decimate(self):
|
|
90
|
def decimate(self):
|
|
83
|
|
|
91
|
|
|
84
|
# dx = int(len(self.x)/self.__MAXNUMX) + 1
|
|
92
|
# dx = int(len(self.x)/self.__MAXNUMX) + 1
|
|
85
|
dy = int(len(self.y)/self.__MAXNUMY) + 1
|
|
93
|
dy = int(len(self.y)/self.__MAXNUMY) + 1
|
|
86
|
|
|
94
|
|
|
87
|
# x = self.x[::dx]
|
|
95
|
# x = self.x[::dx]
|
|
88
|
x = self.x
|
|
96
|
x = self.x
|
|
89
|
y = self.y[::dy]
|
|
97
|
y = self.y[::dy]
|
|
90
|
z = self.z[::, ::, ::dy]
|
|
98
|
z = self.z[::, ::, ::dy]
|
|
91
|
|
|
99
|
|
|
92
|
return x, y, z
|
|
100
|
return x, y, z
|
|
93
|
|
|
101
|
|
|
94
|
def __plot(self):
|
|
102
|
def __plot(self):
|
|
95
|
|
|
103
|
|
|
96
|
print 'plotting...{}'.format(self.CODE)
|
|
104
|
print 'plotting...{}'.format(self.CODE)
|
|
97
|
|
|
105
|
if self.ind_plt_ch is False : #standard
|
|
98
|
if self.show:
|
|
106
|
if self.show:
|
|
99
|
self.figure.show()
|
|
107
|
self.figure.show()
|
|
100
|
self.figure2.show()
|
|
108
|
self.plot()
|
|
101
|
|
|
109
|
plt.tight_layout()
|
|
102
|
self.plot()
|
|
110
|
self.figure.canvas.manager.set_window_title('{} {} - {}'.format(self.title, self.CODE.upper(),
|
|
103
|
plt.tight_layout()
|
|
|
|
|
104
|
|
|
|
|
|
105
|
# self.figure.canvas.manager.set_window_title('{} {} - Date:{}'.format(self.title, self.CODE.upper(),
|
|
|
|
|
106
|
# datetime.datetime.fromtimestamp(self.max_time).strftime('%y/%m/%d %H:%M:%S')))
|
|
|
|
|
107
|
# self.figure2.canvas.manager.set_window_title('{} {} - Date:{}'.format(self.title, self.CODE.upper(),
|
|
|
|
|
108
|
# datetime.datetime.fromtimestamp(self.max_time).strftime('%y/%m/%d %H:%M:%S')))
|
|
|
|
|
109
|
# =======
|
|
|
|
|
110
|
self.figure.canvas.manager.set_window_title('{} {} - {}'.format(self.title, self.CODE.upper(),
|
|
|
|
|
111
|
datetime.datetime.fromtimestamp(self.max_time).strftime('%Y/%m/%d')))
|
|
111
|
datetime.datetime.fromtimestamp(self.max_time).strftime('%Y/%m/%d')))
|
|
112
|
self.figure2.canvas.manager.set_window_title('{} {} - {}'.format(self.title, self.CODE.upper(),
|
|
112
|
else :
|
|
113
|
datetime.datetime.fromtimestamp(self.max_time).strftime('%Y/%m/%d')))
|
|
113
|
for n, eachfigure in enumerate(self.figurelist):
|
|
114
|
|
|
114
|
if self.show:
|
|
|
|
|
115
|
eachfigure.show()
|
|
|
|
|
116
|
self.plot() # ok? como elijo que figura?
|
|
|
|
|
117
|
plt.tight_layout()
|
|
|
|
|
118
|
eachfigure.canvas.manager.set_window_title('{} {} - {}'.format(self.title[n], self.CODE.upper(),
|
|
|
|
|
119
|
datetime.datetime.fromtimestamp(self.max_time).strftime('%Y/%m/%d')))
|
|
115
|
|
|
120
|
|
|
116
|
if self.save:
|
|
121
|
if self.save:
|
|
117
|
figname = os.path.join(self.save, '{}_{}.png'.format(self.CODE,
|
|
122
|
if self.ind_plt_ch is False : #standard
|
|
118
|
datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d_%H%M%S')))
|
|
123
|
figname = os.path.join(self.save, '{}_{}.png'.format(self.CODE,
|
|
119
|
print 'Saving figure: {}'.format(figname)
|
|
124
|
datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d_%H%M%S')))
|
|
120
|
self.figure.savefig(figname)
|
|
125
|
print 'Saving figure: {}'.format(figname)
|
|
121
|
figname2 = os.path.join(self.save, '{}_{}2.png'.format(self.CODE,
|
|
126
|
self.figure.savefig(figname)
|
|
122
|
datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d_%H%M%S')))
|
|
127
|
else :
|
|
123
|
print 'Saving figure: {}'.format(figname2)
|
|
128
|
for n, eachfigure in enumerate(self.figurelist):
|
|
124
|
self.figure2.savefig(figname2)
|
|
129
|
#add specific name for each channel in channelList
|
|
125
|
|
|
130
|
figname = os.path.join(self.save, '{}_{}_{}.png'.format(self.titles[n],self.CODE,
|
|
126
|
self.figure.canvas.draw()
|
|
131
|
datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d_%H%M%S')))
|
|
127
|
self.figure2.canvas.draw()
|
|
132
|
|
|
|
|
|
133
|
print 'Saving figure: {}'.format(figname)
|
|
|
|
|
134
|
eachfigure.savefig(figname)
|
|
|
|
|
135
|
|
|
|
|
|
136
|
if self.ind_plt_ch is False :
|
|
|
|
|
137
|
self.figure.canvas.draw()
|
|
|
|
|
138
|
else :
|
|
|
|
|
139
|
for eachfigure in self.figurelist:
|
|
|
|
|
140
|
eachfigure.canvas.draw()
|
|
128
|
|
|
141
|
|
|
129
|
def plot(self):
|
|
142
|
def plot(self):
|
|
130
|
|
|
143
|
|
|
131
|
print 'plotting...{}'.format(self.CODE.upper())
|
|
144
|
print 'plotting...{}'.format(self.CODE.upper())
|
|
132
|
return
|
|
145
|
return
|
|
133
|
|
|
146
|
|
|
134
|
def run(self):
|
|
147
|
def run(self):
|
|
135
|
|
|
148
|
|
|
136
|
print '[Starting] {}'.format(self.name)
|
|
149
|
print '[Starting] {}'.format(self.name)
|
|
137
|
|
|
150
|
|
|
138
|
context = zmq.Context()
|
|
151
|
context = zmq.Context()
|
|
139
|
receiver = context.socket(zmq.SUB)
|
|
152
|
receiver = context.socket(zmq.SUB)
|
|
140
|
receiver.setsockopt(zmq.SUBSCRIBE, '')
|
|
153
|
receiver.setsockopt(zmq.SUBSCRIBE, '')
|
|
141
|
receiver.setsockopt(zmq.CONFLATE, self.CONFLATE)
|
|
154
|
receiver.setsockopt(zmq.CONFLATE, self.CONFLATE)
|
|
142
|
|
|
155
|
|
|
143
|
if 'server' in self.kwargs['parent']:
|
|
156
|
if 'server' in self.kwargs['parent']:
|
|
144
|
receiver.connect('ipc:///tmp/{}.plots'.format(self.kwargs['parent']['server']))
|
|
157
|
receiver.connect('ipc:///tmp/{}.plots'.format(self.kwargs['parent']['server']))
|
|
145
|
else:
|
|
158
|
else:
|
|
146
|
receiver.connect("ipc:///tmp/zmq.plots")
|
|
159
|
receiver.connect("ipc:///tmp/zmq.plots")
|
|
147
|
|
|
160
|
|
|
148
|
seconds_passed = 0
|
|
161
|
seconds_passed = 0
|
|
149
|
|
|
162
|
|
|
150
|
while True:
|
|
163
|
while True:
|
|
151
|
try:
|
|
164
|
try:
|
|
152
|
self.data = receiver.recv_pyobj(flags=zmq.NOBLOCK)#flags=zmq.NOBLOCK
|
|
165
|
self.data = receiver.recv_pyobj(flags=zmq.NOBLOCK)#flags=zmq.NOBLOCK
|
|
153
|
self.started = self.data['STARTED']
|
|
166
|
self.started = self.data['STARTED']
|
|
154
|
self.dataOut = self.data['dataOut']
|
|
167
|
self.dataOut = self.data['dataOut']
|
|
155
|
|
|
168
|
|
|
156
|
if (len(self.times) < len(self.data['times']) and not self.started and self.data['ENDED']):
|
|
169
|
if (len(self.times) < len(self.data['times']) and not self.started and self.data['ENDED']):
|
|
157
|
continue
|
|
170
|
continue
|
|
158
|
|
|
171
|
|
|
159
|
self.times = self.data['times']
|
|
172
|
self.times = self.data['times']
|
|
160
|
self.times.sort()
|
|
173
|
self.times.sort()
|
|
161
|
self.throttle_value = self.data['throttle']
|
|
174
|
self.throttle_value = self.data['throttle']
|
|
162
|
self.min_time = self.times[0]
|
|
175
|
self.min_time = self.times[0]
|
|
163
|
self.max_time = self.times[-1]
|
|
176
|
self.max_time = self.times[-1]
|
|
164
|
|
|
177
|
|
|
165
|
if self.isConfig is False:
|
|
178
|
if self.isConfig is False:
|
|
166
|
print 'setting up'
|
|
179
|
print 'setting up'
|
|
167
|
self.setup()
|
|
180
|
self.setup()
|
|
168
|
self.isConfig = True
|
|
181
|
self.isConfig = True
|
|
169
|
self.__plot()
|
|
182
|
self.__plot()
|
|
170
|
|
|
183
|
|
|
171
|
if self.data['ENDED'] is True:
|
|
184
|
if self.data['ENDED'] is True:
|
|
172
|
print '********GRAPHIC ENDED********'
|
|
185
|
print '********GRAPHIC ENDED********'
|
|
173
|
self.ended = True
|
|
186
|
self.ended = True
|
|
174
|
self.isConfig = False
|
|
187
|
self.isConfig = False
|
|
175
|
self.__plot()
|
|
188
|
self.__plot()
|
|
176
|
elif seconds_passed >= self.data['throttle']:
|
|
189
|
elif seconds_passed >= self.data['throttle']:
|
|
177
|
print 'passed', seconds_passed
|
|
190
|
print 'passed', seconds_passed
|
|
178
|
self.__plot()
|
|
191
|
self.__plot()
|
|
179
|
seconds_passed = 0
|
|
192
|
seconds_passed = 0
|
|
180
|
|
|
193
|
|
|
181
|
except zmq.Again as e:
|
|
194
|
except zmq.Again as e:
|
|
182
|
print 'Waiting for data...'
|
|
195
|
print 'Waiting for data...'
|
|
183
|
plt.pause(2)
|
|
196
|
plt.pause(2)
|
|
184
|
seconds_passed += 2
|
|
197
|
seconds_passed += 2
|
|
185
|
|
|
198
|
|
|
186
|
def close(self):
|
|
199
|
def close(self):
|
|
187
|
if self.dataOut:
|
|
200
|
if self.dataOut:
|
|
188
|
self.__plot()
|
|
201
|
self.__plot()
|
|
189
|
|
|
202
|
|
|
190
|
|
|
203
|
|
|
191
|
class PlotSpectraData(PlotData):
|
|
204
|
class PlotSpectraData(PlotData):
|
|
192
|
|
|
205
|
|
|
193
|
CODE = 'spc'
|
|
206
|
CODE = 'spc'
|
|
194
|
colormap = 'jro'
|
|
207
|
colormap = 'jro'
|
|
195
|
CONFLATE = False
|
|
208
|
CONFLATE = False
|
|
196
|
|
|
209
|
|
|
197
|
def setup(self):
|
|
210
|
def setup(self):
|
|
198
|
|
|
211
|
|
|
199
|
ncolspan = 1
|
|
212
|
ncolspan = 1
|
|
200
|
colspan = 1
|
|
213
|
colspan = 1
|
|
201
|
self.ncols = int(numpy.sqrt(self.dataOut.nChannels)+0.9)
|
|
214
|
self.ncols = int(numpy.sqrt(self.dataOut.nChannels)+0.9)
|
|
202
|
self.nrows = int(self.dataOut.nChannels*1./self.ncols + 0.9)
|
|
215
|
self.nrows = int(self.dataOut.nChannels*1./self.ncols + 0.9)
|
|
203
|
self.width = 3.6*self.ncols
|
|
216
|
self.width = 3.6*self.ncols
|
|
204
|
self.height = 3.2*self.nrows
|
|
217
|
self.height = 3.2*self.nrows
|
|
205
|
if self.showprofile:
|
|
218
|
if self.showprofile:
|
|
206
|
ncolspan = 3
|
|
219
|
ncolspan = 3
|
|
207
|
colspan = 2
|
|
220
|
colspan = 2
|
|
208
|
self.width += 1.2*self.ncols
|
|
221
|
self.width += 1.2*self.ncols
|
|
209
|
|
|
222
|
|
|
210
|
self.ylabel = 'Range [Km]'
|
|
223
|
self.ylabel = 'Range [Km]'
|
|
211
|
self.titles = ['Channel {}'.format(x) for x in self.dataOut.channelList]
|
|
224
|
self.titles = ['Channel {}'.format(x) for x in self.dataOut.channelList]
|
|
212
|
|
|
225
|
|
|
213
|
if self.figure is None:
|
|
226
|
if self.figure is None:
|
|
214
|
self.figure = plt.figure(figsize=(self.width, self.height),
|
|
227
|
self.figure = plt.figure(figsize=(self.width, self.height),
|
|
215
|
edgecolor='k',
|
|
228
|
edgecolor='k',
|
|
216
|
facecolor='w')
|
|
229
|
facecolor='w')
|
|
217
|
else:
|
|
230
|
else:
|
|
218
|
self.figure.clf()
|
|
231
|
self.figure.clf()
|
|
219
|
|
|
232
|
|
|
220
|
n = 0
|
|
233
|
n = 0
|
|
221
|
for y in range(self.nrows):
|
|
234
|
for y in range(self.nrows):
|
|
222
|
for x in range(self.ncols):
|
|
235
|
for x in range(self.ncols):
|
|
223
|
if n >= self.dataOut.nChannels:
|
|
236
|
if n >= self.dataOut.nChannels:
|
|
224
|
break
|
|
237
|
break
|
|
225
|
ax = plt.subplot2grid((self.nrows, self.ncols*ncolspan), (y, x*ncolspan), 1, colspan)
|
|
238
|
ax = plt.subplot2grid((self.nrows, self.ncols*ncolspan), (y, x*ncolspan), 1, colspan)
|
|
226
|
if self.showprofile:
|
|
239
|
if self.showprofile:
|
|
227
|
ax.ax_profile = plt.subplot2grid((self.nrows, self.ncols*ncolspan), (y, x*ncolspan+colspan), 1, 1)
|
|
240
|
ax.ax_profile = plt.subplot2grid((self.nrows, self.ncols*ncolspan), (y, x*ncolspan+colspan), 1, 1)
|
|
228
|
|
|
241
|
|
|
229
|
ax.firsttime = True
|
|
242
|
ax.firsttime = True
|
|
230
|
self.axes.append(ax)
|
|
243
|
self.axes.append(ax)
|
|
231
|
n += 1
|
|
244
|
n += 1
|
|
232
|
|
|
245
|
|
|
233
|
def plot(self):
|
|
246
|
def plot(self):
|
|
234
|
|
|
247
|
|
|
235
|
if self.xaxis == "frequency":
|
|
248
|
if self.xaxis == "frequency":
|
|
236
|
x = self.dataOut.getFreqRange(1)/1000.
|
|
249
|
x = self.dataOut.getFreqRange(1)/1000.
|
|
237
|
xlabel = "Frequency (kHz)"
|
|
250
|
xlabel = "Frequency (kHz)"
|
|
238
|
elif self.xaxis == "time":
|
|
251
|
elif self.xaxis == "time":
|
|
239
|
x = self.dataOut.getAcfRange(1)
|
|
252
|
x = self.dataOut.getAcfRange(1)
|
|
240
|
xlabel = "Time (ms)"
|
|
253
|
xlabel = "Time (ms)"
|
|
241
|
else:
|
|
254
|
else:
|
|
242
|
x = self.dataOut.getVelRange(1)
|
|
255
|
x = self.dataOut.getVelRange(1)
|
|
243
|
xlabel = "Velocity (m/s)"
|
|
256
|
xlabel = "Velocity (m/s)"
|
|
244
|
|
|
257
|
|
|
245
|
y = self.dataOut.getHeiRange()
|
|
258
|
y = self.dataOut.getHeiRange()
|
|
246
|
z = self.data[self.CODE]
|
|
259
|
z = self.data[self.CODE]
|
|
247
|
|
|
260
|
|
|
248
|
for n, ax in enumerate(self.axes):
|
|
261
|
for n, ax in enumerate(self.axes):
|
|
249
|
|
|
|
|
|
250
|
if ax.firsttime:
|
|
262
|
if ax.firsttime:
|
|
251
|
self.xmax = self.xmax if self.xmax else np.nanmax(x)
|
|
263
|
self.xmax = self.xmax if self.xmax else np.nanmax(x)
|
|
252
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
264
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
253
|
self.ymin = self.ymin if self.ymin else np.nanmin(y)
|
|
265
|
self.ymin = self.ymin if self.ymin else np.nanmin(y)
|
|
254
|
self.ymax = self.ymax if self.ymax else np.nanmax(y)
|
|
266
|
self.ymax = self.ymax if self.ymax else np.nanmax(y)
|
|
255
|
self.zmin = self.zmin if self.zmin else np.nanmin(z)
|
|
267
|
self.zmin = self.zmin if self.zmin else np.nanmin(z)
|
|
256
|
self.zmax = self.zmax if self.zmax else np.nanmax(z)
|
|
268
|
self.zmax = self.zmax if self.zmax else np.nanmax(z)
|
|
257
|
ax.plot = ax.pcolormesh(x, y, z[n].T,
|
|
269
|
ax.plot = ax.pcolormesh(x, y, z[n].T,
|
|
258
|
vmin=self.zmin,
|
|
270
|
vmin=self.zmin,
|
|
259
|
vmax=self.zmax,
|
|
271
|
vmax=self.zmax,
|
|
260
|
cmap=plt.get_cmap(self.colormap)
|
|
272
|
cmap=plt.get_cmap(self.colormap)
|
|
261
|
)
|
|
273
|
)
|
|
262
|
divider = make_axes_locatable(ax)
|
|
274
|
divider = make_axes_locatable(ax)
|
|
263
|
cax = divider.new_horizontal(size='3%', pad=0.05)
|
|
275
|
cax = divider.new_horizontal(size='3%', pad=0.05)
|
|
264
|
self.figure.add_axes(cax)
|
|
276
|
self.figure.add_axes(cax)
|
|
265
|
plt.colorbar(ax.plot, cax)
|
|
277
|
plt.colorbar(ax.plot, cax)
|
|
266
|
|
|
278
|
|
|
267
|
ax.set_xlim(self.xmin, self.xmax)
|
|
279
|
ax.set_xlim(self.xmin, self.xmax)
|
|
268
|
ax.set_ylim(self.ymin, self.ymax)
|
|
280
|
ax.set_ylim(self.ymin, self.ymax)
|
|
269
|
|
|
281
|
|
|
270
|
ax.set_ylabel(self.ylabel)
|
|
282
|
ax.set_ylabel(self.ylabel)
|
|
271
|
ax.set_xlabel(xlabel)
|
|
283
|
ax.set_xlabel(xlabel)
|
|
272
|
|
|
284
|
|
|
273
|
ax.firsttime = False
|
|
285
|
ax.firsttime = False
|
|
274
|
|
|
286
|
|
|
275
|
if self.showprofile:
|
|
287
|
if self.showprofile:
|
|
276
|
ax.plot_profile= ax.ax_profile.plot(self.data['rti'][self.max_time][n], y)[0]
|
|
288
|
ax.plot_profile= ax.ax_profile.plot(self.data['rti'][self.max_time][n], y)[0]
|
|
277
|
ax.ax_profile.set_xlim(self.zmin, self.zmax)
|
|
289
|
ax.ax_profile.set_xlim(self.zmin, self.zmax)
|
|
278
|
ax.ax_profile.set_ylim(self.ymin, self.ymax)
|
|
290
|
ax.ax_profile.set_ylim(self.ymin, self.ymax)
|
|
279
|
ax.ax_profile.set_xlabel('dB')
|
|
291
|
ax.ax_profile.set_xlabel('dB')
|
|
280
|
ax.ax_profile.grid(b=True, axis='x')
|
|
292
|
ax.ax_profile.grid(b=True, axis='x')
|
|
281
|
ax.plot_noise = ax.ax_profile.plot(numpy.repeat(self.data['noise'][self.max_time][n], len(y)), y,
|
|
293
|
ax.plot_noise = ax.ax_profile.plot(numpy.repeat(self.data['noise'][self.max_time][n], len(y)), y,
|
|
282
|
color="k", linestyle="dashed", lw=2)[0]
|
|
294
|
color="k", linestyle="dashed", lw=2)[0]
|
|
283
|
[tick.set_visible(False) for tick in ax.ax_profile.get_yticklabels()]
|
|
295
|
[tick.set_visible(False) for tick in ax.ax_profile.get_yticklabels()]
|
|
284
|
else:
|
|
296
|
else:
|
|
285
|
ax.plot.set_array(z[n].T.ravel())
|
|
297
|
ax.plot.set_array(z[n].T.ravel())
|
|
286
|
if self.showprofile:
|
|
298
|
if self.showprofile:
|
|
287
|
ax.plot_profile.set_data(self.data['rti'][self.max_time][n], y)
|
|
299
|
ax.plot_profile.set_data(self.data['rti'][self.max_time][n], y)
|
|
288
|
ax.plot_noise.set_data(numpy.repeat(self.data['noise'][self.max_time][n], len(y)), y)
|
|
300
|
ax.plot_noise.set_data(numpy.repeat(self.data['noise'][self.max_time][n], len(y)), y)
|
|
289
|
|
|
301
|
|
|
290
|
ax.set_title('{} - Noise: {:.2f} dB'.format(self.titles[n], self.data['noise'][self.max_time][n]),
|
|
302
|
ax.set_title('{} - Noise: {:.2f} dB'.format(self.titles[n], self.data['noise'][self.max_time][n]),
|
|
291
|
size=8)
|
|
303
|
size=8)
|
|
292
|
self.saveTime = self.max_time
|
|
304
|
self.saveTime = self.max_time
|
|
293
|
|
|
305
|
|
|
294
|
|
|
306
|
|
|
295
|
class PlotCrossSpectraData(PlotData):
|
|
307
|
class PlotCrossSpectraData(PlotData):
|
|
296
|
|
|
308
|
|
|
297
|
CODE = 'cspc'
|
|
309
|
CODE = 'cspc'
|
|
298
|
zmin_coh = None
|
|
310
|
zmin_coh = None
|
|
299
|
zmax_coh = None
|
|
311
|
zmax_coh = None
|
|
300
|
zmin_phase = None
|
|
312
|
zmin_phase = None
|
|
301
|
zmax_phase = None
|
|
313
|
zmax_phase = None
|
|
302
|
CONFLATE = False
|
|
314
|
CONFLATE = False
|
|
303
|
|
|
315
|
|
|
304
|
def setup(self):
|
|
316
|
def setup(self):
|
|
305
|
|
|
317
|
|
|
306
|
ncolspan = 1
|
|
318
|
ncolspan = 1
|
|
307
|
colspan = 1
|
|
319
|
colspan = 1
|
|
308
|
self.ncols = 2
|
|
320
|
self.ncols = 2
|
|
309
|
self.nrows = self.dataOut.nPairs
|
|
321
|
self.nrows = self.dataOut.nPairs
|
|
310
|
self.width = 3.6*self.ncols
|
|
322
|
self.width = 3.6*self.ncols
|
|
311
|
self.height = 3.2*self.nrows
|
|
323
|
self.height = 3.2*self.nrows
|
|
312
|
|
|
324
|
|
|
313
|
self.ylabel = 'Range [Km]'
|
|
325
|
self.ylabel = 'Range [Km]'
|
|
314
|
self.titles = ['Channel {}'.format(x) for x in self.dataOut.channelList]
|
|
326
|
self.titles = ['Channel {}'.format(x) for x in self.dataOut.channelList]
|
|
315
|
|
|
327
|
|
|
316
|
if self.figure is None:
|
|
328
|
if self.figure is None:
|
|
317
|
self.figure = plt.figure(figsize=(self.width, self.height),
|
|
329
|
self.figure = plt.figure(figsize=(self.width, self.height),
|
|
318
|
edgecolor='k',
|
|
330
|
edgecolor='k',
|
|
319
|
facecolor='w')
|
|
331
|
facecolor='w')
|
|
320
|
else:
|
|
332
|
else:
|
|
321
|
self.figure.clf()
|
|
333
|
self.figure.clf()
|
|
322
|
|
|
334
|
|
|
323
|
for y in range(self.nrows):
|
|
335
|
for y in range(self.nrows):
|
|
324
|
for x in range(self.ncols):
|
|
336
|
for x in range(self.ncols):
|
|
325
|
ax = plt.subplot2grid((self.nrows, self.ncols), (y, x), 1, 1)
|
|
337
|
ax = plt.subplot2grid((self.nrows, self.ncols), (y, x), 1, 1)
|
|
326
|
ax.firsttime = True
|
|
338
|
ax.firsttime = True
|
|
327
|
self.axes.append(ax)
|
|
339
|
self.axes.append(ax)
|
|
328
|
|
|
340
|
|
|
329
|
def plot(self):
|
|
341
|
def plot(self):
|
|
330
|
|
|
342
|
|
|
331
|
if self.xaxis == "frequency":
|
|
343
|
if self.xaxis == "frequency":
|
|
332
|
x = self.dataOut.getFreqRange(1)/1000.
|
|
344
|
x = self.dataOut.getFreqRange(1)/1000.
|
|
333
|
xlabel = "Frequency (kHz)"
|
|
345
|
xlabel = "Frequency (kHz)"
|
|
334
|
elif self.xaxis == "time":
|
|
346
|
elif self.xaxis == "time":
|
|
335
|
x = self.dataOut.getAcfRange(1)
|
|
347
|
x = self.dataOut.getAcfRange(1)
|
|
336
|
xlabel = "Time (ms)"
|
|
348
|
xlabel = "Time (ms)"
|
|
337
|
else:
|
|
349
|
else:
|
|
338
|
x = self.dataOut.getVelRange(1)
|
|
350
|
x = self.dataOut.getVelRange(1)
|
|
339
|
xlabel = "Velocity (m/s)"
|
|
351
|
xlabel = "Velocity (m/s)"
|
|
340
|
|
|
352
|
|
|
341
|
y = self.dataOut.getHeiRange()
|
|
353
|
y = self.dataOut.getHeiRange()
|
|
342
|
z_coh = self.data['cspc_coh']
|
|
354
|
z_coh = self.data['cspc_coh']
|
|
343
|
z_phase = self.data['cspc_phase']
|
|
355
|
z_phase = self.data['cspc_phase']
|
|
344
|
|
|
356
|
|
|
345
|
for n in range(self.nrows):
|
|
357
|
for n in range(self.nrows):
|
|
346
|
ax = self.axes[2*n]
|
|
358
|
ax = self.axes[2*n]
|
|
347
|
ax1 = self.axes[2*n+1]
|
|
359
|
ax1 = self.axes[2*n+1]
|
|
348
|
if ax.firsttime:
|
|
360
|
if ax.firsttime:
|
|
349
|
self.xmax = self.xmax if self.xmax else np.nanmax(x)
|
|
361
|
self.xmax = self.xmax if self.xmax else np.nanmax(x)
|
|
350
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
362
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
351
|
self.ymin = self.ymin if self.ymin else np.nanmin(y)
|
|
363
|
self.ymin = self.ymin if self.ymin else np.nanmin(y)
|
|
352
|
self.ymax = self.ymax if self.ymax else np.nanmax(y)
|
|
364
|
self.ymax = self.ymax if self.ymax else np.nanmax(y)
|
|
353
|
self.zmin_coh = self.zmin_coh if self.zmin_coh else 0.0
|
|
365
|
self.zmin_coh = self.zmin_coh if self.zmin_coh else 0.0
|
|
354
|
self.zmax_coh = self.zmax_coh if self.zmax_coh else 1.0
|
|
366
|
self.zmax_coh = self.zmax_coh if self.zmax_coh else 1.0
|
|
355
|
self.zmin_phase = self.zmin_phase if self.zmin_phase else -180
|
|
367
|
self.zmin_phase = self.zmin_phase if self.zmin_phase else -180
|
|
356
|
self.zmax_phase = self.zmax_phase if self.zmax_phase else 180
|
|
368
|
self.zmax_phase = self.zmax_phase if self.zmax_phase else 180
|
|
357
|
|
|
369
|
|
|
358
|
ax.plot = ax.pcolormesh(x, y, z_coh[n].T,
|
|
370
|
ax.plot = ax.pcolormesh(x, y, z_coh[n].T,
|
|
359
|
vmin=self.zmin_coh,
|
|
371
|
vmin=self.zmin_coh,
|
|
360
|
vmax=self.zmax_coh,
|
|
372
|
vmax=self.zmax_coh,
|
|
361
|
cmap=plt.get_cmap(self.colormap_coh)
|
|
373
|
cmap=plt.get_cmap(self.colormap_coh)
|
|
362
|
)
|
|
374
|
)
|
|
363
|
divider = make_axes_locatable(ax)
|
|
375
|
divider = make_axes_locatable(ax)
|
|
364
|
cax = divider.new_horizontal(size='3%', pad=0.05)
|
|
376
|
cax = divider.new_horizontal(size='3%', pad=0.05)
|
|
365
|
self.figure.add_axes(cax)
|
|
377
|
self.figure.add_axes(cax)
|
|
366
|
plt.colorbar(ax.plot, cax)
|
|
378
|
plt.colorbar(ax.plot, cax)
|
|
367
|
|
|
379
|
|
|
368
|
ax.set_xlim(self.xmin, self.xmax)
|
|
380
|
ax.set_xlim(self.xmin, self.xmax)
|
|
369
|
ax.set_ylim(self.ymin, self.ymax)
|
|
381
|
ax.set_ylim(self.ymin, self.ymax)
|
|
370
|
|
|
382
|
|
|
371
|
ax.set_ylabel(self.ylabel)
|
|
383
|
ax.set_ylabel(self.ylabel)
|
|
372
|
ax.set_xlabel(xlabel)
|
|
384
|
ax.set_xlabel(xlabel)
|
|
373
|
ax.firsttime = False
|
|
385
|
ax.firsttime = False
|
|
374
|
|
|
386
|
|
|
375
|
ax1.plot = ax1.pcolormesh(x, y, z_phase[n].T,
|
|
387
|
ax1.plot = ax1.pcolormesh(x, y, z_phase[n].T,
|
|
376
|
vmin=self.zmin_phase,
|
|
388
|
vmin=self.zmin_phase,
|
|
377
|
vmax=self.zmax_phase,
|
|
389
|
vmax=self.zmax_phase,
|
|
378
|
cmap=plt.get_cmap(self.colormap_phase)
|
|
390
|
cmap=plt.get_cmap(self.colormap_phase)
|
|
379
|
)
|
|
391
|
)
|
|
380
|
divider = make_axes_locatable(ax1)
|
|
392
|
divider = make_axes_locatable(ax1)
|
|
381
|
cax = divider.new_horizontal(size='3%', pad=0.05)
|
|
393
|
cax = divider.new_horizontal(size='3%', pad=0.05)
|
|
382
|
self.figure.add_axes(cax)
|
|
394
|
self.figure.add_axes(cax)
|
|
383
|
plt.colorbar(ax1.plot, cax)
|
|
395
|
plt.colorbar(ax1.plot, cax)
|
|
384
|
|
|
396
|
|
|
385
|
ax1.set_xlim(self.xmin, self.xmax)
|
|
397
|
ax1.set_xlim(self.xmin, self.xmax)
|
|
386
|
ax1.set_ylim(self.ymin, self.ymax)
|
|
398
|
ax1.set_ylim(self.ymin, self.ymax)
|
|
387
|
|
|
399
|
|
|
388
|
ax1.set_ylabel(self.ylabel)
|
|
400
|
ax1.set_ylabel(self.ylabel)
|
|
389
|
ax1.set_xlabel(xlabel)
|
|
401
|
ax1.set_xlabel(xlabel)
|
|
390
|
ax1.firsttime = False
|
|
402
|
ax1.firsttime = False
|
|
391
|
else:
|
|
403
|
else:
|
|
392
|
ax.plot.set_array(z_coh[n].T.ravel())
|
|
404
|
ax.plot.set_array(z_coh[n].T.ravel())
|
|
393
|
ax1.plot.set_array(z_phase[n].T.ravel())
|
|
405
|
ax1.plot.set_array(z_phase[n].T.ravel())
|
|
394
|
|
|
406
|
|
|
395
|
ax.set_title('Coherence Ch{} * Ch{}'.format(self.dataOut.pairsList[n][0], self.dataOut.pairsList[n][1]), size=8)
|
|
407
|
ax.set_title('Coherence Ch{} * Ch{}'.format(self.dataOut.pairsList[n][0], self.dataOut.pairsList[n][1]), size=8)
|
|
396
|
ax1.set_title('Phase Ch{} * Ch{}'.format(self.dataOut.pairsList[n][0], self.dataOut.pairsList[n][1]), size=8)
|
|
408
|
ax1.set_title('Phase Ch{} * Ch{}'.format(self.dataOut.pairsList[n][0], self.dataOut.pairsList[n][1]), size=8)
|
|
397
|
self.saveTime = self.max_time
|
|
409
|
self.saveTime = self.max_time
|
|
398
|
|
|
410
|
|
|
399
|
|
|
411
|
|
|
400
|
class PlotSpectraMeanData(PlotSpectraData):
|
|
412
|
class PlotSpectraMeanData(PlotSpectraData):
|
|
401
|
|
|
413
|
|
|
402
|
CODE = 'spc_mean'
|
|
414
|
CODE = 'spc_mean'
|
|
403
|
colormap = 'jet'
|
|
415
|
colormap = 'jet'
|
|
404
|
|
|
416
|
|
|
405
|
def plot(self):
|
|
417
|
def plot(self):
|
|
406
|
|
|
418
|
|
|
407
|
if self.xaxis == "frequency":
|
|
419
|
if self.xaxis == "frequency":
|
|
408
|
x = self.dataOut.getFreqRange(1)/1000.
|
|
420
|
x = self.dataOut.getFreqRange(1)/1000.
|
|
409
|
xlabel = "Frequency (kHz)"
|
|
421
|
xlabel = "Frequency (kHz)"
|
|
410
|
elif self.xaxis == "time":
|
|
422
|
elif self.xaxis == "time":
|
|
411
|
x = self.dataOut.getAcfRange(1)
|
|
423
|
x = self.dataOut.getAcfRange(1)
|
|
412
|
xlabel = "Time (ms)"
|
|
424
|
xlabel = "Time (ms)"
|
|
413
|
else:
|
|
425
|
else:
|
|
414
|
x = self.dataOut.getVelRange(1)
|
|
426
|
x = self.dataOut.getVelRange(1)
|
|
415
|
xlabel = "Velocity (m/s)"
|
|
427
|
xlabel = "Velocity (m/s)"
|
|
416
|
|
|
428
|
|
|
417
|
y = self.dataOut.getHeiRange()
|
|
429
|
y = self.dataOut.getHeiRange()
|
|
418
|
z = self.data['spc']
|
|
430
|
z = self.data['spc']
|
|
419
|
mean = self.data['mean'][self.max_time]
|
|
431
|
mean = self.data['mean'][self.max_time]
|
|
420
|
|
|
432
|
|
|
421
|
for n, ax in enumerate(self.axes):
|
|
433
|
for n, ax in enumerate(self.axes):
|
|
422
|
|
|
434
|
|
|
423
|
if ax.firsttime:
|
|
435
|
if ax.firsttime:
|
|
424
|
self.xmax = self.xmax if self.xmax else np.nanmax(x)
|
|
436
|
self.xmax = self.xmax if self.xmax else np.nanmax(x)
|
|
425
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
437
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
426
|
self.ymin = self.ymin if self.ymin else np.nanmin(y)
|
|
438
|
self.ymin = self.ymin if self.ymin else np.nanmin(y)
|
|
427
|
self.ymax = self.ymax if self.ymax else np.nanmax(y)
|
|
439
|
self.ymax = self.ymax if self.ymax else np.nanmax(y)
|
|
428
|
self.zmin = self.zmin if self.zmin else np.nanmin(z)
|
|
440
|
self.zmin = self.zmin if self.zmin else np.nanmin(z)
|
|
429
|
self.zmax = self.zmax if self.zmax else np.nanmax(z)
|
|
441
|
self.zmax = self.zmax if self.zmax else np.nanmax(z)
|
|
430
|
ax.plt = ax.pcolormesh(x, y, z[n].T,
|
|
442
|
ax.plt = ax.pcolormesh(x, y, z[n].T,
|
|
431
|
vmin=self.zmin,
|
|
443
|
vmin=self.zmin,
|
|
432
|
vmax=self.zmax,
|
|
444
|
vmax=self.zmax,
|
|
433
|
cmap=plt.get_cmap(self.colormap)
|
|
445
|
cmap=plt.get_cmap(self.colormap)
|
|
434
|
)
|
|
446
|
)
|
|
435
|
ax.plt_dop = ax.plot(mean[n], y,
|
|
447
|
ax.plt_dop = ax.plot(mean[n], y,
|
|
436
|
color='k')[0]
|
|
448
|
color='k')[0]
|
|
437
|
|
|
449
|
|
|
438
|
divider = make_axes_locatable(ax)
|
|
450
|
divider = make_axes_locatable(ax)
|
|
439
|
cax = divider.new_horizontal(size='3%', pad=0.05)
|
|
451
|
cax = divider.new_horizontal(size='3%', pad=0.05)
|
|
440
|
self.figure.add_axes(cax)
|
|
452
|
self.figure.add_axes(cax)
|
|
441
|
plt.colorbar(ax.plt, cax)
|
|
453
|
plt.colorbar(ax.plt, cax)
|
|
442
|
|
|
454
|
|
|
443
|
ax.set_xlim(self.xmin, self.xmax)
|
|
455
|
ax.set_xlim(self.xmin, self.xmax)
|
|
444
|
ax.set_ylim(self.ymin, self.ymax)
|
|
456
|
ax.set_ylim(self.ymin, self.ymax)
|
|
445
|
|
|
457
|
|
|
446
|
ax.set_ylabel(self.ylabel)
|
|
458
|
ax.set_ylabel(self.ylabel)
|
|
447
|
ax.set_xlabel(xlabel)
|
|
459
|
ax.set_xlabel(xlabel)
|
|
448
|
|
|
460
|
|
|
449
|
ax.firsttime = False
|
|
461
|
ax.firsttime = False
|
|
450
|
|
|
462
|
|
|
451
|
if self.showprofile:
|
|
463
|
if self.showprofile:
|
|
452
|
ax.plt_profile= ax.ax_profile.plot(self.data['rti'][self.max_time][n], y)[0]
|
|
464
|
ax.plt_profile= ax.ax_profile.plot(self.data['rti'][self.max_time][n], y)[0]
|
|
453
|
ax.ax_profile.set_xlim(self.zmin, self.zmax)
|
|
465
|
ax.ax_profile.set_xlim(self.zmin, self.zmax)
|
|
454
|
ax.ax_profile.set_ylim(self.ymin, self.ymax)
|
|
466
|
ax.ax_profile.set_ylim(self.ymin, self.ymax)
|
|
455
|
ax.ax_profile.set_xlabel('dB')
|
|
467
|
ax.ax_profile.set_xlabel('dB')
|
|
456
|
ax.ax_profile.grid(b=True, axis='x')
|
|
468
|
ax.ax_profile.grid(b=True, axis='x')
|
|
457
|
ax.plt_noise = ax.ax_profile.plot(numpy.repeat(self.data['noise'][self.max_time][n], len(y)), y,
|
|
469
|
ax.plt_noise = ax.ax_profile.plot(numpy.repeat(self.data['noise'][self.max_time][n], len(y)), y,
|
|
458
|
color="k", linestyle="dashed", lw=2)[0]
|
|
470
|
color="k", linestyle="dashed", lw=2)[0]
|
|
459
|
[tick.set_visible(False) for tick in ax.ax_profile.get_yticklabels()]
|
|
471
|
[tick.set_visible(False) for tick in ax.ax_profile.get_yticklabels()]
|
|
460
|
else:
|
|
472
|
else:
|
|
461
|
ax.plt.set_array(z[n].T.ravel())
|
|
473
|
ax.plt.set_array(z[n].T.ravel())
|
|
462
|
ax.plt_dop.set_data(mean[n], y)
|
|
474
|
ax.plt_dop.set_data(mean[n], y)
|
|
463
|
if self.showprofile:
|
|
475
|
if self.showprofile:
|
|
464
|
ax.plt_profile.set_data(self.data['rti'][self.max_time][n], y)
|
|
476
|
ax.plt_profile.set_data(self.data['rti'][self.max_time][n], y)
|
|
465
|
ax.plt_noise.set_data(numpy.repeat(self.data['noise'][self.max_time][n], len(y)), y)
|
|
477
|
ax.plt_noise.set_data(numpy.repeat(self.data['noise'][self.max_time][n], len(y)), y)
|
|
466
|
|
|
478
|
|
|
467
|
ax.set_title('{} - Noise: {:.2f} dB'.format(self.titles[n], self.data['noise'][self.max_time][n]),
|
|
479
|
ax.set_title('{} - Noise: {:.2f} dB'.format(self.titles[n], self.data['noise'][self.max_time][n]),
|
|
468
|
size=8)
|
|
480
|
size=8)
|
|
469
|
self.saveTime = self.max_time
|
|
481
|
self.saveTime = self.max_time
|
|
470
|
|
|
482
|
|
|
471
|
|
|
483
|
|
|
472
|
class PlotRTIData(PlotData):
|
|
484
|
class PlotRTIData(PlotData):
|
|
473
|
|
|
485
|
|
|
474
|
CODE = 'rti'
|
|
486
|
CODE = 'rti'
|
|
475
|
colormap = 'jro'
|
|
487
|
colormap = 'jro'
|
|
476
|
|
|
488
|
|
|
477
|
def setup(self):
|
|
489
|
def setup(self):
|
|
478
|
self.ncols = 1
|
|
490
|
self.ncols = 1
|
|
479
|
self.nrows = self.dataOut.nChannels
|
|
491
|
self.nrows = self.dataOut.nChannels
|
|
480
|
self.width = 10
|
|
492
|
self.width = 10
|
|
481
|
self.height = 2.2*self.nrows if self.nrows<6 else 12
|
|
493
|
self.height = 2.2*self.nrows if self.nrows<6 else 12
|
|
482
|
if self.nrows==1:
|
|
494
|
if self.nrows==1:
|
|
483
|
self.height += 1
|
|
495
|
self.height += 1
|
|
484
|
self.ylabel = 'Range [Km]'
|
|
496
|
self.ylabel = 'Range [Km]'
|
|
485
|
self.titles = ['Channel {}'.format(x) for x in self.dataOut.channelList]
|
|
497
|
self.titles = ['Channel {}'.format(x) for x in self.dataOut.channelList]
|
|
486
|
|
|
498
|
|
|
487
|
if self.figure is None:
|
|
499
|
'''
|
|
488
|
self.figure = plt.figure(figsize=(self.width, self.height),
|
|
500
|
Logica:
|
|
489
|
edgecolor='k',
|
|
501
|
1) Si la variable ind_plt_ch es True, va a crear mas de 1 figura
|
|
490
|
facecolor='w')
|
|
502
|
2) guardamos "Figures" en una lista y "axes" en otra, quizas se deberia guardar el
|
|
491
|
else:
|
|
503
|
axis dentro de "Figures" como un diccionario.
|
|
492
|
self.figure.clf()
|
|
504
|
'''
|
|
493
|
self.axes = []
|
|
505
|
if self.ind_plt_ch is False: #standard mode
|
|
|
|
|
506
|
|
|
|
|
|
507
|
if self.figure is None: #solo para la priemra vez
|
|
|
|
|
508
|
self.figure = plt.figure(figsize=(self.width, self.height),
|
|
|
|
|
509
|
edgecolor='k',
|
|
|
|
|
510
|
facecolor='w')
|
|
|
|
|
511
|
else:
|
|
|
|
|
512
|
self.figure.clf()
|
|
|
|
|
513
|
self.axes = []
|
|
494
|
|
|
514
|
|
|
495
|
if self.figure2 is None:
|
|
|
|
|
496
|
self.figure2 = plt.figure(figsize=(self.width, self.height),
|
|
|
|
|
497
|
edgecolor='k',
|
|
|
|
|
498
|
facecolor='w')
|
|
|
|
|
499
|
else:
|
|
|
|
|
500
|
self.figure2.clf()
|
|
|
|
|
501
|
self.axes = []
|
|
|
|
|
502
|
|
|
515
|
|
|
503
|
ax = self.figure.add_subplot(1,1,1)
|
|
516
|
for n in range(self.nrows):
|
|
504
|
#ax = self.figure( n+1)
|
|
517
|
ax = self.figure.add_subplot(self.nrows, self.ncols, n+1)
|
|
505
|
ax.firsttime = True
|
|
518
|
#ax = self.figure(n+1)
|
|
506
|
self.axes.append(ax)
|
|
519
|
ax.firsttime = True
|
|
|
|
|
520
|
self.axes.append(ax)
|
|
507
|
|
|
521
|
|
|
508
|
ax = self.figure2.add_subplot(1,1,1)
|
|
522
|
else : #append one figure foreach channel in channelList
|
|
509
|
#ax = self.figure( n+1)
|
|
523
|
if self.figurelist == None:
|
|
510
|
ax.firsttime = True
|
|
524
|
self.figurelist = []
|
|
511
|
self.axes.append(ax)
|
|
525
|
for n in range(self.nrows):
|
|
512
|
# for n in range(self.nrows):
|
|
526
|
self.figure = plt.figure(figsize=(self.width, self.height),
|
|
513
|
# ax = self.figure.add_subplot(self.nrows, self.ncols, n+1)
|
|
527
|
edgecolor='k',
|
|
514
|
# #ax = self.figure( n+1)
|
|
528
|
facecolor='w')
|
|
515
|
# ax.firsttime = True
|
|
529
|
#add always one subplot
|
|
516
|
# self.axes.append(ax)
|
|
530
|
self.figurelist.append(self.figure)
|
|
|
|
|
531
|
|
|
|
|
|
532
|
else : # cada dia nuevo limpia el axes, pero mantiene el figure
|
|
|
|
|
533
|
for eachfigure in self.figurelist:
|
|
|
|
|
534
|
eachfigure.clf() # eliminaria todas las figuras de la lista?
|
|
|
|
|
535
|
self.axes = []
|
|
|
|
|
536
|
|
|
|
|
|
537
|
for eachfigure in self.figurelist:
|
|
|
|
|
538
|
ax = eachfigure.add_subplot(1,1,1) #solo 1 axis por figura
|
|
|
|
|
539
|
#ax = self.figure(n+1)
|
|
|
|
|
540
|
ax.firsttime = True
|
|
|
|
|
541
|
#Cada figura tiene un distinto puntero
|
|
|
|
|
542
|
self.axes.append(ax)
|
|
|
|
|
543
|
#plt.close(eachfigure)
|
|
517
|
|
|
544
|
|
|
518
|
|
|
545
|
|
|
519
|
def plot(self):
|
|
546
|
def plot(self):
|
|
520
|
|
|
547
|
|
|
521
|
self.x = np.array(self.times)
|
|
548
|
if self.ind_plt_ch is False: #standard mode
|
|
522
|
self.y = self.dataOut.getHeiRange()
|
|
549
|
self.x = np.array(self.times)
|
|
523
|
self.z = []
|
|
550
|
self.y = self.dataOut.getHeiRange()
|
|
524
|
|
|
551
|
self.z = []
|
|
525
|
for ch in range(self.nrows):
|
|
552
|
|
|
526
|
self.z.append([self.data[self.CODE][t][ch] for t in self.times])
|
|
553
|
for ch in range(self.nrows):
|
|
527
|
|
|
554
|
self.z.append([self.data[self.CODE][t][ch] for t in self.times])
|
|
528
|
self.z = np.array(self.z)
|
|
555
|
|
|
529
|
for n, ax in enumerate(self.axes):
|
|
556
|
self.z = np.array(self.z)
|
|
530
|
x, y, z = self.fill_gaps(*self.decimate())
|
|
557
|
for n, ax in enumerate(self.axes):
|
|
531
|
xmin = self.min_time
|
|
558
|
x, y, z = self.fill_gaps(*self.decimate())
|
|
532
|
xmax = xmin+self.xrange*60*60
|
|
559
|
xmin = self.min_time
|
|
533
|
self.zmin = self.zmin if self.zmin else np.min(self.z)
|
|
560
|
xmax = xmin+self.xrange*60*60
|
|
534
|
self.zmax = self.zmax if self.zmax else np.max(self.z)
|
|
561
|
self.zmin = self.zmin if self.zmin else np.min(self.z)
|
|
535
|
if ax.firsttime:
|
|
562
|
self.zmax = self.zmax if self.zmax else np.max(self.z)
|
|
536
|
self.ymin = self.ymin if self.ymin else np.nanmin(self.y)
|
|
563
|
if ax.firsttime:
|
|
537
|
self.ymax = self.ymax if self.ymax else np.nanmax(self.y)
|
|
564
|
self.ymin = self.ymin if self.ymin else np.nanmin(self.y)
|
|
538
|
plot = ax.pcolormesh(x, y, z[n].T,
|
|
565
|
self.ymax = self.ymax if self.ymax else np.nanmax(self.y)
|
|
539
|
vmin=self.zmin,
|
|
566
|
plot = ax.pcolormesh(x, y, z[n].T,
|
|
540
|
vmax=self.zmax,
|
|
567
|
vmin=self.zmin,
|
|
541
|
cmap=plt.get_cmap(self.colormap)
|
|
568
|
vmax=self.zmax,
|
|
542
|
)
|
|
569
|
cmap=plt.get_cmap(self.colormap)
|
|
543
|
divider = make_axes_locatable(ax)
|
|
570
|
)
|
|
544
|
cax = divider.new_horizontal(size='2%', pad=0.05)
|
|
571
|
divider = make_axes_locatable(ax)
|
|
545
|
#self.figure.add_axes(cax)
|
|
572
|
cax = divider.new_horizontal(size='2%', pad=0.05)
|
|
546
|
#self.figure2.add_axes(cax)
|
|
573
|
self.figure.add_axes(cax)
|
|
547
|
plt.colorbar(plot, cax)
|
|
574
|
plt.colorbar(plot, cax)
|
|
548
|
ax.set_ylim(self.ymin, self.ymax)
|
|
575
|
ax.set_ylim(self.ymin, self.ymax)
|
|
549
|
|
|
576
|
ax.xaxis.set_major_formatter(FuncFormatter(func))
|
|
550
|
ax.xaxis.set_major_formatter(FuncFormatter(func))
|
|
577
|
ax.xaxis.set_major_locator(LinearLocator(6))
|
|
551
|
ax.xaxis.set_major_locator(LinearLocator(6))
|
|
578
|
ax.set_ylabel(self.ylabel)
|
|
552
|
|
|
579
|
# if self.xmin is None:
|
|
553
|
ax.set_ylabel(self.ylabel)
|
|
580
|
# xmin = self.min_time
|
|
554
|
|
|
581
|
# else:
|
|
555
|
# if self.xmin is None:
|
|
582
|
# xmin = (datetime.datetime.combine(self.dataOut.datatime.date(),
|
|
556
|
# xmin = self.min_time
|
|
583
|
# datetime.time(self.xmin, 0, 0))-d1970).total_seconds()
|
|
557
|
# else:
|
|
584
|
ax.set_xlim(xmin, xmax)
|
|
558
|
# xmin = (datetime.datetime.combine(self.dataOut.datatime.date(),
|
|
585
|
ax.firsttime = False
|
|
559
|
# datetime.time(self.xmin, 0, 0))-d1970).total_seconds()
|
|
586
|
else:
|
|
560
|
|
|
587
|
ax.collections.remove(ax.collections[0])
|
|
561
|
ax.set_xlim(xmin, xmax)
|
|
588
|
ax.set_xlim(xmin, xmax)
|
|
562
|
ax.firsttime = False
|
|
589
|
plot = ax.pcolormesh(x, y, z[n].T,
|
|
563
|
else:
|
|
590
|
vmin=self.zmin,
|
|
564
|
ax.collections.remove(ax.collections[0])
|
|
591
|
vmax=self.zmax,
|
|
565
|
ax.set_xlim(xmin, xmax)
|
|
592
|
cmap=plt.get_cmap(self.colormap)
|
|
566
|
plot = ax.pcolormesh(x, y, z[n].T,
|
|
593
|
)
|
|
567
|
vmin=self.zmin,
|
|
594
|
ax.set_title('{} {}'.format(self.titles[n],
|
|
568
|
vmax=self.zmax,
|
|
595
|
datetime.datetime.fromtimestamp(self.max_time).strftime('%y/%m/%d %H:%M:%S')),
|
|
569
|
cmap=plt.get_cmap(self.colormap)
|
|
596
|
size=8)
|
|
570
|
)
|
|
597
|
|
|
571
|
ax.set_title('{} {}'.format(self.titles[n],
|
|
598
|
self.saveTime = self.min_time
|
|
572
|
datetime.datetime.fromtimestamp(self.max_time).strftime('%y/%m/%d %H:%M:%S')),
|
|
599
|
else :
|
|
573
|
size=8)
|
|
600
|
self.x = np.array(self.times)
|
|
574
|
|
|
601
|
self.y = self.dataOut.getHeiRange()
|
|
575
|
self.saveTime = self.min_time
|
|
602
|
self.z = []
|
|
|
|
|
603
|
|
|
|
|
|
604
|
for ch in range(self.nrows):
|
|
|
|
|
605
|
self.z.append([self.data[self.CODE][t][ch] for t in self.times])
|
|
|
|
|
606
|
|
|
|
|
|
607
|
self.z = np.array(self.z)
|
|
|
|
|
608
|
for n, eachfigure in enumerate(self.figurelist): #estaba ax in axes
|
|
|
|
|
609
|
|
|
|
|
|
610
|
x, y, z = self.fill_gaps(*self.decimate())
|
|
|
|
|
611
|
xmin = self.min_time
|
|
|
|
|
612
|
xmax = xmin+self.xrange*60*60
|
|
|
|
|
613
|
self.zmin = self.zmin if self.zmin else np.min(self.z)
|
|
|
|
|
614
|
self.zmax = self.zmax if self.zmax else np.max(self.z)
|
|
|
|
|
615
|
if self.axes[n].firsttime:
|
|
|
|
|
616
|
self.ymin = self.ymin if self.ymin else np.nanmin(self.y)
|
|
|
|
|
617
|
self.ymax = self.ymax if self.ymax else np.nanmax(self.y)
|
|
|
|
|
618
|
plot = self.axes[n].pcolormesh(x, y, z[n].T,
|
|
|
|
|
619
|
vmin=self.zmin,
|
|
|
|
|
620
|
vmax=self.zmax,
|
|
|
|
|
621
|
cmap=plt.get_cmap(self.colormap)
|
|
|
|
|
622
|
)
|
|
|
|
|
623
|
divider = make_axes_locatable(self.axes[n])
|
|
|
|
|
624
|
cax = divider.new_horizontal(size='2%', pad=0.05)
|
|
|
|
|
625
|
eachfigure.add_axes(cax)
|
|
|
|
|
626
|
#self.figure2.add_axes(cax)
|
|
|
|
|
627
|
plt.colorbar(plot, cax)
|
|
|
|
|
628
|
self.axes[n].set_ylim(self.ymin, self.ymax)
|
|
|
|
|
629
|
|
|
|
|
|
630
|
self.axes[n].xaxis.set_major_formatter(FuncFormatter(func))
|
|
|
|
|
631
|
self.axes[n].xaxis.set_major_locator(LinearLocator(6))
|
|
|
|
|
632
|
|
|
|
|
|
633
|
self.axes[n].set_ylabel(self.ylabel)
|
|
|
|
|
634
|
|
|
|
|
|
635
|
# if self.xmin is None:
|
|
|
|
|
636
|
# xmin = self.min_time
|
|
|
|
|
637
|
# else:
|
|
|
|
|
638
|
# xmin = (datetime.datetime.combine(self.dataOut.datatime.date(),
|
|
|
|
|
639
|
# datetime.time(self.xmin, 0, 0))-d1970).total_seconds()
|
|
|
|
|
640
|
|
|
|
|
|
641
|
self.axes[n].set_xlim(xmin, xmax)
|
|
|
|
|
642
|
self.axes[n].firsttime = False
|
|
|
|
|
643
|
else:
|
|
|
|
|
644
|
self.axes[n].collections.remove(self.axes[n].collections[0])
|
|
|
|
|
645
|
self.axes[n].set_xlim(xmin, xmax)
|
|
|
|
|
646
|
plot = self.axes[n].pcolormesh(x, y, z[n].T,
|
|
|
|
|
647
|
vmin=self.zmin,
|
|
|
|
|
648
|
vmax=self.zmax,
|
|
|
|
|
649
|
cmap=plt.get_cmap(self.colormap)
|
|
|
|
|
650
|
)
|
|
|
|
|
651
|
self.axes[n].set_title('{} {}'.format(self.titles[n],
|
|
|
|
|
652
|
datetime.datetime.fromtimestamp(self.max_time).strftime('%y/%m/%d %H:%M:%S')),
|
|
|
|
|
653
|
size=8)
|
|
|
|
|
654
|
|
|
|
|
|
655
|
self.saveTime = self.min_time
|
|
576
|
|
|
656
|
|
|
577
|
|
|
657
|
|
|
578
|
class PlotCOHData(PlotRTIData):
|
|
658
|
class PlotCOHData(PlotRTIData):
|
|
579
|
|
|
659
|
|
|
580
|
CODE = 'coh'
|
|
660
|
CODE = 'coh'
|
|
581
|
|
|
661
|
|
|
582
|
def setup(self):
|
|
662
|
def setup(self):
|
|
583
|
|
|
663
|
|
|
584
|
self.ncols = 1
|
|
664
|
self.ncols = 1
|
|
585
|
self.nrows = self.dataOut.nPairs
|
|
665
|
self.nrows = self.dataOut.nPairs
|
|
586
|
self.width = 10
|
|
666
|
self.width = 10
|
|
587
|
self.height = 2.2*self.nrows if self.nrows<6 else 12
|
|
667
|
self.height = 2.2*self.nrows if self.nrows<6 else 12
|
|
588
|
if self.nrows==1:
|
|
668
|
if self.nrows==1:
|
|
589
|
self.height += 1
|
|
669
|
self.height += 1
|
|
590
|
self.ylabel = 'Range [Km]'
|
|
670
|
self.ylabel = 'Range [Km]'
|
|
591
|
self.titles = ['{} Ch{} * Ch{}'.format(self.CODE.upper(), x[0], x[1]) for x in self.dataOut.pairsList]
|
|
671
|
self.titles = ['{} Ch{} * Ch{}'.format(self.CODE.upper(), x[0], x[1]) for x in self.dataOut.pairsList]
|
|
592
|
|
|
672
|
|
|
593
|
if self.figure is None:
|
|
673
|
if self.figure is None:
|
|
594
|
self.figure = plt.figure(figsize=(self.width, self.height),
|
|
674
|
self.figure = plt.figure(figsize=(self.width, self.height),
|
|
595
|
edgecolor='k',
|
|
675
|
edgecolor='k',
|
|
596
|
facecolor='w')
|
|
676
|
facecolor='w')
|
|
597
|
else:
|
|
677
|
else:
|
|
598
|
self.figure.clf()
|
|
678
|
self.figure.clf()
|
|
599
|
self.axes = []
|
|
679
|
self.axes = []
|
|
600
|
|
|
680
|
|
|
601
|
for n in range(self.nrows):
|
|
681
|
for n in range(self.nrows):
|
|
602
|
ax = self.figure.add_subplot(self.nrows, self.ncols, n+1)
|
|
682
|
ax = self.figure.add_subplot(self.nrows, self.ncols, n+1)
|
|
603
|
ax.firsttime = True
|
|
683
|
ax.firsttime = True
|
|
604
|
self.axes.append(ax)
|
|
684
|
self.axes.append(ax)
|
|
605
|
|
|
685
|
|
|
606
|
|
|
686
|
|
|
607
|
class PlotNoiseData(PlotData):
|
|
687
|
class PlotNoiseData(PlotData):
|
|
608
|
CODE = 'noise'
|
|
688
|
CODE = 'noise'
|
|
609
|
|
|
689
|
|
|
610
|
def setup(self):
|
|
690
|
def setup(self):
|
|
611
|
|
|
691
|
|
|
612
|
self.ncols = 1
|
|
692
|
self.ncols = 1
|
|
613
|
self.nrows = 1
|
|
693
|
self.nrows = 1
|
|
614
|
self.width = 10
|
|
694
|
self.width = 10
|
|
615
|
self.height = 3.2
|
|
695
|
self.height = 3.2
|
|
616
|
self.ylabel = 'Intensity [dB]'
|
|
696
|
self.ylabel = 'Intensity [dB]'
|
|
617
|
self.titles = ['Noise']
|
|
697
|
self.titles = ['Noise']
|
|
618
|
|
|
698
|
|
|
619
|
if self.figure is None:
|
|
699
|
if self.figure is None:
|
|
620
|
self.figure = plt.figure(figsize=(self.width, self.height),
|
|
700
|
self.figure = plt.figure(figsize=(self.width, self.height),
|
|
621
|
edgecolor='k',
|
|
701
|
edgecolor='k',
|
|
622
|
facecolor='w')
|
|
702
|
facecolor='w')
|
|
623
|
else:
|
|
703
|
else:
|
|
624
|
self.figure.clf()
|
|
704
|
self.figure.clf()
|
|
625
|
self.axes = []
|
|
705
|
self.axes = []
|
|
626
|
|
|
706
|
|
|
627
|
self.ax = self.figure.add_subplot(self.nrows, self.ncols, 1)
|
|
707
|
self.ax = self.figure.add_subplot(self.nrows, self.ncols, 1)
|
|
628
|
self.ax.firsttime = True
|
|
708
|
self.ax.firsttime = True
|
|
629
|
|
|
709
|
|
|
630
|
def plot(self):
|
|
710
|
def plot(self):
|
|
631
|
|
|
711
|
|
|
632
|
x = self.times
|
|
712
|
x = self.times
|
|
633
|
xmin = self.min_time
|
|
713
|
xmin = self.min_time
|
|
634
|
xmax = xmin+self.xrange*60*60
|
|
714
|
xmax = xmin+self.xrange*60*60
|
|
635
|
if self.ax.firsttime:
|
|
715
|
if self.ax.firsttime:
|
|
636
|
for ch in self.dataOut.channelList:
|
|
716
|
for ch in self.dataOut.channelList:
|
|
637
|
y = [self.data[self.CODE][t][ch] for t in self.times]
|
|
717
|
y = [self.data[self.CODE][t][ch] for t in self.times]
|
|
638
|
self.ax.plot(x, y, lw=1, label='Ch{}'.format(ch))
|
|
718
|
self.ax.plot(x, y, lw=1, label='Ch{}'.format(ch))
|
|
639
|
self.ax.firsttime = False
|
|
719
|
self.ax.firsttime = False
|
|
640
|
self.ax.xaxis.set_major_formatter(FuncFormatter(func))
|
|
720
|
self.ax.xaxis.set_major_formatter(FuncFormatter(func))
|
|
641
|
self.ax.xaxis.set_major_locator(LinearLocator(6))
|
|
721
|
self.ax.xaxis.set_major_locator(LinearLocator(6))
|
|
642
|
self.ax.set_ylabel(self.ylabel)
|
|
722
|
self.ax.set_ylabel(self.ylabel)
|
|
643
|
plt.legend()
|
|
723
|
plt.legend()
|
|
644
|
else:
|
|
724
|
else:
|
|
645
|
for ch in self.dataOut.channelList:
|
|
725
|
for ch in self.dataOut.channelList:
|
|
646
|
y = [self.data[self.CODE][t][ch] for t in self.times]
|
|
726
|
y = [self.data[self.CODE][t][ch] for t in self.times]
|
|
647
|
self.ax.lines[ch].set_data(x, y)
|
|
727
|
self.ax.lines[ch].set_data(x, y)
|
|
648
|
|
|
728
|
|
|
649
|
self.ax.set_xlim(xmin, xmax)
|
|
729
|
self.ax.set_xlim(xmin, xmax)
|
|
650
|
self.ax.set_ylim(min(y)-5, max(y)+5)
|
|
730
|
self.ax.set_ylim(min(y)-5, max(y)+5)
|
|
651
|
self.saveTime = self.min_time
|
|
731
|
self.saveTime = self.min_time
|
|
652
|
|
|
732
|
|
|
653
|
|
|
733
|
|
|
654
|
class PlotWindProfilerData(PlotRTIData):
|
|
734
|
class PlotWindProfilerData(PlotRTIData):
|
|
655
|
|
|
735
|
|
|
656
|
CODE = 'wind'
|
|
736
|
CODE = 'wind'
|
|
657
|
colormap = 'seismic'
|
|
737
|
colormap = 'seismic'
|
|
658
|
|
|
738
|
|
|
659
|
def setup(self):
|
|
739
|
def setup(self):
|
|
660
|
self.ncols = 1
|
|
740
|
self.ncols = 1
|
|
661
|
self.nrows = self.dataOut.data_output.shape[0]
|
|
741
|
self.nrows = self.dataOut.data_output.shape[0]
|
|
662
|
self.width = 10
|
|
742
|
self.width = 10
|
|
663
|
self.height = 2.2*self.nrows
|
|
743
|
self.height = 2.2*self.nrows
|
|
664
|
self.ylabel = 'Height [Km]'
|
|
744
|
self.ylabel = 'Height [Km]'
|
|
665
|
self.titles = ['Zonal Wind' ,'Meridional Wind', 'Vertical Wind']
|
|
745
|
self.titles = ['Zonal Wind' ,'Meridional Wind', 'Vertical Wind']
|
|
666
|
self.clabels = ['Velocity (m/s)','Velocity (m/s)','Velocity (cm/s)']
|
|
746
|
self.clabels = ['Velocity (m/s)','Velocity (m/s)','Velocity (cm/s)']
|
|
667
|
self.windFactor = [1, 1, 100]
|
|
747
|
self.windFactor = [1, 1, 100]
|
|
668
|
|
|
748
|
|
|
669
|
if self.figure is None:
|
|
749
|
if self.figure is None:
|
|
670
|
self.figure = plt.figure(figsize=(self.width, self.height),
|
|
750
|
self.figure = plt.figure(figsize=(self.width, self.height),
|
|
671
|
edgecolor='k',
|
|
751
|
edgecolor='k',
|
|
672
|
facecolor='w')
|
|
752
|
facecolor='w')
|
|
673
|
else:
|
|
753
|
else:
|
|
674
|
self.figure.clf()
|
|
754
|
self.figure.clf()
|
|
675
|
self.axes = []
|
|
755
|
self.axes = []
|
|
676
|
|
|
756
|
|
|
677
|
for n in range(self.nrows):
|
|
757
|
for n in range(self.nrows):
|
|
678
|
ax = self.figure.add_subplot(self.nrows, self.ncols, n+1)
|
|
758
|
ax = self.figure.add_subplot(self.nrows, self.ncols, n+1)
|
|
679
|
ax.firsttime = True
|
|
759
|
ax.firsttime = True
|
|
680
|
self.axes.append(ax)
|
|
760
|
self.axes.append(ax)
|
|
681
|
|
|
761
|
|
|
682
|
def plot(self):
|
|
762
|
def plot(self):
|
|
683
|
|
|
763
|
|
|
684
|
self.x = np.array(self.times)
|
|
764
|
self.x = np.array(self.times)
|
|
685
|
self.y = self.dataOut.heightList
|
|
765
|
self.y = self.dataOut.heightList
|
|
686
|
self.z = []
|
|
766
|
self.z = []
|
|
687
|
|
|
767
|
|
|
688
|
for ch in range(self.nrows):
|
|
768
|
for ch in range(self.nrows):
|
|
689
|
self.z.append([self.data['output'][t][ch] for t in self.times])
|
|
769
|
self.z.append([self.data['output'][t][ch] for t in self.times])
|
|
690
|
|
|
770
|
|
|
691
|
self.z = np.array(self.z)
|
|
771
|
self.z = np.array(self.z)
|
|
692
|
self.z = numpy.ma.masked_invalid(self.z)
|
|
772
|
self.z = numpy.ma.masked_invalid(self.z)
|
|
693
|
|
|
773
|
|
|
694
|
cmap=plt.get_cmap(self.colormap)
|
|
774
|
cmap=plt.get_cmap(self.colormap)
|
|
695
|
cmap.set_bad('black', 1.)
|
|
775
|
cmap.set_bad('black', 1.)
|
|
696
|
|
|
776
|
|
|
697
|
for n, ax in enumerate(self.axes):
|
|
777
|
for n, ax in enumerate(self.axes):
|
|
698
|
x, y, z = self.fill_gaps(*self.decimate())
|
|
778
|
x, y, z = self.fill_gaps(*self.decimate())
|
|
699
|
xmin = self.min_time
|
|
779
|
xmin = self.min_time
|
|
700
|
xmax = xmin+self.xrange*60*60
|
|
780
|
xmax = xmin+self.xrange*60*60
|
|
701
|
if ax.firsttime:
|
|
781
|
if ax.firsttime:
|
|
702
|
self.ymin = self.ymin if self.ymin else np.nanmin(self.y)
|
|
782
|
self.ymin = self.ymin if self.ymin else np.nanmin(self.y)
|
|
703
|
self.ymax = self.ymax if self.ymax else np.nanmax(self.y)
|
|
783
|
self.ymax = self.ymax if self.ymax else np.nanmax(self.y)
|
|
704
|
self.zmax = self.zmax if self.zmax else numpy.nanmax(abs(self.z[:-1, :]))
|
|
784
|
self.zmax = self.zmax if self.zmax else numpy.nanmax(abs(self.z[:-1, :]))
|
|
705
|
self.zmin = self.zmin if self.zmin else -self.zmax
|
|
785
|
self.zmin = self.zmin if self.zmin else -self.zmax
|
|
706
|
|
|
786
|
|
|
707
|
plot = ax.pcolormesh(x, y, z[n].T*self.windFactor[n],
|
|
787
|
plot = ax.pcolormesh(x, y, z[n].T*self.windFactor[n],
|
|
708
|
vmin=self.zmin,
|
|
788
|
vmin=self.zmin,
|
|
709
|
vmax=self.zmax,
|
|
789
|
vmax=self.zmax,
|
|
710
|
cmap=cmap
|
|
790
|
cmap=cmap
|
|
711
|
)
|
|
791
|
)
|
|
712
|
divider = make_axes_locatable(ax)
|
|
792
|
divider = make_axes_locatable(ax)
|
|
713
|
cax = divider.new_horizontal(size='2%', pad=0.05)
|
|
793
|
cax = divider.new_horizontal(size='2%', pad=0.05)
|
|
714
|
self.figure.add_axes(cax)
|
|
794
|
self.figure.add_axes(cax)
|
|
715
|
cb = plt.colorbar(plot, cax)
|
|
795
|
cb = plt.colorbar(plot, cax)
|
|
716
|
cb.set_label(self.clabels[n])
|
|
796
|
cb.set_label(self.clabels[n])
|
|
717
|
ax.set_ylim(self.ymin, self.ymax)
|
|
797
|
ax.set_ylim(self.ymin, self.ymax)
|
|
718
|
|
|
798
|
|
|
719
|
ax.xaxis.set_major_formatter(FuncFormatter(func))
|
|
799
|
ax.xaxis.set_major_formatter(FuncFormatter(func))
|
|
720
|
ax.xaxis.set_major_locator(LinearLocator(6))
|
|
800
|
ax.xaxis.set_major_locator(LinearLocator(6))
|
|
721
|
|
|
801
|
|
|
722
|
ax.set_ylabel(self.ylabel)
|
|
802
|
ax.set_ylabel(self.ylabel)
|
|
723
|
|
|
803
|
|
|
724
|
ax.set_xlim(xmin, xmax)
|
|
804
|
ax.set_xlim(xmin, xmax)
|
|
725
|
ax.firsttime = False
|
|
805
|
ax.firsttime = False
|
|
726
|
else:
|
|
806
|
else:
|
|
727
|
ax.collections.remove(ax.collections[0])
|
|
807
|
ax.collections.remove(ax.collections[0])
|
|
728
|
ax.set_xlim(xmin, xmax)
|
|
808
|
ax.set_xlim(xmin, xmax)
|
|
729
|
plot = ax.pcolormesh(x, y, z[n].T*self.windFactor[n],
|
|
809
|
plot = ax.pcolormesh(x, y, z[n].T*self.windFactor[n],
|
|
730
|
vmin=self.zmin,
|
|
810
|
vmin=self.zmin,
|
|
731
|
vmax=self.zmax,
|
|
811
|
vmax=self.zmax,
|
|
732
|
cmap=plt.get_cmap(self.colormap)
|
|
812
|
cmap=plt.get_cmap(self.colormap)
|
|
733
|
)
|
|
813
|
)
|
|
734
|
ax.set_title('{} {}'.format(self.titles[n],
|
|
814
|
ax.set_title('{} {}'.format(self.titles[n],
|
|
735
|
datetime.datetime.fromtimestamp(self.max_time).strftime('%y/%m/%d %H:%M:%S')),
|
|
815
|
datetime.datetime.fromtimestamp(self.max_time).strftime('%y/%m/%d %H:%M:%S')),
|
|
736
|
size=8)
|
|
816
|
size=8)
|
|
737
|
|
|
817
|
|
|
738
|
self.saveTime = self.min_time
|
|
818
|
self.saveTime = self.min_time
|
|
739
|
|
|
819
|
|
|
740
|
|
|
820
|
|
|
741
|
class PlotSNRData(PlotRTIData):
|
|
821
|
class PlotSNRData(PlotRTIData):
|
|
742
|
CODE = 'snr'
|
|
822
|
CODE = 'snr'
|
|
743
|
colormap = 'jet'
|
|
823
|
colormap = 'jet'
|
|
744
|
|
|
824
|
|
|
745
|
class PlotDOPData(PlotRTIData):
|
|
825
|
class PlotDOPData(PlotRTIData):
|
|
746
|
CODE = 'dop'
|
|
826
|
CODE = 'dop'
|
|
747
|
colormap = 'jet'
|
|
827
|
colormap = 'jet'
|
|
748
|
|
|
828
|
|
|
749
|
|
|
829
|
|
|
750
|
class PlotPHASEData(PlotCOHData):
|
|
830
|
class PlotPHASEData(PlotCOHData):
|
|
751
|
CODE = 'phase'
|
|
831
|
CODE = 'phase'
|
|
752
|
colormap = 'seismic'
|
|
832
|
colormap = 'seismic'
|
|
753
|
|
|
833
|
|
|
754
|
|
|
834
|
|
|
755
|
class PlotSkyMapData(PlotData):
|
|
835
|
class PlotSkyMapData(PlotData):
|
|
756
|
|
|
836
|
|
|
757
|
CODE = 'met'
|
|
837
|
CODE = 'met'
|
|
758
|
|
|
838
|
|
|
759
|
def setup(self):
|
|
839
|
def setup(self):
|
|
760
|
|
|
840
|
|
|
761
|
self.ncols = 1
|
|
841
|
self.ncols = 1
|
|
762
|
self.nrows = 1
|
|
842
|
self.nrows = 1
|
|
763
|
self.width = 7.2
|
|
843
|
self.width = 7.2
|
|
764
|
self.height = 7.2
|
|
844
|
self.height = 7.2
|
|
765
|
|
|
845
|
|
|
766
|
self.xlabel = 'Zonal Zenith Angle (deg)'
|
|
846
|
self.xlabel = 'Zonal Zenith Angle (deg)'
|
|
767
|
self.ylabel = 'Meridional Zenith Angle (deg)'
|
|
847
|
self.ylabel = 'Meridional Zenith Angle (deg)'
|
|
768
|
|
|
848
|
|
|
769
|
if self.figure is None:
|
|
849
|
if self.figure is None:
|
|
770
|
self.figure = plt.figure(figsize=(self.width, self.height),
|
|
850
|
self.figure = plt.figure(figsize=(self.width, self.height),
|
|
771
|
edgecolor='k',
|
|
851
|
edgecolor='k',
|
|
772
|
facecolor='w')
|
|
852
|
facecolor='w')
|
|
773
|
else:
|
|
853
|
else:
|
|
774
|
self.figure.clf()
|
|
854
|
self.figure.clf()
|
|
775
|
|
|
855
|
|
|
776
|
self.ax = plt.subplot2grid((self.nrows, self.ncols), (0, 0), 1, 1, polar=True)
|
|
856
|
self.ax = plt.subplot2grid((self.nrows, self.ncols), (0, 0), 1, 1, polar=True)
|
|
777
|
self.ax.firsttime = True
|
|
857
|
self.ax.firsttime = True
|
|
778
|
|
|
858
|
|
|
779
|
|
|
859
|
|
|
780
|
def plot(self):
|
|
860
|
def plot(self):
|
|
781
|
|
|
861
|
|
|
782
|
arrayParameters = np.concatenate([self.data['param'][t] for t in self.times])
|
|
862
|
arrayParameters = np.concatenate([self.data['param'][t] for t in self.times])
|
|
783
|
error = arrayParameters[:,-1]
|
|
863
|
error = arrayParameters[:,-1]
|
|
784
|
indValid = numpy.where(error == 0)[0]
|
|
864
|
indValid = numpy.where(error == 0)[0]
|
|
785
|
finalMeteor = arrayParameters[indValid,:]
|
|
865
|
finalMeteor = arrayParameters[indValid,:]
|
|
786
|
finalAzimuth = finalMeteor[:,3]
|
|
866
|
finalAzimuth = finalMeteor[:,3]
|
|
787
|
finalZenith = finalMeteor[:,4]
|
|
867
|
finalZenith = finalMeteor[:,4]
|
|
788
|
|
|
868
|
|
|
789
|
x = finalAzimuth*numpy.pi/180
|
|
869
|
x = finalAzimuth*numpy.pi/180
|
|
790
|
y = finalZenith
|
|
870
|
y = finalZenith
|
|
791
|
|
|
871
|
|
|
792
|
if self.ax.firsttime:
|
|
872
|
if self.ax.firsttime:
|
|
793
|
self.ax.plot = self.ax.plot(x, y, 'bo', markersize=5)[0]
|
|
873
|
self.ax.plot = self.ax.plot(x, y, 'bo', markersize=5)[0]
|
|
794
|
self.ax.set_ylim(0,90)
|
|
874
|
self.ax.set_ylim(0,90)
|
|
795
|
self.ax.set_yticks(numpy.arange(0,90,20))
|
|
875
|
self.ax.set_yticks(numpy.arange(0,90,20))
|
|
796
|
self.ax.set_xlabel(self.xlabel)
|
|
876
|
self.ax.set_xlabel(self.xlabel)
|
|
797
|
self.ax.set_ylabel(self.ylabel)
|
|
877
|
self.ax.set_ylabel(self.ylabel)
|
|
798
|
self.ax.yaxis.labelpad = 40
|
|
878
|
self.ax.yaxis.labelpad = 40
|
|
799
|
self.ax.firsttime = False
|
|
879
|
self.ax.firsttime = False
|
|
800
|
else:
|
|
880
|
else:
|
|
801
|
self.ax.plot.set_data(x, y)
|
|
881
|
self.ax.plot.set_data(x, y)
|
|
802
|
|
|
882
|
|
|
803
|
|
|
883
|
|
|
804
|
dt1 = datetime.datetime.fromtimestamp(self.min_time).strftime('%y/%m/%d %H:%M:%S')
|
|
884
|
dt1 = datetime.datetime.fromtimestamp(self.min_time).strftime('%y/%m/%d %H:%M:%S')
|
|
805
|
dt2 = datetime.datetime.fromtimestamp(self.max_time).strftime('%y/%m/%d %H:%M:%S')
|
|
885
|
dt2 = datetime.datetime.fromtimestamp(self.max_time).strftime('%y/%m/%d %H:%M:%S')
|
|
806
|
title = 'Meteor Detection Sky Map\n %s - %s \n Number of events: %5.0f\n' % (dt1,
|
|
886
|
title = 'Meteor Detection Sky Map\n %s - %s \n Number of events: %5.0f\n' % (dt1,
|
|
807
|
dt2,
|
|
887
|
dt2,
|
|
808
|
len(x))
|
|
888
|
len(x))
|
|
809
|
self.ax.set_title(title, size=8)
|
|
889
|
self.ax.set_title(title, size=8)
|
|
810
|
|
|
890
|
|
|
811
|
self.saveTime = self.max_time
|
|
891
|
self.saveTime = self.max_time
|