Пример #1
0
 def test_ift(self):
     omega_max = utils.l2w(300)
     omega0 = utils.l2w(800)
     Npts = 2**10
     omega_grid, time_grid = utils.ftAxis(Npts, omega_max)
     signal_temp = np.sin(omega0 * time_grid) * utils.gauss1D(
         time_grid, 0, 100, 1)
     signal_omega = utils.ft(signal_temp)
     assert np.all(
         signal_temp == pytest.approx(np.real(utils.ift(signal_omega))))
     with pytest.raises(Exception):
         utils.ift(signal_temp, 2)
Пример #2
0
    def test_ft(self):
        omega_max = utils.l2w(300)
        omega0 = utils.l2w(800)
        Npts = 2**10
        omega_grid, time_grid = utils.ftAxis(Npts, omega_max)
        signal_temp = np.sin(omega0 * time_grid) * utils.gauss1D(
            time_grid, 0, 100, 1)
        signal_omega = utils.ft(signal_temp)

        assert np.abs(omega_grid[np.argmax(
            np.abs(signal_omega))]) == pytest.approx(omega0, rel=1e-2)
        with pytest.raises(Exception):
            utils.ft(signal_temp, 2)
Пример #3
0
 def test_ftAxis(self):
     omega_max = utils.l2w(800)
     Npts = 1024
     omega_grid, time_grid = utils.ftAxis(Npts, omega_max)
     assert len(omega_grid) == Npts
     assert len(time_grid) == Npts
     assert np.max(time_grid) == (Npts - 1) * np.pi / (2 * omega_max)
Пример #4
0
    def test_ftAxis(self):
        omega_max = utils.l2w(800)
        Npts = 1024
        omega_grid, time_grid = utils.ftAxis(Npts, omega_max)
        assert len(omega_grid) == Npts
        assert len(time_grid) == Npts
        assert np.max(time_grid) == (Npts - 1) * np.pi / (2 * omega_max)

        with pytest.raises(TypeError):
            assert utils.ftAxis("40", omega_max)
        with pytest.raises(ValueError):
            assert utils.ftAxis(0, omega_max)
Пример #5
0
 def test_l2w(self):
     assert utils.l2w(800) == pytest.approx(2.35619449)