IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33341


Ignore:
Timestamp:
Feb 22, 2012, 3:05:56 PM (14 years ago)
Author:
watersc1
Message:

Updated PATTERN.CONTINUITY correction, with better maximum diff limits and constrained fitting to force one cell to have zero offset.

Location:
tags/ipp-20120216/psModules/src/detrend
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20120216/psModules/src/detrend

  • tags/ipp-20120216/psModules/src/detrend/pmPattern.c

    r33327 r33341  
    680680        j = 8 * (x + 1) + y; // Determine that neighbor's index
    681681        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]);
     682          critical_value = 2.0 * fabs(D->data.F64[y][x+1]);
    683683        }
    684684        else {
    685           critical_value = 2.0 * fabs(C->data.F64[y][x] / D->data.F64[y][x+1]);
    686         }
    687         psTrace("psModules.detrend.cont",5,"CmD %d %d %d %d %g %g", // diagnostic
     685          critical_value = 2.0 * fabs(C->data.F64[y][x]);
     686        }
     687        if (critical_value < 25) { critical_value = 25; }
     688        psTrace("psModules.detrend.cont",5,"CmD %d %d %d %d %g %g %g", // diagnostic
    688689                i,x,y,j,
    689690                C->data.F64[y][x],
    690                 D->data.F64[y][x+1]
     691                D->data.F64[y][x+1],
     692                critical_value
    691693                );
    692694        if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&&  // If there are no errors with the neighbor,
     
    701703      if (x - 1 > -1) { // etc.
    702704        j = 8 * (x - 1) + y;
    703         psTrace("psModules.detrend.cont",5,"DmC %d %d %d %d %g %g",
     705        if (fabs(C->data.F64[y][x-1]) > fabs(D->data.F64[y][x])) {
     706          critical_value = 2.0 * fabs(D->data.F64[y][x]);
     707        }
     708        else {
     709          critical_value = 2.0 * fabs(C->data.F64[y][x-1]);
     710        }
     711        if (critical_value < 25) { critical_value = 25; }
     712        psTrace("psModules.detrend.cont",5,"DmC %d %d %d %d %g %g %g",
    704713                i,x,y,j,
    705714                D->data.F64[y][x],
    706                 C->data.F64[y][x-1]
     715                C->data.F64[y][x-1],
     716                critical_value
    707717                );
    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         }
     718
    714719        if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&&
    715720            (isfinite(D->data.F64[y][x]))&&(isfinite(C->data.F64[y][x-1]))&&
     
    729734                );
    730735        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]);
     736          critical_value = 2.0 * fabs(B->data.F64[y+1][x]);
    732737        }
    733738        else {
    734           critical_value = 2.0 * fabs(A->data.F64[y][x] / B->data.F64[y+1][x]);
    735         }
     739          critical_value = 2.0 * fabs(A->data.F64[y][x]);
     740        }
     741        if (critical_value < 25) { critical_value = 25; }
    736742        if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&&
    737743            (isfinite(A->data.F64[y][x]))&&(isfinite(B->data.F64[y+1][x]))&&
     
    751757                );
    752758        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]);
     759          critical_value = 2.0 * fabs(B->data.F64[y][x]);
    754760        }
    755761        else {
    756           critical_value = 2.0 * fabs(A->data.F64[y-1][x] / B->data.F64[y][x]);
    757         }
     762          critical_value = 2.0 * fabs(A->data.F64[y-1][x]);
     763        }
     764        if (critical_value < 25) { critical_value = 25; }
    758765        if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&&
    759766            (isfinite(B->data.F64[y][x]))&&(isfinite(A->data.F64[y-1][x]))&&
     
    766773      }
    767774    }
     775    double max_XX = 0;
     776    double solution_V = 0;
     777    int i_peak = -1;
    768778    for (int i = 0; i < numCells; i++) { // If any cells have no value of themself, set the matrix to 1.0.
    769779      if (XX->data.F64[i][i] == 0.0) {
    770780        XX->data.F64[i][i] = 1.0;
    771781      }
    772     }
    773 #if (0)
     782      if (XX->data.F64[i][i] > max_XX) {
     783        max_XX = XX->data.F64[i][i];
     784        solution_V = solution->data.F64[i];
     785        i_peak = i;
     786      }
     787    }
     788    psTrace("psModules.detrend.cont",5,"fixed point: %d %g\n",
     789            i_peak,solution_V);
     790
     791    for (int i = 0; i < numCells; i++) {
     792/*        if (!((XX->data.F64[i][i] == 1.0)&& */
     793/*          (solution->data.F64[i] == 0.0))) { */
     794        solution->data.F64[i] -= solution_V;
     795        if (i != i_peak) {
     796          for (int j = 0; j < numCells; j++) {
     797            XX->data.F64[i][j] -= XX->data.F64[i_peak][j];
     798          }
     799        }
     800/*        } */
     801    }
     802    for (int i = 0; i < numCells; i++) {
     803      XX->data.F64[i_peak][i] = 0.0;
     804    }
     805    XX->data.F64[i_peak][i_peak] = 1.0;
     806   
     807   
     808#if (1)
    774809    for (int i = 0; i < numCells; i++) { // print matrix A
    775810      psTrace("psModules.detrend.cont",5,"A: %3d % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f % 2.0f",
     
    805840    //    psMatrixLUSolve(XX,solution);
    806841    psMatrixGJSolve(XX,solution);
    807 #if (0)
     842#if (1)
    808843    for (int i = 0; i < numCells; i++) { // print vector b
    809       psTrace("psModules.detrend.cont",5,"b: %d %f",
     844      psTrace("psModules.detrend.cont",5,"x: %d %f",
    810845              i,
    811846              solution->data.F64[i]
Note: See TracChangeset for help on using the changeset viewer.