Commit ca948697 authored by lucas_miranda's avatar lucas_miranda
Browse files

Fixed a bug that introduced an additional ghost data point when applying smoothing

parent 325d1b9e
......@@ -210,7 +210,7 @@ class project:
)
tab_dict[key] = pd.concat([x, y], axis=1).sort_index(axis=1)
lik_dict[key] = lik
lik_dict[key] = lik.droplevel("scorer", axis=1)
if self.smooth_alpha:
......@@ -225,7 +225,7 @@ class project:
)
)
smooth.columns = cols
tab_dict[key] = smooth.iloc[1:, :]
tab_dict[key] = smooth.iloc[1:, :].reset_index(drop=True)
for key, tab in tab_dict.items():
tab_dict[key] = tab[tab.columns.levels[0][0]]
......
......@@ -663,6 +663,8 @@ def tag_rulebased_frames(
),
thickness=-1,
)
# Print frame number
write_on_frame("Frame " + str(fnum), corners["downleft"])
if tag_dict["nose2nose"][fnum] and not tag_dict["sidebyside"][fnum]:
write_on_frame("Nose-Nose", conditional_pos())
......
......@@ -427,8 +427,8 @@ def interpolate_outliers(
exclude: str,
lag: int = 5,
n_std: int = 3,
mode: str = "and",
limit: int = 5,
mode: str = "or",
limit: int = 15,
):
"""Marks all outliers in experiment and replaces them using a univariate linear interpolation approach.
Note that this approach only works for equally spaced data (constant camera acquisition rates).
......@@ -437,9 +437,9 @@ def interpolate_outliers(
- experiment (pd.DataFrame): dataframe with time series representing the x, y positions of a every body part
- lag (int): size of the convolution window used to compute the moving average
- n_std (int): number of standard deviations over the moving average to be considered an outlier
- mode (str): if "and" (default) both x and y have to be marked in order to call an outlier.
If "or", one is enough
- limit (int): maximum of consecutive outliers to interpolate. Defaults to 5
- mode (str): if "and" both x and y have to be marked in order to call an outlier.
If "or" (default), one is enough
- limit (int): maximum of consecutive outliers to interpolate. Defaults to 15
Returns:
interpolated_exp (pd.DataFrame): Interpolated version of experiment
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment