Integration with Biopac
Initial Setup
Note: To enable data streaming from SightLab to Acqknowledge, you need to activate the NDT Network Data Transfer protocol in AcqKnowledge (NDT is a licensed feature add-on).
- In AcqKnowledge, go to Display > Preferences > Networking.
- Select the checkboxes for "Enable network data transfer" and "Respond to auto-recovery requests".
- Restart the AcqKnowledge software to activate the Network Data Transfer.
This configuration only needs to be done once.
Enabling Biopac Integration in SightLab
GUI Version
- You can send markers to Acqknowledge with the GUI version by using a checkbox.
Non-GUI Version
- Set
sl.SightLab(biopac=True)
in the main SightLab instance. - This will send markers to Acqknowledge when you fixate on objects, including the name of the object.
Sending Custom Events to Biopac
You can set flags and send events to Biopac Acqknowledge at any time during your session:
sightlab.set_flag('something happened')
if sightlab.biopacFlag == True:
sightlab.acqServer.insertGlobalEvent('something happened', 'stim', '')
Replace 'something happened' with your own event title.
Viewing Events in Acqknowledge
- Enable the events bar in Acqknowledge.
- You can also display the "Event Palette" from the dropdown window.
- After a session, events will appear on the timeline alongside physiological data.
- Click on events to see their corresponding names
Running Multiple Trials
If you are running multiple trials, you will need to open Acqknowledge and go to Playback- Set up Data Acquisition- Length/ Rate and change this to "Autosave", and save "using" to "disk". This will save individual data files to a folder. On first run you will be prompted to choose a folder to save to.
You can also view the events palette to see a timeline of events
Linking Video Recordings
To link up a video recording (which you can obtain by selecting to record a video when running Sightlab), you can go to Media-Setup in Acqknowledge. Then , click on the "linked media" tab- Edit- and then select your video to link.
Note: For compressed videos, you may need to adjust the delay to make sure it is at "0"
To playback the media go to Media- Show Playback Viewer, and now you can click through the events in the events palette to skip to that part in the video playback. You can also use the "I Beam" tool in Acqknowledge to select a point in the timeline to see the corresponding data and video playback and scrub through the data.
Saving Physiological Data to the SightLab Data Files
To save the Acqknowledge Physiological data to the Sightlab Trial Data file, see the sample code below. Also in ExampleScripts under Biopac Saving to Data Files
and Biopac Saving Average to Summary
for saving averages to the summary file. This also includes a script to view a comparison chart of a condition versus the effect it has on the average physiological measurement.
import sightlab_utils.sightlab as sl
from sightlab_utils import biopacndt
import viztask
# Initialize SightLab with Biopac enabled
sightlab = sl.SightLab(biopac=True)
def outputToScreen(index, frame, channelsInSlice):
for i, value in enumerate(frame):
# Round and log to custom trial data
sightlab.setCustomTrialData(str(round(value, 4)), f"Channel_{i}")
# Biopac server setup
enabledChannels = sightlab.acqServer.DeliverAllEnabledChannels()
dataServer = biopacndt.AcqNdtDataServer(sightlab.acqServer.getSingleConnectionModePort(), enabledChannels)
dataServer.RegisterCallback("OutputToScreen", outputToScreen)
# Experiment function
def sightLabExperiment():
yield viztask.waitKeyDown(' ')
yield sightlab.startTrial()
#Start the BIOPAC data server
dataServer.Start()
yield viztask.waitKeyDown(' ')
yield sightlab.endTrial()
#Stop the BIOPAC data server
dataServer.Stop()
# Schedule experiment
viztask.schedule(sightlab.runExperiment)
viztask.schedule(sightLabExperiment)
Running Acqknowledge on Another Machine
SightLab is using AcqNdtQuickConnect by default so this will return an AcqNdtServer object either for the localhost computer or, if AcqKnowledge is not running on the local computer, the first computer
found on the network where AcqKnowledge is running with networking functionality enabled.
Additional Resources
- For more detailed information, consult the Acqknowledge Manual under "Help" in Acqknowledge.
- To learn about getting data from Acqknowledge to SightLab, see the "BioFeedback_Ball_Biopac" example in the ExampleScripts folder.
- For more information on Biopac see their website https://www.biopac.com/
- For a video tutorial on using Biopac with Sightlab VR, see below