diff --git a/swash/processing/post.py b/swash/processing/post.py index 50cd5e8..2642226 100644 --- a/swash/processing/post.py +++ b/swash/processing/post.py @@ -39,13 +39,13 @@ n_t = botl.shape[0] t = np.arange(0, n_t * dt, dt) # Cospectral calculations -pos_x = config.getint("post", "x0") +x0 = config.getint("post", "x0") t0 = config.getint("post", "t0") f = 1 / dt -log.info(f"Computing reflection coefficient at x={pos_x}") +log.info(f"Computing reflection coefficient at x={x0}") -eta = (dep - botl)[t > t0, pos_x] -u = vel[t > t0, 0, pos_x] +eta = (dep - botl)[t > t0, x0] +u = vel[t > t0, 0, x0] phi_eta = np.abs(sgl.csd(eta, eta, f)) phi_u = np.abs(sgl.csd(u, u, f)) @@ -60,13 +60,13 @@ R = np.sqrt( log.info("Plotting results") fig, (ax_dep, ax_vel) = plt.subplots(2) -ax_dep.plot(t, (dep - botl)[:, pos_x], label="dep") +ax_dep.plot(t, (dep - botl)[:, x0], label="dep") ax_dep.set(xlabel="t (s)", ylabel="z (m)") ax_dep.autoscale(axis="x", tight=True) ax_dep.grid() ax_dep.axvline(t0, c='k', alpha=.2) -ax_vel.plot(t, vel[:, 0, pos_x], label="vel") +ax_vel.plot(t, vel[:, 0, x0], label="vel") ax_vel.set(xlabel="t (s)", ylabel="U (m/s)") ax_vel.autoscale(axis="x", tight=True) ax_vel.grid() @@ -93,8 +93,8 @@ out = pathlib.Path(config.get("post", "out")) log.info(f"Saving plots in '{out}'") out.mkdir(exist_ok=True) -fig.savefig(out.joinpath(f"t{pos_x}.png")) -fig_r.savefig(out.joinpath(f"R{pos_x}.png")) -fig_x.savefig(out.joinpath(f"x{pos_x}.png")) +fig.savefig(out.joinpath(f"t{x0}.png")) +fig_r.savefig(out.joinpath(f"R{x0}.png")) +fig_x.savefig(out.joinpath(f"x{t0}.png")) log.info("Finished post-processing")