Beispiel #1
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)
Beispiel #2
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)
Beispiel #3
0
    def calculate_fft(self):

        ftaxis, axis = ftAxis_time(len(self.xaxis),
                                   np.max(self.xaxis) - np.min(self.xaxis))
        self.xaxisft = ftaxis / (2 * np.pi)
        self.data_fft = ft(self.data)