Difference between revisions of "Ultrasession.py"
m |
Keithjohnson (talk | contribs) |
||
(6 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
<code>ultrasession.py</code> is a Python script that acquires ultrasound data via the [[ultracomm|<code>ultracomm</code> 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. |
<code>ultrasession.py</code> is a Python script that acquires ultrasound data via the [[ultracomm|<code>ultracomm</code> 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 <code>ultrasession.py</code> |
+ | The favored method of calling <code>ultrasession.py</code> is by [[ultrasession in opensesame|including it in an Opensesame experiment]]. |
+ | |||
+ | <code>ultrasession.py</code> is one of the scripts included in the [https://github.com/rsprouse/ultratils <code>ultratils</code> github repository]. |
||
== Usage == |
== Usage == |
||
− | <code>ultrasession.py</code> requires a parameter file that it passes to [[ultracomm|<code>ultracomm</code>]]. It also requires you to specify |
+ | <code>ultrasession.py</code> requires a parameter file that it passes to [[ultracomm|<code>ultracomm</code>]]. 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 |
python C:\Anaconda\Scripts\ultrasession.py --params \path\to\params.cfg --datadir \path\to\output\dir |
||
− | Since <code>ultracomm</code> is a Windows-only utility <code>ultrasession.py</code> must run under Windows. The path to <code>ultrasession.py</code> is its standard location on the |
+ | Since <code>ultracomm</code> is a Windows-only utility <code>ultrasession.py</code> must run under Windows. The path to <code>ultrasession.py</code> shown here is its standard location on the PhonLab's ultrasound acquisition workstation. |
For a full listing of options, use: |
For a full listing of options, use: |
||
Line 17: | Line 19: | ||
== Output files == |
== Output files == |
||
− | 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: |
− | + | * a <code>*.bpr</code> file that contains the ultrasound image data. (The <code>*</code> indicates a timestamp.) |
|
− | + | * 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 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 copy of the imaging parameter file specified by <code>--params</code> |
|
− | + | * 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. |
Latest revision as of 10:02, 26 April 2018
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
is by including it in an Opensesame experiment.
ultrasession.py
is one of the scripts included in the ultratils
github repository.
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 PhonLab'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 namedstim.txt
that contains the stimulus item used for the acquisition.
- if the
--log-versions
option is used, a file namedversions.txt
that contains information related to the version ofultracomm
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.