Changeset 12977
- Timestamp:
- Apr 23, 2007, 4:39:12 PM (19 years ago)
- Location:
- branches/eam_02_branch/psModules/src/objects
- Files:
-
- 2 edited
-
pmSourcePhotometry.c (modified) (4 diffs)
-
pmSourcePhotometry.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_02_branch/psModules/src/objects/pmSourcePhotometry.c
r12958 r12977 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1.22.4. 5$ $Name: not supported by cvs2svn $6 * @date $Date: 2007-04-2 3 18:04:18$5 * @version $Revision: 1.22.4.6 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2007-04-24 02:39:04 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 369 369 } 370 370 371 # if (0) 371 372 double pmSourceCrossProduct (const pmSource *Mi, 372 373 const pmSource *Mj, … … 527 528 return flux; 528 529 } 530 # endif 529 531 530 532 bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight) … … 549 551 } 550 552 553 554 double pmSourceModelWeight(const pmSource *Mi, 555 int term, 556 const bool unweighted_sum) // should the cross product be weighted? 557 { 558 double flux = 0, wt = 0, factor = 0; 559 560 const psImage *Pi = Mi->modelFlux; 561 const psImage *Wi = Mi->weight; 562 const psImage *Ti = Mi->maskObj; 563 564 for (int yi = 0; yi < Pi->numRows; yi++) { 565 for (int xi = 0; xi < Pi->numCols; xi++) { 566 if (Ti->data.U8[yi][xi]) 567 continue; 568 if (!unweighted_sum) { 569 wt = Wi->data.F32[yi][xi]; 570 if (wt == 0) 571 continue; 572 } 573 574 switch (term) { 575 case 0: 576 factor = 1; 577 break; 578 case 1: 579 factor = xi + Pi->col0; 580 break; 581 case 2: 582 factor = yi + Pi->row0; 583 break; 584 default: 585 psAbort("invalid term for pmSourceWeight"); 586 } 587 588 if (unweighted_sum) { 589 flux += (factor * Pi->data.F32[yi][xi]); 590 } else { 591 flux += (factor * Pi->data.F32[yi][xi]) / wt; 592 } 593 } 594 } 595 return flux; 596 } 597 598 double pmSourceModelDotModel (const pmSource *Mi, 599 const pmSource *Mj, 600 const bool unweighted_sum) // should the cross product be weighted? 601 { 602 int Xs, Xe, Ys, Ye; 603 int xi, xj, yi, yj; 604 int xIs, xJs, yIs, yJs; 605 int xIe, yIe; 606 double flux, wt; 607 608 const psImage *Pi = Mi->modelFlux; 609 const psImage *Pj = Mj->modelFlux; 610 611 const psImage *Wi = Mi->weight; 612 613 const psImage *Ti = Mi->maskObj; 614 const psImage *Tj = Mj->maskObj; 615 616 Xs = PS_MAX (Pi->col0, Pj->col0); 617 Xe = PS_MIN (Pi->col0 + Pi->numCols, Pj->col0 + Pj->numCols); 618 619 Ys = PS_MAX (Pi->row0, Pj->row0); 620 Ye = PS_MIN (Pi->row0 + Pi->numRows, Pj->row0 + Pj->numRows); 621 622 xIs = Xs - Pi->col0; 623 xJs = Xs - Pj->col0; 624 yIs = Ys - Pi->row0; 625 yJs = Ys - Pj->row0; 626 627 xIe = Xe - Pi->col0; 628 yIe = Ye - Pi->row0; 629 630 // note that weight is addressing the same image pixels 631 flux = 0; 632 for (yi = yIs, yj = yJs; yi < yIe; yi++, yj++) { 633 for (xi = xIs, xj = xJs; xi < xIe; xi++, xj++) { 634 if (Ti->data.U8[yi][xi]) 635 continue; 636 if (Tj->data.U8[yj][xj]) 637 continue; 638 639 // XXX skip the nonsense weight pixels? 640 if (unweighted_sum) { 641 flux += (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]); 642 } else { 643 wt = Wi->data.F32[yi][xi]; 644 if (wt > 0) { 645 flux += (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]) / wt; 646 } 647 } 648 } 649 } 650 return flux; 651 } 652 653 double pmSourceDataDotModel (const pmSource *Mi, 654 const pmSource *Mj, 655 const bool unweighted_sum) // should the cross product be weighted? 656 { 657 658 int Xs, Xe, Ys, Ye; 659 int xi, xj, yi, yj; 660 int xIs, xJs, yIs, yJs; 661 int xIe, yIe; 662 double flux, wt; 663 664 const psImage *Pi = Mi->pixels; 665 const psImage *Pj = Mj->modelFlux; 666 667 const psImage *Wi = Mi->weight; 668 669 const psImage *Ti = Mi->maskObj; 670 const psImage *Tj = Mj->maskObj; 671 672 Xs = PS_MAX (Pi->col0, Pj->col0); 673 Xe = PS_MIN (Pi->col0 + Pi->numCols, Pj->col0 + Pj->numCols); 674 675 Ys = PS_MAX (Pi->row0, Pj->row0); 676 Ye = PS_MIN (Pi->row0 + Pi->numRows, Pj->row0 + Pj->numRows); 677 678 xIs = Xs - Pi->col0; 679 xJs = Xs - Pj->col0; 680 yIs = Ys - Pi->row0; 681 yJs = Ys - Pj->row0; 682 683 xIe = Xe - Pi->col0; 684 yIe = Ye - Pi->row0; 685 686 // note that weight is addressing the same image pixels, 687 flux = 0; 688 for (yi = yIs, yj = yJs; yi < yIe; yi++, yj++) { 689 for (xi = xIs, xj = xJs; xi < xIe; xi++, xj++) { 690 if (Ti->data.U8[yi][xi]) 691 continue; 692 if (Tj->data.U8[yj][xj]) 693 continue; 694 695 // XXX skip the nonsense weight pixels? 696 if (unweighted_sum) { 697 flux += (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]); 698 } else { 699 wt = Wi->data.F32[yi][xi]; 700 if (wt > 0) { 701 flux += (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]) / wt; 702 } 703 } 704 } 705 } 706 return flux; 707 } 708 -
branches/eam_02_branch/psModules/src/objects/pmSourcePhotometry.h
r12958 r12977 4 4 * @author EAM, IfA; GLG, MHPCC 5 5 * 6 * @version $Revision: 1.8.6. 1$ $Name: not supported by cvs2svn $7 * @date $Date: 2007-04-2 3 18:04:18$6 * @version $Revision: 1.8.6.2 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2007-04-24 02:39:12 $ 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 9 9 */ … … 50 50 bool pmSourceMagnitudesInit (psMetadata *config); 51 51 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode); 52 double pmSourceCrossProduct(const pmSource *Mi, const pmSource *Mj, const bool unweighted_sum);53 double pmSourceCrossWeight(const pmSource *Mi, const pmSource *Mj, const bool unweighted_sum);54 52 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask); 55 53 bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight); 56 54 57 double pmSourceWeight(const pmSource *Mi, int term, const bool unweighted_sum); 55 56 double pmSourceDataDotModel (const pmSource *Mi, const pmSource *Mj, const bool unweighted_sum); 57 double pmSourceModelDotModel (const pmSource *Mi, const pmSource *Mj, const bool unweighted_sum); 58 double pmSourceModelWeight(const pmSource *Mi, int term, const bool unweighted_sum); 59 60 // retire these: 61 // double pmSourceCrossProduct(const pmSource *Mi, const pmSource *Mj, const bool unweighted_sum); 62 // double pmSourceCrossWeight(const pmSource *Mi, const pmSource *Mj, const bool unweighted_sum); 63 // double pmSourceWeight(const pmSource *Mi, int term, const bool unweighted_sum); 58 64 59 65 /// @}
Note:
See TracChangeset
for help on using the changeset viewer.
