def plot_mean_debye(sol, ax):
x = np.log10(sol[0]["data"]["tau"])
x = np.linspace(min(x), max(x),100)
list_best_rtd = [100*np.sum([a*(x**i) for (i, a) in enumerate(s["params"]["a"])], axis=0) for s in sol]
# list_best_rtd = [s["fit"]["best"] for s in sol]
y = np.mean(list_best_rtd, axis=0)
y_min = 100*np.sum([a*(x**i) for (i, a) in enumerate(sol[0]["params"]["a"] - sol[0]["params"]["a_std"])], axis=0)
y_max = 100*np.sum([a*(x**i) for (i, a) in enumerate(sol[0]["params"]["a"] + sol[0]["params"]["a_std"])], axis=0)
ax.errorbar(10**x[(x>-6)&(x<2)], y[(x>-6)&(x<2)], None, None, "-", color='blue',linewidth=2, label="Mean RTD", zorder=10)
plt.plot(10**x[(x>-6)&(x<2)], y_min[(x>-6)&(x<2)], color='lightgray', alpha=1, zorder=-1, label="RTD range")
plt.plot(10**x[(x>-6)&(x<2)], y_max[(x>-6)&(x<2)], color='lightgray', alpha=1, zorder=-1)
plt.fill_between(sol[0]["data"]["tau"], 100*(sol[0]["params"]["m_"]-sol[0]["params"]["m__std"]) , 100*(sol[0]["params"]["m_"]+sol[0]["params"]["m__std"]), color='lightgray', alpha=1, zorder=-1, label="RTD SD")
ax.set_xlabel("Relaxation time (s)", fontsize=14)
ax.set_ylabel("Chargeability (%)", fontsize=14)
plt.yticks(fontsize=14), plt.xticks(fontsize=14)
plt.xscale("log")
ax.set_xlim([1e-6, 1e1])
ax.set_ylim([0, 5.0])
ax.legend(loc=1, fontsize=12)
# ax.set_title(title+" step method", fontsize=14)
评论列表
文章目录