Closed GoktugAlkan closed 1 year ago
Hi @GoktugAlkan ,
Is the data returned by nwb.units.vectordata.get('labels').data([10275652,10327085])
correct? It looks like element 10327085
should also throw an error no?
@lawrence-mbf Exactly, normally there should be an error for element 10327085
because we don't have any entry at that position. {'label_xx'}
corresponds to entry at position 10275652
but an error should be there for position 10327085
.
Interestingly, also the preview of says that there are 10327085
entries in the cell array.
@GoktugAlkan With an example script, I can recreate the bug where the data is duplicated if the non-contiguous indices are invalid. I do get an error if I index outside the allocated space though.
@lawrence-mbf Did you try to save the nwb file (nwbExport), then read it (nwbRead), and then access entry 10327085
?
If you run the following script and call DataStub([1, 11])
the output will duplicate the data from index 1
.
Note that just indexing the out-of-bounds DataStub(11)
throws an error. Not sure why your code does not.
@GoktugAlkan Out of curiosity, if you use double values for the "labels" property does the same behavior occur? Or, if you have DataStubs of other types, does indexing out of bounds do the same thing?
Hi @GoktugAlkan ,
Please check and let me know if this PR fixes things: https://github.com/NeurodataWithoutBorders/matnwb/pull/514
Hello,
We created nwb files where the field
nwb.units
is populated according to our previous discussion. We also added a cell array that contains the labels of all the spikes that were detected. This cell array can be accessed by executingnwb.units.vectordata.get('labels')
.When we execute
nwb.units.vectordata.get('labels')
we see the following:This means that we should have 10327084 entries in this array, which is correct so far. However, when we execute
nwb.units.vectordata.get('labels').data(10327084+1)
we get the following answer:We are wondering why there is an empty entry at index 10327084+1 although the whole cell array should just contain 10327084 entries. We would have expected to see an error when we execute this command.
Because of this issue we are not sure trust the answers when we load individual entries of this array by executing, for example,
nwb.units.vectordata.get('labels').data([10275652,10327080])
.Remark: Although
nwb.units.vectordata.get('labels').data(10327084+1)
is an empty entry executingnwb.units.vectordata.get('labels').data([10275652,10327085]
outputsMany thanks in advance for your help.