diff --git a/nwb_linkml/src/nwb_linkml/types/ndarray.py b/nwb_linkml/src/nwb_linkml/types/ndarray.py index e1265ce..2477b6c 100644 --- a/nwb_linkml/src/nwb_linkml/types/ndarray.py +++ b/nwb_linkml/src/nwb_linkml/types/ndarray.py @@ -4,6 +4,7 @@ Extension of nptyping NDArray for pydantic that allows for JSON-Schema serializa * Order to store data in (row first) """ import base64 +import pdb from pathlib import Path from typing import ( Any, @@ -119,6 +120,8 @@ class NDArray(_NDArray): def array_to_list(instance: np.ndarray | DaskArray) -> list|dict: if isinstance(instance, DaskArray): arr = instance.__array__() + elif isinstance(instance, NDArrayProxy): + arr = instance[:] else: arr = instance diff --git a/nwb_linkml/tests/test_maps/test_hdmf.py b/nwb_linkml/tests/test_maps/test_hdmf.py index c3bc784..7b022e7 100644 --- a/nwb_linkml/tests/test_maps/test_hdmf.py +++ b/nwb_linkml/tests/test_maps/test_hdmf.py @@ -5,20 +5,27 @@ import h5py import time from nwb_linkml.maps.hdmf import model_from_dynamictable, dynamictable_to_model +from ..fixtures import data_dir NWBFILE = '/Users/jonny/Dropbox/lab/p2p_ld/data/nwb/sub-738651046_ses-760693773.nwb' -@pytest.mark.skip() -def test_make_dynamictable(): - h5f = h5py.File(NWBFILE, 'r') +@pytest.mark.parametrize( + 'dataset', + [ + 'aibs.nwb' + ] +) +def test_make_dynamictable(data_dir, dataset): + nwbfile = data_dir / dataset + h5f = h5py.File(nwbfile, 'r') group = h5f['units'] start_time = time.time() model = model_from_dynamictable(group) data = dynamictable_to_model(group, model) + ser = data.model_dump_json() end_time = time.time() total_time = end_time - start_time - pdb.set_trace() diff --git a/nwb_linkml/tests/test_translate.py b/nwb_linkml/tests/test_translate.py deleted file mode 100644 index 062b26a..0000000 --- a/nwb_linkml/tests/test_translate.py +++ /dev/null @@ -1,16 +0,0 @@ -import pdb - -import pytest -from pathlib import Path -#from nwb_linkml.translate import generate_from_nwbfile - -# def test_generate_pydantic(): -# # pass until we rig up smaller test data -# pass - - #NWBFILE = Path('/Users/jonny/Dropbox/lab/p2p_ld/data/nwb/sub-738651046_ses-760693773.nwb') - - #pydantic_module = generate_from_nwbfile(NWBFILE) - - #pdb.set_trace() -