Changeset 2838
- Timestamp:
- Dec 28, 2004, 9:04:30 AM (22 years ago)
- Location:
- trunk/psModules
- Files:
-
- 3 edited
-
src/pmSubtractBias.c (modified) (4 diffs)
-
src/pmSubtractSky.c (modified) (2 diffs)
-
test/tst_pmSubtractBias.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmSubtractBias.c
r2777 r2838 6 6 * @author George Gusciora, MHPCC 7 7 * 8 * @version $Revision: 1. 19$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-12-2 1 20:41:29 $8 * @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-12-28 19:04:29 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 233 233 psSpline1D *mySpline; 234 234 int nBin; 235 // 235 // XXX: This comment isn't right? 236 236 // Determine if multiple options are specified in stat. 237 237 // … … 241 241 242 242 if (overScanAxis == PM_OVERSCAN_NONE) { 243 if (fit != PM_FIT_NONE) { 244 psLogMsg(__func__, PS_LOG_WARN, 245 "WARNING: pmSubtractBias.(): overScanAxis equals NONE, and fit does not equal NONE\n"); 246 } 247 243 248 if (overscans != NULL) { 244 249 psLogMsg(__func__, PS_LOG_WARN, … … 248 253 } 249 254 250 if (((overScanAxis == PM_OVERSCAN_NONE) || 251 (overScanAxis == PM_OVERSCAN_ALL)) && 252 (fit == PM_FIT_NONE)) { 255 if ((overScanAxis == PM_OVERSCAN_ALL) && (fit != PM_FIT_NONE)) { 253 256 psLogMsg(__func__, PS_LOG_WARN, 254 "WARNING: pmSubtractBias.(): overScanAxis equals NONE or ALL, and fit equalsNONE\n");257 "WARNING: pmSubtractBias.(): overScanAxis equals ALL, and fit does not equal NONE\n"); 255 258 } 256 259 -
trunk/psModules/src/pmSubtractSky.c
r2812 r2838 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-12-2 3 23:16:36$8 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-12-28 19:04:29 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 202 202 203 203 XXX: Use a psImage for the p_psPolySums data structure? 204 XXX: Check for positive x- and y-Order.205 204 XXX: Use variable size arrays for p_psPolySums[][]. 206 XXX "Must initialize p_psPolySums[][]?205 XXX: Must initialize p_psPolySums[][]? 207 206 *****************************************************************************/ 208 207 #define PS_MAX_POLYNOMIAL_ORDER 20 -
trunk/psModules/test/tst_pmSubtractBias.c
r2756 r2838 13 13 * @author GLG, MHPCC 14 14 * 15 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $16 * @date $Date: 2004-12- 18 02:27:55$15 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2004-12-28 19:04:30 $ 17 17 * 18 18 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 26 26 static int test02(void); 27 27 static int test03(void); 28 static int test04(void); 28 29 testDescription tests[] = { 29 {test00, 000, "pmSubtractBias", 0, false}, 30 {test01, 000, "pmSubtractBias", 0, false}, 31 {test02, 000, "pmSubtractBias", 0, false}, 32 {test03, 000, "pmSubtractBias", 0, false}, 30 /* 31 {test00, 000, "pmSubtractBias", 0, false}, 32 {test01, 000, "pmSubtractBias", 0, false}, 33 {test02, 000, "pmSubtractBias", 0, false}, 34 {test03, 000, "pmSubtractBias", 0, false}, 35 */ 36 {test04, 000, "pmSubtractBias", 0, false}, 33 37 {NULL} 34 38 }; … … 294 298 295 299 296 297 298 299 300 301 302 300 int doSubtractOverscansTestInputCases(int numCols, int numRows) 301 { 302 int i; 303 int j; 304 int testStatus = 0; 305 psImage *tmpImage1 = psImageAlloc(numCols, numRows, PS_TYPE_F32); 306 psImage *tmpImage2 = psImageAlloc(numCols, numRows, PS_TYPE_F32); 307 psImage *tmpImage3 = psImageAlloc(numCols, numRows, PS_TYPE_F32); 308 psImage *tmpImage4 = psImageAlloc(numCols, numRows, PS_TYPE_F32); 309 psReadout *myReadout = psReadoutAlloc(numCols, numRows, tmpImage1); 310 psReadout *rc = NULL; 311 psList *list; 312 psStats *stat = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 313 psImage *tmpImage5 = psImageAlloc(numCols, numRows, PS_TYPE_F32); 314 psReadout *myBias = psReadoutAlloc(numCols, numRows, tmpImage5); 315 316 for (i=0;i<numRows;i++) { 317 for (j=0;j<numCols;j++) { 318 myReadout->image->data.F32[i][j] = (float) (i + j); 319 tmpImage2->data.F32[i][j] = 3.0; 320 tmpImage3->data.F32[i][j] = 4.0; 321 tmpImage4->data.F32[i][j] = 5.0; 322 myBias->image->data.F32[i][j] = 1.0; 323 } 324 } 325 list = psListAlloc(tmpImage2); 326 psListAdd(list, PS_LIST_HEAD, tmpImage3); 327 psListAdd(list, PS_LIST_HEAD, tmpImage4); 328 329 printf("------------------------------------------------------------------\n"); 330 printf("Calling pmSubtractBias() with NULL overscan list and PM_OVERSCAN_ALL. Should generate error.\n"); 331 rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_ALL, stat, 0, PM_FIT_NONE, NULL); 332 if (rc != myReadout) { 333 printf("ERROR: pmSubtractBias() did not return input psReadout.\n"); 334 testStatus = false; 335 } 336 337 printf("------------------------------------------------------------------\n"); 338 printf("Calling pmSubtractBias() with NULL overscan list and PM_OVERSCAN_ROWS. Should generate error.\n"); 339 rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_ROWS, stat, 0, PM_FIT_NONE, NULL); 340 if (rc != myReadout) { 341 printf("ERROR: pmSubtractBias() did not return input psReadout.\n"); 342 testStatus = false; 343 psFree(rc); 344 } 345 346 printf("------------------------------------------------------------------\n"); 347 printf("Calling pmSubtractBias() with NULL overscan list and PM_OVERSCAN_COLUMNS. Should generate error.\n"); 348 rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_COLUMNS, stat, 0, PM_FIT_NONE, NULL); 349 if (rc != myReadout) { 350 printf("ERROR: pmSubtractBias() did not return input psReadout.\n"); 351 testStatus = false; 352 psFree(rc); 353 } 354 355 printf("------------------------------------------------------------------\n"); 356 printf("Calling pmSubtractBias() with non-NULL overscan list and PM_OVERSCAN_NONE. Should generate warning.\n"); 357 rc = pmSubtractBias(myReadout, NULL, list, PM_OVERSCAN_NONE, stat, 358 0, PM_FIT_NONE, myBias); 359 360 for (i=0;i<numRows;i++) { 361 for (j=0;j<numCols;j++) { 362 psF32 expect = ((float) (i + j)) - 1.0; 363 psF32 actual = rc->image->data.F32[i][j]; 364 if (FLT_EPSILON < fabs(expect - actual)) { 365 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 366 testStatus = 1; 367 } 368 369 // Restore myReadout for next test. 370 myReadout->image->data.F32[i][j] = (float) (i + j); 371 } 372 } 373 374 printf("------------------------------------------------------------------\n"); 375 printf("Calling pmSubtractBias() with NULL overscan list and PM_OVERSCAN_NONE. Should generate warning.\n"); 376 rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, stat, 377 0, PM_FIT_NONE, myBias); 378 379 for (i=0;i<numRows;i++) { 380 for (j=0;j<numCols;j++) { 381 psF32 expect = ((float) (i + j)) - 1.0; 382 psF32 actual = rc->image->data.F32[i][j]; 383 if (FLT_EPSILON < fabs(expect - actual)) { 384 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 385 testStatus = 1; 386 } 387 388 // Restore myReadout for next test. 389 myReadout->image->data.F32[i][j] = (float) (i + j); 390 } 391 } 392 393 printf("------------------------------------------------------------------\n"); 394 printf("Calling pmSubtractBias() with PM_OVERSCAN_NONE and PM_FIT_POLYNOMIAL. Should generate Warning.\n"); 395 rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, stat, 0, PM_FIT_POLYNOMIAL, myBias); 396 for (i=0;i<numRows;i++) { 397 for (j=0;j<numCols;j++) { 398 psF32 expect = ((float) (i + j)) - 1.0; 399 psF32 actual = rc->image->data.F32[i][j]; 400 if (FLT_EPSILON < fabs(expect - actual)) { 401 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 402 testStatus = 1; 403 } 404 405 // Restore myReadout for next test. 406 myReadout->image->data.F32[i][j] = (float) (i + j); 407 } 408 } 409 410 411 printf("------------------------------------------------------------------\n"); 412 printf("Calling pmSubtractBias() with PM_OVERSCAN_ALL and PM_FIT_SPLINE. Should generate Warning.\n"); 413 rc = pmSubtractBias(myReadout, NULL, NULL, PM_OVERSCAN_NONE, stat, 0, PM_FIT_SPLINE, myBias); 414 if (rc != myReadout) { 415 printf("ERROR: pmSubtractBias() did not return input psReadout.\n"); 416 testStatus = false; 417 psFree(rc); 418 } 419 420 for (i=0;i<numRows;i++) { 421 for (j=0;j<numCols;j++) { 422 psF32 expect = ((float) (i + j)) - 1.0; 423 psF32 actual = rc->image->data.F32[i][j]; 424 if (FLT_EPSILON < fabs(expect - actual)) { 425 printf("ERROR: image[%d][%d] is %f, should be %f\n", i, j, actual, expect); 426 testStatus = 1; 427 } 428 429 // Restore myReadout for next test. 430 myReadout->image->data.F32[i][j] = (float) (i + j); 431 } 432 } 433 434 435 436 printf("------------------------------------------------------------------\n"); 437 psFree(myReadout); 438 psFree(tmpImage2); 439 psFree(tmpImage3); 440 psFree(tmpImage4); 441 psFree(myBias); 442 psFree(stat); 443 psFree(list); 444 445 return(testStatus); 446 } 447 448 int test04( void ) 449 { 450 int testStatus = 0; 451 452 testStatus |= doSubtractOverscansTestInputCases(NUM_COLS, NUM_ROWS); 453 return(testStatus); 454 } 455 456 457 //This code will ...
Note:
See TracChangeset
for help on using the changeset viewer.
