figure out graphs

This commit is contained in:
Lisa 2019-10-31 15:22:12 +01:00
parent a483f40056
commit f7f0b10828

View File

@ -20,8 +20,9 @@ def analyze_sams(filename):
f = nix.File.open(filename, nix.FileMode.ReadOnly)
b = f.blocks[0]
b.metadata.pprint(max_depth=-1) # max_depth=-1: alles rausschreiben
print(b.groups)
for g in b.groups:
if 'sam' in g.name.lower(): # go through loop, until 'sam' is found
if 'sam' in g.name.lower(): # go through loop, until 'sam' is found
break
rtag_data = g.tags[0] # rtag_data = tags within this group
@ -42,22 +43,23 @@ def analyze_sams(filename):
spike_data.append(stim_tag.retrieve_data(idx, 'Spikes-1')[:])
dims = voltage_trace.dimensions[0].axis(len(voltage_trace))
os.chdir('/home/lisa/PycharmProjects/torus_ephys')
print(os.getcwd())
plt.plot(dims[:-1], voltage_trace[:-1])
for i in range(len(stim_pos)):
stim_y = [np.max(voltage_trace)+10, np.max(voltage_trace)+10]
plt.plot([stim_pos[i], stim_pos[i] + stim_extent[i]], stim_y, 'k')
os.chdir('/home/lisa/Dropbox/Masterarbeit/')
for j in range(len(spike_data)):
for k in range(len(spike_data[j])):
plt.plot(spike_data[j][k], np.max(voltage_trace)+2.5, 'o', color='k')
plt.xlim([stim_pos[0]-.5, stim_pos[0] + stim_extent[-1] + .5])
plt.xlabel('time [s]')
plt.ylabel('voltage [mV]')
plt.show()
print('saving...')
plt.savefig(filename + stim_type + '.png')
plt.close()
for s_i in range(len(b.groups)):
plt.savefig(filename + stim_type + str(s_i) + '.png')
# f.close()
# embed()
# exit()