예제 #1
0
def plot_cluster_error(ax):

    res_ftemp = "spatial_analysis/{}_{}_ifs.pkz"
    for exp in ["dots", "sticks"]:

        subjects = get_subject_order(exp)
        color = get_colormap(exp, as_cmap=False)[20]

        errs = []
        for subj in subjects:

            res = moss.load_pkl(res_ftemp.format(subj, exp))
            x = res.steps

            norm = res.null.mean()
            errs.append(res.real / norm)

        errs = np.vstack(errs)
        mean = errs.mean(axis=0)
        ax.plot(x, mean, color=color, lw=2)
        sem = stats.sem(errs, axis=0)
        ax.fill_between(x, mean - sem, mean + sem, alpha=.2, color=color)

    ax.axhline(y=1,
               lw=1,
               dashes=[5, 2],
               color=".5",
               zorder=0,
               xmin=.02,
               xmax=.98)

    ax.set(xlim=(0, 42),
           ylim=(.55, 1.45),
           yticks=[.6, .8, 1, 1.2, 1.4],
           xticks=[0, 10, 20, 30, 40],
           xlabel="Neighborhood radius (mm)",
           ylabel="Normalized error")

    sns.despine(ax=ax, trim=True)
예제 #2
0
                mec=".2",
                ms=3)

        ax.set(xticks=x, xlim=(.6, 4.4), ylim=(0, .07))
        sns.despine(ax=ax, trim=True)

    plt.setp(axes[1:], yticklabels=[])
    axes[0].set_ylabel("Correlation (r)")


if __name__ == "__main__":

    set_style()
    f, axes = setup_figure()

    subjects = get_subject_order("sticks")

    plot_time_corrs(subjects, axes)

    axes[0].text(2.5, .041, "Same context", color=".2", size=7, ha="center")
    axes[0].text(2.9,
                 .014,
                 "Different\ncontext",
                 color=".5",
                 size=7,
                 ha="center")
    f.text(.55, .03, "Resting scan number", size=10, ha="center")

    f.tight_layout()
    f.subplots_adjust(bottom=.2)
예제 #3
0
    ylabel = "Subnetwork strength\n($r_{\mathrm{same}} - r_{\mathrm{diff}}$)"
    plt.setp(axes[1:7], yticklabels=[])
    axes[0].set_ylabel(ylabel)

    if exp == "dots":
        plt.setp(axes[8:], yticklabels=[])
        plt.setp(axes[:7], xticklabels=[])
        axes[7].set_ylabel(ylabel)


if __name__ == "__main__":

    set_style()
    f, dots_axes, sticks_axes, rest_axes = setup_figure()

    dots_subjects = get_subject_order("dots")
    sticks_subjects = get_subject_order("sticks")

    plot_distance_corrs(dots_subjects, dots_axes, "dots")
    plot_distance_corrs(sticks_subjects, sticks_axes, "sticks")
    plot_distance_corrs(sticks_subjects, rest_axes, "rest")

    f.text(.525, .01, "Distance threshold (mm)", size=10, ha="center")
    f.text(.525, .95, "Experiment 1 (residuals)", size=11, ha="center")
    f.text(.525, .50, "Experiment 2 (residuals)", size=11, ha="center")
    f.text(.525, .25, "Experiment 2 (resting)", size=11, ha="center")

    dots_axes[0].text(10, .038, "2D Distance", color=".2", size=7)
    dots_axes[0].text(10, .005, "3D Distance", color=".5", size=7)

    savefig(f, __file__)
예제 #4
0
    return f, brain_axes, hist_axes, cbar_ax


def plot_colorbar(f, ax):

    cmap = get_colormap("dots")

    xx = np.arange(200).reshape(1, 200)

    ax.imshow(xx, rasterized=True, aspect="auto", cmap=cmap)

    kws = dict(size=7, ha="center")
    f.text(.35, .04, "Motion", **kws)
    f.text(.65, .04, "Color", **kws)

    ax.set(xticks=[], yticks=[])


if __name__ == "__main__":

    set_style()
    f, brain_axes, hist_axes, cbar_ax = setup_figure()

    subjects = get_subject_order("dots")

    plot_brains(subjects, brain_axes)
    plot_hists(subjects, hist_axes, 2, 380)
    plot_colorbar(f, cbar_ax)

    savefig(f, __file__)