VectorNumpy3D
's azimuthal
and longitudinal
properties throw an error (similar for VectorNumpy4D
)
#194
Labels
bug (unverified)
The problem described would be a bug, but needs to be triaged
hacktoberfest
help wanted
Extra attention is needed
Reproducible example
Similarly for -
vec.longitudinal
vec.azimuthal
for a 4D NumPy vector (VectorNumpy4D
)vec.longitudinal
for a 4D NumPy vector (VectorNumpy4D
)vec.temporal
for a 4D NumPy vector (VectorNumpy4D
)Error
Cause
Going through the stack trace I looked into the function
_getitem
, which was throwing an error related to the number of arguments. After adding some debug statements, I discovered that theif-else
statements written to initializeazimuthal
,longitudinal
, andtemporal
are never executed when running the example.This is due to the fact that the type of the passed
array
argument isAzimuthalNumpyXY
(in the case of callingvec.azimuthal
on a structured array having"x"
and"y"
as the datatypes). Asarray
belongs toAzimuthalNumpyXY
, it never has an attribute named_azimuthal_type
, rather it has attributes namedx
andy
.The main intention here was to pass in a
VectorNumpy2D
,VectorNumpy3D
, orVectorNumpy4D
object but I can't really figure out why the__getitem
method in the classGetItem
is picking upAzimuthalNumpyXY
.I think the case of calling
azimuthal
on aVectorNumpy2D
object works coincidentally, through the lastelse
condition._getitem
A possible fix
I tried fixing this by modifying the function but ended up breaking some tests -
Modified function
This works somewhat fine. An example -
Broken tests
These are most probably failing as I did a lot of hard coding inside
_getitem
-The text was updated successfully, but these errors were encountered: