-
Notifications
You must be signed in to change notification settings - Fork 84
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
Change timeseries data checks to warn instead of error on read #1793
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #1793 +/- ##
=======================================
Coverage 91.96% 91.97%
=======================================
Files 27 27
Lines 2615 2617 +2
Branches 682 683 +1
=======================================
+ Hits 2405 2407 +2
Misses 138 138
Partials 72 72
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Please add a new entry or two to |
The |
with self.assertRaisesWith(ValueError, 'Rate must be a positive value.'): | ||
TimeSeries(name='test_ts1', data=list(), unit='volts', rate=0.0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rly @stephprince Hey there
Does this mean that on next release of PyNWB it will be impossible to specify any TimeSeries with a rate of zero, even if it only has a single element on the first axis?
That's a fairly big break to back-compatibility if so, we've recommended to several people throughout the years to use that approach for statically generated microscopy images since that is the closest available data type for their setup (static images module lacks the associated metadata, and no specific static image types in the ophys module)
Not that it's a bad thing overall, but there should be a bigger changelog note about it IMO, along with some update about what we recommend to such users as an alternative
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I was not aware that folks were using the Ophys modules this way. Could you clarify why rate matters when there is only a single image. Wouldn't you just use an explicit timestamp array in that case? I think it is fine to change the check to only check for "self.rate < 0" instead of "self.rate <= 0" to avoid the breaking case you mentioned (an maybe have an warning for "rate == 0").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the difference with that proposal is then how to treat NaN
values for timestamps
For static images in this case, it might not matter when it was acquired w.r.t. any other data streams in the file, so the starting_time
could be set to NaN
while the rate
is set to a true value of 0.0
It's true an equivalent representation could be to use timestamps
but then it would be an array of one element, that being NaN
, but we'd need checks elsewhere to ensure no more than one NaN
is set in other instances, such as a series with timestamps=[NaN, NaN, NaN, ...]
which would make less sense, right?
In all cases, this is really because there's a lack of appropriate neurodata object, so maybe I'll just kick the bucket to ndx-microscopy to resolve this in the best way
I do think we shouldn't break back-compatibility for the exact 0.0
case for the time being however, just so there's no unintended disruption
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case I would suggest the following:
- change the new check to only check for
self.rate > 0
- optionally add a warning for
self.rate == 0
- Wait for
ndx-microscopy
to address the missing data type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stephprince could you create a PR to make those changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I can do that
Motivation
Fixes #1786 and #1721.
How to test the behavior?
See example in #1721
Checklist
flake8
from the source directory.