aeye-lab / pymovements

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

feat: add trial_columns to from_numpy() and from_pandas() #651

Closed dkrako closed 5 months ago

dkrako commented 5 months ago

Somehow they were missing before from the implementation.

signatures are updated to:

def from_numpy(
        data: np.ndarray | None = None,
        experiment: Experiment | None = None,
        events: EventDataFrame | None = None,
        *,
        trial: np.ndarray | None = None,
        time: np.ndarray | None = None,
        pixel: np.ndarray | None = None,
        position: np.ndarray | None = None,
        velocity: np.ndarray | None = None,
        acceleration: np.ndarray | None = None,
        distance: np.ndarray | None = None,
        schema: list[str] | None = None,
        orient: Literal['col', 'row'] = 'col',
        trial_columns: str | list[str] | None = None,
        time_column: str | None = None,
        pixel_columns: list[str] | None = None,
        position_columns: list[str] | None = None,
        velocity_columns: list[str] | None = None,
        acceleration_columns: list[str] | None = None,
        distance_column: str | None = None,
) -> GazeDataFrame:

and

def from_pandas(
        data: pd.DataFrame,
        experiment: Experiment | None = None,
        events: EventDataFrame | None = None,
        *,
        trial_columns: str | list[str] | None = None,
        time_column: str | None = None,
        pixel_columns: list[str] | None = None,
        position_columns: list[str] | None = None,
        velocity_columns: list[str] | None = None,
        acceleration_columns: list[str] | None = None,
        distance_column: str | None = None,
) -> GazeDataFrame:

needs #650 to be merged first for pydocstyle ignores

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (250c0f5) 100.00% compared to head (fdc09ca) 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #651 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 54 54 Lines 2357 2362 +5 Branches 588 589 +1 ========================================= + Hits 2357 2362 +5 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.