Turns and Angular Analysis

Turns

Turns can be calculated using calc_angle().

traja.trajectory.calc_angle(trj: traja.frame.TrajaDataFrame, unit: str = 'degrees', lag: int = 1)[source]

Returns a Series with angle between steps as a function of displacement with regard to x axis.

Parameters:
  • trj (TrajaDataFrame) – Trajectory
  • unit (str) – return angle in radians or degrees (Default value: ‘degrees’)
  • lag (int) – time steps between angle calculation (Default value: 1)
Returns:

Angle series.

Return type:

angle (pandas.Series)

Heading

Heading can be calculated using calc_heading().

traja.trajectory.calc_heading(trj: traja.frame.TrajaDataFrame)[source]

Calculate trajectory heading.

Parameters:trj (TrajaDataFrame) – Trajectory
Returns:heading as a Series
Return type:heading (pandas.Series)

..doctest:

>>> df = traja.TrajaDataFrame({'x':[0,1,2],'y':[1,2,3]})
>>> traja.calc_heading(df)
0     NaN
1    45.0
2    45.0
Name: heading, dtype: float64

Angles

Angles can be calculated using angles().