Changeset 32839
- Timestamp:
- Nov 30, 2011, 11:41:21 AM (15 years ago)
- Location:
- tags/ipp-20111110/ppSub
- Files:
-
- 7 edited
-
. (modified) (1 prop)
-
src (modified) (1 prop)
-
src/ppSubFlagNeighbors.c (modified) (5 diffs)
-
src/ppSubLoop.c (modified) (1 prop)
-
src/ppSubMakePSF.c (modified) (1 prop)
-
src/ppSubMatchPSFs.c (modified) (1 prop)
-
src/ppSubReadoutPhotometry.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20111110/ppSub
- Property svn:mergeinfo set to
-
tags/ipp-20111110/ppSub/src
- Property svn:mergeinfo changed
/trunk/ppSub/src merged: 32807,32822
- Property svn:mergeinfo changed
-
tags/ipp-20111110/ppSub/src/ppSubFlagNeighbors.c
r31449 r32839 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; … … 187 221 pmPhotObj *obj = objects->data[j]; 188 222 223 // fprintf (stderr, "%f, %f vs %f, %f\n", src->peak->xf, src->peak->yf, obj->x, obj->y); 224 189 225 if (!src) NEXT1; 190 226 if (!src->peak) NEXT1; … … 209 245 src = sources->data[I]; 210 246 211 if (!src) NEXT1;212 if (!src->peak) NEXT1;213 if (!isfinite(src->peak->xf)) NEXT1;214 if (!isfinite(src->peak->yf)) NEXT1;215 if (!isfinite(src->peak->detValue)) NEXT1;216 if (sqrt(src->peak->detValue) < MIN_SN) NEXT1;247 if (!src) continue; 248 if (!src->peak) continue; 249 if (!isfinite(src->peak->xf)) continue; 250 if (!isfinite(src->peak->yf)) continue; 251 if (!isfinite(src->peak->detValue)) continue; 252 if (sqrt(src->peak->detValue) < MIN_SN) continue; 217 253 218 254 dx = src->peak->xf - obj->x; -
tags/ipp-20111110/ppSub/src/ppSubLoop.c
- Property svn:mergeinfo deleted
-
tags/ipp-20111110/ppSub/src/ppSubMakePSF.c
- Property svn:mergeinfo deleted
-
tags/ipp-20111110/ppSub/src/ppSubMatchPSFs.c
- Property svn:mergeinfo deleted
-
tags/ipp-20111110/ppSub/src/ppSubReadoutPhotometry.c
r31449 r32839 92 92 // detections in the wings (or cores) of bright(er) stars found in both images. 93 93 // flag detections based on their distance from the bright(er) input sources. 94 bool matchRef= !strcasecmp(name, "PPSUB.INVERSE");95 ppSubFlagNeighbors (config, view, sources, matchRef);94 bool subInverse = !strcasecmp(name, "PPSUB.INVERSE"); 95 ppSubFlagNeighbors (config, view, sources, subInverse); 96 96 97 97 if (data->stats) {
Note:
See TracChangeset
for help on using the changeset viewer.
