torus_ephys/stimuli_figures.py
2019-08-23 18:59:50 +02:00

33 lines
1.2 KiB
Python

import glob
import matplotlib.pyplot as plt
# figures for phase_ and amplitude_sweep should be made with artificial data
filenames = glob.glob('*.dat')
for i in range(len(filenames)):
with open(filenames[i], 'r') as f:
lines = f.readlines()
time = []
amplitude = []
for l in lines:
if len(l.strip()) > 0 and '#' not in l:
l = l.strip().split()
time.append(float(l[0]))
amplitude.append(float(l[1]))
plt.figure(figsize=(20/2.54, 12/2.54), facecolor='white', edgecolor='white')
ax = plt.subplot(111)
ax.spines["top"].set_visible(False)
# ax.spines["bottom"].set_visible(False)
ax.spines["right"].set_visible(False)
# ax.spines["left"].set_visible(False)
ax.get_xaxis().tick_bottom()
ax.get_yaxis().tick_left()
if filenames[i] == 'zap.dat':
ax.set_xlim([0, 1])
else:
ax.set_xlim([0, .2])
ax.set_title(filenames[i])
ax.set_xlabel('time')
ax.set_ylabel('amplitude')
ax.plot(time, amplitude)
plt.savefig(filenames[i]+'.pdf')
plt.show()