From 9785bb5339791316a4a23a24a46845f65f67380b Mon Sep 17 00:00:00 2001 From: Valentin Boettcher Date: Tue, 21 Mar 2023 14:28:34 -0400 Subject: [PATCH] adjust bounds --- bandfit/bandfit.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bandfit/bandfit.py b/bandfit/bandfit.py index 764d036..39bd81d 100644 --- a/bandfit/bandfit.py +++ b/bandfit/bandfit.py @@ -130,7 +130,7 @@ def candidate(k, c, d, a, δb, k_scale, k_shift): def fit_to_bands( bands, - bounds=[(-10, -10, 0.1, -0.5, 0.9, -0.5), (10, 10, 10, 0.5, 1.1, 0.5)], + bounds=[(-10, -10, 0.1, -0.5, 0.8, -0.5), (10, 10, 10, 0.5, 1.2, 0.5)], ic_scan_steps=5, c_d_order=0, debug_plots=False, @@ -229,3 +229,13 @@ def plot_data_with_bands_and_fit(data, bands, band_fit): plt.errorbar(ks, bands[:, 0], yerr=bands[:, 2]) plt.errorbar(ks, bands[:, 1], yerr=bands[:, 3]) plt.plot(smooth_ks_unscaled, upper_band) + + +def plot_error_funnel(p, σ): + ks = np.linspace(-np.pi, np.pi, 1000) + + params = np.random.multivariate_normal(p, np.diag(σ), 1000) + for param in params: + plt.plot(ks, energy(ks, *param), color="gray", alpha=0.1) + + plt.plot(ks, energy(ks, *p), linewidth=2)