-
Notifications
You must be signed in to change notification settings - Fork 126
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
refactor!: back nanoevents.methods.vector with scikit-hep vector #991
Conversation
2ddea28
to
43e1f19
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.
I guess the only painful part is r
vs. rho
. Otherwise looks like it's drag and drop. @jrueb might want to review this as well.
0.6078019961139605, | ||
] | ||
|
||
computed_dphi = a.delta_phi(b).to_numpy() |
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.
Is the explicit cast required now?
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.
see the comment on approx.
unfortunately @jrueb has left academia for industry, unless he wants to review out of the kindness of his heart. |
fa9d4e5
to
b8e16a4
Compare
I'm putting in a deprecation for ~6 months from now over in #997. |
9ca78b9
to
d7ad56c
Compare
@lgray Is the plan to keep the public |
In the first phase of this, yes we'll keep those functions for backwards compatibility. In the long run, when we remove |
4a7ef1e
to
2374127
Compare
@nsmith- tests fail after appeasing linter :-( |
Yes, I added tests and am now working to improve them |
Ah, gotcha - yeah putting this together with scikit-hep/vector#413 I figured you may be messing around. |
8946d59
to
bbcf978
Compare
I think one place where we could benefit a lot from a thorough look-over by @Saransh-cpp is to make sure we're not unintentionally clobbering any of the vector interface with parts of nanoevents.vector, and likewise @nsmith- if there's anything we can do to make the delta between skh-vector-backed nanoevents.vector closer to the original implementation we should try to smooth all that out. |
* More tests * Don't modify the global awkward behavior
for more information, see https://pre-commit.ci
…ector fix: Revert "fix: updates from review"
fix: use the new type signature for copy_behaviors
@Saransh-cpp looks like a few things broke... there are missing behavior functions according to the tests. |
Weirdly, I am not able to reproduce any of the failures locally. I guess that's why I gave this PR a green flag in the last meeting. |
I am having no luck in reproducing these locally, even with new environments. @lgray could you or someone else check if this is reproducible locally? The GH Actions error looks unrelated (something wrong with pytest's installation in |
I'll give it a spin soon here to see if I can reproduce. |
@Saransh-cpp so this appears to be some windows-specific issues with paths in new images github produced. There's still another error, and we'll see if that shows up without the changes in this PR. |
@Saransh-cpp unfortunately it appears to be something with this PR. The tests with just awkward 2.6.7 over in #1149 are passing fine. |
@Saransh-cpp any luck? |
Hi @lgray, I tried the tests in a fresh environment as well as on another system (windows), but I really don't know why I am not seeing the errors locally. I am a bit clueless here. |
@Saransh-cpp so I reproduced this on my laptop:
So somehow we are resolving to the wrong type! It should be a GenParticleArray-typetracer. |
The layout seems to be correct though:
|
Hi @lgray. I was able to reproduce this on the third system 😬 I think I know why this is happening. Working on it right now. |
fix: copy_behaviors should be called before class definition
@nsmith- finally passing tests except for what looks like a spurious failure on arm linux. I've re-requested your review some time ago, but now it looks like you can properly do one. I think most of what you asked last time has been answered. |
Two minor missing suggestions from the review, which are more of discussion topics (maybe in tomorrow's meeting) - |
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!
@@ -519,22 +534,36 @@ def test_inherited_method_transpose(lcoord, threecoord, twocoord): | |||
) | |||
elif twocoord == "PolarTwoVector": | |||
c = ak.zip( | |||
{"r": [-10.0, 13.0, 15.0], "phi": [1.22, -1.0, 1.0]}, | |||
{"rho": [-10.0, 13.0, 15.0], "phi": [1.22, -1.0, 1.0]}, |
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.
This renaming of r
to rho
is something we'll need to remember to include in the release notes.
Perhaps a migration guide is in order? Are there any other user-facing changes we'll have to advertise?
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.
This the only one that isn't resolved by reading vector's documentation.
I think this one will be a fairly low hit-rate, since most people would specify a polar two vector using pT and phi, which is the same in both cases.
Fixes #992
Right now this is breaking in terms of some low-level definitions of physics variables, in particular:
rho
is now always transverse, as opposed to it being previouslyr
, this can certainly screw up math if you're not expecting itBreaking interface differences (as you can see in tests):
to_VectorND()
to correctly compare vectors.But that doesn't seem to have too many side effects?
However, all the tests pass and the current implementation is backwards compatible in terms of
delta_phi
vsdeltaphi
anddelta_r
vs.deltaR
so we can actually deprecate that in a reasonable way.Another thing we need to address is where the functions
nearest
andmetric_table
should live, which are fairly often used but could be advertised better.@nsmith- This will require a thorough review as well as contribution from you, and we should discuss how we want to roll this out.