Closed pelson closed 9 years ago
This is bizarrely similar to the code I was writing yesterday - right down to the name of the class and it's parameters! Convergent evolution in action?
Convergent evolution in action?
Good stuff. Apparently it isn't always bad to step on each others toes in a sprint (according to Scrum master training yesterday)
Or perhaps it was subliminal? https://github.com/SciTools/biggus/pull/116#discussion_r26714001 :wink:
Or perhaps it was subliminal? #116 (comment) :wink:
I suspect a bit of both. :grinning:
P.S. This needs a rebase, so if I were putting review effort anywhere, I'd start with #124. If you're curious about this, browse away! :smile:
@rhattersley - now that #124 is merged, do you want me to rebase and fixup the remaining tests, or would you like me to iterate based on your comments so far?
do you want me to rebase and fixup the remaining tests, or would you like me to iterate based on your comments so far?
I'd prefer to postpone the rebase for now if that's not going to cause too many problems.
I'd prefer to postpone the rebase for now if that's not going to cause too many problems.
I'll hold fire then. Actions will be forthcoming in new commit(s).
I've followed through with the major action of using _getitem_full_keys
. There are one or two comments that still need addressing, but how is that shaping up?
how is that shaping up?
It's fine - please continue, and feel free to re-base now.
I've rebased and handled the cases which related the the latest PR.
I'm pulling on a rather slippery thread at the minute. First off, the code doesn't yet support:
>>> import numpy as np
>>> a = np.arange(3)[None, ..., None]
>>> a[1:2].shape
(0, 3, 1)
But this is pulling on a wider issue that you can do the following with a newaxis:
>>> a[(0, 0), ...].shape
(2, 3, 1)
In order to implement this in the simplest possible way, I'm tempted to suggest a BroadcastedArray
which would be created when indexing with: BroadcastedArray(array, broadcast={0: 2})
where the keyword represents a mapping of axis to length.
As discussed offline yesterday, I'm OK with just raising a NotImplementedError
for now.
As discussed offline yesterday, I'm OK with just raising a NotImplementedError for now.
@rhattersley - I've now added the commit which does the minimum possible to give sensible fail mechanisms on indexing of NewAxesArray.
Thanks @pelson. :+1:
For the record, I fixed both issues in #133.
A clear path existed for me to implement np.newaxis support so I took it. The PR is pretty big, but the vast majority is testing.
Apologies for stepping on your toes @rhattersley. Hope that is :+1:.
Alternative for #116 (only without the np.array support, which would be nice to have).
Some work from #124 needs to be pulled into this, so I will rebase once that is merged.