- Timestamp:
- Jan 2, 2010, 6:13:37 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091201/psModules/src/imcombine/pmSubtractionEquation.c
r26470 r26502 15 15 #include "pmSubtractionVisual.h" 16 16 17 // #define TESTING // TESTING output for debugging; may not work with threads!17 // #define TESTING // TESTING output for debugging; may not work with threads! 18 18 19 19 #define USE_WEIGHT // Include weight (1/variance) in equation? 20 #define USE_WINDOW // Include weight (1/variance) in equation?20 // #define USE_WINDOW // Include weight (1/variance) in equation? 21 21 22 22 … … 157 157 if (mode & PM_SUBTRACTION_EQUATION_KERNELS) { 158 158 vector->data.F64[iIndex] = sumIC * poly[iTerm]; 159 if (!(mode & PM_SUBTRACTION_EQUATION_NORM)) { 159 // XXX TEST for Hermitians: do not calculate A - norm*B - \sum(k x B), 160 // instead, calculate A - \sum(k x B), with full hermitians 161 if (0 && !(mode & PM_SUBTRACTION_EQUATION_NORM)) { 160 162 // subtract norm * sumRC * poly[iTerm] 161 163 psAssert (kernels->solution1, "programming error: define solution first!"); … … 228 230 const psKernel *image2, // Image 2 229 231 const psKernel *weight, // Weight image 232 const psKernel *window, // Window image 230 233 const psArray *convolutions1, // Convolutions of image 1 for each kernel 231 234 const psArray *convolutions2, // Convolutions of image 2 for each kernel … … 291 294 ab *= wtVal; 292 295 } 296 if (window) { 297 float wtVal = window->kernel[y][x]; 298 aa *= wtVal; 299 bb *= wtVal; 300 ab *= wtVal; 301 } 293 302 sumAA += aa; 294 303 sumBB += bb; … … 319 328 if (weight) { 320 329 ab *= weight->kernel[y][x]; 330 } 331 if (window) { 332 ab *= window->kernel[y][x]; 321 333 } 322 334 sumAB += ab; … … 365 377 i2 *= wtVal; 366 378 } 379 if (window) { 380 float wtVal = window->kernel[y][x]; 381 ai2 *= wtVal; 382 bi2 *= wtVal; 383 ai1 *= wtVal; 384 bi1 *= wtVal; 385 i1i2 *= wtVal; 386 a *= wtVal; 387 b *= wtVal; 388 i2 *= wtVal; 389 } 367 390 sumAI2 += ai2; 368 391 sumBI2 += bi2; … … 411 434 if (weight) { 412 435 float wtVal = weight->kernel[y][x]; 436 i1 *= wtVal; 437 i1i1 *= wtVal; 438 one *= wtVal; 439 i2 *= wtVal; 440 i1i2 *= wtVal; 441 } 442 if (window) { 443 float wtVal = window->kernel[y][x]; 413 444 i1 *= wtVal; 414 445 i1i1 *= wtVal; … … 516 547 for (int xOrder = 0; xOrder <= spatialOrder - yOrder; xOrder++, index += numKernels) { 517 548 // Contribution to chi^2: a_i^2 P_i 549 if (!isfinite(penalties->data.F32[i])) { 550 psAbort ("invalid penalty"); 551 } 518 552 matrix->data.F64[index][index] -= norm * penalties->data.F32[i]; 519 553 } … … 702 736 break; 703 737 case PM_SUBTRACTION_MODE_DUAL: 704 psAbort ("dual is disabled: need to add window and calculation mode");705 738 if (new) { 706 739 stamp->matrix2 = psImageAlloc(numKernels * numSpatial, numKernels * numSpatial, PS_TYPE_F64); … … 714 747 #endif 715 748 status = calculateDualMatrixVector(stamp->matrix1, stamp->vector1, stamp->matrix2, stamp->vector2, 716 stamp->matrixX, stamp->image1, stamp->image2, weight, 749 stamp->matrixX, stamp->image1, stamp->image2, weight, window, 717 750 stamp->convolutions1, stamp->convolutions2, kernels, polyValues, 718 751 footprint); … … 1587 1620 } 1588 1621 } 1622 1623 // XXX visualize the target, source, convolution and residual 1624 pmSubtractionVisualShowFitAddStamp (image2, image1, residual, background, norm, i); 1625 1589 1626 for (int y = - footprint; y <= footprint; y++) { 1590 1627 for (int x = - footprint; x <= footprint; x++) {
Note:
See TracChangeset
for help on using the changeset viewer.
