Multilevel 2D stationary wavelet transform. Parameters ---------- data : array_like 2D array with input data wavelet : Wavelet object or name string, or 2-tuple of wavelets Wavelet to use. This can also be a tuple of wavelets to apply per axis in ``axes
(data, wavelet, level, start_level=0, axes=(-2, -1),
trim_approx=False, norm=False)
| 270 | |
| 271 | |
| 272 | def swt2(data, wavelet, level, start_level=0, axes=(-2, -1), |
| 273 | trim_approx=False, norm=False): |
| 274 | """ |
| 275 | Multilevel 2D stationary wavelet transform. |
| 276 | |
| 277 | Parameters |
| 278 | ---------- |
| 279 | data : array_like |
| 280 | 2D array with input data |
| 281 | wavelet : Wavelet object or name string, or 2-tuple of wavelets |
| 282 | Wavelet to use. This can also be a tuple of wavelets to apply per |
| 283 | axis in ``axes``. |
| 284 | level : int |
| 285 | The number of decomposition steps to perform. |
| 286 | start_level : int, optional |
| 287 | The level at which the decomposition will start (default: 0) |
| 288 | axes : 2-tuple of ints, optional |
| 289 | Axes over which to compute the SWT. Repeated elements are not allowed. |
| 290 | trim_approx : bool, optional |
| 291 | If True, approximation coefficients at the final level are retained. |
| 292 | norm : bool, optional |
| 293 | If True, transform is normalized so that the energy of the coefficients |
| 294 | will be equal to the energy of ``data``. In other words, |
| 295 | ``np.linalg.norm(data.ravel())`` will equal the norm of the |
| 296 | concatenated transform coefficients when ``trim_approx`` is True. |
| 297 | |
| 298 | Returns |
| 299 | ------- |
| 300 | coeffs : list |
| 301 | Approximation and details coefficients (for ``start_level = m``). |
| 302 | If ``trim_approx`` is ``False``, approximation coefficients are |
| 303 | retained for all levels:: |
| 304 | |
| 305 | [ |
| 306 | (cA_m+level, |
| 307 | (cH_m+level, cV_m+level, cD_m+level) |
| 308 | ), |
| 309 | ..., |
| 310 | (cA_m+1, |
| 311 | (cH_m+1, cV_m+1, cD_m+1) |
| 312 | ), |
| 313 | (cA_m, |
| 314 | (cH_m, cV_m, cD_m) |
| 315 | ) |
| 316 | ] |
| 317 | |
| 318 | where cA is approximation, cH is horizontal details, cV is |
| 319 | vertical details, cD is diagonal details and m is ``start_level``. |
| 320 | |
| 321 | If ``trim_approx`` is ``True``, approximation coefficients are only |
| 322 | retained at the final level of decomposition. This matches the format |
| 323 | used by ``pywt.wavedec2``:: |
| 324 | |
| 325 | [ |
| 326 | cA_m+level, |
| 327 | (cH_m+level, cV_m+level, cD_m+level), |
| 328 | ..., |
| 329 | (cH_m+1, cV_m+1, cD_m+1), |