Skip to content

Commit

Permalink
add tests for ivt and microsaccades
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrako committed Sep 13, 2023
1 parent 2493f13 commit 0a6a4df
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 204 deletions.
12 changes: 9 additions & 3 deletions src/pymovements/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,20 @@ def detect(
Returns self, useful for method cascading.
"""
self._check_gaze_dataframe()

if not self.events:
self.events = [None for _ in self.gaze]

disable_progressbar = not verbose
for file_id, gaze in tqdm(enumerate(self.gaze), disable=disable_progressbar):
gaze.detect(method, eye=eye, clear=clear, kwargs=kwargs)
for file_id, (gaze, fileinfo_row) in tqdm(
enumerate(zip(self.gaze, self.fileinfo.to_dicts())), disable=disable_progressbar,
):
gaze.detect(method, eye=eye, clear=clear, **kwargs)
# workaround until events are fully part of the GazeDataFrame
gaze.events.frame = dataset_files.add_fileinfo(
definition=self.definition,
df=gaze.events.frame,
fileinfo=self.files[file_id],
fileinfo=fileinfo_row,
)
self.events[file_id] = gaze.events
return self
Expand Down
2 changes: 2 additions & 0 deletions tests/events/detection/ivt_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ def test_ivt_detects_fixations(kwargs, expected):
kwargs['positions'], sampling_rate=10, method='preceding',
)

print(velocities)
assert False
# Just use positions argument for velocity calculation
kwargs.pop('positions')

Expand Down
Loading

0 comments on commit 0a6a4df

Please sign in to comment.