Skip to content
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

ContinuousWavelet: add tests for dtype and remove unused **kwargs #547

Merged
merged 2 commits into from Mar 28, 2020

Conversation

grlee77
Copy link
Contributor

@grlee77 grlee77 commented Mar 27, 2020

The ContinuousWavelet object allows specifying single or double precision via a dtype argument. This seems to work as expected, although is undocumented. This PR documents this dtype parameter and adds tests for it. I also removed an unused **kwargs parameter from the __cinit__.

Finally, this adds validation during wavelet creation to give a clear error when specifying an unsupported dtype. Prior to this PR the wavelet can be created with unsupported dtypes, but then when trying to use it via wavefun or integrate_wavelet, one would get errors like:

pywt.integrate_wavelet(wavelet=pywt.ContinuousWavelet('cmor1.5-1.0', np.complex64), precision=8)
Traceback (most recent call last):

  File "<ipython-input-79-c5c9ef8f093b>", line 1, in <module>
    pywt.integrate_wavelet(wavelet=pywt.ContinuousWavelet('cmor1.5-1.0', np.complex64), precision=8)

  File "/home/lee8rx/my_git/pyir/pywt/pywt/_functions.py", line 104, in integrate_wavelet
    functions_approximations = wavelet.wavefun(precision)

  File "pywt/_extensions/_pywt.pyx", line 953, in pywt._extensions._pywt.ContinuousWavelet.wavefun

ValueError: Buffer dtype mismatch, expected 'float32_t' but got 'complex float'

remove unused **kwargs argument from ContinuousWavelet constructor
TST: add tests for ContinuousWavelet dtypes
@codecov-io
Copy link

Codecov Report

Merging #547 into master will increase coverage by 1.82%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #547      +/-   ##
==========================================
+ Coverage   85.86%   87.68%   +1.82%     
==========================================
  Files          23       23              
  Lines        3962     3882      -80     
  Branches      738      467     -271     
==========================================
+ Hits         3402     3404       +2     
+ Misses        491      409      -82     
  Partials       69       69              
Impacted Files Coverage Δ
pywt/_extensions/_pywt.pyx 84.13% <100.00%> (+0.27%) ⬆️
pywt/_extensions/c/cwt.template.c 97.84% <0.00%> (+2.05%) ⬆️
pywt/_extensions/c/convolution.template.c 98.95% <0.00%> (+2.34%) ⬆️
pywt/_extensions/c/wavelets.c 87.06% <0.00%> (+6.60%) ⬆️
pywt/_extensions/c/wt.template.c 94.21% <0.00%> (+14.29%) ⬆️
pywt/_extensions/c/common.c 100.00% <0.00%> (+16.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6c7bfa4...a10c3b6. Read the comment docs.

@rgommers rgommers merged commit 6e3641b into PyWavelets:master Mar 28, 2020
@rgommers
Copy link
Member

LGTM, merged. Thanks @grlee77

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants