Skip to content

Change axis default on a number of functions in uproot-raw codegen #1054

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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

ponyisi
Copy link
Collaborator

@ponyisi ponyisi commented May 10, 2025

We make many awkward functions available when writing cuts and expressions for uproot. A lot of these default to operating on the entire array at once (axis=0) in ways that make no sense for an event-by-event cut mask. In general this default causes a lot of errors. We will override those defaults here (we believe the defaults are so incorrect that nobody with correct code will be affected by this). The axis can still be overridden if people want. The list of functions with changed defaults will be given in the frontend documentation.

Copy link
Collaborator

@gordonwatts gordonwatts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't like this. I get why you are doing this. But this is magic and now behaves differently than regular code. So what users learn will break here.

btw - if axis argument is specified twice will this work?

@ponyisi
Copy link
Collaborator Author

ponyisi commented May 13, 2025

It will work if the user specifies axis again. (It doesn't work if a user specifies it as a positional argument instead of a keyword one but this is a very rare pattern.)

I understand why this would make one uncomfortable but the fact is that essentially every new user I've seen work with the uproot-raw transformer makes the error of not specifying axis=1 in a relevant place and unless they're quite competent with awkward they don't figure it out on their own. When awkward specifies axis=0 as a default this is never the behavior you want here (unless you can come up with a circumstance where we want queries to correlate across events ...). The biggest likelihood of causing problems, I would guess, is actually that some inexperienced users come up with some cut expression that works in uproot-raw and not when they run awkward locally.

The equivalent RDataFrame expressions don't need this kind of silliness to work correctly...

@ponyisi
Copy link
Collaborator Author

ponyisi commented May 13, 2025

I suppose we could make it an option in the uproot-raw request (though I would still want the default to be the override).

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

Successfully merging this pull request may close these issues.

2 participants