From 876ba42d7fa4a42b0e4cf77e6ab011851e63345f Mon Sep 17 00:00:00 2001 From: tillraab Date: Fri, 8 Jul 2022 10:59:53 +0200 Subject: [PATCH] new electrode check slow but works --- electrode_check.py | 1 - new_electrode_check.py | 17 ++++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/electrode_check.py b/electrode_check.py index 0341bd2..038a656 100644 --- a/electrode_check.py +++ b/electrode_check.py @@ -226,7 +226,6 @@ def main(): channel_data = list(map(lambda x : data[x::channels][:250], channel_array)) channel_std = list(map(lambda x : np.std(data[x::channels][:250]), channel_array)) power_channel = int(np.argmax(channel_std)) - if init_fig == True: yspan = (np.min(channel_data[power_channel]) / gain, np.max(channel_data[power_channel]) / gain) ylim = (yspan[0] - np.abs(np.diff(yspan)) * 0.2, yspan[1] + np.abs(np.diff(yspan))* 0.2) diff --git a/new_electrode_check.py b/new_electrode_check.py index 6536ea5..e25d53a 100644 --- a/new_electrode_check.py +++ b/new_electrode_check.py @@ -22,21 +22,19 @@ class Live_plot(): plt.show(block=False) def create_axis(self): - gs = gridspec.GridSpec(4, 4, left=0.1, bottom=0.05, right=1, top=0, hspace=0, wspace=0) + gs = gridspec.GridSpec(4, 4, left=0.1, bottom=0.05, right=1, top=1, hspace=0, wspace=0) for x in range(4): for y in range(4): # for x in range(self.n_cols): - ax = plt.subplot(gs[y, x]) + self.axs.append(self.fig.add_subplot(gs[y, x])) if not y == 3: - ax.tick_params(axis='x', which='both', bottom=False, top=False, labelbottom=False) + self.axs[-1].tick_params(axis='x', which='both', bottom=False, top=False, labelbottom=False) if not x == 0: - ax.tick_params(axis='y', which='both', left=False, right=False, labelleft=False) + self.axs[-1].tick_params(axis='y', which='both', left=False, right=False, labelleft=False) - ax.set_ylim(-self.max_v, self.max_v) - - self.axs.append(ax) + self.axs[-1].set_ylim(-self.max_v, self.max_v) def DAQ_setup(self): status = ScanStatus.IDLE @@ -152,13 +150,12 @@ class Live_plot(): status, transfer_status = self.ai_device.get_scan_status() index = transfer_status.current_index - if (last_idx > index) and (index != -1): channel_array = np.arange(self.channels) channel_data = list(map(lambda x: self.data[x::self.channels][:250], channel_array)) channel_std = list(map(lambda x: np.std(self.data[x::self.channels][:250]), channel_array)) power_channel = int(np.argmax(channel_std)) - + print('yay') if init_fig == True: yspan = (np.min(channel_data[power_channel]) / self.gain, np.max(channel_data[power_channel]) / self.gain) ylim = (yspan[0] - np.abs(np.diff(yspan)) * 0.2, yspan[1] + np.abs(np.diff(yspan)) * 0.2) @@ -210,5 +207,7 @@ def main(): Plot.create_axis() + Plot.run() + if __name__ == '__main__': main() \ No newline at end of file