1
Fork 0

Fixed input spec scaling

This commit is contained in:
Edgar P. Burkhart 2022-04-05 11:42:41 +02:00
parent c1f2c793c9
commit c5f14bfd16
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227

View file

@ -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)")