Skip to content

Strange behavior of dwt_coeff_len and dwt_max_level. #877

Description

@tianrluo
In [1]: import pywt

In [2]: w = pywt.Wavelet('db2')
   ...: data_len = 23
   ...: level = pywt.dwt_max_level(data_len, w)
   ...: while level > 0:
   ...:     print(data_len, level)
   ...:     data_len = pywt.dwt_coeff_len(data_len, w.dec_len, 'symmetric')
   ...:     level = pywt.dwt_max_level(data_len, w)
   ...: 
23 2
13 2
8 1

I'm using PyWavelets 1.10.0.
I was trying to find how many dwt levels an input data of length 23 will have.
Based on the while loop printouts, I thought the level for 23 should be 3 rather than 2?
I might have misunderstood what dwt_max_level does if this behavior was intended rather than a bug...

Thank you ahead of time for looking into this!

(btw, pywt.__version__ is still showing 1.8.0 b/c of this line.

MINOR = 8
I can make a separate issue for __version__ if that's the preferred way to track issue with prs)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions