-
Notifications
You must be signed in to change notification settings - Fork 86
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
Update .gitignore to exclude virtual environment directories and enhance documentation on adding datasets with h5py #2032
Conversation
…nce documentation on adding datasets with h5py
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #2032 +/- ##
=======================================
Coverage 91.78% 91.78%
=======================================
Files 27 27
Lines 2738 2738
Branches 709 709
=======================================
Hits 2513 2513
Misses 149 149
Partials 76 76
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
If the dataset has not been created yet, it can be appended using pynwb but import pynwb
from pynwb.testing.mock.file import mock_NWBFile
nwb = mock_NWBFile()
nwb.subject = pynwb.file.Subject(subject_id="test")
io = pynwb.NWBHDF5IO("test.nwb", "w")
io.write(nwb)
io.close()
io = pynwb.NWBHDF5IO("test.nwb", "a")
nwb = io.read()
nwb.subject.genotype = "test"
nwb.subject.set_modified()
io.write(nwb)
io.close()
io = pynwb.NWBHDF5IO("test.nwb", "r")
nwb = io.read()
print(nwb.subject.genotype) # returns "test"
|
OK, we should definitely add this to the editing tutorial. Can optional Attributes and optional non-scalar Datasets also be added in this way? |
@rly this is fixed now |
Thank you @bendichter
|
@rly can you please approve? |
Motivation
Added a new section to the editing tutorial that demonstrates how to add custom datasets using h5py. This enhances the documentation by showing users how to add new datasets to existing groups in NWB files when the standard PyNWB API doesn't provide direct methods for doing so. The example specifically shows adding a genotype dataset to the Subject object, which is a common use case for neuroscience data management. This came up recently in the following slack message: https://nwb-users.slack.com/archives/C5XKC14L9/p1738791649800719
I don't think there is a way to do this directly with pynwb. Is that right, @rly?