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

RaggedArray third-dimension slice #164

Closed
justinrporter opened this issue Mar 30, 2019 · 1 comment
Closed

RaggedArray third-dimension slice #164

justinrporter opened this issue Mar 30, 2019 · 1 comment
Labels

Comments

@justinrporter
Copy link
Collaborator

justinrporter commented Mar 30, 2019

It appears not to be possible to calculate slice a stride in the third dimesion of a RaggedArray:

a = ra.RaggedArray(np.zeros((100, 2)), lengths=[90, 10])
a[:, :, ::2]

gives

ValueError                                Traceback (most recent call last)
<ipython-input-37-64bea6dd4686> in <module>()
      1 a = ra.RaggedArray(np.zeros((100, 2)), lengths=[90, 10])
----> 2 a[:, :, ::2]

~/modules/enspara/ra/ra.py in __getitem__(self, iis)
    531         # tuples get index conversion from 2d to 1d
    532         elif isinstance(iis, tuple):
--> 533             first_dimension, second_dimension = iis
    534             # if the first dimension is a slice, converts both sets of indices
    535             if isinstance(first_dimension, slice):

ValueError: too many values to unpack (expected 2)

@mizimmer90 is this a bug or expected behavior? It seems very reasonable to want to do this.

@mizimmer90
Copy link
Collaborator

This is expected behavior. While it is reasonable to want this, the ragged array is currently only supported for 2 dimensions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants