Package com.nr.model

Examples of com.nr.model.Fitlin


        fail("*** Fitsvd: Fitted parameters not within estimated uncertainty");
       
      }
    }

    Fitlin mylinfit = new Fitlin(x,y,sig,this);
    mylinfit.fit();
    sbeps=TOL;
    for (j=0;j<ma;j++) {
//      System.out.printf(mysvdfit.a[j] << " %f\n", mylinfit.a[j] << " ";
//      System.out.printf(sqrt(mysvdfit.covar[j][j]) << " %f\n", sqrt(mylinfit.covar[j][j]));
      localflag = abs(mysvdfit.a[j]-mylinfit.a[j]) > sbeps;
View Full Code Here


      for (j=0;j<ma;j++) y[i] += amp[j]*f[j];
      y[i] += ndev.dev();
      sig[i]=stdev;
    }

    Fitlin myfit = new Fitlin(x,y,sig,this);
    myfit.fit();

    for (j=0;j<ma;j++) {
      localflag = abs(myfit.a[j]-amp[j]) > 2.0*sqrt(myfit.covar[j][j]);
      globalflag = globalflag || localflag;
      if (localflag) {
        fail("*** Fitlin: Fitted parameters not within estimated uncertainty");
       
      }
    }

//    System.out.printf(fixed << setprecision(6);
//    for (i=0;i<ma;i++) {
//      System.out.printf(setw(8) << myfit.a[i];
//      System.out.printf(setw(13) << sqrt(myfit.covar[i][i]));
//    }
//    System.out.printf(scientific << setprecision(4);
//    for (i=0;i<ma;i++) {
//      for (j=0;j<ma;j++) System.out.printf(setw(15) << myfit.covar[i][j];
//      System.out.printf(endl;
//    }
//    System.out.printf(endl;

    // Now check results of restricting fit parameters 1 and 3
    myfit.hold(1,amp[1]);
    myfit.hold(3,amp[3]);
    myfit.fit();

    localflag = (myfit.a[1] != amp[1]);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Fitlin: A held parameter does not have its assigned value");
     
    }

    localflag = (myfit.a[3] != amp[3]);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Fitlin: A held parameter does not have its assigned value");
     
    }

    localflag = (myfit.covar[1][1] != 0.0);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Fitlin: A held parameter does not have uncertainty=0.0");
     
    }

    localflag = (myfit.covar[3][3] != 0.0);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Fitlin: A held parameter does not have uncertainty=0.0");
     
    }

    for (j=0;j<ma;j++) {
      localflag = abs(myfit.a[j]-amp[j]) > 2.0*sqrt(myfit.covar[j][j]);
      globalflag = globalflag || localflag;
      if (localflag) {
        fail("*** Fitlin: Fitted parameters (with 2 parameters held) not within estimated uncertainty");
       
      }
    }

    localflag=false;
    for (i=0;i<ma;i++) {
      for (j=0;j<ma;j++) {
        if (i==1 || i==3 || j==1 || j==3)
          localflag = localflag || myfit.covar[i][j] != 0.0;
        else
          localflag = localflag || myfit.covar[i][j] == 0.0;
      }
    }
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Fitlin: Covariance matrix with 2 held parameters has incorrect pattern");
     
    }

//    System.out.printf(fixed << setprecision(6);
//    for (i=0;i<ma;i++) {
//      System.out.printf(setw(8) << myfit.a[i];
//      System.out.printf(setw(13) << sqrt(myfit.covar[i][i]));
//    }
//    System.out.printf(scientific << setprecision(4);
//    for (i=0;i<ma;i++) {
//      for (j=0;j<ma;j++) System.out.printf(setw(15) << myfit.covar[i][j];
//      System.out.printf(endl;
//    }
//    System.out.printf(endl;

    // Now free one of the fixed parameters
    myfit.free(1);
    myfit.fit();

    localflag = (myfit.a[1] == amp[1]);
    globalflag = globalflag || localflag;
    if (localflag) {
      fail("*** Fitlin: A free parameter still has its assigned value");
View Full Code Here

TOP

Related Classes of com.nr.model.Fitlin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.