Changeset 32822 for trunk/ppSub/src/ppSubFlagNeighbors.c
- Timestamp:
- Nov 25, 2011, 2:30:40 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/ppSub/src/ppSubFlagNeighbors.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSub/src/ppSubFlagNeighbors.c
r32807 r32822 18 18 #include "ppSub.h" 19 19 20 # define MIN_ERROR 0.02 /* padding for self-match flux test */ 21 # define MAX_OFFSET 5.0 /* delta mag greater than this is not a self match */ 22 20 23 // match the diff sources to the detections from the positive or negative input images 21 24 // matchRef : false if this is the standard diff image, true if this is the inverse (in-ref vs ref-in) 22 25 // this is needed to choose which value is positive and which is negative relative to the difference 23 bool ppSubFlagNeighbors(pmConfig *config, pmFPAview *view, psArray *sources, bool matchRef) {26 bool ppSubFlagNeighbors(pmConfig *config, pmFPAview *view, psArray *sources, bool subInverse) { 24 27 25 28 bool status; … … 106 109 psAssert ((sourceM1->imageID == 1) || (sourceM1->imageID == 2), "error in pmPhotObj construction (second entry is not from 1 or 2"); 107 110 111 // which image gives the match, the positive or negative one? 112 bool positive = false; 113 if (subInverse) { 114 positive = (sourceM1->imageID == 2); 115 } else { 116 positive = (sourceM1->imageID == 1); 117 } 118 119 // check if source and sourceM1 are likely to be the same flux (ie, isolated detection in one image) 120 if (positive && isfinite(sourceM1->psfMag) && isfinite(source->psfMag)) { 121 float dMag = sourceM1->psfMag - source->psfMag; 122 float nSig = fabs(dMag) / hypot(MIN_ERROR, source->psfMagErr); 123 if (nSig < MAX_OFFSET) { 124 source->mode2 |= PM_SOURCE_MODE2_DIFF_SELF_MATCH; 125 } 126 } 127 108 128 // only one match. set a flag? 109 129 source->mode2 |= PM_SOURCE_MODE2_DIFF_WITH_SINGLE; 110 130 if (source->diffStats) { 111 // which is match need an xor here...112 bool positive = !matchRef && (sourceM1->imageID == 1);113 positive |= matchRef && (sourceM1->imageID == 2);114 131 float SN1 = isfinite(sourceM1->psfMagErr) ? 1.0 / sourceM1->psfMagErr : NAN; 115 132 if (positive) { … … 133 150 psAssert (sourceM1->imageID != sourceM2->imageID, "error in pmPhotObj construction (case 3.3)"); 134 151 152 // we don't know which matched source (sourceM1 or sourceM2) is the positive detection, 153 // and the answer depends on both the ID and the subtraction order (in-ref vs ref-in) 154 // positive is true if sourceM1 is the positive detection 155 bool positive = false; 156 if (subInverse) { 157 positive = (sourceM1->imageID == 2); 158 } else { 159 positive = (sourceM1->imageID == 1); 160 } 161 162 // check for self-detection 163 float magPSF1 = positive ? sourceM1->psfMag : sourceM2->psfMag; 164 if (isfinite(magPSF1) && isfinite(source->psfMag)) { 165 float dMag = magPSF1 - source->psfMag; 166 float nSig = fabs(dMag) / hypot(MIN_ERROR, source->psfMagErr); 167 if (nSig < MAX_OFFSET) { 168 source->mode2 |= PM_SOURCE_MODE2_DIFF_SELF_MATCH; 169 } 170 } 171 135 172 source->mode2 |= PM_SOURCE_MODE2_DIFF_WITH_DOUBLE; 136 173 if (source->diffStats) { 137 // which is match need an xor here...138 bool positive = !matchRef && (sourceM1->imageID == 1);139 positive |= matchRef && (sourceM1->imageID == 2);140 174 float SN1 = isfinite(sourceM1->psfMagErr) ? 1.0 / sourceM1->psfMagErr : NAN; 141 175 float SN2 = isfinite(sourceM2->psfMagErr) ? 1.0 / sourceM2->psfMagErr : NAN;
Note:
See TracChangeset
for help on using the changeset viewer.
