Пример #1
0
def test_perfect_reconstruction_level_0(n_dimensions):
    """ Test perfect reconstruction for a 0-level decomposition """
    array = gen_input(n_dimensions)
    coeffs = dtcwt(data=array, level=0, first_stage="sym6", wavelet="qshift1")
    reconstructed = idtcwt(coeffs=coeffs,
                           first_stage="sym6",
                           wavelet="qshift1")
    assert np.allclose(array, reconstructed)
Пример #2
0
 def test_perfect_reconstruction_level_1(self):
     """ Test perfect reconstruction for a single decomposition level """
     for first_stage in available_first_stage_filters():
         coeffs = dtcwt(
             data=self.array, level=1, first_stage=first_stage, wavelet="qshift1"
         )
         reconstructed = idtcwt(
             coeffs=coeffs, first_stage=first_stage, wavelet="qshift1"
         )
         self.assertTrue(np.allclose(self.array, reconstructed))
Пример #3
0
 def test_perfect_reconstruction_level_0(self):
     """ Test perfect reconstruction for a 0-level decomposition """
     coeffs = dtcwt(data=self.array,
                    level=0,
                    first_stage="sym6",
                    wavelet="qshift1")
     reconstructed = idtcwt(coeffs=coeffs,
                            first_stage="sym6",
                            wavelet="qshift1")
     self.assertTrue(np.allclose(self.array, reconstructed))
Пример #4
0
def test_perfect_reconstruction_level_1(n_dimensions):
    """ Test perfect reconstruction for a single decomposition level """
    array = gen_input(n_dimensions)
    for first_stage in available_first_stage_filters():
        coeffs = dtcwt(data=array,
                       level=1,
                       first_stage=first_stage,
                       wavelet="qshift1")
        reconstructed = idtcwt(coeffs=coeffs,
                               first_stage=first_stage,
                               wavelet="qshift1")
        assert np.allclose(array, reconstructed)
Пример #5
0
 def test_axis(self):
     """ Test perfect reconstruction along all axes """
     for axis in range(0, self.array.ndim):
         coeffs = dtcwt(
             data=self.array,
             level=2,
             axis=axis,
             first_stage="sym6",
             wavelet="qshift1",
         )
         reconstructed = idtcwt(
             coeffs=coeffs, axis=axis, first_stage="sym6", wavelet="qshift1"
         )
         self.assertTrue(np.allclose(self.array, reconstructed))
Пример #6
0
def test_axis(n_dimensions):
    """ Test perfect reconstruction along all axes """
    array = gen_input(n_dimensions)
    for axis in range(0, array.ndim):
        coeffs = dtcwt(
            data=array,
            level=2,
            axis=axis,
            first_stage="sym6",
            wavelet="qshift1",
        )
        reconstructed = idtcwt(coeffs=coeffs,
                               axis=axis,
                               first_stage="sym6",
                               wavelet="qshift1")
        assert np.allclose(array, reconstructed)
Пример #7
0
 def test_perfect_reconstruction_multilevel(self):
     """ Test perfect reconstruction for all levels, for all first_stage wavelets, for all DT wavelets """
     for first_stage in available_first_stage_filters():
         for wavelet in available_dt_filters():
             for level in range(
                 1,
                 dt_max_level(
                     data=self.array, first_stage=first_stage, wavelet=wavelet
                 ),
             ):
                 coeffs = dtcwt(
                     data=self.array,
                     level=level,
                     first_stage=first_stage,
                     wavelet=wavelet,
                 )
                 reconstructed = idtcwt(
                     coeffs=coeffs, first_stage=first_stage, wavelet=wavelet
                 )
                 self.assertTrue(np.allclose(self.array, reconstructed))
Пример #8
0
def test_perfect_reconstruction_multilevel(n_dimensions):
    """ Test perfect reconstruction for all levels, for all first_stage wavelets, for all DT wavelets """
    array = gen_input(n_dimensions)

    for first_stage in available_first_stage_filters():
        for wavelet in available_dt_filters():
            for level in range(
                    1,
                    dt_max_level(data=array,
                                 first_stage=first_stage,
                                 wavelet=wavelet),
            ):
                coeffs = dtcwt(
                    data=array,
                    level=level,
                    first_stage=first_stage,
                    wavelet=wavelet,
                )
                reconstructed = idtcwt(coeffs=coeffs,
                                       first_stage=first_stage,
                                       wavelet=wavelet)
                assert np.allclose(array, reconstructed)