You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Way to get a range of sub-arrays similar to numpy's x[a:b] #218
I'm attempting to do some audio processing, which involves a lot of splitting a big 2d array into smaller chunks. My wave is of shape [big_number, 2], for 2-channel stereo audio, and I'm attempting to slice this to get a time range. I would expect, for example, wave[0...1024] to result in an array of shape [1024, 2], but it seems to treat the whole thing as flat and just return an array of shape [1024].
I had a search through the docs and examples and couldn't find anything like this - is there a way to take this kind of slice or do i have to math out the size and reshape afterwards?
Activity
jneen commentedon Jun 18, 2024
Concrete example:
jneen commentedon Jun 18, 2024
I think the thing I would want (and how normal ruby arrays work) is more similar to this:
But this feels like it leaks the abstraction of shapes a little bit and forces me to think of it as a totally flattened array.
kojix2 commentedon Jun 19, 2024
Hi @jneen
I'm not very familiar with NumPy, so I don't know if my answer is what you expect, but I think you can use
true.I'm glad you're interested in NArray.
jneen commentedon Jun 19, 2024
Oh! That's... certainly an interesting way to do it. Thanks!