IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 30, 2013, 1:35:54 PM (13 years ago)
Author:
eugene
Message:

add a number of additional flag bits, esp for model fitting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130904/psphot/src/psphotExtendedSourceFits.c

    r36318 r36327  
    445445    // psTraceSetLevel ("psLib.math.psMinimizeLMChi2_Alt", 5);
    446446
     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
    447455    // choose the sources of interest
    448456    for (int i = 0; i < sources->n; i++) {
     
    532540          }
    533541
     542          source->mode2 |= PM_SOURCE_MODE2_EXT_FITS_RUN;
     543
    534544          // check on the model type
    535545          pmModelType modelType = psMetadataLookupS32 (&status, model, "MODEL_TYPE");
     
    548558                  psTrace ("psphot", 5, "failed to fit psf-conv model for object at %f, %f", source->moments->Mx, source->moments->My);
    549559                  Nfail ++;
     560                  source->mode2 |= PM_SOURCE_MODE2_EXT_FITS_FAIL;
    550561                  continue;
    551562              }
     
    553564                       source->moments->Mx, source->moments->My, pmModelClassGetName (modelFit->type), modelFit->chisq, modelFit->nPix, modelFit->nIter);
    554565              Nconvolve ++;
    555               if (!(modelFit->flags & (PM_MODEL_STATUS_BADARGS | PM_MODEL_STATUS_NONCONVERGE | PM_MODEL_STATUS_OFFIMAGE))) {
     566              if (!(modelFit->flags & badModel)) {
    556567                  NconvolvePass ++;
    557568                  source->mode |= PM_SOURCE_MODE_EXTENDED_FIT;
     
    567578                      Nfail ++;
    568579                      doneFits = true;
     580                      source->mode2 |= PM_SOURCE_MODE2_EXT_FITS_FAIL;
    569581                      continue;
    570582                  }
    571583                  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);
    572584                  Nplain ++;
    573                   if (!(modelFit->flags & (PM_MODEL_STATUS_BADARGS | PM_MODEL_STATUS_NONCONVERGE | PM_MODEL_STATUS_OFFIMAGE))) {
     585                  if (!(modelFit->flags & badModel)) {
    574586                      NplainPass ++;
    575587                      source->mode |= PM_SOURCE_MODE_EXTENDED_FIT;
     
    595607                          fprintf (stderr, "update window : %f %f : %f -> %f\n", source->peak->xf, source->peak->yf, fitRadius, 2*fitRadius);
    596608                          psphotSetWindowTrail (&fitRadius, &windowRadius, readout, source, markVal, fitRadius*2.0);
     609                          source->mode2 |= PM_SOURCE_MODE2_EXT_FITS_RETRY;
    597610                      }
    598611                  }
     
    600613          }
    601614          // 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
    602616          if (!modelFit) continue;
    603617
     
    615629            pmModel *model = source->modelFits->data[i];
    616630
     631            // skip the really bad fits
    617632            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
    620635            // if (model->flags & (PM_MODEL_STATUS_NONCONVERGE)) continue;
    621             if (model->flags & (PM_MODEL_STATUS_OFFIMAGE)) continue;
    622636
    623637            if ((minModel < 0) || (model->chisq < minChisq)) {
     
    646660          pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);
    647661
     662          source->mode2 |= PM_SOURCE_MODE2_EXT_FITS_NONE;
    648663          continue;
    649664        }
Note: See TracChangeset for help on using the changeset viewer.