def test_linear_freq_01(self): method = 'linear' f0 = 1.0 f1 = 2.0 t1 = 1.0 t = np.linspace(0, t1, 100) phase = waveforms._chirp_phase(t, f0, t1, f1, method) tf, f = compute_frequency(t, phase) abserr = np.max(np.abs(f - chirp_linear(tf, f0, f1, t1))) assert_(abserr < 1e-6)
def test_quadratic_freq_02(self): method = 'quadratic' f0 = 20.0 f1 = 10.0 t1 = 10.0 t = np.linspace(0, t1, 2000) phase = waveforms._chirp_phase(t, f0, t1, f1, method) tf, f = compute_frequency(t, phase) abserr = np.max(np.abs(f - chirp_quadratic(tf, f0, f1, t1))) assert_(abserr < 1e-6)
def test_logarithmic_freq_03(self): method = 'logarithmic' f0 = 100.0 f1 = 100.0 t1 = 10.0 t = np.linspace(0, t1, 10000) phase = waveforms._chirp_phase(t, f0, t1, f1, method) tf, f = compute_frequency(t, phase) abserr = np.max(np.abs(f - chirp_geometric(tf, f0, f1, t1))) assert_(abserr < 1e-6)
def test_hyperbolic_freq_01(self): method = "hyperbolic" f0 = 10.0 f1 = 1.0 t1 = 1.0 t = np.linspace(0, t1, 10000) phase = waveforms._chirp_phase(t, f0, t1, f1, method) tf, f = compute_frequency(t, phase) abserr = np.max(np.abs(f - chirp_hyperbolic(tf, f0, f1, t1))) assert_(abserr < 1e-6)
def test_hyperbolic_freq_01(self): method = 'hyperbolic' t1 = 1.0 t = np.linspace(0, t1, 10000) # f0 f1 cases = [[10.0, 1.0], [1.0, 10.0], [-10.0, -1.0], [-1.0, -10.0]] for f0, f1 in cases: phase = waveforms._chirp_phase(t, f0, t1, f1, method) tf, f = compute_frequency(t, phase) expected = chirp_hyperbolic(tf, f0, f1, t1) assert_allclose(f, expected)