print(extract_sig(induced_zero, x))
        print('Max: {:.2f}'.format(np.max(np.absolute(induced_mean))))
        print('LatMed')
        print(extract_sig(induced_x_zero, x))
        print('Max: {:.2f}'.format(np.max(np.absolute(induced_mean_x))))
        print('RePro')
        print(extract_sig(induced_y_zero, x))
        print('Max: {:.2f}'.format(np.max(np.absolute(induced_mean_y))))
        print('Tilt')
        print(extract_sig(induced_z_zero, x))
        print('Max: {:.2f}'.format(np.max(np.absolute(induced_mean_z))))

        # plot mean +- sd
        cur_row = act_row[activity.lower()]
        induced_ln = mean_sd_plot(
            axs_axial[cur_row, 0], x, induced_mean, induced_sd,
            dict(color=color_map.colors[0], alpha=0.2, hatch='ooo'),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        induced_x_ln = mean_sd_plot(
            axs_axial[cur_row, 0], x, induced_mean_x, induced_sd_x,
            dict(color=color_map.colors[1], alpha=0.3),
            dict(color=color_map.colors[1], marker=markers[1], markevery=20))
        induced_y_ln = mean_sd_plot(
            axs_axial[cur_row, 0], x, induced_mean_y, induced_sd_y,
            dict(color=color_map.colors[7], alpha=0.3),
            dict(color=color_map.colors[7], marker=markers[2], markevery=20))
        induced_z_ln = mean_sd_plot(
            axs_axial[cur_row, 0], x, induced_mean_z, induced_sd_z,
            dict(color=color_map.colors[3], alpha=0.2, hatch='xxx'),
            dict(color=color_map.colors[3], marker=markers[3], markevery=20))

        # plot spm
Ejemplo n.º 2
0
        gh_mean = np.rad2deg(np.mean(traj_gh, axis=0))
        ht_sd = np.rad2deg(np.std(traj_ht, axis=0, ddof=1))
        st_sd = np.rad2deg(np.std(traj_st, axis=0, ddof=1))
        gh_sd = np.rad2deg(np.std(traj_gh, axis=0, ddof=1))

        ht_max_mean = np.rad2deg(np.mean(traj_ht_max, axis=0))
        st_max_mean = np.rad2deg(np.mean(traj_st_max, axis=0))
        gh_max_mean = np.rad2deg(np.mean(traj_gh_max, axis=0))
        ht_max_sd = np.rad2deg(np.std(traj_ht_max, axis=0, ddof=1))
        st_max_sd = np.rad2deg(np.std(traj_st_max, axis=0, ddof=1))
        gh_max_sd = np.rad2deg(np.std(traj_gh_max, axis=0, ddof=1))

        # plot mean +- sd
        cur_row = act_row[activity.lower()]
        gh_ln = mean_sd_plot(axs_elev[cur_row], x_elev, gh_mean, gh_sd,
                             dict(color=color_map.colors[0], alpha=0.25, hatch='...'),
                             dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        st_ln = mean_sd_plot(axs_elev[cur_row], x_elev, st_mean, st_sd,
                             dict(color=color_map.colors[1], alpha=0.25),
                             dict(color=color_map.colors[1], marker=markers[1], markevery=20))
        ht_ln = mean_sd_plot(axs_elev[cur_row], x_elev, ht_mean, ht_sd,
                             dict(color=color_map.colors[2], alpha=0.25),
                             dict(color=color_map.colors[2], marker=markers[2], markevery=20))

        axs_elev[cur_row].errorbar(max_pos, gh_max_mean, yerr=gh_max_sd, color=color_map.colors[0],
                                   marker=markers[0], capsize=3)
        axs_elev[cur_row].errorbar(max_pos + 3, st_max_mean, yerr=st_max_sd, color=color_map.colors[1],
                                   marker=markers[1], capsize=3)
        axs_elev[cur_row].errorbar(max_pos - 3, ht_max_mean, yerr=ht_max_sd, color=color_map.colors[2],
                                   marker=markers[2], capsize=3)
        st_lt35_mean = np.rad2deg(np.mean(traj_st_lt35, axis=0))
        st_gt45_mean = np.rad2deg(np.mean(traj_st_gt45, axis=0))
        gh_lt35_mean = np.rad2deg(np.mean(traj_gh_lt35, axis=0))
        gh_gt45_mean = np.rad2deg(np.mean(traj_gh_gt45, axis=0))

        # sds
        ht_lt35_sd = np.rad2deg(np.std(traj_ht_lt35, axis=0, ddof=1))
        ht_gt45_sd = np.rad2deg(np.std(traj_ht_gt45, axis=0, ddof=1))
        st_lt35_sd = np.rad2deg(np.std(traj_st_lt35, axis=0, ddof=1))
        st_gt45_sd = np.rad2deg(np.std(traj_st_gt45, axis=0, ddof=1))
        gh_lt35_sd = np.rad2deg(np.std(traj_gh_lt35, axis=0, ddof=1))
        gh_gt45_sd = np.rad2deg(np.std(traj_gh_gt45, axis=0, ddof=1))

        # plots mean +- sd
        ht_lt35_ln = mean_sd_plot(
            axs[idx_act, 0], x, ht_lt35_mean, ht_lt35_sd,
            dict(color=color_map.colors[0], alpha=0.2),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        ht_gt45_ln = mean_sd_plot(
            axs[idx_act, 0], x, ht_gt45_mean, ht_gt45_sd,
            dict(color=color_map.colors[1], alpha=0.2),
            dict(color=color_map.colors[1], marker=markers[1], markevery=20))

        st_lt35_ln = mean_sd_plot(
            axs[idx_act, 1], x, st_lt35_mean, st_lt35_sd,
            dict(color=color_map.colors[0], alpha=0.2),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        st_gt45_ln = mean_sd_plot(
            axs[idx_act, 1], x, st_gt45_mean, st_gt45_sd,
            dict(color=color_map.colors[1], alpha=0.2),
            dict(color=color_map.colors[1], marker=markers[1], markevery=20))
Ejemplo n.º 4
0
                                                          **infer_params)

        print('Activity: {}'.format(activity))
        print('HT')
        print(extract_sig(ht_zero, x))
        print('GH')
        print(extract_sig(gh_zero, x))
        print('Min axial rotation: {:.2f} max axial rotation: {:.2f}'.format(
            np.min(true_mean_gh), np.max(true_mean_gh)))
        print('ST')
        print(extract_sig(st_zero, x))

        # plot mean +- sd
        cur_row = act_row[activity.lower()]
        true_gh_ln = mean_sd_plot(
            axs_axial[cur_row, 0], x, true_mean_gh, true_sd_gh,
            dict(color=color_map.colors[0], alpha=0.25, hatch='...'),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        true_st_ln = mean_sd_plot(
            axs_axial[cur_row, 0], x, true_mean_st, true_sd_st,
            dict(color=color_map.colors[1], alpha=0.25),
            dict(color=color_map.colors[1], marker=markers[1], markevery=20))
        true_ht_ln = mean_sd_plot(
            axs_axial[cur_row, 0], x, true_mean_ht, true_sd_ht,
            dict(color=color_map.colors[2], alpha=0.25),
            dict(color=color_map.colors[2], marker=markers[2], markevery=20))

        # plot spm
        ht_t_ln, ht_alpha = spm_plot_alpha(
            axs_axial[cur_row, 1], x, ht_zero,
            dict(color=color_map.colors[2], alpha=0.25),
            dict(color=color_map.colors[2]))
            np.std(act_all_traj_induced_z, ddof=1, axis=0))

        # plot mean +- sd
        shaded = dict(color=color_map.colors[idx], alpha=0.2)
        if activity == 'CA':
            shaded['hatch'] = 'oo'
        if activity == 'SA':
            shaded['alpha'] = 0.28
        if activity == 'FE':
            shaded['alpha'] = 0.3

        line = dict(color=color_map.colors[idx],
                    marker=markers[idx],
                    markevery=20)

        induced_ln = mean_sd_plot(axs_plane[0, 0], x, induced_mean, induced_sd,
                                  shaded, line)
        induced_x_ln = mean_sd_plot(axs_plane[1, 0], x, induced_mean_x,
                                    induced_sd_x, shaded, line)
        induced_y_ln = mean_sd_plot(axs_plane[2, 0], x, induced_mean_y,
                                    induced_sd_y, shaded, line)
        induced_z_ln = mean_sd_plot(axs_plane[3, 0], x, induced_mean_z,
                                    induced_sd_z, shaded, line)

        mean_lns_start.append(induced_ln[0])
        activities_start.append(activity)

    # figure title and legend
    plt.tight_layout(pad=0.5, h_pad=1.5, w_pad=0.5)
    fig_plane.suptitle('ST-induced HT Axial Rotation Comparison by Plane',
                       x=0.5,
                       y=0.99,
        st_contrib_max_sd = np.rad2deg(np.std(st_contrib_max, ddof=1, axis=0))
        gh_euler_max_sd = np.rad2deg(np.std(gh_euler_max, ddof=1, axis=0))
        gh_contrib_max_sd = np.rad2deg(np.std(gh_contrib_max, ddof=1, axis=0))

        # spm
        st_spm = spm_test(st_euler, st_contrib).inference(alpha,
                                                          two_tailed=True,
                                                          **infer_params)
        gh_spm = spm_test(gh_euler, gh_contrib).inference(alpha,
                                                          two_tailed=True,
                                                          **infer_params)

        # plot mean +- sd
        cur_row = act_row[activity.lower()]
        st_euler_ln = mean_sd_plot(
            axs[cur_row, 0], x, st_euler_mean, st_euler_sd,
            dict(color=color_map.colors[0], alpha=0.25),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        st_contrib_ln = mean_sd_plot(
            axs[cur_row, 0], x, st_contrib_mean, st_contrib_sd,
            dict(color=color_map.colors[1], alpha=0.25),
            dict(color=color_map.colors[1], marker=markers[1], markevery=20))
        gh_euler_ln = mean_sd_plot(
            axs[cur_row, 1], x, gh_euler_mean, gh_euler_sd,
            dict(color=color_map.colors[0], alpha=0.25),
            dict(color=color_map.colors[0], marker=markers[2], markevery=20))
        gh_contrib_ln = mean_sd_plot(
            axs[cur_row, 1], x, gh_contrib_mean, gh_contrib_sd,
            dict(color=color_map.colors[1], alpha=0.25),
            dict(color=color_map.colors[1], marker=markers[3], markevery=20))

        axs[cur_row, 0].errorbar(max_pos - 3,
Ejemplo n.º 7
0
        st_poe_mean = np.nanmean(st_poe_per, axis=0)
        gh_elev_mean = np.nanmean(gh_elev_per, axis=0)
        gh_axial_mean = np.nanmean(gh_axial_per, axis=0)
        gh_poe_mean = np.nanmean(gh_poe_per, axis=0)

        st_elev_sd = np.nanstd(st_elev_per, axis=0, ddof=1)
        st_axial_sd = np.nanstd(st_axial_per, axis=0, ddof=1)
        st_poe_sd = np.nanstd(st_poe_per, axis=0, ddof=1)
        gh_elev_sd = np.nanstd(gh_elev_per, axis=0, ddof=1)
        gh_axial_sd = np.nanstd(gh_axial_per, axis=0, ddof=1)
        gh_poe_sd = np.nanstd(gh_poe_per, axis=0, ddof=1)

        # plot mean +- sd
        cur_row = act_row[activity.lower()]
        st_elev_ln = mean_sd_plot(
            axs[cur_row, 0], x, st_elev_mean, st_elev_sd,
            dict(color=color_map.colors[0], alpha=0.25),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        st_axial_ln = mean_sd_plot(
            axs[cur_row, 0], x, st_axial_mean, st_axial_sd,
            dict(color=color_map.colors[1], alpha=0.25),
            dict(color=color_map.colors[1], marker=markers[0], markevery=20))
        st_poe_ln = mean_sd_plot(
            axs[cur_row, 0], x, st_poe_mean, st_poe_sd,
            dict(color=color_map.colors[2], alpha=0.25),
            dict(color=color_map.colors[2], marker=markers[0], markevery=20))

        gh_elev_ln = mean_sd_plot(
            axs[cur_row, 1], x, gh_elev_mean, gh_elev_sd,
            dict(color=color_map.colors[0], alpha=0.25),
            dict(color=color_map.colors[0], marker=markers[1], markevery=20))
        gh_axial_ln = mean_sd_plot(
Ejemplo n.º 8
0
                                   all_traj_ht_gt45).inference(alpha,
                                                               two_tailed=True,
                                                               **infer_params)
        st_lt35_vs_gt35 = spm_test(all_traj_st_lt35,
                                   all_traj_st_gt45).inference(alpha,
                                                               two_tailed=True,
                                                               **infer_params)
        gh_lt35_vs_gt35 = spm_test(all_traj_gh_lt35,
                                   all_traj_gh_gt45).inference(alpha,
                                                               two_tailed=True,
                                                               **infer_params)

        # plot mean and SD
        cur_row = act_row[activity.lower()]
        ht_ln_lt35 = mean_sd_plot(
            axs[cur_row, 0], x, ht_mean_lt35, ht_sd_lt35,
            dict(color=color_map.colors[0], alpha=0.25),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        st_ln_lt35 = mean_sd_plot(
            axs[cur_row, 1], x, st_mean_lt35, st_sd_lt35,
            dict(color=color_map.colors[0], alpha=0.25),
            dict(color=color_map.colors[0], marker=markers[1], markevery=20))
        gh_ln_lt35 = mean_sd_plot(
            axs[cur_row, 2], x, gh_mean_lt35, gh_sd_lt35,
            dict(color=color_map.colors[0], alpha=0.25),
            dict(color=color_map.colors[0], marker=markers[2], markevery=20))

        ht_ln_gt45 = mean_sd_plot(
            axs[cur_row, 0], x, ht_mean_gt45, ht_sd_gt45,
            dict(color=color_map.colors[1], alpha=0.25),
            dict(color=color_map.colors[1], marker=markers[0], markevery=20))
        st_ln_gt45 = mean_sd_plot(
Ejemplo n.º 9
0
            np.std(ht_euler_ur_elev_diff_max, axis=0, ddof=1))
        ht_contrib_max_sd = np.rad2deg(
            np.std(ht_euler_contrib_diff_max, axis=0, ddof=1))

        # spm
        ht_euler_diff_vs_euler_add = spm_test(ht_euler_ur_elev_diff,
                                              0).inference(alpha,
                                                           two_tailed=True,
                                                           **infer_params)
        # ht_euler_diff_vs_contribs = spm_test(ht_euler_contrib_diff, 0).inference(alpha, two_tailed=True,
        #                                                                          **infer_params)

        # plot mean +- sd
        cur_row = act_row[activity.lower()]
        ht_euler_add_ln = mean_sd_plot(
            axs[cur_row], x, ht_euler_add_mean, ht_euler_add_sd,
            dict(color=color_map.colors[0], alpha=0.25),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        ht_contribs_ln = mean_sd_plot(
            axs[cur_row], x, ht_contrib_mean, ht_contrib_sd,
            dict(color=color_map.colors[1], alpha=0.25),
            dict(color=color_map.colors[1], marker=markers[1], markevery=20))

        # plot at max
        axs[cur_row].errorbar(max_pos,
                              ht_euler_add_max_mean,
                              yerr=ht_euler_add_max_sd,
                              color=color_map.colors[0],
                              marker=markers[0],
                              capsize=3)
        axs[cur_row].errorbar(max_pos - 3,
                              ht_contrib_max_mean,
Ejemplo n.º 10
0
            extract_sub_rot_norm,
            args=['st', 'common_fine_up', 'contribs', 2, 'up']),
                                 axis=0)

        # means and standard deviations
        poe_mean = np.rad2deg(np.mean(traj_poe, axis=0))
        st_axial_mean = np.rad2deg(np.mean(traj_st_axial, axis=0))
        poe_sd = np.rad2deg(np.std(traj_poe, axis=0, ddof=1))
        st_axial_sd = np.rad2deg(np.std(traj_st_axial, axis=0, ddof=1))

        color = color_map.colors[colors[activity.lower()]]
        marker = markers[activity.lower()]
        # plot mean and SD
        poe_ln = mean_sd_plot(
            axs_elev[0], x_elev, poe_mean, poe_sd,
            dict(color=color,
                 alpha=0.25,
                 hatch='oo' if activity == 'CA' else None),
            dict(color=color, marker=marker, markevery=20, ms=4))
        st_axial_ln = mean_sd_plot(
            axs_elev[1], x_elev, st_axial_mean, st_axial_sd,
            dict(color=color,
                 alpha=0.25,
                 hatch='oo' if activity == 'CA' else None),
            dict(color=color, marker=marker, markevery=20, ms=4))

        # at maximum
        traj_poe_max = np.stack(activity_df['traj_interp'].apply(
            sub_rot_at_max_elev, args=['gh', 'euler.gh_phadke', 1, None]),
                                axis=0)
        traj_st_axial_max = np.stack(activity_df['traj_interp'].apply(
            sub_rot_at_max_elev, args=['st', 'contribs', 2, 'up']),
Ejemplo n.º 11
0
        # means
        latmed_mean = np.rad2deg(np.mean(all_traj_latmed, axis=0))
        repro_mean = np.rad2deg(np.mean(all_traj_repro, axis=0))
        tilt_mean = np.rad2deg(np.mean(all_traj_tilt, axis=0))
        total_mean = np.rad2deg(np.mean(all_traj_total, axis=0))

        # sds
        latmed_sd = np.rad2deg(np.std(all_traj_latmed, ddof=1, axis=0))
        repro_sd = np.rad2deg(np.std(all_traj_repro, ddof=1, axis=0))
        tilt_sd = np.rad2deg(np.std(all_traj_tilt, ddof=1, axis=0))
        total_sd = np.rad2deg(np.std(all_traj_total, ddof=1, axis=0))

        # plots mean +- sd
        repro_ln = mean_sd_plot(
            axs[idx_act, 0], x, repro_mean, repro_sd,
            dict(color=color_map.colors[1], alpha=0.2),
            dict(color=color_map.colors[1], marker=markers[1], markevery=20))
        total_ln = mean_sd_plot(
            axs[idx_act, 0], x, total_mean, total_sd,
            dict(color=color_map.colors[2], alpha=0.2, hatch='ooo'),
            dict(color=color_map.colors[2], marker=markers[2], markevery=20))
        tilt_ln = mean_sd_plot(
            axs[idx_act, 0], x, tilt_mean, tilt_sd,
            dict(color=color_map.colors[7], alpha=0.2),
            dict(color=color_map.colors[7], marker=markers[3], markevery=20))
        latmed_ln = mean_sd_plot(
            axs[idx_act, 0], x, latmed_mean, latmed_sd,
            dict(color=color_map.colors[0], alpha=0.2, hatch='xxx'),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))

        ax_inset = axs[idx_act, 0].inset_axes([0.02, 0.05, 0.1, 0.5])
        st_sd_y = np.rad2deg(np.std(traj_st_y, ddof=1, axis=0))
        st_sd_z = np.rad2deg(np.std(traj_st_z, ddof=1, axis=0))

        st_max_mean = np.rad2deg(np.mean(traj_st_max, axis=0))
        st_max_mean_x = np.rad2deg(np.mean(traj_st_max_x, axis=0))
        st_max_mean_y = np.rad2deg(np.mean(traj_st_max_y, axis=0))
        st_max_mean_z = np.rad2deg(np.mean(traj_st_max_z, axis=0))
        st_max_sd = np.rad2deg(np.std(traj_st_max, ddof=1, axis=0))
        st_max_sd_x = np.rad2deg(np.std(traj_st_max_x, ddof=1, axis=0))
        st_max_sd_y = np.rad2deg(np.std(traj_st_max_y, ddof=1, axis=0))
        st_max_sd_z = np.rad2deg(np.std(traj_st_max_z, ddof=1, axis=0))

        # plot mean +- sd
        cur_row = act_row[activity.lower()]
        st_ln = mean_sd_plot(
            axs_elev[cur_row], x_elev, st_mean, st_sd,
            dict(color=color_map.colors[0], alpha=0.2, hatch='ooo'),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        st_x_ln = mean_sd_plot(
            axs_elev[cur_row], x_elev, st_mean_x, st_sd_x,
            dict(color=color_map.colors[1], alpha=0.3),
            dict(color=color_map.colors[1], marker=markers[1], markevery=20))
        st_y_ln = mean_sd_plot(
            axs_elev[cur_row], x_elev, st_mean_y, st_sd_y,
            dict(color=color_map.colors[7], alpha=0.3),
            dict(color=color_map.colors[7], marker=markers[2], markevery=20))
        st_z_ln = mean_sd_plot(
            axs_elev[cur_row], x_elev, st_mean_z, st_sd_z,
            dict(color=color_map.colors[3], alpha=0.2, hatch='xxx'),
            dict(color=color_map.colors[3], marker=markers[3], markevery=20))

        axs_elev[cur_row].errorbar(max_pos,
                                 axis=0)

        # means and standard deviations
        poe_mean = np.rad2deg(np.mean(traj_poe, axis=0))
        st_axial_mean = np.rad2deg(np.mean(traj_st_axial, axis=0))
        poe_sd = np.rad2deg(np.std(traj_poe, axis=0, ddof=1))
        st_axial_sd = np.rad2deg(np.std(traj_st_axial, axis=0, ddof=1))

        st_axial_med = np.rad2deg(np.median(traj_st_axial, axis=0))
        st_axial_25 = np.rad2deg(np.quantile(traj_st_axial, 0.25, axis=0))
        st_axial_75 = np.rad2deg(np.quantile(traj_st_axial, 0.75, axis=0))

        # plot mean and SD
        poe_ln = mean_sd_plot(
            axs[0], x, poe_mean, poe_sd,
            dict(color=color_map.colors[act_idx], alpha=0.25),
            dict(color=color_map.colors[act_idx],
                 marker=markers[0],
                 markevery=20))
        st_axial_ln = mean_sd_plot(
            axs[1], x, st_axial_mean, st_axial_sd,
            dict(color=color_map.colors[act_idx], alpha=0.25),
            dict(color=color_map.colors[act_idx],
                 marker=markers[1],
                 markevery=20))

        # at maximum
        traj_poe_max = np.stack(activity_df['traj_interp'].apply(
            sub_rot_at_max_elev, args=['gh', 'euler.gh_phadke', 1, None]),
                                axis=0)
        traj_st_axial_max = np.stack(activity_df['traj_interp'].apply(
            sub_rot_at_max_elev, args=['st', 'contribs', 2, 'up']),
        # means and standard deviations
        st_lt35_mean = np.rad2deg(np.mean(traj_st_lt35, axis=0))
        st_gt45_mean = np.rad2deg(np.mean(traj_st_gt45, axis=0))
        st_lt35_max_mean = np.rad2deg(np.mean(traj_st_lt35_max, axis=0))
        st_gt45_max_mean = np.rad2deg(np.mean(traj_st_gt45_max, axis=0))

        st_lt35_sd = np.rad2deg(np.std(traj_st_lt35, axis=0, ddof=1))
        st_gt45_sd = np.rad2deg(np.std(traj_st_gt45, axis=0, ddof=1))
        st_lt35_max_sd = np.rad2deg(np.std(traj_st_lt35_max, axis=0, ddof=1))
        st_gt45_max_sd = np.rad2deg(np.std(traj_st_gt45_max, axis=0, ddof=1))

        # plot mean +- sd
        cur_row = act_row[activity.lower()]
        st_lt35_ln = mean_sd_plot(
            axs_elev[cur_row], x_elev, st_lt35_mean, st_lt35_sd,
            dict(color=color_map.colors[0], alpha=0.25),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        st_gt45_ln = mean_sd_plot(
            axs_elev[cur_row], x_elev, st_gt45_mean, st_gt45_sd,
            dict(color=color_map.colors[1], alpha=0.25),
            dict(color=color_map.colors[1], marker=markers[1], markevery=20))

        axs_elev[cur_row].errorbar(max_pos,
                                   st_lt35_max_mean,
                                   yerr=st_lt35_max_sd,
                                   color=color_map.colors[0],
                                   marker=markers[0],
                                   capsize=3)
        axs_elev[cur_row].errorbar(max_pos,
                                   st_gt45_max_mean,
                                   yerr=st_gt45_max_sd,
        new_shr_sd_gt45 = np.std(new_shr_gt45, ddof=1, axis=0)

        # spm
        spm_old = spm_test(old_shr_lt35, old_shr_gt45,
                           equal_var=False).inference(alpha,
                                                      two_tailed=True,
                                                      **infer_params)
        spm_new = spm_test(new_shr_lt35, new_shr_gt45,
                           equal_var=False).inference(alpha,
                                                      two_tailed=True,
                                                      **infer_params)

        # plot mean +- sd
        cur_row = act_row[activity.lower()]
        old_shr_ln_lt35 = mean_sd_plot(
            axs[cur_row, 0], x, old_shr_mean_lt35, old_shr_sd_lt35,
            dict(color=color_map.colors[0], alpha=0.25),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        old_shr_ln_gt45 = mean_sd_plot(
            axs[cur_row, 0], x, old_shr_mean_gt45, old_shr_sd_gt45,
            dict(color=color_map.colors[1], alpha=0.25),
            dict(color=color_map.colors[1], marker=markers[1], markevery=20))
        new_shr_ln_lt35 = mean_sd_plot(
            axs[cur_row, 1], x, new_shr_mean_lt35, new_shr_sd_lt35,
            dict(color=color_map.colors[0], alpha=0.25),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        new_shr_ln_gt45 = mean_sd_plot(
            axs[cur_row, 1], x, new_shr_mean_gt45, new_shr_sd_gt45,
            dict(color=color_map.colors[1], alpha=0.25),
            dict(color=color_map.colors[1], marker=markers[1], markevery=20))

        # plot spm
Ejemplo n.º 16
0
        # means and standard deviations
        old_shr_mean = np.mean(old_shr, axis=0)
        new_shr_mean = np.mean(new_shr, axis=0)

        old_shr_sd = np.std(old_shr, ddof=1, axis=0)
        new_shr_sd = np.std(new_shr, ddof=1, axis=0)

        # spm
        spm_res = spm_test(old_shr, new_shr).inference(alpha,
                                                       two_tailed=True,
                                                       **infer_params)

        # plot mean +- sd
        cur_row = act_row[activity.lower()]
        old_shr_ln = mean_sd_plot(
            axs[cur_row], x, old_shr_mean, old_shr_sd,
            dict(color=color_map.colors[0], alpha=0.25),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        new_shr_ln = mean_sd_plot(
            axs[cur_row], x, new_shr_mean, new_shr_sd,
            dict(color=color_map.colors[1], alpha=0.25),
            dict(color=color_map.colors[1], marker=markers[0], markevery=20))

        # plot spm
        x_sig = sig_filter(spm_res, x)
        axs[cur_row].plot(x_sig, np.repeat(12, x_sig.size), color='k', lw=2)

        if idx == 0:
            leg_mean.append(old_shr_ln[0])
            leg_mean.append(new_shr_ln[0])

    # figure title and legend
Ejemplo n.º 17
0
                                                             two_tailed=True,
                                                             **infer_params)
        gh_euler_spm = spm_test(gh_euler_lt35, gh_euler_gt45,
                                equal_var=False).inference(alpha,
                                                           two_tailed=True,
                                                           **infer_params)
        gh_contrib_spm = spm_test(gh_contrib_lt35,
                                  gh_contrib_gt45,
                                  equal_var=False).inference(alpha,
                                                             two_tailed=True,
                                                             **infer_params)

        # plot mean +- sd
        cur_row = act_row[activity.lower()]
        st_euler_ln_lt35 = mean_sd_plot(
            axs_st[cur_row, 0], x, st_euler_mean_lt35, st_euler_sd_lt35,
            dict(color=color_map.colors[0], alpha=0.25),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        st_contrib_ln_lt35 = mean_sd_plot(
            axs_st[cur_row, 1], x, st_contrib_mean_lt35, st_contrib_sd_lt35,
            dict(color=color_map.colors[2], alpha=0.25),
            dict(color=color_map.colors[2], marker=markers[2], markevery=20))
        gh_euler_ln_lt35 = mean_sd_plot(
            axs_gh[cur_row, 0], x, gh_euler_mean_lt35, gh_euler_sd_lt35,
            dict(color=color_map.colors[0], alpha=0.25),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        gh_contrib_ln_lt35 = mean_sd_plot(
            axs_gh[cur_row, 1], x, gh_contrib_mean_lt35, gh_contrib_sd_lt35,
            dict(color=color_map.colors[2], alpha=0.25),
            dict(color=color_map.colors[2], marker=markers[2], markevery=20))

        st_euler_ln_gt45 = mean_sd_plot(
                             all_traj_ht_m).inference(alpha,
                                                      two_tailed=True,
                                                      **infer_params)
        st_f_vs_m = spm_test(all_traj_st_f,
                             all_traj_st_m).inference(alpha,
                                                      two_tailed=True,
                                                      **infer_params)
        gh_f_vs_m = spm_test(all_traj_gh_f,
                             all_traj_gh_m).inference(alpha,
                                                      two_tailed=True,
                                                      **infer_params)

        # plot mean and SD
        cur_row = act_row[activity.lower()]
        ht_ln_f = mean_sd_plot(
            axs[cur_row, 0], x, ht_mean_f, ht_sd_f,
            dict(color=color_map.colors[0], alpha=0.25),
            dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        st_ln_f = mean_sd_plot(
            axs[cur_row, 1], x, st_mean_f, st_sd_f,
            dict(color=color_map.colors[0], alpha=0.25),
            dict(color=color_map.colors[0], marker=markers[1], markevery=20))
        gh_ln_f = mean_sd_plot(
            axs[cur_row, 2], x, gh_mean_f, gh_sd_f,
            dict(color=color_map.colors[0], alpha=0.25),
            dict(color=color_map.colors[0], marker=markers[2], markevery=20))

        ht_ln_m = mean_sd_plot(
            axs[cur_row, 0], x, ht_mean_m, ht_sd_m,
            dict(color=color_map.colors[1], alpha=0.25),
            dict(color=color_map.colors[1], marker=markers[0], markevery=20))
        st_ln_m = mean_sd_plot(
Ejemplo n.º 19
0
        repro_mean_gt45 = np.rad2deg(np.mean(all_traj_repro_gt45, axis=0))
        poe_mean_gt45 = np.rad2deg(np.mean(all_traj_poe_gt45, axis=0))
        repro_sd_gt45 = np.rad2deg(np.std(all_traj_repro_gt45, ddof=1, axis=0))
        poe_sd_gt45 = np.rad2deg(np.std(all_traj_poe_gt45, ddof=1, axis=0))

        # spm
        repro_lt35_vs_gt35 = spm_test(all_traj_repro_lt35, all_traj_repro_gt45).inference(alpha, two_tailed=True,
                                                                                          **infer_params)
        poe_lt35_vs_gt35 = spm_test(all_traj_poe_lt35, all_traj_poe_gt45).inference(alpha, two_tailed=True,
                                                                                    **infer_params)

        # plot mean and SD
        cur_row = act_row[activity.lower()]
        repro_ln_lt35 = mean_sd_plot(axs[cur_row, 0], x, repro_mean_lt35, repro_sd_lt35,
                                     dict(color=color_map.colors[0], alpha=0.25),
                                     dict(color=color_map.colors[0], marker=markers[0], markevery=20))
        poe_ln_lt35 = mean_sd_plot(axs[cur_row, 1], x, poe_mean_lt35, poe_sd_lt35,
                                   dict(color=color_map.colors[0], alpha=0.25),
                                   dict(color=color_map.colors[0], marker=markers[2], markevery=20))

        repro_ln_gt45 = mean_sd_plot(axs[cur_row, 0], x, repro_mean_gt45, repro_sd_gt45,
                                     dict(color=color_map.colors[1], alpha=0.25),
                                     dict(color=color_map.colors[1], marker=markers[0], markevery=20))
        poe_ln_gt45 = mean_sd_plot(axs[cur_row, 1], x, poe_mean_gt45, poe_sd_gt45,
                                   dict(color=color_map.colors[1], alpha=0.25),
                                   dict(color=color_map.colors[1], marker=markers[2], markevery=20))

        # plot SPM
        repro_x_sig = sig_filter(repro_lt35_vs_gt35, x)
        poe_x_sig = sig_filter(poe_lt35_vs_gt35, x)