def __poolfeature__(feature,ylabel,title,fname,cr,info,path): if not os.path.exists(path): os.makedirs(path) cut = getballistictrials(cr) m = cut.groupby(level=['subject','session'])[feature].mean() e = cut.groupby(level=['subject','session'])[feature].std() d = activitytables.groupbylesionvolumes(pd.concat([m,e],axis=1),info) fig = plt.figure() ax = plt.gca() activityplots.sessionmetric(d,ax=ax,colorcycle=colorcycle) plt.ylabel(ylabel) plt.title(title) fpath = os.path.join(path,fname) plt.savefig(fpath) plt.close(fig)
def __poolfeature__(feature, ylabel, title, fname, cr, info, path): if not os.path.exists(path): os.makedirs(path) cut = getballistictrials(cr) m = cut.groupby(level=['subject', 'session'])[feature].mean() e = cut.groupby(level=['subject', 'session'])[feature].std() d = activitytables.groupbylesionvolumes(pd.concat([m, e], axis=1), info) fig = plt.figure() ax = plt.gca() activityplots.sessionmetric(d, ax=ax, colorcycle=colorcycle) plt.ylabel(ylabel) plt.title(title) fpath = os.path.join(path, fname) plt.savefig(fpath) plt.close(fig)
def __poolfeatureconditions__(feature,conditions,ylabel,title,fname,cr,info,path): if not os.path.exists(path): os.makedirs(path) labels = range(len(conditions)) cr = resetsessionindex(cr,labels,labels[-1]) info = resetsessionindex(info,labels,labels[-1]) cut = getballistictrials(cr) m = cut.groupby(level=['subject','session'])[feature].mean() e = cut.groupby(level=['subject','session'])[feature].std() d = activitytables.groupbylesionvolumes(pd.concat([m,e],axis=1),info) fig = plt.figure() ax = plt.gca() activityplots.sessionmetric(d,ax=ax,colorcycle=colorcycle,connect=False) plt.xlabel('') plt.xticks(labels,conditions) plt.ylabel(ylabel) plt.title(title) fpath = os.path.join(path,fname) plt.savefig(fpath) plt.close(fig)
def __poolfeatureconditions__(feature, conditions, ylabel, title, fname, cr, info, path): if not os.path.exists(path): os.makedirs(path) labels = range(len(conditions)) cr = resetsessionindex(cr, labels, labels[-1]) info = resetsessionindex(info, labels, labels[-1]) cut = getballistictrials(cr) m = cut.groupby(level=['subject', 'session'])[feature].mean() e = cut.groupby(level=['subject', 'session'])[feature].std() d = activitytables.groupbylesionvolumes(pd.concat([m, e], axis=1), info) fig = plt.figure() ax = plt.gca() activityplots.sessionmetric(d, ax=ax, colorcycle=colorcycle, connect=False) plt.xlabel('') plt.xticks(labels, conditions) plt.ylabel(ylabel) plt.title(title) fpath = os.path.join(path, fname) plt.savefig(fpath) plt.close(fig)
def figure1b(rr,info,path): if not os.path.exists(path): os.makedirs(path) rr = rr.query('session > 0') info = info.query('session > 0') rrdiff = rr.groupby(level=[0,1]).diff() nulldiff = rrdiff.time.isnull() firstrr = rr.time[nulldiff] - info.starttime rrdiff.time[nulldiff] = firstrr rrsec = rrdiff.time.map(lambda x:x / np.timedelta64(1, 's')) rrdata = rrsec.groupby(level=[0,1]).mean() rryerr = rrsec.groupby(level=[0,1]).std() rrgdata = activitytables.groupbylesionvolumes(pd.concat([rrdata,rryerr],axis=1),info) fig = plt.figure() activityplots.sessionmetric(rrgdata) plt.ylabel('time between rewards (s)') plt.title('performance curve') fname = 'performance_curve.png' fpath = os.path.join(path,fname) plt.savefig(fpath) plt.close(fig)
def figure1b(rr, info, path): if not os.path.exists(path): os.makedirs(path) rr = rr.query('session > 0') info = info.query('session > 0') rrdiff = rr.groupby(level=[0, 1]).diff() nulldiff = rrdiff.time.isnull() firstrr = rr.time[nulldiff] - info.starttime rrdiff.time[nulldiff] = firstrr rrsec = rrdiff.time.map(lambda x: x / np.timedelta64(1, 's')) rrdata = rrsec.groupby(level=[0, 1]).mean() rryerr = rrsec.groupby(level=[0, 1]).std() rrgdata = activitytables.groupbylesionvolumes( pd.concat([rrdata, rryerr], axis=1), info) fig = plt.figure() activityplots.sessionmetric(rrgdata) plt.ylabel('time between rewards (s)') plt.title('performance curve') fname = 'performance_curve.png' fpath = os.path.join(path, fname) plt.savefig(fpath) plt.close(fig)