Module eyekit.fixation
Defines the Fixation
and FixationSequence
objects, which are used to
represent fixation data.
Classes
class Fixation (index: int, x: int, y: int, start: int, end: int, discarded: bool = False)
-
Representation of a single fixation event. It is not usually necessary to create
Fixation
objects manually; they are created automatically during the instantiation of aFixationSequence
.Instance variables
var x : int
-
X-coordinate of the fixation.
var y : int
-
Y-coordinate of the fixation.
var xy : tuple
-
XY-coordinates of the fixation.
var start : int
-
Start time of the fixation in milliseconds.
var end : int
-
End time of the fixation in milliseconds.
var duration : int
-
Duration of the fixation in milliseconds.
var discarded : bool
-
True
if the fixation has been discarded,False
otherwise. var index
-
Index of the fixation in its parent
FixationSequence
Methods
def discard(self)
-
Mark this fixation as discarded. To completely remove the fixation, you should also call
FixationSequence.purge()
.
class FixationSequence (sequence: list = [])
-
Representation of a sequence of consecutive fixations, typically from a single trial.
Initialized with:
sequence
List of tuples of ints, or something similar, that conforms to the following structure:[(106, 540, 100, 200), (190, 536, 200, 300), ..., (763, 529, 1000, 1100)]
, where each tuple contains the X-coordinate, Y-coordinate, start time, and end time of a fixation.
Instance variables
var start : int
-
Start time of the fixation sequence (in milliseconds).
var end : int
-
End time of the fixation sequence (in milliseconds).
var duration : int
-
Duration of the fixation sequence, incuding any gaps between fixations (in milliseconds).
Methods
def copy(self, include_discards=True)
-
Returns a copy of the fixation sequence.
def purge(self)
-
Permanently removes all discarded fixations from the sequence, and reindexes the fixations.
def iter_with_discards(self)
-
Iterates over the fixation sequence including any discarded fixations. This is also the default behavior when iterating over a
FixationSequence
directly. def iter_without_discards(self)
-
Iterates over the fixation sequence without any discarded fixations.
def iter_pairs(self, include_discards=True)
-
Iterate over fixations in consecutive pairs. This is useful if you want to compare consecutive fixations in some way. For example, if you wanted to detect when a fixation leaves an interest area, you might do something like this:
for curr_fxn, next_fxn in seq.iter_pairs(): if curr_fxn in interest_area and next_fxn not in interest_area: print('A fixation has left the interest area')