From 2f16aef816d5ba3effd387c319e69c474d83cc82 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Fri, 1 Apr 2022 17:10:37 +0200 Subject: [PATCH] Compare reflex to custom_puv --- swash/processing/post_reflex.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/swash/processing/post_reflex.py b/swash/processing/post_reflex.py index 582032e..7833f00 100644 --- a/swash/processing/post_reflex.py +++ b/swash/processing/post_reflex.py @@ -44,10 +44,24 @@ f = 1 / dt idx = [arg_x0 - 5, arg_x0, arg_x0 + 7] wl = watl[arg_t0:, idx] +# Reflex3S res = reflex3S(*wl.T, *x[idx], botl[idx].mean(), f, 0.02, 0.2) f_, ai_, ar_ = reflex3s(wl.T, x[idx], botl[idx].mean(), f) ai, ar, _, _, _, _, fre = res +# Custom PUV +eta = watl[t > t0, arg_x0] +u = vel[t > t0, 0, arg_x0] + +phi_eta = sgl.welch(eta, f) +phi_u = sgl.welch(u, f) +phi_eta_u = sgl.csd(eta, u, f) + +R = np.sqrt( + (np.abs(phi_eta[1]) + np.abs(phi_u[1]) - 2 * phi_eta_u[1].real) + / (np.abs(phi_eta[1]) + np.abs(phi_u[1]) + 2 * phi_eta_u[1].real) +) + out = pathlib.Path(config.get("post", "out")).joinpath(f"t{t0}x{x0}") log.info(f"Saving plots in '{out}'") out.mkdir(parents=True, exist_ok=True) @@ -58,6 +72,7 @@ plt.ylim((0, 1)) plt.savefig(out.joinpath("reflex3s_pa.pdf")) plt.clf() plt.plot(f_, ar_ / ai_) +plt.plot(phi_eta[0], R) plt.xlim((0, 0.3)) plt.ylim((0, 1)) plt.savefig(out.joinpath("reflex3s.pdf"))