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

Allow resetting data and timestamps on TimeSeries #1752

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft

Conversation

rly
Copy link
Contributor

@rly rly commented Aug 4, 2023

Motivation

Partner PR to hdmf-dev/hdmf#868

TODO:

  • Add tests
  • Move validation to separate function that is called on build or into the setter (moving it into the setter would still not allow modifying multiple fields at once, e.g., changing TimeSeries with rate to having timestamps, but maybe that is OK for now)

How to test the behavior?

Currently without the validation safeguards, this is allowed:

from pynwb.testing.mock.base import mock_TimeSeries

ts = mock_TimeSeries(timestamps=[1,2,3,4], rate=None)
ts.rate = 5  # this works
ts.data = [2,3,4,5]
ts.timestamps = [1,2,3]

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.

@rly rly marked this pull request as draft August 4, 2023 18:34
@bendichter
Copy link
Contributor

@rly I thought we agreed that this would be too flexible, because it would allow a user to take data and set it to None or replace a None with data, thus creating an invalid NWB file. Instead, we want to be able to get a new DataIO for data or timestamps. Let me see if I can create this feature

@CodyCBakerPhD
Copy link
Collaborator

@rly is this able to be closed? The set_data_io method does everything we need with regards to this issue

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.

3 participants