diff --git a/motorApp/AerotechSrc/EnsembleTrajectoryScan.st b/motorApp/AerotechSrc/EnsembleTrajectoryScan.st index f5e6fab5..cee3e9d0 100644 --- a/motorApp/AerotechSrc/EnsembleTrajectoryScan.st +++ b/motorApp/AerotechSrc/EnsembleTrajectoryScan.st @@ -1653,7 +1653,7 @@ abort: double eval_fStart(double fStart, double *motorReadbacks, double scopeDataInterval, int nScopeDataPoints, double *motorTrajectory, double *realTimeTrajectory, int npoints); -int parabola(double *x, double *y, int npts, double *xfit); +int parabola(double *x, double *y, int npts, double *xFit); static double trajEval(SS_ID ssId, struct UserVar *pVar, double *motorReadbacks, int scopeDataIntervalMS, int nScopeDataPoints, double *motorTrajectory, double *realTimeTrajectory, int npoints, double *motorError) { @@ -1677,11 +1677,10 @@ static double trajEval(SS_ID ssId, struct UserVar *pVar, double *motorReadbacks, } else { frac = 0.; } + fStart = 0.; + frac = 0.; if (rStart>0) { fStart = (rStart-1) + frac; - } else { - fStart = 0.; - frac = 0.; } if (pVar->debugLevel>5) printf("trajEval: rStart=%d, frac=%f, fStart=%f\n", rStart, frac, fStart); @@ -1690,7 +1689,7 @@ static double trajEval(SS_ID ssId, struct UserVar *pVar, double *motorReadbacks, nTry = 5; for (i=0; idebugLevel>5) printf("eval_fStart: iThis=%d, motorReadbacks[iThis]=%f\n", iThis, motorReadbacks[iThis]); + /* printf("eval_fStart: iThis=%d, motorReadbacks[iThis]=%f\n", iThis, motorReadbacks[iThis]);*/ p = fThis-iThis; if ((iThis > 0) && (iThis+2 < nScopeDataPoints)) { /* Lagrange 4-point interpolation */ @@ -1757,7 +1756,7 @@ double eval_fStart(double fStart, double *motorReadbacks, double scopeDataInterv /* linear interpolation */ interp = motorReadbacks[iThis] + (motorReadbacks[iThis+1] - motorReadbacks[iThis])*p; } - if (pVar->debugLevel>5) printf("eval_fStart: fThis=%f, interp=%f, motorTrajectory[%d]=%f, \n", fThis, interp, i, motorTrajectory[i]); + /* printf("eval_fStart: fThis=%f, interp=%f, motorTrajectory[%d]=%f, \n", fThis, interp, i, motorTrajectory[i]);*/ chisq += (interp - motorTrajectory[i]) * (interp - motorTrajectory[i]); numChi++; } @@ -1766,7 +1765,8 @@ double eval_fStart(double fStart, double *motorReadbacks, double scopeDataInterv } #define SMALL 1e-8 -int parabola(double *x, double *y, int npts, double *xfit) { +#define LARGE 1e10 +int parabola(double *x, double *y, int npts, double *xFit) { double xf, yf; double xx, yy, xi, xi2, xi3, xi4, yi, yixi, yixi2;