You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was the second half of #1375; I'm splitting it because it's really two issues.
Now #1375 is just for applying the policy in v1, which will prevent bugs.
This issue is for extending the capability to what users really want—allowing reducers to be overridden so that ak.sum on Vectors will add the Vectors (accounting for coordinate systems). It can only be done in v2.
The text was updated successfully, but these errors were encountered:
importvectorv=arrayoflistsofvectorsinpt, phi, etacoordinatesak.sum(v, axis=1) # CORRECTLY adds vectors in each list to produce one vector per list
Vector needs to be able to overload record-sum in such a way as to correctly handle non-Cartesian coordinates. On our side, that means that reducers over records (such as vectors) need to be overloadable.
Overloading syntax?
ak.behaviors[np.sum, "Momentum3D"] =special_function# implemented in vector, not awkward
There's already a syntax for overloading NumPy ufuncs,
Ufuncs are "mapper" functions; the new capability would be to be able to overload "reducer" functions. The only ones that will likely ever be overloaded are np.sum (very likely) and np.prod (not very likely). Others, like np.any or np.all, probably not, because they usually act on booleans. Maybe np.min and np.max would want overloads for records so that orderings can be given to complex objects. (If someone wants to overload np.min and np.max, they'd want to connect it somehow with the ufuncs np.less_than, np.greater_than, np.minimize, and np.maximize...)
Should it just be records, or also arrays? (__record__: "Momentum3D" and also __array__: "string"?)
Description of new feature
This was the second half of #1375; I'm splitting it because it's really two issues.
Now #1375 is just for applying the policy in v1, which will prevent bugs.
This issue is for extending the capability to what users really want—allowing reducers to be overridden so that
ak.sum
on Vectors will add the Vectors (accounting for coordinate systems). It can only be done in v2.The text was updated successfully, but these errors were encountered: