-
-
Notifications
You must be signed in to change notification settings - Fork 492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: add wavedecn and waverecn functions #67
Conversation
Signal extension mode, see MODES (default: 'sym') | ||
level : int, optional | ||
Decomposition level. If level is None (default) then it will be | ||
calculated using the ``dwt_max_level`` function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to document here that level needs to be >=0
Looks good at a quick glance. This is one way of working around #54. Personally, I think |
If you want to add documentation on why the behaviour in #54 is expected and mention this as a workaround, I would be okay with that. I don't really know which behaviour is preferable for |
This was rebased using current master. A major overhaul of the tests was done in the last commit to make them more comprehensive and consistent across all dimensions. |
@kwohlfahrt can you check if the updated implementation of |
@grlee77 sorry, I completely missed that I'd been tagged here. The idea looks clean, however in There are a few edge cases (e.g. one level being |
I merged @kwolfahrt's code to handle missing or invalid coefficients, but please do not merge just yet. I still want to add a warning in the case of missing coefficients or unexpected extra keys in the detail coefficient dictionary and an exception if any coefficients have the wrong shape. |
@kwohlfahrt
|
Sorry for the delay, here are my thoughts:
I'm not sure it's necessary to warn if any detail coefficient dictionaries are empty. It's an extension of allowing any other number of coefficients to be missing, so it's not really unusual enough to cause a warning. I would also enable the warnings/exceptions for |
@kwohlfahrt I removed the warning about empty coefficient dictionaries as suggested. I now raise a |
252645f
to
a01939d
Compare
Given that we 'broke' Otherwise looks good! |
@kwohlfahrt |
coeffs_list.append(a) | ||
coeffs_list.reverse() | ||
|
||
if len(coeffs_list) < level + 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the lines above, this test shouldn't ever fail (and it doesn't break any tests if removed).
reorganize tests into a logical order and use uniform tolerances across all tests. merge the separate *_complex tests into the dtype *_accuracies tests to avoid duplicating functionality add comprehensive mode and wavelet type tests to the 1D and 2D cases to match those previously existing for nD added dec.slow or PYWT_XSLOW decorators where needed. In the future if dwt2/idwt2 are refactored to use dwtn/idwtn the PYWT_XSLOW decorator can be removed.
Correctly handle missing coefficients in waverecn, as they are treated in idwtn.
Previously, empty levels were discarded, they should not be.
…rrays during waverecn
…efficients. Temporarily catch the Exception and raise a warning instead to allow for a deprecation period
…ning for invalid keys was removed
…ore calling idwtn
…nd restore missing import in test_multidim.py
… are fewer than the number of array dimensions.
…s_modes now that the underlying code is much faster
@kwohlfahrt: still waiting on Travis, but I addressed the issue above and added a couple new tests of the axes arguments to |
""" | ||
|
||
if not isinstance(coeffs, (list, tuple)): | ||
raise ValueError("Expected sequence of coefficient arrays.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this check is necessary - other sequences should work fine.
Apart from the |
okay. should be good to go now |
ENH: add wavedecn and waverecn functions
adds n-dimensional variants of wavedec2 and waverec2.
This was split off from the now closed #52