示例#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 update_filter(self):
        try:
            xmin, xmax = self.viewer1D.ROIfft.getRegion()
            self.filter = gauss1D(self.xaxisft, np.mean([xmin, xmax]), xmax - xmin)
            self.data = np.real(ift(self.filter * self.data_fft))
            index = np.argmax(self.filter * self.data_fft)
            self.frequency = self.xaxisft[index]
            self.phase = np.angle(self.data_fft[index])

            self.filter_changed.emit(dict(frequency=self.frequency, phase=self.phase))
            self.update_plot()
        except Exception as e:
            logger.exception(str(e))