Commit d0f3ff06 authored by Andrey Filippov's avatar Andrey Filippov

changed parameters for automatic LMA run

parent 41015a35
......@@ -3018,15 +3018,15 @@ d_s2/d_x0= 2*delta_x*delta_y^2/r2^2
String msg="initial Jacobian matrix calculation. Points:"+this.dataValues.length+" Parameters:"+this.currentVector.length;
if (debugLevel>1) System.out.println(msg);
if (this.updateStatus) IJ.showStatus(msg);
System.out.println("*** 1 @ "+ IJ.d2s(0.000000001*(System.nanoTime()-this.startTime),5));
if (debugLevel>1) System.out.println("*** 1 @ "+ IJ.d2s(0.000000001*(System.nanoTime()-this.startTime),5));
this.currentfX=createFXandJacobian(this.currentVector, true); // is it always true here (this.jacobian==null)
System.out.println("*** 2 @ "+ IJ.d2s(0.000000001*(System.nanoTime()-this.startTime),5));
if (debugLevel>1) System.out.println("*** 2 @ "+ IJ.d2s(0.000000001*(System.nanoTime()-this.startTime),5));
this.lMAArrays=calculateJacobianArrays(this.currentfX);
System.out.println("*** 3 @ "+ IJ.d2s(0.000000001*(System.nanoTime()-this.startTime),5));
if (debugLevel>1) System.out.println("*** 3 @ "+ IJ.d2s(0.000000001*(System.nanoTime()-this.startTime),5));
this.currentRMS= calcErrorDiffY(this.currentfX,false);
System.out.println("*** 4 @ "+ IJ.d2s(0.000000001*(System.nanoTime()-this.startTime),5));
if (debugLevel>1) System.out.println("*** 4 @ "+ IJ.d2s(0.000000001*(System.nanoTime()-this.startTime),5));
this.currentRMSPure=calcErrorDiffY(this.currentfX, true);
System.out.println("*** 5 @ "+ IJ.d2s(0.000000001*(System.nanoTime()-this.startTime),5));
if (debugLevel>1) System.out.println("*** 5 @ "+ IJ.d2s(0.000000001*(System.nanoTime()-this.startTime),5));
msg=this.currentStrategyStep+": initial RMS="+IJ.d2s(this.currentRMS,8)+" (pure RMS="+IJ.d2s(this.currentRMSPure,8)+")"+
". Calculating next Jacobian. Points:"+this.dataValues.length+" Parameters:"+this.currentVector.length;
if (debugLevel>1) System.out.println(msg);
......@@ -3164,12 +3164,12 @@ public void stepLevenbergMarquardtAction(int debugLevel){//
*
*/
public boolean selectLMAParameters(boolean autoSel){
// int numSeries=fittingStrategy.getNumSeries();
// boolean resetCorrections=false;
// int numSeries=fittingStrategy.getNumSeries();
// boolean resetCorrections=false;
GenericDialog gd = new GenericDialog("Levenberg-Marquardt algorithm parameters lens aberrations approxiamtion");
//TODO: change to selection using series comments
// gd.addNumericField("Fitting series number", this.currentStrategyStep, 0, 3," (-1 - current)");
// gd.addNumericField("Fitting series number", this.currentStrategyStep, 0, 3," (-1 - current)");
int suggestStep=this.currentStrategyStep;
boolean suggestStopEachStep=this.stopEachStep;
if (autoSel){
......@@ -3189,7 +3189,7 @@ public boolean selectLMAParameters(boolean autoSel){
gd.addNumericField("Debug Jacobian for point number", this.debugPoint, 0, 5,"(-1 - none)");
gd.addNumericField("Debug Jacobian for parameter number", this.debugParameter, 0, 5,"(-1 - none)");
// gd.addCheckbox("Keep current correction parameters (do not reset)", this.keepCorrectionParameters);
// gd.addCheckbox("Keep current correction parameters (do not reset)", this.keepCorrectionParameters);
gd.addNumericField("Initial LMA Lambda ", 0.0, 5, 8, "0 - keep, last was "+this.lambda);
gd.addNumericField("Multiply lambda on success", this.lambdaStepDown, 5);
gd.addNumericField("Threshold RMS to exit LMA", this.thresholdFinish, 7,9,"pix");
......@@ -3223,7 +3223,7 @@ public boolean selectLMAParameters(boolean autoSel){
debugPoint= (int) gd.getNextNumber();
debugParameter= (int) gd.getNextNumber();
// this.keepCorrectionParameters = gd.getNextBoolean();
// this.keepCorrectionParameters = gd.getNextBoolean();
double preLambda=gd.getNextNumber();
if (preLambda>0.0) this.lambda= preLambda;
this.lambdaStepDown= gd.getNextNumber();
......@@ -3238,7 +3238,7 @@ public boolean selectLMAParameters(boolean autoSel){
this.showDisabledParams= gd.getNextBoolean();
this.showCorrectionParams= gd.getNextBoolean();
this.threadsMax= (int) gd.getNextNumber();
// if (!keepCorrectionParameters) fieldFitting.resetSampleCorr();
// if (!keepCorrectionParameters) fieldFitting.resetSampleCorr();
return true;
}
......@@ -4282,6 +4282,12 @@ public boolean LevenbergMarquardt(
double savedLambda=this.lambda;
this.debugLevel=debugLevel;
if (openDialog && !selectLMAParameters(autoSel)) return false;
if (!openDialog && autoSel) {
this.stopEachStep= false;
this.stopEachSeries= false;
this.currentStrategyStep=0;
}
this.startTime=System.nanoTime();
// create savedVector (it depends on parameter masks), restore from it if aborted
// fieldFitting.initSampleCorrVector(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment