Patch setupRabbit.py operations#671
Conversation
|
As I commented in Mattermost, I think this change of --select that adds the sum keyword to keep or remove the axis after the operation is making --select equivalent to --axlim (at least in the default case), which slices but doesn't remove the axis. |
| logger.debug("Applying global action") | ||
| h = self.globalAction(h) | ||
|
|
||
| sum_axes = [x for x in self.sum_gen_axes if x in h.axes.name] |
There was a problem hiding this comment.
Since you are touching this part, can we take this occasion to rename sum_axes (which is only used in this and the next few lines) as sum_gen_axes or something to explicitly mark it as such? It is probably already quite clear from the right had side that it only affects gen axes, usually for the unfolding or alphaS, but if you did it would make this part of the code easier to understand. Other possible axes on which we might apply actions are managed elsewhere, for example through the globalAction.
scripts/rabbit/setupRabbit.py
Outdated
| sel_ax, sel_lb, sel_ub = sel.split() | ||
| parts = sel.split() | ||
| sel_ax, sel_lb, sel_ub = parts[0], parts[1], parts[2] | ||
| do_sum = len(parts) > 3 and parts[3] == "sum" |
There was a problem hiding this comment.
In spite of my previous comment, I think it makes sense that you made this action act more generically, allowing the user to control whether the marginalisation of the axis should happen or not.
Unfortunately it modifies the previous default behaviour, but if this is properly advertised to all users I can accept it
|
Hi @cippy @davidwalter2 thank you for the discussions. I propose the following
what do you think? |
|
wremnants/utilities/styles/styles.py
Outdated
| ], | ||
| "min": common_groups | ||
| + [ | ||
| "angularCoeffs", |
There was a problem hiding this comment.
I am not generally using this whole group, but I think its logic was to have the minimal grouping with no redundancy (i.e. without adding also groups of listed subgroups), to avoid that one tends to double-count the lines with impacts
|
Fine to merge for me. Have you checked that the options work as expected? Especially for negative numbers, it might still be true that we need to pass " -2.4" (note the white space) instead of just -2.4 or "-2.4" |
Hi @cippy I've added a small parser wrapper to deal with things like "-2.4j". You should now be able to do "--axlim eta -2.4j 2.4j" without any further tricks. I don't think we need this for negative integers "-2" since --axlim takes either values "--axlim eta -2.4j 2.4j" or bin numbers, "--axlim eta 0 19", but let me know if you disagree. |
Hi, so now I remember that indeed we either pass integer numbers or pure imaginary ones when we want to pick a bin by value, this was to avoid ambiguities when you pass 2 to represent 2.0, right now you are forced to pass 2.0j if you want by value, and the parser would complain if it doesn't recognise an integer or an ending j, we probably want to keep it like that. The other issue was with the parser and negative numbers, in that when you use "--option -2.4 2.4" it interprets -2.4 as another option, even if you use strings. and "--option '-2.4' '2.4'", because of some internal parser handling. Do you say your change now deals with it correctly? If so, very good, otherwise it is simpler to force the user to add white spaces before the minus like " -2.4" (curiously, a white space at the end like in "-2.4 " was also working). |
|
Yes, we're now relying on |
--selectand--axlimare possibly overlapping, and inconsistent with the order of operations like projecting. The goal of this PR is to separate the two, and ensure that things aren't quietly failing.