Gazepoint OpenGaze API USER_DATA Update

As of Gazepoint release V4.2.0 the USER_DATA option in the OpenGaze API has been updated to include an optional duration tag. The DUR tag allows for embedding discrete events into the data stream. Previously if a USER_DATA value was set in the gaze data stream:

<SET ID="USER_DATA" VALUE="EXP1" />

The USER_DATA value would then be set for all subsequent data samples, which is useful for blocking off portions of the data stream, such as Experiment 1, Experiment 2, etc. The duration option allows embedding single events (DUR=1) which means only a single data record will be tagged with the event.

<SET ID="USER_DATA" VALUE="EVENT1" DUR="1" />

With this update it is possible to read other sensors such as serial port devices and then use the API to embed the results in the data stream. An illustrative example using MATLAB is shown below, where Control is running to generate the gaze data, and Analysis is running to collect the data. In the example the original use case is shown where USER_DATA is set to EXP1 for 1 second of data, EXP2 for 1.5 seconds and EXP3 for 2 seconds (a simple delay is used instead of the actual experiment). Following this the new USER_DATA capability is demonstrated using fictional events 88, 99, 101 (these could be A,B,C, or any other ID for the events).

The source code is available in the demo folder of the Gazepoint installation C:\Program Files (x86)\Gazepoint\Gazepoint\demo\

</pre>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Gazepoint sample program for USER_DATA embedding via the Gazepoint API
% Written in 2017 by Gazepoint www.gazept.com
%
% To the extent possible under law, the author(s) have dedicated all copyright
% and related and neighboring rights to this software to the public domain worldwide.
% This software is distributed without any warranty.
%
% You should have received a copy of the CC0 Public Domain Dedication along with this
% software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% setup address and port
client_socket = tcpip('127.0.0.1', 4242);

% setup line terminator
set(client_socket, 'InputBufferSize', 4096);
fopen(client_socket);
client_socket.Terminator = 'CR/LF';

% Send the USER_DATA value to mark a region of gaze data (such as Experiment 1)
% Use a numeric value to simplify further analysis
fprintf(client_socket, '<SET ID="USER_DATA" VALUE="1" />'); % begin EXP1
pause(1);
fprintf(client_socket, '<SET ID="USER_DATA" VALUE="2" />'); % begin EXP2
pause(1.5);
fprintf(client_socket, '<SET ID="USER_DATA" VALUE="3" />'); % begin EXP3
pause(2);
fprintf(client_socket, '<SET ID="USER_DATA" VALUE="" />'); % end EXP3

% Send the USER_DATA value to mark a single event, assign an event a number
fprintf(client_socket, '<SET ID="USER_DATA" VALUE="88" DUR="1" />'); % Event 88 occurred
pause(0.2);
fprintf(client_socket, '<SET ID="USER_DATA" VALUE="99" DUR="1" />'); % Event 99 occurred
pause(0.5);
fprintf(client_socket, '<SET ID="USER_DATA" VALUE="88" DUR="1" />'); % Event 88 occurred
pause(0.2);
fprintf(client_socket, '<SET ID="USER_DATA" VALUE="88" DUR="1" />'); % Event 88 occurred
pause(0.2);
fprintf(client_socket, '<SET ID="USER_DATA" VALUE="101" DUR="1" />'); %Event 101 occurred
pause(0.4);
fprintf(client_socket, '<SET ID="USER_DATA" VALUE="99" DUR="1" />'); % Event 99 occurred
pause(0.5);

% clean up
fclose(client_socket);
delete(client_socket);
clear client_socket

 

By | 2018-02-04T12:56:45+00:00 February 4th, 2018|Uncategorized|Comments Off on Gazepoint OpenGaze API USER_DATA Update

About the Author: