Back to the main page.
Bug 2808 - reading the last sample from a neuromag fif file returns 0
Status | CLOSED FIXED |
Reported | 2015-01-19 23:49:00 +0100 |
Modified | 2019-08-10 12:40:48 +0200 |
Product: | FieldTrip |
Component: | fileio |
Version: | unspecified |
Hardware: | PC |
Operating System: | Mac OS |
Importance: | P5 normal |
Assigned to: | |
URL: | |
Tags: | |
Depends on: | |
Blocks: | |
See also: |
Robert Oostenveld - 2015-01-19 23:49:36 +0100
this only happens if you read only the very last sample. If you read more, it will not be zero.
Jan-Mathijs Schoffelen - 2017-01-23 14:28:52 +0100
This is indeed the case, but the issue is more generic. If in general just a single sample of data is asked, ft_read_data returns all zeros. This can be traced back to line 213 in fiff_read_raw_segment. Data is only assigned to the output if picksamp>0, i.e. if more than a single sample is requested. Changing the '>' into '>=' would solve it. @Alex: do you see a principled reason to keep it '>' rather than to change it into '>='? (apart from the fact that it is a bit silly to ask only for a single sample of data...) If not, we probably would want to make this change also in the mne-matlab code.
Alexandre Gramfort - 2017-01-23 17:13:08 +0100
no objection to change this in the mne-matlab code can you open a pull request on github? thanks Alex
Jan-Mathijs Schoffelen - 2017-01-24 07:58:12 +0100
Sure, done.
Jan-Mathijs Schoffelen - 2017-01-24 09:23:16 +0100
Fixed in FT with PR 307.
Robert Oostenveld - 2019-08-10 12:34:38 +0200
This closes a whole series of bugs that have been resolved (either FIXED/WONTFIX/INVALID) for quite some time. If you disagree, please file a new issue on https://github.com/fieldtrip/fieldtrip/issues.