Package gov.nih.mipav.model.algorithms
Class FitLorentz
java.lang.Object
gov.nih.mipav.model.algorithms.NLConstrainedEngine
gov.nih.mipav.model.algorithms.NLFittedFunction
gov.nih.mipav.model.algorithms.FitLorentz
FitLorentz -fits an array of points to a lorentz distribution, thresholding techniques come from ViewJFrameGraph,
no need to implement here
- Version:
- 1.0
- Author:
- senseneyj
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate doubleAmplitude parameterprivate intLocation in xSeries where Gaussian data endsprivate intLocation in xSeries where Gaussian data startsprivate doublehalf width at half maximumprivate intIterations performedprivate doubleStatistical medianFields inherited from class gov.nih.mipav.model.algorithms.NLFittedFunction
chisq, EPSILON, MAX_ITR, MIN_ITR, xSeries, yDataFitted, ySeriesFields inherited from class gov.nih.mipav.model.algorithms.NLConstrainedEngine
a, absoluteConvergence, analyticalJacobian, bl, bounds, bu, ctrlMat, dyda, gues, internalScaling, jacobian, maxIterations, nPts, outputMes, param, parameterConvergence, relativeConvergence, residuals, secondAllowed, stdv, tolerance -
Constructor Summary
ConstructorsConstructorDescriptionFitLorentz - test constructor, builds and test function.FitLorentz(int nPoints, double[] xData, double[] yData) FitLorentz.FitLorentz(int nPoints, float[] xData, float[] yData) Constructs new fit lorentz distribution. -
Method Summary
Modifier and TypeMethodDescriptionprivate double[]Apply small Gaussian kernel to smooth out data.protected voidCalculates chi squaredprotected voidCalculates yDataFittedvoidDisplay results of displaying lorentz fitting parameters.private doubledLdA(double x) Partial derivative of Lorentz distribution with respect to A.private doubledLdgamma(double x) Partial derivative of Lorentz distribution with respect to gamma.private doubledLdxMedian(double x) Partial derivative of Lorentz distribution with respect to xMedian.voiddriver()Starts the analysis.private voidvoidfitToFunction(double[] a, double[] residuals, double[][] covarMat) fitToFunction communicates with 3 protected variables param, nPts, and ctrlMat ctrlMat is used as a wrapper for ctrl or lctrl.protected Jama.MatrixJacobian used for non-linear least squares fitting.protected Jama.MatrixCalculates the residuals for a given function, not implemented since some functions might prefer to only use a subset of data points, or not use yDataFitted if working during an iterationprivate doublelorentz(double x) Lorentz distribution evaluated at a point with given parametersMethods inherited from class gov.nih.mipav.model.algorithms.NLFittedFunction
getChisq, getFittedY, getMedianMethods inherited from class gov.nih.mipav.model.algorithms.NLConstrainedEngine
dumpTestResults, fitToTestFunction, getChiSquared, getExitStatus, getIterations, getParameters, getResiduals, statusMessage
-
Field Details
-
dataStart
private int dataStartLocation in xSeries where Gaussian data starts -
dataEnd
private int dataEndLocation in xSeries where Gaussian data ends -
amp
private double ampAmplitude parameter -
xMedian
private double xMedianStatistical median -
gamma
private double gammahalf width at half maximum -
iters
private int itersIterations performed
-
-
Constructor Details
-
FitLorentz
public FitLorentz()FitLorentz - test constructor, builds and test function. -
FitLorentz
public FitLorentz(int nPoints, double[] xData, double[] yData) FitLorentz.- Parameters:
nPoints- number of points in the functionxData- values along x-axisyData- values along y-axis
-
FitLorentz
public FitLorentz(int nPoints, float[] xData, float[] yData) Constructs new fit lorentz distribution.- Parameters:
nPoints- Number of points in the functionxData- values along x-axisyData- values along y-axis
-
-
Method Details
-
applyKernel
private double[] applyKernel()Apply small Gaussian kernel to smooth out data. Note should not be called if doing data comparison. -
estimateInitial
private void estimateInitial() -
driver
public void driver()Starts the analysis.- Overrides:
driverin classNLConstrainedEngine
-
calculateChiSq
protected void calculateChiSq()Description copied from class:NLFittedFunctionCalculates chi squared- Specified by:
calculateChiSqin classNLFittedFunction
-
calculateFittedY
protected void calculateFittedY()Description copied from class:NLFittedFunctionCalculates yDataFitted- Specified by:
calculateFittedYin classNLFittedFunction
-
displayResults
public void displayResults()Display results of displaying lorentz fitting parameters.- Specified by:
displayResultsin classNLFittedFunction
-
fitToFunction
public void fitToFunction(double[] a, double[] residuals, double[][] covarMat) Description copied from class:NLConstrainedEnginefitToFunction communicates with 3 protected variables param, nPts, and ctrlMat ctrlMat is used as a wrapper for ctrl or lctrl. Evaluates the residuals or the Jacobian at a certain a[]- Specified by:
fitToFunctionin classNLConstrainedEngine- Parameters:
a- DOCUMENT ME!residuals- DOCUMENT ME!covarMat- DOCUMENT ME!
-
lorentz
private double lorentz(double x) Lorentz distribution evaluated at a point with given parameters -
dLdA
private double dLdA(double x) Partial derivative of Lorentz distribution with respect to A. -
dLdxMedian
private double dLdxMedian(double x) Partial derivative of Lorentz distribution with respect to xMedian. -
dLdgamma
private double dLdgamma(double x) Partial derivative of Lorentz distribution with respect to gamma. -
generateJacobian
protected Jama.Matrix generateJacobian()Jacobian used for non-linear least squares fitting. -
generateResiduals
protected Jama.Matrix generateResiduals()Description copied from class:NLFittedFunctionCalculates the residuals for a given function, not implemented since some functions might prefer to only use a subset of data points, or not use yDataFitted if working during an iteration- Specified by:
generateResidualsin classNLFittedFunction- Returns:
-