IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 17, 2012, 4:44:49 PM (14 years ago)
Author:
watersc1
Message:

Update to continuity code that sets a limit on how large a jump will be allowed into the continuity matrix. This means we will leave some cells uncorrected, which may cause issues around them, but will keep the rest of the cells in a single (hopefully valid) solution.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/detrend/pmPattern.c

    r33243 r33304  
    565565    psImage *C = psImageAlloc(8,8,PS_TYPE_F64); // Right edge
    566566    psImage *D = psImageAlloc(8,8,PS_TYPE_F64); // Left edge
     567    psImageInit(A,0.0);
     568    psImageInit(B,0.0);
     569    psImageInit(C,0.0);
     570    psImageInit(D,0.0);
    567571   
    568572    for (int i = 0; i < numCells; i++) {
     
    611615            continue; // Move on to next edge, as only part of this cell may be a problem
    612616          }
    613 
     617 
    614618          // If the returned value is zero, assume something is wrong.  Do I still need this?
    615619          if (psStatsGetValue(bgStats,bgStat) < 1e-6) {
     
    632636            else if (j == 3) { D->data.F64[y][x] = psStatsGetValue(bgStats,bgStat); }
    633637          }
     638
     639          for (int u = 0; u < subset->numCols; u++) {
     640            for (int v = 0; v < subset->numRows; v++) {
     641              psTrace("psModules.detrend.cont",10,"BOX: %d %d (%d %d) (%d %d) %f %d",
     642                      i,j,x,y,u,v,subset->data.F32[v][u],submask->data.PS_TYPE_IMAGE_MASK_DATA[v][u]);
     643            }
     644          }       
     645         
    634646          psFree(subset);
    635647          psFree(submask);
     
    638650        psTrace("psModules.detrend.cont",5, "OTA: %d (%d %d) A: %f B: %f C: %f D: %f",
    639651                i,x,y,
    640                 A->data.F32[y][x],B->data.F32[y][x],C->data.F32[y][x],D->data.F32[y][x]);               
     652                A->data.F64[y][x],B->data.F64[y][x],C->data.F64[y][x],D->data.F64[y][x]);               
    641653    }
    642654    psFree(bgStats);
     
    661673      int x = (i - y) / 8;
    662674      int j;
     675      double critical_value = 0.0;
    663676      if (meanMask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PM_PATTERN_IGNORE) {
    664677        continue;
     
    666679      if (x + 1 < 8) {  // We have a neighbor adjacent in the +x direction
    667680        j = 8 * (x + 1) + y; // Determine that neighbor's index
     681        if (fabs(C->data.F64[y][x]) > fabs(D->data.F64[y][x+1])) {
     682          critical_value = 2.0 * fabs(D->data.F64[y][x+1] / C->data.F64[y][x]);
     683        }
     684        else {
     685          critical_value = 2.0 * fabs(C->data.F64[y][x] / D->data.F64[y][x+1]);
     686        }
    668687        psTrace("psModules.detrend.cont",5,"CmD %d %d %d %d %g %g", // diagnostic
    669688                i,x,y,j,
     
    672691                );
    673692        if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&&  // If there are no errors with the neighbor,
    674             (isfinite(C->data.F64[y][x]))&&(isfinite(D->data.F64[y][x+1]))) {    // and all edges have valid values:
     693            (isfinite(C->data.F64[y][x]))&&(isfinite(D->data.F64[y][x+1]))&&     // and all edges have valid values,
     694            (fabs(C->data.F64[y][x] - D->data.F64[y][x+1]) < critical_value)     // and there are no large discontinuities,
     695            ) {   
    675696          solution->data.F64[i] += C->data.F64[y][x] - D->data.F64[y][x+1];     // Take the difference
    676697          XX->data.F64[i][i] += 1;                                              // increment our relation with ourself
     
    685706                C->data.F64[y][x-1]
    686707                );
    687 
     708        if (fabs(C->data.F64[y][x-1]) > fabs(D->data.F64[y][x])) {
     709          critical_value = 2.0 * fabs(D->data.F64[y][x] / C->data.F64[y][x-1]);
     710        }
     711        else {
     712          critical_value = 2.0 * fabs(C->data.F64[y][x-1] / D->data.F64[y][x]);
     713        }
    688714        if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&&
    689             (isfinite(D->data.F64[y][x]))&&(isfinite(C->data.F64[y][x-1]))) {
     715            (isfinite(D->data.F64[y][x]))&&(isfinite(C->data.F64[y][x-1]))&&
     716            (fabs(D->data.F64[y][x] - C->data.F64[y][x-1]) < critical_value)
     717            ) {
    690718          solution->data.F64[i] += D->data.F64[y][x] - C->data.F64[y][x-1];
    691719          XX->data.F64[i][i] += 1;
     
    700728                B->data.F64[y+1][x]
    701729                );
    702 
     730        if (fabs(A->data.F64[y][x]) > fabs(B->data.F64[y+1][x])) {
     731          critical_value = 2.0 * fabs(B->data.F64[y+1][x] / A->data.F64[y][x]);
     732        }
     733        else {
     734          critical_value = 2.0 * fabs(A->data.F64[y][x] / B->data.F64[y+1][x]);
     735        }
    703736        if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&&
    704             (isfinite(A->data.F64[y][x]))&&(isfinite(B->data.F64[y+1][x]))) {
     737            (isfinite(A->data.F64[y][x]))&&(isfinite(B->data.F64[y+1][x]))&&
     738            (fabs(A->data.F64[y][x] - B->data.F64[y+1][x]) < critical_value)
     739            ) {
    705740          solution->data.F64[i] += A->data.F64[y][x] - B->data.F64[y+1][x];
    706741          XX->data.F64[i][i] += 1;
     
    715750                A->data.F64[y-1][x]
    716751                );
    717 
     752        if (fabs(A->data.F64[y-1][x]) > fabs(B->data.F64[y][x])) {
     753          critical_value = 2.0 * fabs(B->data.F64[y][x] / A->data.F64[y-1][x]);
     754        }
     755        else {
     756          critical_value = 2.0 * fabs(A->data.F64[y-1][x] / B->data.F64[y][x]);
     757        }
    718758        if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&&
    719             (isfinite(B->data.F64[y][x]))&&(isfinite(A->data.F64[y-1][x]))) {
     759            (isfinite(B->data.F64[y][x]))&&(isfinite(A->data.F64[y-1][x]))&&
     760            (fabs(B->data.F64[y][x] - A->data.F64[y-1][x]) < critical_value)
     761            ) {
    720762          solution->data.F64[i] += B->data.F64[y][x] - A->data.F64[y-1][x];
    721763          XX->data.F64[i][i] += 1;
Note: See TracChangeset for help on using the changeset viewer.