Skip to content

Choice Comparison

Overview

The Choice Comparison Template is a versatile SightLab experiment template designed to allow participants to make choices between two objects using various input methods: laser pointer, rating scale, or keypress. This template can be easily set up using either the SightLab GUI or leveraging the built in SightLab and Vizard code, as well as expanding with python. The default configuration involves choosing between two food items, but it can be adapted for various comparison tasks.

Use for Consumer Preference Studies , Product Placement, Decision Making Strategies and more. 

Features

  • Input Methods: Allows participants to make choices using a laser pointer, rating scale, or keypress.
  • Data Collection: Captures all included SightLab data as well as object chosen and  choice confirmation time.
  • Interactive Replay: Use the SightLab Session Replay to review participant interactions.
  • Biopac Integration: Synchronizes physiological data with Biopac Acqknowledge.
  • Graph Generation: Automatically generates bar charts summarizing the number of times each object was chosen across trials.

Key Components of Potential Studies:

  • Eye-Tracking: Records where participants look to understand what captures their attention and influences their decisions.
  • Physiological Measures: Often include measures like heart rate, skin conductance, or brain activity to correlate physiological responses with decision-making processes.
  • Data Analysis: Includes analyzing choice patterns, response times, and physiological data to draw conclusions about decision-making behavior.

Code Example: Laser Pointer

Below is an example of the SightLab experiment script using a laser pointer for making choices.

import sightlab_utils.sightlab as sl
from sightlab_utils.settings import *
from sightlab_utils import selector
from tools import highlighter
import vizshape
sightlab = sl.SightLab()
sightlab.setStartText(' ')

def sightLabExperiment():
    i = 0
    while True:

        if i == 0:
            yield viztask.waitEvent(EXPERIMENT_START)
            i = 1
        yield sightlab.startTrial(startExperimentText="Use the grip button to bring up higlighter and Trigger to Choose Your Preference.nn Press Trigger to begin")
 selector.setupSelector(sightlab.getConfig())
        env = sightlab.getEnvironment()
        target_names = list(sightlab.sceneObjects[GAZE_OBJECTS].keys())
        target_objects = {}
        object_name_map = {}

        for name in target_names:
            obj = env.getChild(name)

            if obj:
                sightlab.addSceneObject(name, obj, gaze=True, grab=True)
                target_objects[name] = obj
                object_name_map[obj] = name
                print(f'Added {name} to scene objects: {obj}')
        selector.tool.setItems(list(target_objects.values()))
        selector.tool2.setItems(list(target_objects.values()))
        selector.tool.setHighlightMode(highlighter.MODE_NONE)
        selector.tool2.setHighlightMode(highlighter.MODE_NONE)
        targetObject = list(target_objects.values())
        print(f'Target objects: {targetObject}')
        global isConfirmingTarget, currentHighlightedObject, readyToConfirm
        isConfirmingTarget = False
        readyToConfirm = False
        currentHighlightedObject = None

        def confirmTarget(e):
            global isConfirmingTarget, readyToConfirm, currentHighlightedObject

            if readyToConfirm and currentHighlightedObject in targetObject:
                isConfirmingTarget = True
                object_name = object_name_map.get(currentHighlightedObject, 'Unknown object')
                print(f'{object_name} is confirmed')
                readyToConfirm = False  # Reset the flag after confirmation
                currentTime = round(sightlab.hud.getCurrentTime(), 4)  # Round to 4 decimal places
                sightlab.setExperimentSummaryData('Choice', object_name)
                sightlab.setExperimentSummaryData('Time', currentTime)
        viz.callback(viz.getEventID('triggerPress'), confirmTarget)
        viz.callback(viz.getEventID('triggerPressLeft'), confirmTarget)

        def onHighlight(e):
            global currentHighlightedObject, readyToConfirm
            currentHighlightedObject = e.new

            if currentHighlightedObject in targetObject:
                object_name = object_name_map.get(currentHighlightedObject, 'Unknown object')
                print(f'{object_name} is highlighted')
                readyToConfirm = True  # Set the flag when an object is highlighted
        viz.callback(highlighter.HIGHLIGHT_EVENT, onHighlight)
        while not isConfirmingTarget:
            yield viztask.waitTime(0.1)
        yield viztask.waitTime(0.7)
        yield sightlab.endTrial(endExperimentText="Thank you for participating")
        yield viztask.waitTime(2)
viztask.schedule(sightlab.runExperiment)
viztask.schedule(sightLabExperiment)
viz.callback(viz.getEventID('ResetPosition'), sightlab.resetViewPoint)

Data Analysis and Visualization

The template provides tools to analyze and visualize the data collected during the experiment. This includes:

  • Choice and Time Data: Stores the chosen object and the time taken to make the choice.
  • Graph Generation: Automatically generates bar charts showing the number of times each object was chosen across all trials. (Note only works with the Choice Comparison Pointer script)

Running the Experiment

  1. Setup: Configure the experiment using the SightLab GUI or by modifying the script directly.
  2. Execution: Run the experiment, and participants will make choices between two objects using the preferred input method.
  3. Data Collection: Eye-tracking, choice data, and physiological data (if Biopac is connected) will be collected and stored.
  4. Analysis: Use the provided tools to analyze the data and generate visualizations.

Connecting to Biopac Acqknowledge

The template supports integration with Biopac Acqknowledge for synchronizing physiological data. Ensure that the Biopac system is correctly set up and connected before running the experiment. The data will be synchronized and saved for further analysis.

Customization

The template can be easily customized to fit different research needs:

  • Change Objects: Modify the objects presented to participants by updating the scene objects using the GUI interface or script.
  • Input Methods: Switch between laser pointer, rating scale, or keypress by adjusting the input configuration.
  • Trial Conditions: Set different trial conditions and parameters as needed in the GUI or script.