mabelcalim / waipy

This guide includes a Continuous Wavelet Transform (CWT), significance tests from based on Torrence and Compo (1998) and Cross Wavelet Analysis (CWA) based on Maraun and Kurths(2004).
https://wavelet-analysis.readthedocs.org/en/latest/index.html
BSD 3-Clause "New" or "Revised" License
79 stars 48 forks source link

Error #7

Open ghost opened 8 years ago

ghost commented 8 years ago

Hi, I installed waipy from github, exactly the way you have described. (NO PIP) So I execute result = waipy.cwt(data_norm, 1, 1, 0.25, 2, 4/0.25, alpha, 6, mother='Morlet') and i get following error

IndexError Traceback (most recent call last)

in () ----> 1 result = waipy.cwt(data_norm, 1, 1, 0.25, 2, 4/0.25, alpha, 6, mother='Morlet') /Users/nicolasf/anaconda/envs/python2/lib/python2.7/site-packages/waipy/cwt/wavetest.pyc in cwt(data, dt, pad, dj, s0, j1, lag1, param, mother) 73 # Wavelet transform 74 import lib_wavelet ---> 75 ondaleta,wave,period,scale,coi,f = lib_wavelet.wavelet(data,dt,mother,param)#,pad,dj,s0,j1,mother,param) 76 power = np.abs(wave*wave) 77 # Significance levels: (variance=1 for the normalized SST) /Users/nicolasf/anaconda/envs/python2/lib/python2.7/site-packages/waipy/cwt/lib_wavelet.pyc in wavelet(Y, dt, mother, param) 130 k_neg = [e \* (-1) for e in k_neg] # negative part 131 k_neg = k_neg[1:-1] # delete the first value of k_neg = last value of k_pos --> 132 k = np.concatenate((k_pos,k_neg), axis =1) # vector of symmetric 133 # compute fft of the padded time series 134 f = np.fft.fft(x,n) IndexError: axis 1 out of bounds [0, 1)
gavin971 commented 7 years ago

Traceback (most recent call last): File "/Users/fuzhp/Downloads/Python_Library/waipy_file/waipy/Waipy Examples /Example 3.py", line 13, in mother='Morlet',name='x') File "build/bdist.macosx-10.6-x86_64/egg/waipy/cwt/wavetest.py", line 88, in cwt File "build/bdist.macosx-10.6-x86_64/egg/waipy/cwt/lib_wavelet.py", line 172, in wavelet IndexError: axis 1 out of bounds [0, 1) [Finished in 1.577s]

I did as the suggestion, but it still did't work and got the wrong info! what should I do ?

gavin971 commented 7 years ago

I modify the "axis=1" with "axis=0" ( lib_wavelet.py and wavetest.py), just get the following warning. Besides, I can run the example(https://wavelet-analysis.readthedocs.io/en/latest/cookbook.html) successfully, and plot the data nino3. (the graph attachment https://www.dropbox.com/s/o861f36bxi67306/figure_1.png?dl=0 )

/Users/fuzhp/anaconda/lib/python2.7/site-packages/waipy-0.0.9.0-py2.7.egg/waipy/cwt/wavetest.py:88: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future /Users/fuzhp/anaconda/lib/python2.7/site-packages/waipy-0.0.9.0-py2.7.egg/waipy/cwt/wavetest.py:89: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future

mabelcalim commented 7 years ago

Hi Gavin

Did you try the example1?

open a terminal:

git clone https://github.com/mabelcalim/waipy.git

cd waipy/

sudo python setup.py install

python

import waipy

import numpy as np

import matplotlib.pyplot as pet

import pylab

z = np.linspace(0,2048,2048)

x = np.sin(50_np.pi_z)

y = np.cos(50_np.pi_z)

data_norm = waipy.normalize(x)

result = waipy.cwt(data_norm, 1, 1, 0.125, 2, 4/0.125, 0.72, 6,mother='Morlet',name='x')

waipy.wavelet_plot('Sine', z, data_norm, 0.03125, result)

pylab.show()

data_norm1 = waipy.normalize(y)

result1 = waipy.cwt(data_norm1, 1, 1, 0.125, 2, 4/0.125, 0.72, 6,

... mother='Morlet',name='y')

waipy.wavelet_plot('Cosine', z, data_norm1, 0.03125, result1)

pylab.show()

cross_power, coherence, phase_angle = waipy.cross_wavelet(result['wa ve'],

... result1['wave'])

waipy.plot_cross('Crosspower sine and cosine', cross_power, phase_angle,

... z, result, result1)

pylab.show()

I didn't have time to fix all the examples in github.

Please, check if the example n.1 it's working on your machine.

regards Mabel


Mabel Calim Costa Instituto Nacional de Pesquisas Espaciais - INPE Cachoeira Paulista -SP

+55 (12) 3186 - 8566 (ramal 8566)

On 21 October 2016 at 13:12, gavin971 notifications@github.com wrote:

Traceback (most recent call last): File "/Users/fuzhp/Downloads/Python_Library/waipy_file/waipy/Waipy Examples /Example 3.py", line 13, in mother='Morlet',name='x') File "build/bdist.macosx-10.6-x86_64/egg/waipy/cwt/wavetest.py", line 88, in cwt File "build/bdist.macosx-10.6-x86_64/egg/waipy/cwt/lib_wavelet.py", line 172, in wavelet IndexError: axis 1 out of bounds [0, 1) [Finished in 1.577s]

