combiTransform method

List<List<Float64List>> combiTransform (Float64List fidValues, Map<String, Object> args, int nrows, int userFTSize, RowDoneCallback rcb)

Processes fidValues by treating it as a 2D array with nrows (=1 for 1D). Each row is assumed to be complex: (re, im, re, im, ..) Returns null for 1D, while fidValues contain the processing result. Otherwise returns a list with 2 entries: The reals and the imaginaries (which can be an empty array if processing does not generate imaginaries). Processing means: bcoffset - em - gm - ft for each row of fidValues, in this sequence, depending on argsdobc, ..doem, ..dogm, ..doft. Processing is performed for each of the rows. The function rcb, if not null, will be called with the row number after processing a row. If userFTSize is not null, the transform size of each row is adjusted respectively: (zero-filling if bigger, cut-off if smaller) NOTE: bc/em/gm are do not consider userFTSize. If a row is not a power of two, it is zero-filled to the next power of 2.

Implementation

static List<List<Float64List>> combiTransform(
    Float64List fidValues,
    Map<String, Object> args,
    int nrows,
    int userFTSize,
    RowDoneCallback rcb) {
  List<Float64List> real2d, imag2d, reim;
  int rowLength = fidValues.length ~/ nrows;
  real2d = new List<Float64List>();
  imag2d = new List<Float64List>();
  Float64List yValues;
  for (int i = 0; i < nrows; i++) {
    if (nrows == 1)
      yValues = fidValues;
    else
      yValues = Array1D.getRow(fidValues, i, nrows);

    if (args[dobc])
      BaseLine.bcOffset(yValues, args[complex], args[bcstart], args[bcsize]);
    if (args[doem])
      WinFunc.expMult(yValues, args[ema], args[complex], args[groupDelay]);
    if (args[dogm]) WinFunc.gaussMult(yValues, args[gmr], args[gms], args[complex]);

    if (args[doft]) {
      yValues = Array1D.zeroFill(yValues, userFTSize, true);
      reim = transformShuffled(yValues, args[groupDelay], args[swapMode]);
      real2d.add(reim[0]); // after transform: reals+imags
      imag2d.add(reim[1]);
    }

    if (!args[doft]) {
      // replace original fidvalues by result
      for (int k = 0; k < yValues.length; k++)
        fidValues[i * rowLength + k] = yValues[k];
    }

    if (rcb != null) rcb(i);
  }

  if (args[doft])
    return [real2d, imag2d]; // Two 2D arrays
  else
    return null; // fidValues were replaced
}