aeye-lab / pymovements

A python package for processing eye movement data
https://pymovements.readthedocs.io
MIT License
57 stars 11 forks source link

Implement measure interface #701

Open dkrako opened 4 months ago

dkrako commented 4 months ago

With #673 we get our first measures but we should make sure how to use the measure interface before merging this PR.

The way I see it, there are several distinct types of measures:

  1. gaze signal measure: this computes a single aggregate function applied to the grouped gaze signal time series. one example is the null_ratio implemented in #673, but other can be maximum or standard deviation of velocity (per trial) etc.
  2. this aggregates event properties according to groups (trial, subject, etc). examples would be mean fixation duration or maximum saccade velocity.
  3. aoi measure: these are measures that include stimulus information and provide measures per area of interest, like dwell time or first fixation duration.
  4. reading measures are similar to aoi measures, but for text stimuli. reading measures can be applied to various levels: character, word, multi-word

combined vs distinct methods

There could be two ways this is implemented in the GazeDataFrame:

  1. one common method get_measure() like proposed in #673
  2. or distinct methods for each type, e.g. Gaze.measure_signal(), Gaze.measure_events(), Gaze.measure_interest(), or Gaze.measure_reading()

Version 2 makes explicitly clear what parts of the data will be measured. The methods are straight-foward in what to expect and return.

Version 1 would have the benefit of a one-fits-all method, but we would have to make sure that we use the right data for the right method. This makes the method itself more complicated.

It tend to think we should start out with Version 2 and can create a combined method later on if we really see the value in it.