Skip to content
This repository has been archived by the owner on Nov 25, 2021. It is now read-only.

scalogram coi is wrong when time is set #2

Open
rickyegeland opened this issue Jan 30, 2015 · 1 comment
Open

scalogram coi is wrong when time is set #2

rickyegeland opened this issue Jan 30, 2015 · 1 comment

Comments

@rickyegeland
Copy link

The scalogram cone of influence is wrong when the time= parameter is set to put the axis in time units as opposed to sample indices.

import numpy as np
import matplotlib as mpl
from matplotlib import pyplot as plt
import cwt

# make signal
P = 17.0 # period, s
D = 100   # duration, s
N = 1000 # number of samples
x = np.linspace(0, D, N) # time, s
data = np.sin(2*np.pi/P*x)
label = 'P=%0.1f sine wave' % P

# plot signal
plt.plot(x, data)
plt.title(label)
plt.xlabel('Time [s]')
plt.ylabel('signal')

# continuous wavelet transform
scales = np.arange(200)    
mother = cwt.Morlet(len_signal = len(data), scales = scales)
wavelet = cwt.cwt(data, mother)

# plot with builtin function
wavelet.scalogram(time=x, show_coi=True)
@lesserwhirls
Copy link
Collaborator

I'm thinking this may be related to not setting sampf. Let's work on the API of cwt, mother, before checking this one out, if that's ok.

Thanks!

Sean

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants