Skip to content

Commit

Permalink
Fix trialend from 0.4.8
Browse files Browse the repository at this point in the history
  • Loading branch information
kalaschnik committed Aug 4, 2023
1 parent d6957ce commit 23d5c3d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion eyewit/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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", , "[email protected]", role = c("aut", "cre"),
Expand Down
19 changes: 10 additions & 9 deletions eyewit/R/get_looks.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)]

Expand Down Expand Up @@ -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 &&
(
Expand All @@ -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
Expand Down

0 comments on commit 23d5c3d

Please sign in to comment.