ppsp-team / HyPyP

The Hyperscanning Python Pipeline
BSD 3-Clause "New" or "Revised" License
73 stars 42 forks source link

Cross-Wavelet Transform (CWT) #71

Open deep-introspection opened 2 years ago

deep-introspection commented 2 years ago

Python implementation

deep-introspection commented 2 years ago

Later on, consider cross-frequency.

claytonjschneider commented 2 years ago

@deep-introspection is there any version of wavelet transform coherence analysis currently in HyPyP? I assumed there was, and on looking at compute_sync, I can't tell but assume the 'coh' connectivity measure refers to cross-spectral coherence?

I am planning to do my analysis using wavelet transform coherence analysis and I am happy to contribute to this toolbox however possible, if the feature does not exist yet.

katied-neuro commented 2 years ago

Hi- we are currently in the process of working on some wavelet based analysis tools based on the cross wavelet transform described in Torrence and Compo's 1998 paper (https://paos.colorado.edu/research/wavelets/). Currently, this works for EEG, but I am still working on some bugs for fNIRS. Later this week, I am planning to upload what I have so far to my branch of HyPyP as a rough draft and provide a link to that here so that you can see what I have so far and if it suits your needs.

claytonjschneider commented 2 years ago

Awesome, thank you for the update @katied-neuro . If you happen to think of it, please @ me here when you push that to your branch! I can do my best to help debug / show you how it works for our data.

katied-neuro commented 2 years ago

Hi @claytonjschneider,

Here is the wavelet draft. I need to add error messages to warn people about duplicate/identical datasets and using too small a time frame for the analyses. I also need to program the plots so that the COI is indicated (i.e. the area not fit for use).

Let me know what you think. https://github.com/katied-neuro/HyPyP/blob/master/tutorial/fnirs-wavelets-2022-07-06kd.ipynb

Thanks!

claytonjschneider commented 2 years ago

Hi @katied-neuro !! Thank you so much! I will take a look now :D appreciate you sharing this with me and all that you are doing at HyPyP

claytonjschneider commented 2 years ago

@katied-neuro do I need to be using a specific branch to access this code for now? If it's the branch under your name, I don't know that I can access it. I got a 404 when trying to look.

katied-neuro commented 2 years ago

Weird- what about if you try to access my branch directly and then find the wavelets in the tutorial section? https://github.com/katied-neuro/HyPyP

claytonjschneider commented 2 years ago

Nice, looks like that works. So I'm going to give this a shot now by cloning the repo, rather than installing via pip, and checkout to your branch, and import the library from sys path before import. Hopefully that works?

katied-neuro commented 2 years ago

Go- for it... Just head's up, I'm a self-taught coder and not very good with Github. So once, the wavelets are finished, I'm going to have to reset my branch to the original HyPyP using git and then upload the final version of the wavelets to avoid anything too weird happening. The other option is just to download the wavelet tutorial and go through it with your current version of HyPyP with out relying on a clone of my repository (this what I am doing!).

claytonjschneider commented 2 years ago

@katied-neuro somehow I'm still running into issues with my versions. ugh.

What is the result when you run import mne >>> mne.version ? I have v1.0.3. When I try to import your hypyp package, I get the same error every time even in the production version: no module named 'mne.externals'. I'm really frustrated with this darned bug I can't seem to get my versions to match up. Using python v3.7.5

katied-neuro commented 2 years ago

Are you talking about my repository or HyPyP in general?I have mne 0.24.0. and looking at HyPyP, it is currently set-up according to the requirements.txt for mne 0.24.0.

claytonjschneider commented 2 years ago

OK I'm back to mne 0.24.0, hopefully that works as I've ran into problems with the previous versions of MNE loading NIRx data before.

Also - how are you adding your local HyPyP branch to your python modules? I tried adding it to the path with sys.path.append, then import hypyp, and got this error: DistributionNotFound: The 'hypyp' distribution was not found and is required by the application.

Then I tried running pip install . from inside the cloned repository, but got an error that the wheel building failed.

I can't seem to find a setup.py if one exists - so how do I import your branch?

claytonjschneider commented 2 years ago

Thanks for helping me through this, I am pretty new to it as well

katied-neuro commented 2 years ago

I think you are doing something a little too complex here. Do you use jupyter notebooks? It might be best to call and try and talk this throug. Do you have an email you can be reached at (if you don't want to post it on github, you could message me on twitter)?

claytonjschneider commented 2 years ago

Aweome! I messaged you on twitter