def thresholds(save_pdf=False): conf = ss_timing_analysis.conf.get_conf() # load the fit parameters, excluding the bad subjects # this will be subj x onsets x oris x (a,b) x (est, 2.5, 97.5) (fit, _, _) = ss_timing_analysis.group_fit.load_fit_data(exclude=True) # restrict to just the alpha estimates data = fit[..., 0, 0] embed = veusz.embed.Embedded("veusz") figutils.set_veusz_style(embed) page = embed.Root.Add("page") page.width.val = "13.5cm" page.height.val = "6cm" # separate columns for simultaneous and leading grid = page.Add("grid") grid.rows.val = 1 grid.columns.val = 2 grid.leftMargin.val = grid.rightMargin.val = "0cm" grid.topMargin.val = grid.bottomMargin.val = "0cm" onset_order = [1, 0] # sim, leading ori_order = [0, 1] # orth, para for i_onset in onset_order: graph = grid.Add("graph", autoadd=False) graph.bottomMargin.val = "1cm" graph.topMargin.val = "0.6cm" x_axis = graph.Add("axis") y_axis = graph.Add("axis") for i_ori in ori_order: curr_data = data[:, i_onset, i_ori] boxplot = graph.Add("boxplot") dataset_str = "data_{onset:d}_{ori:d}".format(onset=i_onset, ori=i_ori) embed.SetData(dataset_str, curr_data) boxplot.values.val = dataset_str boxplot.posn.val = i_ori boxplot.labels.val = conf.surr_ori_labels[i_ori] boxplot.fillfraction.val = 0.3 boxplot.markerSize.val = "2pt" for i_subj in xrange(conf.n_subj): subj_data_str = "subj_data_{subj:d}_{onset:d}".format( subj=i_subj, onset=i_onset) embed.SetData(subj_data_str, data[i_subj, i_onset, :]) xy = graph.Add("xy") xy.xData.val = [0, 1] xy.yData.val = subj_data_str xy.MarkerFill.hide.val = True xy.MarkerLine.hide.val = True xy.PlotLine.transparency.val = 80 x_axis.mode.val = "labels" x_axis.MajorTicks.manualTicks.val = [0, 1] x_axis.MinorTicks.hide.val = True x_axis.label.val = "Relative orientation" y_axis.log.val = True y_axis.TickLabels.format.val = "%.3g" y_axis.MajorTicks.manualTicks.val = [0.001, 0.01, 0.1, 0.5, 1] y_axis.min.val = 0.005 y_axis.max.val = 1.0 y_axis.label.val = "Threshold contrast" cond_label = graph.Add("label") cond_label.label.val = conf.surr_onset_labels[i_onset] cond_label.yPos.val = 1.02 cond_label.xPos.val = 0.5 cond_label.alignHorz.val = "centre" cond_label.Text.size.val = "8pt" if save_pdf: _save(embed, conf, "ss_timing_thresholds") embed.EnableToolbar(True) embed.WaitForClose()
def eg_subject(subj_id="p1022", save_pdf=False): conf = ss_timing_analysis.conf.get_conf() # find the index for this subject # we'll load the data without excluding participants, so this needs to be # in the all subjects list i_subj = conf.all_subj_ids.index(subj_id) # subj x onsets x oris x bins x (prop, n) data = ss_timing_analysis.group_data.bin_group_data() # restrict to this subject data = data[i_subj, ...] # fit is: subj x onsets x oris x (a, b) x (est, 2.5, 97.5) # fit_fine is: subj x onsets x oris x X x 2 (2.5, 97.5) (fit, fit_fine, _) = ss_timing_analysis.group_fit.load_fit_data() # again, restrict to this subject fit = fit[i_subj, ...] fit_fine = fit_fine[i_subj, ...] embed = veusz.embed.Embedded("veusz") figutils.set_veusz_style(embed) embed.SetData("bin_centres", conf.bin_centres) embed.SetData("fine_x", conf.fine_x) page = embed.Root.Add("page") page.width.val = "8cm" page.height.val = "20cm" grid = page.Add("grid") grid.rows.val = 4 grid.columns.val = 1 grid.leftMargin.val = grid.rightMargin.val = "0cm" grid.topMargin.val = grid.bottomMargin.val = "0cm" onset_order = [1, 0] # sim, leading ori_order = [0, 1] # orth, par for i_onset in onset_order: for i_ori in ori_order: graph = grid.Add("graph", autoadd=False) graph.leftMargin.val = "1.2cm" graph.rightMargin.val = "0.5cm" graph.topMargin.val = "0.7cm" graph.bottomMargin.val = "0.85cm" x_axis = graph.Add("axis") y_axis = graph.Add("axis") cond_label = graph.Add("label") cond_label.label.val = ", ".join( [conf.surr_ori_labels[i_ori], conf.surr_onset_labels[i_onset]]) cond_label.yPos.val = 1.02 cond_label.xPos.val = 0.5 cond_label.alignHorz.val = "centre" cond_label.Text.size.val = "8pt" # CROSSHAIRS pse_y = graph.Add("xy") pse_y.xData.val = [0.001, fit[i_onset, i_ori, 0, 0]] pse_y.yData.val = [ conf.psych_func(fit[i_onset, i_ori, 0, 0], fit[i_onset, i_ori, 0, 0], fit[i_onset, i_ori, 0, 1]) ] * 2 pse_x = graph.Add("xy") pse_x.xData.val = [fit[i_onset, i_ori, 0, 0]] * 2 pse_x.yData.val = [ -0.05, conf.psych_func(fit[i_onset, i_ori, 0, 0], fit[i_onset, i_ori, 0, 0], fit[i_onset, i_ori, 0, 1]) ] for pse_ax in (pse_y, pse_x): pse_ax.MarkerFill.hide.val = True pse_ax.MarkerLine.hide.val = True pse_ax.PlotLine.style.val = "dashed" # POINTS points = graph.Add("xy") prop_name = "resp_prop_{t:d}_{o:d}".format(t=i_onset, o=i_ori) embed.SetData(prop_name, data[i_onset, i_ori, :, 0]) k_name = "resp_k_{t:d}_{o:d}".format(t=i_onset, o=i_ori) point_scale = np.sqrt( (data[i_onset, i_ori, :, 1] * 1) / np.pi) * 2 * 0.35 embed.SetData(k_name, point_scale) points.xData.val = "bin_centres" points.yData.val = prop_name points.scalePoints.val = k_name points.MarkerLine.hide.val = True points.MarkerFill.transparency.val = 65 points.PlotLine.hide.val = True points.MarkerFill.color.val = "blue" # FIT fit_plot = graph.Add("xy") fit_name = "fit_{t:d}_{o:d}".format(t=i_onset, o=i_ori) fit_y = conf.psych_func(conf.fine_x, alpha=fit[i_onset, i_ori, 0, 0], beta=fit[i_onset, i_ori, 1, 0]) embed.SetData( fit_name, fit_y, poserr=np.abs(fit_fine[i_onset, i_ori, :, 1] - fit_y), negerr=np.abs(fit_fine[i_onset, i_ori, :, 0] - fit_y)) fit_plot.xData.val = "fine_x" fit_plot.yData.val = fit_name fit_plot.MarkerFill.hide.val = True fit_plot.MarkerLine.hide.val = True fit_plot.errorStyle.val = "fillvert" fit_plot.ErrorBarLine.hide.val = True x_axis.log.val = True x_axis.label.val = "Target contrast" x_axis.TickLabels.format.val = "%.3g" x_axis.MajorTicks.manualTicks.val = [0.001, 0.01, 0.1, 0.5, 1] y_axis.min.val = -0.1 y_axis.max.val = 1.1 y_axis.label.val = "Accuracy (prop. correct)" y_axis.MinorTicks.hide.val = True y_axis.MajorTicks.manualTicks.val = [0, 0.25, 0.5, 0.69, 1] y_axis.TickLabels.format.val = "%.02f" if save_pdf: _save(embed, conf, "ss_timing_eg_subject") embed.EnableToolbar(True) embed.WaitForClose()
def context_by_booth(save_pdf=False): conf = ss_timing_analysis.conf.get_conf() dem = ss_timing_analysis.dem.demographics() booths = np.array( [dem[subj_id]["testing_booth"] for subj_id in conf.subj_ids]) potential_booths = np.unique(booths) n_booths = len(potential_booths) assert n_booths == 2 # load the fit parameters, excluding the bad subjects # this will be subj x onsets x oris x (a,b) x (est, 2.5, 97.5) (fit, _, _) = ss_timing_analysis.group_fit.load_fit_data(exclude=True) # restrict to just the alpha estimates data = fit[..., 0, 0] # and look at the context effect for simultaneous data = data[:, 1, 1] - data[:, 1, 0] embed = veusz.embed.Embedded("veusz") figutils.set_veusz_style(embed) page = embed.Root.Add("page") page.width.val = "12cm" page.height.val = "8cm" graph = page.Add("graph", autoadd=False) graph.bottomMargin.val = "1cm" graph.topMargin.val = "0.6cm" x_axis = graph.Add("axis") y_axis = graph.Add("axis") for i_booth in xrange(n_booths): curr_booth = data[booths == potential_booths[i_booth]] boxplot = graph.Add("boxplot") dataset_str = "data_{b:d}".format(b=i_booth) embed.SetData(dataset_str, curr_booth) boxplot.values.val = dataset_str boxplot.posn.val = i_booth boxplot.labels.val = "{b:d} (n={n:d})".format(b=i_booth + 1, n=len(curr_booth)) boxplot.fillfraction.val = 0.3 boxplot.markerSize.val = "2pt" x_axis.mode.val = "labels" x_axis.MajorTicks.manualTicks.val = [0, 1] x_axis.MinorTicks.hide.val = True x_axis.label.val = "Testing booth" y_axis.TickLabels.format.val = "%.3g" y_axis.min.val = 0.0 y_axis.max.val = 0.5 y_axis.label.val = "Context effect for simultaneous (par - orth)" if save_pdf: _save(embed, conf, "ss_timing_context_by_booth") embed.EnableToolbar(True) embed.WaitForClose()
def scatter(cond, form, save_pdf=False): if cond not in ["sim", "sim_orth", "lead"]: raise ValueError() if form not in ["linear", "rank"]: raise ValueError() conf = ss_timing_analysis.conf.get_conf() # load the fit parameters, excluding the bad subjects # this will be subj x onsets x oris x (a,b) x (est, 2.5, 97.5) (fit, _, _) = ss_timing_analysis.group_fit.load_fit_data(exclude=True) # restrict to just the alpha estimates data = fit[..., 0, 0] if cond == "sim": data = data[:, 1, 1] - data[:, 1, 0] elif cond == "sim_orth": data = data[:, 1, 0] elif cond == "lead": #data = (data[:, 1, 1] - data[:, 1, 0]) - (data[:, 0, 1] - data[:, 0, 0]) data = data[:, 0, 1] - data[:, 0, 0] if form == "rank": data = scipy.stats.rankdata(data) embed = veusz.embed.Embedded("veusz") figutils.set_veusz_style(embed) embed.SetData("data", data) page = embed.Root.Add("page") page.width.val = "13.5cm" page.height.val = "10cm" grid = page.Add("grid") grid.rows.val = 2 grid.columns.val = 2 grid.leftMargin.val = grid.rightMargin.val = "2cm" grid.topMargin.val = grid.bottomMargin.val = "0cm" ss_nice = [ "Unusual experiences", "Cognitive disorganisation", "Introvertive anhedonia", "Impulsive nonconformity" ] for (i_sub, subscale) in enumerate( ("un_ex", "cog_dis", "int_anh", "imp_non")): curr_ss = ss_timing_analysis.dem.get_olife_subscale(subscale, exclude=True) if form == "rank": curr_ss = scipy.stats.rankdata(curr_ss) assert len(curr_ss) == len(data) graph = grid.Add("graph", autoadd=False) graph.bottomMargin.val = "1cm" graph.topMargin.val = "0.6cm" graph.leftMargin.val = "1cm" graph.aspect.val = 1 label = graph.Add("label") label.label.val = ss_nice[i_sub] label.yPos.val = 1.025 label.xPos.val = 0.5 label.alignHorz.val = "centre" x_axis = graph.Add("axis") y_axis = graph.Add("axis") xy = graph.Add("xy") xy.xData.val = curr_ss xy.yData.val = data xy.PlotLine.hide.val = True xy.MarkerFill.transparency.val = 60 xy.MarkerLine.hide.val = True xy.markerSize.val = "3pt" if form == "rank": x_axis.label.val = "O-LIFE subscale (rank; 1 = lowest)" else: x_axis.label.val = "O-LIFE subscale score" if cond == "sim": if form == "rank": y_axis.label.val = "Context effect (rank; 1 = lowest)" else: y_axis.label.val = "Context effect (contrast units)" elif cond == "sim_orth": if form == "rank": y_axis.label.val = "Orthogonal threshold (rank; 1 = lowest)" else: y_axis.label.val = "Orthogonal threshold (contrast units)" elif cond == "lead": if form == "rank": y_axis.label.val = "Leading context effect (rank; 1 = lowest)" else: y_axis.label.val = "Leading context effect (contrast units)" if form == "linear": if cond == "sim": y_max = 0.5 elif cond == "sim_orth": y_max = 0.03 y_axis.TickLabels.format.val = "%.3g" elif cond == "lead": y_max = 0.085 y_axis.max.val = y_max y_axis.min.val = 0.0 x_axis.min.val = -2 else: x_axis.min.val = -10 x_axis.max.val = 105 y_axis.min.val = -10 y_axis.max.val = 105 x_axis.MajorTicks.manualTicks.val = [1] + range(20, 83, 20) + [93] x_axis.MinorTicks.hide.val = True y_axis.MajorTicks.manualTicks.val = [1] + range(20, 83, 20) + [93] y_axis.MinorTicks.hide.val = True if save_pdf: _save(embed, conf, "ss_timing_{c:s}_{f:s}_scatter".format(c=cond, f=form)) embed.EnableToolbar(True) embed.WaitForClose()
def split(save_pdf=False): conf = ss_timing_analysis.conf.get_conf() split_locs = [50, 40, 30, 20, 10] n_splits = len(split_locs) data = ss_timing_analysis.split.split_ana() embed = veusz.embed.Embedded("veusz") figutils.set_veusz_style(embed) page = embed.Root.Add("page") page.width.val = "10cm" page.height.val = "10cm" graph = page.Add("graph", autoadd=False) graph.bottomMargin.val = "2.5cm" graph.topMargin.val = "0.2cm" graph.leftMargin.val = "1.5cm" graph.rightMargin.val = "0cm" x_axis = graph.Add("axis") y_axis = graph.Add("axis") subscale_colours = ["#e41a1c", "#377eb8", "#4daf4a", "#984ea3"] split_lbl = [ "< {s1:d}%, >= {s2:d}%".format(s1=sloc, s2=100 - sloc) for sloc in split_locs ] embed.SetDataText("split_lbl", split_lbl) for (i_sub, sub) in enumerate(conf.subscales): embed.SetData(sub, data[:, i_sub, 0], symerr=data[:, i_sub, 1]) xy = graph.Add("xy") x = np.arange(n_splits) + np.linspace(-0.15, 0.15, 4)[i_sub] xy.xData.val = x xy.yData.val = sub if i_sub == 0: xy.labels.val = "split_lbl" xy.MarkerLine.hide.val = False #xy.MarkerLine.transparency.val = 20 xy.MarkerFill.hide.val = True #xy.PlotLine.hide.val = True xy.markerSize.val = "2pt" xy.MarkerLine.color.val = subscale_colours[i_sub] xy.PlotLine.color.val = subscale_colours[i_sub] xy.ErrorBarLine.color.val = subscale_colours[i_sub] #xy.marker.val = ana_markers[i_ana] xy.key.val = "".join(sub.title().split("_")) xy.Label.hide.val = True key = graph.Add("key") key.horzPosn.val = "manual" key.vertPosn.val = "manual" key.horzManual.val = 0.051125165504591 key.vertManual.val = 0.79086156527087 x_axis.mode.val = "labels" x_axis.min.val = -0.5 x_axis.max.val = 4.5 x_axis.MinorTicks.hide.val = True x_axis.MajorTicks.manualTicks.val = range(n_splits) x_axis.TickLabels.rotate.val = "45" x_axis.label.val = "Group split" y_axis.label.val = "Context effect difference (high - low)" if save_pdf: _save(embed, conf, "ss_timing_split") embed.EnableToolbar(True) embed.WaitForClose()
def subjects(save_pdf=False): conf = ss_timing_analysis.conf.get_conf() # subj x onsets x oris x bins x (prop, n) data = ss_timing_analysis.group_data.bin_group_data() # fit is: subj x onsets x oris x (a, b) x (est, 2.5, 97.5) # fit_fine is: subj x onsets x oris x X x 2 (2.5, 97.5) (fit, fit_fine, _) = ss_timing_analysis.group_fit.load_fit_data() embed = veusz.embed.Embedded("veusz") figutils.set_veusz_style(embed) embed.SetData("bin_centres", conf.bin_centres) embed.SetData("fine_x", conf.fine_x) for (i_subj, subj_id) in enumerate(conf.all_subj_ids): page = embed.Root.Add("page") page.width.val = "21cm" page.height.val = "29.7cm" label = page.Add("label") label.label.val = subj_id label.yPos.val = 0.77 if subj_id in conf.exclude_ids: label.label.val += " (excluded)" label.Text.color.val = "red" grid = page.Add("grid") grid.rows.val = 2 grid.columns.val = 2 grid.leftMargin.val = grid.rightMargin.val = "3cm" grid.topMargin.val = "8cm" grid.bottomMargin.val = "8cm" for i_onset in xrange(conf.n_surr_onsets): for i_ori in xrange(conf.n_surr_oris): graph = grid.Add("graph", autoadd=False) x_axis = graph.Add("axis") y_axis = graph.Add("axis") cond_label = graph.Add("label") cond_label.label.val = ", ".join([ conf.surr_ori_labels[i_ori], conf.surr_onset_labels[i_onset] ]) cond_label.yPos.val = 1.02 cond_label.xPos.val = 0.5 cond_label.alignHorz.val = "centre" cond_label.Text.size.val = "8pt" # CROSSHAIRS pse_y = graph.Add("xy") pse_y.xData.val = [0.001, fit[i_subj, i_onset, i_ori, 0, 0]] pse_y.yData.val = [ conf.psych_func(fit[i_subj, i_onset, i_ori, 0, 0], fit[i_subj, i_onset, i_ori, 0, 0], fit[i_subj, i_onset, i_ori, 0, 1]) ] * 2 pse_x = graph.Add("xy") pse_x.xData.val = [fit[i_subj, i_onset, i_ori, 0, 0]] * 2 pse_x.yData.val = [ -0.05, conf.psych_func(fit[i_subj, i_onset, i_ori, 0, 0], fit[i_subj, i_onset, i_ori, 0, 0], fit[i_subj, i_onset, i_ori, 0, 1]) ] for pse_ax in (pse_y, pse_x): pse_ax.MarkerFill.hide.val = True pse_ax.MarkerLine.hide.val = True pse_ax.PlotLine.style.val = "dashed" # POINTS points = graph.Add("xy") prop_name = "resp_prop_{s:d}_{t:d}_{o:d}".format(s=i_subj, t=i_onset, o=i_ori) embed.SetData(prop_name, data[i_subj, i_onset, i_ori, :, 0]) k_name = "resp_k_{s:d}_{t:d}_{o:d}".format(s=i_subj, t=i_onset, o=i_ori) point_scale = np.sqrt( data[i_subj, i_onset, i_ori, :, 1] / np.pi) * 2 * 0.35 embed.SetData(k_name, point_scale) points.xData.val = "bin_centres" points.yData.val = prop_name points.scalePoints.val = k_name points.MarkerLine.hide.val = True points.MarkerFill.transparency.val = 50 points.PlotLine.hide.val = True points.MarkerFill.color.val = "blue" # FIT fit_plot = graph.Add("xy") fit_name = "fit_{s:d}_{t:d}_{o:d}".format(s=i_subj, t=i_onset, o=i_ori) fit_y = conf.psych_func(conf.fine_x, alpha=fit[i_subj, i_onset, i_ori, 0, 0], beta=fit[i_subj, i_onset, i_ori, 1, 0]) embed.SetData( fit_name, fit_y, poserr=np.abs(fit_fine[i_subj, i_onset, i_ori, :, 1] - fit_y), negerr=np.abs(fit_fine[i_subj, i_onset, i_ori, :, 0] - fit_y)) fit_plot.xData.val = "fine_x" fit_plot.yData.val = fit_name fit_plot.MarkerFill.hide.val = True fit_plot.MarkerLine.hide.val = True fit_plot.errorStyle.val = "fillvert" fit_plot.ErrorBarLine.hide.val = True x_axis.log.val = True x_axis.label.val = "Contrast" x_axis.TickLabels.format.val = "%.3g" x_axis.MajorTicks.manualTicks.val = [0.001, 0.01, 0.1, 0.5, 1] y_axis.min.val = -0.1 y_axis.max.val = 1.1 y_axis.label.val = "Accuracy (prop. correct)" y_axis.MinorTicks.hide.val = True y_axis.MajorTicks.manualTicks.val = [0, 0.25, 0.5, 0.69, 1] y_axis.TickLabels.format.val = "%.02f" if save_pdf: _save(embed, conf, "ss_timing_subjects", page=range(conf.n_all_subj)) embed.EnableToolbar(True) embed.WaitForClose()
def figure(study): conf = ss_timing_analysis.conf.get_conf() if study == "yoon": study_pkg = ss_timing_analysis.ext_yoon elif study == "s-p": study_pkg = ss_timing_analysis.ext_s_p # two-item list (controls, patients) # each item is an array, n subj x 3 (ns, os, ps) data = study_pkg.load_data() embed = veusz.embed.Embedded("veusz") figutils.set_veusz_style(embed) # x to evaluate for the regressions fine_x = np.linspace(0, 100, 101) if study == "s-p": fine_x /= 100.0 nice_surrs = {"O": "Orthogonal", "P": "Parallel"} nice_grps = {"C": "Control", "P": "Patient"} limits = { "yoon": { "C": { "x": 40.0, "y": {"O": 100.0, "P": 100.0}, "r": {"O": [0.5, 2.25], "P": [1.4, 4.0]} }, "P": { "x": 40.0, "y": {"O": 100.0, "P": 100.0}, "r": {"O": [0.5, 4.0], "P": [1.25, 3.75]} } }, "s-p": { "C": { "x": 0.04, "y": {"O": 0.03, "P": 0.6}, "r": {"O": [-1.2, 1.1], "P": [0.5, 4.25]} }, "P": { "x": 0.1, "y": {"O": 0.06, "P": 0.5}, "r": {"O": [-2.2, 0.5], "P": [0, 3.05]} } } } study_limits = limits[study] page = embed.Root.Add("page") page.width.val = "12.5cm" page.height.val = "20cm" grp_grid = page.Add("grid") grp_grid.rows.val = 2 grp_grid.columns.val = 1 grp_grid.leftMargin.val = grp_grid.rightMargin.val = "0cm" grp_grid.topMargin.val = grp_grid.bottomMargin.val = "0cm" for (i_grp, (grp_data, grp_name)) in enumerate(zip(data, ("C", "P"))): grid = grp_grid.Add("grid") # OS, PS grid.rows.val = 2 # NS x AS, (AS/NS) x NS grid.columns.val = 2 grid.leftMargin.val = grid.rightMargin.val = grid.bottomMargin.val = "0cm" grid.topMargin.val = "1cm" label = page.Add("label") label.label.val = nice_grps[grp_name] label.Text.bold.val = True label.Text.size.val = "10pt" label.alignHorz.val = "centre" label.alignVert.val = "centre" label.yPos.val = 1 - (0.5 * i_grp + 0.025) # denominator is the no-surround condition denom = grp_data[:, 0] # loop over the orthogonal and parallel conditions for (i_num, num_name) in enumerate(("O", "P"), 1): numerator = grp_data[:, i_num] # first, NS x AS graph graph = grid.Add("graph", autoadd=False) x_axis = graph.Add("axis") y_axis = graph.Add("axis") xy = graph.Add("xy") xy.xData.val = denom xy.yData.val = numerator _format_points(xy) coef = regress(x=denom, y=numerator) fit_y = regress_ci(coef=coef, x=fine_x) fit_y_str = "_".join([grp_name, num_name]) embed.SetData( fit_y_str, fit_y[0, :], poserr=abs(fit_y[2, :] - fit_y[0, :]), negerr=abs(fit_y[0, :] - fit_y[1, :]) ) fit_xy = graph.Add("xy") fit_xy.xData.val = fine_x fit_xy.yData.val = fit_y_str fit_xy.MarkerFill.hide.val = fit_xy.MarkerLine.hide.val = True fit_xy.errorStyle.val = "linevert" fit_xy.ErrorBarLine.style.val = "dashed" x_axis.label.val = "No-surround threshold" y_axis.label.val = "{s:s} threshold".format( s=nice_surrs[num_name] ) x_axis.min.val = 0.0 x_axis.max.val = study_limits[grp_name]["x"] y_axis.min.val = 0.0 y_axis.max.val = study_limits[grp_name]["y"][num_name] x_axis.outerticks.val = y_axis.outerticks.val = True # now, the ratio graph = grid.Add("graph", autoadd=False) x_axis = graph.Add("axis") y_axis = graph.Add("axis") x_axis.outerticks.val = y_axis.outerticks.val = True ratio = numerator / denom # take the log ratio if the study is Serrano-Pedraza et al. if study == "s-p": ratio = np.log(ratio) xy = graph.Add("xy") xy.xData.val = denom xy.yData.val = ratio _format_points(xy) # calculate the correlation (r, p) = scipy.stats.spearmanr(denom, ratio) c_str = "\italic{{r}}_{{s}} = {r:.2f}\\\\\italic{{p}} = {p:.3f}".format(r=r, p=p) c_label = graph.Add("label") c_label.label.val = c_str c_label.xPos.val = 0.75 c_label.yPos.val = 0.8 c_label.Text.size.val = "6pt" x_axis.label.val = "No-surround threshold" y_axis.label.val = "{s:s} suppression index".format( s=nice_surrs[num_name] ) x_axis.min.val = 0.0 x_axis.max.val = study_limits[grp_name]["x"] (y_axis.min.val, y_axis.max.val) = study_limits[grp_name]["r"][num_name] stem = os.path.join( conf.figures_path, "_".join(("ss_timing", study)) ) #embed.Zoom(0.5) embed.Save(stem + ".vsz") embed.Export(stem + ".pdf") embed.WaitForClose()