the wavelength vector used for dipserion calculation has been shrinked. The new way to determine dt via wavelength_window made it so that there wasn't 2 extra points to take gradients with.
23 lines
563 B
Python
23 lines
563 B
Python
import numpy as np
|
|
import pytest
|
|
|
|
import scgenerator as sc
|
|
|
|
|
|
def test_scaling():
|
|
period = 2
|
|
nt = 512
|
|
t = sc.tspace(period, nt)
|
|
w = sc.wspace(t)
|
|
dt = t[1] - t[0]
|
|
assert w[1] - w[0] == pytest.approx(2 * np.pi / (period + dt))
|
|
assert dt == pytest.approx(period / (nt - 1))
|
|
|
|
|
|
def test_wl_dispersion():
|
|
t = sc.tspace(t_num=1 << 15, dt=3.8e-15)
|
|
w = sc.wspace(t)
|
|
wl = sc.units.m.inv(w + sc.units.nm(1546))
|
|
wl_disp, ind_disp = sc.fiber.lambda_for_envelope_dispersion(wl, (950e-9, 4000e-9))
|
|
assert all(np.diff(wl_disp) > 0)
|