axs_diff[cur_row, 0].errorbar(x[-1] + (x[-1] - x[0]) * 0.14,
                                      phadke_max_mean,
                                      yerr=phadke_max_sd,
                                      color=color_map.colors[1],
                                      marker=markers[1],
                                      capsize=3)
        axs_diff[cur_row, 0].errorbar(x[-1] + (x[-1] - x[0]) * 0.12,
                                      true_max_mean,
                                      yerr=true_max_sd,
                                      color=color_map.colors[2],
                                      marker=markers[2],
                                      capsize=3)

        # plot spm
        isb_t_ln = spm_plot(axs_diff[cur_row, 1], x[1:], isb_vs_true,
                            dict(color=color_map.colors[0], alpha=0.25),
                            dict(color=color_map.colors[0]))
        phadke_t_ln = spm_plot(axs_diff[cur_row, 1], x[1:], phadke_vs_true,
                               dict(color=color_map.colors[1], alpha=0.25),
                               dict(color=color_map.colors[1]))

        axs_diff_dist[cur_row].axhline(0.05, ls='--')
        isb_vs_true_dist_ln = axs_diff_dist[cur_row].plot(
            x[1:], isb_vs_true_dist[1], color=color_map.colors[0])
        phadke_vs_true_dist_ln = axs_diff_dist[cur_row].plot(
            x[1:], phadke_vs_true_dist[1], color=color_map.colors[1])
        leg_patch_dist.append(isb_vs_true_dist_ln[0])
        leg_patch_dist.append(phadke_vs_true_dist_ln[0])

        if idx == 0:
            leg_patch_mean.append(isb_ln[0])
예제 #2
0
        true_ln = mean_sd_plot(
            axs_diff0[cur_row, 0], x, true_mean, true_sd,
            dict(color=color_map.colors[2], alpha=0.25),
            dict(color=color_map.colors[2], marker=markers[2], markevery=20))
        phadke_ln = mean_sd_plot(
            axs_diff0[cur_row, 0], x, phadke_mean, phadke_sd,
            dict(color=color_map.colors[1], alpha=0.25),
            dict(color=color_map.colors[1], marker=markers[1], markevery=20))
        isb_ln = mean_sd_plot(
            axs_diff0[cur_row, 0], x, isb_mean, isb_sd,
            dict(color=color_map.colors[0], alpha=0.3),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))

        # plot spm
        isb_t_ln = spm_plot(axs_diff0[cur_row, 1], x[1:], isb_zero,
                            dict(color=color_map.colors[0], alpha=0.25),
                            dict(color=color_map.colors[0]))
        phadke_t_ln = spm_plot(axs_diff0[cur_row, 1], x[1:], phadke_zero,
                               dict(color=color_map.colors[1], alpha=0.25),
                               dict(color=color_map.colors[1]))
        true_t_ln = spm_plot(axs_diff0[cur_row, 1], x[1:], true_zero,
                             dict(color=color_map.colors[2], alpha=0.25),
                             dict(color=color_map.colors[2]))

        axs_diff0_dist[cur_row].axhline(0.05, ls='--')
        isb_dist_ln = axs_diff0_dist[cur_row].plot(x[1:],
                                                   isb_zero_norm[1],
                                                   color=color_map.colors[0])
        phadke_dist_ln = axs_diff0_dist[cur_row].plot(
            x[1:], phadke_zero_norm[1], color=color_map.colors[1])
        true_dist_ln = axs_diff0_dist[cur_row].plot(x[1:],
            'FE': 3
        })).to_numpy(dtype=np.int)
        subj_rm = (db_elev_equal['Subject_Short'].map(subj_name_to_number)
                   ).to_numpy()
        spm_one_way_rm_true = spm1d.stats.anova1rm(
            all_traj_true_rm[:, 1:], group_rm, subj_rm).inference(alpha=0.05)
        spm_one_way_rm_isb = spm1d.stats.anova1rm(
            all_traj_isb_rm[:, 1:], group_rm, subj_rm).inference(alpha=0.05)
        spm_one_way_rm_phadke = spm1d.stats.anova1rm(
            all_traj_phadke_rm[:, 1:], group_rm, subj_rm).inference(alpha=0.05)

        shaded_spm = dict(color=color_map.colors[4], alpha=0.25)
        line_spm = dict(color=color_map.colors[5])
        shaded_spm_rm = dict(color=color_map.colors[6], alpha=0.25)
        line_spm_rm = dict(color=color_map.colors[7])
        one_way_ln_true = spm_plot(axs_plane[0, 1], x[1:], spm_one_way_true,
                                   shaded_spm, line_spm)
        one_way_ln_isb = spm_plot(axs_plane[1, 1], x[1:], spm_one_way_isb,
                                  shaded_spm, line_spm)
        one_way_ln_phadke = spm_plot(axs_plane[2, 1], x[1:],
                                     spm_one_way_phadke, shaded_spm, line_spm)
        one_way_rm_ln_true = spm_plot(axs_plane[0,
                                                1], x[1:], spm_one_way_rm_true,
                                      shaded_spm_rm, line_spm_rm)
        one_way_rm_ln_isb = spm_plot(axs_plane[1,
                                               1], x[1:], spm_one_way_rm_isb,
                                     shaded_spm_rm, line_spm_rm)
        one_way_rm_ln_phadke = spm_plot(axs_plane[2, 1], x[1:],
                                        spm_one_way_rm_phadke, shaded_spm_rm,
                                        line_spm_rm)

        mean_lns = []
