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

Make dyntab expandable #1017

Draft
wants to merge 19 commits into
base: dev
Choose a base branch
from
Draft
Changes from all commits
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
21 changes: 21 additions & 0 deletions src/hdmf/common/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
import numpy as np
import pandas as pd
import itertools
from typing import Type

from . import register_class, EXP_NAMESPACE
from ..backends.hdf5.h5_utils import H5DataIO
from ..container import Container, Data
from ..data_utils import DataIO, AbstractDataChunkIterator
from ..utils import docval, getargs, ExtenderMeta, popargs, pystr, AllowPositional, check_type
Expand Down Expand Up @@ -1323,6 +1325,25 @@
colnames=self.colnames)
return self.__class__(**kwargs)

def make_expandable(self, data_io_class: Type[DataIO] = H5DataIO, data_io_kwargs: dict = None):
"""

Parameters
----------
data_io_class: Type[DataIO], default=H5DataIO
data_io_kwargs: dict, optional
Keyword arguments to pass to the data_io_class. If None, defaults to dict(shape=(None, *data.shape[1:]))
"""

if data_io_kwargs is None:
data_io_kwargs = dict()

Check warning on line 1339 in src/hdmf/common/table.py

View check run for this annotation

Codecov / codecov/patch

src/hdmf/common/table.py#L1339

Added line #L1339 was not covered by tests

for column in self.columns + [self.id]:
shape = column.data.shape
kwargs = dict(shape=(None, *shape[1:]))
kwargs.update(**data_io_kwargs)
column.set_data_io(data_io_class=data_io_class, data_io_kwargs=kwargs)

Check warning on line 1345 in src/hdmf/common/table.py

View check run for this annotation

Codecov / codecov/patch

src/hdmf/common/table.py#L1342-L1345

Added lines #L1342 - L1345 were not covered by tests


@register_class('DynamicTableRegion')
class DynamicTableRegion(VectorData):
Expand Down