Ultrasession in opensesame

From Phonlab
Revision as of 13:24, 19 August 2015 by Ronald (talk | contribs)
Jump to navigationJump to search

The recommended way to acquire ultrasound data in the Phonology Lab is via an Opensesame experiment. You can use Opensesame to display a series of prompts to a subject and use inline scripts to run and control the data acquisition utilities ultracomm and ultrasession.py. A simple experiment proceeds like this:

  1. Set configuration variables related to data acquisition. These are the imaging parameters and the location to store results.
  2. Initialize the ultrasound acquisition system.
  3. Loop over a list of stimuli which are used to prompt the subject.
    1. Display a preparatory prompt to the subject.
    2. Start data acquisition with ultrasession.py and wait until the ultrasound system confirms that it is imaging.
    3. Display a speaking prompt to the subject during data acquisition. This prompt can be shown for a defined duration, or it can be displayed until the subject presses a key.
    4. Send a signal to ultrasession.py to stop data acquisition.


Sample experiment

A sample experiment that contains the steps listed in the previous section is available in the ultracomm repository on github. See the test experiment provided in the latest release.

The sample experiment relates to the listed steps as follows:

  • The ultrasound_arguments inline script defines variables related to data acquisition, and you need to edit some variable definitions. The most important variables to change are myparams, which points to your imaging parameters file, and datadir, which is the parent directory for your timestamped acquisitions. In the Phonology Lab the datadir should be somewhere on the U: drive. Set do_log to True if you want ultracomm to produce a detailed log of its activity.


  • The init_ultrasound inline script initializes the Ultrasonix system. You should not need to make any changes to this script.
  • The stimuli loop object contains a list of prompts to display to the subject. The prompts are provided in the stimulus variable, and to keep things simple you should give your prompt variable the same name.
  • The display_word_prep object shows the preparatory prompt to the subject. Customize this display for your own needs.
  • The run_ultrasession inline script starts ultrasession.py and waits until the ultrasound system has confirmed it is imaging. You should not need to change this script unless you the name of your prompt variable.
  • The display_word_while_acquiring object displays the acquisition prompt to the subject. Customize this display for your own needs. It can end after a duration of your choosing, or on a keypress.
  • The stop_acquisition inline script terminates ultrasession.py. You should not need to change this script.