Olaflow waveDict generation with fft
This commit is contained in:
parent
8f902fb24d
commit
1506fd06a1
2 changed files with 33 additions and 19 deletions
|
|
@ -34,13 +34,20 @@ t = data("t")
|
|||
|
||||
watl = data("watl")
|
||||
|
||||
arg_x0 = np.argmin(np.abs(x+1250))
|
||||
arg_x0 = np.argmin(np.abs(x + 1250))
|
||||
|
||||
wl = watl[:, arg_x0]
|
||||
|
||||
f = fft.rfftfreq(t.size, np.diff(t).mean())
|
||||
w_fft = fft.rfft(wl)
|
||||
f = fft.rfftfreq(t.size, np.diff(t).mean())[1:]
|
||||
w_fft = fft.rfft(wl)[1:]
|
||||
amp = np.abs(w_fft)
|
||||
phi = np.angle(w_fft)
|
||||
|
||||
olaflow_root = pathlib.Path(config.get("olaflow", "root"))
|
||||
org = olaflow_root.joinpath("constant", "waveDict.org").read_text()
|
||||
org = org.replace("{n}", str(t.size))
|
||||
org = org.replace("{wh}", "\n".join(amp.astype(np.str_)))
|
||||
org = org.replace("{wph}", "\n".join(phi.astype(np.str_)))
|
||||
org = org.replace("{wper}", "\n".join((1 / f).astype(np.str_)))
|
||||
olaflow_root.joinpath("constant", "waveDict").write_text(org)
|
||||
print(f, amp, phi, sep="\n")
|
||||
|
|
|
|||
Reference in a new issue