beauchamplab / rave

For all RAVE info, including installation instructions, visit
https://beauchamplab.github.io/rave
23 stars 5 forks source link

feature request: import power data from matlab or python OR more options to compute power (e.g., multitaper) #45

Open XiaoyuZeng opened 3 years ago

XiaoyuZeng commented 3 years ago

Hi all.

The preprocess module of RAVE calculated power using wavelet. I wondered that is it possible to provide more options to calculate power, such as multi-taper? Alternatively, RAVE users may compute power through multitaper way via matlab or python toolbox, and import the power data to RAVE to use the power explorer module.

Best regards, Xiaoyu

dipterix commented 3 years ago

Thanks @XiaoyuZeng ,

Yes this is totally doable. As long as they follow RAVE file convention. RAVE files are stored at project > subject > rave folder. The critical data files use HDF5, csv, or yaml formats that can be generated or read by Matlab, Python, or C.

We are working on a new grant to incorporate Python and Matlab pipelines/models into RAVE. In the future there will be RAVE extensions for Matlab and Python.

Right now RAVE only has one pipeline because we re-implemented wavelet in R to make sure the results align with Matlab code. This makes the dev procedure slow. The reason why we do wavelet is because it also generates phase data. If you really want multitaper. There is a multitaper package. I will look at it and provide code (not interactive modules) for you to play with.

dipterix commented 3 years ago

Also, just a quick reference for myself - Code to preprocess subject without GUI https://github.com/beauchamplab/rave/issues/18

XiaoyuZeng commented 3 years ago

@dipterix Thanks for the reply! I will try to first do multitaper power computation in fieldtrip, and then move the power data to project/subject/rave/data/power to see whether it works.

jmagnotti commented 3 years ago

Not to discourage the attempt, but it won’t be quite as easy as that. I’m not sure we have the time to help you debug the process fully at the moment as we are working on other items currently. I think this is a worthwhile endeavor, though, and maybe our best chance of success would be to have a quick zoom chat to go over the RAVE data structures with you? The next couple weeks are hectic, but maybe the second week of December would work

XiaoyuZeng commented 3 years ago

@jmagnotti @dipterix Actually, our attempt to load the power data exported from MATLAB has succeeded. The key point is to export the HDF 5 file correctly. So far, the power explorer seems to work well with the replaced power data.

Thanks for your support!

jmagnotti commented 3 years ago

Oh, ok. So you first processed in RAVE, and then just replaced the data within the .h5 files? Gotcha, I understand now :) clever. I thought you were working with a new subject that didn't have any files in place.

Just a thought: The common average referencing probably won't work, as that relies on power and phase, but if you referenced the data prior to multi taper you should be good to go.

XiaoyuZeng commented 3 years ago

@jmagnotti Yes, you got me.

Here comes a short note for those RAVE users who demand to use RAVE power explorer to showcase the power data exported from other toolboxes. Basically, you can achieve the goal within two steps.

  1. Create a new subject and a new project in RAVE (via preprocess). This step serves to create the corresponding data folder and metadata files for each sub in each project. After that, revise the generated metadata files (e.g., electrode, epoch).
  2. Export the power data you produced with other toolboxes to .h5 files correctly. To make this step easier to succeed, you may load a demo .h5 file first and replace the corresponding content of the .h5 file with your own power data. Finally, you just move the .h5 files to the power folder. Note that, if you found that the power explorer didn't show the replaced power data, it's likely due to the cache power data. You may have a try to delete the cache power data ('data_dir\project\sub\rave\data\cache\power').

Good luck.

Thanks again for the helpful guide from @dipterix @jmagnotti