array2D method
Returns a matrix containing a two-dimensional mixed Gauss-Lorentz shape
consisting of 0
rows and 1
columns
Check method array1D for the other parameters. However, c
, w
, m
are arrays of length 2.
Implementation
static List<Float64List> array2D(
List<int> rows_cols, double a, List<double> c, List<double> w, List<double> m, double noiseAmpl,
[double fGauss, double fLorentz]) {
LorentzGauss lg = LorentzGauss.fromPars(a, c, w, m, fGauss, fLorentz);
int nrows = rows_cols[0], ncols = rows_cols[1];
List<Float64List> matrix = List(nrows);
math.Random rand = math.Random();
for (int i = 0; i < nrows; i++) {
double yrow = i.toDouble();
for (int k = 0; k < ncols; k++) {
double xcol = k.toDouble();
double zval = lg.getValueAt([yrow, xcol]);
if (noiseAmpl != null) {
double noise = (2 * rand.nextDouble() - 1.0) * zval * noiseAmpl;
zval += noise;
}
matrix[i][k]=zval;
}
}
return matrix;
}