Login  Register

custom curve fit side effect?

Posted by Chuck Harrison-2 on May 30, 2010; 1:37am
URL: http://imagej.273.s1.nabble.com/custom-curve-fit-side-effect-tp3688135.html

Hi all,

I have a problem with macros becoming uninterruptible after doing a curve fit.

Any ideas?

Chuck

---- begin included text ----

// Unexpected behavior with custom curve fit (observed in v1.44a)
// After executing a custom fit, the macro interpreter no longer responds to ESC

  x=newArray (1, 2, 3);
  y=newArray (2, 4, 6);

  // User-defined fit
  lineEquation = "y = a + b*x";
  initialGuesses = newArray(1, 1);

  print("standard fit");
  Fit.doFit("Straight Line", x, y);
  Fit.plot();

  print("you CAN interrupt me with ESC here");
  for(i=0;i<5;i++) {
    wait(1000);
    print(i);
  }

  print("custom fit");
  Fit.doFit(lineEquation, x, y, initialGuesses);
  Fit.plot();

  print("you CAN'T interrupt me with ESC here");
  for(i=0;i<5;i++) {
    wait(1000);
    print(i);
  }

  print("finished.");

---- end included text ----