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

Layout Record should have an 'axis_wrap_if_negative' method #1551

Closed
jpivarski opened this issue Jul 18, 2022 · 2 comments
Closed

Layout Record should have an 'axis_wrap_if_negative' method #1551

jpivarski opened this issue Jul 18, 2022 · 2 comments
Assignees
Labels
bug The problem described is something that must be fixed

Comments

@jpivarski
Copy link
Member

Version of Awkward Array

HEAD

Description and code to reproduce

Otherwise, any method that takes an axis fails like this:

AttributeError: 'Record' object has no attribute 'axis_wrap_if_negative'

This affects both v1 and v2. It's a bug, so it should be fixed in both, but v2 is higher priority if there's only time to fix one of them. The fix in v2 can be in Python; the fix in v1 has to be C++ code.

Fields of a record don't count as an axis, so the implementation would be to just pass it to self._array.axis_wrap_if_negative.

However, if the axis that this function returns is equal to 0, that should be an error. The user is trying to compute something on a top-level array, but the top-level is a scalar, not an array. We don't want to pass that through self._array.axis_wrap_if_negative and have, for instance, ak.to_regular(record, axis=0) return an array, especially if that ignores the Record's _at attribute and returns an output containing what had been hidden data.

@jpivarski jpivarski added the bug The problem described is something that must be fixed label Jul 18, 2022
@agoose77
Copy link
Collaborator

Huh, I thought we had an issue tracking this, but apparently not!

@jpivarski
Copy link
Member Author

I don't remember it. I just did a search and didn't find it. If it rings a bell, that's a good sign for consistency, at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The problem described is something that must be fixed
Projects
None yet
Development

No branches or pull requests

3 participants