scipy.fftpack.dct does not work

1,800 views
Skip to first unread message

Bo Qiang

unread,
Nov 27, 2014, 1:09:53 AM11/27/14
to winp...@googlegroups.com
Hi,

I am trying to use the DCT function but it seems like the function does not work. Here is the error message.

    w = fftpack.dct(v)
AttributeError: 'module' object has no attribute 'dct'

Thanks!

Bo

Sebastian Wagner

unread,
Nov 27, 2014, 7:04:39 AM11/27/14
to winp...@googlegroups.com
Hi,

First impression: looks like a user bug. Which version are you using,
how are you calling dct?

How it should work: (Winpython 32bit 2.7.8.2)

>>> import scipy.fftpack
>>> scipy.fftpack.dct(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"D:\WinPython-32bit-2.7.8.2\python-2.7.8\lib\site-packages\scipy\fftpack\realtransforms.py",
line 135, in dct
return _dct(x, type, n, axis, normalize=norm,
overwrite_x=overwrite_x)
File
"D:\WinPython-32bit-2.7.8.2\python-2.7.8\lib\site-packages\scipy\fftpack\realtransforms.py",
line 222, in _dct
n = tmp.shape[axis]
IndexError: tuple index out of range
# -> works
>>> from scipy import fftpack
>>> fftpack.dct(None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"D:\WinPython-32bit-2.7.8.2\python-2.7.8\lib\site-packages\scipy\fftpack\realtransforms.py",
line 135, in dct
return _dct(x, type, n, axis, normalize=norm,
overwrite_x=overwrite_x)
File
"D:\WinPython-32bit-2.7.8.2\python-2.7.8\lib\site-packages\scipy\fftpack\realtransforms.py",
line 222, in _dct
n = tmp.shape[axis]
IndexError: tuple index out of range
# -> works

regards,
Sebastian
> --
> You received this message because you are subscribed to the Google
> Groups "WinPython" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to winpython+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout [1].
>
>
> Links:
> ------
> [1] https://groups.google.com/d/optout

Bo Qiang

unread,
Nov 27, 2014, 11:44:12 PM11/27/14
to winp...@googlegroups.com
Thanks!

I should use:

from scipy import fftpack

then it works.

Very new to python so learn bit by bit.
Reply all
Reply to author
Forward
0 new messages