Changeset 9340
- Timestamp:
- Oct 5, 2006, 5:33:49 PM (20 years ago)
- Location:
- trunk/psModules/src/detrend
- Files:
-
- 2 edited
-
pmShutterCorrection.c (modified) (4 diffs)
-
pmShutterCorrection.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/detrend/pmShutterCorrection.c
r9336 r9340 362 362 psImage *pmShutterCorrectionMeasure(const psVector *exptimes, // Exposure times 363 363 const psArray *images, // Input images 364 const psArray *weights, // Weight images 364 365 const psArray *masks, // Mask images 365 366 unsigned int size, // Size of samples … … 377 378 PS_ASSERT_ARRAYS_SIZE_EQUAL(images, masks, NULL); 378 379 } 380 if (weights) { 381 PS_ASSERT_ARRAYS_SIZE_EQUAL(images, weights, NULL); 382 } 379 383 long num = images->n; // Number of images 380 384 PS_ASSERT_VECTOR_SIZE(exptimes, num, NULL); 385 PS_ASSERT_INT_POSITIVE(nIter, 0, NULL); 386 PS_ASSERT_FLOAT_LARGER_THAN(rej, 0.0, NULL); 381 387 382 388 // Check input sizes, generate first-pass statistics … … 493 499 psTrace("psModules.detrend", 3, "Mean reference value: %f\n", meanRef); 494 500 501 // Check the weights 502 if (weights && nIter > 1) { 503 for (int i = 0; i < weights->n && nIter > 1; i++) { 504 psImage *weight = weights->data[i]; // Weight image 505 if (!weight) { 506 // We don't have weights, so no realistic errors: turn off iteration 507 if (nIter > 0) { 508 psWarning("Not all images have weights --- turning weighting off.\n"); 509 } 510 nIter = 1; 511 } 512 } 513 } 514 495 515 psImage *shutter = psImageAlloc(numCols, numRows, PS_TYPE_F32); // Shutter correction image 496 516 //psImage *pattern = psImageAlloc(numCols, numRows, PS_TYPE_F32); // Illumination pattern … … 503 523 for (int i = 0; i < num; i++) { 504 524 psImage *image = images->data[i]; // Image of interest 525 counts->data.F32[i] = image->data.F32[y][x] * refs->data.F32[i]; 505 526 psImage *maskImage; // Mask image 506 527 if (masks && (maskImage = masks->data[i])) { 507 528 mask->data.U8[i] = maskImage->data.U8[y][x]; 508 529 } 509 counts->data.F32[i] = image->data.F32[y][x] * refs->data.F32[i]; 510 errors->data.F32[i] = sqrtf(image->data.F32[y][x]) * refs->data.F32[i]; 530 psImage *weight; // Weight image 531 if (weights && (weight = weights->data[i])) { 532 errors->data.F32[i] = sqrtf(weight->data.F32[y][x]) * refs->data.F32[i]; 533 } else { 534 errors->data.F32[i] = sqrtf(image->data.F32[y][x]) * refs->data.F32[i]; 535 } 511 536 } 512 537 -
trunk/psModules/src/detrend/pmShutterCorrection.h
r9336 r9340 48 48 * @author Eugene Magnier, IfA 49 49 * 50 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $51 * @date $Date: 2006-10-06 03: 06:30$50 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 51 * @date $Date: 2006-10-06 03:33:49 $ 52 52 * 53 53 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 99 99 psImage *pmShutterCorrectionMeasure(const psVector *exptimes, // Exposure times 100 100 const psArray *images, // Input images 101 const psArray *weights, // Weight images 101 102 const psArray *masks, // Mask images 102 103 unsigned int size, // Size of samples
Note:
See TracChangeset
for help on using the changeset viewer.
