Пример #1
0
def plot_singular_values_and_vectors_only_time(fig_name, s, network_object,
                                               v_right, h_right, right_args):

    fig = plt.figure(constrained_layout=True)
    gs = fig.add_gridspec(2, 1, height_ratios=[1, 1], wspace=0.0, hspace=0.01)

    a0 = fig.add_subplot(gs[0, 0])  # plotting singular values
    a3 = fig.add_subplot(gs[1, 0])  # plotting right singular vectors

    plot_utils.plot_singular_values(a0, s)
    plot_utils.plot_multiple_right_singular_vectors(a3, v_right, h_right,
                                                    **right_args)

    a0.text(0.0,
            1.0,
            'A',
            horizontalalignment='left',
            transform=a0.transAxes,
            verticalalignment='top',
            fontsize=9,
            fontweight='bold')
    a3.text(0.0,
            1.0,
            'B',
            horizontalalignment='left',
            transform=a3.transAxes,
            verticalalignment='top',
            fontsize=9,
            fontweight='bold')

    fig.set_size_inches(fig_width_onecolum, 4.5)
    plt.savefig(figures_subfolder + fig_name, bbox_inches='tight')
Пример #2
0
def plot_singular_values_and_vectors(fig_name, s, network_object, x_left,
                                     states_left, left_args, v_right, h_right,
                                     right_args):

    fig = plt.figure(constrained_layout=True)
    gs = fig.add_gridspec(2,
                          4,
                          height_ratios=[1, 1],
                          width_ratios=[7, 0.4, 1, 6],
                          wspace=0.0,
                          hspace=0.01)

    a0 = fig.add_subplot(gs[0, 0])  # plotting singular values
    a1 = fig.add_subplot(gs[:, 2])  # plotting states - left singular vectors
    a2 = fig.add_subplot(gs[:, 3])  # plotting values - left singular vectors
    a3 = fig.add_subplot(gs[1, 0])  # plotting right singular vectors

    plot_utils.plot_singular_values(a0, s)
    plot_utils.plot_multiple_left_singular_vectors(a1,
                                                   a2,
                                                   x_left,
                                                   states_left,
                                                   network_object,
                                                   sort_ids=[0, 1],
                                                   **left_args)
    plot_utils.plot_multiple_right_singular_vectors(a3, v_right, h_right,
                                                    **right_args)

    a0.text(0.0,
            1.0,
            'A',
            horizontalalignment='left',
            transform=a0.transAxes,
            verticalalignment='top',
            fontsize=9,
            fontweight='bold')
    a2.text(0.0,
            1.0,
            'B',
            horizontalalignment='left',
            transform=a2.transAxes,
            verticalalignment='top',
            fontsize=9,
            fontweight='bold')
    a3.text(0.0,
            1.0,
            'C',
            horizontalalignment='left',
            transform=a3.transAxes,
            verticalalignment='top',
            fontsize=9,
            fontweight='bold')

    fig.set_size_inches(fig_width_max, 4.5)
    plt.savefig(figures_subfolder + fig_name, bbox_inches='tight')
Пример #3
0
def plot_fft_plots(fig_name, network_object, v, Vh, h, n_vectors):
    plt.style.use(plot_style)
    fig = plt.figure(constrained_layout=True)
    gs = fig.add_gridspec(2,
                          2,
                          height_ratios=[1, 1],
                          width_ratios=[20, 1],
                          wspace=0.0,
                          hspace=0.01)

    a0 = fig.add_subplot(gs[0, 0])
    a1 = fig.add_subplot(gs[1, 0])

    plot_utils.plot_right_matrix_probs(a0,
                                       v,
                                       h,
                                       xlim=[-10, 10],
                                       xlabel='Frequency (1/days)',
                                       ylabel='probability of measurement',
                                       frequency_domain=True,
                                       log2axis=False,
                                       ylog=True)
    plot_utils.plot_multiple_right_singular_vectors(
        a1,
        Vh,
        h,
        n_vectors,
        xlabel='Frequency (1/days)',
        ylabel='singular vector value',
        frequency_domain=True,
        xlim=[-10, 10],
        log2axis=False,
        ylog=True)

    a0.text(0.95,
            1.0,
            'A',
            horizontalalignment='left',
            transform=a0.transAxes,
            verticalalignment='top',
            fontsize=9,
            fontweight='bold')
    a1.text(0.95,
            1.0,
            'B',
            horizontalalignment='left',
            transform=a1.transAxes,
            verticalalignment='top',
            fontsize=9,
            fontweight='bold')

    fig.set_size_inches(fig_width_onecolum, 4.)
    plt.savefig(figures_subfolder + fig_name, bbox_inches='tight')
