[FieldTrip] FT doesn't close .fif files

Vladimir Litvak v.litvak at ion.ucl.ac.uk
Wed Feb 9 16:54:29 CET 2011

Hi Alexandre,

So why does fiff_setup_read_raw take so long? Do you really need half
a second to open a fif file or does it also read some header data not
all of which is necessary? Could there perhaps be a faster version for
repeated calls that would make it possible to keep fileio code


On Wed, Feb 9, 2011 at 3:31 PM, Alexandre Gramfort
<gramfort at nmr.mgh.harvard.edu> wrote:
> Hi,
>> The design idea is that reading from files shoudl be
>> stateless, i.e. prior and after each read operation the file should be
>> closed. On modern file systems there is no penalty associated with that, and
>> it keeps the code much cleaner. That is why fieldtrip does not have a
>> ft_open_file and ft_close_file function, and why you cannot close the file
>> (except with fclose('all')).
>> Do you happen to know whether fiff_read_meas_info and fiff_setup_read_raw
>> are supposed to keep the files open? I could not find a fiff_close function,
>> do you know whether there is one?
> fiff_setup_read_raw keeps the files open for subsequent calls of
> fiff_read_raw_segment, fiff_read_raw_segment_times etc.
> when done the file can be closed with :
> fclose(raw.fid)
> assuming you used:
> raw = fiff_setup_read_raw(filename);
> FYI (I wanted to wait but it seems to be a good occasion)
> the mne-matlab code is now publicly hosted on line:
> https://github.com/mne-tools/mne-matlab
> latest commits:
> https://github.com/mne-tools/mne-matlab/commits/master
> the license of this code has been changed to BSD.
> If you have feature request, bug reports or willing to contribute some code
> that's a good place to do it. If you need help, just send me an email.
> If fieldtripers turn out to modify the mne matlab code it would be great to
> consider applying the modifications on the main repository.
> Alex
> --
> Alexandre Gramfort, PhD
> gramfort at nmr.mgh.harvard.edu
> Dept. of Radiology MGH Martinos Center / Harvard Medical School
> http://www-sop.inria.fr/members/Alexandre.Gramfort/
> _______________________________________________
> fieldtrip mailing list
> fieldtrip at donders.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/fieldtrip

More information about the fieldtrip mailing list