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

Change timeseries data checks to warn instead of error on read #1793

Merged
merged 2 commits into from
Nov 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add test for starting time and update CHANGELOG
stephprince committed Nov 29, 2023
commit e8bd8f88406fab714a49e3bb71c01d6854991104
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -6,6 +6,7 @@
- For `NWBHDF5IO()`, change the default of arg `load_namespaces` from `False` to `True`. @bendichter [#1748](https://github.com/NeurodataWithoutBorders/pynwb/pull/1748)
- Add `NWBHDF5IO.can_read()`. @bendichter [#1703](https://github.com/NeurodataWithoutBorders/pynwb/pull/1703)
- Add `pynwb.get_nwbfile_version()`. @bendichter [#1703](https://github.com/NeurodataWithoutBorders/pynwb/pull/1703)
- Updated timeseries data checks to warn instead of error when reading invalid files. @stephprince [#1793](https://github.com/NeurodataWithoutBorders/pynwb/pull/1793)

## PyNWB 2.5.0 (August 18, 2023)

18 changes: 18 additions & 0 deletions tests/unit/test_base.py
Original file line number Diff line number Diff line change
@@ -444,6 +444,24 @@ def test_file_with_rate_and_timestamps_in_construct_mode(self):
timestamps=[1, 2, 3, 4, 5]
)

def test_file_with_starting_time_and_timestamps_in_construct_mode(self):
"""Test that UserWarning is raised when starting_time and timestamps are both specified
while being in construct mode (i.e,. on data read)."""
obj = TimeSeries.__new__(TimeSeries,
container_source=None,
parent=None,
object_id="test",
in_construct_mode=True)
with self.assertWarnsWith(warn_type=UserWarning,
exc_msg='Specifying starting_time and timestamps is not supported.'):
obj.__init__(
name="test_ts",
data=[11, 12, 13, 14, 15],
unit="volts",
starting_time=1.0,
timestamps=[1, 2, 3, 4, 5]
)


class TestImage(TestCase):
def test_init(self):