This commit is contained in:
tillraab 2019-09-11 12:01:02 +02:00
parent a9feeda2b2
commit 7d8694b576

View File

@ -60,6 +60,8 @@ def read_cfg(cfg_file, now, init_read=False):
n_rows = int(line.split(':')[1].strip()) n_rows = int(line.split(':')[1].strip())
elif "AISampleRate" in line: elif "AISampleRate" in line:
samplerate = int(float(line.split(':')[-1].strip().replace('kHz', '')) * 1000) samplerate = int(float(line.split(':')[-1].strip().replace('kHz', '')) * 1000)
elif "AIMaxVolt" in line:
max_v = float(line.split(':')[1].strip().replace('mV', ''))
channels = n_rows * n_cols channels = n_rows * n_cols
### alter information and re-write ### ### alter information and re-write ###
@ -75,7 +77,7 @@ def read_cfg(cfg_file, now, init_read=False):
cfg_f.write(line) cfg_f.write(line)
cfg_f.close() cfg_f.close()
return channels, samplerate, n_cols, n_rows return channels, samplerate, n_cols, n_rows, max_v
# for line in cfg: # for line in cfg:
# if 'Columns1' in line: # if 'Columns1' in line:
@ -171,7 +173,7 @@ def main():
# cfgfile = os.path.join(path, 'fishgrid.cfg') # cfgfile = os.path.join(path, 'fishgrid.cfg')
# read and edit config file # read and edit config file
channels, rate, n_cols, n_rows = read_cfg(init_cfgfile, now) channels, rate, n_cols, n_rows, max_v = read_cfg(init_cfgfile, now)
# file = os.path.join(path, 'traces-grid1.raw') # file = os.path.join(path, 'traces-grid1.raw')
# f = open(file, 'wb') # f = open(file, 'wb')
@ -290,7 +292,10 @@ def main():
if not x == 0: if not x == 0:
ax.tick_params(axis='y', which='both', left=False, right=False, labelleft=False) ax.tick_params(axis='y', which='both', left=False, right=False, labelleft=False)
ax.set_ylim(-max_v, max_v)
axs.append(ax) axs.append(ax)
gs.update(left=0.05, bottom=0.05, top=1, right=1, hspace=0, wspace=0) gs.update(left=0.05, bottom=0.05, top=1, right=1, hspace=0, wspace=0)
# ax = np.hstack(ax) # ax = np.hstack(ax)
@ -344,7 +349,7 @@ def main():
if init_fig == True: if init_fig == True:
for ch in channel_array: for ch in channel_array:
h, = axs[ch].plot(np.arange(250)[:len(channel_data[ch])] / rate, channel_data[ch], color='k') h, = axs[ch].plot(np.arange(250)[:len(channel_data[ch])] / rate, channel_data[ch], color='k')
axs[ch].set_ylim(min - channel_std[power_channel], max + channel_std[power_channel]) # axs[ch].set_ylim(min - channel_std[power_channel], max + channel_std[power_channel])
# axs[ch].set_ylim(min, max) # axs[ch].set_ylim(min, max)
channel_handle.append(h) channel_handle.append(h)
plt.show(block=False) plt.show(block=False)