def plotRegr(exp): """ Plots data for one experiment. Arguments: exp --- {"004A", "004B"} """ src = 'selected_dm_%s_WITH_drift_corr_onlyControl_False.csv' % exp dm = CsvReader(src).dataMatrix() R = RBridge() fig = plt.figure(figsize = (8,3)) plt.subplots_adjust(left=.2, bottom=.15) # Plot hline: plt.axhline(0, color = "black", linestyle = "--") legend = True for sacc in [1, 2]: colList = [green[1], orange[1], blue[1]] for contrast in dm.unique("contrast_side"): print "contrast side = ", contrast print "sacc = ", sacc _dm = dm.select("contrast_side == '%s'" % contrast) lmeRegr(R, _dm, sacc=sacc, corr=False, \ color = colList.pop(),stats=False, legend = contrast.strip("_")) if legend: plt.legend(frameon = False, loc='best') legend = False plt.savefig("Timecourse_contrast_per_cond%s.png" % exp)
def refixLaunch(exp,corr=False, trim=True, bins=8): """ """ src = 'selected_dm_%s_WITH_drift_corr_onlyControl_True.csv' % exp dm = CsvReader(src).dataMatrix() lat1 = "saccLat1" lat2 = "saccLat2" if corr: fix1 = "endX1CorrNormToHandle" fix2 = "endX2CorrNormToHandle" else: fix1 = "endX1NormToHandle" fix2 = "endX2NormToHandle" for var in [lat1, lat2, fix1, fix2]: dm = dm.select("%s != ''" % var) # Trim the data if trim: dm = dm.selectByStdDev(["file"],lat2, verbose=False) dm = dm.removeField("__dummyCond__") dm = dm.removeField("__stdOutlier__") dm = dm.selectByStdDev(["file"], fix2, verbose=False) dm = dm.addField('saccLat2_perc', dtype=float) dm = dm.calcPerc(lat2, 'saccLat2_perc', nBin=bins) cmLat1 = dm.collapse(['saccLat2_perc'], lat1) cmX = cmLat2 = dm.collapse(['saccLat2_perc'], lat2) cmFix1 = dm.collapse(['saccLat2_perc'], fix1) cmFix2 = dm.collapse(['saccLat2_perc'], fix2) fig = plt.figure(figsize = (3,6)) plt.subplots_adjust(left=.2, bottom=.15) colList = [orange[1], blue[1]] nRows = 3 nCols = 1 nPlot = 0 lTitles = ["Landing pos 2", "Landing pos 1"] lTitles.reverse() for cmY in [cmFix2, cmFix1]:#, cmLat1]: #nPlot +=1 #plt.subplot(nRows, nCols, nPlot) color = colList.pop() plt.plot(cmX['mean'], cmY['mean'], marker = 'o', color=color, \ markerfacecolor='white', markeredgecolor=color, \ markeredgewidth=1) plt.xlabel("Sacc lat 2") plt.legend(lTitles, frameon=False, loc='best') plt.axhline(0, linestyle = "--", color = gray[3]) plt.savefig("Launch_site_refixations_%s_corr_%s.png" % (exp, corr))
def crossExpDescriptives(dm): for exp in ['exp1', 'exp2', 'exp3']: dm = CsvReader('data/%s.data.csv' % exp).dataMatrix() if exp == 'exp1': dm = dm.select('trialType == "control"') elif exp == 'exp3': print dm.collapse(['cond'], 'rt') stats.R.load(dm) lm = stats.R.lmer('rt ~ cond + (1+cond|subject_nr)') print lm rt = dm['rt'] print 'Exp = %s' % exp print 'N = %d' % len(rt) print 'RT = %.2f ms (%.2f)' % (rt.mean(), rt.std()) a = np.loadtxt('data/%s.fixdur.csv' % exp) print 'Fixdur = %.2f ms (%.2f)' % (a.mean(), a.std())
def addCog(dm): """ Use NEW CoG calculation. """ # Get cog dictionary: f = "compare cogs/cog_per_stim_004C.csv" cogDm = CsvReader(f).dataMatrix() dm = dm.addField("xCog", default = -1000) for i in dm.range(): stimName = dm["object"][i] flip = dm["handle_side"][i] symm = dm["symm"][i] if symm == "symm": continue xCogUnrot = cogDm.select("name == '%s'" % stimName, verbose = False)["xCog"][0] if flip == "left": xCog = xCogUnrot * -1 elif flip == "right": xCog = xCogUnrot dm["xCog"][i] = xCog #print "object = ", stimName #print "symm = ", symm #print "flip = ", flip #print "cog = ", xCog return dm
# if int(xNorm) == 0: # if fixNr == 2: # if abs(dy) > constants.minSaccSize: # print fix['t'] # print dy # raw_input() if fixNr > 3: break # Save the dm containing the simulation data: dm.save('dm_004C_simulation.csv') if printSum: print '\nSummary:\n' for gap in (None, 'overlap', 'zero'): print 'Gap: %s' % gap if gap == None: _dm = dm else: _dm = dm.select('gap == "%s"' % gap, verbose=False) fix1 = _dm['endX1NormToHandle'].mean() fix2 = _dm['endX2NormToHandle'].mean() fix3 = _dm['endX3NormToHandle'].mean() t1 = _dm['saccLat1'].mean() t2 = _dm['saccLat2'].mean() t3 = _dm['saccLat3'].mean() print '%.2f (%.2f)\t%.2f (%.2f)\t%.2f (%.2f)' % (fix1, t1, fix2, t2, fix3, \ t3)
# -*- coding: utf-8 -*- """ Created on Thu Feb 13 16:11:45 2014 @author: lotje """ import onObject import numpy as np from matplotlib import pyplot as plt from exparser.CsvReader import CsvReader from exparser.PivotMatrix import PivotMatrix exp = "004B" src = 'selected_dm_%s_WITH_drift_corr_onlyControl_False.csv' % exp main_dm = CsvReader(src).dataMatrix() main_dm = main_dm.select("contrast_side != 'control'") dv = "endX1NormToContrast" dm = main_dm.select("%s != ''" % dv) dm = dm.selectByStdDev(["file"], dv) dm = dm.removeField("__dummyCond__") dm = dm.removeField("__stdOutlier__") dm = dm.selectByStdDev(["file"], "saccLat1") fig = plt.figure() pm = PivotMatrix(dm, cols = ["visual_field"], \ rows = ["file"], dv = dv, colsWithin=True) pm.barPlot(fig = fig) for vf in ["upper", "lower"]:
def plotRegr(exp, direction): """ Plots data for one experiment. Arguments: exp --- {"004A", "004B"} """ if direction == "ToHandle": src = 'selected_dm_%s_WITH_drift_corr_onlyControl_True.csv' % exp elif direction == "ToContrast": src = 'selected_dm_%s_WITH_drift_corr_onlyControl_False.csv' % exp if direction == "ToHandle": yLim = [-.30,.15] elif direction == "ToContrast": yLim = [-.15,.1] dm = CsvReader(src).dataMatrix() if direction == "ToContrast": dm = dm.select("contrast_side != 'control'") R = RBridge() fig = plt.figure(figsize = (8,3)) plt.subplots_adjust(left=.2, bottom=.15) # Plot hline: plt.axhline(0, color = "black", linestyle = "--") lmeRegr(R, dm, sacc=1, direction=direction, corr=False, color=blue[1]) if exp == "004A": lmeRegr(R, dm, sacc=1, direction=direction, corr=True, color=orange[1]) lmeRegr(R, dm, sacc=2, direction=direction, corr=False, color=blue[1]) if exp == "004A": lmeRegr(R, dm, direction=direction, sacc=2, corr=True, color=orange[1]) # H line indicating landing position simulated saccades: xmin1 = 60 xmax1 = xmin2 = 250 xmax2 = 550 if direction == "ToHandle" and exp == "004B": lSal = salMeans() plt.hlines(lSal[0], xmin = xmin1, xmax= xmax1, color = red[1], \ linestyle = "--") plt.hlines(lSal[1], xmin = xmin2, xmax = xmax2, color = red[1],\ linestyle = "--") # Fake legend: if exp == "004A": lLabels = ["Relative to center", "Relative to CoG"] col1 = orange[1] col2 = blue[1] linestyle2 = "-" if exp == "004B": lLabels = ["Relative to CoG", "Simulated landing positions"] col1 = blue[1] col2 = red[1] linestyle2="--" line1= plt.Line2D((0,1),(0,0), marker = "o", color = col1, \ markerfacecolor = "white", markeredgecolor = col1, \ markeredgewidth = 1) line2= plt.Line2D((0,1),(0,0), marker = "o", color = col2, \ markerfacecolor = "white", markeredgecolor = col2, \ markeredgewidth = 1, linestyle = "--") if direction == "ToHandle": plt.legend([line1, line2], lLabels,\ frameon = False, loc=3) # TODO!! plt.xlabel("Saccade latency since stimulus onset") plt.xlim([80,660]) plt.ylim(yLim) plt.ylabel("Normalised landing position") figName = "Timecourse_%s_%s.png" % (direction, exp) plt.savefig(os.path.join(dst,figName)) plt.show() print print print "Done!" print figName, "is saved!" print print
""" # Import modules: from exparser.CsvReader import CsvReader # Constants: xc = 1024/2 yc = 768/2 ythr = 100 if __name__ == "__main__": dm = CsvReader('data.csv').dataMatrix() dm = dm.select('mask_side == "control"') dm = dm.select('symm == "asymm"') #dm = dm.select('gap == "overlap"') #dm = dm.select('handle_side == "right"') #dm = dm.select('object == "screwdriver"') # X coordinates, where positive values indicate a deviation towards the handle dm = dm.addField('refix1', dtype=float) dm = dm.addField('refix2', dtype=float) dm = dm.addField('refix3', dtype=float) # Timestamps for each fixation dm = dm.addField('tfix1', dtype=float) dm = dm.addField('tfix2', dtype=float) dm = dm.addField('tfix3', dtype=float)
dm = CsvReader(f).dataMatrix() dm = dm.addField("trial_dur") for i in dm.range(): # Skip the very first trial because it doesn't have a previous trial: if i == 0: dm["trial_dur"][i] = -1000 else: s = dm["time_correct_response"][i-1] e = dm["time_correct_response"][i] dur = e-s dm["trial_dur"][i] = dur # Exclude first trial, which was skipped: dm = dm.select("trial_dur > 0") dm["trial_dur"] = dm["trial_dur"]/1000/60 #import analyse #analyse.plotDist(dm, "trial_dur", bins = 100) #plt.show() plt.hist(dm["trial_dur"], bins=100) plt.show() # Exclude trials that took longer than 1 minute, because this was probably a # break: #dm = dm.select("trial_dur < 60000") #ms = dm["trial_dur"].sum() #sec = ms/1000.
def plotContrast(exp = "004B", trim=True, inclSim=True,stats=True,norm=False): """ Plots landing positions as a function of contrats manipulation per saccade, for Exp 1 and Exp 2, relative to CoG. Keyword arguments: trim --- (default=True) """ # Get dm: src = 'selected_dm_%s_WITH_drift_corr_onlyControl_False.csv' % exp dm = CsvReader(src).dataMatrix() colList = ["#f57900", "#3465a4"] lLegend = ["Saccade 1", "Saccade 2"] fig = plt.figure(figsize = (3,4)) plt.subplots_adjust(left=.2, bottom=.15) yLim = [-.07, .12] for sacc in ["1", "2"]: dv = "endX%sNorm" % sacc saccVar = "saccLat%s" % sacc # Get dm: # Only on-object: dm = onObject.onObject(dm, sacc,verbose=False) if trim: dm = dm.removeField("__dummyCond__") dm = dm.removeField("__stdOutlier__") dm = dm.selectByStdDev(keys = ["file"], \ dv = dv,verbose=False) dm = dm.removeField("__dummyCond__") dm = dm.removeField("__stdOutlier__") dm = dm.selectByStdDev(keys = ["file"], dv = saccVar,\ verbose=False) # Collect mean and error bar per saccade: lM = [] lErr = [] if norm: # Normalize across handle side: dm = dm.removeField("normDV") dm= dm.addField("normDV", dtype = float) dm= dm.withinize(dv, "normDV", \ ["handle_side"], whiten=False) dv = "normDV" for contrast in dm.unique("contrast_side"): contrast_dm = dm.select("contrast_side == '%s'" % contrast,\ verbose = False) cm = contrast_dm.collapse(["file"], dv) M = cm["mean"].mean() SE = cm['mean'].std() / np.sqrt(len(cm)) CI = SE * critVal lM.append(M) lErr.append(CI) if stats: # Run a full LME print "Exp = ", exp print "DV = ", dv print "trim = ", trim print "norm = ", norm print "saccVar = ", saccVar lmeContrast(R, dm, dv, saccVar, exp=exp) #raw_input() xData = range(len(lM)) yData = lM yErr = lErr col = colList.pop() plt.errorbar(xData, yData, yerr=yErr, fmt='o-', marker = "o", \ color = col, markerfacecolor='white', markeredgecolor=col, \ markeredgewidth=1) plt.axhline(0, linestyle = "--") plt.ylim(yLim) plt.ylabel(yTitle) #ax.yaxis.set_ticklabels([]) plt.legend(lLegend, frameon = False) plt.axhline(0, color = "black", linestyle = "--") plt.xlabel("High-contrast side") spacing = 0.5 xTicks = range(0,3) xLabels = ["Left", "Control", "Right"] plt.xticks(xTicks, xLabels, rotation = .5) plt.xlim(min(xTicks)-spacing, max(xTicks)+spacing) plt.savefig(os.path.join(dst,"Contrast_Effect_%s_trim_%s_norm_%s.png") \ % (exp, trim, norm)) plt.show()
#!/usr/bin/env python #-*- coding:utf-8 -*- """ DESCRIPTION: Plots landing position as a function of sacc latency (and other predictors, if wanted), using LMM. """ from exparser.CsvReader import CsvReader from exparser.RBridge import RBridge src = "/home/lotje/Documents/PhD Marseille/Studies/004 - Single-object experiment - Handle-orientation effect/analysis 004/selected_dm_004B_WITH_drift_corr_onlyControl_True.csv" dm = CsvReader(src).dataMatrix() dm = dm.select("endX1NormToHandle == ''") dvRaw = "endX1Norm" dvNorm = "endX1NormToHandle" nsim = 10 R = RBridge() R.load(dm) print "Condition in DV" # Run a full LME lmerDm = R.lmer(\ '%s ~ (1|file) + (1|object)'\ % (dvNorm), nsim=nsim, printLmer=True) lmerDm._print(sign=5) lmerDm.save('lme_condition_in_dv.csv') print "Condition as factor"
srcDm = "/home/lotje/Documents/PhD Marseille/Studies/004/004C/stimuli/cog_per_stim.csv" dm = CsvReader(srcDm).dataMatrix() stimList = ["chisel", "chisel2", "mallet", "paintbrush", "screwdriver", \ "wrench", "fork", "knife", "peeler", "sharpeningsteel", "spoon", \ "spoon2", "washingbrush", "hammer"] f = open("blockloop.csv", "w") for direction in [-20, 0, 20]: for stimType in ["object", "non-object"]: for flip in ["left", "right"]: for vf in ["upper","lower"]: for stim in stimList: _dm = dm.select("stim_type == '%s'" % stimType) _dm = _dm.select("name == '%s'" % stim) assert(len(_dm)==1) cog = _dm["xCoG"][0] if flip == "left": cog = cog * -1 print "object = ", stim print "flip = ", flip print "cog = ", cog #raw_input() f.write(",".join([str(direction), \ stimType, flip, vf, stim, str(cog)]) + "\n") f.close()
def plotGap(exp, dv = "saccLat1", trim = False, norm=True, nBins = 50, \ exclFastSacc = False): """ """ src = 'selected_dm_%s_WITH_drift_corr_onlyControl_True.csv' % exp dm = CsvReader(src).dataMatrix() # Determine sacc: sacc = [int(x.group()) for x in re.finditer(r'\d+', dv)][0] dm = onObject.onObject(dm, sacc) # Exclude very fast saccades: dm = dm.select("%s > 80" % dv) colList = [orange[1], blue[1]] # Trim the data if trim: dm = dm.removeField("__dummyCond__") dm = dm.removeField("__stdOutlier__") dm = dm.selectByStdDev(["file"], dv, \ verbose=False) dm = dm.removeField("__dummyCond__") dm = dm.removeField("__stdOutlier__") dm = dm.selectByStdDev(["file"], "endX%sNormToHandle" % sacc, \ verbose=False) if exp == "004A": dm = dm.removeField("__dummyCond__") dm = dm.removeField("__stdOutlier__") dm = dm.selectByStdDev(["file"], "endX%sCorrNormToHandle" % sacc, \ verbose=False) else: dm = dm.select("%s < 1000" % dv) # Normalize saccade latencies if norm: dm= dm.addField("normSacc", dtype = float) dm= dm.withinize(dv, "normSacc", \ ["file"], whiten=False) dv = "normSacc" for gap in dm.unique("gap"): _dm = dm.select("gap == '%s'" % gap) samp = _dm[dv] y, edges = np.histogram(samp, bins = nBins) y = normY(y) x = .5*edges[1:] + .5*edges[:-1] col = colList.pop() plt.plot(x, y, color = col) plt.fill_between(x, 0, y, alpha=.3, color=col) plt.legend(dm.unique("gap")) plt.ylim([0,1.1])
def plotPerExp(exp, direction, norm=True): """ """ print "exp = ", exp print "direction = ", direction legend = True # Get dm: if direction == "ToHandle": src = 'selected_dm_%s_WITH_drift_corr_onlyControl_True.csv' % exp #dm = getDM.getDM(exp, onlyControl=True) elif direction == "ToContrast": src = 'selected_dm_%s_WITH_drift_corr_onlyControl_False.csv' % exp #dm = getDM.getDM(exp, onlyControl=False) # main_dm = CsvReader(src).dataMatrix() if direction == "ToContrast": main_dm = main_dm.select("contrast_side != 'control'") nCols = 2 if exp == "004B": nRows = 1 fig = plt.figure(figsize = (8, 3)) plt.subplots_adjust(wspace=0, hspace = 0.2, left = .2, bottom = .15) #plt.suptitle("Experiment 2", s) lTitles = ["a) Saccade 1 relative to CoG", \ "b) Saccade 2 relative to CoG"] lTitles.reverse() if exp == "004A": nRows = 2 fig = plt.figure(figsize = (8,6)) plt.subplots_adjust(wspace=0, hspace = 0.2,\ left = .2, bottom = .15) #plt.suptitle("Experiment 1") lTitles = ["a) Saccade 1 relative to absolute center", \ "b) Saccade 2 relative to absolute center", "c) Saccade 1 relative to CoG", "d) Saccade 2 relative to CoG"] lTitles.reverse() nPlot = 0 if exp == "004A": varList = ["absolute center", "CoG"] elif exp == "004B": varList = ["absolute center"] for dvType in varList: for sacc in ["1", "2"]: if dvType == "absolute center": dv = "endX%sNorm%s" % (sacc, direction) elif dvType == "CoG": dv = "endX%sCorrNorm%s" % (sacc, direction) # Plot distr per saccade bin: nPlot +=1 ax = plt.subplot(nRows, nCols, nPlot) plt.title(lTitles.pop(), size = 10) distr(main_dm, dv, "saccLat%s" % sacc, norm=norm) if legend: plt.legend(["Fast", "Medium", "Slow"],loc='best') legend=False if sacc == "2": ax.yaxis.set_ticklabels([]) elif sacc == "1": plt.ylabel("Normalized frequency") if exp == "004A": if dvType == "absolute center": ax.xaxis.set_ticklabels([]) elif dvType == "CoG": plt.xlabel("Normalized landing position") if exp == "004B": plt.xlabel("Normalized landing position") plt.axvline(0, linestyle = "--", color = gray[3]) figName = "Distr_%s_%s_norm_%s.svg" % \ (exp, direction, norm) plt.savefig(os.path.join(dst,figName)) print print print "Done!" print figName, "is saved" print print
sacc = "1" dvNorm = "endX1CorrNormToHandle" dvRaw = "endX1CorrNorm" dm = onObject.onObject(dm, sacc) print "ANOVA" am = AnovaMatrix(dm, ["handle_side"], dvRaw, "file")._print(ret=True) print am print 'One-sample test scipy' cm = dm.collapse(["file"], dvNorm) ref = 0 t, p = scipy.stats.ttest_1samp(cm['mean'], ref) print "t = ",t print "p = ", p # Paired-samples t-test: print "paired samples t-test" l = [] for handle in dm.unique("handle_side"): handle_dm = dm.select("handle_side == '%s'" % handle) cm = handle_dm.collapse(["file"], dvRaw) l.append(cm["mean"]) t, p = scipy.stats.ttest_rel(l[0], l[1]) print "t = ",t print "p = ", p
def ovp(exp,corr=False, trim=True, bins=8): """ """ src = 'selected_dm_%s_WITH_drift_corr_onlyControl_True.csv' % exp dm = CsvReader(src).dataMatrix() lat1 = "saccLat1" lat2 = "saccLat2" prob = "saccCount" dur1 = "durationFix1" dur2 = "durationFix2" total = "gazeDur" rt = "rtFromStim" if corr: fix1 = "endX1CorrNormToHandle" fix2 = "endX2CorrNormToHandle" else: fix1 = "endX1NormToHandle" fix2 = "endX2NormToHandle" for var in [lat1, lat2, fix1, fix2, dur1, dur2, total, rt]: dm = dm.select("%s != ''" % var) # Trim the data if trim: dm = dm.selectByStdDev(["file"],lat2, verbose=False) dm = dm.removeField("__dummyCond__") dm = dm.removeField("__stdOutlier__") dm = dm.selectByStdDev(["file"], fix2, verbose=False) dm = dm.addField('land2_perc', dtype=float) dm = dm.calcPerc(fix2, 'land2_perc', nBin=bins) cmLat1 = dm.collapse(['land2_perc'], lat1) cmLat2 = dm.collapse(['land2_perc'], lat2) cmFix1 = dm.collapse(['land2_perc'], fix1) cmX = cmFix2 = dm.collapse(['land2_perc'], fix2) cmProb = dm.collapse(['land2_perc'], prob) cmDur1 = dm.collapse(['land2_perc'], dur1) cmDur2 = dm.collapse(['land2_perc'], dur2) cmTotal = dm.collapse(['land2_perc'], total) cmRt = dm.collapse(['land2_perc'], rt) fig = plt.figure(figsize = (3,10)) plt.subplots_adjust(left=.2, bottom=.15, hspace = .2) lTitles = ["dur 1", "prob", "land 1", "rt", "total", "lat 1", "lat 2", "dur 2"] lTitles.reverse() nRows = len(lTitles) nCols = 1 nPlot = 0 for cmY in [cmDur1, cmProb, cmFix1, cmRt, cmTotal, \ cmLat1, cmLat2, cmDur2]: nPlot +=1 ax = plt.subplot(nRows, nCols, nPlot) #color = colList.pop() color = blue[1] plt.plot(cmX['mean'], cmY['mean'], marker = 'o', color=color, \ markerfacecolor='white', markeredgecolor=color, \ markeredgewidth=1) plt.ylabel(lTitles.pop()) plt.axvline(0, linestyle = "--", color = gray[3]) if nPlot == nRows: plt.xlabel("Second landing position") else: ax.xaxis.set_ticklabels([]) plt.savefig("ovp2_%s_corr_%s.png" % (exp, corr))
def plotAff(rtVar, trim=True,errBar = False,stats=True): """ """ fig = plt.figure(figsize = (5, 2.5)) plt.subplots_adjust(left=.2, bottom=.15, wspace=.4) nRows = 1 nCols = 2 nPlot = 0 lTitles = ["b) Experiment 2", "a) Experiment 1"] for exp in ["004A", "004B"]: nPlot +=1 ax = plt.subplot(nRows, nCols, nPlot) plt.title(lTitles.pop()) # Get dm: src = 'selected_dm_%s_WITH_drift_corr_onlyControl_True.csv' % exp dm = CsvReader(src).dataMatrix() # Determine the names of the dependent variables in the datamatrix if trim: dm = dm.selectByStdDev(["file"], \ rtVar, verbose=False) colList = [orange[1], blue[1]] for hand in dm.unique("response_hand"): _dm = dm.select("response_hand == '%s'" % hand) lM = [] lErr = [] for handle in dm.unique("handle_side"): __dm = _dm.select("handle_side == '%s'" % handle) cm = __dm.collapse(["file"], rtVar) M = cm["mean"].mean() SE = cm['mean'].std() / np.sqrt(len(cm)) lM.append(M) lErr.append(SE) col = colList.pop() xData = range(len(lM)) yData = lM if errBar: plt.errorbar(xData, yData, yerr=lErr, fmt='o-', marker = "o", \ color = col, markerfacecolor='white', markeredgecolor=col, \ markeredgewidth=1) else: plt.plot(yData, marker = "o", \ color = col, markerfacecolor='white', markeredgecolor=col, \ markeredgewidth=1) if exp == "004A": plt.legend(dm.unique("handle_side"), loc = 'best', frameon=False, \ title="Handle Orientation") if exp == "004A": plt.ylim([700, 750]) if exp == "004B": plt.ylim([600,650]) plt.xlabel("Response Hand") spacing = 0.5 xTicks = range(0,2) xLabels = dm.unique("response_hand") plt.xticks(xTicks, xLabels, rotation = .5) plt.xlim(min(xTicks)-spacing, max(xTicks)+spacing) plt.ylabel("Response time") if stats: print "Exp = ", exp print "rtVar = ", rtVar lmeAff(R, dm, rtVar,exp=exp) raw_input() plt.savefig(os.path.join(dst,"Affordances_both_exp.png"))