micropython-ulab icon indicating copy to clipboard operation
micropython-ulab copied to clipboard

[FEATURE REQUEST] add Hilbert transform

Open labodezao opened this issue 3 years ago • 9 comments

Hi, I wonder if it's possible to implement the hilbert transform with micropython ulab. Best regards

labodezao avatar Aug 30 '21 19:08 labodezao

I assume, you want the implementation of https://docs.scipy.org/doc/scipy/reference/generated/scipy.fftpack.hilbert.html. However, before we add that, I wanted to ask, whether you could already calculate the Hilbert transform via the Fourier transform by applying the relation: Relationship with the Fourier transform.

v923z avatar Aug 31 '21 05:08 v923z

Hi, this is the right feature. It's certainly possible to code this manually, yes, but some of my tries where hazardous :)

labodezao avatar Jan 02 '22 14:01 labodezao

OK, but the question is, whether this has to be implemented, if the same functionality can be gotten with the already available tools. In order to keep the flash size small, I would rather implement things with some python wrapper. https://github.com/v923z/micropython-ulab/tree/master/snippets

v923z avatar Jan 02 '22 14:01 v923z

Hmm yes i did not think about it :)

labodezao avatar Jan 02 '22 15:01 labodezao

@labodezao I am not sure, where this issue stands now. Do you want to implement this functionality as a snippet, or should we close it?

v923z avatar Jan 29 '22 16:01 v923z

This could be a good idea, but I don't have the knoloedge to modify the code :)

labodezao avatar Jan 29 '22 17:01 labodezao

This could be a good idea, but I don't have the knowledge to modify the code :)

But if it is supposed to be a snippet, then you would write the code in python, so you would not have to change anything in the code base. That's the beauty of it.

v923z avatar Jan 29 '22 17:01 v923z

How can I do that ?


http://labodezao.fr/

Ewen d'Aviau 9 rue fernand de Magellan 44600 Saint-Nazaire 06-02-37-53-22

Le sam. 29 janv. 2022 à 18:14, Zoltán Vörös @.***> a écrit :

This could be a good idea, but I don't have the knowledge to modify the code :)

But if it is supposed to be a snippet, then you would write the code in python, so you would not have to change anything in the code base. That's the beauty of it.

— Reply to this email directly, view it on GitHub https://github.com/v923z/micropython-ulab/issues/436#issuecomment-1024950257, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALPYWOME5KNOBZAFWWCM2EDUYQN73ANCNFSM5DCRD4TA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you were mentioned.Message ID: @.***>

labodezao avatar Jan 29 '22 17:01 labodezao

You have access to the Fourier transform, and then you use what is written in https://en.wikipedia.org/wiki/Hilbert_transform#Relationship_with_the_Fourier_transform. You can calculate the phase of your signal by calling np.atan2, and then shift the phase by +/-90 degrees. This all can be done in python.

EDIT: if this is performance-critical, we could move the calculations to C, but first I would like to see a working implementation in python.

v923z avatar Jan 29 '22 17:01 v923z