Open christophra opened 2 years ago
This is a feature request, and the fact that it's not the first time this has come up (see #122) means there needs to be a way to do this. Vectors can only be represented by independent blocks of azimuthal, longitudinal, and temporal coordinates, but maybe the constructors could handle "r" or "p" as a special case and construct "rho" or "pt".
Or maybe instead of the standard constructor, a special constructor? (I.e. for objects, a different function from vector.obj
, maybe vector.spherical
.) This idea of having special logic in the constructor can't be carried over to the Awkward Array case, which is just an interpretation of the RecordArray fields that are already there, not a computation. (RecordArrays may be buried in nested lists, and this interpretation only applies when they bubble up to the surface, so it can't be an active transformation, the way that the Object and NumPy backends are.)
In our terminology (the terminology that I've seen in most), "r" is a spherical coordinate, the 3D distance from the origin, and "rho" is a cylindrical coordinate, the 2D distance from the z-axis. I wouldn't be surprised if there are textbooks that do it the other way, but I thought the convention was fairly standard. I hope it's not confusing! (For "p" and "pt", there should be no confusion.)
(a feature request)
The system to construct vectors is elegant: first 2D, add an argument for 3D, add another for 4D. To quote the docs
But as a consequence, there is no argument to set the magnitude of a 3-vector. Using
rho
(orpt
) remains the radius in the azimuthal (xy) plane.pt
stands for "transverse momentum" (having read the docs), this is reasonably clear. But a user who knowsrho
from spherical coordinates could be unaware that they need to setrho = magnitude * sin(theta)
.Examples: