re-enable janky hdmf mapping test just to have it on the board for morale

Fix serializing datasets
This commit is contained in:
sneakers-the-rat 2023-10-09 23:27:33 -07:00
parent f071705ac8
commit 91875dabb2
3 changed files with 14 additions and 20 deletions

View file

@ -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

View file

@ -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()

View file

@ -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()