combiTransform method
Processes complexArray2D
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 complexArray2D
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 complexArray2D
,
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 complexArray2D,
Map<String, Object> args,
int nrows,
int userFTSize,
RowDoneCallback rcb) {
List<Float64List> real2d, imag2d, reim;
int rowLength = complexArray2D.length ~/ nrows;
real2d = List<Float64List>();
imag2d = List<Float64List>();
Float64List yValues;
for (int i = 0; i < nrows; i++) {
if (nrows == 1) {
yValues = complexArray2D;
} else {
yValues = Array1D.getRow(complexArray2D, 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++) {
complexArray2D[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
}
}