hcUtil.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:synchrony 作者: cknd 项目源码 文件源码
def plot_all_times_to_correct_decision(self,thr=0.5,stay_above=True,unit="spikes",spikemeasure="growing_spikecount", do_title=True):
        times = np.array([self.time_to_correct_decision(e,thr,stay_above,unit,spikemeasure) for e in self.experiments]).flatten()
        # times[30:50] = np.Inf
        maximum = int(np.ceil(max(times[times!=np.Inf])))
        plt_inf = maximum+2 # for unsuccessful trials (time=Inf), set time to some value distinct from any actual decision time.
        times[times==np.Inf] = plt_inf

        fig = plt.figure(figsize=(hcPlotting.fig_width,hcPlotting.fig_height/3))

        bins = np.hstack([np.arange(0.25,maximum+1,0.5),[plt_inf,plt_inf+1]])
        n,_,_ = plt.hist(times,bins,color='k',edgecolor='w')

        ax = plt.gca()
        ax.set_xlim((0,plt_inf+1))
        ax.set_ylim(ax.get_ylim()[0],ax.get_ylim()[1]+1)
        plt.plot((plt_inf,plt_inf),(0,ax.get_ylim()[1]),'r')

        ax.set_xticks(range(maximum+1)+[plt_inf+0.5])
        ax.set_xticklabels([str(i) for i in range(maximum+1)]+[r'$\infty$'])

        ax.set_ylabel("nr. of trials")
        ax.set_xlabel("spikes observed before classification")
        if do_title:
            plt.title("thr = "+str(thr)+", stay_above = "+str(stay_above)+", classes: " +" vs. ".join(self.classes))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号