averageCoherence method

double averageCoherence({
  1. int n = 10,
})

Running average coherence over the last n cycles.

Implementation

double averageCoherence({int n = 10}) {
  if (_coherenceHistory.isEmpty) return 1.0;
  final samples = _coherenceHistory.reversed.take(n).toList();
  return samples.reduce((a, b) => a + b) / samples.length;
}