def saliency(): """ Plots avg LPs simulation """ fig = plt.figure(figsize = (1.5,4)) dm = DataMatrix(np.load(".cache/dm_sim_select_driftcorr.npy")) # PLOT SIMULATED SACCADES: for stimType in dm.unique("stim_type"): if stimType == "object": col = green[1] elif stimType == "non-object": col = red[1] lSacc = [] for sacc in [1,2]: stimDm = dm.select("stim_type == '%s'" % stimType) m = stimDm["xNorm%s" % sacc].mean() lSacc.append(m) plt.plot([1,2], lSacc, color = col, marker = 'o', markerfacecolor = 'white', markeredgecolor = col, markeredgewidth = 1) # HACK: # PLOT REAL LPs: for stimType in dm.unique("stim_type"): if stimType == "object": col = blue[1] elif stimType == "non-object": col = orange[1] lSacc = [] for sacc in [1,2]: stimDm = dm.select("stim_type == '%s'" % stimType) m = stimDm["xNorm%s" % sacc].mean() lSacc.append(m) plt.plot([1,2], lSacc, color = col, marker = 'o', markerfacecolor = 'white', markeredgecolor = col, markeredgewidth = 1, label = stimType) plt.axhline(0, linestyle = "--", color = gray[3]) plt.ylim(-.3, .07) plt.xlim(0.8, 2.2) plt.legend(frameon = False) plt.savefig("./plots/simulation.png") plt.savefig("./plots/simulation.svg")
from exparser.DataMatrix import DataMatrix import numpy as np f = ".cache/004C_lat_driftcorr_False.npy" dm = DataMatrix(np.load(f)) for pp in dm.unique("file"): ppDm = dm.select("file == '%s'" % pp, verbose = False) _ppDm = ppDm.select("xNorm1 == -1000", verbose = False) print pp, float(len(_ppDm))/float(len(ppDm))
mDev = gapDm['xNorm%s' % sacc].mean() d[stimType, sacc]= mDev return d if __name__ == "__main__": dm = dmSim(cacheId = "dm_sim_raw") dm = addCommonFactors.addCommonFactors(dm, \ cacheId = "dm_sim_common_factors") dm = addCoord.addCoord(dm, cacheId = "dm_sim_coord") #dm = addLat.addLat(dm, cacheId = "dm_sim_lat_driftcorr") dm = selectDm.selectDm(dm, cacheId = "dm_sim_select_driftcorr") f = ".cache/dm_sim_select_driftcorr.npy" dm = DataMatrix(np.load(f)) fig = plt.figure() nPlot = 0 for stimType in dm.unique("stim_type"): stimDm = dm.select("stim_type == '%s'" % stimType) for sacc in (1,2): nPlot +=1 plt.subplot(2,2,nPlot) dv = "xNorm%s" % sacc plt.title("%s sacc %s" % (stimType, sacc)) plt.hist(stimDm[dv], bins = 5) plt.savefig("Distribution_simulated_saccades.png")