GazeParser.Core
- core components of GazeParser¶
-
class
GazeParser.Core.
BlinkData
(t, d, Tlist)¶ Holds start time, end time and duraton of a blink.
- パラメータ
t (sequence) -- TimeStamp (start, endTime)
d (float) -- duration of blink (msec)
Tlist (sequence) -- List of timestamps.
-
getNextEvent
(step=1, eventType=None)¶
-
getPreviousEvent
(step=1, eventType=None)¶
-
relativeEndTime
(time)¶ Blink offset time relative to indicated time. Unit is msec.
- パラメータ
time -- reference time. Unit is msec. If objects that has 'time' attribute (e.g. GazeParser.Core.MessageData) is passed, the value of 'time' attribute is used.
-
relativeStartTime
(time)¶ Blink onset time relative to indicated time. Unit is msec.
- パラメータ
time -- reference time. Unit is msec. If objects that has 'time' attribute (e.g. GazeParser.Core.MessageData) is passed, the value of 'time' attribute is used.
-
property
duration
¶ Blink duration in msec.
-
property
endIndex
¶ Blink offset index in the timestamp list.
-
property
endTime
¶ Blink offset time in msec.
-
property
parent
¶ Parent GazeData object.
-
property
startIndex
¶ Blink onset index in the timestamp list.
-
property
startTime
¶ Blink onset time in msec.
-
class
GazeParser.Core.
CalPointData
(point, accuracy, precision, recordedEye)¶ Holds accuracy and precision at calibration points.
-
getAccuracy
(eye=None)¶ Get accuracy. If data is binocular, 4 values (LX, LY, RX, RY) are returned. If monocular, 2 values (X, Y) are returned. If the value is numpy.NaN, no data is available at this calibration point.
- パラメータ
eye (str) -- Output both-eye ('B'), left-eye ('L'), right-eye ('R') data or None (recorded eye). Default value is None.
-
getPrecision
(eye=None)¶ Get precision. If data is binocular, 4 values (LX, LY, RX, RY) are returned. If monocular, 2 values (X, Y) are returned. If the value is numpy.NaN, no data is available at this calibration point.
- パラメータ
eye (str) -- Output both-eye ('B'), left-eye ('L'), right-eye ('R') data or None (recorded eye). Default value is None.
-
property
accuracy
¶ Accuracy in screen coordinate (Lelt-X, Left-Y, Right-X, Right-Y). None if not available.
-
property
point
¶ Location of calibration target in screen coordinate (x,y)
-
property
precision
¶ Precision in screen coordinate (Lelt-X, Left-Y, Right-X, Right-Y). None if not available.
-
property
recordedEye
¶ Precision in screen coordinate (Lelt-X, Left-Y, Right-X, Right-Y). None if not available.
-
-
class
GazeParser.Core.
FixationData
(t, d, Tlist)¶ Holds various parameters of a single fixation such as start time, end time and so on.
- パラメータ
t -- Timestamp (start, endTime)
d -- Tuple of 3 elements. (duration, center location X, Y)
Tlist -- List of TimeStamps.
-
getNextEvent
(step=1, eventType=None)¶
-
getPreviousEvent
(step=1, eventType=None)¶
-
getTraj
(eye=None)¶ Get fixation trajectory. If eye is 'L' or 'R', the returned value is a numpy.ndarray object. If 'B', the returned value is a tuple of two numpy.ndarray objects. The first and second element represent left and right eye's trajectory, respectively.
- パラメータ
eye (str) -- 'L', 'R' or 'B'. If none, recorded eye is used.
-
relativeEndTime
(time)¶ Fixation offset time relative to indicated time. Unit is msec.
- パラメータ
time -- reference time. Unit is msec. If objects that has 'time' attribute (e.g. GazeParser.Core.MessageData) is passed, the value of 'time' attribute is used.
-
relativeStartTime
(time)¶ Fixation onset time relative to indicated time. Unit is msec.
- パラメータ
time -- reference time. Unit is msec. If objects that has 'time' attribute (e.g. GazeParser.Core.MessageData) is passed, the value of 'time' attribute is used.
-
property
center
¶ Fixation center in screen coordinate (x, y). 'Fixation center' means an average of whole gaze trajectory during fixation.
-
property
duration
¶ Fixation duration in msec.
-
property
endIndex
¶ Fixation offset index in the timestamp list.
-
property
endTime
¶ Fixation offset time in msec.
-
property
parent
¶ Parent GazeData object.
-
property
startIndex
¶ Fixation onset index in the timestamp list.
-
property
startTime
¶ Fixation onset time in msec.
-
class
GazeParser.Core.
GazeData
(Tlist, Llist, Rlist, SacList, FixList, MsgList, BlinkList, PupilList, recordedEye, config=None, recordingDate=None)¶ Holds saccades, fixations, blinks, messages, timestamps and gaze trajectory in a single recording.
Constructor GazeData.
-
DegToPixel
(degValue)¶ Convert visual angle to screen pixel.
- パラメータ
degValue (float) -- A value in screen pixel.
-
PixelToDeg
(pixValue)¶ Convert screen pixel to visual angle.
- パラメータ
pixValue (float) -- A value in visual angle.
-
deleteMessage
(message)¶ Delete a message from message list.
- パラメータ
message -- MessageData to be deleted. a
MessageData
object or an integer is accepted.
-
extractTraj
(period, eye=None)¶ Extract trajectory in the specified period of time.
- パラメータ
period (tuple) -- Specify time period. The first element of the tuple specifies the start time of the period. Use None to specify the beginning of the data. The second element is the end time of the period. Use None to specify the end of the data. The unit of these values are millisecond.
eye (str) -- 'L', 'R' or 'B'. If none, recorded eye is used.
- 戻り値
The first element is timestamp. If monocular data is requested, The second element is extracted trajectory. If binocular, The second element is left eye's data
-
findIndexFromTime
(time)¶ Return index of the timestamp of the sample that is nearest to the argument value. For example, 1000.0 is given as an argument and timestamp of the 251st and 252nd sample are 999.6 and 1003.4 respectively, 251 is returned.
- パラメータ
time (float) -- Time in msec.
-
findMessage
(text, byIndices=False, useRegexp=False)¶ Get messages including specified text.
- パラメータ
text (str) -- A text to be found.
byIndices (bool) -- If ture, matched messages are returned by a list of indices. Otherwise, matched messages are returned by a list of GazeParser.Core.MessageData objects. Default value is False.
useRegexp (bool) -- If true, 'text' parapeter is considered as a regular expression. Default value is False.
-
findNearestIndexFromMessage
(message)¶ Return index of the timestamp of the sample that is nearest to the time of given message.
注釈
This method is deprecated. Use
GazeData`findIndexFromTime()
instead. gazedata.findNearestIndexFromMessage(msg) is equivalent to gazedata.findIndexFromTime(msg.time)
-
getBlinkTime
(index=None)¶ Get the start and end time of blinks.
- パラメータ
index -- An index or a list of indices of blink(s). Give n-1 to get the start and end time of n-th blink. If None, all fixations are included. Default value is None.
- 戻り値
If an integer is passed, starting and finish time of the blink is returned. Otherwise, an n x 2 numpy.ndarray object is returned.
-
getCalPointDataByList
(contents='all')¶ Get calibration point data by numpy.ndarray.
- パラメータ
contents -- Contents of the list. 'point', 'accuracy', 'precision' and 'all' are supported. Default value is 'all'.
-
getFixCenter
(index=None)¶ Get the center of fixations in screen coordinate.
- パラメータ
index -- An index or a list of indices of fixation(s). Give n-1 to get the center of n-th fixation. If None, all fixations are included. Default value is None.
- 戻り値
If an integer is passed, horizontal and vertical position of the fixation center is returned. Otherwise, an n x 2 numpy.ndarray object is returned.
-
getFixDur
(index=None)¶ Get duration of fixations in milliseconds.
- パラメータ
index -- An index or a list of indices of fixation(s). Give n-1 to get duration of n-th fixation. If None, all fixations are included. Default value is None.
- 戻り値
If an integer is passed, a float value is returned. Otherwise, an n x 1 numpy.ndarray object is returned.
-
getFixTime
(index=None)¶ Get the start and end time of fixations.
- パラメータ
index -- An index or a list of indices of fixation(s). Give n-1 to get the starting and finish time of n-th fixation. If None, all fixations are included. Default value is None.
- 戻り値
If an integer is passed, starting and finish time of the fixation is returned. Otherwise, an n x 2 numpy.ndarray object is returned.
-
getFixTraj
(index, eye=None)¶ Get gaze trajectory during a fixation.
- パラメータ
index (integer) -- Index of fixation. Give n-1 to get gaze trajectory during n-th fixation.
eye (str) -- Output both-eye ('B'), left-eye ('L'), right-eye ('R') data or None (recorded eye). Default value is None.
-
getMessageTextList
()¶ Get a list of all message texts.
-
getMsgTime
(index=None)¶ Get the recorded time of messages.
- パラメータ
index -- An index or a list of indices of message(s). Give n-1 to get timestamp of n-th message. If None, all messages are included. Default value is None.
- 戻り値
If an integer is passed, a float value is returned. Otherwise, an n x 1 numpy.ndarray object is returned.
-
getNextEvent
(event, step=1, eventType=None)¶ Get an event next to the argument. If no next event, return None.
- パラメータ
event -- An instance of SaccadeData, FixaionData, BlinkData or MessageData. Timestamp (a float value) is also accepted.
step (integer) -- If an integer (n) is given, the n-th next event is returned. Default value is 1.
eventType (str) -- If 'saccade', 'fixation', 'blink' or 'message' is given, only events of given type are considered.
- 戻り値
Event object. If there is no next event, return None.
-
getPathLength
(sac)¶ Get saccade length along saccade trajectory. If a list of SaccadeData object is provided, a list of the length of each saccades in the input list is returned.
- パラメータ
sac -- a SaccadeData object or a list of SaccadeData object.
- 戻り値
a float value or a numpy.ndarray object depending on the argument
-
getPreviousEvent
(event, step=1, eventType=None)¶ Get an event previous to the argument. If no previous event, return None.
- パラメータ
event -- An instance of SaccadeData, FixaionData, BlinkData or MessageData. Timestamp is also accepted.
step (integer) -- If an integer (n) is given, the n-th previous event is returned. Default value is 1.
eventType (str) -- If 'saccade', 'fixation', 'blink' or 'message' is given, only events of given type are considered.
- 戻り値
Event object. If there is no previous event, return None.
-
getSacAmp
(index=None)¶ Get saccade amplitude.
- パラメータ
index -- An index or a list of indices of saccade(s). Give n-1 to get amplitude of n-th saccade. If None, all saccades are included. Default value is None.
- 戻り値
If an integer is passed, a float value is returned. Otherwise, an n x 1 numpy.ndarray object is returned.
-
getSacDur
(index=None)¶ Get duration of saccades in milliseconds.
- パラメータ
index -- An index or a list of indices of saccade(s). Give n-1 to get duration of n-th saccade. If None, all saccades are included. Default value is None.
- 戻り値
If an integer is passed, a float value is returned. Otherwise, an n x 1 numpy.ndarray object is returned.
-
getSacLen
(index=None)¶ Get saccade length.
- パラメータ
index -- An index or a list of indices of saccade(s). Give n-1 to get length of n-th saccade. If None, all saccades are included. Default value is None.
- 戻り値
If an integer is passed, a float value is returned. Otherwise, an n x 1 numpy.ndarray object is returned.
-
getSacTime
(index=None)¶ Get the start and end time of saccades.
- パラメータ
index -- An index or a list of indices of saccade(s). Give n-1 to get the start and end time of n-th saccade. If None, all saccades are included. Default value is None.
- 戻り値
If an integer is passed, starting and finish time of the saccade is returned. Otherwise, an n x 2 numpy.ndarray object is returned.
-
getSacTraj
(index, eye=None)¶ Get gaze trajectory during a saccade.
- パラメータ
index (integer) -- Index of saccade. Give n-1 to get gaze trajectory during n-th saccade.
eye (str) -- Output both-eye ('B'), left-eye ('L'), right-eye ('R') data or None (recorded eye). Default value is None.
-
hasCalPointData
()¶ Return True if calibration point data is included.
-
hasCameraSpecificData
()¶ Return True if camera specific data is included.
-
hasUSBIOData
()¶ Return True if USBIO data is included.
-
insertNewMessage
(time, text)¶ Insert a new message to MessageList.
- パラメータ
time -- Timestamp of the new message.
text -- Message text of the new message.
-
setCalPointData
(calpointdata)¶ Set calibration point data.
- パラメータ
calpointdata -- A list of calibration point location, accuracy and precision.
-
setCameraSpecificData
(data)¶ Set camera specific data.
- パラメータ
data -- Camera specific data.
-
setUSBIOData
(channels, data)¶ Set USBIO data.
- パラメータ
channels -- List of USBIO channels.
data -- USBIO data.
-
sortEventListByTime
()¶ Sort event list by time.
-
sortMessagesByTime
()¶ Sort messages by time.
-
property
CalPointData
¶
-
property
CameraSpecificData
¶
-
property
EventList
¶ List of all events (saccades, fixations, blinks and messages) in chronological order.
-
property
Fix
¶ List of
FixationData
objects.
-
property
L
¶ List of gaze position (x, y) of left eye.
-
property
Msg
¶ List of
MessageData
objects.
-
property
Pupil
¶
-
property
R
¶ List of gaze position (x, y) of right eye.
-
property
Sac
¶ List of
SaccadeData
objects.
-
property
T
¶ List of timestamps when each gaze position was recorded.
-
property
USBIOChannels
¶
-
property
USBIOData
¶
-
property
nBlink
¶ Number of blinks detected in this trial.
-
property
nFix
¶ Number of fixations detected in this trial.
-
property
nMsg
¶ Number of messages recorded in this trial.
-
property
nSac
¶ Number of saccades detected in this trial.
-
property
recordedEye
¶
-
property
recordingDate
¶
-
-
class
GazeParser.Core.
MessageData
(m)¶ Holds a message received during recording.
- パラメータ
m -- A tuple of 2 elements. The 1st element is timestamp (in msec). The 2nd element is received text.
-
delete
()¶
-
getNextEvent
(step=1, eventType=None)¶
-
getPreviousEvent
(step=1, eventType=None)¶
-
updateMessage
(newTime=None, newText=None)¶ Update message time and/or text.
- パラメータ
newTime -- New timestamp. If None, timestamp is not updated.
newText -- New text. If None, text is not updated.
-
property
parent
¶ Parent GazeData object.
-
property
text
¶ Message text.
-
property
time
¶ Time when message was recorded.
-
class
GazeParser.Core.
SaccadeData
(t, d, Tlist)¶ Holds various parameters of a single saccade such as start time, end time, amplitude and so on.
- パラメータ
t -- Timestamp (start, endTime).
d -- Tuple of 6 elements (Startpoint X, Y, Endpoint X, Y, amplitude, length).
Tlist -- List of TimeStamps.
-
getNextEvent
(step=1, eventType=None)¶
-
getPreviousEvent
(step=1, eventType=None)¶
-
getTraj
(eye=None)¶ Get saccade trajectory. If eye is 'L' or 'R', the returned value is a numpy.ndarray object. If 'B', the returned value is a tuple of two numpy.ndarray objects. The first and second element represent left and right eye's trajectory, respectively.
- パラメータ
eye (str) -- 'L', 'R' or 'B'. If none, recorded eye is used.
-
relativeEndTime
(time)¶ Saccade offset time relative to indicated time. Unit is msec.
- パラメータ
time -- reference time. Unit is msec. If objects that has 'time' attribute (e.g. GazeParser.Core.MessageData) is passed, the value of 'time' attribute is used.
-
relativeStartTime
(time)¶ Saccade onset time relative to indicated time. Unit is msec.
- パラメータ
time -- reference time. Unit is msec. If objects that has 'time' attribute (e.g. GazeParser.Core.MessageData) is passed, the value of 'time' attribute is used.
-
property
amplitude
¶ Saccade length in degree.
-
property
direction
¶ Saccade direction in radian.
-
property
duration
¶ Saccade duration in msec.
-
property
end
¶ Saccade end location in screen coordinate (x, y).
-
property
endIndex
¶ Saccade offset index in the timestamp list.
-
property
endTime
¶ Saccade offset time in msec.
-
property
length
¶ Saccade length in screen coordinate.
-
property
parent
¶ Parent GazeData object.
-
property
start
¶ Saccade start location in screen coordinate (x, y).
-
property
startIndex
¶ Saccade onset index in the timestamp list.
-
property
startTime
¶ Saccade onset time in msec.