Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
dcnieho committed Feb 8, 2017
2 parents db7637a + 2eed622 commit ef84da8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
*.swp
*.bak
/output/*
/.dropbox
/desktop.ini
24 changes: 14 additions & 10 deletions functions/I2MC/getFixations.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
end

%% beginning and end of fixation must be real data, not interpolated.
% If interpolated, those bit(s) at the edge(s) is excluded from the
% fixation first throw out fixations that are all missing/interpolated
% If interpolated, those bit(s) at the edge(s) are excluded from the
% fixation. First throw out fixations that are all missing/interpolated
for p=length(starttime):-1:1
if all(missing(fixstart(p):fixend(p)))
fixstart(p) = [];
Expand All @@ -95,22 +95,26 @@
end
end

%% caluclate fixation duration
%% calculate fixation duration
% if you calculate fixation duration by means of time of last sample during
% fixation minus time of first sample during fixation (our fixation markers
% are inclusive), then you always underestimate fixation duration by one
% sample because you're in practice counting to the beginning of the
% sample, not the end of it. To solve this, as end time we need to take the
% timestamp of the sample that is one past the last sample of the fixation.
% so, first get new end time
endtime = timestamp(min(fixend+1,length(timestamp))); % make sure we don't run off the end of the data
% if last fixation ends at end of data, we need to make up how long that
% sample is and add that to the end time
% so, first calculate fixation duration by simple timestamp subtraction.
fixdur = endtime-starttime;
% then determine what duration of this last sample was
extratime = timestamp(min(fixend+1,length(timestamp)))-timestamp(fixend); % make sure we don't run off the end of the data
% if last fixation ends at end of data, we need to determine how long that
% sample is and add that to the end time. Here we simply guess it as the
% duration of previous sample
if ~isempty(fixend) && fixend(end)==length(timestamp) % first check if there are fixations in the first place, or we'll index into non-existing data
endtime(end) = endtime(end) + diff(timestamp(end-1:end));
extratime(end) = diff(timestamp(end-1:end));
end
% now calculate fixation duration correctly.
fixdur = endtime-starttime;
% now add the duration of the end sample to fixation durations, so we have
% correct fixation durations
fixdur = fixdur+extratime;


%% check if any fixations are too short
Expand Down

0 comments on commit ef84da8

Please sign in to comment.