Difference between revisions of "Ultrasession.py"

From Phonlab
Jump to navigationJump to search
Line 19: Line 19:
 
Each time <code>ultrasession.py</code> runs it creates a timestamped subdirectory in the directory identified by <code>--datadir</code>. This subdirectory contains:
 
Each time <code>ultrasession.py</code> runs it creates a timestamped subdirectory in the directory identified by <code>--datadir</code>. This subdirectory contains:
   
1. a <code>*.bpr</code> file that contains the ultrasound image data. (The <code>*</code> indicates a timestamp.)
+
* a <code>*.bpr</code> file that contains the ultrasound image data. (The <code>*</code> indicates a timestamp.)
1. a <code>*.bpr.idx.txt</code> file that contains a list of frame indexes corresponding to the frames of data in the <code>.bpr</code> file. This list of indexes is important for detecting dropped frames in the <code>.bpr</code> data. At high acquisition rates some images will be missed.
 
   
 
* a <code>*.bpr.idx.txt</code> file that contains a list of frame indexes corresponding to the frames of data in the <code>.bpr</code> file. This list of indexes is important for detecting dropped frames in the <code>.bpr</code> data. At high acquisition rates some images will be missed.
1. a two-channel <code>*.bpr.wav</code> file containing audio data captured from a microphone in the first channel and the ultrasound synchronization signal in the second channel.
 
   
 
* a two-channel <code>*.bpr.wav</code> file containing audio data captured from a microphone in the first channel and the ultrasound synchronization signal in the second channel.
1. a copy of the imaging parameter file specified by <code>--params</code>
 
   
 
* a copy of the imaging parameter file specified by <code>--params</code>
1. if the <code>--stim</code> or <code>--stims</code> option is used, a file named <code>stim.txt</code> that contains the stimulus item used for the acquisition.
 
   
1. if the <code>--log-versions</code> option is used, a file named <code>versions.txt</code> that contains information related to the version of <code>ultracomm</code> used in the acquisition.
+
* if the <code>--stim</code> or <code>--stims</code> option is used, a file named <code>stim.txt</code> that contains the stimulus item used for the acquisition.
  +
 
* if the <code>--log-versions</code> option is used, a file named <code>versions.txt</code> that contains information related to the version of <code>ultracomm</code> used in the acquisition.
   
 
The first two items are created by <code>ultracomm</code> directly, and the remaining files are added by <code>ultrasession.py</code>. The last two optional files are created if you use <code>ultrasession.py</code> in an Opensesame experiment in the recommended way.
 
The first two items are created by <code>ultracomm</code> directly, and the remaining files are added by <code>ultrasession.py</code>. The last two optional files are created if you use <code>ultrasession.py</code> in an Opensesame experiment in the recommended way.

Revision as of 13:55, 18 August 2015

ultrasession.py is a Python script that acquires ultrasound data via the ultracomm utility while simultaneously acquiring an audio signal and the ultrasound synchronization signal. In addition it creates timestamped acquisition directories and logs various acquisition parameters so that they are available for postprocessing.

The favored method of calling ultrasession.py in the Phonology Lab is by including it in an Opensesame experiment.

Usage

ultrasession.py requires a parameter file that it passes to ultracomm. It also requires you to specify an output data directory:

 python C:\Anaconda\Scripts\ultrasession.py --params \path\to\params.cfg --datadir \path\to\output\dir

Since ultracomm is a Windows-only utility ultrasession.py must run under Windows. The path to ultrasession.py shown here is its standard location on the Phonology Lab's ultrasound acquisition workstation.

For a full listing of options, use:

 python C:\Anaconda\Scripts\ultrasession.py --help

Output files

Each time ultrasession.py runs it creates a timestamped subdirectory in the directory identified by --datadir. This subdirectory contains:

  • a *.bpr file that contains the ultrasound image data. (The * indicates a timestamp.)
  • a *.bpr.idx.txt file that contains a list of frame indexes corresponding to the frames of data in the .bpr file. This list of indexes is important for detecting dropped frames in the .bpr data. At high acquisition rates some images will be missed.
  • a two-channel *.bpr.wav file containing audio data captured from a microphone in the first channel and the ultrasound synchronization signal in the second channel.
  • a copy of the imaging parameter file specified by --params
  • if the --stim or --stims option is used, a file named stim.txt that contains the stimulus item used for the acquisition.
  • if the --log-versions option is used, a file named versions.txt that contains information related to the version of ultracomm used in the acquisition.

The first two items are created by ultracomm directly, and the remaining files are added by ultrasession.py. The last two optional files are created if you use ultrasession.py in an Opensesame experiment in the recommended way.