-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Current Behavior
Calling gaze.split()
when gaze.events
is empty results in an empty list being returned.
The problem is the use of zip
here:
pymovements/src/pymovements/gaze/gaze.py
Line 355 in e61b668
for samples, events in zip(samples_list, events_list) |
Also, if only a subset of trials have no events, the Gaze
and Event
objects in the returned list will be misaligned.
Expected Behavior
Gaze
should be split and returned even if there are no events. Samples and events should be aligned even if some trials have no events.
Steps to Reproduce
Example file: gaze.csv
To reproduce empty return value:
import pymovements as pm
gaze = pm.gaze.from_csv(
"gaze.csv",
pixel_columns=["pixel_x", "pixel_y"],
trial_columns=["trial"],
)
gaze.split() # empty
To reproduce misaligned events:
import pymovements as pm
import polars as pl
gaze = pm.gaze.from_csv(
"gaze.csv",
pixel_columns=["pixel_x", "pixel_y"],
trial_columns=["trial"],
)
# Add event for trial2 only
gaze.events.frame.extend(
pl.DataFrame(
{
"trial": ["trial2"],
"name": ["fixation"],
"onset": [0],
"offset": [1000],
"duration": [1000],
}
)
)
gaze.split() # gaze for trial1 and event for trial2; gaze for trial2 missing
Checklist
- I am running the latest version
- I checked the documentation and found no answer
- I checked to make sure that this issue has not already been filed
- I have provided sufficient information for the team
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working