I did as the suggestion, but it still did't work and got the wrong info! what should I do ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mabelcalim/waipy/issues/7#issuecomment-255403857, or mute the thread https://github.com/notifications/unsubscribe-auth/AGNvDXBFpHySNq5bnRqkYfRcUS_l8rYzks5q2NZIgaJpZM4Jdd_Q .

mabelcalim commented 7 years ago

Hi Gavin,

Can you explain better which axis did you modified? In wavetest.py you do not suppose to change the axis :

global_ws = variance * (np.sum(power.conj().transpose(), axis=0) / n) this means that the conjugate power is transpose in the first dimension = axis =0

joint_wavelet = np.concatenate((np.fft.ifft(ondaleta)[np.ceil( n / 2.):], np.fft.ifft(ondaleta)[np.ceil(n / 2.):][::-1]), axis=1) this means that I need to concatenate the significant values in the second dimension = axis =1

Regards Mabel


Mabel Calim Costa Instituto Nacional de Pesquisas Espaciais - INPE Cachoeira Paulista -SP

+55 (12) 3186 - 8566 (ramal 8566)

On 22 October 2016 at 00:15, gavin971 notifications@github.com wrote:

_I modify the axis=1 with axis ( libwavelet.py and wavetest.py), just get the following warning. Besides, I can run the example(https://wavelet-analysis.readthedocs.io/en/latest/cookbook.html https://wavelet-analysis.readthedocs.io/en/latest/cookbook.html) successfully, and plot the data nino3. (the graph attachment _https://www.dropbox.com/s/o861f36bxi67306/figure_1.png?dl=0 https://www.dropbox.com/s/o861f36bxi67306/figure_1.png?dl=0_ )

/Users/fuzhp/anaconda/lib/python2.7/site-packages/waipy- 0.0.9.0-py2.7.egg/waipy/cwt/wavetest.py:88: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future /Users/fuzhp/anaconda/lib/python2.7/site-packages/waipy- 0.0.9.0-py2.7.egg/waipy/cwt/wavetest.py:89: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mabelcalim/waipy/issues/7#issuecomment-255501410, or mute the thread https://github.com/notifications/unsubscribe-auth/AGNvDXxCX_qBbl0aUGAli3UFKzA4zaZvks5q2XGkgaJpZM4Jdd_Q .

mabelcalim commented 6 years ago

Hi! Yesterday I converted waipy to python3.6. Now it's waipy0.0.1.0! Try to check the example_python3.6 on my github (https://github.com/mabelcalim/waipy)

I hardly recommend to install from github: in your path: git clone https://github.com/mabelcalim/waipy.git cd waipy python3 setup.py install

And try to use the example ;) If you have some problem to install, please let me know!

Thanks for choosing waipy! Best regards Mabel

Kangarooamso commented 5 years ago

Hi,am running this code: result = waipy.cwt(data_norm, 1, 1, 0.125, 2, 4/0.125, 0.72, 6,mother='Morlet',name='x') and getting the AxisError below:

AxisError Traceback (most recent call last)

in () 1 result = waipy.cwt(data_norm, 1, 1, 0.125, 2, 4/0.125, 0.72, ----> 2 6,mother='Morlet') /home/okama/anaconda2/lib/python2.7/site-packages/waipy/cwt/wavetest.pyc in cwt(data, dt, pad, dj, s0, j1, lag1, param, mother) 73 # Wavelet transform 74 import lib_wavelet ---> 75 ondaleta,wave,period,scale,coi,f = lib_wavelet.wavelet(data,dt,mother,param)#,pad,dj,s0,j1,mother,param) 76 power = np.abs(wave*wave) 77 # Significance levels: (variance=1 for the normalized SST) /home/okama/anaconda2/lib/python2.7/site-packages/waipy/cwt/lib_wavelet.pyc in wavelet(Y, dt, mother, param) 130 k_neg = [e * (-1) for e in k_neg] # negative part 131 k_neg = k_neg[1:-1] # delete the first value of k_neg = last value of k_pos --> 132 k = np.concatenate((k_pos,k_neg), axis =1) # vector of symmetric 133 # compute fft of the padded time series 134 f = np.fft.fft(x,n) AxisError: axis 1 is out of bounds for array of dimension 1 Kindly help to solve it