Giter Club home page Giter Club logo

pywt's Introduction

Important

We're moving! The new home for the project is https://github.com/PyWavelets.

Thanks everyone for starring, forking and following this repository on Github.

The PyWavelets project has a new home and maintainers.

Please go to https://github.com/PyWavelets/pywt and follow the development and new releases there.

PyWavelets - Discrete Wavelet Transform in Python

PyWavelets is a free Open Source wavelet transform software for Python programming language. It is written in Python, Cython and C for a mix of easy and powerful high-level interface and the best performance.

PyWavelets is very easy to start with and use, and currently is capable of:

  • 1D and 2D Forward and Inverse Discrete Wavelet Transform (DWT and IDWT)
  • 1D and 2D Stationary Wavelet Transform (Undecimated Wavelet Transform)
  • 1D and 2D Wavelet Packet decomposition and reconstruction
  • Approximating wavelet and scaling functions
  • Over seventy built-in wavelet filters and custom wavelets supported
  • Single and double precision calculations
  • Results compatibility with Matlab Wavelet Toolbox (tm)

Build Status

Requirements

PyWavelets is a package for the Python programming language. It requires:

Download

The most recent development version can be found on GitHub at https://github.com/nigma/pywt.

Latest release, including source and binary package for Windows, is available for download from the Python Package Index.

Install

In order to build PyWavelets from source, a working C compiler (GCC or MSVC) and a recent version of Cython is required.

  • To install PyWavelets open shell prompt and type pip install PyWavelets or easy_install PyWavelets.
  • To build and install from source, navigate to downloaded PyWavelets source code directory and type python setup.py install.
  • The in-development version of PyWavelets can be installed with pip install PyWavelets==dev or easy_install PyWavelets==dev.

Prebuilt Windows binaries and source code packages are also available from Python Package Index.

Binary packages for several Linux distributors are maintained by Open Source community contributors. Query your Linux package manager tool for python-wavelets, python-pywt or similar package name.

Documentation

Documentation with detailed examples and links to more resources is available online at http://www.pybytes.com/pywavelets/ and http://pywavelets.readthedocs.org.

For more usage examples see the demo directory in the source package.

Contributing

PyWavelets started in 2006 as an academic project for a master thesis on Analysis and Classification of Medical Signals using Wavelet Transforms and is maintained by its original developer.

All contributions including bug reports, bug fixes, new feature implementations and documentation improvements are welcome.

Go and fork on GitHub today!

Python 3

Python 3 development branch is at https://github.com/nigma/pywt/tree/py-3. Check out the changelog for info. Currently the code and examples are ported to work on Python 2.7 and 3.2 from the same codebase.

Contact

Use GitHub Issues or PyWavelets discussions group to post your comments or questions.

License

PyWavelets is a free Open Source software released under the MIT license.

Commercial Support

For information on commercial support and development email me at [email protected].

pywt's People

Contributors

nigma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pywt's Issues

Python 3 Support

I was able to compile the master branch after using 2to3, but it won't import:

In [148]: import pywt
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/home/me/<ipython-input-148-ea1b55fe832f> in <module>()
----> 1 import pywt

