Welcome! Log In Create A New Profile

Advanced

Saccade Detector Adapter (Feature Request)

Posted by Liner 
Saccade Detector Adapter (Feature Request)
November 05, 2020 08:26PM
Dear All & Jaewon,

Has anyone fashioned a strategy using current adapters that can be used as a saccade detector, or would a new one need to be written?

The features I'm looking for in a saccade detector if it were an adapter:

1. Success=True if the eye position moved a minimum threshhold distance & velocity (deg/sec).
2. Be able to count # of saccades during a window of time based on above the threshholds in #1.
3. NOT be dependent on a target radius.
4. Be able to distinguish blinks from saccades.
5. Provide locations of the fixations.

Example scenario: a scene that connects SingleTarget, WaitThenHold, LooseHold and a SaccadeDetector adapter that would provide a reward if the monkey made less than a maximum of up to 2 saccades to the SingleTarget location.

Thanks ahead for the feedback,

Linus
Re: Saccade Detector Adapter (Feature Request)
November 07, 2020 01:15AM
Making a saccade detector is not difficult, but I would rather leave it to individual users for a few reasons.

First, there is no single method that works for all situations, especially considering blink detection together.

Second, detecting saccades does not work without smoothing and derivative calculations, which are very costly operations to do online. Smoothing also causes variable delays in calculation, depending on the size of the kernel.

Third, I am a bit skeptical about the usefulness of such an adapter. In most cases, saccades are induced by presenting targets at specific locations, so just waiting for eye signals around the targets works well.

I don't understand the example scenario you mentioned. If the subject takes multiple saccades to get to the target, the first saccade is probably not even aimed at the target. Are you talking about a case like a subject makes an overshoot or undershoot initially and does a corrective saccade?
Re: Saccade Detector Adapter (Feature Request)
November 13, 2020 02:09AM
Quote
Third, I am a bit skeptical about the usefulness of such an adapter. In most cases, saccades are induced by presenting targets at specific locations, so just waiting for eye signals around the targets works well. I don't understand the example scenario you mentioned. If the subject takes multiple saccades to get to the target, the first saccade is probably not even aimed at the target. Are you talking about a case like a subject makes an overshoot or undershoot initially and does a corrective saccade?

Yes that could be one situation. Another possibility would be visual search on a blank screen: timers/events are triggered based at the start of a certain saccade # (e.g. the 2nd saccade) or at the start a certain fixation # (e.g. 1st or 4th). Essentially I'm wondering if ML2 can detect and be triggered based on:

1) the start of a saccade before a window crossing occurs?
2) the exact start of a fixation after crossing into a window?

This would be exceptionally helpful for experiments where temporal precision is desired either to turn on a screen pixel, LED or laser at a certain moment during time of flight or precise moment after fixation has been acquired.

Quote
Making a saccade detector is not difficult, but I would rather leave it to individual users for a few reasons. First, there is no single method that works for all situations, especially considering blink detection together. Second, detecting saccades does not work without smoothing and derivative calculations, which are very costly operations to do online. Smoothing also causes variable delays in calculation, depending on the size of the kernel.

I agree that there are no perfect methods, just approximations with compromises. One cheap approximation Pentium CPUs could pull off with REX was to calculate degrees moved in between a small number of adjacent eye position samples (e.g. 6-8 frames or more, each 1 ms). If distance calculated between the frames were above a threshold, it could be considered a non-fixation. If all below thresh hold, it would be a fixation. It wasn't perfect but was good enough as a <10ms saccade/fixation detector for real time behavioral experiments that is not dependent on any window or target location. It could also keep track of the numbers of fixations/movements if needed real-time. This might be one easy implementation of a saccade/fixation detector adapter?

Thanks for the consideration.
Re: Saccade Detector Adapter (Feature Request)
November 16, 2020 02:35PM
There is something you are missing. The scene framework evaluates samples frame by frame, not every millisecond. If you want to trigger something, for example, on the start of a saccade, you need to program in the style of Timing Script v1.
https://monkeylogic.nimh.nih.gov/docs_CreatingTask.html#RuntimeVersion2_Background

To get approximations that you described, you can retrieve most recent 6-to-8 eye samples with the get_analog_data() function and do the calculation yourself.
https://monkeylogic.nimh.nih.gov/docs_RuntimeFunctions.html#get_analog_data

threshold = 0.1;  % degrees
while true
    data = get_analog_data('eye',6);  % most recent 6 samples
    degrees_moved = sqrt(sum((data(1,smiling smiley-data(end,smiling smiley).^2));
    if threshold < degrees_moved, break, end
end

The National Institute of Mental Health (NIMH) is part of the National Institutes of Health (NIH), a component of the U.S. Department of Health and Human Services.