Commit 7a4f9f53 authored by Andrey Filippov's avatar Andrey Filippov

enforcing phase 1 long exposure for slow targets

parent 643c20b0
...@@ -1031,7 +1031,7 @@ public class CuasMotion { ...@@ -1031,7 +1031,7 @@ public class CuasMotion {
if (npar >= 0 && npar < multi_targets[nseq][ntile][ntarg].length) { if (npar >= 0 && npar < multi_targets[nseq][ntile][ntarg].length) {
double val = multi_targets[nseq][ntile][ntarg][npar]; double val = multi_targets[nseq][ntile][ntarg][npar];
targObj.put(CuasMotionLMA.LMA_TITLES[npar], val); // By Claude on 05/08/2026 targObj.put(CuasMotionLMA.LMA_TITLES[npar], val); // By Claude on 05/08/2026
if (!Double.isNaN(val)) { if (!Double.isNaN(val) && !Double.isInfinite(val)) {
if (!(val >= minMax[pi][0])) minMax[pi][0] = val; if (!(val >= minMax[pi][0])) minMax[pi][0] = val;
if (!(val <= minMax[pi][1])) minMax[pi][1] = val; if (!(val <= minMax[pi][1])) minMax[pi][1] = val;
} }
...@@ -1290,7 +1290,8 @@ public class CuasMotion { ...@@ -1290,7 +1290,8 @@ public class CuasMotion {
// //
default: default:
System.out.print(String.format("%"+fw+"f",multi_targets[nseq][ntile][ntarg][npar])); System.out.print(String.format("%"+fw+"f",multi_targets[nseq][ntile][ntarg][npar]));
if (!Double.isNaN(multi_targets[nseq][ntile][ntarg][npar])) { if (!Double.isNaN(multi_targets[nseq][ntile][ntarg][npar]) &&
!Double.isInfinite(multi_targets[nseq][ntile][ntarg][npar])) {
if (!(multi_targets[nseq][ntile][ntarg][npar] >= min_max[0])) { if (!(multi_targets[nseq][ntile][ntarg][npar] >= min_max[0])) {
min_max[0] = multi_targets[nseq][ntile][ntarg][npar]; min_max[0] = multi_targets[nseq][ntile][ntarg][npar];
} }
...@@ -6711,6 +6712,7 @@ public class CuasMotion { ...@@ -6711,6 +6712,7 @@ public class CuasMotion {
* @param target_multi target data to be modified [nseq][ntile][ntarget][nparam] * @param target_multi target data to be modified [nseq][ntile][ntarget][nparam]
* @param niter current iteration number, will be applied to [RSLT_WHEN] * @param niter current iteration number, will be applied to [RSLT_WHEN]
* @param min_mscore minimal value for [RSLT_MSCORE] * @param min_mscore minimal value for [RSLT_MSCORE]
* @param early_boosts enforce boosted exposure for boosted motion
* @param min_vstr minimal value for [RSLT_VSTR] * @param min_vstr minimal value for [RSLT_VSTR]
* @param min_score minimal value for [RSLT_QSCORE] * @param min_score minimal value for [RSLT_QSCORE]
* @param min_amp minimal value for [RSLT_A] * @param min_amp minimal value for [RSLT_A]
...@@ -6719,6 +6721,7 @@ public class CuasMotion { ...@@ -6719,6 +6721,7 @@ public class CuasMotion {
public static int [] earlyFail( // Fail after Phase 1 public static int [] earlyFail( // Fail after Phase 1
final double [][][][] target_multi, final double [][][][] target_multi,
final int niter, final int niter,
final boolean early_boosts,
final double min_mscore, final double min_mscore,
final double min_vstr, final double min_vstr,
final double min_score, final double min_score,
...@@ -6728,6 +6731,7 @@ public class CuasMotion { ...@@ -6728,6 +6731,7 @@ public class CuasMotion {
final Thread[] threads = ImageDtt.newThreadArray(); final Thread[] threads = ImageDtt.newThreadArray();
final AtomicInteger ai = new AtomicInteger(0); final AtomicInteger ai = new AtomicInteger(0);
final AtomicInteger afail = new AtomicInteger(0); final AtomicInteger afail = new AtomicInteger(0);
final AtomicInteger aboosts = new AtomicInteger(0);
final AtomicInteger amscore = new AtomicInteger(0); final AtomicInteger amscore = new AtomicInteger(0);
final AtomicInteger avstr = new AtomicInteger(0); final AtomicInteger avstr = new AtomicInteger(0);
final AtomicInteger ascore = new AtomicInteger(0); final AtomicInteger ascore = new AtomicInteger(0);
...@@ -6743,6 +6747,10 @@ public class CuasMotion { ...@@ -6743,6 +6747,10 @@ public class CuasMotion {
for (int ntarg = 0; ntarg <targets.length; ntarg++) if (targets[ntarg] != null){ for (int ntarg = 0; ntarg <targets.length; ntarg++) if (targets[ntarg] != null){
if (Double.isNaN(targets[ntarg][CuasMotionLMA.RSLT_FAIL]) || (targets[ntarg][CuasMotionLMA.RSLT_FAIL]==CuasMotionLMA.FAIL_NONE)) { if (Double.isNaN(targets[ntarg][CuasMotionLMA.RSLT_FAIL]) || (targets[ntarg][CuasMotionLMA.RSLT_FAIL]==CuasMotionLMA.FAIL_NONE)) {
int fail_type = 0; int fail_type = 0;
if (early_boosts && (targets[ntarg][CuasMotionLMA.RSLT_VBOOST] > 1) && (targets[ntarg][CuasMotionLMA.RSLT_EBOOST] <= 1)) {
if (fail_type == 0) fail_type = CuasMotionLMA.FAIL_BOOSTS;
aboosts.getAndIncrement();
}
if (!Double.isNaN(min_mscore) && !(targets[ntarg][CuasMotionLMA.RSLT_MSCORE] >= min_mscore)) { if (!Double.isNaN(min_mscore) && !(targets[ntarg][CuasMotionLMA.RSLT_MSCORE] >= min_mscore)) {
if (fail_type == 0) fail_type = CuasMotionLMA.FAIL_MOTION; if (fail_type == 0) fail_type = CuasMotionLMA.FAIL_MOTION;
amscore.getAndIncrement(); amscore.getAndIncrement();
...@@ -6775,6 +6783,7 @@ public class CuasMotion { ...@@ -6775,6 +6783,7 @@ public class CuasMotion {
ImageDtt.startAndJoin(threads); ImageDtt.startAndJoin(threads);
return new int [] { return new int [] {
afail.get(), afail.get(),
aboosts.get(),
amscore.get(), amscore.get(),
avstr.get(), avstr.get(),
ascore.get(), ascore.get(),
...@@ -8041,6 +8050,7 @@ public class CuasMotion { ...@@ -8041,6 +8050,7 @@ public class CuasMotion {
boolean accum_base = clt_parameters.imp.cuas_accum_base || !accum_boosted; // By AF on 05/12/2026 boolean accum_base = clt_parameters.imp.cuas_accum_base || !accum_boosted; // By AF on 05/12/2026
boolean early_en = clt_parameters.imp.cuas_early_en; // Apply early fail filter after phase 1 boolean early_en = clt_parameters.imp.cuas_early_en; // Apply early fail filter after phase 1
boolean early_boosts = clt_parameters.imp.cuas_early_boosts; // Apply early fail filter after phase 1
double early_mscore = clt_parameters.imp.cuas_early_mscore; // Minimal motion score (RSLT_MSCORE) double early_mscore = clt_parameters.imp.cuas_early_mscore; // Minimal motion score (RSLT_MSCORE)
double early_vstr = clt_parameters.imp.cuas_early_vstr; // Minimal MV confidence (RSLT_VSTR) double early_vstr = clt_parameters.imp.cuas_early_vstr; // Minimal MV confidence (RSLT_VSTR)
double early_score = clt_parameters.imp.cuas_early_score; // Minimal score (RSLT_QSCORE) double early_score = clt_parameters.imp.cuas_early_score; // Minimal score (RSLT_QSCORE)
...@@ -8575,6 +8585,7 @@ public class CuasMotion { ...@@ -8575,6 +8585,7 @@ public class CuasMotion {
int [] early_fail = earlyFail( // Fail after Phase 1 int [] early_fail = earlyFail( // Fail after Phase 1
target_sequence_multi, // final double [][][][] target_multi, target_sequence_multi, // final double [][][][] target_multi,
niter, // final int niter, niter, // final int niter,
early_boosts, // final boolean early_boosts,
early_mscore, // final double min_mscore, early_mscore, // final double min_mscore,
early_vstr, // final double min_vstr, early_vstr, // final double min_vstr,
early_score, // final double min_score, early_score, // final double min_score,
...@@ -8582,10 +8593,11 @@ public class CuasMotion { ...@@ -8582,10 +8593,11 @@ public class CuasMotion {
if (debugLevel > -4) { if (debugLevel > -4) {
System.out.println("Early failed:"); System.out.println("Early failed:");
System.out.println(String.format(" total: %5d", early_fail[0])); System.out.println(String.format(" total: %5d", early_fail[0]));
System.out.println(String.format(" mscore: %5d (<%f)", early_fail[1],early_mscore)); System.out.println(String.format(" boosts: %5d, enforced=%b", early_fail[1],early_boosts));
System.out.println(String.format(" vstr: %5d (<%f)", early_fail[2],early_vstr)); System.out.println(String.format(" mscore: %5d (<%f)", early_fail[2],early_mscore));
System.out.println(String.format(" score: %5d (<%f)", early_fail[3],early_score)); System.out.println(String.format(" vstr: %5d (<%f)", early_fail[3],early_vstr));
System.out.println(String.format(" amplitude: %5d (<%f)", early_fail[4],early_amp)); System.out.println(String.format(" score: %5d (<%f)", early_fail[4],early_score));
System.out.println(String.format(" amplitude: %5d (<%f)", early_fail[5],early_amp));
} }
} else { } else {
if (debugLevel > -4) { if (debugLevel > -4) {
......
...@@ -176,13 +176,14 @@ public class CuasMotionLMA { ...@@ -176,13 +176,14 @@ public class CuasMotionLMA {
public static final int FAIL_K_LOW = 14; // Overshoot is too low (not used, it can be down to 0) public static final int FAIL_K_LOW = 14; // Overshoot is too low (not used, it can be down to 0)
public static final int FAIL_K_HIGH = 15; // Overshoot is too high public static final int FAIL_K_HIGH = 15; // Overshoot is too high
public static final int FAIL_FAR = 16; // Peak is too far from the center public static final int FAIL_FAR = 16; // Peak is too far from the center
public static final int FAIL_VCORR = 17; // MV refinement (fine pass) resulted in a too high correction (not yet checked) public static final int FAIL_BOOSTS= 17; // Tried to use short exposure for slow motion
public static final int FAIL_HORIZON = 18; // Peak is below horizon public static final int FAIL_VCORR = 18; // MV refinement (fine pass) resulted in a too high correction (not yet checked)
public static final int FAIL_MISMATCH = 19; // Mismatch on both ends is too high public static final int FAIL_HORIZON = 19; // Peak is below horizon
public static final int FAIL_NEIGHBOR = 20; // failed because some neighbor is stronger public static final int FAIL_MISMATCH = 20; // Mismatch on both ends is too high
public static final int FAIL_DUPLICATE= 21; // coordinate are (almost) the same as those of a stronger tile public static final int FAIL_NEIGHBOR = 21; // failed because some neighbor is stronger
public static final int FAIL_USED= 22; // non-centered used to generate centered, remove this public static final int FAIL_DUPLICATE= 22; // coordinate are (almost) the same as those of a stronger tile
public static final int FAIL_FL_ONLY= 23; // Flight log data only, no target detected here public static final int FAIL_USED= 23; // non-centered used to generate centered, remove this
public static final int FAIL_FL_ONLY= 24; // Flight log data only, no target detected here
public static final int CENTERED_NO = 0; public static final int CENTERED_NO = 0;
public static final int CENTERED_YES = 1; public static final int CENTERED_YES = 1;
......
...@@ -824,6 +824,9 @@ min_str_neib_fpn 0.35 ...@@ -824,6 +824,9 @@ min_str_neib_fpn 0.35
public int cuas_trim_first = 5; // Trim targets after first (non-centered) pass (if > 0) public int cuas_trim_first = 5; // Trim targets after first (non-centered) pass (if > 0)
public boolean cuas_early_en = true; // Apply early fail filter after phase 1 public boolean cuas_early_en = true; // Apply early fail filter after phase 1
// for debugging this parameter will be applied together with other cuas_early_* filtering,
// for efficiency it may be enforced when adding new targets
public boolean cuas_early_boosts = true; // require boosted exposure for slow (boosted) movements
public double cuas_early_mscore = 0.0015;// Minimal motion score (RSLT_MSCORE) public double cuas_early_mscore = 0.0015;// Minimal motion score (RSLT_MSCORE)
public double cuas_early_vstr = 0.007; // Minimal MV confidence (RSLT_VSTR) public double cuas_early_vstr = 0.007; // Minimal MV confidence (RSLT_VSTR)
public double cuas_early_score = 0.32; // Minimal score (RSLT_QSCORE) public double cuas_early_score = 0.32; // Minimal score (RSLT_QSCORE)
...@@ -2738,7 +2741,7 @@ min_str_neib_fpn 0.35 ...@@ -2738,7 +2741,7 @@ min_str_neib_fpn 0.35
gd.addNumericField("Exposure boost RSLT_A exponent", this.cuas_exposure_boost_factor, 5,8,"", gd.addNumericField("Exposure boost RSLT_A exponent", this.cuas_exposure_boost_factor, 5,8,"",
"RSLT_A *= pow(boost_exposure, factor). 0.5=sqrt (default), 0=no scale, 1=linear."); // By Claude on 05/24/2026 "RSLT_A *= pow(boost_exposure, factor). 0.5=sqrt (default), 0=no scale, 1=linear."); // By Claude on 05/24/2026
gd.addCheckbox ("Accumulate phasae 1 base exposure", this.cuas_phase1_base, gd.addCheckbox ("Accumulate phase 1 base exposure", this.cuas_phase1_base,
"Accumulate non-centered targets (phase 1) with base \"exposure\"."); "Accumulate non-centered targets (phase 1) with base \"exposure\".");
gd.addCheckbox ("Accumulate phase 1 boosted exposure", this.cuas_phase1_boosted, gd.addCheckbox ("Accumulate phase 1 boosted exposure", this.cuas_phase1_boosted,
"Accumulate non-centered targets (phASE 1) with boosted \"exposure\"."); "Accumulate non-centered targets (phASE 1) with boosted \"exposure\".");
...@@ -2783,6 +2786,8 @@ min_str_neib_fpn 0.35 ...@@ -2783,6 +2786,8 @@ min_str_neib_fpn 0.35
gd.addMessage("=== Early Fail Filters (after phase 1) ==="); gd.addMessage("=== Early Fail Filters (after phase 1) ===");
gd.addCheckbox ("Apply early fail filters", this.cuas_early_en, gd.addCheckbox ("Apply early fail filters", this.cuas_early_en,
"Reduce number of target candidates after phase 1."); "Reduce number of target candidates after phase 1.");
gd.addCheckbox ("Enforce bosted exposure for slow targets", this.cuas_early_boosts,
"Require boosted exposure for slow (boosted) movements.");
gd.addNumericField("Motion score (RSLT_MSCORE)", this.cuas_early_mscore, 5,8,"", gd.addNumericField("Motion score (RSLT_MSCORE)", this.cuas_early_mscore, 5,8,"",
"Minimal motion score (RSLT_MSCORE)."); "Minimal motion score (RSLT_MSCORE).");
gd.addNumericField("Motion confidence (RSLT_VSTR)", this.cuas_early_vstr, 5,8,"", gd.addNumericField("Motion confidence (RSLT_VSTR)", this.cuas_early_vstr, 5,8,"",
...@@ -4480,6 +4485,7 @@ min_str_neib_fpn 0.35 ...@@ -4480,6 +4485,7 @@ min_str_neib_fpn 0.35
this.cuas_trim_first = (int) gd.getNextNumber(); this.cuas_trim_first = (int) gd.getNextNumber();
this.cuas_early_en = gd.getNextBoolean(); this.cuas_early_en = gd.getNextBoolean();
this.cuas_early_boosts = gd.getNextBoolean();
this.cuas_early_mscore = gd.getNextNumber(); this.cuas_early_mscore = gd.getNextNumber();
this.cuas_early_vstr = gd.getNextNumber(); this.cuas_early_vstr = gd.getNextNumber();
this.cuas_early_score = gd.getNextNumber(); this.cuas_early_score = gd.getNextNumber();
...@@ -5810,6 +5816,7 @@ min_str_neib_fpn 0.35 ...@@ -5810,6 +5816,7 @@ min_str_neib_fpn 0.35
properties.setProperty(prefix+"cuas_trim_first", this.cuas_trim_first+""); // int properties.setProperty(prefix+"cuas_trim_first", this.cuas_trim_first+""); // int
properties.setProperty(prefix+"cuas_early_en", this.cuas_early_en+""); // boolean properties.setProperty(prefix+"cuas_early_en", this.cuas_early_en+""); // boolean
properties.setProperty(prefix+"cuas_early_boosts", this.cuas_early_boosts+""); // boolean
properties.setProperty(prefix+"cuas_early_mscore", this.cuas_early_mscore+""); // double properties.setProperty(prefix+"cuas_early_mscore", this.cuas_early_mscore+""); // double
properties.setProperty(prefix+"cuas_early_vstr", this.cuas_early_vstr+""); // double properties.setProperty(prefix+"cuas_early_vstr", this.cuas_early_vstr+""); // double
properties.setProperty(prefix+"cuas_early_score", this.cuas_early_score+""); // double properties.setProperty(prefix+"cuas_early_score", this.cuas_early_score+""); // double
...@@ -7075,6 +7082,7 @@ min_str_neib_fpn 0.35 ...@@ -7075,6 +7082,7 @@ min_str_neib_fpn 0.35
if (properties.getProperty(prefix+"cuas_trim_first")!=null) this.cuas_trim_first=Integer.parseInt(properties.getProperty(prefix+"cuas_trim_first")); if (properties.getProperty(prefix+"cuas_trim_first")!=null) this.cuas_trim_first=Integer.parseInt(properties.getProperty(prefix+"cuas_trim_first"));
if (properties.getProperty(prefix+"cuas_early_en")!=null) this.cuas_early_en=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_early_en")); if (properties.getProperty(prefix+"cuas_early_en")!=null) this.cuas_early_en=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_early_en"));
if (properties.getProperty(prefix+"cuas_early_boosts")!=null) this.cuas_early_boosts=Boolean.parseBoolean(properties.getProperty(prefix+"cuas_early_boosts"));
if (properties.getProperty(prefix+"cuas_early_mscore")!=null) this.cuas_early_mscore=Double.parseDouble(properties.getProperty(prefix+"cuas_early_mscore")); if (properties.getProperty(prefix+"cuas_early_mscore")!=null) this.cuas_early_mscore=Double.parseDouble(properties.getProperty(prefix+"cuas_early_mscore"));
if (properties.getProperty(prefix+"cuas_early_vstr")!=null) this.cuas_early_vstr=Double.parseDouble(properties.getProperty(prefix+"cuas_early_vstr")); if (properties.getProperty(prefix+"cuas_early_vstr")!=null) this.cuas_early_vstr=Double.parseDouble(properties.getProperty(prefix+"cuas_early_vstr"));
if (properties.getProperty(prefix+"cuas_early_score")!=null) this.cuas_early_score=Double.parseDouble(properties.getProperty(prefix+"cuas_early_score")); if (properties.getProperty(prefix+"cuas_early_score")!=null) this.cuas_early_score=Double.parseDouble(properties.getProperty(prefix+"cuas_early_score"));
...@@ -8357,6 +8365,7 @@ min_str_neib_fpn 0.35 ...@@ -8357,6 +8365,7 @@ min_str_neib_fpn 0.35
imp.cuas_trim_first = this.cuas_trim_first; imp.cuas_trim_first = this.cuas_trim_first;
imp.cuas_early_en = this.cuas_early_en; imp.cuas_early_en = this.cuas_early_en;
imp.cuas_early_boosts = this.cuas_early_boosts;
imp.cuas_early_mscore = this.cuas_early_mscore; imp.cuas_early_mscore = this.cuas_early_mscore;
imp.cuas_early_vstr = this.cuas_early_vstr; imp.cuas_early_vstr = this.cuas_early_vstr;
imp.cuas_early_score = this.cuas_early_score; imp.cuas_early_score = this.cuas_early_score;
......
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