Changeset 2928
- Timestamp:
- Jan 7, 2005, 10:00:34 AM (22 years ago)
- Location:
- trunk/psModules
- Files:
-
- 5 edited
-
src/pmNonLinear.c (modified) (6 diffs)
-
src/pmReadoutCombine.c (modified) (2 diffs)
-
src/pmSubtractSky.c (modified) (3 diffs)
-
test/tst_pmSubtractBias.c (modified) (4 diffs)
-
test/tst_pmSubtractSky.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmNonLinear.c
r2916 r2928 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $8 * @date $Date: 2005-01-0 5 23:43:58$7 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-01-07 20:00:34 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 41 41 psS32 j; 42 42 43 for (i=0;i< (inputReadout->image)->numRows;i++) {44 for (j=0;j< (inputReadout->image)->numCols;j++) {45 (inputReadout->image)->data.F32[i][j] = psPolynomial1DEval(input1DPoly, (inputReadout->image)->data.F32[i][j]);43 for (i=0;i<inputReadout->image->numRows;i++) { 44 for (j=0;j<inputReadout->image->numCols;j++) { 45 inputReadout->image->data.F32[i][j] = psPolynomial1DEval(input1DPoly, inputReadout->image->data.F32[i][j]); 46 46 } 47 47 } … … 65 65 PS_IMAGE_CHECK_TYPE(inputReadout->image, PS_TYPE_F32, NULL); 66 66 PS_PTR_CHECK_NULL(inFlux,NULL); 67 psS32 tableSize = inFlux->n;68 67 if (inFlux->n < 2) { 69 68 psError(PS_ERR_UNKNOWN,true, "pmNonLinearityLookup(): input vector less than 2 elements. Returning inputReadout image."); … … 71 70 } 72 71 PS_PTR_CHECK_NULL(outFlux,NULL); 72 psS32 tableSize = inFlux->n; 73 73 if (inFlux->n != outFlux->n) { 74 74 tableSize = PS_MIN(inFlux->n, outFlux->n); … … 87 87 88 88 x.type.type = PS_TYPE_F32; 89 for (i=0;i<(inputReadout->image)->numRows;i++) { 90 for (j=0;j<(inputReadout->image)->numCols;j++) { 91 x.data.F32 = (inputReadout->image)->data.F32[i][j]; 92 89 for (i=0;i<inputReadout->image->numRows;i++) { 90 for (j=0;j<inputReadout->image->numCols;j++) { 91 x.data.F32 = inputReadout->image->data.F32[i][j]; 93 92 binNum = p_psVectorBinDisect((psVector *)inFlux, &x); 94 93 95 94 if (binNum == -2) { 96 95 // We get here if x is below the table lookup range. 97 (inputReadout->image)->data.F32[i][j] = outFlux->data.F32[0];96 inputReadout->image->data.F32[i][j] = outFlux->data.F32[0]; 98 97 numPixels++; 99 98 100 99 } else if (binNum == -1) { 101 100 // We get here if x is above the table lookup range. 102 (inputReadout->image)->data.F32[i][j] = outFlux->data.F32[tableSize-1]; 101 inputReadout->image->data.F32[i][j] = outFlux->data.F32[tableSize-1]; 102 numPixels++; 103 103 104 numPixels++;105 104 } else if (binNum < -2) { 106 105 // We get here if there was some other problem. … … 112 111 slope = (outFlux->data.F32[binNum+1] - outFlux->data.F32[binNum]) / 113 112 (inFlux->data.F32[binNum+1] - inFlux->data.F32[binNum]); 114 (inputReadout->image)->data.F32[i][j] = outFlux->data.F32[binNum] +115 ((x.data.F32 - inFlux->data.F32[binNum]) * slope);113 inputReadout->image->data.F32[i][j] = outFlux->data.F32[binNum] + 114 ((x.data.F32 - inFlux->data.F32[binNum]) * slope); 116 115 } 117 116 } -
trunk/psModules/src/pmReadoutCombine.c
r2916 r2928 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1.2 0$ $Name: not supported by cvs2svn $8 * @date $Date: 2005-01-0 5 23:43:58$7 * @version $Revision: 1.21 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-01-07 20:00:34 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 27 27 psS32 numBits = 0; 28 28 29 for (i=0;i< 4* sizeof(psStatsOptions);i++) {29 for (i=0;i<8 * sizeof(psStatsOptions);i++) { 30 30 if (0x0001 & tmpData) { 31 31 numBits++; -
trunk/psModules/src/pmSubtractSky.c
r2916 r2928 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-01-0 5 23:43:58$8 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-01-07 20:00:34 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 29 29 psS32 numBits = 0; 30 30 31 for (i=0;i< 4* sizeof(psStatsOptions);i++) {31 for (i=0;i<8 * sizeof(psStatsOptions);i++) { 32 32 if (0x0001 & tmpData) { 33 33 numBits++; … … 439 439 psStatsOptions statOptions = 0; 440 440 441 // 441 442 // Return the original input readout if the fit specs are poorly defined. 443 // No warning or error messages should be generated. 444 // 442 445 if ((fitSpec == NULL) || 443 446 ((fit == PM_FIT_NONE) || (fit == PM_FIT_SPLINE))) { 444 psLogMsg(__func__, PS_LOG_WARN, "Fit specs are poorly defined. Returning in image.\n");447 // psLogMsg(__func__, PS_LOG_WARN, "Fit specs are poorly defined. Returning in image.\n"); 445 448 return(in); 446 449 } -
trunk/psModules/test/tst_pmSubtractBias.c
r2915 r2928 13 13 * @author GLG, MHPCC 14 14 * 15 * @version $Revision: 1.1 3$ $Name: not supported by cvs2svn $16 * @date $Date: 2005-01-0 5 23:25:25$15 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2005-01-07 20:00:34 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 654 654 } 655 655 656 printf("------------------------------------------------------------------\n"); 657 printf("Calling pmSubtractBias() with NULL overscan list and PM_OVERSCAN_NONE. Should generate warning.\n"); 658 rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, stat, 659 0, PM_FIT_NONE, myBias); 660 661 for (i=0;i<numRows;i++) { 662 for (j=0;j<numCols;j++) { 663 psF32 expect = ((float) (i + j)) - 1.0; 664 psF32 actual = rc->image->data.F32[i][j]; 665 if (FLT_EPSILON < fabs(expect - actual)) { 666 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 667 testStatus = 1; 668 } 669 670 // Restore myReadout for next test. 671 myReadout->image->data.F32[i][j] = (float) (i + j); 672 } 673 } 656 /* XXX: This does not seem to be a requirement. 657 printf("------------------------------------------------------------------\n"); 658 printf("Calling pmSubtractBias() with NULL overscan list and PM_OVERSCAN_NONE. Should generate warning.\n"); 659 rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, stat, 660 0, PM_FIT_NONE, myBias); 661 662 for (i=0;i<numRows;i++) { 663 for (j=0;j<numCols;j++) { 664 psF32 expect = ((float) (i + j)) - 1.0; 665 psF32 actual = rc->image->data.F32[i][j]; 666 if (FLT_EPSILON < fabs(expect - actual)) { 667 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 668 testStatus = 1; 669 } 670 671 // Restore myReadout for next test. 672 myReadout->image->data.F32[i][j] = (float) (i + j); 673 } 674 } 675 */ 674 676 675 677 printf("------------------------------------------------------------------\n"); … … 767 769 768 770 printf("------------------------------------------------------------------\n"); 769 printf("Calling pmSubtractBias() undersize bias image (short rows). Should generate Warning.\n");771 printf("Calling pmSubtractBias() undersize bias image (short rows). Should generate Error.\n"); 770 772 myReadout = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, NULL, 771 773 0, PM_FIT_NONE, myBiasShortRows); … … 778 780 779 781 printf("------------------------------------------------------------------\n"); 780 printf("Calling pmSubtractBias() undersize bias image (short columns). Should generate Warning.\n");782 printf("Calling pmSubtractBias() undersize bias image (short columns). Should generate Error.\n"); 781 783 myReadout = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, NULL, 782 784 0, PM_FIT_NONE, myBiasShortCols); -
trunk/psModules/test/tst_pmSubtractSky.c
r2915 r2928 7 7 * @author GLG, MHPCC 8 8 * 9 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $10 * @date $Date: 2005-01-0 5 23:25:25$9 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-01-07 20:00:34 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 226 226 227 227 printf("----------------------------------------------------------------\n"); 228 printf("Calling pmSubtractSky() with NULL fitSpec. Should return image, no TESTERROR, no WARNING.\n\n");228 printf("Calling pmSubtractSky() with NULL fitSpec. Should return image, no ERROR, no WARNING.\n\n"); 229 229 rc = pmSubtractSky(myReadout, NULL, PM_FIT_POLYNOMIAL, 1, myStats, 2.0); 230 230 if (rc != myReadout) { … … 234 234 235 235 printf("----------------------------------------------------------------\n"); 236 printf("Calling pmSubtractSky() with PM_FIT_NONE fit. Should return image, no TESTERROR, no WARNING.\n\n");236 printf("Calling pmSubtractSky() with PM_FIT_NONE fit. Should return image, no ERROR, no WARNING.\n\n"); 237 237 rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_NONE, 1, myStats, 2.0); 238 238 if (rc != myReadout) { … … 242 242 243 243 printf("----------------------------------------------------------------\n"); 244 printf("Calling pmSubtractSky() with PM_FIT_SPLINE fit. Should return image, no TESTERROR, no WARNING.\n\n");244 printf("Calling pmSubtractSky() with PM_FIT_SPLINE fit. Should return image, no ERROR, no WARNING.\n\n"); 245 245 rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_SPLINE, 1, myStats, 2.0); 246 246 if (rc != myReadout) {
Note:
See TracChangeset
for help on using the changeset viewer.
