agepy.mag.trajectory.add_diff
- add_diff(df, periods=1, dim_col='x')
Adds a “diff” column for differentiation of a coordinate.
This function adds “diff_x” for the differentiation of x the column. This function adds the column to the original DataFrame, so its impure :(
- Parameters:
- df: DataFrame
with particle data (from trackpy)
- periods: int, optional
Window of frames to get diff/velocity from. Default is 1.
- dim_col: string, optional
Calculate velocity on column x or y. Default is “x”.
- Returns:
- df:
DataFrame The original dataframe with the new “diff” column
- df:
- Return type:
DataFrame