Skip to content

feat: allow users to pass custom timestamps to from_numpy#941

Open
muvva-krishna wants to merge 2 commits intoneuroinformatics-unit:mainfrom
muvva-krishna:warn-nan-compute-path-length
Open

feat: allow users to pass custom timestamps to from_numpy#941
muvva-krishna wants to merge 2 commits intoneuroinformatics-unit:mainfrom
muvva-krishna:warn-nan-compute-path-length

Conversation

@muvva-krishna
Copy link
Copy Markdown

Closes #473

Allow users to pass a timestamps array to from_numpy() instead of
deriving time coordinates from fps.

Changes:

  • Add timestamps field to _BaseDatasetInputs in validators/datasets.py
  • Add length validation in ValidPosesInputs.to_dataset() before building
    the xarray Dataset (raises ValueError if length mismatches n_frames)
  • Thread timestamps through load_poses.from_numpy() into ValidPosesInputs

Tests:

  • test_from_numpy_with_custom_timestamps: verifies irregular timestamps
    are set correctly as the time coordinate
  • test_from_numpy_timestamps_wrong_length_raises: verifies ValueError
    is raised when timestamp length does not match number of frames

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for loading time coordinates from file

1 participant