hdmf-dev / hdmf-common-schema

Specifications for pre-defined data structures provided by HDMF.
Other
3 stars 7 forks source link

Doc for `VectorIndex` is wrong #35

Closed rly closed 4 years ago

rly commented 4 years ago

Based on the graphic in the NWB preprint which is also here: https://github.com/hdmf-dev/hdmf-common-schema/blob/master/docs/source/figures/ragged-array.png

the docstring for VectorIndex is wrong: https://github.com/hdmf-dev/hdmf-common-schema/blob/b22b352851db5b925e142f036187ad25e5ffb9d4/common/table.yaml#L11-L13

I think I wrote this incorrectly months ago. It should say: The first vector is at VectorData[0:VectorIndex[0]]. The second vector is at VectorData[VectorIndex[0]:VectorIndex[1]].

example:

>>> from hdmf.common import VectorData, VectorIndex
>>> foo = VectorData(name='foo', description='foo column', data=['a', 'b', 'c', 'd'])
>>> foo_ind = VectorIndex(name='foo_index', target=foo, data=[2, 4])
>>> foo_ind[0]
['a', 'b']