smart_lorentz_gauss 2.0.6 copy "smart_lorentz_gauss: ^2.0.6" to clipboard
smart_lorentz_gauss: ^2.0.6 copied to clipboard

outdated

Provides functionalities to compute mixed Lorentz-Gauss line shapes, also called n-dimensional Pseudo-Voigt function.

example/example.dart

// Copyright (c) 2019, Dr. Bruno Guigas. All rights reserved. Use of this source
// code is governed by a BSD-style license that can be found in the LICENSE file.
import 'package:smart_lorentz_gauss/smart_lorentz_gauss.dart';
import 'dart:typed_data';

/// Creates an array containing a mixed Lorentz-Gauss line shape.
main() {
  final int NPOINTS = 100; // array length
  double height = 100; // value of line shape maximum
  double center = 40; // the maximum should be at this position
  double width = 10; // width of shape at half height of maximum
  Float64List array = Float64List(NPOINTS); // create array

  // construct a line shape with 80% Lorentzian and 20% Gaussian fractions
  LorentzGauss lg = new LorentzGauss.fromPars(height, [center], [width], [0.2]);

  // fill array with line shape values
  for (int k = 0; k < NPOINTS; k++) {
    array[k] = lg.getValueAt([k.toDouble()]);
  }

  // print result: you may paste the result to a MS Excel, OpenOffice Calc or so
  // to view the shape as a curve.
  for (int k = 0; k < NPOINTS; k++) {
    print("$k ${array[k].toStringAsFixed(2)}");
  }
}
0
likes
0
pub points
4%
popularity

Publisher

verified publisherhiveright.tech

Provides functionalities to compute mixed Lorentz-Gauss line shapes, also called n-dimensional Pseudo-Voigt function.

Homepage

License

unknown (LICENSE)

Dependencies

build_runner, build_web_compilers, pedantic

More

Packages that depend on smart_lorentz_gauss