2023-09-27 02:50:49 +00:00
|
|
|
import time
|
2023-09-23 08:33:28 +00:00
|
|
|
|
2024-07-02 04:44:35 +00:00
|
|
|
import h5py
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
from nwb_linkml.maps.hdmf import dynamictable_to_model, model_from_dynamictable
|
2023-09-23 08:33:28 +00:00
|
|
|
|
2024-07-02 04:23:31 +00:00
|
|
|
NWBFILE = "/Users/jonny/Dropbox/lab/p2p_ld/data/nwb/sub-738651046_ses-760693773.nwb"
|
2023-09-23 08:33:28 +00:00
|
|
|
|
2024-07-02 04:23:31 +00:00
|
|
|
|
2024-07-10 07:20:01 +00:00
|
|
|
@pytest.mark.xfail()
|
2024-07-02 04:23:31 +00:00
|
|
|
@pytest.mark.parametrize("dataset", ["aibs.nwb"])
|
2023-10-10 06:27:33 +00:00
|
|
|
def test_make_dynamictable(data_dir, dataset):
|
|
|
|
nwbfile = data_dir / dataset
|
2024-07-02 04:23:31 +00:00
|
|
|
h5f = h5py.File(nwbfile, "r")
|
|
|
|
group = h5f["units"]
|
2023-09-23 08:33:28 +00:00
|
|
|
|
2023-09-27 02:50:49 +00:00
|
|
|
start_time = time.time()
|
2023-09-23 08:33:28 +00:00
|
|
|
model = model_from_dynamictable(group)
|
2023-09-27 02:50:49 +00:00
|
|
|
data = dynamictable_to_model(group, model)
|
2023-10-10 06:27:33 +00:00
|
|
|
|
2024-04-17 19:55:52 +00:00
|
|
|
_ = data.model_dump_json()
|
2023-09-27 02:50:49 +00:00
|
|
|
end_time = time.time()
|
|
|
|
total_time = end_time - start_time
|