compute static method

List<double> compute(
  1. List<List<double>> spectra
)

Computes the spectral flux for a list of spectra, returning a list of flux values where the first value is 0 (since there is no previous spectrum to compare to).

Implementation

static List<double> compute(List<List<double>> spectra) {
  if (spectra.isEmpty) {
    return const [];
  }

  final flux = <double>[0];

  for (int i = 1; i < spectra.length; i++) {
    flux.add(positiveDifference(spectra[i], spectra[i - 1]));
  }

  return flux;
}