Problem exporting data from Matlab (Fieldtrip/SPM) for mne-python

Hi.

I'm having trouble getting set of MEG data to load in Python (both 2 and 3).
I'm exporting the data from SPM by converting to Fieldtrip raw format
(spm2fieldtrip), and then calling fieldtrip2fiff.
I get a few warnings here, but the file is saved nonetheless:

the input is raw data with 340 channels and 120 trials
Warning: the data does not contain a trial definition
  In utilities/private/warning_once at 158
  In utilities/private/fixsampleinfo at 66
  In ft_datatype_raw at 154
In ft_checkdata at 224
  In fieldtrip2fiff at 57
  In export at 8
Warning: reconstructing sampleinfo by assuming that the trials are

consecutive > segments of a continuous recording

In utilities/private/warning_once at 158
In utilities/private/fixsampleinfo at 79
In ft_datatype_raw at 154
In ft_checkdata at 224
In fieldtrip2fiff at 57
In export at 8
Reconstructing channel locations, it might be inaccurate
Unknown channel type refmag, assigned to meggrad....

In Python I then try and load the data with mne.fiff.Raw('data.fif'), but
get an exception:

/usr/lib/python2.7/site-packages/mne/fiff/raw.pyc in _read_raw_file(self,

fname, allow_maxshield, preload, compensation, verbose)

    191 else:
    192 if len(raw_node) == 0:
--> 193 raise ValueError('No raw data in %s' % fname)
    194
    195 if len(raw_node) == 1:
ValueError: No raw data in data.fif

I've inspected what is loaded in the debugger, and it appears as if the
file is being read. An exception is thrown however when there are no nodes
found in the meas structure containing FIFFB_RAW_DATA or
FIFFB_CONTINUOUS_DATA.

I'm not familiar with the FIFF file format, so am wondering if anyone knows
whether it is likely the failure to load the data is due to the warnings
given at the Matlab end, or I should be looking elsewhere?

Cheers,
Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20131216/ffc976be/attachment.html

hi nick,

well I guess you should report the problem on the fieldtrip mailing list,
as it's on a bug on their side if the fif file written is not
recognized as a raw file.

did you try to load the same files with the MNE C commands? with neuromag tools?

out of curiosity what processing are you doing with SPM?

Best,
Alex

OK, with the help of Gio Piantoni I've got the data to import into
mne-python with:
mne.fiff.Evoked('data.fif', setno=trialnumber)

The data is single-trial (rather than evoked), but now it's in Python I
should be able to convert to a more appropriate format.

out of curiosity what processing are you doing with SPM?

That's the format I was given the data :slight_smile:
I think pre-processing, artefact removal, epoching etc was performed in
SPM, and I had been using the SPM beamforming toolbox for source
reconstruction, but planning to use MNE for that now.

Nick

Nick, can you put a copy of the file somewhere so that I can have a look at the actual contents with mne_show_fiff

- Matti