Skip to content

Commit

Permalink
write more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrako committed Sep 12, 2023
1 parent 3bea3c0 commit 2493f13
Show file tree
Hide file tree
Showing 4 changed files with 708 additions and 188 deletions.
7 changes: 1 addition & 6 deletions src/pymovements/gaze/gaze_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,16 +415,11 @@ def detect(
if 'events' in method_args:
kwargs['events'] = self.events

if 'time' in method_args and 'time' in self.frame.columns:
if 'timesteps' in method_args and 'time' in self.frame.columns:
timesteps = self.frame.get_column('time').to_numpy()
kwargs['timesteps'] = timesteps

new_events = method(**kwargs)
# new_events.frame = dataset_files.add_fileinfo(
# definition=self.definition,
# df=new_event_df.frame,
# fileinfo=fileinfo_row,
# )

self.events.frame = pl.concat(
[self.events.frame, new_events.frame],
Expand Down
17 changes: 16 additions & 1 deletion tests/events/detection/idt_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,22 @@ def test_idt_raises_error(kwargs, expected_error):
onsets=[1000],
offsets=[1099],
),
id='constant_position_single_fixation_with_timesteps_float',
id='constant_position_single_fixation_with_timesteps_float_no_decimal',
),
pytest.param(
{
'positions': step_function(length=100, steps=[0], values=[(0, 0)]),
'timesteps': np.arange(1000, 1010, 0.1, dtype=float),
'dispersion_threshold': 1,
'minimum_duration': 2,
},
pm.events.EventDataFrame(
name='fixation',
onsets=[1000],
offsets=[1099],
),
id='constant_position_single_fixation_with_timesteps_float_with_decimal',
marks=pytest.mark.xfail(reason='#532'),
),
],
)
Expand Down
Loading

0 comments on commit 2493f13

Please sign in to comment.