Skip to content

aniprocess 0.3.0

Latest

Choose a tag to compare

@roaldarbol roaldarbol released this 14 Aug 21:49
· 2 commits to main since this release
fd9720c

Breaking changes

  • The interface is now split into three tiers (#30). The individual functions work on a vector or a frame of coordinate columns, *_with() selects a method by name, and *_across() applies one to a whole aniframe.

    filter_across(data, "lowpass", cutoff_freq = 5)
    filter_with(x, "gaussian", sigma = 2)
    data |> mutate(filter_ccma(pick(all_of(c("x", "y")))))
  • filter_aniframe() is removed — use filter_across().

  • replace_na() is removed — use replace_na_with(), which does not collide with tidyr::replace_na().

  • filter_ccma(), filter_na_speed(), filter_na_excursion(), filter_na_roi() and filter_na_confidence() now take a frame of coordinate columns rather than an aniframe. Use filter_across() / filter_na_across() for a whole aniframe.

  • Filters preserve gaps by default: keep_na is TRUE everywhere except the Kalman filters, where inferring across gaps is the point. Pass keep_na = FALSE for the old behaviour (#38).

  • Argument names are consistent across the package: window_width replaces window_size in filter_sgolay(), find_peaks() and find_troughs(); x replaces measurements in the Kalman filters; min_value/max_value replace min/max in filter_na_range().

  • filter_na_confidence() no longer masks rows whose confidence is NA, and warns instead — a missing score means not assessed, not poor.

  • filter_na_across(method = "speed") estimates an "auto" threshold per group. Pass threshold = "pooled" for a single estimate across all groups, which is steadier when tracks are short.

New features

  • New filter_one_euro(): the One Euro filter (Casiez, Roussel & Vogel, 2012), an adaptive low-pass whose cutoff rises with the speed of the signal — smooth when the animal is still, responsive when it moves (#35).
  • *_across() uses what the aniframe already knows: sampling_rate and the time column come from its metadata. variables selects columns with tidyselect, defaulting to variables_where.
  • keep_na is available on every filter, and validated.

Bug fixes

  • filter_na_speed() computes speed within each group, so a step is never formed between one track and the next. Where time restarts per track that step inflated the "auto" threshold and caused genuine outliers to be missed (#37).
  • Differencing filters (on_deltas, formerly use_derivatives) re-integrate from the original starting value; they previously dropped the first sample and shifted the whole series (#30).
  • filter_na_speed() no longer blanks groups too short to contain a step (#37).
  • The data.table (>= 1.18.0) requirement is enforced when the package loads, not only when it is installed (#33).

Performance

  • filter_ccma() and filter_na_excursion() no longer scale quadratically in the number of groups. At 3,000 groups they are roughly 8× and 3.5× faster (#37).