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 keyspace as fast and accurately 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.  In this case, it might be obvious that the Vigilance Task is a modified version of the SART (i.e., there are other tasks).

Table of Contents

Sustained Attention

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

Psychomotor Vigilance Test

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 periods.

The experiments are free to use as anyone pleases. You need to have PsychoPy installed to run these tasks. Luckily, PsychoPy is free! For a more recent version of the experimental task: see the Psychomotor Vigilance Test in PsychoPy tutorial (with downloads). In that post, you can, as indicated, also download the task and run it freely.

Please note that I have not yet piloted the tasks more than tested the task. If you plan on using them, please do a pilot test of the tasks and let me know if there are any problems.

The script can be downloaded at my GitHub page, SART.

Note that response time data is stored in seconds. If you need to convert it to milliseconds, use your favorite software and multiply each cell by 1000 (one second is 1000ms). Do pilot the task before you use it; I have not.

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

References

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 http://www.ncbi.nlm.nih.gov/pubmed/9204482

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. http://doi.org/10.1016/j.neuropsychologia.2010.05.002

14 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.

      Regards,

      Erik

  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).

        Wishes,

        Erik

  3. hi Erick, i’d like to use you script, but testing it i can’t figure out in the data file the number that refers to the RTs. The number is too long (e.g 11164231300354000). Is it a cell format problem? How can a set it to read the RTs in ms?

    1. Giulia, sorry for the late reply. The response times from the script should be in seconds. However, that long numbers mean that something else is going on. On my Ubuntu computer, I get the RT in seconds. It’s really hard to know whats going on. I am sorry.

    1. The response times are in seconds. One second is 1000ms. Thus, you can just convert your RTs to ms. by multiplying each RT. I typically start by using Python when preprocessing my data. Using Pandas data frames to store date, you can just take your column (RT) and multiply it by 1000: frame.RT = frame.RT*1000. If you are using SPSS you could probably use “compute variables” (if I remember it correctly) or syntax. Hope it helps,

      Erik

  4. Fernanda Garza

    Hi Erik,

    I’m interested in using the SART experiment you created for my thesis. I’ve been running it on Psychopy for the past hour and it’s not working for me. It says that there’s an error on line 189. The first box that asks for information such as age, sex and other variables pops up. When I want to start running the experiment, my screen goes black and then nothing happens. It says that there’s an error in line 189, though I’m not sure why.

    Could you help me out?

    Fernanda.

    1. Hey Fernanda,

      Sorry for the late reply. It would be easier for me if you could copy-paste the error since it’s very hard for me to know what’s going on except for something on line 189. Do this by sending me an email, preferably, and I will try to help you get the SART task running. Also, be careful to see that your data is correctly recorded (see other comments for instance regarding the response time from the SART task.

  5. Hi Eric,

    I’ve tried running your test a number of times, and every time the accuracy always comes up as 0 and the RT are always a long string of numbers that exceed one second (ex: 1.11450874). Any idea why this might be the case?

    1. Hey Ryan!

      I am not sure. I know that some people seem to have this problem. I will have a look as soon as possible (it may take some time due to that I am finishing up my Ph.D. thesis).

      Take care,

      Erik

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top
Share via
Copy link