def plot_all_scan(scan_res, selections, plot_selections, unit_dict,
                  param_val_fun, param_desc):
    plot_all = get_plot_all_fun(selections, plot_selections, unit_dict)
    lets = [x for x in "efcdab"]
    fig, big_ax = plt.subplots()
    aux.clean_big_ax(big_ax)
    inset_dict = aux.get_inset_loc(nx=2, ny=3, hs=0.1, vs=0.05)
    axes = [big_ax.inset_axes(inset_dict[key]) for key in inset_dict]
    big_ax.set_xlabel("time [min]")
    plot_all(scan_res, 80, axes)
    for ax, let in zip(axes, lets):
        if let in "bdf":
            ax.text(-0.17,
                    1.02,
                    "({})".format(let),
                    transform=ax.transAxes,
                    fontsize=12)
        if let in "ace":
            ax.text(-0.25,
                    1.02,
                    "({})".format(let),
                    transform=ax.transAxes,
                    fontsize=12)

    cb_ax, kw = mpl.colorbar.make_axes(big_ax,
                                       orientation="vertical",
                                       fraction=0.15,
                                       aspect=40,
                                       pad=0.02)
    param_vals = param_val_fun(scan_res)
    cmap = plt.cm.coolwarm
    cb = aux.make_cb(cb_ax, list(param_vals), cmap, "vertical")
    cb.set_label(param_desc)
    cb.ax.set_yticklabels(param_vals)
示例#2
0
def plot_all_scan(scan_res_double, plot_selections, unit_dict, param_val_fun, param_desc):
    plot_all = get_plot_all_fun(unit_dict)
    lets = [x for x in "cba"]
    fig, big_ax = plt.subplots()
    aux.clean_big_ax(big_ax)
    inset_dict = aux.get_inset_loc(nx=2, ny=3, hs=0.02, vs=0.05)
    st_axes = [big_ax.inset_axes(inset_dict[key]) for key in inset_dict if key[0] == "0"]
    sf_axes = [big_ax.inset_axes(inset_dict[key]) for key in inset_dict if key[0] == "1"]
    axes_double = [st_axes, sf_axes]
    big_ax.set_xlabel("time [min]")
    plot_all(scan_res_double, plot_selections, 80, axes_double)
    st_axes[2].set_title("stress sensing")
    sf_axes[2].set_title("plain")
    for ax in sf_axes:
        ax.set_ylabel(None)
        ax.set_yticklabels([])

    for ax, let in zip(st_axes, lets):
        ax.text(-0.25, 1.02, "({})".format(let), transform=ax.transAxes, fontsize=12)

    for ax_st, ax_sf in zip(st_axes, sf_axes):
        y_lim = max(ax_st.get_ylim()[1], ax_sf.get_ylim()[1])
        ax_st.set_ylim(top=y_lim)
        ax_sf.set_ylim(top=y_lim)
        for ax in [ax_st, ax_sf]:
            aux.make_grid(ax)
    cb_ax, kw = mpl.colorbar.make_axes(big_ax, orientation="vertical", fraction=0.15, aspect=40, pad=0.02)
    param_vals = param_val_fun(scan_res_double[0])
    cmap = plt.cm.coolwarm
    cb = aux.make_cb(cb_ax, list(param_vals), cmap, "vertical")
    cb.set_label(param_desc)
    cb.ax.set_yticklabels(param_vals)
def plot_tv(result_df: pd.DataFrame, param_desc, vol_range, param_val_fun):
    fig, ax = plt.subplots(1, 1, figsize=(6, 4))
    aux.clean_big_ax(ax)
    gs = aux.loc(nrows=1, ncols=2, hs=0.1, vs=0, width_ratios=(1 / 2, 1 / 2))
    tax, vax = [ax.inset_axes(gs[0, i]) for i in range(gs.shape[1])]
    pvb.plot_vdiv_y_multi(result_df, "v_trans", vax)
    pvb.plot_vdiv_y_multi(result_df, "t_g1", tax)
    pad = 0.05 * (vol_range[-1] - vol_range[0])
    vax.set_xlim(vol_range[0] - pad, vol_range[-1] + pad)
    cb_ax, kw = mpl.colorbar.make_axes(ax, fraction=0.15, aspect=25, pad=0.02)
    param_vals = param_val_fun(scan_results)
    cb = aux.make_cb(ax=cb_ax,
                     values=param_vals,
                     cmap=mpl.cm.coolwarm,
                     orientation="vertical")
    cb.ax.set_yticklabels(param_vals)
    cb.set_label(param_desc)
