Package cnuphys.splot.fit
Class Fit
java.lang.Object
cnuphys.splot.fit.Fit
General Fit container class. It holds all the information for a fit, but the
actual fit is performed by the object held in the
_fit
instance
variable, which is a numerical recipes fit object.- Author:
- heddle
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionFit()
Fit
(double[] x, double[] y, double[] sigmaY) Fit
(double[] x, double[] y, double[] sigmaY, double tolerance) Create a fit which is someone poorly named.Fit
(double[] x, double[] y, double[] sigmaX, double[] sigmaY, double tolerance) Create a fit which is someone poorly named. -
Method Summary
Modifier and TypeMethodDescriptionGet the error type that was used in the fittinggetFit()
Returns the fit object, which is most likely a numerical recipes fitgetFitString
(DataColumn curve) Get a report on the fit parameters in htmlGet the fit typegetHolds()
Get the fit parameter holdsint
Get the number of gaussiansint
Get the polynomial order, the polynomial order--the power of the highest powerdouble[]
Get the x error data for the fitdouble[]
Get the y error data for the fitdouble
Get the tolerancedouble[]
getX()
Get the x data for the fitdouble[]
getY()
Get the y data for the fitvoid
hold
(int index, double val) Set a hold on a fit parameter.boolean
isDirty()
Check whether fit needs to be recomputedboolean
isHeld
(int index) Check whether a parameter was heldstatic void
void
setDirty()
Set the fit to be dirty.protected void
setErrorType
(Fit.ErrorType errorType) Set the error type used by the fitting.void
Set the fitvoid
setFitType
(FitType type) Set the fit typevoid
setNumGaussian
(int numGauss) Set the number of gaussiansvoid
setPolynomialOrder
(int order) Get the polynomial order--the power of the highest powervoid
setSigmaX
(double[] sigma) Set the x error data for the fitvoid
setSigmaY
(double[] sigma) Set the y error data for the fitvoid
setTolerance
(double tolerance) Set the tolerancevoid
setX
(double[] x) Set the x data for the fitvoid
setY
(double[] y) Set the y data for the fitint
size()
The x and y data arrays should be the same size.
-
Constructor Details
-
Fit
public Fit() -
Fit
public Fit(double[] x, double[] y, double[] sigmaY) -
Fit
public Fit(double[] x, double[] y, double[] sigmaY, double tolerance) Create a fit which is someone poorly named. It is really just a container that holds all the data for a fit. It will be used in the constructor of an actual fit.- Parameters:
x
- the x datay
- the y datasigmaY
- the y errorstolerance
- accuracy parameter (for nonlinear fits)
-
Fit
public Fit(double[] x, double[] y, double[] sigmaX, double[] sigmaY, double tolerance) Create a fit which is someone poorly named. It is really just a container that holds all the data for a fit. It will be used in the constructor of an actual fit.- Parameters:
x
- the x datay
- the y datasigmaX
- the x errorssigmaY
- the y errorstolerance
- accuracy parameter (for nonlinear fits)
-
-
Method Details
-
size
public int size()The x and y data arrays should be the same size. This returns the smaller of the two sizes.- Returns:
- the minimum size of the data arrays
-
hold
public void hold(int index, double val) Set a hold on a fit parameter. If there already is one it will be overwritten using the new value.- Parameters:
index
- the index of the parameterval
- the value at which the parameter is held.
-
getHolds
Get the fit parameter holds- Returns:
- the fit parameter holds
-
isHeld
public boolean isHeld(int index) Check whether a parameter was held- Parameters:
index
- the index of the parameter- Returns:
true
if the index was held
-
getX
public double[] getX()Get the x data for the fit- Returns:
- the x data for the fit
-
getY
public double[] getY()Get the y data for the fit- Returns:
- the y data for the fit
-
getSigmaY
public double[] getSigmaY()Get the y error data for the fit- Returns:
- the y error data for the fit
-
getSigmaX
public double[] getSigmaX()Get the x error data for the fit- Returns:
- the x error data for the fit
-
setX
public void setX(double[] x) Set the x data for the fit- Parameters:
x
- the x data
-
setY
public void setY(double[] y) Set the y data for the fit- Parameters:
y
- the y data
-
setSigmaY
public void setSigmaY(double[] sigma) Set the y error data for the fit- Parameters:
sigma
- the y error data
-
setSigmaX
public void setSigmaX(double[] sigma) Set the x error data for the fit- Parameters:
sigma
- the x error data
-
setErrorType
Set the error type used by the fitting. The client does no set this, the methods that call the fits in FitUtilities set this. If the type is "Massaged zeroes" it meant that error of zero were given fake fakes (equal to the mean error) to prevent the fits from failing.- Parameters:
errorType
- the way the errors were used.
-
getErrorType
Get the error type that was used in the fitting- Returns:
- the error type that was used in the fitting
-
setPolynomialOrder
public void setPolynomialOrder(int order) Get the polynomial order--the power of the highest power- Parameters:
order
- the polynomial order--the power of the highest power
-
getPolynomialOrder
public int getPolynomialOrder()Get the polynomial order, the polynomial order--the power of the highest power- Returns:
- the polynomial order
-
getNumGaussian
public int getNumGaussian()Get the number of gaussians- Returns:
- the number of gaussians
-
setNumGaussian
public void setNumGaussian(int numGauss) Set the number of gaussians- Parameters:
numGauss
- the new number of gaussians
-
setTolerance
public void setTolerance(double tolerance) Set the tolerance- Parameters:
tolerance
- the value of the tolerance
-
getTolerance
public double getTolerance()Get the tolerance- Returns:
- the tolerance
-
getFit
Returns the fit object, which is most likely a numerical recipes fit- Returns:
- the fit object.
-
setFit
Set the fit- Parameters:
fit
- the new fit object, which is most likely a numerical recipes fit
-
setDirty
public void setDirty()Set the fit to be dirty. Perhaps more data have been added -
isDirty
public boolean isDirty()Check whether fit needs to be recomputed- Returns:
true
if fit must be recomputed
-
getFitType
Get the fit type- Returns:
- the fit type
-
setFitType
Set the fit type- Parameters:
type
- the fit type
-
getFitString
Get a report on the fit parameters in html- Parameters:
curve
- the active curve- Returns:
- the html fit string description
-
main
-