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

Adaptive sampling of wavelets #4

Open
jchutrue opened this issue Apr 17, 2019 · 7 comments
Open

Adaptive sampling of wavelets #4

jchutrue opened this issue Apr 17, 2019 · 7 comments

Comments

@jchutrue
Copy link
Member

At the lower frequencies, we need more samples to get an accurate representation of the wavelet, but at higher frequencies, we need fewer. I need to figure out a better way of sampling the wavelets rather than the default of 16000 samples or so.

@ckemere
Copy link

ckemere commented Apr 18, 2019

I'm confused. I always define the root wavelet (i.e., scale = 1), which corresponds to something close to the highest frequency being sampled. Lower frequencies are just stretched versions of this. The duration of the wavelet should scale with increasing scale (decreasing frequency)?

@jchutrue
Copy link
Member Author

Hmm I was doing it backward, where I computed the number of points that the lowest frequency wavelet needed to be sampled sufficiently. I set this level to be 1. Then for example, if the frequency doubled, the number of samples should be halved.

For the example I was testing, the lowest frequency was around 0.15 Hz and needed 25000 points. At 150 Hz, my strategy said I only need 25, but when I checked the wavelet's representation, it was definitely undersampled

@ckemere
Copy link

ckemere commented Apr 18, 2019

This is the benefit of the "scales"-focused approach. In your example, you might have been undersampling 0.15Hz without realizing.

@jchutrue
Copy link
Member Author

You are correct. The wavelet implementation I adapted my code around dealt only with frequencies, not scales. I'll take another look at the Morse papers and see what they did.

@jchutrue
Copy link
Member Author

There's a formula here that is analogous to the temporal bandwidth:
https://royalsocietypublishing.org/doi/pdf/10.1098/rspa.2016.0776

See equation 2.8. From preliminary tests, about 4 times this value seemed to give sufficient sampling. I'll go verify on the lowest frequencies too.

@ckemere
Copy link

ckemere commented Apr 19, 2019

The whole point of the wavelet is that you convolve with h( (t -a)/b) ). b is the scale. So if the wavelet h(t) is time limited, it should be time limited the same amount regardless of scale. Equation 2.8 is just saying this. I don't understand why you don't just use scale internally???

@jchutrue
Copy link
Member Author

jchutrue commented Apr 19, 2019

From a maintenance perspective, I find frequencies easier to work with, and this is how Lilly's own Morse wavelet package is implemented. In fact, all of the functions I've adapted use normalized radians, not scales.

Internally for the transform object, I do scale the number of wavelet samples by the ratio of the frequencies to the mother wavelet peak frequencies, per equation 2.8.

This adaptive wavelet sampling based on the scale/frequency is now up on the develop and unstable branches, and is working. You can also specify a voices_per_octave argument like MATLAB's cwt function.

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