Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Fix TimeSeries data does not match length of timestamps should raise an error when created #1538

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

weiglszonja
Copy link
Collaborator

Motivation

This is a follow up on the issue described in #1536 to prevent a TimeSeries being created with timestamps that does not match the length of data.

This PR changes TimeSeries _check_time_series_dimension check to warn when reading from file and raise an error when constructing new data.

This change also affects ImageSeries check that will also raise a ValueError when an ImageSeries is being created with timestamps that do not match the length of data. If ImageSeries is used with external file, then this error or warning will not be triggered.

Resolve #1536

How to test the behavior?

tests/unit/test_base.py
tests/unit/test_image.py

Checklist

  • Did you update CHANGELOG.md with your changes?
  • Have you checked our Contributing document?
  • Have you ensured the PR clearly describes the problem and the solution?
  • Is your contribution compliant with our coding style? This can be checked running flake8 from the source directory.
  • Have you checked to ensure that there aren't other open Pull Requests for the same change?
  • Have you included the relevant issue number using "Fix #XXX" notation where XXX is the issue number? By including "Fix #XXX" you allow GitHub to close issue #XXX when the PR is merged.

@weiglszonja
Copy link
Collaborator Author

@oruebel
In docs/gallery/domain/brain_observatory.py ImageSeries are being created with timestamps of [0], I tried to fix it but I don't have currently access to the data that is being used here to that was my guess. But it's not working yet.

@weiglszonja weiglszonja self-assigned this Aug 11, 2022
@rly
Copy link
Contributor

rly commented Aug 11, 2022

@weiglszonja

This code stores images in an ImageSeries so that they can be referenced by IndexSeries:
https://github.com/NeurodataWithoutBorders/pynwb/blob/dev/docs/gallery/domain/brain_observatory.py#L71-L85

This approach is no longer the recommended approach. Instead, use the Images and Image types with IndexSeries which was recently updated to support this. For example:
https://github.com/NeurodataWithoutBorders/pynwb/blob/dev/tests/unit/test_image.py#L313-L325

@rly rly self-requested a review October 17, 2024 21:49
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.

[Bug]: Timeseries can have timestamps + data that don't match in length
2 participants