- Timestamp:
- Jun 6, 2011, 1:56:22 PM (15 years ago)
- Location:
- branches/czw_branch/20110406
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20110406
- Property svn:mergeinfo changed
-
branches/czw_branch/20110406/psphot
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20110404/psphot (added) merged: 31313-31314,31328,31337,31362,31364,31381,31384,31437,31444
- Property svn:mergeinfo changed
-
branches/czw_branch/20110406/psphot/src/psphotMagnitudes.c
r31154 r31606 167 167 pmSource *source = (pmSource *) sources->data[i]; 168 168 169 bool saveTest = false; 170 psImage *testImage = NULL; 171 # if (0) 172 if ((fabs(source->peak->xf-3518) < 5) && (fabs(source->peak->yf-3178) < 5)) { 173 saveTest = true; 174 psRegion subregion = psRegionSet (source->peak->xf - 200, source->peak->xf + 200, source->peak->yf - 200, source->peak->yf + 200); 175 testImage = psImageSubset ((psImage *) source->pixels->parent, subregion); 176 } 177 # endif 178 179 if (saveTest) { 180 psphotSaveImage(NULL, testImage, "test.image.1.fits"); 181 } 182 169 183 // replace object in image 170 184 if (source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED) { … … 172 186 } 173 187 188 if (saveTest) { 189 psphotSaveImage(NULL, testImage, "test.image.2.fits"); 190 } 191 192 float xPos = source->peak->xf; 193 float yPos = source->peak->yf; 194 195 pmModel *model = source->modelPSF; 196 if (model) { 197 xPos = model->params->data.F32[PM_PAR_XPOS]; 198 yPos = model->params->data.F32[PM_PAR_YPOS]; 199 } else { 200 bool useMoments = pmSourcePositionUseMoments(source); 201 if (useMoments) { 202 xPos = source->moments->Mx; 203 yPos = source->moments->My; 204 } 205 } 206 174 207 // clear the mask bit and set the circular mask pixels 175 208 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); 176 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, source->apRadius, "OR", markVal);209 psImageKeepCircle (source->maskObj, xPos, yPos, source->apRadius, "OR", markVal); 177 210 178 211 status = pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, source->apRadius); 179 if (status && isfinite(source->apMag)) Nap ++; 212 if (status && isfinite(source->apFlux)) { 213 Nap ++; 214 } else { 215 fprintf (stderr, "failed to measure mag for source @ %f,%f\n", source->peak->xf, source->peak->yf); 216 } 180 217 181 218 // clear the mask bit … … 185 222 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); 186 223 224 if (saveTest) { 225 psphotSaveImage(NULL, testImage, "test.image.3.fits"); 226 } 227 187 228 if (backModel) { 188 229 psAssert (binning, "if backModel is defined, so should binning be"); 189 source->sky = psImageUnbinPixel( source->peak->x, source->peak->y, backModel->image, binning);230 source->sky = psImageUnbinPixel(xPos, yPos, backModel->image, binning); 190 231 if (isnan(source->sky) && false) { 191 232 psLogMsg ("psphot.magnitudes", PS_LOG_DETAIL, "error setting pmSource.sky"); … … 197 238 if (backStdev) { 198 239 psAssert (binning, "if backStdev is defined, so should binning be"); 199 source->skyErr = psImageUnbinPixel( source->peak->x, source->peak->y, backStdev->image, binning);240 source->skyErr = psImageUnbinPixel(xPos, yPos, backStdev->image, binning); 200 241 if (isnan(source->skyErr) && false) { 201 242 psLogMsg ("psphot.magnitudes", PS_LOG_DETAIL, "error setting pmSource.skyErr");
Note:
See TracChangeset
for help on using the changeset viewer.
