Back to the main page.
Bug 1094 - header caching for read_biosig_data.m
Status | CLOSED FIXED |
Reported | 2011-10-31 14:02:00 +0100 |
Modified | 2019-08-10 11:46:19 +0200 |
Product: | FieldTrip |
Component: | fileio |
Version: | unspecified |
Hardware: | PC |
Operating System: | Windows |
Importance: | P1 normal |
Assigned to: | Tilmann Sander-Thommes |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Tilmann Sander-Thommes - 2011-10-31 14:02:14 +0100
Due to the BIOSIG combining header and data reading in one function, the read_biosig_data.m function is very slow for random access (trial reading). Header caching with read_biosig_data.m can be programmed, but it should not be always on. I suggest to define ... global biosig_caching = 1; ... in the top level calling script and then check for this variable in the low level function: % READ_BIOSIG_DATA reads data from EEG file using the BIOSIG ... if isglobal(biosig_caching) ... ... The users in need of fast trial reading would benefit and at the same time the functionality would be totally transparent to the casual user. A help text explaining this would be added to read_biosig_data.m . If this approach is not welcome, please tell me that. Yours, Till
Robert Oostenveld - 2011-10-31 21:39:16 +0100
The low-level code should not have to know about the caching. Why would you not implement this consistently with the other format-independent implementations in ft_read_header? I.e. read_biosig_header would be called once, the hdr would be rememberer in ft_read_header as the persistent "cacheheader" variable, and upon subsequent repeated calls to ft_read_data->read_biosig_data the persistent hdr would get passed.
Tilmann Sander-Thommes - 2011-11-01 09:57:23 +0100
This is a good suggestion, but it would not work in conjunction with ft_preprocessing as I cannot pass on the cacheheader between the calls to ft_read_header and ft_read_data within preprocessing !? ft_read_data does not know the persistent cacheheader variable. Or is that wrong ? A solution could be to have the persistent cacheheader within read_biosig_data and check for its content. If present the header does not need to be read again. What do you think ?
Robert Oostenveld - 2011-11-03 10:51:33 +0100
there are file formats where it is on by default. This could be one of them.
Tilmann Sander-Thommes - 2011-11-16 15:17:25 +0100
Made header caching default for the BIOSIG. Changes in read_biosig_data and ft_read_header. Random access reading is much faster now.