-
Notifications
You must be signed in to change notification settings - Fork 20
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
[InMemoryDataset redesign] ix_with_slices, format_ndindex #387
Conversation
d4a6c7b
to
b990862
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No complaints here - I look forward to seeing how ix_with_slices
comes into play in the next PRs :)
Just a few merge conflicts to resolve, then we should merge.
return np.ix_(*idx2) | ||
|
||
|
||
def format_ndindex(idx: Any) -> str: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Maybe ndindex
itself would benefit from implementing something similar for its objects. If that happens, we could just return str(ndindex(idx))
here. Anyway for now this looks good.
return a.astype(dtype) | ||
|
||
|
||
def ix_with_slices(*idx: Any, shape: tuple[int, ...]) -> tuple: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, this is really cool. With this you can more elegantly select hyperrectangles of n-dim arrays. Nice!
Both of these things could definitely live in ndindex itself, although it's understandable if you just want to put them here first since ndindex may have more stringent requirements. |
b990862
to
c90a929
Compare
Two new general purpose functions