From c5f14bfd16716f2867d52600f828b87d79519777 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Tue, 5 Apr 2022 11:42:41 +0200 Subject: [PATCH] Fixed input spec scaling --- data/processing/spec.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/data/processing/spec.py b/data/processing/spec.py index fca9580..8523b81 100644 --- a/data/processing/spec.py +++ b/data/processing/spec.py @@ -24,25 +24,31 @@ out_root = pathlib.Path(config.get("out", "root")) inp_spec = inp_root.joinpath(config.get("inp", "raw_spec")) out_spec = out_root.joinpath("spec.dat") +Sm = np.loadtxt( + inp_spec, + skiprows=3, + max_rows=1, +) + inp = np.loadtxt( inp_spec, dtype=[("f", float), ("S", float)], delimiter=",", skiprows=12, - usecols=(0, 6), + usecols=(0, 1), max_rows=64, ) with out_spec.open("w") as out: out.write("SPEC1D\n") - np.savetxt(out, inp) + np.savetxt(out, np.stack((inp["f"], inp["S"] * Sm), axis=1)) df = np.diff(inp['f']).min() log.info(f"Minimum frequency delta: {df:.4f}Hz") log.info(f"Maximum modelled time: {1/df:.0f}s") fig, ax = plt.subplots() -ax.plot(inp["f"], inp["S"], c="k", lw=1) +ax.plot(inp["f"], inp["S"]*Sm, c="k", lw=1) ax.autoscale(True, "x", tight=True) ax.grid() ax.set(xlim=0, ylim=0, xlabel="f (Hz)", ylabel="S (m^2/Hz)")