Changeset 33340
- Timestamp:
- Feb 22, 2012, 3:02:02 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/detrend/pmPattern.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/detrend/pmPattern.c
r33326 r33340 680 680 j = 8 * (x + 1) + y; // Determine that neighbor's index 681 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]);682 critical_value = 2.0 * fabs(D->data.F64[y][x+1]); 683 683 } 684 684 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 688 689 i,x,y,j, 689 690 C->data.F64[y][x], 690 D->data.F64[y][x+1] 691 D->data.F64[y][x+1], 692 critical_value 691 693 ); 692 694 if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&& // If there are no errors with the neighbor, … … 701 703 if (x - 1 > -1) { // etc. 702 704 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", 704 713 i,x,y,j, 705 714 D->data.F64[y][x], 706 C->data.F64[y][x-1] 715 C->data.F64[y][x-1], 716 critical_value 707 717 ); 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 714 719 if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&& 715 720 (isfinite(D->data.F64[y][x]))&&(isfinite(C->data.F64[y][x-1]))&& … … 729 734 ); 730 735 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]); 732 737 } 733 738 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; } 736 742 if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&& 737 743 (isfinite(A->data.F64[y][x]))&&(isfinite(B->data.F64[y+1][x]))&& … … 751 757 ); 752 758 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]); 754 760 } 755 761 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; } 758 765 if (!(meanMask->data.PS_TYPE_VECTOR_MASK_DATA[j] & PM_PATTERN_IGNORE)&& 759 766 (isfinite(B->data.F64[y][x]))&&(isfinite(A->data.F64[y-1][x]))&& … … 766 773 } 767 774 } 775 double max_XX = 0; 776 double solution_V = 0; 777 int i_peak = -1; 768 778 for (int i = 0; i < numCells; i++) { // If any cells have no value of themself, set the matrix to 1.0. 769 779 if (XX->data.F64[i][i] == 0.0) { 770 780 XX->data.F64[i][i] = 1.0; 771 781 } 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) 774 809 for (int i = 0; i < numCells; i++) { // print matrix A 775 810 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", … … 805 840 // psMatrixLUSolve(XX,solution); 806 841 psMatrixGJSolve(XX,solution); 807 #if ( 0)842 #if (1) 808 843 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", 810 845 i, 811 846 solution->data.F64[i]
Note:
See TracChangeset
for help on using the changeset viewer.