Пример #4
0
def plot_haar_plots_w_vectors(fig_name, network_object, v, Vh, n_vectors):
    plt.style.use(plot_style)
    fig = plt.figure(constrained_layout=True)
    gs = fig.add_gridspec(4,
                          6,
                          height_ratios=[1, 1, 1, 1],
                          width_ratios=[5, 5, 5, 5, 1, 20],
                          wspace=0.0,
                          hspace=0.0)

    a0 = fig.add_subplot(gs[:2, -1])  # probabilities
    a1 = fig.add_subplot(gs[2:, -1])  # singular vectors
    haar_ax = [[fig.add_subplot(gs[i, j]) for i in range(4)]
               for j in range(4)]  # haar vectors
    haar_mat = haarMatrix(len(v))

    plot_utils.plot_right_matrix_probs(a0,
                                       v,
                                       1.,
                                       xlim=[-0.1, 100],
                                       xlabel='Haar wavelet number',
                                       ylabel='probability of measurement')
    plot_utils.plot_multiple_right_singular_vectors(
        a1,
        Vh,
        1.,
        n_vectors,
        xlabel='Haar wavelet number',
        frequency_domain=False,
        xlim=[-0.1, 100],
        log2axis=True)
    # plot_utils.plot_haar_vectors(haar_ax,haar_mat,  n_rows = 4, n_cols = 4)
    plot_utils.plot_haar_vectors_full(haar_ax, haar_mat, n_rows=4, n_cols=4)

    haar_ax[3][0].text(0.95,
                       1.0,
                       'A',
                       horizontalalignment='left',
                       transform=haar_ax[3][0].transAxes,
                       verticalalignment='top',
                       fontsize=9,
                       fontweight='bold')
    a0.text(0.95,
            1.0,
            'B',
            horizontalalignment='left',
            transform=a0.transAxes,
            verticalalignment='top',
            fontsize=9,
            fontweight='bold')
    a1.text(0.95,
            1.0,
            'C',
            horizontalalignment='left',
            transform=a1.transAxes,
            verticalalignment='top',
            fontsize=9,
            fontweight='bold')

    # plt.subplots_adjust(wspace=0.25, hspace=0.25)
    fig.set_size_inches(fig_width_max, 4.5)
    plt.savefig(figures_subfolder + fig_name, bbox_inches='tight')
Пример #5
0
def plot_appendix_simulations(fig_name,
                              x_t,
                              h,
                              s,
                              network_object,
                              states,
                              x_left,
                              left_args,
                              v_right,
                              h_right,
                              right_args,
                              xlabel_main='time (in days)',
                              color_limits=[1E-3, 1]):

    fig = plt.figure(constrained_layout=True)
    gs = fig.add_gridspec(2,
                          7,
                          height_ratios=[1, 1],
                          width_ratios=[1, 6, 0.4, 7, 0.4, 1, 6],
                          wspace=0.0,
                          hspace=0.01)

    a0_0 = fig.add_subplot(gs[:, 0])  # plotting states - full progression
    a0_1 = fig.add_subplot(gs[:, 1])  # plotting values - full progression
    a1_0 = fig.add_subplot(gs[0, 3])  # plotting singular values
    a2_0 = fig.add_subplot(gs[:, 5])  # plotting states - left singular vectors
    a2_1 = fig.add_subplot(gs[:, 6])  # plotting values - left singular vectors
    a3_0 = fig.add_subplot(gs[1, 3])  # plotting right singular vectors

    plot_utils.plot_full_states(a0_0,
                                a0_1,
                                network_object,
                                x_t,
                                states,
                                h,
                                xlabel=xlabel_main,
                                color_limits=color_limits,
                                frequency_domain=False)
    plot_utils.plot_singular_values(a1_0, s)
    plot_utils.plot_multiple_left_singular_vectors(a2_0, a2_1, x_left, states,
                                                   network_object, **left_args)
    plot_utils.plot_multiple_right_singular_vectors(a3, v_right, h_right,
                                                    **right_args)

    a0_0.text(0.0,
              1.0,
              'A',
              horizontalalignment='left',
              transform=a0.transAxes,
              verticalalignment='top',
              fontsize=9,
              fontweight='bold')
    a1_0.text(0.0,
              1.0,
              'B',
              horizontalalignment='left',
              transform=a2.transAxes,
              verticalalignment='top',
              fontsize=9,
              fontweight='bold')
    a2_0.text(0.0,
              1.0,
              'C',
              horizontalalignment='left',
              transform=a3.transAxes,
              verticalalignment='top',
              fontsize=9,
              fontweight='bold')
    a3_0.text(0.0,
              1.0,
              'D',
              horizontalalignment='left',
              transform=a3.transAxes,
              verticalalignment='top',
              fontsize=9,
              fontweight='bold')

    fig.set_size_inches(fig_width_max, 5.0)
    plt.savefig(figures_subfolder + fig_name, bbox_inches='tight')