Using PyWavelets in Sage

154 views
Skip to first unread message

j wade

unread,
Sep 16, 2010, 10:07:13 PM9/16/10
to sage-support
I would like to use PyWavelets (http://www.pybytes.com/pywavelets/) in
Sage.

I am running Sage 4.3.4 on Ubuntu 9.10.

I have installed python-pywt using Synaptic File Manager, but I am not
sure what to do beyond this. I have refreshed the libraries, and
tried

import scipy
from scipy import pywt

and

import scipy
import pywt

but neither command recognizes pywt.

If someone out there is using pywavelets with Sage, I'd appreciate it
if you could let me know how you were able to get it to work.

Minh Nguyen

unread,
Sep 17, 2010, 12:51:53 AM9/17/10
to sage-s...@googlegroups.com, j wade
Hi,

On Fri, Sep 17, 2010 at 12:07 PM, j wade <wade....@gmail.com> wrote:
> I would like to use PyWavelets (http://www.pybytes.com/pywavelets/) in
> Sage.
>
> I am running Sage 4.3.4 on Ubuntu 9.10.
>
> I have installed python-pywt using Synaptic File Manager, but I am not
> sure what to do beyond this.  I have refreshed the libraries, and
> tried
>
> import scipy
> from scipy import pywt
>
> and
>
> import scipy
> import pywt
>
> but neither command recognizes pywt.

The above steps failed because by default Sage doesn't recognize
Python packages that you have installed system-wide. That is, the
package manager Synaptic installs packages system-wide, whereas the
packages (including Python ones) in Sage are installed specifically
under the SAGE_ROOT top-level directory. So when you issued

import pywt

from within a Sage session, Sage couldn't find pywt because PyWavelets
was not installed under a place where Sage would by default recognize.


> If someone out there is using pywavelets with Sage, I'd appreciate it
> if you could let me know how you were able to get it to work.

Here are the steps that should allow you to install and use PyWavelets
from within Sage.

(1) Download a source release of PyWavelets from
http://pypi.python.org/pypi/PyWavelets/. I downloaded
PyWavelets-0.2.0.tar.bz2 and uncompressed it.

(2) Get the absolute path to your local Sage installation. In my case, it's

/dev/shm/mvngu/sage-4.5.3

(3) Navigate to the top-level directory of the uncompressed PyWavelets
package and install it:

$ cd /path/to/PyWavelets-0.2.0/
$ /dev/shm/mvngu/sage-4.5.3/sage -python setup.py install
<installation messages>

(4) Load Sage and start using PyWavelets:

$ /dev/shm/mvngu/sage-4.5.3/sage
----------------------------------------------------------------------
| Sage Version 4.5.3, Release Date: 2010-09-04 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: import pywt
sage: pywt.families()
['haar', 'db', 'sym', 'coif', 'bior', 'rbio', 'dmey']
sage: w = pywt.Wavelet('db3')
sage: print w
Wavelet db3
Family name: Daubechies
Short name: db
Filters length: 6
Orthogonal: True
Biorthogonal: True
Symmetry: asymmetric

--
Regards
Minh Van Nguyen

Marshall Hampton

unread,
Sep 17, 2010, 6:50:34 AM9/17/10
to sage-support
I just made an spkg for this that seems to work, so you could also do:

sage -i http://sage.math.washington.edu/home/mhampton/PyWavelets-0.2.0.p0.spkg

Putting this in the experimental repository is now trac ticket 9932:

http://trac.sagemath.org/sage_trac/ticket/9932

-Marshall Hampton
> (1) Download a source release of PyWavelets fromhttp://pypi.python.org/pypi/PyWavelets/. I downloaded
Reply all
Reply to author
Forward
0 new messages