def test_expwin(self): f = filters.Expwin(self._G) self._test_methods(f, tight=False) f = filters.Expwin(self._G, band_min=None, band_max=0.8) self._test_methods(f, tight=False) f = filters.Expwin(self._G, band_min=0.1, band_max=None) self._test_methods(f, tight=False) f = filters.Expwin(self._G, band_min=0.1, band_max=0.7) self._test_methods(f, tight=False)
def test_inverse(self, frame_bound=3): """The frame is the pseudo-inverse of the original frame.""" g = filters.Heat(self._G, scale=[2, 3, 4]) h = g.inverse() Ag, Bg = g.estimate_frame_bounds() Ah, Bh = h.estimate_frame_bounds() np.testing.assert_allclose(Ag * Bh, 1) np.testing.assert_allclose(Bg * Ah, 1) gL = g.compute_frame(method='exact') hL = h.compute_frame(method='exact') I = np.identity(self._G.N) np.testing.assert_allclose(hL.T.dot(gL), I, atol=1e-10) pinv = np.linalg.inv(gL.T.dot(gL)).dot(gL.T) np.testing.assert_allclose(pinv, hL.T, atol=1e-10) # The reconstruction is exact for any frame (lower bound A > 0). y = g.filter(self._signal, method='exact') z = h.filter(y, method='exact') np.testing.assert_allclose(z, self._signal) # Not invertible if not a frame. if sys.version_info > (3, 4): g = filters.Expwin(self._G) with self.assertLogs(level='WARNING'): h = g.inverse() h.evaluate(self._G.e) # If the frame is tight, inverse is h=g/A. g += g.complement(frame_bound) h = g.inverse() he = g(self._G.e) / frame_bound np.testing.assert_allclose(h(self._G.e), he, atol=1e-10)
def test_expwin(self): f = filters.Expwin(self._G) self._test_methods(f, tight=False)
def test_expwin(G): g = filters.Expwin(G)