Vizard 7 » Reference » Input Devices » Other devices » Biopac physiological recording
7.6

Biopac physiological recording

Biopac provides a large range of monitoring devices for detecting physical or physiological changes over time. The Biopac virtual reality platform provides:

Using physical data with Vizard

Vizard supports interaction with the data provided from these devices using the biopacndt.py module, a Python API for connecting to Biopac’s AcqKnowledge software. The connection to AcqKnowledge can be made locally or over the network. As long as the Respond to auto-discovery requests option is enabled in AcqKnowledge there is no need to specify a remote machine’s IP address in Vizard.

Software setup in AcqKnowledge

Enable the NDT protocol in AcqKnowledge in order to stream data to and from Vizard. In AcqKnowledge go to Display>Preferences>Networking. Select the checkboxes for Enable network data transfer and Respond to auto-recovery requests. Next restart the AcqKnowledge software to activate the Network Data Transfer. This configuration only needs to be done once.

Send events to AcqKnowledge

A common reason for sending events signals are from Vizard to AcqKnowledge is to synchronize stimuli presented in the virtual environment with the physical data. To view the event markers in the AcqKnowledge graph enable Events from the menu option. The following script shows how to send an event:

'''
Press A to toggle acquisition
Press spacebar to drop a marker
'''
import sys

import biopacndt 

import viz
import vizact
import vizinfo

# Connect to the AcqKnowledge server
try:
    acqServer = biopacndt.AcqNdtQuickConnect()
except biopacndt.ACQException:
    viz.log(viz.LOG_ERROR, 'Exiting application, no AcqKnowledge servers found')
    sys.exit()

viz.go()
vizinfo.InfoPanel()
viz.clearcolor(viz.SLATE)

def insert_marker():
    acqServer.insertGlobalEvent('stimulus', '1', '')

vizact.onkeydown(' ', insert_marker)
vizact.onkeydown('a', acqServer.toggleAcquisition)

Recieve data in Vizard

The following example script shows how to get data streamed from AcqKnowledge in Vizard:

'''
Press A to toggle acquisition
Press S to start the data server
Press D to stop the data server
The data server can only be started once
'''

import sys

import biopacndt

import viz
import vizact
import vizinfo

# Connect to the AcqKnowledge server.
try:
    acqServer = biopacndt.AcqNdtQuickConnect()
except biopacndt.ACQException:
    viz.log(viz.LOG_ERROR, 'Exiting application, no AcqKnowledge servers found')
    sys.exit()

# Change data connection method to single. The single data connection
# mode means that AcqKnowledge will make a single TCP network connection to
# deliver the data, all channels being delivered over that same connection.
if acqServer.getDataConnectionMethod() != 'single':
    acqServer.changeDataConnectionMethod('single')
    print('Data Connection Method Changed to: single')

def print_data(index, frame, channelsInSlice):
    print(index, frame)

enabledChannels = acqServer.DeliverAllEnabledChannels()
singleConnectPort = acqServer.getSingleConnectionModePort()
dataServer = biopacndt.AcqNdtDataServer(singleConnectPort, enabledChannels )
dataServer.RegisterCallback('print_data', print_data)

viz.go()
vizinfo.InfoPanel()
viz.clearcolor(viz.SLATE)

vizact.onkeydown('a', acqServer.toggleAcquisition)
vizact.onkeydown('s', dataServer.Start)
vizact.onkeydown('d', dataServer.Stop)

Additional information

For additional information, please visit www.biopac.com