tmalsburg / saccades

Detection of fixations and saccades in eyetracking data
GNU General Public License v2.0
76 stars 14 forks source link

Blink Detection #15

Open jgeller112 opened 4 years ago

jgeller112 commented 4 years ago

Hi!

It is my understanding that tracklossed data are usually labeled as blinks? The blink detect function is not working with some of the data I am processing. Interestingly, it works with data from Experiment Builder, but not when I process data from Psychtoolbox. I compared the below data to the sample report from SR and there are some large discrepancies in blink detection.

install::remotes("dmirman/gazer")
samp <- system.file("extdata", "samp.xls", package = "gazer")
samp<-fread(samp)

 blk <- saccades::detect.fixations(samp, lambda=16)

blk1 <- blk %>%
        dplyr::filter(event=="blink") %>%
        tidyr::gather(data=., key="startend", value="time", start:end) # gather all the blinks
blk_merge <- dplyr::full_join(samp, blk1)
tmalsburg commented 4 years ago

I suspect that one of your data sets uses NAs to code trackloss. In this case the code for blink detection might fail. Could you provide sample data?

For a description of the blink detection heuristic see: https://github.com/tmalsburg/saccades#blinks-and-artifacts

jgeller112 commented 4 years ago

The data were collected with EyeLink so I believe all the trackloss is 1e+08. There are no x,y coordinates with NAs. The sample data can be extracted with the above code. I will show a few lines of the data. The first few rows should be labeled as a blink, but are not.

# A tibble: 6 x 11
  trial    time    gxL    gyL   paL     gxR     gyR   paR   pup      x      y
  <dbl>   <int>  <dbl>  <dbl> <dbl>   <dbl>   <dbl> <dbl> <dbl>  <dbl>  <dbl>
1     1 2244092 1.00e8 1.00e8     0  1.00e8  1.00e8     0     0 1.00e8 1.00e8
2     1 2244094 1.00e8 1.00e8     0  1.00e8  1.00e8     0     0 1.00e8 1.00e8
3     1 2244096 1.00e8 1.00e8     0  1.00e8  1.00e8     0     0 1.00e8 1.00e8
4     1 2244098 1.00e8 1.00e8     0  1.00e8  1.00e8     0     0 1.00e8 1.00e8
5     1 2244100 1.00e8 1.00e8     0 NA      NA         NA     0 1.00e8 1.00e8
6     1 2244102 1.00e8 1.00e8     0  1.00e8  1.00e8     0     0 1.00e8 1.00e8

Label here refers to the start and end of a blink.

# A tibble: 704,918 x 6
   trial    time         x         y   pup Label
   <dbl>   <int>     <dbl>     <dbl> <dbl> <chr>
 1     1 2244092 100000000 100000000     0 NA   
 2     1 2244094 100000000 100000000     0 NA   
 3     1 2244096 100000000 100000000     0 NA   
 4     1 2244098 100000000 100000000     0 NA   
 5     1 2244100 100000000 100000000     0 NA   
 6     1 2244102 100000000 100000000     0 NA   
 7     1 2244104 100000000 100000000     0 NA   
 8     1 2244106 100000000 100000000     0 NA   
 9     1 2244108 100000000 100000000     0 NA   
10     1 2244110 100000000 100000000     0 NA  
tmalsburg commented 4 years ago

If you provide me with a reproducible example, I could look into this and hopefully find out what happening.