bf
This commit is contained in:
parent
9c57af3fa6
commit
3f45d7dc61
@ -28,7 +28,6 @@ class plot():
|
||||
self.channel_handle = []
|
||||
|
||||
self.fig = plt.figure(figsize=(20 / 2.54, 12 / 2.54), facecolor='white')
|
||||
self.fig.canvas.mpl_connect('key_press_event', self.keypress)
|
||||
self.axs = []
|
||||
plt.show(block=False)
|
||||
|
||||
@ -49,16 +48,6 @@ class plot():
|
||||
self.axs.append(ax)
|
||||
gs.update(left=0.05, bottom=0.05, top=1, right=1, hspace=0, wspace=0)
|
||||
|
||||
def keypress(self, event):
|
||||
if event.key == 'v':
|
||||
yrange = np.abs(np.diff(self.axs[0].get_ylim()))
|
||||
for ax in self.axs:
|
||||
ax.set_ylim(-(yrange / 2) * (2/3), (yrange / 2) * (2/3) )
|
||||
if event.key == 'V':
|
||||
yrange = np.abs(np.diff(self.axs[0].get_ylim()))
|
||||
for ax in self.axs:
|
||||
ax.set_ylim(-(yrange / 2) * (3/2), (yrange / 2) * (3/2) )
|
||||
print('v pressed')
|
||||
|
||||
|
||||
def GPIO_setup(LED1_pin, LED2_pin, Button1_pin, Button2_pin):
|
||||
@ -371,15 +360,23 @@ def main():
|
||||
power_channel = int(np.argmax(channel_std))
|
||||
|
||||
if init_fig == True:
|
||||
yspan = (np.min(channel_std[power_channel]), np.max(channel_std[power_channel]))
|
||||
ylim = (yspan[0] - np.abs(np.diff(yspan)) * 0.2, yspan[1] + np.abs(np.diff(yspan)) * 0.2)
|
||||
|
||||
for ch in channel_array:
|
||||
h, = Plot.axs[ch].plot(np.arange(250)[:len(channel_data[ch])] / rate, channel_data[ch], color='k')
|
||||
Plot.axs[ch].set_ylim(ylim)
|
||||
Plot.channel_handle.append(h)
|
||||
|
||||
Plot.fig.canvas.draw()
|
||||
|
||||
init_fig = False
|
||||
else:
|
||||
yspan = (np.min(channel_std[power_channel]), np.max(channel_std[power_channel]))
|
||||
ylim = (yspan[0] - np.abs(np.diff(yspan)) * 0.2, yspan[1] + np.abs(np.diff(yspan)) * 0.2)
|
||||
for ch in channel_array:
|
||||
Plot.channel_handle[ch].set_data(np.arange(250)[:len(channel_data[ch])] / rate, channel_data[ch])
|
||||
|
||||
Plot.axs[ch].set_ylim(ylim)
|
||||
Plot.fig.canvas.draw()
|
||||
|
||||
if index == -1:
|
||||
|
Loading…
Reference in New Issue
Block a user