Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VectorData Refactor Expandable #1158

Merged
merged 22 commits into from
Aug 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
dtype
mavaylon1 committed Aug 7, 2024
commit aeeadc0173b52937fd5d33f090bc5235e323c64a
12 changes: 9 additions & 3 deletions src/hdmf/build/objectmapper.py
Original file line number Diff line number Diff line change
@@ -724,7 +724,10 @@
msg = "'container' must be of type Data with DatasetSpec"
raise ValueError(msg)
spec_dtype, spec_shape, spec_dims, spec = self.__check_dset_spec(self.spec, spec_ext)
dimension_labels, matched_shape = self.__get_spec_info(container.data, spec_shape, spec_dims)
dimension_labels, matched_shape = self.__get_spec_info(container.data,
spec_shape,
spec_dims,
spec_dtype)
if isinstance(spec_dtype, RefSpec):
self.logger.debug("Building %s '%s' as a dataset of references (source: %s)"
% (container.__class__.__name__, container.name, repr(source)))
@@ -825,16 +828,19 @@
spec = ext
return dtype, shape, dims, spec

def __get_spec_info(self, data, spec_shape, spec_dims):
def __get_spec_info(self, data, spec_shape, spec_dims, spec_dtype=None):
"""This will return the dimension labels and shape by matching the data shape to a permissible spec shape."""
if spec_shape is None and spec_dims is None:
return None, None
elif spec_shape is not None and spec_dims is None:
return None, tuple(spec_shape)
elif spec_shape is None and spec_dims is not None:
return spec_dims, None

Check warning on line 838 in src/hdmf/build/objectmapper.py

Codecov / codecov/patch

src/hdmf/build/objectmapper.py#L838

Added line #L838 was not covered by tests
else:
data_shape = get_data_shape(data)
if spec_dtype is not None and isinstance(spec_dtype, list):
data_shape = (len(data),)

Check warning on line 841 in src/hdmf/build/objectmapper.py

Codecov / codecov/patch

src/hdmf/build/objectmapper.py#L841

Added line #L841 was not covered by tests
else:
data_shape = get_data_shape(data)
# if shape is a list of allowed shapes, find the index of the shape that matches the data
if isinstance(spec_shape[0], list):
match_shape_inds = list()