Commit ce4d91d4 authored by Andrey Filippov's avatar Andrey Filippov

fixed nastgy bug

parent 71aa98de
...@@ -260,7 +260,7 @@ Panel panel1,panel2; ...@@ -260,7 +260,7 @@ Panel panel1,panel2;
public static int INVERSE_DIRECT_SIZE= 32; // size (side of square) of direct PSF kernel public static int INVERSE_DIRECT_SIZE= 32; // size (side of square) of direct PSF kernel
public static int INVERSE_REVERSE_SIZE= 64; // size (side of square) of reverse PSF kernel public static int INVERSE_REVERSE_SIZE= 64; // size (side of square) of reverse PSF kernel
public static boolean INVERSE_FILTER= true; // apply variable-sigma filetering to the inverted PSF public static boolean INVERSE_FILTER= true; // apply variable-sigma filtering to the inverted PSF
public static int SPLIT_OVERSAMPLE= 2; public static int SPLIT_OVERSAMPLE= 2;
......
...@@ -2358,7 +2358,26 @@ B = |+dy0 -dy1 -2*dy3 | ...@@ -2358,7 +2358,26 @@ B = |+dy0 -dy1 -2*dy3 |
} }
} }
double [] getJtJTrace( // just debugging
double [][] jt,
double [] w)
{
double [] jtj_trace = new double [jt.length];
if (w == null){
w = new double[jt[0].length];
for (int i = 0; i < w.length; i++){
w[i] = 1.0/w.length;
}
}
for (int i = 0; i < jt.length; i++){
for (int k = 0; k < jt[i].length; k++){
jtj_trace[i] += w[k] * jt[i][k]*jt[i][k];
}
}
return jtj_trace;
}
double [][] getJTJ( double [][] getJTJ(
double [][] jt, double [][] jt,
...@@ -2426,6 +2445,12 @@ B = |+dy0 -dy1 -2*dy3 | ...@@ -2426,6 +2445,12 @@ B = |+dy0 -dy1 -2*dy3 |
Mismatch mm = mismatch_list.get(indx); Mismatch mm = mismatch_list.get(indx);
mm.copyToW(w, indx); mm.copyToW(w, indx);
} }
double sumw = 0.0;
for (int i = 0; i < w.length; i++) sumw += w[i];
if (sumw > 0.0){
for (int i = 0; i < w.length; i++) w[i]/=sumw;
}
return w; return w;
} }
...@@ -2458,7 +2483,7 @@ B = |+dy0 -dy1 -2*dy3 | ...@@ -2458,7 +2483,7 @@ B = |+dy0 -dy1 -2*dy3 |
corr_vector, // GeometryCorrection.CorrVector corr_vector) corr_vector, // GeometryCorrection.CorrVector corr_vector)
debugLevel); // int debugLevel) debugLevel); // int debugLevel)
// convert Jacobian outputs to symmetrical measurement vectors (last one is non-zero only if disaprity should be adjusted) // convert Jacobian outputs to symmetrical measurement vectors (last one is non-zero only if disparity should be adjusted)
double [][] jta_mv = (new Mismatch()).convertJt_mv (jta); //double [][] jt) double [][] jta_mv = (new Mismatch()).convertJt_mv (jta); //double [][] jt)
...@@ -2478,8 +2503,13 @@ B = |+dy0 -dy1 -2*dy3 | ...@@ -2478,8 +2503,13 @@ B = |+dy0 -dy1 -2*dy3 |
System.out.println("--- solveCorr(): initial RMS = " + rms0); System.out.println("--- solveCorr(): initial RMS = " + rms0);
} }
Matrix y_minus_fx_weighted = new Matrix(y_minus_fx_a_weighted, y_minus_fx_a_weighted.length); Matrix y_minus_fx_weighted = new Matrix(y_minus_fx_a_weighted, y_minus_fx_a_weighted.length);
double [][] jtja = getJTJ(jta, weights); // double [][] jtja = getJTJ(jta, weights);
double [][] jtja = getJTJ(jta_mv, weights);
Matrix jtj = new Matrix(jtja); // getJTJ(jta, weights)); // less operations than jt.times(jt.transpose()); Matrix jtj = new Matrix(jtja); // getJTJ(jta, weights)); // less operations than jt.times(jt.transpose());
// double [] jt_trace_null_dbg = getJtJTrace(jta,null);
// double [] jt_trace_dbg = getJtJTrace(jta,weights);
// double [] jt_mv_trace_null_dbg = getJtJTrace(jta_mv,null);
// double [] jt_mv_trace_dbg = getJtJTrace(jta_mv,weights);
// //
boolean dbg_images = debugLevel>1; boolean dbg_images = debugLevel>1;
int dbg_decimate = 64; // just for the debug image int dbg_decimate = 64; // just for the debug image
......
...@@ -3913,7 +3913,7 @@ public class EyesisCorrectionParameters { ...@@ -3913,7 +3913,7 @@ public class EyesisCorrectionParameters {
gd.addCheckbox ("Allow expansion over previously identified background (infinity)", this.ex_over_bgnd); gd.addCheckbox ("Allow expansion over previously identified background (infinity)", this.ex_over_bgnd);
gd.addNumericField("When expanding over background, disregard lower disparity ", this.ex_min_over, 3); gd.addNumericField("When expanding over background, disregard lower disparity ", this.ex_min_over, 3);
gd.addMessage ("********* Plates filetering when building initial z-map *********"); gd.addMessage ("********* Plates filtering when building initial z-map *********");
gd.addNumericField("If strength exceeds ex_strength * super_trust, do not apply ex_nstrength and plate_ds", this.pt_super_trust, 3); gd.addNumericField("If strength exceeds ex_strength * super_trust, do not apply ex_nstrength and plate_ds", this.pt_super_trust, 3);
gd.addCheckbox ("Do not replace raw tiles by the plates, if raw is closer (like poles)", this.pt_keep_raw_fg); gd.addCheckbox ("Do not replace raw tiles by the plates, if raw is closer (like poles)", this.pt_keep_raw_fg);
gd.addNumericField("Scale plates strength before comparing to raw strength", this.pt_scale_pre, 3); gd.addNumericField("Scale plates strength before comparing to raw strength", this.pt_scale_pre, 3);
......
...@@ -267,7 +267,7 @@ Panel panel1,panel2; ...@@ -267,7 +267,7 @@ Panel panel1,panel2;
public static int INVERSE_DIRECT_SIZE= 32; // size (side of square) of direct PSF kernel public static int INVERSE_DIRECT_SIZE= 32; // size (side of square) of direct PSF kernel
public static int INVERSE_REVERSE_SIZE= 64; // size (side of square) of reverse PSF kernel public static int INVERSE_REVERSE_SIZE= 64; // size (side of square) of reverse PSF kernel
public static boolean INVERSE_FILTER= true; // apply variable-sigma filetering to the inverted PSF public static boolean INVERSE_FILTER= true; // apply variable-sigma filtering to the inverted PSF
public static int SPLIT_OVERSAMPLE= 2; public static int SPLIT_OVERSAMPLE= 2;
......
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