-
Notifications
You must be signed in to change notification settings - Fork 15
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
pupil_u, pupil_v being modified in RubinOptics.applyTo #475
Comments
I think I would probably consider this a bug in batoid.RayVector._directInit. That function shouldn't modify it's input parameters. @jmeyers314 Would this be an easy fix to make? Or should we add a line to make copies in imsim? |
I think I'd probably just make copies on the line @esheldon highlighted. A bunch of batoid operates in-place by design b/c I noticed it made a noticeable speed difference. As an aside, supposedly the public RayVector ctor makes copies, so we could theoretically switch to that: https://github.com/jmeyers314/batoid/blob/07edb511630c57131d9072494e7855571865e3fa/batoid/rayVector.py#L23-L25. Though now I'm looking at the docs for Weird:
So the str() prints out different addresses but they're actually the same? |
I think these are two different pointers to the same place in memory. The hex value you see here is the address of the pointer. Not the address it points to. |
And I take back the comment that this is a bug in batoid. It's a leading underscore method, which (in my framework of UI design) is allowed to take this kind of shortcut. So I agree it's on us to use that method properly. There may still be a bug in the non-underscore version, but that's a separate matter. |
Addressed by #477 . |
I noticed that the pupil positions of the photon array are being modifed by RubinOptics.applyTo
Here "x, y" are references to the pupil values, not copies
imSim/imsim/photon_ops.py
Line 92 in b6a633f
subsequently these get modified in place in the trace call.
I suggest that those x, y should be copies of the pupil values rather than references
The text was updated successfully, but these errors were encountered: