Skip to contents

Main functions

Main functions for estimating kinematic parameters from midline data. These are more or less in the order you would use them. Functions ending in _df operate on a data frame and often add multiple columns to the data frame. The data frame should have two identifier columns:

  • frame: Identifies instants in time
  • point: Identifies locations along the body, so that they can be ordered from head to tail.

To use identifier columns with different names, the functions take options .frame and .point. To change the names of the output columns, the functions use an option .out. .out can be a vector containing the names of the columns, or a named list.

arclength()
Calculate arc length along a 2D curve
interpolate_points_df()
Interpolates and smooths a 2D curve at new arc length
interpolate_width()
Interpolates and scales fish body width
get_midline_center_df()
Gets the center of a midline for many midlines in a data frame
get_primary_swimming_axis_df()
Gets the primary swimming axis for many midlines
curvature()
Estimates curvature for a single curve
hilbert_phase()
Compute phase of an oscillation using the Hilbert transform
peak_phase()
Compute phase of an oscillation by locating peaks and zero crossings.
get_frequency()
Estimates the cycle frequency based on time and phase
get_wavelength()
Computes the body wavelength based on the phase at each point and the arc length
get_body_cycle_numbers_df()
Gets oscillation cycle numbers for a midline data set

Helper functions

Other useful functions for estimating kinematic parameters.

apply_filter()
Apply a filter constructed with build_filter
build_filter()
Constructs a smoothing filter
check.out()
Helper function to check the .out and .out_default variables used in this package
check_if_overwrite_columns()
Check if a data frame has columns that we might overwrite
deriv()
Estimate first or second derivatives for dy/dx.
get_cycle_numbers()
Gets cycle numbers from a phase variable
get_primary_swimming_axis()
Gets the main swimming axis from a midline
get_volume()
Gets the volume of segments of a cylindrical body with elliptical cross section
interpolate_peak_location()
Interpolate the location of a peak based on three points
interpolate_points_frame()
Interpolates x and y points on a curve to different arc lengths
pivot_kinematics_longer()
Pivots a kinematics dataset into long format
skip_na()
Skip NAs when running a function on a vector