I am not sure yet if this is a real bug but I noticed that the number of marker names and number of marker onsets mismatch after importing an eyelink asc file.
I expected that marker.values marker.names and data should have equal sizes.
struct with fields:
data: [2858×1 double]
markerinfo: [1×1 struct]
header: [1×1 struct]
data{2}.markerinfo
ans =
struct with fields:
name: {2860×1 cell}
value: [2860×1 double]
After comparing the imports from versions 4.0.2 with 4.2.0 I can see that that the first and last marker names (4.2.0) are not included in the cell arrays of marker names imported by the older pspm version.
I couldn't find anything in the pspm_trim.m file that takes into account these size differences. My guess is that it has something to do with the import_eyelink.m function and that some irrelevant eyelink messages are saved as marker names. However, I have not had the time to verify this with a different data set.
All the best,
Sasa
Please let me know if this is a valid work around or if I am seeing a bug where there is none.
PSPM v4.2.0
import_eyelink.m
line 259
% construct markers
markers.markers = false(size(dataraw, 1), 1);
markers.times = [];
markers.names = {};
for idx = msg_indices
msgline = messages{idx};
parts = split(msgline);
time = str2num(parts{2});
markers.markers(bsearch(timecol, time)) = true;
markers.times(end + 1, 1) = time;
markers.names{end + 1, 1} = cell2mat(join(parts(3:end), ' '));
end
My work around
% construct markers
markers.markers = false(size(dataraw, 1), 1);
markers.times = [];
markers.names = {};
for idx = msg_indices
msgline = messages{idx};
parts = split(msgline);
time = str2num(parts{2});
% I have several cases where 2 markers times are identical although with
% different names. Identical times become problematic in the next
% step when we use them as index. This is my workaround so far...
if ~isempty(markers.times) && time == markers.times(end)
time = time+1;
end
% I am using ismeber instead of index = bsearch(x,var) here because
% if the var that we are looking for is not included in the data vector
% then index becomes max(x).
i_search = find(ismember(timecol, time));
if ~isempty(i_search)
markers.markers(i_search) = true;
markers.times(end + 1, 1) = time;
markers.names{end + 1, 1} = cell2mat(join(parts(3:end), ' '));
else
%dont save time and name
end
end
Dear Sasa,
Thank you for letting us know about this issue. Could you please verify whether my understanding of the issue as explained below is correct?
The current Eyelink import code loads markers incorrectly
In case I understood it correctly, I agree with you that the code should be able to handle both of these cases possibly differently than how it does currently. The workraround you suggested seems reasonable, and it might be sensible to use it in case of urgency as we look into this issue more closely and patch it as soon as we can, while also trying to preserve the behaviour of the function in regard to the other PsPM components it interacts with. However, if there is a point missing in my description of the problem, please add further details, and if possible, provide sample data that we can use to reproduce the issue exactly.
Kind regards,
Eshref
Sure
https://box.uke.de/f/8231317