Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
dkrako committed Sep 14, 2023
1 parent 9de020f commit e106667
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 92 deletions.
10 changes: 0 additions & 10 deletions src/pymovements/gaze/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import pandas as pd
import polars as pl

from pymovements.events.frame import EventDataFrame
from pymovements.gaze.experiment import Experiment
from pymovements.gaze.gaze_dataframe import GazeDataFrame
from pymovements.utils import checks
Expand All @@ -35,7 +34,6 @@
def from_numpy(
data: np.ndarray | None = None,
experiment: Experiment | None = None,
events: EventDataFrame | None = None,
*,
time: np.ndarray | None = None,
pixel: np.ndarray | None = None,
Expand Down Expand Up @@ -68,8 +66,6 @@ def from_numpy(
Two-dimensional data represented as a numpy ndarray.
experiment : Experiment
The experiment definition.
events: EventDataFrame
A dataframe of events in the gaze signal.
time:
Array of timestamps.
pixel:
Expand Down Expand Up @@ -204,7 +200,6 @@ def from_numpy(
return GazeDataFrame(
data=df,
experiment=experiment,
events=events,
time_column=time_column,
pixel_columns=pixel_columns,
position_columns=position_columns,
Expand Down Expand Up @@ -250,7 +245,6 @@ def from_numpy(
return GazeDataFrame(
data=df,
experiment=experiment,
events=events,
time_column=time_column,
pixel_columns=pixel_columns,
position_columns=position_columns,
Expand All @@ -262,7 +256,6 @@ def from_numpy(
def from_pandas(
data: pd.DataFrame,
experiment: Experiment | None = None,
events: EventDataFrame | None = None,
*,
time_column: str | None = None,
pixel_columns: list[str] | None = None,
Expand All @@ -278,8 +271,6 @@ def from_pandas(
Data represented as a pandas DataFrame.
experiment : Experiment
The experiment definition.
events: EventDataFrame
A dataframe of events in the gaze signal.
time_column:
The name of the timestamp column in the input data frame.
pixel_columns:
Expand All @@ -299,7 +290,6 @@ def from_pandas(
return GazeDataFrame(
data=df,
experiment=experiment,
events=events,
time_column=time_column,
pixel_columns=pixel_columns,
position_columns=position_columns,
Expand Down
39 changes: 0 additions & 39 deletions tests/gaze/integration_numpy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"""Test from gaze.from_numpy."""
import numpy as np
import polars as pl
import pytest
from polars.testing import assert_frame_equal

import pymovements as pm
Expand Down Expand Up @@ -186,41 +185,3 @@ def test_from_numpy_all_none():

assert_frame_equal(gaze.frame, expected)
assert gaze.n_components is None


@pytest.mark.parametrize(
'events',
[
pytest.param(
None,
id='events_none',
),
pytest.param(
pm.EventDataFrame(),
id='events_empty',
),
pytest.param(
pm.EventDataFrame(name='fixation', onsets=[123], offsets=[345]),
id='fixation',
),
pytest.param(
pm.EventDataFrame(name='saccade', onsets=[34123], offsets=[67345]),
id='saccade',
),
],
)
def test_from_numpy_events(events):
if events is None:
expected_events = pm.EventDataFrame().frame
else:
expected_events = events.frame

gaze = pm.gaze.from_numpy(events=events)

assert_frame_equal(gaze.events.frame, expected_events)
# We don't want the events point to the same reference.
assert gaze.events.frame is not expected_events
43 changes: 0 additions & 43 deletions tests/gaze/integration_pandas_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"""Test from gaze.from_pandas."""
import pandas as pd
import polars as pl
import pytest
from polars.testing import assert_frame_equal

import pymovements as pm
Expand Down Expand Up @@ -72,45 +71,3 @@ def test_from_pandas_explicit_columns():
})

assert_frame_equal(gaze.frame, expected)


@pytest.mark.parametrize(
('df', 'events'),
[
pytest.param(
pd.DataFrame(),
None,
id='events_none',
),
pytest.param(
pd.DataFrame(),
pm.EventDataFrame(),
id='events_empty',
),
pytest.param(
pd.DataFrame(),
pm.EventDataFrame(name='fixation', onsets=[123], offsets=[345]),
id='fixation',
),
pytest.param(
pd.DataFrame(),
pm.EventDataFrame(name='saccade', onsets=[34123], offsets=[67345]),
id='saccade',
),
],
)
def test_from_pandas_events(df, events):
if events is None:
expected_events = pm.EventDataFrame().frame
else:
expected_events = events.frame

gaze = pm.gaze.from_pandas(data=df, events=events)

assert_frame_equal(gaze.events.frame, expected_events)
# We don't want the events point to the same reference.
assert gaze.events.frame is not expected_events

0 comments on commit e106667

Please sign in to comment.