From 23d5c3d33d229730d7799584283b0b03e276e838 Mon Sep 17 00:00:00 2001 From: Steven Kalinke <9831678+Kalaschnik@users.noreply.github.com> Date: Fri, 4 Aug 2023 20:39:49 +0200 Subject: [PATCH] Fix trialend from 0.4.8 --- eyewit/DESCRIPTION | 2 +- eyewit/R/get_looks.R | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/eyewit/DESCRIPTION b/eyewit/DESCRIPTION index 5e8fbfa..b34d0f0 100644 --- a/eyewit/DESCRIPTION +++ b/eyewit/DESCRIPTION @@ -1,6 +1,6 @@ Package: eyewit Title: Bootstrapping Common Eyetracking Tasks around Tobii’s I-VT Filter -Version: 0.4.8 +Version: 0.4.9 Date: 2022-02-22 Authors@R: person("Steven", "Kalinke", , "steven.kalinke@gmail.com", role = c("aut", "cre"), diff --git a/eyewit/R/get_looks.R b/eyewit/R/get_looks.R index fdd1811..e69da37 100755 --- a/eyewit/R/get_looks.R +++ b/eyewit/R/get_looks.R @@ -267,8 +267,6 @@ get_looks <- function(df, # operate WITHIN the current fixation pair (i.e., within a trial) for (i in min_fi:max_fi) { - - # get all hit names within current fixation index hit_names_in_fi <- df[[column_name]][which(df$fi == i)] @@ -469,13 +467,6 @@ get_looks <- function(df, first_looks_collection[[hn]]$first_look_initial_timestamp <- df$timestamp[fi_pairs$fistart[i]] } - # if this is the last fixation and since this if-block tracks if we are in an overflowing fixation - # we can set the ending reason to trialend and and make a forced_stop for the first_looks_collection - current_first_look_ending_reason[[hn]] <- "trialend" - first_looks_collection[[hn]]$forced_stop <- TRUE - # overwrite current_first_look_duration[[hn]] to include saccades and error data and not only fixations - current_first_look_duration[[hn]] <- end_ms - first_looks_collection[[hn]]$first_look_initial_timestamp - if ( first_looks_collection[[hn]]$found_first && !first_looks_collection[[hn]]$forced_stop && ( @@ -489,6 +480,16 @@ get_looks <- function(df, # update current_first_looks_last_fi to next fi current_first_look_last_fi[[hn]] <- i + # if this is the last fixation and since this if-block tracks if we are in an overflowing fixation + # we can set the ending reason to trialend and and make a forced_stop for the first_looks_collection + current_first_look_ending_reason[[hn]] <- "trialend" + first_looks_collection[[hn]]$forced_stop <- TRUE + # overwrite current_first_look_duration[[hn]] to include saccades and error data and not only fixations + current_first_look_duration[[hn]] <- end_ms - first_looks_collection[[hn]]$first_look_initial_timestamp + # moreover we can break this iteration, since the trial ended and outside and timecritertion is possible anymore + break + + # check if outside label is between this fi and the next fi if (i < max(df$fi, na.rm = TRUE) && is_hitname_in_range(df[[column_name]], outside_aoi_label, i, i + 1)) { # outside fixation or saccade after last fi