Package xal.extension.fit.lsm
Class Gaussian
java.lang.Object
xal.extension.fit.lsm.Gaussian
This class is for data fitting with Gaussian function. The Gaussian function
form used in this class is y = pedestal+amp*exp(-(x-center)^2/(sigma^2/2.)).
- Author:
- shishlo
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddData(double x, double y) Adds a data point to the internal datavoidaddData(double x, double y, double yErr) Adds a data point to the internal datavoidclear()Removes all internal databooleanfit()perform one step of the data fitbooleanfit(int iteration) perform the data fitbooleanfitParameter(String key) Returns the boolean variable about including variable into the fittingvoidfitParameter(String key, boolean incl) Includes or excludes the parameter into fittingdoublegetParameter(String key) Returns the parameter valuedoublegetParameterError(String key) Returns the parameter value errordoublegetValue(double x) Returns the value of Gaussian functionbooleanFinds the parameters of Gaussian with initial values defined from raw databooleanguessAndFit(int iteration) Perform the several iterations of the data fit with guessing the initial values of parametersstatic voidMAIN for debuggingvoidsetData(double[] xArr, double[] yArr) Sets the data attribute of the Gaussian objectvoidsetData(double[] xArr, double[] yArr, double[] yErrArr) Sets the data attribute of the Gaussian objectvoidsetParameter(String key, double val) Sets the parameter value
-
Field Details
-
SIGMA_STR
The "sigma" parameter- See Also:
-
AMP_STR
The "amplitude" parameter- See Also:
-
CENTER_STR
The "center" parameter- See Also:
-
PEDESTAL_STR
The "pedestal" parameter- See Also:
-
-
Constructor Details
-
Gaussian
public Gaussian()Creates a new instance of Gaussian
-
-
Method Details
-
getParameter
Returns the parameter value- Parameters:
key- The parameter name- Returns:
- The parameter value
-
getParameterError
Returns the parameter value error- Parameters:
key- The parameter name- Returns:
- The parameter value error
-
fitParameter
Includes or excludes the parameter into fitting- Parameters:
key- The parameter nameincl- The boolean variable about including variable into the fitting
-
fitParameter
Returns the boolean variable about including variable into the fitting- Parameters:
key- The parameter name
-
setParameter
Sets the parameter value- Parameters:
key- The parameter nameval- The new parameter value
-
setData
public void setData(double[] xArr, double[] yArr, double[] yErrArr) Sets the data attribute of the Gaussian object- Parameters:
yArr- Y data arrayyErrArr- Y values error arrayxArr- The new data value
-
setData
public void setData(double[] xArr, double[] yArr) Sets the data attribute of the Gaussian object- Parameters:
yArr- Y data arrayxArr- The new data value
-
clear
public void clear()Removes all internal data -
addData
public void addData(double x, double y) Adds a data point to the internal data- Parameters:
x- The x valuey- The y value
-
addData
public void addData(double x, double y, double yErr) Adds a data point to the internal data- Parameters:
x- The x valuey- The y valuyErr- The error of the y value
-
fit
public boolean fit(int iteration) perform the data fit- Parameters:
iteration- The number of iterations- Returns:
- Success or not
-
fit
public boolean fit()perform one step of the data fit- Returns:
- Success or not
-
guessAndFit
public boolean guessAndFit(int iteration) Perform the several iterations of the data fit with guessing the initial values of parameters- Parameters:
iteration- The number of iterations- Returns:
- Success or not
-
guessAndFit
public boolean guessAndFit()Finds the parameters of Gaussian with initial values defined from raw data- Returns:
- The true is the initial parameters have been defined successfully
-
getValue
public double getValue(double x) Returns the value of Gaussian function- Parameters:
x- The x-value- Returns:
- The Gauss function value
-
main
MAIN for debugging- Parameters:
args- The array of strings as parameters
-