Closed tensionhead closed 1 year ago
I still have one question though: the Scalogram trying to recapitulate Figure 3 of the NatComm publication looks as expected:
To make a proper test of the Python superlet function I checked the amplitudes of the scalogram along the harmonic frequencies (dashed lines above) against the true signal amplitudes:
The true amplitude is 10, so for the 20Hz signal there is a slight overshoot, and for the faster 60Hz signal the amplitude can only be recovered to around 80%. Is that to be expected?
Hello,
Yes, that is to be expected. The frequency neighbors are what's causing this behavior due to constructive or destructive interferences between the frequency components. For example, this is what I'm getting with FASLT with o=1:30 and c1=3, on the signal from the MATLAB variant. [image: image.png] Tuning the parameters more thoroughly could get you a better result, though.
If all's well, I will merge your pull request later today.
Cheers, Harald
On Fri, 17 Feb 2023 at 13:45, tensionhead @.***> wrote:
I still have one question though: the Scalogram trying to recapitulate Figure 3 of the NatComm publication looks as expected: [image: test_scalogram] https://user-images.githubusercontent.com/10595420/219645220-5e66a65c-861c-4c20-a110-ce934a1bacd0.png
To make a proper test of the Python superlet function I checked the amplitudes of the scalogram along the harmonic frequencies (dashed lines above) against the true signal amplitudes:
[image: scalogram_profiles] https://user-images.githubusercontent.com/10595420/219643708-ec3abaee-d130-4a8a-a219-9fda10b5f19f.png
The true amplitude is 10, so for the 20Hz signal there is a slight overshoot, and for the faster 60Hz signal the amplitude can only be recovered to around 80%. Is that to be expected?
— Reply to this email directly, view it on GitHub https://github.com/TransylvanianInstituteOfNeuroscience/Superlets/pull/2#issuecomment-1434525022, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR3QLFHEOFZUR47KZKPISODWX5QBTANCNFSM6AAAAAAU7KNLDE . You are receiving this because you are subscribed to this thread.Message ID: <TransylvanianInstituteOfNeuroscience/Superlets/pull/2/c1434525022@ github.com>
-- Harald Bârzan, PhD Transylvanian Institute of Neuroscience (TINS), Department of Experimental and Theoretical Neuroscience, Str. Ploiesti 33 https://maps.google.com/?q=Str.+Ploiesti+33&entry=gmail&source=g, 400157 Cluj-Napoca, Romania Email: @.***
Ah ok I see, thx for the explanation! What about the 2nd (in time) localized harmonic though, it does not have a frequency neighbor yet shows very similar amplitude response? The image you posted sadly does not show here so far..
Oh, yeah! Forgot to mention that. It wholly depends on the parameters - if you use a very large upper order (say you do 1:30), then most of your wavelets will be larger than the target packet, thereby diminishing the combined amplitude response. Consider it like using an FFT window - if you fill that window completely with a sine wave, you will get the desired amplitude. If you only fill it by 50%, you will get an amplitude that is only 50% of the sine's amplitude. The same thing (roughly) happens with the superlet as well.
The image I sent previously roughly looks like what you've obtained in python. Here I'm attaching another one (this time a file, maybe it works now, dunno what's wrong with gmail these days), where I use c1=3 and an order range of 5:10. This doesn't solve the interference problem (because it's a problem that's related to the signal itself, not to the estimation technique), but the second packet does not overshoot or undershoot the target (sine amplitude is 1 so the estimated power should read 0.5).
On Fri, 17 Feb 2023 at 15:58, tensionhead @.***> wrote:
Ah ok I see, thx for the explanation! What about the 2nd (in time) localized harmonic though, it does not have a frequency neighbor yet shows very similar amplitude response? The image you posted sadly does not show here so far..
— Reply to this email directly, view it on GitHub https://github.com/TransylvanianInstituteOfNeuroscience/Superlets/pull/2#issuecomment-1434686921, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR3QLFBMHHLXIBIDSRH5OCLWX57VNANCNFSM6AAAAAAU7KNLDE . You are receiving this because you commented.Message ID: @.*** com>
-- Harald Bârzan, PhD Transylvanian Institute of Neuroscience (TINS), Department of Experimental and Theoretical Neuroscience, Str. Ploiesti 33 https://maps.google.com/?q=Str.+Ploiesti+33&entry=gmail&source=g, 400157 Cluj-Napoca, Romania Email: @.***
Oh yes, that makes a lot of sense! So it's the distribution of Wavelets of different cycle numbers within the superlet which determines the performance, longer wavelets won't fully cover the packet and hence penalize the weighted amplitudes . As for FASLT we always use a linear scaling (so uniform distribution?!) of the order, tweaking the lower and upper limits of the cycle numbers does the trick as you described!
I guess sending images via email via github does not really work, I always just drag and drop them here in the github web-interface. But ok, the important thing is we have coinciding results between Matlab and Python, thx for your quick check :+1:
I changed the API such that users can directly input desired frequencies to compute the superlet transform, without first having to convert to scales. Additionally I separated out the test script, which is now also a proper test, i.e. can be run with
pytest
.