1
Fork 0

Added spectrum to reflection plot

This commit is contained in:
Edgar P. Burkhart 2022-03-07 10:52:22 +01:00
parent 3e2de12a92
commit d945770453
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227

View file

@ -7,6 +7,7 @@ import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.signal as sgl
import scipy.fft as fft
from .read_swash import *
@ -68,9 +69,18 @@ ax_vel.axvline(t0, c="k", alpha=0.2)
fig.tight_layout()
fig_r, ax_r = plt.subplots()
ax_fft = ax_r.twinx()
ax_r.plot(1 / phi_eta[0, 1:], R[1:], marker="+", lw=1)
ax_r.set(xlim=(1, 30), ylim=(0, 1), xlabel="t (s)", ylabel="R")
ax_fft.plot(
fft.rfftfreq(eta.size, dt),
np.abs(fft.rfft(eta)),
lw=1,
c="k",
alpha=0.2,
)
ax_r.plot(phi_eta[0], R, marker="+")
ax_r.set(xlim=(0, 0.3), ylim=(0, 1), xlabel="f (Hz)", ylabel="R")
ax_fft.set(ylim=0, ylabel="FFT")
ax_r.grid()
fig_x, ax_x = plt.subplots()
@ -88,8 +98,8 @@ 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)
fig.savefig(out.joinpath(f"t.png"))
fig_r.savefig(out.joinpath(f"R.png"))
fig_x.savefig(out.joinpath(f"x.png"))
fig.savefig(out.joinpath("t.png"))
fig_r.savefig(out.joinpath("R.png"))
fig_x.savefig(out.joinpath("x.png"))
log.info("Finished post-processing")