Skip to content

Commit

Permalink
Updated source example
Browse files Browse the repository at this point in the history
  • Loading branch information
oruebel committed Sep 23, 2022
1 parent 524453f commit 145b772
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ pip install .
## Usage

```python

from pynwb.file import NWBFile, Subject
from ndx_labmetadata_example import LabMetaDataExtensionExample
from pynwb import NWBHDF5IO
Expand All @@ -37,11 +36,12 @@ lab_meta_data = LabMetaDataExtensionExample(tissue_preparation="Example tissue p
nwbfile.add_lab_meta_data(lab_meta_data=lab_meta_data)

# Write the file to disk
with NWBHDF5IO(path=self.filename, mode='a') as io:
filename = 'testfile.nwb'
with NWBHDF5IO(path=filename, mode='a') as io:
io.write(nwbfile)

# Read the file from disk
with NWBHDF5IO(path=self.filename, mode='r') as io:
with NWBHDF5IO(path=filename, mode='r') as io:
in_nwbfile = io.read()
in_lab_meta_data = in_nwbfile.get_lab_meta_data(lab_meta_data.name)
assert lab_meta_data.tissue_preparation == in_lab_meta_data.tissue_preparation
Expand Down
5 changes: 3 additions & 2 deletions src/pynwb/tests/test_labmetadata_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,12 @@ def test_readme_script(self):
nwbfile.add_lab_meta_data(lab_meta_data=lab_meta_data)

# Write the file to disk
with NWBHDF5IO(path=self.filename, mode='a') as io:
filename = 'testfile.nwb'
with NWBHDF5IO(path=filename, mode='a') as io:
io.write(nwbfile)

# Read the file from disk
with NWBHDF5IO(path=self.filename, mode='r') as io:
with NWBHDF5IO(path=filename, mode='r') as io:
in_nwbfile = io.read()
in_lab_meta_data = in_nwbfile.get_lab_meta_data(lab_meta_data.name)
assert lab_meta_data.tissue_preparation == in_lab_meta_data.tissue_preparation
Expand Down

0 comments on commit 145b772

Please sign in to comment.