Changeset 19881
- Timestamp:
- Oct 3, 2008, 11:00:18 AM (18 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 12 edited
-
models/pmModel_STRAIL.c (modified) (3 diffs)
-
models/pmModel_TEST1.c (modified) (1 diff)
-
psphotBlendFit.c (modified) (4 diffs)
-
psphotChoosePSF.c (modified) (1 diff)
-
psphotExtendedSourceAnalysis.c (modified) (5 diffs)
-
psphotExtendedSourceFits.c (modified) (4 diffs)
-
psphotFakeSources.c (modified) (1 diff)
-
psphotGuessModels.c (modified) (1 diff)
-
psphotModelTest.c (modified) (1 diff)
-
psphotMosaicSubimage.c (modified) (1 diff)
-
psphotSourceFits.c (modified) (3 diffs)
-
psphotSummaryPlots.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/models/pmModel_STRAIL.c
r15843 r19881 478 478 { 479 479 pmMoments *Smoments = source->moments; 480 pmPeak *peak = source->peak; 480 481 psF32 *params = model->params->data.F32; 481 482 … … 484 485 psEllipseMoments moments; 485 486 486 moments.x2 = PS_SQR(Smoments->Sx);487 moments.y2 = PS_SQR(Smoments->Sy);488 moments.xy = Smoments-> Sxy;487 moments.x2 = Smoments->Mxx; 488 moments.y2 = Smoments->Myy; 489 moments.xy = Smoments->Mxy; 489 490 //sometimes these moment inputs are zero...why? 490 491 … … 494 495 shape = psEllipseAxesToShape(axes); 495 496 496 params[0] = Smoments->Sky; 497 params[1] = Smoments->Peak - Smoments->Sky; 498 params[2] = Smoments->x; 499 params[3] = Smoments->y; 497 params[PM_PAR_SKY] = Smoments->Sky; 498 params[PM_PAR_I0] = peak->flux; 499 params[PM_PAR_XPOS] = peak->xf; 500 params[PM_PAR_YPOS] = peak->yf; 501 500 502 params[7] = 2 * axes.major; 501 503 params[8] = axes.theta; -
trunk/psphot/src/models/pmModel_TEST1.c
r15843 r19881 126 126 { 127 127 pmMoments *moments = source->moments; 128 pmPeak *peak = source->peak; 128 129 psF32 *PAR = model->params->data.F32; 129 130 131 psEllipseMoments emoments; 132 emoments.x2 = moments->Mxx; 133 emoments.y2 = moments->Myy; 134 emoments.xy = moments->Mxy; 135 136 // force the axis ratio to be < 20.0 137 psEllipseAxes axes = psEllipseMomentsToAxes (emoments, 20.0); 138 psEllipseShape shape = psEllipseAxesToShape (axes); 139 130 140 PAR[PM_PAR_SKY] = moments->Sky; 131 PAR[PM_PAR_I0] = moments->Peak - moments->Sky; 132 PAR[PM_PAR_XPOS] = moments->x; 133 PAR[PM_PAR_YPOS] = moments->y; 134 PAR[PM_PAR_SXX] = PS_MAX(0.5, moments->Sx); 135 PAR[PM_PAR_SYY] = PS_MAX(0.5, moments->Sy); 141 PAR[PM_PAR_I0] = peak->flux; 142 PAR[PM_PAR_XPOS] = peak->xf; 143 PAR[PM_PAR_YPOS] = peak->yf; 144 PAR[PM_PAR_SXX] = PS_MAX(0.5, M_SQRT2*shape.sx); 145 PAR[PM_PAR_SYY] = PS_MAX(0.5, M_SQRT2*shape.sy); 146 PAR[PM_PAR_SXY] = shape.sxy; 136 147 PAR[PM_PAR_SXY] = 0.0; // XXX we can get this right if we do the integral 137 148 -
trunk/psphot/src/psphotBlendFit.c
r19869 r19881 55 55 56 56 // limit selection to some SN limit 57 // XXX this should use peak? 58 if (source->moments == NULL) continue; 59 if (source->moments->SN < FIT_SN_LIM) continue; 57 if (source->peak->SN < FIT_SN_LIM) continue; 60 58 61 59 // XXX this should use peak? 62 if (source-> moments->x< AnalysisRegion.x0) continue;63 if (source-> moments->y< AnalysisRegion.y0) continue;64 if (source-> moments->x> AnalysisRegion.x1) continue;65 if (source-> moments->y> AnalysisRegion.y1) continue;60 if (source->peak->xf < AnalysisRegion.x0) continue; 61 if (source->peak->yf < AnalysisRegion.y0) continue; 62 if (source->peak->xf > AnalysisRegion.x1) continue; 63 if (source->peak->yf > AnalysisRegion.y1) continue; 66 64 67 65 // if model is NULL, we don't have a starting guess … … 95 93 if (psphotFitBlob (readout, source, sources, psf, maskVal, markVal)) { 96 94 source->type = PM_SOURCE_TYPE_EXTENDED; 97 psTrace ("psphot", 5, "source at %7.1f, %7.1f is ext", source-> moments->x, source->moments->y);95 psTrace ("psphot", 5, "source at %7.1f, %7.1f is ext", source->peak->xf, source->peak->yf); 98 96 Next ++; 99 97 continue; … … 102 100 if (psphotFitBlend (readout, source, psf, maskVal, markVal)) { 103 101 source->type = PM_SOURCE_TYPE_STAR; 104 psTrace ("psphot", 5, "source at %7.1f, %7.1f is psf", source-> moments->x, source->moments->y);102 psTrace ("psphot", 5, "source at %7.1f, %7.1f is psf", source->peak->xf, source->peak->yf); 105 103 Npsf ++; 106 104 continue; … … 108 106 } 109 107 110 psTrace ("psphot", 5, "source at %7.1f, %7.1f failed", source-> moments->x, source->moments->y);108 psTrace ("psphot", 5, "source at %7.1f, %7.1f failed", source->peak->xf, source->peak->yf); 111 109 Nfail ++; 112 110 -
trunk/psphot/src/psphotChoosePSF.c
r19793 r19881 474 474 if (!(source->mode & PM_SOURCE_MODE_PSFSTAR)) continue; 475 475 476 // moments->Sx,Sy are roughly sigma_x,y 477 moments.x2 = PS_SQR(source->moments->Sx); 478 moments.y2 = PS_SQR(source->moments->Sy); 479 moments.xy = source->moments->Sxy; 476 moments.x2 = source->moments->Mxx; 477 moments.y2 = source->moments->Myy; 478 moments.xy = source->moments->Mxy; 480 479 481 480 // limit axis ratio < 20.0 -
trunk/psphot/src/psphotExtendedSourceAnalysis.c
r17396 r19881 71 71 // all measurements below require the radial profile; skip them all 72 72 // re-subtract the object, leave local sky 73 psTrace ("psphot", 5, "failed to extract radial profile for source at %7.1f, %7.1f", source->moments-> x, source->moments->y);73 psTrace ("psphot", 5, "failed to extract radial profile for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 74 74 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); 75 75 source->mode |= PM_SOURCE_MODE_SUBTRACTED; … … 81 81 if (doIsophotal) { 82 82 if (!psphotIsophotal (source, recipe, maskVal)) { 83 psTrace ("psphot", 5, "failed to measure isophotal mags for source at %7.1f, %7.1f", source->moments-> x, source->moments->y);83 psTrace ("psphot", 5, "failed to measure isophotal mags for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 84 84 } else { 85 psTrace ("psphot", 5, "measured isophotal mags for source at %7.1f, %7.1f", source->moments-> x, source->moments->y);85 psTrace ("psphot", 5, "measured isophotal mags for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 86 86 Nisophot ++; 87 87 } … … 91 91 if (doPetrosian) { 92 92 if (!psphotPetrosian (source, recipe, maskVal)) { 93 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments-> x, source->moments->y);93 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 94 94 } else { 95 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments-> x, source->moments->y);95 psTrace ("psphot", 5, "measured petrosian flux & radius for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 96 96 Npetro ++; 97 97 } … … 101 101 if (doKron) { 102 102 if (!psphotKron (source, recipe, maskVal)) { 103 psTrace ("psphot", 5, "failed to measure kron mags for source at %7.1f, %7.1f", source->moments-> x, source->moments->y);103 psTrace ("psphot", 5, "failed to measure kron mags for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 104 104 } else { 105 psTrace ("psphot", 5, "measure kron mags for source at %7.1f, %7.1f", source->moments-> x, source->moments->y);105 psTrace ("psphot", 5, "measure kron mags for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 106 106 Nkron ++; 107 107 } … … 114 114 return false; 115 115 } 116 psTrace ("psphot", 5, "measured annuli for source at %7.1f, %7.1f", source->moments-> x, source->moments->y);116 psTrace ("psphot", 5, "measured annuli for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 117 117 Nannuli ++; 118 118 } -
trunk/psphot/src/psphotExtendedSourceFits.c
r19237 r19881 163 163 modelFit = psphotPSFConvModel (readout, source, modelType, maskVal, markVal, psfSize); 164 164 if (!modelFit) { 165 psTrace ("psphot", 5, "failed to fit psf-conv model for object at %f, %f", source->moments-> x, source->moments->y);165 psTrace ("psphot", 5, "failed to fit psf-conv model for object at %f, %f", source->moments->Mx, source->moments->My); 166 166 continue; 167 167 } 168 psTrace ("psphot", 4, "fit psf-conv model for %f, %f : %s chisq = %f\n", source->moments-> x, source->moments->y, pmModelClassGetName (modelFit->type), modelFit->chisq);168 psTrace ("psphot", 4, "fit psf-conv model for %f, %f : %s chisq = %f\n", source->moments->Mx, source->moments->My, pmModelClassGetName (modelFit->type), modelFit->chisq); 169 169 Nconvolve ++; 170 170 if (!(modelFit->flags & (PM_MODEL_STATUS_BADARGS | PM_MODEL_STATUS_NONCONVERGE | PM_MODEL_STATUS_OFFIMAGE))) { … … 176 176 modelFit = psphotFitEXT (readout, source, modelType, maskVal, markVal); 177 177 if (!modelFit) { 178 psTrace ("psphot", 5, "failed to fit plain model for object at %f, %f", source->moments-> x, source->moments->y);178 psTrace ("psphot", 5, "failed to fit plain model for object at %f, %f", source->moments->Mx, source->moments->My); 179 179 continue; 180 180 } 181 181 pmSourceCacheModel (source, maskVal); 182 psTrace ("psphot", 4, "fit plain model for %f, %f : %s chisq = %f\n", source->moments-> x, source->moments->y, pmModelClassGetName (modelFit->type), modelFit->chisq);182 psTrace ("psphot", 4, "fit plain model for %f, %f : %s chisq = %f\n", source->moments->Mx, source->moments->My, pmModelClassGetName (modelFit->type), modelFit->chisq); 183 183 Nplain ++; 184 184 if (!(modelFit->flags & (PM_MODEL_STATUS_BADARGS | PM_MODEL_STATUS_NONCONVERGE | PM_MODEL_STATUS_OFFIMAGE))) { … … 217 217 if (minModel == -1) { 218 218 // re-subtract the object, leave local sky 219 psTrace ("psphot", 5, "failed to fit extended source model to object at %f, %f", source->moments-> x, source->moments->y);219 psTrace ("psphot", 5, "failed to fit extended source model to object at %f, %f", source->moments->Mx, source->moments->My); 220 220 221 221 // replace original model, subtract it … … 257 257 psFree (modelFluxes); 258 258 259 psTrace ("psphot", 4, "best ext model for %f, %f : %s chisq = %f\n", source->moments-> x, source->moments->y, pmModelClassGetName (source->modelEXT->type), source->modelEXT->chisq);260 psTrace ("psphot", 5, "extended source model for source at %7.1f, %7.1f", source->moments-> x, source->moments->y);259 psTrace ("psphot", 4, "best ext model for %f, %f : %s chisq = %f\n", source->moments->Mx, source->moments->My, pmModelClassGetName (source->modelEXT->type), source->modelEXT->chisq); 260 psTrace ("psphot", 5, "extended source model for source at %7.1f, %7.1f", source->moments->Mx, source->moments->My); 261 261 262 262 if (savePics) { -
trunk/psphot/src/psphotFakeSources.c
r14655 r19881 10 10 pmSource *source = pmSourceAlloc (); 11 11 source->moments = pmMomentsAlloc (); 12 source->moments-> x = 10;13 source->moments-> y = 10;14 source->moments-> Sx = 1;15 source->moments-> Sy = 1;16 source->moments-> Sxy = 0;12 source->moments->Mx = 10; 13 source->moments->My = 10; 14 source->moments->Mxx = 1; 15 source->moments->Myy = 1; 16 source->moments->Mxy = 0; 17 17 source->moments->Sum = 1000; 18 18 source->moments->Peak = 100; -
trunk/psphot/src/psphotGuessModels.c
r18555 r19881 59 59 // these valuse are set in pmSourceModelGuess, should this rule be in there as well? 60 60 if (source->mode & PM_SOURCE_MODE_SATSTAR) { 61 modelEXT->params->data.F32[PM_PAR_XPOS] = source->moments-> x;62 modelEXT->params->data.F32[PM_PAR_YPOS] = source->moments-> y;61 modelEXT->params->data.F32[PM_PAR_XPOS] = source->moments->Mx; 62 modelEXT->params->data.F32[PM_PAR_YPOS] = source->moments->My; 63 63 } else { 64 64 modelEXT->params->data.F32[PM_PAR_XPOS] = source->peak->xf; -
trunk/psphot/src/psphotModelTest.c
r18555 r19881 143 143 source->peak->value = source->moments->Peak; 144 144 145 fprintf (stderr, "sum: %f @ (%f, %f)\n", source->moments->Sum, source->moments-> x, source->moments->y);146 fprintf (stderr, "moments: %f, %f - %f\n", source->moments-> Sx, source->moments->Sy, source->moments->Sxy);145 fprintf (stderr, "sum: %f @ (%f, %f)\n", source->moments->Sum, source->moments->Mx, source->moments->My); 146 fprintf (stderr, "moments: %f, %f - %f\n", source->moments->Mxx, source->moments->Myy, source->moments->Mxy); 147 147 148 148 psEllipseMoments moments; 149 moments.x2 = source->moments-> Sx;150 moments.y2 = source->moments-> Sy;151 moments.xy = source->moments-> Sxy;149 moments.x2 = source->moments->Mxx; 150 moments.y2 = source->moments->Myy; 151 moments.xy = source->moments->Mxy; 152 152 psEllipseAxes axes = psEllipseMomentsToAxes (moments, 20.0); 153 153 -
trunk/psphot/src/psphotMosaicSubimage.c
r19869 r19881 38 38 newImage->data.F32[iy][ix] = subImage->data.F32[iy][ix] / peak; 39 39 } else { 40 newImage->data.F32[iy][ix] = subImage->data.F32[iy][ix] / peak;40 newImage->data.F32[iy][ix] = subImage->data.F32[iy][ix]; 41 41 } 42 42 } -
trunk/psphot/src/psphotSourceFits.c
r19869 r19881 218 218 if (source->type == PM_SOURCE_TYPE_DEFECT) return false; 219 219 if (source->type == PM_SOURCE_TYPE_SATURATED) return false; 220 if (source-> moments->SN < EXT_MIN_SN) return false;220 if (source->peak->SN < EXT_MIN_SN) return false; 221 221 222 222 // recalculate the source moments using the larger extended-source moments radius … … 331 331 maskVal |= markVal; 332 332 333 // XXX this is really poor: if we don't have moments for the source, we have no guess. 334 // force the measurement? 335 psAssert (source->moments, "moments are re-calculated for any extended source"); 336 333 337 // make a guess at the position of the two sources 334 moments.x2 = source->moments-> Sx;335 moments. y2 = source->moments->Sy;336 moments. xy = source->moments->Sxy;338 moments.x2 = source->moments->Mxx; 339 moments.xy = source->moments->Mxy; 340 moments.y2 = source->moments->Myy; 337 341 axes = psEllipseMomentsToAxes (moments, 20.0); 338 342 … … 380 384 psphotCheckRadiusEXT (readout, source, EXT, markVal); 381 385 382 if ((source->moments-> Sx < 1e-3) || (source->moments->Sx< 1e-3)) {383 psTrace ("psphot", 5, "problem source: moments: %f %f\n", source->moments-> Sx, source->moments->Sy);386 if ((source->moments->Mxx < 1e-3) || (source->moments->Myy < 1e-3)) { 387 psTrace ("psphot", 5, "problem source: moments: %f %f\n", source->moments->Mxx, source->moments->Myy); 384 388 } 385 389 -
trunk/psphot/src/psphotSummaryPlots.c
r13477 r19881 61 61 if (source->moments == NULL) continue; 62 62 63 xFaint->data.F32[nF] = source->moments-> Sx;64 yFaint->data.F32[nF] = source->moments-> Sy;63 xFaint->data.F32[nF] = source->moments->Mxx; 64 yFaint->data.F32[nF] = source->moments->Myy; 65 65 nF++; 66 66 … … 68 68 if (source->moments->SN < 25) continue; 69 69 70 xBright->data.F32[nB] = source->moments-> Sx;71 yBright->data.F32[nB] = source->moments-> Sy;70 xBright->data.F32[nB] = source->moments->Mxx; 71 yBright->data.F32[nB] = source->moments->Myy; 72 72 nB++; 73 73 } … … 160 160 161 161 psEllipseMoments moments; 162 moments.x2 = source->moments-> Sx;163 moments. y2 = source->moments->Sy;164 moments. xy = source->moments->Sxy;162 moments.x2 = source->moments->Mxx; 163 moments.xy = source->moments->Mxy; 164 moments.y2 = source->moments->Myy; 165 165 166 166 psEllipseShape shape;
Note:
See TracChangeset
for help on using the changeset viewer.
