[FieldTrip] FT doesn't close .fif files

Alexandre Gramfort gramfort at nmr.mgh.harvard.edu
Wed Feb 9 17:41:05 CET 2011

the filename is stored raw.info

we could close the file after the fiff_setup_read_raw
and then do
raw.fid = fopen(raw.info.filename)
before reading from it later.

see my attempt :


would this solve your pb?


On Wed, Feb 9, 2011 at 11:16 AM, Vladimir Litvak <v.litvak at ion.ucl.ac.uk> wrote:
> The question is if it would be possible to pre-read those fif tags and
> all the other info and store it in the header, then close the file and
> then given just the samples to read to open it again and navigate fast
> to the right place based on the info that has been stored before?
> Those tags don't change (do they?) so it should be sufficient to read
> them once.
> Vladimir
> On Wed, Feb 9, 2011 at 4:05 PM, Alexandre Gramfort
> <gramfort at nmr.mgh.harvard.edu> wrote:
>> Hi Vladimir,
>>> 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?
>> fiff_setup_read_raw reads many things from the fif file:
>> - measurement info
>> - sampling rate
>> - first/last time sample
>> to do this it locates in the file the location of all the info (the fif tags).
>> So when you look for something in the file, you go down the tree
>> (in matlab) and that points you to the location in the file where to read.
>>> Could there perhaps be a faster version for
>>> repeated calls that would make it possible to keep fileio code
>>> stateless?
>> we could write a single function that does both :
>> fiff_setup_read_raw and fiff_read_raw_segment
>> if it can help.
>> Alex
> The information in this e-mail is intended only for the person to whom it is
> addressed. If you believe this e-mail was sent to you in error and the e-mail
> contains patient information, please contact the Partners Compliance HelpLine at
> http://www.partners.org/complianceline . If the e-mail was sent to you in error
> but does not contain patient information, please contact the sender and properly
> dispose of the e-mail.

More information about the fieldtrip mailing list