splprep, splrep, sproot, spalde, splint - evaluation, roots, integralbisplrep, bisplev - bivariate splinesUnivariateSpline, BivariateSpline - an alternative wrapping

The first stage of analysis was estimating instantaneous velocities, accelerations, and headings from the raw tracking data (). Translational velocity and acceleration were calculated by taking the first and second derivatives of an interpolation spline fit to the body position data (splev and splrep functions, Scientific Python). The velocities and accelerations were split into vertical and horizontal components. The body orientation vector was represented in spherical coordinates as azimuth and pitch angles. We took the first derivatives to obtain azimuth and pitch velocities. Because the video tracking system did not allow a measurement of body roll, we decided to use a global coordinate system instead of a body axis-centered coordinate system. In our frame of reference, pitch is a global measure defined relative to the horizontal plane. Heading was calculated as the instantaneous direction of the horizontal translation velocity, and the heading velocity was calculated as the derivative of heading.