Changeset 2915
- Timestamp:
- Jan 5, 2005, 1:25:25 PM (22 years ago)
- Location:
- trunk/psModules
- Files:
-
- 6 edited
-
src/pmNonLinear.c (modified) (7 diffs)
-
src/pmReadoutCombine.c (modified) (2 diffs)
-
test/tst_pmNonLinear.c (modified) (7 diffs)
-
test/tst_pmReadoutCombine.c (modified) (16 diffs)
-
test/tst_pmSubtractBias.c (modified) (25 diffs)
-
test/tst_pmSubtractSky.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmNonLinear.c
r2857 r2915 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $8 * @date $Date: 200 4-12-30 22:22:00$7 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-01-05 23:25:24 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 11 * 12 * XXX: The SDR is silent about image types. Only F32 was implemented. 11 13 * 12 14 */ … … 28 30 *****************************************************************************/ 29 31 30 psReadout *pmNonLinearityPolynomial(psReadout *in ,31 const psPolynomial1D * coeff)32 psReadout *pmNonLinearityPolynomial(psReadout *inputReadout, 33 const psPolynomial1D *input1DPoly) 32 34 { 33 PS_PTR_CHECK_NULL(in ,NULL);34 PS_PTR_CHECK_NULL(in ->image, NULL);35 PS_PTR_CHECK_NULL( coeff,NULL);35 PS_PTR_CHECK_NULL(inputReadout, NULL); 36 PS_PTR_CHECK_NULL(inputReadout->image, NULL); 37 PS_PTR_CHECK_NULL(input1DPoly, NULL); 36 38 37 39 psS32 i; 38 40 psS32 j; 39 41 40 for (i=0;i<(in ->image)->numRows;i++) {41 for (j=0;j<(in ->image)->numCols;j++) {42 (in ->image)->data.F32[i][j] = psPolynomial1DEval(coeff, (in->image)->data.F32[i][j]);42 for (i=0;i<(inputReadout->image)->numRows;i++) { 43 for (j=0;j<(inputReadout->image)->numCols;j++) { 44 (inputReadout->image)->data.F32[i][j] = psPolynomial1DEval(input1DPoly, (inputReadout->image)->data.F32[i][j]); 43 45 } 44 46 } 45 return(in );47 return(inputReadout); 46 48 } 47 49 … … 54 56 be set to the value from outFlux. 55 57 *****************************************************************************/ 56 psReadout *pmNonLinearityLookup(psReadout *in ,58 psReadout *pmNonLinearityLookup(psReadout *inputReadout, 57 59 const psVector *inFlux, 58 60 const psVector *outFlux) 59 61 { 60 PS_PTR_CHECK_NULL(in ,NULL);61 PS_PTR_CHECK_NULL(in ->image,NULL);62 PS_PTR_CHECK_NULL(inputReadout,NULL); 63 PS_PTR_CHECK_NULL(inputReadout->image,NULL); 62 64 PS_PTR_CHECK_NULL(inFlux,NULL); 65 psS32 tableSize = inFlux->n; 66 if (inFlux->n < 2) { 67 psError(PS_ERR_UNKNOWN,true, "pmNonLinearityLookup(): input vector less than 2 elements. Returning inputReadout image."); 68 return(inputReadout); 69 } 63 70 PS_PTR_CHECK_NULL(outFlux,NULL); 71 if (inFlux->n != outFlux->n) { 72 tableSize = PS_MIN(inFlux->n, outFlux->n); 73 psLogMsg(__func__, PS_LOG_WARN, 74 "WARNING: pmNonLinear.c: pmNonLinearityLookup(): input vectors have different sizes (%d, %d)\n", inFlux->n, outFlux->n); 75 } 64 76 65 77 psS32 i; 66 78 psS32 j; 67 psS32 tableSize = inFlux->n;68 79 psS32 binNum; 69 80 psScalar x; … … 72 83 73 84 x.type.type = PS_TYPE_F32; 74 if (inFlux->n != outFlux->n) { 75 tableSize = PS_MIN(inFlux->n, outFlux->n); 76 psLogMsg(__func__, PS_LOG_WARN, 77 "WARNING: pmNonLinear.c: pmNonLinearityLookup(): input vectors have different sizes (%d, %d)\n", inFlux->n, outFlux->n); 78 } 79 if (inFlux->n < 2) { 80 psError(PS_ERR_UNKNOWN,true, "pmNonLinearityLookup(): input vector less than 2 elements. Returning in image."); 81 return(in); 82 } 83 for (i=0;i<(in->image)->numRows;i++) { 84 for (j=0;j<(in->image)->numCols;j++) { 85 x.data.F32 = (in->image)->data.F32[i][j]; 85 for (i=0;i<(inputReadout->image)->numRows;i++) { 86 for (j=0;j<(inputReadout->image)->numCols;j++) { 87 x.data.F32 = (inputReadout->image)->data.F32[i][j]; 86 88 87 89 binNum = p_psVectorBinDisect((psVector *)inFlux, &x); … … 89 91 if (binNum == -2) { 90 92 // We get here if x is below the table lookup range. 91 (in ->image)->data.F32[i][j] = outFlux->data.F32[0];93 (inputReadout->image)->data.F32[i][j] = outFlux->data.F32[0]; 92 94 numPixels++; 93 95 94 96 } else if (binNum == -1) { 95 97 // We get here if x is above the table lookup range. 96 (in ->image)->data.F32[i][j] = outFlux->data.F32[tableSize-1];98 (inputReadout->image)->data.F32[i][j] = outFlux->data.F32[tableSize-1]; 97 99 98 100 numPixels++; 99 101 } else if (binNum < -2) { 100 102 // We get here if there was some other problem. 101 psError(PS_ERR_UNKNOWN,true, "pmNonLinearityLookup(): Could not perform p_psVectorBinDisect(). Returning in image.");102 return(in );103 psError(PS_ERR_UNKNOWN,true, "pmNonLinearityLookup(): Could not perform p_psVectorBinDisect(). Returning inputReadout image."); 104 return(inputReadout); 103 105 numPixels++; 104 106 } else { … … 106 108 slope = (outFlux->data.F32[binNum+1] - outFlux->data.F32[binNum]) / 107 109 (inFlux->data.F32[binNum+1] - inFlux->data.F32[binNum]); 108 (in ->image)->data.F32[i][j] = outFlux->data.F32[binNum] +109 ((x.data.F32 - inFlux->data.F32[binNum]) * slope);110 (inputReadout->image)->data.F32[i][j] = outFlux->data.F32[binNum] + 111 ((x.data.F32 - inFlux->data.F32[binNum]) * slope); 110 112 } 111 113 } … … 115 117 "WARNING: pmNonLinear.c: pmNonLinearityLookup(): %d pixels outside table.", numPixels); 116 118 } 117 return(in );119 return(inputReadout); 118 120 } -
trunk/psModules/src/pmReadoutCombine.c
r2857 r2915 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1.1 8$ $Name: not supported by cvs2svn $8 * @date $Date: 200 4-12-30 22:22:00$7 * @version $Revision: 1.19 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-01-05 23:25:24 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 144 144 } else if (numInputs < scale->n) { 145 145 psLogMsg(__func__, PS_LOG_WARN, 146 "WARNING: the scale vector too many elements (%d)\n", scale->n);146 "WARNING: the scale vector has too many elements (%d)\n", scale->n); 147 147 } 148 148 } -
trunk/psModules/test/tst_pmNonLinear.c
r2857 r2915 11 11 * N), (N, 1), (N, N)]. 12 12 * 13 * test02, test03: This code tests the functions with various unallowable 14 * input parameters (NULLS) and incorrect vector sizes. 15 * 13 16 * @author GLG, MHPCC 14 17 * 15 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $16 * @date $Date: 200 4-12-30 22:22:00$18 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 19 * @date $Date: 2005-01-05 23:25:25 $ 17 20 * 18 21 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 24 27 static int test00(void); 25 28 static int test01(void); 29 static int test02(void); 30 static int test03(void); 26 31 testDescription tests[] = { 27 {test00, 000, "pmNonLinearityPolynomial", 0, false}, 28 {test01, 000, "pmNonLinearityLookup", 0, false}, 32 {test00, 000, "pmNonLinearityPolynomial", true, false}, 33 {test01, 000, "pmNonLinearityLookup", true, false}, 34 {test02, 000, "pmNonLinearityPolynomial(): error/warning conditions", true, false}, 35 {test03, 000, "pmNonLinearityLookup(): error/warning conditions", true, false}, 29 36 {NULL} 30 37 }; … … 44 51 float actual; 45 52 float expect; 46 int testStatus = 0;53 int testStatus = true; 47 54 psImage *myImage = psImageAlloc(numCols, numRows, PS_TYPE_F32); 48 // psReadout *myReadout = psReadoutAlloc(numCols, numRows, myImage);49 55 psReadout *myReadout = psReadoutAlloc(); 50 56 myReadout->image = myImage; … … 64 70 actual = myReadout->image->data.F32[i][j]; 65 71 if (FLT_EPSILON < fabs(expect - actual)) { 66 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);67 testStatus = 1;72 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 73 testStatus = false; 68 74 } 69 75 } … … 94 100 float actual; 95 101 float expect; 96 int testStatus = 0;102 int testStatus = true; 97 103 int tableSize = PS_MAX(numCols, numRows)*2; 98 104 psImage *myImage = psImageAlloc(numCols, numRows, PS_TYPE_F32); 99 // psReadout *myReadout = psReadoutAlloc(numCols, numRows, myImage);100 105 psReadout *myReadout = psReadoutAlloc(); 101 106 myReadout->image = myImage; … … 120 125 actual = myReadout->image->data.F32[i][j]; 121 126 if (FLT_EPSILON < fabs(expect - actual)) { 122 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);123 testStatus = 1;127 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 128 testStatus = false; 124 129 } 125 130 } … … 144 149 return(testStatus); 145 150 } 151 152 int test02( void ) 153 { 154 int i; 155 int j; 156 int testStatus = true; 157 psImage *myImage = psImageAlloc(NUM_COLS, NUM_ROWS, PS_TYPE_F32); 158 psReadout *myReadout = psReadoutAlloc(); 159 psReadout *rc = NULL; 160 myReadout->image = myImage; 161 psPolynomial1D *myPoly = psPolynomial1DAlloc(2, PS_POLYNOMIAL_ORD); 162 myPoly->coeff[1] = 1.0; 163 164 for (i=0;i<NUM_ROWS;i++) { 165 for (j=0;j<NUM_COLS;j++) { 166 myReadout->image->data.F32[i][j] = (float) (i + j); 167 } 168 } 169 170 printf("------------------------------------------------------------\n"); 171 printf("Calling pmNonLinearityPolynomial() with NULL input readout. Should generate error, return NULL.\n"); 172 rc = pmNonLinearityPolynomial(NULL, myPoly); 173 if (rc != NULL) { 174 printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n"); 175 testStatus = false; 176 } 177 178 printf("------------------------------------------------------------\n"); 179 printf("Calling pmNonLinearityPolynomial() with NULL input readout->image. Should generate error, return NULL.\n"); 180 psImage *tmpImage = myReadout->image; 181 myReadout->image = NULL; 182 rc = pmNonLinearityPolynomial(myReadout, myPoly); 183 if (rc != NULL) { 184 printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n"); 185 testStatus = false; 186 } 187 myReadout->image = tmpImage; 188 189 printf("------------------------------------------------------------\n"); 190 printf("Calling pmNonLinearityPolynomial() with NULL polynomial. Should generate error, return NULL.\n"); 191 rc = pmNonLinearityPolynomial(myReadout, NULL); 192 if (rc != NULL) { 193 printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n"); 194 testStatus = false; 195 } 196 197 psFree(myReadout); 198 psFree(myPoly); 199 return(testStatus); 200 } 201 202 203 int test03Init(psReadout *myReadout) 204 { 205 for (psS32 i=0;i<NUM_ROWS;i++) { 206 for (psS32 j=0;j<NUM_COLS;j++) { 207 myReadout->image->data.F32[i][j] = (float) (i + j); 208 } 209 } 210 return(0); 211 } 212 213 int test03() 214 { 215 int i; 216 int j; 217 int testStatus = true; 218 int tableSize = PS_MAX(NUM_COLS, NUM_ROWS)*3; 219 psImage *myImage = psImageAlloc(NUM_COLS, NUM_ROWS, PS_TYPE_F32); 220 psReadout *myReadout = psReadoutAlloc(); 221 psReadout *rc = NULL; 222 myReadout->image = myImage; 223 psVector *in = psVectorAlloc(tableSize, PS_TYPE_F32); 224 psVector *inOne = psVectorAlloc(1, PS_TYPE_F32); 225 psVector *inSmall = psVectorAlloc(tableSize-1, PS_TYPE_F32); 226 psVector *inBig = psVectorAlloc(tableSize+1, PS_TYPE_F32); 227 psVector *out = psVectorAlloc(tableSize, PS_TYPE_F32); 228 psVector *outOne = psVectorAlloc(1, PS_TYPE_F32); 229 psVector *outSmall = psVectorAlloc(tableSize-1, PS_TYPE_F32); 230 psVector *outBig = psVectorAlloc(tableSize+1, PS_TYPE_F32); 231 232 test03Init(myReadout); 233 for (i=0;i<tableSize;i++) { 234 in->data.F32[i] = (float) i; 235 out->data.F32[i] = (float) (2 * i); 236 inBig->data.F32[i] = (float) i; 237 outBig->data.F32[i] = (float) (2 * i); 238 if (i < tableSize-1) { 239 inSmall->data.F32[i] = (float) (2 * i); 240 outSmall->data.F32[i] = (float) (2 * i); 241 } 242 } 243 inBig->data.F32[tableSize] = (float) tableSize; 244 outBig->data.F32[tableSize] = (float) (2 * tableSize); 245 inOne->data.F32[0] = 0.0; 246 outOne->data.F32[0] = 0.0; 247 248 printf("------------------------------------------------------------\n"); 249 printf("Calling pmNonLinearityLookup() with NULL input psReadout. Should generate error, return NULL.\n"); 250 rc = pmNonLinearityLookup(NULL, in, out); 251 if (rc != NULL) { 252 printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n"); 253 testStatus = false; 254 } 255 256 printf("------------------------------------------------------------\n"); 257 printf("Calling pmNonLinearityLookup() with NULL input psReadout->image. Should generate error, return NULL.\n"); 258 psImage *tmpImage = myReadout->image; 259 myReadout->image = NULL; 260 rc = pmNonLinearityLookup(myReadout, in, out); 261 if (rc != NULL) { 262 printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n"); 263 testStatus = false; 264 } 265 myReadout->image = tmpImage; 266 267 printf("------------------------------------------------------------\n"); 268 printf("Calling pmNonLinearityLookup() with NULL inFlux psVector. Should generate error, return NULL.\n"); 269 rc = pmNonLinearityLookup(myReadout, NULL, out); 270 if (rc != NULL) { 271 printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n"); 272 testStatus = false; 273 } 274 275 printf("------------------------------------------------------------\n"); 276 printf("Calling pmNonLinearityLookup() with NULL outFlux psVector. Should generate error, return NULL.\n"); 277 rc = pmNonLinearityLookup(myReadout, in, NULL); 278 if (rc != NULL) { 279 printf("TEST ERROR: pmNonLinearityPolynomial() returned a non-NULL psReadout\n"); 280 testStatus = false; 281 } 282 283 test03Init(myReadout); 284 printf("------------------------------------------------------------\n"); 285 printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors. Should generate warning.\n"); 286 rc = pmNonLinearityLookup(myReadout, in, outBig); 287 if (rc == NULL) { 288 printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n"); 289 testStatus = false; 290 } 291 for (i=0;i<NUM_ROWS;i++) { 292 for (j=0;j<NUM_COLS;j++) { 293 psF32 expect = (float) (2 * (i + j)); 294 psF32 actual = rc->image->data.F32[i][j]; 295 if (FLT_EPSILON < fabs(expect - actual)) { 296 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 297 testStatus = false; 298 } 299 } 300 } 301 302 303 test03Init(myReadout); 304 printf("------------------------------------------------------------\n"); 305 printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors. Should generate warning.\n"); 306 rc = pmNonLinearityLookup(myReadout, in, outSmall); 307 if (rc == NULL) { 308 printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n"); 309 testStatus = false; 310 } 311 312 test03Init(myReadout); 313 printf("------------------------------------------------------------\n"); 314 printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors. Should generate warning.\n"); 315 rc = pmNonLinearityLookup(myReadout, inSmall, out); 316 if (rc == NULL) { 317 printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n"); 318 testStatus = false; 319 } 320 321 test03Init(myReadout); 322 printf("------------------------------------------------------------\n"); 323 printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors. Should generate warning.\n"); 324 rc = pmNonLinearityLookup(myReadout, inBig, out); 325 if (rc == NULL) { 326 printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n"); 327 testStatus = false; 328 } 329 330 test03Init(myReadout); 331 printf("------------------------------------------------------------\n"); 332 printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors. Should generate warning.\n"); 333 rc = pmNonLinearityLookup(myReadout, inSmall, outBig); 334 if (rc == NULL) { 335 printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n"); 336 testStatus = false; 337 } 338 339 test03Init(myReadout); 340 printf("------------------------------------------------------------\n"); 341 printf("Calling pmNonLinearityLookup() with size difference in inFlux/outFLux psVectors. Should generate warning.\n"); 342 rc = pmNonLinearityLookup(myReadout, inBig, outSmall); 343 if (rc == NULL) { 344 printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n"); 345 testStatus = false; 346 } 347 348 test03Init(myReadout); 349 printf("------------------------------------------------------------\n"); 350 printf("Calling pmNonLinearityLookup() with inFlux psVector size 1. Should generate error, return original psReadout.\n"); 351 rc = pmNonLinearityLookup(myReadout, inOne, out); 352 if (rc != myReadout) { 353 printf("TEST ERROR: pmNonLinearityPolynomial() did not return the original psReadout\n"); 354 testStatus = false; 355 } 356 357 printf("------------------------------------------------------------\n"); 358 printf("Calling pmNonLinearityLookup() with one pixels outside inFlux range. Should generate warnings.\n"); 359 test03Init(myReadout); 360 myReadout->image->data.F32[0][0] = -1; 361 rc = pmNonLinearityLookup(myReadout, in, out); 362 if (rc == NULL) { 363 printf("TEST ERROR: pmNonLinearityPolynomial() returned a NULL psReadout\n"); 364 testStatus = false; 365 } 366 367 368 psFree(myReadout); 369 psFree(in); 370 psFree(inOne); 371 psFree(inSmall); 372 psFree(inBig); 373 psFree(out); 374 psFree(outOne); 375 psFree(outSmall); 376 psFree(outBig); 377 378 return(testStatus); 379 } -
trunk/psModules/test/tst_pmReadoutCombine.c
r2856 r2915 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $8 * @date $Date: 200 4-12-30 21:35:04$7 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-01-05 23:25:25 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 44 44 for (psS32 j = 0 ; j < output->numCols ; j++) { 45 45 if (output->data.F32[i][j] != expect) { 46 printf(" ERROR: output[%d][%d] is %.2f, should be %f\n", i, j, output->data.F32[i][j], expect);46 printf("TEST ERROR: output[%d][%d] is %.2f, should be %f\n", i, j, output->data.F32[i][j], expect); 47 47 testStatus = false; 48 48 } … … 261 261 262 262 if (rc->type.type != scale->type.type) { 263 printf(" ERROR: output readout->image has incorrect type.\n");263 printf("TEST ERROR: output readout->image has incorrect type.\n"); 264 264 testStatus = false; 265 265 } 266 266 psFree(rc); 267 267 } else { 268 printf(" ERROR: pmReadoutCombine() returned NULL\n");268 printf("TEST ERROR: pmReadoutCombine() returned NULL\n"); 269 269 testStatus = false; 270 270 … … 275 275 rc = pmReadoutCombine(NULL, list, params, zeroHalf, scale, true, 0.0, 0.0); 276 276 if (rc != NULL) { 277 printf(" ERROR: pmReadoutCombine() did not return NULL\n");277 printf("TEST ERROR: pmReadoutCombine() did not return NULL\n"); 278 278 testStatus = false; 279 279 } … … 283 283 rc = pmReadoutCombine(NULL, list, params, zeroF64, scale, true, 0.0, 0.0); 284 284 if (rc != NULL) { 285 printf(" ERROR: pmReadoutCombine() did not return NULL\n");285 printf("TEST ERROR: pmReadoutCombine() did not return NULL\n"); 286 286 testStatus = false; 287 287 } … … 300 300 rc = NULL; 301 301 } else { 302 printf(" ERROR: pmReadoutCombine() returned NULL\n");302 printf("TEST ERROR: pmReadoutCombine() returned NULL\n"); 303 303 testStatus = false; 304 304 } … … 316 316 317 317 if (rc->type.type != scale->type.type) { 318 printf(" ERROR: output readout->image has incorrect type.\n");318 printf("TEST ERROR: output readout->image has incorrect type.\n"); 319 319 testStatus = false; 320 320 } 321 321 psFree(rc); 322 322 } else { 323 printf(" ERROR: pmReadoutCombine() returned NULL\n");323 printf("TEST ERROR: pmReadoutCombine() returned NULL\n"); 324 324 testStatus = false; 325 325 … … 330 330 rc = pmReadoutCombine(output, list, params, zero, scaleHalf, true, 0.0, 0.0); 331 331 if (rc != NULL) { 332 printf(" ERROR: pmReadoutCombine() did not return NULL\n");332 printf("TEST ERROR: pmReadoutCombine() did not return NULL\n"); 333 333 testStatus = false; 334 334 } … … 338 338 rc = pmReadoutCombine(output, list, params, zero, scaleF64, true, 0.0, 0.0); 339 339 if (rc != NULL) { 340 printf(" ERROR: pmReadoutCombine() did not return NULL\n");340 printf("TEST ERROR: pmReadoutCombine() did not return NULL\n"); 341 341 testStatus = false; 342 342 } … … 355 355 rc = NULL; 356 356 } else { 357 printf(" ERROR: pmReadoutCombine() returned NULL\n");357 printf("TEST ERROR: pmReadoutCombine() returned NULL\n"); 358 358 testStatus = false; 359 359 } … … 364 364 rc = pmReadoutCombine(output, list, params, zero, scale, true, 0.0, 0.0); 365 365 if (rc != NULL) { 366 printf(" ERROR: pmReadoutCombine() did not return NULL\n");366 printf("TEST ERROR: pmReadoutCombine() did not return NULL\n"); 367 367 testStatus = false; 368 368 } … … 377 377 rc = pmReadoutCombine(output, list, params, zero, scale, true, 0.0, 0.0); 378 378 if (rc != NULL) { 379 printf(" ERROR: pmReadoutCombine() did not return NULL\n");379 printf("TEST ERROR: pmReadoutCombine() did not return NULL\n"); 380 380 testStatus = false; 381 381 } … … 387 387 rc = pmReadoutCombine(output, NULL, params, zero, scale, true, 0.0, 0.0); 388 388 if (rc != NULL) { 389 printf(" ERROR: pmReadoutCombine() did not return NULL\n");389 printf("TEST ERROR: pmReadoutCombine() did not return NULL\n"); 390 390 testStatus = false; 391 391 } … … 395 395 rc = pmReadoutCombine(output, list, NULL, zero, scale, true, 0.0, 0.0); 396 396 if (rc != NULL) { 397 printf(" ERROR: pmReadoutCombine() did not return NULL\n");397 printf("TEST ERROR: pmReadoutCombine() did not return NULL\n"); 398 398 testStatus = false; 399 399 } … … 404 404 rc = pmReadoutCombine(output, list, params, zero, scale, true, 0.0, 0.0); 405 405 if (rc != NULL) { 406 printf(" ERROR: pmReadoutCombine() did not return NULL\n");406 printf("TEST ERROR: pmReadoutCombine() did not return NULL\n"); 407 407 testStatus = false; 408 408 } … … 412 412 psStats *oldStats = params->stats; 413 413 printf("Calling pmReadoutCombine() with NULL param->stats. Should generate error, return NULL.\n"); 414 params->stats = NULL; 414 415 rc = pmReadoutCombine(output, list, params, zero, scale, true, 0.0, 0.0); 415 416 if (rc != NULL) { 416 printf(" ERROR: pmReadoutCombine() did not return NULL\n");417 printf("TEST ERROR: pmReadoutCombine() did not return NULL\n"); 417 418 testStatus = false; 418 419 } -
trunk/psModules/test/tst_pmSubtractBias.c
r2856 r2915 13 13 * @author GLG, MHPCC 14 14 * 15 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $16 * @date $Date: 200 4-12-30 21:35:04$15 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2005-01-05 23:25:25 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 82 82 actual = myReadout->image->data.F32[i][j]; 83 83 if (FLT_EPSILON < fabs(expect - actual)) { 84 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);84 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 85 85 testStatus = 1; 86 86 } … … 150 150 actual = myReadout->image->data.F32[i][j]; 151 151 if (FLT_EPSILON < fabs(expect - actual)) { 152 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);152 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 153 153 testStatus = 1; 154 154 } … … 223 223 actual = myReadout->image->data.F32[i][j]; 224 224 if (FLT_EPSILON < fabs(expect - actual)) { 225 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);225 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 226 226 testStatus = 1; 227 227 } … … 285 285 actual = myReadout->image->data.F32[i][j]; 286 286 if (FLT_EPSILON < fabs(expect - actual)) { 287 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);287 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 288 288 testStatus = 1; 289 289 } … … 351 351 actual = myReadout->image->data.F32[i][j]; 352 352 if (FLT_EPSILON < fabs(expect - actual)) { 353 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);353 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 354 354 testStatus = 1; 355 355 } … … 431 431 actual = myReadout->image->data.F32[i][j]; 432 432 if (FLT_EPSILON < fabs(expect - actual)) { 433 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);433 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 434 434 testStatus = 1; 435 435 } … … 505 505 actual = myReadout->image->data.F32[i][j]; 506 506 if (FLT_EPSILON < fabs(expect - actual)) { 507 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);507 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 508 508 testStatus = 1; 509 509 } … … 614 614 rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_ALL, stat, 0, PM_FIT_NONE, NULL); 615 615 if (rc != myReadout) { 616 printf(" ERROR: pmSubtractBias() did not return input psReadout.\n");616 printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n"); 617 617 testStatus = false; 618 618 } … … 622 622 rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_ROWS, stat, 0, PM_FIT_NONE, NULL); 623 623 if (rc != myReadout) { 624 printf(" ERROR: pmSubtractBias() did not return input psReadout.\n");624 printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n"); 625 625 testStatus = false; 626 626 psFree(rc); … … 631 631 rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_COLUMNS, stat, 0, PM_FIT_NONE, NULL); 632 632 if (rc != myReadout) { 633 printf(" ERROR: pmSubtractBias() did not return input psReadout.\n");633 printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n"); 634 634 testStatus = false; 635 635 psFree(rc); … … 645 645 psF32 actual = rc->image->data.F32[i][j]; 646 646 if (FLT_EPSILON < fabs(expect - actual)) { 647 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);647 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 648 648 testStatus = 1; 649 649 } … … 664 664 psF32 actual = rc->image->data.F32[i][j]; 665 665 if (FLT_EPSILON < fabs(expect - actual)) { 666 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);666 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 667 667 testStatus = 1; 668 668 } … … 681 681 psF32 actual = rc->image->data.F32[i][j]; 682 682 if (FLT_EPSILON < fabs(expect - actual)) { 683 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);683 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 684 684 testStatus = 1; 685 685 } … … 695 695 rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, stat, 0, PM_FIT_SPLINE, myBias); 696 696 if (rc != myReadout) { 697 printf(" ERROR: pmSubtractBias() did not return input psReadout.\n");697 printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n"); 698 698 testStatus = false; 699 699 psFree(rc); … … 705 705 psF32 actual = rc->image->data.F32[i][j]; 706 706 if (FLT_EPSILON < fabs(expect - actual)) { 707 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);707 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 708 708 testStatus = 1; 709 709 } … … 725 725 psF32 actual = rc->image->data.F32[i][j]; 726 726 if (FLT_EPSILON < fabs(expect - actual)) { 727 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);727 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 728 728 testStatus = 1; 729 729 } … … 742 742 psF32 actual = rc->image->data.F32[i][j]; 743 743 if (FLT_EPSILON < fabs(expect - actual)) { 744 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);744 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 745 745 testStatus = 1; 746 746 } … … 759 759 psF32 actual = rc->image->data.F32[i][j]; 760 760 if (FLT_EPSILON < fabs(expect - actual)) { 761 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);761 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 762 762 testStatus = 1; 763 763 } … … 771 771 0, PM_FIT_NONE, myBiasShortRows); 772 772 if (rc != myReadout) { 773 printf(" ERROR: pmSubtractBias() did not return input psReadout.\n");773 printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n"); 774 774 testStatus = false; 775 775 psFree(rc); … … 782 782 0, PM_FIT_NONE, myBiasShortCols); 783 783 if (rc != myReadout) { 784 printf(" ERROR: pmSubtractBias() did not return input psReadout.\n");784 printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n"); 785 785 testStatus = false; 786 786 psFree(rc); … … 792 792 0, 54321, NULL); 793 793 if (rc != myReadout) { 794 printf(" ERROR: pmSubtractBias() did not return input psReadout.\n");794 printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n"); 795 795 testStatus = false; 796 796 psFree(rc); … … 802 802 0, PM_FIT_NONE, NULL); 803 803 if (rc != myReadout) { 804 printf(" ERROR: pmSubtractBias() did not return input psReadout.\n");804 printf("TEST ERROR: pmSubtractBias() did not return input psReadout.\n"); 805 805 testStatus = false; 806 806 psFree(rc); … … 813 813 psF32 actual = rc->image->data.F32[i][j]; 814 814 if (FLT_EPSILON < fabs(expect - actual)) { 815 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);815 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 816 816 testStatus = 1; 817 817 } … … 921 921 actual = myReadout->image->data.F32[i][j]; 922 922 if (FLT_EPSILON < fabs(expect - actual)) { 923 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect);923 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 924 924 testStatus = 1; 925 925 } -
trunk/psModules/test/tst_pmSubtractSky.c
r2856 r2915 7 7 * @author GLG, MHPCC 8 8 * 9 * @version $Revision: 1. 6$ $Name: not supported by cvs2svn $10 * @date $Date: 200 4-12-30 21:35:04$9 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2005-01-05 23:25:25 $ 11 11 * 12 12 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 65 65 for (j=0;j<numCols;j++) { 66 66 if (ERROR_TOLERANCE < fabs(myReadout->image->data.F32[i][j])) { 67 printf(" ERROR: image[%d][%d] is %f, should be 0.0\n", i, j, myReadout->image->data.F32[i][j]);67 printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j, myReadout->image->data.F32[i][j]); 68 68 testStatus = 1; 69 69 } … … 113 113 for (j=0;j<numCols;j++) { 114 114 if (errorTolerance < fabs(myReadout->image->data.F32[i][j] - trueImage->data.F32[i][j])) { 115 printf(" ERROR: image[%d][%d] is %f, should be %f\n", i, j,115 printf("TEST ERROR: image[%d][%d] is %f, should be %f\n", i, j, 116 116 myReadout->image->data.F32[i][j], trueImage->data.F32[i][j]); 117 117 testStatus = 1; … … 201 201 rc = pmSubtractSky(NULL, (void *) myPoly, PM_FIT_POLYNOMIAL, 1, myStats, 2.0); 202 202 if (rc != NULL) { 203 printf(" ERROR: pmSubtractSky() returned a non-NULL psReadout\n");203 printf("TEST ERROR: pmSubtractSky() returned a non-NULL psReadout\n"); 204 204 testStatus = false; 205 205 } … … 210 210 rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_POLYNOMIAL, 1, myStats, 2.0); 211 211 if (rc != NULL) { 212 printf(" ERROR: pmSubtractSky() returned a non-NULL psReadout\n");212 printf("TEST ERROR: pmSubtractSky() returned a non-NULL psReadout\n"); 213 213 testStatus = false; 214 214 } … … 220 220 rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_POLYNOMIAL, 1, myStats, 2.0); 221 221 if (rc != NULL) { 222 printf(" ERROR: pmSubtractSky() returned a non-NULL psReadout\n");223 testStatus = false; 224 } 225 myReadout->image = tmpImageF32; 226 227 printf("----------------------------------------------------------------\n"); 228 printf("Calling pmSubtractSky() with NULL fitSpec. Should return image, no ERROR, no WARNING.\n\n");222 printf("TEST ERROR: pmSubtractSky() returned a non-NULL psReadout\n"); 223 testStatus = false; 224 } 225 myReadout->image = tmpImageF32; 226 227 printf("----------------------------------------------------------------\n"); 228 printf("Calling pmSubtractSky() with NULL fitSpec. Should return image, no TEST ERROR, no WARNING.\n\n"); 229 229 rc = pmSubtractSky(myReadout, NULL, PM_FIT_POLYNOMIAL, 1, myStats, 2.0); 230 230 if (rc != myReadout) { 231 printf(" ERROR: pmSubtractSky() returned something other than psReadout\n");232 testStatus = false; 233 } 234 235 printf("----------------------------------------------------------------\n"); 236 printf("Calling pmSubtractSky() with PM_FIT_NONE fit. Should return image, no ERROR, no WARNING.\n\n");231 printf("TEST ERROR: pmSubtractSky() returned something other than psReadout\n"); 232 testStatus = false; 233 } 234 235 printf("----------------------------------------------------------------\n"); 236 printf("Calling pmSubtractSky() with PM_FIT_NONE fit. Should return image, no TEST ERROR, no WARNING.\n\n"); 237 237 rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_NONE, 1, myStats, 2.0); 238 238 if (rc != myReadout) { 239 printf(" ERROR: pmSubtractSky() returned something other than psReadout\n");240 testStatus = false; 241 } 242 243 printf("----------------------------------------------------------------\n"); 244 printf("Calling pmSubtractSky() with PM_FIT_SPLINE fit. Should return image, no ERROR, no WARNING.\n\n");239 printf("TEST ERROR: pmSubtractSky() returned something other than psReadout\n"); 240 testStatus = false; 241 } 242 243 printf("----------------------------------------------------------------\n"); 244 printf("Calling pmSubtractSky() with PM_FIT_SPLINE fit. Should return image, no TEST ERROR, no WARNING.\n\n"); 245 245 rc = pmSubtractSky(myReadout, (void *) myPoly, PM_FIT_SPLINE, 1, myStats, 2.0); 246 246 if (rc != myReadout) { 247 printf(" ERROR: pmSubtractSky() returned something other than psReadout\n");247 printf("TEST ERROR: pmSubtractSky() returned something other than psReadout\n"); 248 248 testStatus = false; 249 249 } … … 255 255 for (j=0;j<NUM_COLS_SMALL;j++) { 256 256 if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) { 257 printf(" ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,257 printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j, 258 258 rc->image->data.F32[i][j]); 259 259 testStatus = false; … … 270 270 for (j=0;j<NUM_COLS_SMALL;j++) { 271 271 if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) { 272 printf(" ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,272 printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j, 273 273 rc->image->data.F32[i][j]); 274 274 testStatus = false; … … 286 286 for (j=0;j<NUM_COLS_SMALL;j++) { 287 287 if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) { 288 printf(" ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,288 printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j, 289 289 rc->image->data.F32[i][j]); 290 290 testStatus = false; … … 300 300 for (j=0;j<NUM_COLS_SMALL;j++) { 301 301 if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) { 302 printf(" ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,302 printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j, 303 303 rc->image->data.F32[i][j]); 304 304 testStatus = false; … … 313 313 for (j=0;j<NUM_COLS_SMALL;j++) { 314 314 if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) { 315 printf(" ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,315 printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j, 316 316 rc->image->data.F32[i][j]); 317 317 testStatus = false; … … 326 326 for (j=0;j<NUM_COLS_SMALL;j++) { 327 327 if (ERROR_TOLERANCE < fabs(rc->image->data.F32[i][j])) { 328 printf(" ERROR: image[%d][%d] is %f, should be 0.0\n", i, j,328 printf("TEST ERROR: image[%d][%d] is %f, should be 0.0\n", i, j, 329 329 rc->image->data.F32[i][j]); 330 330 testStatus = false; … … 337 337 rc = pmSubtractSky(myReadout, (void *) myPoly, 54321, 1, myStats, -1.0); 338 338 if (rc != myReadout) { 339 printf(" ERROR: pmSubtractSky() returned something other than psReadout\n");339 printf("TEST ERROR: pmSubtractSky() returned something other than psReadout\n"); 340 340 testStatus = false; 341 341 }
Note:
See TracChangeset
for help on using the changeset viewer.
