Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 committed Sep 8, 2023
1 parent a0fdb24 commit e7034de
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 13 deletions.
3 changes: 2 additions & 1 deletion docs/write_foo.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@

test_ts = TimeSeries(
name="test_compressed_timeseries",
data=H5DataIO(data=data, compression=True),
data=tw(item=data, termset=terms),
unit=tw(item="Homo sapiens", termset=terms),
timestamps=timestamps,
)
breakpoint()

nwbfile = NWBFile(
session_description="my first synthetic recording",
Expand Down
Binary file added nwbfile_test.nwb
Binary file not shown.
4 changes: 2 additions & 2 deletions src/hdmf/backends/hdf5/h5tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,8 +1100,8 @@ def write_dataset(self, **kwargs): # noqa: C901
dataio = data
link_data = data.link_data
data = data.data
if isinstance(data, TermSetWrapper):
data = data.item
# if isinstance(data, TermSetWrapper):
# data = data.item
else:
options['io_settings'] = {}
attributes = builder.attributes
Expand Down
4 changes: 2 additions & 2 deletions src/hdmf/build/objectmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,8 +565,8 @@ def get_attr_value(self, **kwargs):
msg = ("%s '%s' does not have attribute '%s' for mapping to spec: %s"
% (container.__class__.__name__, container.name, attr_name, spec))
raise ContainerConfigurationError(msg)
if isinstance(attr_val, TermSetWrapper):
attr_val = attr_val.item
# if isinstance(attr_val, TermSetWrapper):
# attr_val = attr_val.item
if attr_val is not None:
attr_val = self.__convert_string(attr_val, spec)
spec_dt = self.__get_data_type(spec)
Expand Down
2 changes: 1 addition & 1 deletion src/hdmf/term_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class TermSetWrapper:
def __init__(self, **kwargs):
self.__item = kwargs['item']
self.__termset = kwargs['termset']
self.__validate()
# self.__validate()

def __validate(self):
# check if list, tuple, array, Data
Expand Down
21 changes: 14 additions & 7 deletions tests/unit/test_term_set.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os

from hdmf.term_set import TermSet
from hdmf.term_set import TermSet, TermSetWrapper
from hdmf.testing import TestCase, remove_test_file
from hdmf.common import VectorData
import numpy as np


CUR_DIR = os.path.dirname(os.path.realpath(__file__))
Expand Down Expand Up @@ -107,12 +109,17 @@ class TestTermSetWrapper(TestCase):

def setUp(self):
self.termset = TermSet(term_schema_path='tests/unit/example_test_term_set.yaml')

def test_item(self):
pass

def test_termset(self):
pass
self.data = VectorData(
name='Species_1',
description='...',
data=np.array('Homo sapiens'),
)

def test_properties(self):
wrapped_item = TermSetWrapper(item=self.data, termset=self.termset)
self.assertEqual(wrapped_item.item.object_id, self.data.object_id)
self.assertEqual(wrapped_item.termset.view_set, self.termset.view_set)
self.assertEqual(wrapped_item.dtype, 'i')

def test_dtype(self):
pass
Expand Down

0 comments on commit e7034de

Please sign in to comment.