Commit 115acc78 authored by Andrey Filippov's avatar Andrey Filippov

Claude: Remove dead code from cuas package + fix targetsAnalyzeMCP

Dead method/constant removal (21 methods across 5 files):
- CuasMotion: addMotionVectors, clearFailByStrongerNeighbor, cloneTargetsSequence,
  filterByHorizon, filterMotionScans, findMatchingTarget, getKeyFrameVelocityScale,
  getTargetImages, getTargetsFromHyperAugment_2025, getVectorFieldHyper, showPxPyDs,
  subtractTargetSequence, trimSuffix; constants INDX_SPEED, INDX_CONFIDENCE, VF_TOP_TITLES
- CorrectionFPN: calculateFPN_old
- CuasCenterLma: getAverageRoll
- CuasMotionLMA: applyWindowToData, copyMotion, getRR0, getFullParametersVector
- CuasTile: setParentIndex, getParentIndex (were already commented out)

targetsAnalyzeMCP fixes:
- Correct PAR constants (add PAR_PXYAR=-2, shift others)
- params array now accepts strings ("pxy","pxyar","vpxy","upxy", or LMA_TITLES names)
  in addition to integer indices; default remains ["pxy"]
- Add missing PAR_PXYAR case (px, py, a, rmse, r)
- Add amplitude to PAR_PXY case
- Default case uses LMA_TITLES[npar] key instead of String.valueOf(npar)
Co-Authored-By: 's avatarClaude Sonnet 4.6 <noreply@anthropic.com>
parent 5defee61
...@@ -615,60 +615,6 @@ public class CorrectionFPN { ...@@ -615,60 +615,6 @@ public class CorrectionFPN {
return imp; return imp;
} }
/**
* Calculate sensors FPN in a simple way average each channel/color for a scene sequence. Intended to be
* used in CUAS mode averaging several (normally 2 full periods of rotation.
* TODO: make more accurate and universal by back-propagating the corrected image and subtracting per-sensor
* versions before averaging.
* @param quadCLTs sequence of scenes with conditioned images (getImageData() != null), without FPN applied
* @param range a first_last scene index pair. May be adjusted to include an integer number of rotations.
* @param sensor_mask bitmask which sensors to process (normally -1 - all)
* @param debugLevel debug level
* @return [sensor][color][pixel] average FPN image. May be saved as image_data to a virtual (center) scene
* (a QuadCLT instance).
*/
public static double [][][] calculateFPN_old(
final QuadCLT [] quadCLTs,
final int [] range, // required
final int sensor_mask,
final int debugLevel){
QuadCLT first_scene = quadCLTs[range[0]];
final int num_sens = first_scene.getNumSensors();
final int num_colors = first_scene.getNumColors();
final int width = first_scene.getTilesX()*first_scene.getTileSize();
final int height = first_scene.getTilesY()*first_scene.getTileSize();
final int num_pix = width*height;
final int num_scenes = range[1]-range[0]+1;
final double [][][] fpn = new double [num_sens][num_colors][num_pix];
final Thread[] threads = ImageDtt.newThreadArray();
final AtomicInteger ai = new AtomicInteger(0);
for (int ithread = 0; ithread < threads.length; ithread++) {
threads[ithread] = new Thread() {
public void run() {
for (int nChn = ai.getAndIncrement(); nChn < num_sens; nChn = ai.getAndIncrement()) if (((sensor_mask >> nChn) & 1) != 0) {
for (int nscene = range[0]; nscene <= range[1]; nscene++) {
for (int ncol = 0; ncol < num_colors; ncol++) {
double [] img_slice = quadCLTs[nscene].getImageData()[nChn][ncol];
for (int npix = 0; npix < num_pix; npix++) {
fpn[nChn][ncol][npix] += img_slice[npix];
}
}
}
double scale = 1.0/num_scenes;
for (int ncol = 0; ncol < num_colors; ncol++) {
for (int npix = 0; npix < num_pix; npix++) {
fpn[nChn][ncol][npix] *= scale;
}
}
}
}
};
}
ImageDtt.startAndJoin(threads);
return fpn;
}
public static double [][][] calculateFPN( public static double [][][] calculateFPN(
final QuadCLT [] quadCLTs, final QuadCLT [] quadCLTs,
final int [] range, // required final int [] range, // required
......
...@@ -868,11 +868,6 @@ public class CuasCenterLma { ...@@ -868,11 +868,6 @@ public class CuasCenterLma {
public double getInitialRMS() { public double getInitialRMS() {
return initial_rms[0]; return initial_rms[0];
} }
public double getAverageRoll() {
return roll_average;
}
public double [] getRoll() { public double [] getRoll() {
return new double [] {roll_average, roll_omega}; return new double [] {roll_average, roll_omega};
} }
......
...@@ -182,32 +182,6 @@ public class CuasMotionLMA { ...@@ -182,32 +182,6 @@ public class CuasMotionLMA {
} }
} }
} }
/**
* Multiply (in place) data by window. Used only when stray data (local maximum is not the absolute maximum) is present
* Center data will be multiplied by almost 1.0
* @param tile_data data array, will be modified
* @param xc relative to center =width/2
* @param yc relative to center =width/2
*/
public void applyWindowToData(
double [] tile_data,
double xc, // relative to center =width/2
double yc) { // relative to center =width/2
double x0 = Math.min(Math.max(xc + width/2, 0), width-1);
double y0 = Math.min(Math.max(yc + width/2, 0), width-1);
int ix0 = (int) Math.round(x0);
int iy0 = (int) Math.round(y0);
for (int y = 0; y < width; y++) {
int ay = Math.abs(y-iy0);
for (int x = 0; x < width; x++) {
int ax = Math.abs(x-ix0);
double w = window[ay][ax]; // window to the nearest integer x,y
tile_data[x + y*width] *= w;
}
}
}
public int prepareLMA( public int prepareLMA(
boolean [] param_select, boolean [] param_select,
double [] tile_data, double [] tile_data,
...@@ -312,24 +286,9 @@ public class CuasMotionLMA { ...@@ -312,24 +286,9 @@ public class CuasMotionLMA {
rslt[RSLT_ITERS] = getIters(); rslt[RSLT_ITERS] = getIters();
return; return;
} }
public static void copyMotion(
double [] dst,
double [] src) {
dst[RSLT_VX] = src[RSLT_VX];
dst[RSLT_VY] = src[RSLT_VY];
dst[RSLT_VSTR] = src[RSLT_VSTR];
dst[RSLT_VFRAC] = src[RSLT_VFRAC];
}
public double [] getCenter(){ public double [] getCenter(){
return new double [] {full_vector[INDX_X0] - width/2, full_vector[INDX_Y0]-width/2}; return new double [] {full_vector[INDX_X0] - width/2, full_vector[INDX_Y0]-width/2};
} }
public double getRR0() {
return full_vector[INDX_RR0];
}
public double getR0() { public double getR0() {
return Math.PI/(2 * full_vector[INDX_RR0]); return Math.PI/(2 * full_vector[INDX_RR0]);
} }
...@@ -349,11 +308,6 @@ public class CuasMotionLMA { ...@@ -349,11 +308,6 @@ public class CuasMotionLMA {
public int getIters() { public int getIters() {
return iters; return iters;
} }
public double [] getFullParametersVector() {
return full_vector;
}
public double [] getParametersVector() { public double [] getParametersVector() {
double [] vector = new double [pindx.length]; double [] vector = new double [pindx.length];
for (int i = 0; i < vector.length; i++) { for (int i = 0; i < vector.length; i++) {
......
...@@ -18,13 +18,6 @@ public class CuasTile implements Comparable<CuasTile>, Serializable { ...@@ -18,13 +18,6 @@ public class CuasTile implements Comparable<CuasTile>, Serializable {
/* /*
public int parent_index = -1; public int parent_index = -1;
public void setParentIndex(int indx) {
parent_index = indx;
}
public int getParentIndex() {
return parent_index;
}
*/ */
public CuasTile ( public CuasTile (
int num_colors, int num_colors,
......
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