package sansmodels; public class PeakGauss extends SANSModel{ private double scale, peak, width, background; //Default constructor public PeakGauss() { scale = 100.0; peak = 0.05; width = 0.005; background = 0.0; setNumberOfParameters(4); String[] parameters = {"Scale", "Peak Position (A-1)", "Std Dev (A-1)","Background (cm-1)"}; setParametersText(parameters); } public PeakGauss(double inScale, double inPeak, double inWidth, double inBackground) { scale = inScale; peak = inPeak; width = inWidth; background = inBackground; setNumberOfParameters(4); String[] parameters = {"Scale", "Peak Position (A-1)", "Peak HWHM (A-1)","Background (cm-1)"}; setParametersText(parameters); } public double getFormFactor(double inX) { return scale*Math.exp(-0.5*(inX-peak)*(inX-peak)/width/width) *getStructureFactor().calculate(inX) + background; } public void setParameters(double[] inParameters) { scale = inParameters[0]; peak = inParameters[1]; width = inParameters[1]; background = inParameters[3]; } public double[] getParameters() { double[] outParameters = new double[4]; outParameters[0] = scale; outParameters[1] = peak; outParameters[2] = width; outParameters[3] = background; return outParameters; } }