예제 #1
0
파일: wavelet.py 프로젝트: odlgroup/odl
 def _call(self, coeffs):
     """Return the inverse wavelet transform of ``coeffs``."""
     if self.impl == 'pywt':
         shapes = pywt_coeff_shapes(self.range.shape, self.pywt_wavelet,
                                    self.nlevels, self.pywt_pad_mode)
         coeff_list = pywt_coeffs_from_flat_array(coeffs, shapes)
         return pywt_multi_level_recon(
             coeff_list, recon_shape=self.range.shape,
             wavelet=self.pywt_wavelet, mode=self.pywt_pad_mode)
     else:
         raise RuntimeError("bad `impl` '{}'".format(self.impl))
예제 #2
0
파일: wavelet.py 프로젝트: yochju/odl
 def _call(self, coeffs):
     """Return the inverse wavelet transform of ``coeffs``."""
     if self.impl == 'pywt':
         shapes = pywt_coeff_shapes(self.range.shape, self.pywt_wavelet,
                                    self.nlevels, self.pywt_pad_mode)
         coeff_list = pywt_coeffs_from_flat_array(coeffs, shapes)
         return pywt_multi_level_recon(
             coeff_list, recon_shape=self.range.shape,
             wavelet=self.pywt_wavelet, mode=self.pywt_pad_mode)
     else:
         raise RuntimeError("bad `impl` '{}'".format(self.impl))
예제 #3
0
def test_pywt_coeff_list_conversion(small_shapes, floating_dtype):
    """Test if converstion flat array <-> coefficient list works."""
    ndim, shapes = small_shapes

    grouped_list, flat_list = _grouped_and_flat_arrays(shapes, dtype=float)

    true_flat_array = np.hstack(flat_list)
    flat_array = pywt_flat_array_from_coeffs(grouped_list)
    assert all_equal(flat_array, true_flat_array)

    coeff_list = pywt_coeffs_from_flat_array(flat_array, shapes)
    true_coeff_list = grouped_list
    assert all_equal(coeff_list, true_coeff_list)
예제 #4
0
def test_pywt_coeff_list_conversion(small_shapes, floating_dtype):
    """Test if converstion flat array <-> coefficient list works."""
    ndim, shapes = small_shapes

    grouped_list, flat_list = _grouped_and_flat_arrays(shapes, dtype=float)

    true_flat_array = np.hstack(flat_list)
    flat_array = pywt_flat_array_from_coeffs(grouped_list)
    assert all_equal(flat_array, true_flat_array)

    coeff_list = pywt_coeffs_from_flat_array(flat_array, shapes)
    true_coeff_list = grouped_list
    assert all_equal(coeff_list, true_coeff_list)