Exemple #1
0
def overlaps_vs_weight(w, o, eo, factor=1.2, name= path + '/weight_overlap_comp.pdf'):
    fig, ax = plots.log_bin_plot(w, o, factor, xlabel=None, ylabel=None, title=None, label=r'$O^c_{ij}$')
    fig, ax = plots.log_bin_plot(w, eo, factor, xlabel=None, ylabel=None, title=None, label=r'$O^f_{ij}$', fig=fig, ax=ax)
    ax.set_ylabel(r'$O_{ij}$')
    ax.set_xlabel(r'$w_{ij}$')
    ax.set_title('')
    ax.legend(loc=0)
    fig.tight_layout()
    fig.savefig(name)
    return fig, ax
def plot_iet_aget(df, factor=1.4):
    idx = df.c_iet_age_na.notnull()
    fig, ax = plots.log_bin_plot(df.c_iet_age_na[idx], df.ovrl[idx], factor)
    ax.set_xlabel(r'Residual Waiting Time, $\tau_r$')
    ax.set_ylabel(r'$\langle O | \tau_r \rangle$')
    ax.set_title('Overlap as a function of residual waiting time')
    fig.savefig(run_path + 'age_iets.png')
    return fig, ax
def plot_iet_rfresh(df, factor=1.4):
    idx = df.c_iet_rfsh_na.notnull()
    fig, ax = plots.log_bin_plot(df.c_iet_rfsh_na[idx], df.ovrl[idx], factor)
    ax.set_xlabel(r'Relative freshness, $f$')
    ax.set_ylabel(r'$\langle O | f \rangle$')
    ax.set_title('Overlap as a function of relative freshness')
    fig.savefig(run_path + 'rfsh_iets.png')
    return fig, ax
def plot_overlap_logbin(df, factor=1.3, limit=8000):
    df = df[df.w < limit]
    fig, ax = plots.log_bin_plot(df.w,
                                 df.ovrl,
                                 factor,
                                 label='Within Company Overlap')
    fig, ax = plots.log_bin_plot(df.w,
                                 df.e_ovrl,
                                 factor,
                                 label='Full network',
                                 fig=fig,
                                 ax=ax)
    ax.set_xlabel(r'$w$')
    ax.set_ylabel(r'$\langle O | w \rangle$')
    ax.set_title('Overlap as a function of number of calls')
    ax.legend()
    fig.savefig(run_path + 'overlap_logbin_calls.png')
    return fig, ax
def plot_btrns(df, factor=1.4):
    idx = df.c_brtrn.notnull()
    fig, ax = plots.log_bin_plot(df.c_brtrn[idx],
                                 df.ovrl[idx],
                                 factor,
                                 label='Bursty Trains')
    fig, ax = plots.log_bin_plot(df.c_wkn_t[idx],
                                 df.ovrl[idx],
                                 factor,
                                 label='Number of Calls',
                                 fig=fig,
                                 ax=ax)
    ax.set_xlabel(r'Residual Waiting Time, $\tau_r$')
    ax.set_ylabel(r'$\langle O | \tau_r \rangle$')
    ax.set_title('Overlap as a function of residual waiting time')
    ax.legend()
    fig.savefig(run_path + 'brtrn.png')
    return fig, ax
def plot_overlap_rank_logbin(df, factor=1.3, limit=8000, overlap_rank=True):
    df = df[df.w < limit]
    fig, ax = plots.log_bin_plot(df.w,
                                 rankdata(df.ovrl) / df.shape[0],
                                 factor,
                                 label='Within Company Overlap')
    fig, ax = plots.log_bin_plot(df.w,
                                 rankdata(df.e_ovrl) / df.shape[0],
                                 factor,
                                 label='Full network',
                                 fig=fig,
                                 ax=ax)
    ax.set_xlabel(r'$w$')
    ax.set_ylabel(r'$\langle Rank(O) | w \rangle$')
    ax.set_title('Rank of overlap as a function of number of calls')
    ax.legend()
    fig.savefig(run_path + 'overlap_rank_logbin_calls.png')
    return fig, ax
def plot_iet_mean(df, factor=1.3):
    idx = df.c_iet_mu_na.notnull()
    fig, ax = plots.log_bin_plot(df.c_iet_mu_na[idx],
                                 df.ovrl[idx],
                                 factor,
                                 label='Naive')
    idx = df.c_iet_mu_km.notnull()
    fig, ax = plots.log_bin_plot(df.c_iet_mu_km[idx],
                                 df.ovrl[idx],
                                 factor,
                                 label='KM',
                                 fig=fig,
                                 ax=ax)
    ax.legend()
    ax.set_xlabel(r'Mean inter-event time, $\tau$')
    ax.set_ylabel(r'$\langle O | \tau \rangle$')
    ax.set_title('Overlap as a function of mean inter-event time')
    fig.savefig(run_path + 'mean_iets.png')
    return fig, ax
def plot_iet_sig(df, factor=1.2):
    idx = df.c_iet_sig_na.notnull()
    fig, ax = plots.log_bin_plot(df.c_iet_sig_na[idx],
                                 df.ovrl[idx],
                                 factor,
                                 label='Naive')
    idx = df.c_iet_sig_km.notnull()
    fig, ax = plots.log_bin_plot(df.c_iet_sig_km[idx],
                                 df.ovrl[idx],
                                 factor,
                                 label='KM',
                                 fig=fig,
                                 ax=ax)
    ax.legend()
    ax.set_xlabel(r'Inter-event time standard deviation, $\sigma_{\tau}$')
    ax.set_ylabel(r'$\langle O | \sigma_{\tau}\rangle$')
    ax.set_title(
        'Overlap as a function of inter-event time standard deviation')
    fig.savefig(run_path + 'std_iets.png')
    return fig, ax