Changeset 36327
- Timestamp:
- Nov 30, 2013, 1:35:54 PM (13 years ago)
- Location:
- branches/eam_branches/ipp-20130904/psphot/src
- Files:
-
- 6 edited
-
psphotEllipticalContour.c (modified) (1 diff)
-
psphotExtendedSourceFits.c (modified) (9 diffs)
-
psphotPetrosianRadialBins.c (modified) (1 diff)
-
psphotPetrosianStats.c (modified) (4 diffs)
-
psphotRadialBins.c (modified) (2 diffs)
-
psphotSourceFits.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130904/psphot/src/psphotEllipticalContour.c
r32348 r36327 64 64 psFree (y); 65 65 psFree (yErr); 66 source->mode2 |= PM_SOURCE_MODE2_ELPROF_FEW_PTS; 66 67 return false; 67 68 } -
branches/eam_branches/ipp-20130904/psphot/src/psphotExtendedSourceFits.c
r36318 r36327 445 445 // psTraceSetLevel ("psLib.math.psMinimizeLMChi2_Alt", 5); 446 446 447 pmModelStatus badModel = PM_MODEL_STATUS_NONE; 448 badModel |= PM_MODEL_STATUS_BADARGS; 449 badModel |= PM_MODEL_STATUS_OFFIMAGE; 450 badModel |= PM_MODEL_STATUS_NAN_CHISQ; 451 badModel |= PM_MODEL_SERSIC_PCM_FAIL_GUESS; 452 badModel |= PM_MODEL_SERSIC_PCM_FAIL_GRID; 453 badModel |= PM_MODEL_PCM_FAIL_GUESS; 454 447 455 // choose the sources of interest 448 456 for (int i = 0; i < sources->n; i++) { … … 532 540 } 533 541 542 source->mode2 |= PM_SOURCE_MODE2_EXT_FITS_RUN; 543 534 544 // check on the model type 535 545 pmModelType modelType = psMetadataLookupS32 (&status, model, "MODEL_TYPE"); … … 548 558 psTrace ("psphot", 5, "failed to fit psf-conv model for object at %f, %f", source->moments->Mx, source->moments->My); 549 559 Nfail ++; 560 source->mode2 |= PM_SOURCE_MODE2_EXT_FITS_FAIL; 550 561 continue; 551 562 } … … 553 564 source->moments->Mx, source->moments->My, pmModelClassGetName (modelFit->type), modelFit->chisq, modelFit->nPix, modelFit->nIter); 554 565 Nconvolve ++; 555 if (!(modelFit->flags & (PM_MODEL_STATUS_BADARGS | PM_MODEL_STATUS_NONCONVERGE | PM_MODEL_STATUS_OFFIMAGE))) {566 if (!(modelFit->flags & badModel)) { 556 567 NconvolvePass ++; 557 568 source->mode |= PM_SOURCE_MODE_EXTENDED_FIT; … … 567 578 Nfail ++; 568 579 doneFits = true; 580 source->mode2 |= PM_SOURCE_MODE2_EXT_FITS_FAIL; 569 581 continue; 570 582 } 571 583 psTrace ("psphot", 4, "fit plain model for %f, %f : %s chisq = %f (npix: %d, niter: %d)\n", source->moments->Mx, source->moments->My, pmModelClassGetName (modelFit->type), modelFit->chisq, modelFit->nPix, modelFit->nIter); 572 584 Nplain ++; 573 if (!(modelFit->flags & (PM_MODEL_STATUS_BADARGS | PM_MODEL_STATUS_NONCONVERGE | PM_MODEL_STATUS_OFFIMAGE))) {585 if (!(modelFit->flags & badModel)) { 574 586 NplainPass ++; 575 587 source->mode |= PM_SOURCE_MODE_EXTENDED_FIT; … … 595 607 fprintf (stderr, "update window : %f %f : %f -> %f\n", source->peak->xf, source->peak->yf, fitRadius, 2*fitRadius); 596 608 psphotSetWindowTrail (&fitRadius, &windowRadius, readout, source, markVal, fitRadius*2.0); 609 source->mode2 |= PM_SOURCE_MODE2_EXT_FITS_RETRY; 597 610 } 598 611 } … … 600 613 } 601 614 // XXX really need to do this in a cleaner way: 615 // XXX I'm not sure I can get to this statement with a null modelFit 602 616 if (!modelFit) continue; 603 617 … … 615 629 pmModel *model = source->modelFits->data[i]; 616 630 631 // skip the really bad fits 617 632 if (!(model->flags & PM_MODEL_STATUS_FITTED)) continue; 618 619 if (model->flags & (PM_MODEL_STATUS_BADARGS)) continue; 633 if (model->flags & badModel) continue; 634 620 635 // if (model->flags & (PM_MODEL_STATUS_NONCONVERGE)) continue; 621 if (model->flags & (PM_MODEL_STATUS_OFFIMAGE)) continue;622 636 623 637 if ((minModel < 0) || (model->chisq < minChisq)) { … … 646 660 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); 647 661 662 source->mode2 |= PM_SOURCE_MODE2_EXT_FITS_NONE; 648 663 continue; 649 664 } -
branches/eam_branches/ipp-20130904/psphot/src/psphotPetrosianRadialBins.c
r36198 r36327 186 186 psFree(values); 187 187 psFree(stats); 188 source->mode2 |= PM_SOURCE_MODE2_PETRO_RADBIN_NAN_CENTER; 188 189 return true; 189 190 } -
branches/eam_branches/ipp-20130904/psphot/src/psphotPetrosianStats.c
r36198 r36327 21 21 if (!profile->binSB) { 22 22 psLogMsg ("psphot", PS_LOG_DETAIL, "no petrosian profile, skipping source %f, %f", source->peak->xf, source->peak->yf); 23 source->mode2 |= PM_SOURCE_MODE2_PETRO_NO_PROFILE; 23 24 return true; 24 25 } … … 118 119 petRadius = InterpolateValues (1.0, 0.0, petRatio->data.F32[nOut], refRadius->data.F32[nOut], PETROSIAN_RATIO); 119 120 petRadiusErr = InterpolateValuesErrX (1.0, 0.0, petRatio->data.F32[nOut], refRadius->data.F32[nOut], PETROSIAN_RATIO, 0.0, petRatioErr->data.F32[nOut]); 121 source->mode2 |= PM_SOURCE_MODE2_PETRO_RATIO_ZEROBIN; 120 122 } else { 121 123 // petRadius = InterpolateValues (petRatio->data.F32[nOut-1], refRadius->data.F32[nOut-1], petRatio->data.F32[nOut], refRadius->data.F32[nOut], PETROSIAN_RATIO); 122 124 if (nOut > 1) { 123 petRadius = InterpolateValuesQuadratic (&petRatio->data.F32[nOut-2], &refRadius->data.F32[nOut-2], PETROSIAN_RATIO);125 petRadius = InterpolateValuesQuadratic (&petRatio->data.F32[nOut-2], &refRadius->data.F32[nOut-2], PETROSIAN_RATIO); 124 126 } else { 125 127 petRadius = InterpolateValuesQuadratic (&petRatio->data.F32[nOut-3], &refRadius->data.F32[nOut-3], PETROSIAN_RATIO); … … 158 160 fprintf (stderr, "nan pet radius\n"); 159 161 } 162 source->mode2 |= PM_SOURCE_MODE2_PETRO_INSIG_RATIO; 160 163 } 161 164 … … 190 193 bool found50 = false; 191 194 bool found90 = false; 195 192 196 // XXX use bisection to do this faster: 193 197 for (int i = 0; !(found50 && found90) && i < refRadius->n; i++) { -
branches/eam_branches/ipp-20130904/psphot/src/psphotRadialBins.c
r34226 r36327 44 44 psVector *radMin = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.LOWER"); 45 45 psVector *radMax = psMetadataLookupPtr (&status, recipe, "RADIAL.ANNULAR.BINS.UPPER"); 46 if (!radMin || !radMin->n) { 47 psError (PSPHOT_ERR_CONFIG, true, "error in definition of annular bins (radMin missing or empty)"); 48 return false; 49 } 50 if (!radMax || !radMax->n) { 51 psError (PSPHOT_ERR_CONFIG, true, "error in definition of annular bins (radMax missing or empty)"); 52 return false; 53 } 46 psAssert (radMin, "RADIAL.ANNULAR.BINS.LOWER is missing from recipe"); 47 psAssert (radMin->n, "RADIAL.ANNULAR.BINS.LOWER is empty in recipe"); 48 psAssert (radMax, "RADIAL.ANNULAR.BINS.UPPER is missing from recipe"); 49 psAssert (radMax->n, "RADIAL.ANNULAR.BINS.UPPER is empty in recipe"); 54 50 55 51 psVector *binSB = psVectorAllocEmpty(radMin->n, PS_TYPE_F32); // surface brightness of radial bin … … 161 157 psFree(values); 162 158 psFree(stats); 159 source->mode2 |= PM_SOURCE_MODE2_RADBIN_NAN_CENTER; 163 160 return true; 164 161 } -
branches/eam_branches/ipp-20130904/psphot/src/psphotSourceFits.c
r36325 r36327 582 582 maskVal |= markVal; 583 583 584 // allocate the model 584 // allocate the model (this can only fail on a config error) 585 585 pmModel *model = pmModelAlloc(modelType); 586 if (!model) { 587 return NULL; 588 } 586 psAssert (model, "invalid extended model name"); 589 587 590 588 float t1, t2, t3, t4, t5; … … 622 620 if (!psphotSersicModelGuessPCM (pcm, source, maskVal, psfSize)) { 623 621 psFree (pcm); 624 model->flags |= PM_MODEL_S TATUS_BADARGS;622 model->flags |= PM_MODEL_SERSIC_PCM_FAIL_GUESS; 625 623 return model; 626 624 } … … 631 629 if (!psphotFitSersicShapeAndIndexGridAuto (pcm, readout, source, &options, maskVal, markVal, psfSize)) { 632 630 psFree (pcm); 633 model->flags |= PM_MODEL_S TATUS_BADARGS;631 model->flags |= PM_MODEL_SERSIC_PCM_FAIL_GRID; 634 632 psError(PS_ERR_UNKNOWN, true, "Failed to find a index & shape"); 635 633 psErrorClear (); // clear the polynomial error … … 640 638 if (!pmSourceModelGuessPCM (pcm, source, maskVal, markVal)) { 641 639 psFree (pcm); 642 model->flags |= PM_MODEL_ STATUS_BADARGS;640 model->flags |= PM_MODEL_PCM_FAIL_GUESS; 643 641 return model; 644 642 }
Note:
See TracChangeset
for help on using the changeset viewer.
