Extracting Information from -tfr.h5 Files

MNE Version: 0.22.0
OS: Windows 10

I’ve generated -tfr.h5 files for making time frequency graphs. However, I’d like to extract and use the data within the .h5 files to create alternative data comparisons. I found the following on StackOverflow and thought it would be a good starting point for me: hdf5 - Open h5 file to use with MNE python - Stack Overflow

While I begin trying to navigate through the files as per the above example, I wanted to know if I could get some specific feedback here related to the information that I want to extract.

Specifically, I’d like to get the actual values (then the average) of the power of a range of frequencies (for example, 8-12Hz) within specific time points (for example 0-1 seconds) within my epoched data and so on for varying time points (1-2 sec, 2-3sec, 3-4sec). This would allow me to have a useful table of information with comparative values, which I could then create comparative trend or bar graphs of different data sets that I have prepared.

If this is something that is already easily done in mne, I would very much appreciate a link or comment on this. Alternatively, if someone has some experience extracting and manipulating the data stored in .h5 files, I am sure your feedback would be helpful as well.

Thank you all for your time and assistance.

J

you should use https://mne.tools/stable/generated/mne.time_frequency.read_tfrs.html
to read such files

Alex

Thanks Alex. I have used the read_tfrs() function previously to generate tfr graphs as are done in the mne tutorials. I believe that my main problem is that I do not have experience working with hdf5 files and thus I am unfamiliar with how to properly extract the relevant information in the format that I need.

I’ve been reading more (Introduction to HDF5) and have explored my h5 files with HDFView, but I still am having issues understanding how the data is formatted.

Thank you for your comment though. If you have more thoughts, please do not hesitate to let me know.

after reading the tfr with read_tfrs you can have everything in the tfr object (data, channel names etc)

don’t try to reverse engineer the format. It’s done by the read_tfrs reader

Alex