Changeset 21213 for branches/pap_branch_20090128/psphot/src/psphotOutput.c
- Timestamp:
- Jan 28, 2009, 2:51:53 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/pap_branch_20090128/psphot/src/psphotOutput.c
r21183 r21213 18 18 19 19 pmReadout *psphotSelectBackgroundStdev (pmConfig *config, 20 const pmFPAview *view) {20 const pmFPAview *view) { 21 21 22 22 bool status; … … 77 77 continue; 78 78 } 79 // skip zero- weightpoints80 if (source-> weight->data.F32[i][j] == 0) {79 // skip zero-variance points 80 if (source->variance->data.F32[i][j] == 0) { 81 81 continue; 82 82 } … … 86 86 (i + source->pixels->row0), 87 87 source->pixels->data.F32[i][j], 88 1.0 / source-> weight->data.F32[i][j],88 1.0 / source->variance->data.F32[i][j], 89 89 source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[i][j]); 90 90 } … … 124 124 if (model == NULL) 125 125 continue; 126 if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) {127 nEXT ++;128 }129 if (source->mode & PM_SOURCE_MODE_CR_LIMIT) {130 nCR ++;131 }126 if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) { 127 nEXT ++; 128 } 129 if (source->mode & PM_SOURCE_MODE_CR_LIMIT) { 130 nCR ++; 131 } 132 132 nSrc ++; 133 133 } … … 242 242 243 243 for (int i = 0; i < try->sources->n; i++) { 244 // masked for: bad model fit, outlier in parameters245 if (try->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL)246 continue;247 248 pmSource *source = try->sources->data[i];249 float x = source->modelPSF->params->data.F32[PM_PAR_XPOS];250 float y = source->modelPSF->params->data.F32[PM_PAR_YPOS];251 252 // set the mask and subtract the PSF model253 // XXX should we be using maskObj? should we be unsetting the mask?254 // use pmModelSub because modelFlux has not been generated255 assert (source->maskObj);256 psImageKeepCircle (source->maskObj, x, y, radius, "OR", markVal);257 pmModelSub (source->pixels, source->maskObj, source->modelPSF, PM_MODEL_OP_FULL, maskVal);258 psImageKeepCircle (source->maskObj, x, y, radius, "AND", PS_NOT_IMAGE_MASK(markVal));244 // masked for: bad model fit, outlier in parameters 245 if (try->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL) 246 continue; 247 248 pmSource *source = try->sources->data[i]; 249 float x = source->modelPSF->params->data.F32[PM_PAR_XPOS]; 250 float y = source->modelPSF->params->data.F32[PM_PAR_YPOS]; 251 252 // set the mask and subtract the PSF model 253 // XXX should we be using maskObj? should we be unsetting the mask? 254 // use pmModelSub because modelFlux has not been generated 255 assert (source->maskObj); 256 psImageKeepCircle (source->maskObj, x, y, radius, "OR", markVal); 257 pmModelSub (source->pixels, source->maskObj, source->modelPSF, PM_MODEL_OP_FULL, maskVal); 258 psImageKeepCircle (source->maskObj, x, y, radius, "AND", PS_NOT_IMAGE_MASK(markVal)); 259 259 } 260 260 261 261 FILE *f = fopen ("shapes.dat", "w"); 262 262 for (int i = 0; i < try->sources->n; i++) { 263 psF32 inPar[10]; // must be psF32 to pmPSF_FitToModel264 265 // masked for: bad model fit, outlier in parameters266 if (try->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL) continue;267 268 pmSource *source = try->sources->data[i];269 psF32 *outPar = source->modelEXT->params->data.F32;270 271 psEllipseShape shape;272 273 shape.sx = outPar[PM_PAR_SXX] / M_SQRT2;274 shape.sy = outPar[PM_PAR_SYY] / M_SQRT2;275 shape.sxy = outPar[PM_PAR_SXY];276 277 psEllipsePol pol = pmPSF_ModelToFit (outPar);278 inPar[PM_PAR_E0] = pol.e0;279 inPar[PM_PAR_E1] = pol.e1;280 inPar[PM_PAR_E2] = pol.e2;281 pmPSF_FitToModel (inPar, 0.1);282 283 psEllipseAxes axes1 = psEllipseShapeToAxes (shape, 20.0);284 psEllipseAxes axes2 = psEllipsePolToAxes(pol, 0.1);285 286 psEllipsePol pol2 = psEllipseAxesToPol (axes1);287 288 fprintf (f, "%3d %7.2f %7.2f %7.4f %7.4f %7.4f -- %7.4f %7.4f %7.4f : %7.4f %7.4f %7.4f -- %7.4f %7.4f %7.4f : %7.4f %7.4f %6.1f : %7.4f %7.4f %6.1f\n",289 i, outPar[PM_PAR_XPOS], outPar[PM_PAR_YPOS],290 outPar[PM_PAR_SXX], outPar[PM_PAR_SXY], outPar[PM_PAR_SYY],291 pol.e0, pol.e1, pol.e2,292 pol2.e0, pol2.e1, pol2.e2,293 inPar[PM_PAR_SXX], inPar[PM_PAR_SXY], inPar[PM_PAR_SYY],294 axes1.major, axes1.minor, axes1.theta*PM_DEG_RAD,295 axes2.major, axes2.minor, axes2.theta*PM_DEG_RAD296 );263 psF32 inPar[10]; // must be psF32 to pmPSF_FitToModel 264 265 // masked for: bad model fit, outlier in parameters 266 if (try->mask->data.PS_TYPE_VECTOR_MASK_DATA[i] & PSFTRY_MASK_ALL) continue; 267 268 pmSource *source = try->sources->data[i]; 269 psF32 *outPar = source->modelEXT->params->data.F32; 270 271 psEllipseShape shape; 272 273 shape.sx = outPar[PM_PAR_SXX] / M_SQRT2; 274 shape.sy = outPar[PM_PAR_SYY] / M_SQRT2; 275 shape.sxy = outPar[PM_PAR_SXY]; 276 277 psEllipsePol pol = pmPSF_ModelToFit (outPar); 278 inPar[PM_PAR_E0] = pol.e0; 279 inPar[PM_PAR_E1] = pol.e1; 280 inPar[PM_PAR_E2] = pol.e2; 281 pmPSF_FitToModel (inPar, 0.1); 282 283 psEllipseAxes axes1 = psEllipseShapeToAxes (shape, 20.0); 284 psEllipseAxes axes2 = psEllipsePolToAxes(pol, 0.1); 285 286 psEllipsePol pol2 = psEllipseAxesToPol (axes1); 287 288 fprintf (f, "%3d %7.2f %7.2f %7.4f %7.4f %7.4f -- %7.4f %7.4f %7.4f : %7.4f %7.4f %7.4f -- %7.4f %7.4f %7.4f : %7.4f %7.4f %6.1f : %7.4f %7.4f %6.1f\n", 289 i, outPar[PM_PAR_XPOS], outPar[PM_PAR_YPOS], 290 outPar[PM_PAR_SXX], outPar[PM_PAR_SXY], outPar[PM_PAR_SYY], 291 pol.e0, pol.e1, pol.e2, 292 pol2.e0, pol2.e1, pol2.e2, 293 inPar[PM_PAR_SXX], inPar[PM_PAR_SXY], inPar[PM_PAR_SYY], 294 axes1.major, axes1.minor, axes1.theta*PM_DEG_RAD, 295 axes2.major, axes2.minor, axes2.theta*PM_DEG_RAD 296 ); 297 297 } 298 298 fclose (f);
Note:
See TracChangeset
for help on using the changeset viewer.
