MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ roughness()

double MayaFlux::Kinesis::roughness ( std::span< const double >  values,
double  dt 
)
inlinenoexcept

Mean absolute difference between consecutive samples, per second.

Parameters
valuesChronological span, at least two entries
dtSeconds per sample
Returns
Average absolute step size divided by dt

Agitation independent of direction and of where the value sits. A quantity oscillating rapidly within a narrow band and one holding still have similar means and similar ranges and very different roughness, and a quantity sweeping smoothly across its whole range has a large variance and a small roughness.

Distinct from two existing measures that sound related. Not Discrete::mad, which is median absolute deviation about a centre and measures spread, not step size. Not Estimate::trend_explained_ratio, which asks what fraction of a window's variance its own linear trend accounts for and answers signal against noise around that trend; roughness answers nothing about a trend and reports the same value whether the steps are around a fixed point or along a steady climb. A window can score high on both: a value climbing steadily in small jittery increments has both a high trend-explained ratio and, if the increments are large relative to the climb's own rate, high roughness.

Definition at line 63 of file TemporalMeasures.hpp.

64{
65 const size_t n = values.size();
66 if (n < 2 || dt <= 0.0)
67 return 0.0;
68
69 double acc = 0.0;
70 for (size_t i = 1; i < n; ++i)
71 acc += std::abs(values[i] - values[i - 1]);
72
73 return (acc / static_cast<double>(n - 1)) / dt;
74}
std::vector< std::byte > values
Definition VDBWriter.cpp:26

References values.