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 TypeMethodDescriptionvoid
addData
(double x, double y) Adds a data point to the internal datavoid
addData
(double x, double y, double yErr) Adds a data point to the internal datavoid
clear()
Removes all internal databoolean
fit()
perform one step of the data fitboolean
fit
(int iteration) perform the data fitboolean
fitParameter
(String key) Returns the boolean variable about including variable into the fittingvoid
fitParameter
(String key, boolean incl) Includes or excludes the parameter into fittingdouble
getParameter
(String key) Returns the parameter valuedouble
getParameterError
(String key) Returns the parameter value errordouble
getValue
(double x) Returns the value of Gaussian functionboolean
Finds the parameters of Gaussian with initial values defined from raw databoolean
guessAndFit
(int iteration) Perform the several iterations of the data fit with guessing the initial values of parametersstatic void
MAIN for debuggingvoid
setData
(double[] xArr, double[] yArr) Sets the data attribute of the Gaussian objectvoid
setData
(double[] xArr, double[] yArr, double[] yErrArr) Sets the data attribute of the Gaussian objectvoid
setParameter
(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
-