LorentzGauss.fromPars constructor

LorentzGauss.fromPars(double a, List<double> c, List<double> w, List<double> m, [ double fGauss, double fLorentz ])

Constructs a mixed Gauss-Lorentz shape defined by: a - amplitude, c - center, w - width, m - mixing factors (0 <= m <= 1).

If m=1 (pure Lorentzian) then w is the "Lorentzian width". If m=0 (pure Gaussian), then w is the "Gaussian sigma".

The dimension n of c,w,m must be the same (>0) and define the dimension of the shape. Otherwise an exception is thrown.

fGauss and fLorentz will take on default values if omitted. Different literature references are using different defaults. The factors used here ensure that w is the line width at half maximum height for L, G, and mixed mode.

Implementation

LorentzGauss.fromPars(this.a, this.c, this.w, this.m,
    [this.fGauss, this.fLorentz]) {
  if (fGauss == null) fGauss = FGAUSS;
  if (fLorentz == null) fLorentz = FLORENTZ;
  dim = c.length;
  if (dim != w.length || dim != m.length) {
    throw "List size error\n. Expected: $dim";
  }

  pars = List<double>(1 + c.length + w.length + m.length);
  pars[0] = a;
  for (int i = 0; i < dim; i++) {
    pars[i + 1] = c[i];
    pars[i + 1 + dim] = w[i];
    pars[i + 1 + dim + dim] = m[i];
  }
  shapeParameters = pars;
}