Multilevel 2D inverse discrete stationary wavelet transform. Parameters ---------- coeffs : list Approximation and details coefficients:: [ (cA_n, (cH_n, cV_n, cD_n) ), ..., (cA
(coeffs, wavelet, norm=False, axes=(-2, -1))
| 379 | |
| 380 | |
| 381 | def iswt2(coeffs, wavelet, norm=False, axes=(-2, -1)): |
| 382 | """ |
| 383 | Multilevel 2D inverse discrete stationary wavelet transform. |
| 384 | |
| 385 | Parameters |
| 386 | ---------- |
| 387 | coeffs : list |
| 388 | Approximation and details coefficients:: |
| 389 | |
| 390 | [ |
| 391 | (cA_n, |
| 392 | (cH_n, cV_n, cD_n) |
| 393 | ), |
| 394 | ..., |
| 395 | (cA_2, |
| 396 | (cH_2, cV_2, cD_2) |
| 397 | ), |
| 398 | (cA_1, |
| 399 | (cH_1, cV_1, cD_1) |
| 400 | ) |
| 401 | ] |
| 402 | |
| 403 | where cA is approximation, cH is horizontal details, cV is |
| 404 | vertical details, cD is diagonal details and n is the number of |
| 405 | levels. Index 1 corresponds to ``start_level`` from ``pywt.swt2``. |
| 406 | wavelet : Wavelet object or name string, or 2-tuple of wavelets |
| 407 | Wavelet to use. This can also be a 2-tuple of wavelets to apply per |
| 408 | axis. |
| 409 | norm : bool, optional |
| 410 | Controls the normalization used by the inverse transform. This must |
| 411 | be set equal to the value that was used by ``pywt.swt2`` to preserve |
| 412 | the energy of a round-trip transform. |
| 413 | |
| 414 | Returns |
| 415 | ------- |
| 416 | 2D array of reconstructed data. |
| 417 | |
| 418 | Examples |
| 419 | -------- |
| 420 | >>> import pywt |
| 421 | >>> coeffs = pywt.swt2([[1,2,3,4],[5,6,7,8], |
| 422 | ... [9,10,11,12],[13,14,15,16]], |
| 423 | ... 'db1', level=2) |
| 424 | >>> pywt.iswt2(coeffs, 'db1') |
| 425 | array([[ 1., 2., 3., 4.], |
| 426 | [ 5., 6., 7., 8.], |
| 427 | [ 9., 10., 11., 12.], |
| 428 | [ 13., 14., 15., 16.]]) |
| 429 | |
| 430 | """ |
| 431 | |
| 432 | # If swt was called with trim_approx=False, first element is a tuple |
| 433 | trim_approx = not isinstance(coeffs[0], (tuple, list)) |
| 434 | cA = coeffs[0] if trim_approx else coeffs[0][0] |
| 435 | if cA.ndim != 2 or axes != (-2, -1): |
| 436 | # convert to swtn coefficient format and call iswtn instead |
| 437 | if trim_approx: |
| 438 | coeffs_nd = [cA] + [{'da': h, 'ad': v, 'dd': d} |
nothing calls this directly
no test coverage detected