/home/me/.local/lib64/python3.2/site-packages/pywt/__init__.py in <module>()
     11 """
     12 
---> 13 import _pywt, multilevel, multidim, wavelet_packets, functions
     14 from _pywt import *
     15 from multilevel import *

ImportError: No module named _pywt

waverec doesn't reconstruct original signal

waverec sometimes generates a reconstruction that is a different length from the data passed to wavedec. For example, the haar decomposition of a 21775 length vector is reconstructed as a 21776 length vector.

iswt2

First of all, thanks for a very useful module! I'm very new to wavelets, so please forgive me if this is a stupid question.

Is there a reason there isn't an implementation of iswt and iswt2 in pywt? I've seen code for iswt on the Google Groups discussion, but I really want to quickly try out denoising images with SWT, for which I need an implementation of iswt2.

Any chance that you've got that code somewhere but not yet committed it?!?

Some equivalent function in R package ('wmtsa') not available in pywt, e.g. wavVar()

Hi,
I am trying to implement some wavelet analysis in Python for some R code wrote previously.

One function used in earlier R version code is discrete wavelet variance estimation ( 'wmtsa', page69,http://cran.r-project.org/web/packages/wmtsa/wmtsa.pdf). But I couldn't find equivalent function to implement in pywt package. Does any one knows alternative solution to that if I want to implement the similar function in Python?

Thanks!
Tao

Continuing PyWavelets development on PyPi

Hi @nigma, as you may have seen on my repo the activity has further picked up and we've decided to start creating new releases: https://github.com/rgommers/pywt/issues/61. We're planning on doing a v0.3.0 release which is fully backwards compatible and with Python 3.x support this weekend. And quickly after that a v0.4.0 with more new features and refactoring.

Our question is whether you are okay with giving us (one or more of me, @kwohlfahrt, @grlee77 and @aaren) access to https://pypi.python.org/pypi/PyWavelets so we can put those releases there. That would be friendlier to users than renaming the repo and making it really a fork.

Compilation issue (Cython) : probable solution.

As I understand it, Cython went through a change recently. Pywt no longer compiles with the latest Cython unless "src/_pywt.pyx" changes new to cinit.

Now, I don't know Cython well enough myself to know this for myself. I just know that another project "https://code.google.com/p/pyffmpeg/issues/detail?id=44" comment #3 stated flatly that this change needs to take place, and pywt compiles after I make the change.

Using updated cygwin, with "pip" updated Cython.

How to use scaling parameter in PyWavelet?

I'm using wavelet transform for crop phenology detection. In this i'm using Modis ndvi time series (9 months 8-days composite). I want to apply wavelet transform with scale 32. I know to apply wavelet transform. What i want to know is how to give scaling parameter.

Thanks in advance
Rajasivaranjan

length of returned arrays

why does pywt.dwt(np.arange(8),'db2') return two arrays of size 5 each? As far as I understand the DWT should always do a downsampling of size 2, no matter the length of the filter... Am I missing something?

EDIT: sorry, saw the official repo has moved. Maybe it would be best to delete this one?

Bug in SWT, max level

In the maximum level decomposition function there is some random code checking how many times the input is divisible by 2.

I believe this is a bug.

Installation fails on Python3.4

I cannot install the module. Trying from pip repositories:

pip3 install pywt --pre
Collecting pywt
  Could not find a version that satisfies the requirement pywt (from versions: )
No matching distribution found for pywt

OK. I clone it from github and run pip3 install .. Error:

    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/var/folders/97/527pmsxx5nb7_vfnb8621nqm0000gn/T/pip-gfrdmja_-build/setup.py", line 14, in <module>
        from util import commands
      File "/private/var/folders/97/527pmsxx5nb7_vfnb8621nqm0000gn/T/pip-gfrdmja_-build/util/commands.py", line 25, in <module>
        import templating
    ImportError: No module named 'templating'

I guess it is not specified as a dependency explicitly. When I try to install templating, I get the same error:

pip3 install templating
Collecting templating
  Could not find a version that satisfies the requirement templating (from versions: )
No matching distribution found for templating

As i cannot find templating repository I post it here

installation error: module 'templating' missing

The following information is collected during installation using pip. Similar massage is also received while installing using git cloned file.

Collecting pywavelets
Using cached PyWavelets-0.2.2.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 20, in
File "/private/var/folders/6z/13s_74351fvdz6zfd2np0zdm0000gn/T/pip-build-8507a3rq/pywavelets/setup.py", line 14, in
from util import commands
File "/private/var/folders/6z/13s_74351fvdz6zfd2np0zdm0000gn/T/pip-build-8507a3rq/pywavelets/util/commands.py", line 25, in
import templating
ImportError: No module named 'templating'

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/6z/13s_74351fvdz6zfd2np0zdm0000gn/T/pip-build-8507a3rq/pywavelets

Horizontal and vertical detail possibly switched in wavedec2

Hi,

I noticed that horizontal and vertical bands may be switched around in wavedec2. Here is some IPython notebook code to reproduce this:

import numpy as np
import pywt
from scipy.misc import imread, imsave
from skimage.draw import polygon
import matplotlib.pyplot as plt
%matplotlib inline

img = np.zeros((256, 256))

poly1 = np.array((
        (50, 50),
        (50, 100),
        (100, 100),
        (100, 50)
    ))

poly2 = np.array((
        (150, 100),
        (100, 150),
        (150, 200),
        (200, 150),
    ))

rr, cc = polygon(poly1[:, 0], poly1[:, 1], img.shape)
img[rr, cc] = 1

rr, cc = polygon(poly2[:, 0], poly2[:, 1], img.shape)
img[rr, cc] = 1

db4 = pywt.Wavelet('db4')
img_w = pywt.wavedec2(img, db4, mode='sym', level=1)

fig1, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2)

ax1.imshow(np.absolute(img_w[0]), cmap=plt.cm.gray)
ax1.axis('off')
ax1.set_title('Approximation')

ax2.imshow(np.absolute(img_w[1][0]), cmap=plt.cm.gray)
ax2.axis('off')
ax2.set_title('Horizontal detail')

ax3.imshow(np.absolute(img_w[1][1]), cmap=plt.cm.gray)
ax3.axis('off')
ax3.set_title('Vertical detail')

ax4.imshow(np.absolute(img_w[1][2]), cmap=plt.cm.gray)
ax4.axis('off')
ax4.set_title('Diagonal detail')

no version information available at runtime

There doesn't seem to be any way to get information about what version of pywt is in use at runtime.
The usual way to get version information from a module is via a module attribute 'version' but there is no such attribute for pywt.

BTW, the reason why I need this is because I am writing a super-installer that installs several modules (including pywt) for use with an application and I want to find out if the user already has the desired version of pywt installed.
Previously, I was creating my own version of pywt and I edited the file "init.py" in the 'pywt' sub-folder of the 'src' folder and added the following line near the top:
version = '0.2.0'
But now that I am using the supplied Windows installer, I can't do this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.