Improved STA figure
This commit is contained in:
parent
55495d2d71
commit
b1fdc18111
@ -5,8 +5,8 @@
|
||||
\lstset{inputpath=../code}
|
||||
\graphicspath{{figures/}}
|
||||
|
||||
\setcounter{page}{}
|
||||
\setcounter{chapter}{-1}
|
||||
\setcounter{page}{81}
|
||||
\setcounter{chapter}{4}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -5,8 +5,8 @@
|
||||
\lstset{inputpath=../code}
|
||||
\graphicspath{{figures/}}
|
||||
|
||||
\setcounter{page}{}
|
||||
\setcounter{chapter}{-1}
|
||||
\setcounter{page}{101}
|
||||
\setcounter{chapter}{6}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -503,5 +503,3 @@ die Zellantwort mit dem STA verfaltet.
|
||||
genauso gro{\ss} ist wie der Originalstimulus aus der Datei
|
||||
\file{sta\_data.mat}.
|
||||
\end{exercise}
|
||||
|
||||
|
||||
|
@ -38,18 +38,22 @@ def reconstruct_stimulus(spike_times, sta, stimulus, t_max=30., dt=1e-4):
|
||||
|
||||
|
||||
def plot_results(sta_time, st_average, stim_time, s_est, stimulus, duration, dt):
|
||||
plt.xkcd()
|
||||
sta_ax = plt.subplot2grid((1, 3), (0, 0), rowspan=1, colspan=1)
|
||||
stim_ax = plt.subplot2grid((1, 3), (0, 1), rowspan=1, colspan=2)
|
||||
|
||||
fig = plt.gcf()
|
||||
fig.set_size_inches(15, 5)
|
||||
fig.set_size_inches(8, 3)
|
||||
fig.subplots_adjust(left=0.08, bottom=0.15, top=0.9, right=0.975)
|
||||
fig.set_facecolor("white")
|
||||
|
||||
sta_ax.plot(sta_time * 1000, st_average, color="dodgerblue", lw=2.)
|
||||
sta_ax.set_xlabel("time [ms]", fontsize=20)
|
||||
sta_ax.set_ylabel("stimulus", fontsize=20)
|
||||
sta_ax.set_xlim([-50, 50])
|
||||
sta_ax.plot(sta_time * 1000, st_average, color="#FF9900", lw=2.)
|
||||
sta_ax.set_xlabel("Time (ms)")
|
||||
sta_ax.set_ylabel("Stimulus")
|
||||
sta_ax.set_xlim(-40, 20)
|
||||
sta_ax.set_xticks(np.arange(-40, 21, 20))
|
||||
sta_ax.set_ylim(-0.1, 0.2)
|
||||
sta_ax.set_yticks(np.arange(-0.1, 0.21, 0.1))
|
||||
# sta_ax.xaxis.grid('off')
|
||||
sta_ax.spines["right"].set_visible(False)
|
||||
sta_ax.spines["top"].set_visible(False)
|
||||
@ -57,32 +61,42 @@ def plot_results(sta_time, st_average, stim_time, s_est, stimulus, duration, dt)
|
||||
sta_ax.xaxis.set_ticks_position('bottom')
|
||||
sta_ax.spines["bottom"].set_linewidth(2.0)
|
||||
sta_ax.spines["left"].set_linewidth(2.0)
|
||||
sta_ax.tick_params(direction="out", width=2.0, labelsize=18)
|
||||
|
||||
sta_ax.tick_params(direction="out", width=2.0)
|
||||
ylim = sta_ax.get_ylim()
|
||||
xlim = sta_ax.get_xlim()
|
||||
sta_ax.plot(list(xlim), [0., 0.], zorder=1, color='darkgray', ls='--', lw=0.75)
|
||||
sta_ax.plot([0., 0.], list(ylim), zorder=1, color='darkgray', ls='--', lw=0.75)
|
||||
sta_ax.plot(list(xlim), [0., 0.], zorder=1, color='darkgray', ls='--', lw=1)
|
||||
sta_ax.plot([0., 0.], list(ylim), zorder=1, color='darkgray', ls='--', lw=1)
|
||||
sta_ax.set_xlim(list(xlim))
|
||||
sta_ax.set_ylim(list(ylim))
|
||||
sta_ax.text(-0.25, 1.04, "A", transform=sta_ax.transAxes, size=24)
|
||||
sta_ax.annotate('Time of\nspike',
|
||||
xy=(0, 0.18), xycoords='data',
|
||||
xytext=(-35, 0.19), textcoords='data', ha='left',
|
||||
arrowprops=dict(arrowstyle="->", relpos=(1.0,0.5),
|
||||
connectionstyle="angle3,angleA=0,angleB=-70") )
|
||||
sta_ax.annotate('STA',
|
||||
xy=(-10, 0.05), xycoords='data',
|
||||
xytext=(-33, 0.09), textcoords='data', ha='left',
|
||||
arrowprops=dict(arrowstyle="->", relpos=(1.0,0.0),
|
||||
connectionstyle="angle3,angleA=60,angleB=-40") )
|
||||
#sta_ax.text(-0.25, 1.04, "A", transform=sta_ax.transAxes, size=24)
|
||||
|
||||
stim_ax.plot(stim_time * 1000, stimulus[:,1], label='stimulus', color='dodgerblue', lw=2.)
|
||||
stim_ax.plot(stim_time * 1000, s_est, label='reconstruction', color='red', lw=2)
|
||||
stim_ax.set_xlabel('time[ms]', fontsize=20)
|
||||
stim_ax.set_xlim([0.0, 250])
|
||||
stim_ax.plot(stim_time * 1000, stimulus[:,1], label='stimulus', color='#0000FF', lw=2.)
|
||||
stim_ax.plot(stim_time * 1000, s_est, label='reconstruction', color='#FF9900', lw=2)
|
||||
stim_ax.set_xlabel('Time (ms)')
|
||||
stim_ax.set_xlim(0.0, 200)
|
||||
stim_ax.set_ylim([-1., 1.])
|
||||
stim_ax.legend()
|
||||
stim_ax.plot([0.0, 250], [0., 0.], color="darkgray", lw=0.75, ls='--', zorder=1)
|
||||
stim_ax.legend(loc=(0.3, 0.85), frameon=False, fontsize=12)
|
||||
stim_ax.plot([0.0, 250], [0., 0.], color="darkgray", lw=1, ls='--', zorder=1)
|
||||
stim_ax.spines["right"].set_visible(False)
|
||||
stim_ax.spines["top"].set_visible(False)
|
||||
stim_ax.yaxis.set_ticks_position('left')
|
||||
stim_ax.xaxis.set_ticks_position('bottom')
|
||||
stim_ax.spines["bottom"].set_linewidth(2.0)
|
||||
stim_ax.spines["left"].set_linewidth(2.0)
|
||||
stim_ax.tick_params(direction="out", width=2.0, labelsize=18)
|
||||
stim_ax.text(-0.1, 1.04, "B", transform=stim_ax.transAxes, size=24)
|
||||
|
||||
stim_ax.tick_params(direction="out", width=2.0)
|
||||
#stim_ax.text(-0.1, 1.04, "B", transform=stim_ax.transAxes, size=24)
|
||||
|
||||
fig.tight_layout()
|
||||
fig.savefig("sta.pdf")
|
||||
plt.close()
|
||||
|
||||
|
@ -5,8 +5,8 @@
|
||||
\lstset{inputpath=../code}
|
||||
\graphicspath{{figures/}}
|
||||
|
||||
\setcounter{page}{}
|
||||
\setcounter{chapter}{-1}
|
||||
\setcounter{page}{89}
|
||||
\setcounter{chapter}{5}
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
Reference in New Issue
Block a user