-
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
Require TimeSeries.data and .unit, update ImageSeries, OpticalSeries #1274
Conversation
@oruebel @ajtritt @bendichter Could you please take a look at this PR? It is not ready to merge, but I would like feedback on it before I finalize it. Thanks. |
Codecov Report
@@ Coverage Diff @@
## rc/2.0.0 #1274 +/- ##
============================================
- Coverage 77.04% 76.78% -0.26%
============================================
Files 37 37
Lines 2692 2731 +39
Branches 445 455 +10
============================================
+ Hits 2074 2097 +23
- Misses 541 552 +11
- Partials 77 82 +5
Continue to review full report at Codecov.
|
bcf8e45
to
b1200e8
Compare
Use TimeSeriesReference in tests Add test for backwards compatibility of timeintervals Update ObjectMapper (not yet working) Fix test Demonstrate two approaches to resolving mapping issue Fix
b1200e8
to
bef1be8
Compare
This reverts commit bef1be8.
Motivation
Fix #1220.
This PR includes breaking changes to the API and will thus be pushed out in PyNWB 2.0.
Changes:
data
is now required in__init__
ofTimeSeries
and all subclasses ofTimeSeries
, except forImageSeries
and its subclasses, whereexternal_file
can be provided instead ofdata
.data
is not passed into the constructor ofImageSeries
, thendata
will be set to the default value so thatsuper().__init__
may be called. This results in the default value being written to disk, which is not ideal. An alternative solution is to splitImageSeries
into two separate classes (and neurodata_types), one wheredata
is required and one whereexternal_file
is required.TimeSeries
is read withoutdata
, thendata
will be set to a default value: an empty 1D numpy array. This is also true for all subclasses ofTimeSeries
except forImageSeries
and its subclasses andDecompositionSeries
where the shape of data cannot be 1-D, so the default value is an empty 3D numpy array.unit
is now required in__init__
ofTimeSeries
and all subclasses ofTimeSeries
, except forImageSeries
and its subclasses.data
above, if aTimeSeries
is read withoutunit
, thenunit
will be set to a default value'unknown'
.data
above, if anImageSeries
is constructed withoutunit
, thenunit
will be set to a default value so thatsuper().__init__
may be called. This results in the default value being written to disk, which is not ideal.ImageSeries
,unit
is required only ifdata
is provided.Previously,
data
was required inOpticalSeries.__init__
even though anexternal_file
could be provided. This is a bug, sodata
is now made optional inOpticalSeries.__init__
. This has the side effect of moving the position ofdata
to later in the argument list, which may break code that relies on positional arguments forOpticalSeries.__init__
.This is a separate change, but included in this PR. NWB 2.4 introduces
TimeSeriesReference
. TheTimeIntervals
table has been updated to useTimeSeriesReference
instead of a bare 3-element tuple.Added test files with
TimeSeries
andImageSeries
types that are missingdata
andunit
.Fixed many tests that used data-less or unit-less
TimeSeries
objects.TODO:
Checklist
flake8
from the source directory.#XXX
notation whereXXX
is the issue number?