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

[Bug]: DataStub errors out if trying to retrieve data with empty indices #595

Open
2 tasks done
ehennestad opened this issue Sep 14, 2024 · 2 comments · May be fixed by #605
Open
2 tasks done

[Bug]: DataStub errors out if trying to retrieve data with empty indices #595

ehennestad opened this issue Sep 14, 2024 · 2 comments · May be fixed by #605
Assignees
Labels
status: need verification potentially solved, but needs verification topic: matnwb-api related to improving the matnwb api

Comments

@ehennestad
Copy link
Collaborator

What happened?

I ran the convertTrials tutorial (branch: 515-fix-convert-trials-tutorial) and tried to run the following:

Steps to Reproduce

nwbIn = nwbRead(nwbFilePath);
nwbIn.intervals_trials.toTable()

Error Message

Error using hdf5lib2
The HDF5 library encountered an error and produced the following stack trace information:

    H5Sselect_elements    elements not specified

Error in H5S.select_elements (line 43)
H5ML.hdf5lib2('H5Sselect_elements', space_id, op, h5_coord);

Error in types.untyped.DataStub/load_mat_style (line 52)
        H5S.select_elements(readSpaceId, 'H5S_SELECT_SET', ...

Error in indexing (line 169)
                data = obj.load_mat_style(CurrentSubRef.subs{:});

Error in types.util.dynamictable.getRow>select (line 170)
        selected = Vector.data(selectInd{:});

Error in types.util.dynamictable.getRow>select (line 205)
        selected{iRange} = select(DynamicTable,...

Error in types.util.dynamictable.getRow (line 49)
    row{i} = select(DynamicTable, indexNames, ind);

Error in types.hdmf_common.DynamicTable/getRow (line 120)
        row = types.util.dynamictable.getRow(obj, id, varargin{:});

Error in types.util.dynamictable.nwbToTable (line 81)
matlabTable = [matlabTable DynamicTable.getRow( ...

Error in types.hdmf_common.DynamicTable/toTable (line 124)
        table = types.util.dynamictable.nwbToTable(obj, varargin{:});

Operating System

macOS

Matlab Version

R2023b

Code of Conduct

@ehennestad
Copy link
Collaborator Author

The error occurs because some of the rows in timeseries_index of the intervals_trials are empty, i.e does not point to any timeseries.

In MATLAB, it is possible to use empty indices, and this could be implemented for DataStub as well.

e.g.

a = struct

a = 

  struct with no fields.

K>> a([])

ans = 

  0×0 empty struct array with no fields.

ehennestad added a commit that referenced this issue Sep 14, 2024
@ehennestad
Copy link
Collaborator Author

@bendichter @lawrence-mbf
I added a proposed fix and it works in the specific case where this error happens. It is not a very general fix, and there may be better ways to solve this?

@ehennestad ehennestad self-assigned this Sep 17, 2024
@ehennestad ehennestad reopened this Oct 31, 2024
@ehennestad ehennestad added the status: need verification potentially solved, but needs verification label Oct 31, 2024
@ehennestad ehennestad linked a pull request Oct 31, 2024 that will close this issue
3 tasks
@ehennestad ehennestad added the topic: matnwb-api related to improving the matnwb api label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: need verification potentially solved, but needs verification topic: matnwb-api related to improving the matnwb api
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant