Class Fit

java.lang.Object
cnuphys.splot.fit.Fit

public class Fit extends Object
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 Link icon

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static enum 
     
  • Constructor Summary Link icon

    Constructors
    Constructor
    Description
    Fit()
     
    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 Link icon

    Modifier and Type
    Method
    Description
    Get the error type that was used in the fitting
    Returns the fit object, which is most likely a numerical recipes fit
    Get a report on the fit parameters in html
    Get the fit type
    protected Vector<FitHold>
    Get the fit parameter holds
    int
    Get the number of gaussians
    int
    Get the polynomial order, the polynomial order--the power of the highest power
    double[]
    Get the x error data for the fit
    double[]
    Get the y error data for the fit
    double
    Get the tolerance
    double[]
    Get the x data for the fit
    double[]
    Get the y data for the fit
    void
    hold(int index, double val)
    Set a hold on a fit parameter.
    boolean
    Check whether fit needs to be recomputed
    boolean
    isHeld(int index)
    Check whether a parameter was held
    static void
    main(String[] arg)
     
    void
    Set the fit to be dirty.
    protected void
    Set the error type used by the fitting.
    void
    Set the fit
    void
    Set the fit type
    void
    setNumGaussian(int numGauss)
    Set the number of gaussians
    void
    setPolynomialOrder(int order)
    Get the polynomial order--the power of the highest power
    void
    setSigmaX(double[] sigma)
    Set the x error data for the fit
    void
    setSigmaY(double[] sigma)
    Set the y error data for the fit
    void
    setTolerance(double tolerance)
    Set the tolerance
    void
    setX(double[] x)
    Set the x data for the fit
    void
    setY(double[] y)
    Set the y data for the fit
    int
    The x and y data arrays should be the same size.

    Methods inherited from class java.lang.Object Link icon

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details Link icon

    • Fit Link icon

      public Fit()
    • Fit Link icon

      public Fit(double[] x, double[] y, double[] sigmaY)
    • Fit Link icon

      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 data
      y - the y data
      sigmaY - the y errors
      tolerance - accuracy parameter (for nonlinear fits)
    • Fit Link icon

      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 data
      y - the y data
      sigmaX - the x errors
      sigmaY - the y errors
      tolerance - accuracy parameter (for nonlinear fits)
  • Method Details Link icon

    • size Link icon

      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 Link icon

      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 parameter
      val - the value at which the parameter is held.
    • getHolds Link icon

      protected Vector<FitHold> getHolds()
      Get the fit parameter holds
      Returns:
      the fit parameter holds
    • isHeld Link icon

      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 Link icon

      public double[] getX()
      Get the x data for the fit
      Returns:
      the x data for the fit
    • getY Link icon

      public double[] getY()
      Get the y data for the fit
      Returns:
      the y data for the fit
    • getSigmaY Link icon

      public double[] getSigmaY()
      Get the y error data for the fit
      Returns:
      the y error data for the fit
    • getSigmaX Link icon

      public double[] getSigmaX()
      Get the x error data for the fit
      Returns:
      the x error data for the fit
    • setX Link icon

      public void setX(double[] x)
      Set the x data for the fit
      Parameters:
      x - the x data
    • setY Link icon

      public void setY(double[] y)
      Set the y data for the fit
      Parameters:
      y - the y data
    • setSigmaY Link icon

      public void setSigmaY(double[] sigma)
      Set the y error data for the fit
      Parameters:
      sigma - the y error data
    • setSigmaX Link icon

      public void setSigmaX(double[] sigma)
      Set the x error data for the fit
      Parameters:
      sigma - the x error data
    • setErrorType Link icon

      protected void setErrorType(Fit.ErrorType errorType)
      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 Link icon

      public Fit.ErrorType getErrorType()
      Get the error type that was used in the fitting
      Returns:
      the error type that was used in the fitting
    • setPolynomialOrder Link icon

      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 Link icon

      public int getPolynomialOrder()
      Get the polynomial order, the polynomial order--the power of the highest power
      Returns:
      the polynomial order
    • getNumGaussian Link icon

      public int getNumGaussian()
      Get the number of gaussians
      Returns:
      the number of gaussians
    • setNumGaussian Link icon

      public void setNumGaussian(int numGauss)
      Set the number of gaussians
      Parameters:
      numGauss - the new number of gaussians
    • setTolerance Link icon

      public void setTolerance(double tolerance)
      Set the tolerance
      Parameters:
      tolerance - the value of the tolerance
    • getTolerance Link icon

      public double getTolerance()
      Get the tolerance
      Returns:
      the tolerance
    • getFit Link icon

      public Object getFit()
      Returns the fit object, which is most likely a numerical recipes fit
      Returns:
      the fit object.
    • setFit Link icon

      public void setFit(Object fit)
      Set the fit
      Parameters:
      fit - the new fit object, which is most likely a numerical recipes fit
    • setDirty Link icon

      public void setDirty()
      Set the fit to be dirty. Perhaps more data have been added
    • isDirty Link icon

      public boolean isDirty()
      Check whether fit needs to be recomputed
      Returns:
      true if fit must be recomputed
    • getFitType Link icon

      public FitType getFitType()
      Get the fit type
      Returns:
      the fit type
    • setFitType Link icon

      public void setFitType(FitType type)
      Set the fit type
      Parameters:
      type - the fit type
    • getFitString Link icon

      public String getFitString(DataColumn curve)
      Get a report on the fit parameters in html
      Parameters:
      curve - the active curve
      Returns:
      the html fit string description
    • main Link icon

      public static void main(String[] arg)