pywt.swt2 un able to compute more than 1 level

286 views
Skip to first unread message

Xareni Galindo

unread,
Jul 13, 2021, 9:08:42 AM7/13/21
to PyWavelets
Hello all! 

Am trying to apply an swt2 wavelet function to an organoid tiff image (2d) but every time I set the level to anything bigger than one I get the same error, ValueError: start_level must be less than 1. I have been trying to find the solution on the web but I did not read any similar problem on this mailing list or any website. Can someone explain to me what is happening? I am maybe not applying the correct wavelet? or something that maybe I am not understanding on the documentation? So far, I have tried different wavelets and different level combinations and I have the same problem every time the level is not equal to 1.

My code is : 

path = 'C:/Users/Xareni Galindo/Pictures/'
filename = '60xclose-3_w3soSPIM-561_s5-1to85-1.tif'

# Load image
original = Image.open(path + filename)
coeffs= pywt.swt2(original, 'sym9', 2, start_level=0) # applying the wavelet to the image

output message
ValueError: start_level must be less than 1.

Thank you in advance
Xareni Galindo

Kraig Fernandes

unread,
Feb 4, 2022, 11:57:29 PM2/4/22
to PyWavelets
Hey! I am facing the same issue when trying to use swt2 on my eeg signal, I can't seem to find a solution online. Were you able to rectify this error?

Regards, 
Kraig Fernandes

Gregory Lee

unread,
Feb 6, 2022, 9:11:51 AM2/6/22
to pywav...@googlegroups.com
Hi Kraig,

My first guess would be that your signal has an odd length so that you need to pad (or truncate) it to a multiple of 2**n in order to be able to do a transform with n levels. See the Notes section of the swt2 docs.

If that doesn't help, please post the signal size and exactly how you are calling the function.

Cheers,
Greg

--
You received this message because you are subscribed to the Google Groups "PyWavelets" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pywavelets+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pywavelets/62f07806-d5ac-4352-bfca-26cc5047bdean%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages