stimuli figures
This commit is contained in:
parent
b14fc1a294
commit
18c6550f2a
BIN
contrast_sweep.dat.pdf
Normal file
BIN
contrast_sweep.dat.pdf
Normal file
Binary file not shown.
@ -2,6 +2,8 @@ import os
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import nixio as nix
|
import nixio as nix
|
||||||
|
import glob
|
||||||
|
import os
|
||||||
from IPython import embed
|
from IPython import embed
|
||||||
|
|
||||||
def analyze_sams(filename):
|
def analyze_sams(filename):
|
||||||
@ -19,7 +21,8 @@ def analyze_sams(filename):
|
|||||||
stim_tag = g.multi_tags[0]
|
stim_tag = g.multi_tags[0]
|
||||||
stim_pos = stim_tag.positions[:] # beginnings of stimulations
|
stim_pos = stim_tag.positions[:] # beginnings of stimulations
|
||||||
stim_extent = stim_tag.extents[:] # duration of stimulations
|
stim_extent = stim_tag.extents[:] # duration of stimulations
|
||||||
|
# embed()
|
||||||
|
# exit()
|
||||||
for r in rtag_data.references:
|
for r in rtag_data.references:
|
||||||
print(r.name, r.type)
|
print(r.name, r.type)
|
||||||
# embed()
|
# embed()
|
||||||
@ -43,7 +46,8 @@ def analyze_sams(filename):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
data_dir = '/home/lisa/data'
|
data_dir = '/home/lisa/data'
|
||||||
data_set = '2019-06-24-aa-invivo-1'
|
os.chdir(data_dir)
|
||||||
|
data_set = glob.glob('2019-*')
|
||||||
stim_pos, stim_extent, spike_data, voltage_trace, dims = analyze_sams(os.path.join(data_dir, data_set,
|
stim_pos, stim_extent, spike_data, voltage_trace, dims = analyze_sams(os.path.join(data_dir, data_set,
|
||||||
data_set + '.nix'))
|
data_set + '.nix'))
|
||||||
print(len(spike_data))
|
print(len(spike_data))
|
||||||
@ -59,5 +63,5 @@ if __name__ == '__main__':
|
|||||||
for k in range(len(spike_data[j])):
|
for k in range(len(spike_data[j])):
|
||||||
print('current spike time is: ', spike_data[j][k])
|
print('current spike time is: ', spike_data[j][k])
|
||||||
plt.plot(spike_data[j][k], -40, 'o', color='k')
|
plt.plot(spike_data[j][k], -40, 'o', color='k')
|
||||||
plt.ylim([-100, -30])
|
# plt.ylim([-45, 0])
|
||||||
plt.show()
|
plt.show()
|
BIN
phase_sweep.dat.pdf
Normal file
BIN
phase_sweep.dat.pdf
Normal file
Binary file not shown.
33
stimuli_figures.py
Normal file
33
stimuli_figures.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import glob
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
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()
|
BIN
zap.dat.pdf
Normal file
BIN
zap.dat.pdf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user