def bifurcation_diagram_plot(obs, fax=None, **kwargs):
    "Plots bifurcation diagram for specified observable and S_range"

    if fax is None:
        fig, ax = init_2d_fax()
    else:
        fig, ax = fax

    # Getting Attractor Data
    cold_attractors = [get_cold_attractor(S=S) for S in np.arange(7, 16)]
    hot_attractors = [get_hot_attractor(S=S) for S in np.arange(8, 17)]
    m_states = [get_m_state(S=S) for S in  np.arange(8, 16)] # S where we computed M-State

    # Getting observable Means
    cold_means = [obs(ds).mean() for ds in cold_attractors]
    hot_means = [obs(ds).mean() for ds in hot_attractors]
    m_means = [obs(ds).mean() for ds in m_states]

    # Bifurcation Plot
    ax.plot(np.arange(7, 16), cold_means, c='b', label='SB', **kwargs)
    ax.plot(np.arange(8, 17), hot_means, c='r', label='W', **kwargs)
    ax.plot(np.arange(8, 16), m_means, c='g', label='M', **kwargs)

    ax.set_xlabel('S')
    ax.grid()
    ax.legend()

    return fig, ax
def add_attractors(plot, fax, S=10):
    fig, ax = fax
    hot_attractor = get_hot_attractor(S=S)
    cold_attractor = get_cold_attractor(S=S)
    m_state = get_m_state(S=S)
    colors = ['r', 'b', 'g']
    for ds, c in zip([hot_attractor, cold_attractor, m_state], colors):
        plot(ds, c=c, ax=ax)
    return
def mean_EMT_with_projections(instanton_ds, attractor_pair):
    attractor, attractor_color = attractor_pair
    # EMT Projection of all Instantons
    fig = plt.figure(figsize=(10, 10))
    fig.suptitle('EMT Projections')
    ax = fig.add_subplot(2, 2, 1, projection='3d')
    EMT_plot(mean_instanton, ax=ax, c='purple')
    EMT_plot(get_m_state(), ax=ax, c='g')
    EMT_plot(attractor, ax=ax, c=attractor_color)

    for i, plot in enumerate([EM_plot, ET_plot, MT_plot]):
        ax = fig.add_subplot(2, 2, i + 2)
        ax.grid()
        plot(mean_instanton, ax=ax, c='purple')

        plot(get_m_state(), ax=ax, c='g')
        plot(attractor, ax=ax, c=attractor_color)
    plt.show()
    return
Beispiel #4
0
def observable_thresholds(obs, cold, S=10, extension=0.5):
    """
    obs - what observable we want the bounds of.
    cold - True/False/'M-State', which attractor or M-state we are bounding.
    S - solar parameter
    extension - uniform addition to bounds
    """

    if cold == 'M-State':
        attractor = get_m_state(S=S)
        return [obs(attractor).min().item() - extension, obs(attractor).max().item() + extension]
    if cold:
        attractor = get_cold_attractor(S=S)
    else:
        attractor = get_hot_attractor(S=S)
    return [obs(attractor).min().item() - extension, obs(attractor).max().item() + extension]