-
Notifications
You must be signed in to change notification settings - Fork 26
Closed
Labels
category: bugerrors in the code or code behaviorerrors in the code or code behaviorpriority: mediumnon-critical problem and/or affecting only a small set of usersnon-critical problem and/or affecting only a small set of users
Description
What happened?
See description in NeurodataWithoutBorders/pynwb#1683
Steps to Reproduce
import h5py
import numpy as np
with h5py.File("pynwb_1683_data.h5", "w") as f:
f.create_dataset(name="data", data=np.random.rand(5, 4))
from pynwb import NWBFile, NWBHDF5IO, validate, TimeSeries
import datetime
f = h5py.File("pynwb_1683_data.h5", "r")
nwbfile = NWBFile(
session_description="session_description",
identifier="identifier",
session_start_time=datetime.datetime.now(datetime.timezone.utc),
)
ts = TimeSeries(
name="test_ts",
data=f["data"],
unit="unit",
rate=1.,
)
nwbfile.add_acquisition(ts)
filename = "pynwb_1683_test.nwb"
with NWBHDF5IO(filename, "w") as io:
io.write(nwbfile)
with NWBHDF5IO(filename, "r") as io:
read_nwbfile = io.read()
print(read_nwbfile.acquisition["test_ts"].data.file)
export_filename = "pynwb_1683_export.nwb"
with NWBHDF5IO(filename, mode="r") as read_io:
read_nwbfile = read_io.read()
# read_nwbfile.generate_new_id()
# nwbfile contains a TimeSeries where the TimeSeries data array is a link to an external dataset
# in a different HDF5 file than self.read_path
with NWBHDF5IO(export_filename, mode="w") as export_io:
export_io.export(src_io=read_io, nwbfile=read_nwbfile, write_args={'link_data': False})
with NWBHDF5IO(export_filename, "r") as io:
read_nwbfile = io.read()
print(read_nwbfile.acquisition["test_ts"].data.file)Traceback
n/aOperating System
macOS
Python Executable
Conda
Python Version
3.10
Package Versions
dev branch of both PyNWB and HDMF
Code of Conduct
- I agree to follow this project's Code of Conduct
- Have you checked the Contributing document?
- Have you ensured this bug was not already reported?
Metadata
Metadata
Assignees
Labels
category: bugerrors in the code or code behaviorerrors in the code or code behaviorpriority: mediumnon-critical problem and/or affecting only a small set of usersnon-critical problem and/or affecting only a small set of users