forked from M-Labs/thermostat
add more graphs in 2x2 grid
This commit is contained in:
parent
81cc23a452
commit
da8948a166
|
@ -19,7 +19,6 @@ channel_data = [{
|
||||||
'tec_i': np.zeros(rec_len),
|
'tec_i': np.zeros(rec_len),
|
||||||
'tec_u_meas': np.zeros(rec_len),
|
'tec_u_meas': np.zeros(rec_len),
|
||||||
'interval': np.zeros(rec_len),
|
'interval': np.zeros(rec_len),
|
||||||
'temp_set': np.zeros(rec_len),
|
|
||||||
} for _ in range(2)]
|
} for _ in range(2)]
|
||||||
|
|
||||||
tec = Client()
|
tec = Client()
|
||||||
|
@ -31,22 +30,38 @@ mw.resize(800,800)
|
||||||
cw = QtGui.QWidget()
|
cw = QtGui.QWidget()
|
||||||
mw.setCentralWidget(cw)
|
mw.setCentralWidget(cw)
|
||||||
l = QtGui.QVBoxLayout()
|
l = QtGui.QVBoxLayout()
|
||||||
|
layout = pg.LayoutWidget()
|
||||||
|
l.addWidget(layout)
|
||||||
cw.setLayout(l)
|
cw.setLayout(l)
|
||||||
|
|
||||||
pg.setConfigOptions(antialias=True)
|
pg.setConfigOptions(antialias=True)
|
||||||
|
|
||||||
pw0= pg.PlotWidget(name='Channel 0')
|
temp0plot= pg.PlotWidget(title='Channel 0 Temperature')
|
||||||
l.addWidget(pw0)
|
layout.addWidget(temp0plot, 1, 1)
|
||||||
pw1 = pg.PlotWidget(name='Channel 1')
|
temp1plot = pg.PlotWidget(title='Channel 1 Temperature')
|
||||||
l.addWidget(pw1)
|
layout.addWidget(temp1plot, 2, 1)
|
||||||
|
current0plot = pg.PlotWidget(title='Channel 0 Current')
|
||||||
|
layout.addWidget(current0plot, 1, 2)
|
||||||
|
current1plot = pg.PlotWidget(title='Channel 1 Current')
|
||||||
|
layout.addWidget(current1plot, 2, 2)
|
||||||
|
|
||||||
|
temp0curve = pg.PlotCurveItem(pen=({'color': 'r', 'width': 1}))
|
||||||
|
temp1curve = pg.PlotCurveItem(pen=({'color': 'r', 'width': 1}))
|
||||||
|
tecI0curve = pg.PlotCurveItem(pen=({'color': 'r', 'width': 1}))
|
||||||
|
tecI1curve = pg.PlotCurveItem(pen=({'color': 'r', 'width': 1}))
|
||||||
|
Iset0curve = pg.PlotCurveItem(pen=({'color': 'g', 'width': 1}))
|
||||||
|
Iset1curve = pg.PlotCurveItem(pen=({'color': 'g', 'width': 1}))
|
||||||
|
temp0plot.addItem(temp0curve)
|
||||||
|
temp1plot.addItem(temp1curve)
|
||||||
|
current0plot.addItem(tecI0curve)
|
||||||
|
current0plot.addItem(Iset0curve)
|
||||||
|
current1plot.addItem(tecI1curve)
|
||||||
|
current1plot.addItem(Iset1curve)
|
||||||
|
|
||||||
curve0 = pw0.plot()
|
|
||||||
curve1 = pw1.plot()
|
|
||||||
|
|
||||||
cnt = 0
|
cnt = 0
|
||||||
time_stamp = np.zeros(rec_len)
|
time_stamp = np.zeros(rec_len)
|
||||||
def update(n):
|
def update(n):
|
||||||
global cnt
|
|
||||||
for data in tec.report_mode():
|
for data in tec.report_mode():
|
||||||
ch = data[n]
|
ch = data[n]
|
||||||
for tag, seq in channel_data[n].items():
|
for tag, seq in channel_data[n].items():
|
||||||
|
@ -69,10 +84,16 @@ def updateData():
|
||||||
cnt += 1
|
cnt += 1
|
||||||
time_stamp[:-1] = time_stamp[1:]
|
time_stamp[:-1] = time_stamp[1:]
|
||||||
time_stamp[-1] = cnt * refresh_period / 1000
|
time_stamp[-1] = cnt * refresh_period / 1000
|
||||||
pw0.setRange(xRange=[cnt * refresh_period / 1000 - 20.0, cnt * refresh_period / 1000])
|
temp0plot.setRange(xRange=[(cnt - rec_len) * refresh_period / 1000, cnt * refresh_period / 1000])
|
||||||
pw1.setRange(xRange=[cnt * refresh_period / 1000 - 20.0, cnt * refresh_period / 1000])
|
temp1plot.setRange(xRange=[(cnt - rec_len) * refresh_period / 1000, cnt * refresh_period / 1000])
|
||||||
curve0.setData(x = time_stamp, y = channel_data[0]['temperature'])
|
current0plot.setRange(xRange=[(cnt - rec_len) * refresh_period / 1000, cnt * refresh_period / 1000])
|
||||||
curve1.setData(x = time_stamp, y = channel_data[1]['temperature'])
|
current1plot.setRange(xRange=[(cnt - rec_len) * refresh_period / 1000, cnt * refresh_period / 1000])
|
||||||
|
temp0curve.setData(x = time_stamp, y = channel_data[0]['temperature'])
|
||||||
|
temp1curve.setData(x = time_stamp, y = channel_data[1]['temperature'])
|
||||||
|
tecI0curve.setData(x = time_stamp, y = channel_data[0]['tec_i'])
|
||||||
|
tecI1curve.setData(x = time_stamp, y = channel_data[1]['tec_i'])
|
||||||
|
Iset0curve.setData(x = time_stamp, y = channel_data[0]['i_set'])
|
||||||
|
Iset1curve.setData(x = time_stamp, y = channel_data[1]['i_set'])
|
||||||
|
|
||||||
|
|
||||||
## Start a timer to rapidly update the plot in pw
|
## Start a timer to rapidly update the plot in pw
|
||||||
|
|
Loading…
Reference in New Issue