mirror of
https://github.com/p2p-ld/nwb-linkml.git
synced 2025-01-10 06:04:28 +00:00
re-enable janky hdmf mapping test just to have it on the board for morale
Fix serializing datasets
This commit is contained in:
parent
f071705ac8
commit
91875dabb2
3 changed files with 14 additions and 20 deletions
|
@ -4,6 +4,7 @@ Extension of nptyping NDArray for pydantic that allows for JSON-Schema serializa
|
||||||
* Order to store data in (row first)
|
* Order to store data in (row first)
|
||||||
"""
|
"""
|
||||||
import base64
|
import base64
|
||||||
|
import pdb
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import (
|
from typing import (
|
||||||
Any,
|
Any,
|
||||||
|
@ -119,6 +120,8 @@ class NDArray(_NDArray):
|
||||||
def array_to_list(instance: np.ndarray | DaskArray) -> list|dict:
|
def array_to_list(instance: np.ndarray | DaskArray) -> list|dict:
|
||||||
if isinstance(instance, DaskArray):
|
if isinstance(instance, DaskArray):
|
||||||
arr = instance.__array__()
|
arr = instance.__array__()
|
||||||
|
elif isinstance(instance, NDArrayProxy):
|
||||||
|
arr = instance[:]
|
||||||
else:
|
else:
|
||||||
arr = instance
|
arr = instance
|
||||||
|
|
||||||
|
|
|
@ -5,20 +5,27 @@ import h5py
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from nwb_linkml.maps.hdmf import model_from_dynamictable, dynamictable_to_model
|
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'
|
NWBFILE = '/Users/jonny/Dropbox/lab/p2p_ld/data/nwb/sub-738651046_ses-760693773.nwb'
|
||||||
|
|
||||||
@pytest.mark.skip()
|
@pytest.mark.parametrize(
|
||||||
def test_make_dynamictable():
|
'dataset',
|
||||||
h5f = h5py.File(NWBFILE, 'r')
|
[
|
||||||
|
'aibs.nwb'
|
||||||
|
]
|
||||||
|
)
|
||||||
|
def test_make_dynamictable(data_dir, dataset):
|
||||||
|
nwbfile = data_dir / dataset
|
||||||
|
h5f = h5py.File(nwbfile, 'r')
|
||||||
group = h5f['units']
|
group = h5f['units']
|
||||||
|
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
model = model_from_dynamictable(group)
|
model = model_from_dynamictable(group)
|
||||||
data = dynamictable_to_model(group, model)
|
data = dynamictable_to_model(group, model)
|
||||||
|
|
||||||
ser = data.model_dump_json()
|
ser = data.model_dump_json()
|
||||||
end_time = time.time()
|
end_time = time.time()
|
||||||
total_time = end_time - start_time
|
total_time = end_time - start_time
|
||||||
pdb.set_trace()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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()
|
|
||||||
|
|
Loading…
Reference in a new issue