Sustained Attention Task in PsychoPy

I have created a PsychoPy script for the Sustained Attention to Response Task (SART) and a Vigilance Task. Both of the tasks are very similar. In SART the task is to press the key space as fast and accurate as possible on all targets (digits 1, 2, 4–9) except for one (digit 3). In the Vigilance Task, however, the task is to withhold response on all targets but the digit 3.  It might be obvious that in this case the Vigilance Task is a modified version of the SART (i.e., there are other tasks).

Sustained Attention

Sustained attention can be defined as the capacity one have to direct and focus attention on a task. It has been argued that it is crucial to carrying out more cognitively demanding goals, sequenced actions, or thoughts.


Vigilance, a construct related to sustained attention (according to wikipedia vigilance is also known as sustained concentration), can be defined as the ability to maintain focused attention over longer time periods.

The experiments are free to use as anyone pleases. You need to have PsychoPy installed to run these tasks. Luckily, PsychoPy is free!

Please note, I have not yet piloted the tasks more than testing them myself. If you are planning on using them, please do pilot test the tasks and let me know if there are any problems.

The script can be downloaded at my Github page; SART.

For more information on SART see Robertson et al.m (1997).


Robertson, I. H., Manly, T., Andrade, J., Baddeley, B. T., & Yiend, J. (1997). “Oops!”: performance correlates of everyday attentional failures in traumatic brain injured and normal subjects. Neuropsychologia, 35(6), 747–58. Retrieved from

Smilek, D., Carriere, J. S. a, & Cheyne, J. A. (2010). Failures of sustained attention in life, lab, and brain: Ecological validity of the SART. Neuropsychologia, 48(9), 2564–2570.

6 thoughts on “Sustained Attention Task in PsychoPy

  1. Hi!
    Please I have been using psychopy to run the SART programme that you created. However it gives raw data as output. Any idea how I can summarize scores?
    I would be glad to receive your great direction.
    Thank you

    1. I suggest that you look in one of the references in the post. If that does not help or you cant access them, I can try to help you. I may even update the post with some directions.



  2. Hello,

    When run the SART task, the following message appears:
    self.mask = self.files[‘circleMask’][0]
    KeyError: ‘circleMask’

    Any idea?

    Thanks for yor help!

    1. Hey Contantine,

      I am sorry for the late reply. I just ran the task on my computer and did not get that error. Have you downloaded the entire folder. You’ll need the Stimuli folder also. It contains the circle that is used as masking stimulus between the target stimuli.

      1. Hey Emanuele,

        I tested the script running Ubuntu and Windows 8.1, just now. I can run the task. Not sure why you and Contantine have this problem. If you use another file than’circleMask.png’ (located in the ‘Stimuli’ subfolder) you either have to use the name of that file as a key or change the filename to ‘circleMask’. Right now, I can’t think of any other solutions (I don’t know why this happens to you).



Leave a Reply

Your email address will not be published. Required fields are marked *