-
Notifications
You must be signed in to change notification settings - Fork 12
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
Restrict kinematics functions to position arrays in cartesian coordinates #291
Comments
I have a rather different opinion regarding this. I don't see a need to restrict what these functions can do - we expect users to know what's in their data array and the current docstrings already clarify "The input data array containing position vectors in cartesian coordinates, with Having these kinds of restrictions will mean users cannot use these functions when they have 1D or 3D data, even if their data is in cartesian space. In terms of position in polar coordinates, keeping the current functions as is allows users to compute radial/angular velocity/acceleration; if they wanted, they could also input "rho" or "phi" separately (e.g. pos.sel(space_pol="phi")) into these functions to say, compute tangential velocity. |
I see the merits of both arguments for and against restricting the kinematic functions to Cartesian space input. I have a kind of compromise to propose:
Would you both be ok with such a solution? |
@niksirbi I was gonna suggest that same thing so yeah, I like this option 😁 |
I was writing a longer explanation to this, I paste it below mostly for future reference. It includes the expressions for the radial and tangential velocity, and the radial and tangential acceleration, as a function of the I agree users should be responsible for the operations they apply to their data, but I think in this case the names of the functions could be genuinely misleading for an input vector in polar coordinates. Below I explain why. Just to clarify, when I say using a cartesian coordinate system in Case for displacement
Case for velocity
Case for acceleration
Because of these reasons I think we should:
I realise I should have given more background to this issue, specifically should have also cross-linked to this other closely related issue. |
Thanks for this detailed explanation Sofia, it will be very useful for when/if we implement the tangential/radial velocity. |
Thanks both for the detailed explanations! I see now how this may be confusing. |
Is your feature request related to a problem? Please describe.
Right now we only check if the position array has a
time
dimension. So in theory we can pass position arrays in polar coordinates tocompute_displacement
,compute_velocity
,compute_acceleration
.This could be confusing for users because the result of passing a position array in polar coordinates to
compute_displacement
is not the same as the displacement vector in polar coordinates. The same applies tocompute_velocity
,compute_acceleration
and their corresponding vectors.Additionally, the quantities computed by passing a position array in polar coordinates to the current implementation of the kinematics functions would rarely be useful as a vector. E.g. for
compute_displacement
, the computeddisplacement
array would have the time derivative ofrho
along the first spatial dimension and the time derivative ofphi
along the second spatial dimension. I think it would be very rare if a user wants these two quantities paired up as a vector in their analysis.If a user explicitly wants these quantities (e.g., the time derivative of
phi
may be useful by itself), it would be more transparent to directly take the time derivative of that quantity (using xarray'sdifferentiate
) rather than to use thedisplacement
wrapper.Describe the solution you'd like
In the kinematics functions, validate that the input position data is in cartesian coordinates.
Describe alternatives you've considered
\
Additional context
\
The text was updated successfully, but these errors were encountered: