Skip to main content
Skip table of contents

Collect data with TRACKPixx /Mini

This simple demo presents a white rectangle on a black background, and collects data from the TRACKPixx /Mini until a key is pressed. The results are plotted.

This demo assumes you have already calibrated your TRACKPixx /Mini. To do so, you can use our automated calibration in PyPixx (PyPixx > Demo > TRACKPixx /Mini).

PY
from psychopy import visual, event, os
from pypixxlib import tracker
from pypixxlib import _libdpx as dp
import matplotlib.pyplot as plt


# Initialize tracker
mini=tracker.TRACKPixxMini()
mini.open()

# Create a window
win = visual.Window(screen=1, color='black', units='pix', fullscr=True)

# Create a rectangle stimulus
rectangle = visual.Rect(win, width=300, height=300, fillColor='white')

# Draw the rectangle
rectangle.draw()

# start recording 
dp.TPxMiniServerSetUpDataRecording(120*60)
dp.TPxMiniRecordData()

# Flip the window to display the rectangle
win.flip()

# Wait for a keypress
event.waitKeys()

# Close the window
win.close()

# mini shutdown
dp.TPxMiniStopRecording()
data = dp.TPxMiniGetDataServer(0)
mini.close()

#plot
lx = [data[1] for data in data]
ly = [data[2] for data in data]
rx = [data[4] for data in data]
ry = [data[5] for data in data]
plt.plot(lx,ly, label="Left")
plt.plot(rx,ry, label = "Right")
plt.legend()
ax = plt.gca()
ax.set_xlim([-960,960])
ax.set_ylim([-540,540])
plt.show()
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.