예제 #4
0
                                 shaded_m, line_m)
        f_true_ln = mean_sd_plot(axs_gender[0, 0], x, true_mean_f, true_sd_f,
                                 shaded_f, line_f)
        m_isb_ln = mean_sd_plot(axs_gender[1, 0], x, isb_mean_m, isb_sd_m,
                                shaded_m, line_m)
        f_isb_ln = mean_sd_plot(axs_gender[1, 0], x, isb_mean_f, isb_sd_f,
                                shaded_f, line_f)
        m_phadke_ln = mean_sd_plot(axs_gender[2, 0], x, phadke_mean_m,
                                   phadke_sd_m, shaded_m, line_m)
        f_phadke_ln = mean_sd_plot(axs_gender[2, 0], x, phadke_mean_f,
                                   phadke_sd_f, shaded_f, line_f)

        # plot spm
        spm_shaded = dict(color=color_map.colors[2], alpha=0.25)
        spm_line = dict(color=color_map.colors[2])
        true_spm_ln = spm_plot(axs_gender[0, 1], x[1:], m_v_f_true, spm_shaded,
                               spm_line)
        isb_spm_ln = spm_plot(axs_gender[1, 1], x[1:], m_v_f_isb, spm_shaded,
                              spm_line)
        phadke_spm_ln = spm_plot(axs_gender[2, 1], x[1:], m_v_f_phadke,
                                 spm_shaded, spm_line)

        # figure title and legend
        plt.tight_layout(pad=0.25, h_pad=1.5, w_pad=0.5)
        fig_gender.suptitle(activity +
                            ' Glenohumeral Axial Rotation Comparison',
                            x=0.5,
                            y=0.99,
                            fontweight='bold')
        plt.subplots_adjust(top=0.93)
        axs_gender[0, 0].legend([m_true_ln[0], f_true_ln[0]],
                                ['Male', 'Female'],
예제 #5
0
            ..., np.newaxis]

        gc_vs_ac_orient = spm1d.stats.ttest_paired(
            all_traj_axial_ac, all_traj_axial_gc).inference(alpha,
                                                            two_tailed=True)
        gc_vs_ac_rot = spm1d.stats.ttest_paired(
            all_traj_axial_ac_norm[:, 1:],
            all_traj_axial_gc_norm[:, 1:]).inference(alpha, two_tailed=True)
        gc_vs_ac_rot_norm_start = spm1d.stats.ttest_paired(
            all_traj_axial_ac_norm_start,
            all_traj_axial_gc_norm_start).inference(alpha, two_tailed=True)

        # plot spm
        cur_row = act_row[activity.lower()]
        orient_ln = spm_plot(axs_axial_spm[cur_row, 0], x, gc_vs_ac_orient,
                             dict(color=color_map.colors[0], alpha=0.25),
                             dict(color=color_map.colors[0]))
        rotation_ln = spm_plot(axs_axial_spm[cur_row, 1], x[1:], gc_vs_ac_rot,
                               dict(color=color_map.colors[1], alpha=0.25),
                               dict(color=color_map.colors[1]))
        rotation_start_ln = spm_plot(
            axs_axial_spm[cur_row, 2], x, gc_vs_ac_rot_norm_start,
            dict(color=color_map.colors[2], alpha=0.25),
            dict(color=color_map.colors[2]))

        leg_patch_axial_spm.append(orient_ln[0])
        leg_patch_axial_spm.append(rotation_start_ln[0])
        leg_patch_axial_spm.append(rotation_ln[0])

    # figure title and axes legends
    plt.tight_layout(pad=0.25, h_pad=2.0, w_pad=0.5)
                                    true_sd_lt35, shaded_lt35, line_lt35)
        gt45_true_ln = mean_sd_plot(axs_age[0, 0], x, true_mean_gt45,
                                    true_sd_gt45, shaded_gt45, line_gt45)
        lt35_isb_ln = mean_sd_plot(axs_age[1, 0], x, isb_mean_lt35,
                                   isb_sd_lt35, shaded_lt35, line_lt35)
        gt45_isb_ln = mean_sd_plot(axs_age[1, 0], x, isb_mean_gt45,
                                   isb_sd_gt45, shaded_gt45, line_gt45)
        lt35_phadke_ln = mean_sd_plot(axs_age[2, 0], x, phadke_mean_lt35,
                                      phadke_sd_lt35, shaded_lt35, line_lt35)
        gt45_phadke_ln = mean_sd_plot(axs_age[2, 0], x, phadke_mean_gt45,
                                      phadke_sd_gt45, shaded_gt45, line_gt45)

        # plot spm
        spm_shaded = dict(color=color_map.colors[2], alpha=0.25)
        spm_line = dict(color=color_map.colors[2])
        true_spm_ln = spm_plot(axs_age[0, 1], x[1:], lt35_v_gt45_true,
                               spm_shaded, spm_line)
        isb_spm_ln = spm_plot(axs_age[1, 1], x[1:], lt35_v_gt45_isb,
                              spm_shaded, spm_line)
        phadke_spm_ln = spm_plot(axs_age[2, 1], x[1:], lt35_v_gt45_phadke,
                                 spm_shaded, spm_line)

        # figure title and legend
        plt.tight_layout(pad=0.25, h_pad=1.5, w_pad=0.5)
        fig_age.suptitle(activity + ' Glenohumeral Axial Rotation Comparison',
                         x=0.5,
                         y=0.99,
                         fontweight='bold')
        plt.subplots_adjust(top=0.93)
        axs_age[0, 0].legend([lt35_true_ln[0], gt45_true_ln[0]],
                             ['Less Than 35', 'Greater Than 45'],
                             loc='upper left',
                                  true_sd_up, shaded_up, line_up)
        down_true_ln = mean_sd_plot(axs_updown[0, 0], x, true_mean_down,
                                    true_sd_down, shaded_down, line_down)
        up_isb_ln = mean_sd_plot(axs_updown[1, 0], x, isb_mean_up, isb_sd_up,
                                 shaded_up, line_up)
        down_isb_ln = mean_sd_plot(axs_updown[1, 0], x, isb_mean_down,
                                   isb_sd_down, shaded_down, line_down)
        up_phadke_ln = mean_sd_plot(axs_updown[2, 0], x, phadke_mean_up,
                                    phadke_sd_up, shaded_up, line_up)
        down_phadke_ln = mean_sd_plot(axs_updown[2, 0], x, phadke_mean_down,
                                      phadke_sd_down, shaded_down, line_down)

        # plot spm
        spm_shaded = dict(color=color_map.colors[2], alpha=0.25)
        spm_line = dict(color=color_map.colors[2])
        true_spm_ln = spm_plot(axs_updown[0, 1], x[1:], up_v_down_true,
                               spm_shaded, spm_line)
        isb_spm_ln = spm_plot(axs_updown[1, 1], x[1:], up_v_down_isb,
                              spm_shaded, spm_line)
        phadke_spm_ln = spm_plot(axs_updown[2, 1], x[1:], up_v_down_phadke,
                                 spm_shaded, spm_line)

        # figure title and legend
        plt.tight_layout(pad=0.25, h_pad=1.5, w_pad=0.5)
        fig_updown.suptitle(
            activity + ' Glenohumeral Up vs Down Axial Rotation Comparison',
            x=0.5,
            y=0.99,
            fontweight='bold')
        plt.subplots_adjust(top=0.93)
        axs_updown[0, 0].legend([up_true_ln[0], down_true_ln[0]],
                                ['Up', 'Down'],