misc, tests

This commit is contained in:
2024-02-29 14:08:04 +01:00
parent d84138f668
commit 843b077850
4 changed files with 23 additions and 3 deletions

View File

@@ -85,3 +85,15 @@ def test_energy():
spec = Spectrum(spec, w, t)
assert np.all(spec.energy == np.trapz(abs2(np.fft.ifft(spec)), x=t, axis=-1))
assert spec.energy.shape == (3, 2)
def test_mask():
wl = 800e-9
bw = 50e-9
t = np.linspace(-1e-12, 1e-12, 4096)
w = wspace(t) + m_rads(wl)
spec = Spectrum(np.ones(4096) + 0j, w, t)
mased = spec.mask_wl(wl, bw)
above = mased.wl_int / mased.wl_int.max() - 0.5 >= 0
diff = spec.wl_disp[above].max() - spec.wl_disp[above].min()
assert diff == bw