Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to extract actual periods or frequencies used in Python version? Normalization? #35

Open
bjunor opened this issue May 22, 2023 · 1 comment

Comments

@bjunor
Copy link

bjunor commented May 22, 2023

I'd like to be able to plot the actual frequencies or actual periods on my scaleograms. I'm using code based on the advanced Python examples so that I can use the optimization. But fcwt returns scales as a SWIG object and I'm not sure what to do with that. (<fcwt.fcwt.Scales; proxy of <Swig Object of type 'Scales *' at 0x000002154D2B70F0> >) Is there a way get to some approximation of the actual periods or frequencies used?

Also what does the normalization option do? Normalized to what?

@felixdollack
Copy link
Contributor

There is the function getFrequencies you can call on the scales object.

fs = 1000
f0 = 0.1 #lowest frequency
f1 = 5 #highest frequency
fn = 300 #number of frequencies

#initialize Morlet wavelet with wavelet parameter (sigma) 2.0
morl = fcwt.Morlet(2.0)

#initialize scales
scales = fcwt.Scales(morl, fcwt.FCWT_LINFREQS, fs, f0, f1, fn)

#initialize output array
freqs = np.zeros((fn,), dtype=np.float32)

# get frequencies from swig scale object
scales.getFrequencies(freqs)

Just watch out, it seems that the frequencies coming out of that call are in decreasing order. Here the first is around 5 (f1) and the last one is 0.1 (f0).

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

No branches or pull requests

2 participants