def plot_all(scan_res, selections, plot_selections, unit_dict, tt=100):
    plot_all = get_plot_all_fun(selections, plot_selections, unit_dict)
    fig, big_ax = plt.subplots(figsize=(7, 7))
    aux.clean_big_ax(big_ax)
    inset_dict = aux.get_inset_loc(nx=2, ny=3, hs=0.1, vs=0.05)
    axes = [big_ax.inset_axes(inset_dict[key]) for key in inset_dict]
    big_ax.set_xlabel("time [min]")
    plot_all(scan_res, tt, axes)
    cb_ax, kw = mpl.colorbar.make_axes(big_ax,
                                       orientation="vertical",
                                       fraction=0.15,
                                       aspect=40,
                                       pad=0.02)
    param_vals = [round(sr[0], 2) for sr in scan_res]
    cmap = plt.cm.coolwarm
    cb = aux.make_cb(cb_ax, list(param_vals), cmap, "vertical")
    cb.set_label("volume after division [fL]")
    cb.ax.set_yticklabels(param_vals)
示例#5
0
def plot_all_scan(scan_res, plot_selections, unit_dict, param_val_fun,
                  param_desc):
    fig, big_ax = plt.subplots()
    aux.clean_big_ax(big_ax)
    inset_dict = aux.get_inset_loc(nx=2, ny=1, hs=0.08, vs=0.05)
    axes = [big_ax.inset_axes(inset_dict[key]) for key in inset_dict]
    big_ax.set_xlabel("time [min]")
    plot_whi3p_stress(axes, plot_selections, unit_dict, scan_res, 80)
    axes[0].set_ylabel(unit_dict[plot_selections[0]])

    #     if let in "bdf":
    #         ax.text(-0.17, 1.02, "({})".format(let), transform = ax.transAxes, fontsize=12)
    #     if let in "ace":
    #         ax.text(-0.25, 1.02, "({})".format(let), transform = ax.transAxes, fontsize=12)

    for ax in axes:
        aux.make_grid(ax)
    cb_ax, kw = mpl.colorbar.make_axes(big_ax,
                                       orientation="vertical",
                                       fraction=0.15,
                                       aspect=40,
                                       pad=0.02)
    param_vals = param_val_fun(scan_res)
    cmap = plt.cm.coolwarm
    cb = aux.make_cb(cb_ax, list(param_vals), cmap, "vertical")
    cb.set_label(param_desc)
    cb.ax.set_yticklabels(param_vals)
    axes[1].text(-0.15,
                 1.02,
                 "({})".format("b"),
                 transform=axes[1].transAxes,
                 fontsize=12)
    axes[0].text(-0.25,
                 1.02,
                 "({})".format("a"),
                 transform=axes[0].transAxes,
                 fontsize=12)
示例#6
0
           frameon=False,
           fontsize=7,
           borderpad=0.4 / f,
           labelspacing=0.5 / f,
           handlelength=2 / f,
           handleheight=0.7 / f,
           handletextpad=0.8 / f,
           borderaxespad=0.5 / f)
    mpl.rc('figure', figsize=(17 / 2.54, 8 / 2.54), dpi=300)
    names = ["Cln12prod.pkl", "Cln3prod.pkl", "kg.pkl"]
    full_names = ["scan_res_whi5_" + name for name in names]
    scans = [aux.load_set(name) for name in full_names]
    fig, (ax, ax1, ax2) = plt.subplots(1, 3)
    plt.subplots_adjust(wspace=0.05)
    for ax in fig.axes:
        aux.clean_big_ax(ax)
    gs = aux.loc(2, 1, 0, 0.02, height_ratios=[0.2, 0.8])
    v_axes = [ax.inset_axes(gs[0, 0]) for ax in fig.axes]
    whi5_axes = [ax.inset_axes(gs[1, 0]) for ax in fig.axes]

    tt = [60, 60, 60]
    colors = [("grey", "darkblue"), ("darkblue", "darkred"),
              ("darkblue", "darkred")]
    for scan_res, whi5_ax, v_ax, color_t, tt in zip(scans, whi5_axes, v_axes,
                                                    colors, tt):
        plot_whi5(scan_res, tt=tt, whi5_ax=whi5_ax, v_ax=v_ax, colors=color_t)

    cbs = [
        mpl.colorbar.make_axes(ax,
                               location="top",
                               fraction=0.1,