Hi,
I need to use the mTRF toolbox in Matlab to compute TRFs and reimport that matrix back into MNE.
I essentially exported the model matrix and I get a 1001 x 129 matrix. The includes 1001 TRFs and 129 channels, including bad channels and stimulus channels. The MEG generally has sfrq=1000Hz, but the TRF matrix basically squeezes this to 1 (as far as I understand), when one TRF has tmin=0s and tmax=1s.
I can basically do:
import mne
from scipy import io
# Save the info parameters from a real MEG data file (.fif) to get the channels:
mne.io.write_info('meg_template.json', raw.info)
# read this file:
meg_template = mne.io.read_info('meg_template.json')
# Load the MATLAB file
mat_data = io.loadmat('/path/to/model.mat')
model = mat_data['savemodel2']
info_new = mne.create_info(ch_names=meg_template.ch_names, sfreq=1)
then:
raw2 = mne.io.RawArray(model.T, info_new)
Creating RawArray with float64 data, n_channels=129, n_times=1001
Range : 0 ... 1000 = 0.000 ... 1000.000 secs
Ready.
with raw2.plot() this looks really broken.
When I give sfreq=1000 then I get something that looks like a proper TRF function, but obviously it’s 1s of “data”.
I also don’t have any proper meta data that would look like an MEG.
Has anybody solved this problem before and might be able to offer some advice?
I also tried to use the mTRFpy module, but could not get this to work at all…
thanks,
Dennis
I’m using MNE 1.6.1, MacOS 14.2.1.