figure out graphs

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

View File

@ -20,6 +20,7 @@ def analyze_sams(filename):
f = nix.File.open(filename, nix.FileMode.ReadOnly) f = nix.File.open(filename, nix.FileMode.ReadOnly)
b = f.blocks[0] b = f.blocks[0]
b.metadata.pprint(max_depth=-1) # max_depth=-1: alles rausschreiben b.metadata.pprint(max_depth=-1) # max_depth=-1: alles rausschreiben
print(b.groups)
for g in 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 break
@ -42,22 +43,23 @@ def analyze_sams(filename):
spike_data.append(stim_tag.retrieve_data(idx, 'Spikes-1')[:]) spike_data.append(stim_tag.retrieve_data(idx, 'Spikes-1')[:])
dims = voltage_trace.dimensions[0].axis(len(voltage_trace)) 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]) plt.plot(dims[:-1], voltage_trace[:-1])
for i in range(len(stim_pos)): for i in range(len(stim_pos)):
stim_y = [np.max(voltage_trace)+10, np.max(voltage_trace)+10] 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') 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 j in range(len(spike_data)):
for k in range(len(spike_data[j])): for k in range(len(spike_data[j])):
plt.plot(spike_data[j][k], np.max(voltage_trace)+2.5, 'o', color='k') 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.xlim([stim_pos[0]-.5, stim_pos[0] + stim_extent[-1] + .5])
plt.xlabel('time [s]') plt.xlabel('time [s]')
plt.ylabel('voltage [mV]') plt.ylabel('voltage [mV]')
plt.show()
print('saving...') print('saving...')
plt.savefig(filename + stim_type + '.png') for s_i in range(len(b.groups)):
plt.close() plt.savefig(filename + stim_type + str(s_i) + '.png')
# f.close() # f.close()
# embed() # embed()
# exit() # exit()