| 443 | |
| 444 | |
| 445 | def _match_coeff_dims(a_coeff, d_coeff_dict): |
| 446 | # For each axis, compare the approximation coeff shape to one of the |
| 447 | # stored detail coeffs and truncate the last element along the axis |
| 448 | # if necessary. |
| 449 | if a_coeff is None: |
| 450 | return None |
| 451 | if not d_coeff_dict: |
| 452 | return a_coeff |
| 453 | d_coeff = d_coeff_dict[next(iter(d_coeff_dict))] |
| 454 | size_diffs = np.subtract(a_coeff.shape, d_coeff.shape) |
| 455 | if np.any((size_diffs < 0) | (size_diffs > 1)): |
| 456 | print(size_diffs) |
| 457 | raise ValueError("incompatible coefficient array sizes") |
| 458 | return a_coeff[tuple(slice(s) for s in d_coeff.shape)] |
| 459 | |
| 460 | |
| 461 | def waverecn(coeffs, wavelet, mode='symmetric', axes=None): |