IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13804


Ignore:
Timestamp:
Jun 13, 2007, 2:00:08 PM (19 years ago)
Author:
eugene
Message:

replaced pmModel.status with pmModel.flags; using bit values instead of ints; names are now of the form PM_MODEL_STATUS_XXX; no error on limit saturation for model parameters

Location:
trunk/psphot/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotChoosePSF.c

    r13516 r13804  
    55
    66    bool            status;
    7     char           *modelName;
    8     pmPSF          *psf = NULL;
    9     pmPSFtry       *try = NULL;
    10     psArray        *stars = NULL;
    117
    128    psTimerStart ("psphot");
     
    5147    }
    5248
    53     stars = psArrayAllocEmpty (sources->n);
     49    psArray *stars = psArrayAllocEmpty (sources->n);
    5450
    5551    // select the candidate PSF stars (pointers to original sources)
     
    9288    for (int i = 0; i < models->n; i++) {
    9389        psMetadataItem *item = psListGetAndIncrement (iter);
    94         modelName = item->data.V;
     90        char *modelName = item->data.V;
    9591        models->data[i] = pmPSFtryModel (stars, modelName, RADIUS, POISSON_ERRORS, psfTrendMask, PSF_PARAM_WEIGHTS);
    9692    }
     
    106102    float bestM = 0.0;
    107103    for (int i = 0; i < models->n; i++) {
    108         try = models->data[i];
     104        pmPSFtry *try = models->data[i];
    109105        if (try == NULL) {
    110106            psError(PSPHOT_ERR_PSF, false, "PSF model %d is NULL", i);
     
    125121    }
    126122
    127     try = models->data[bestN];
     123    pmPSFtry *try = models->data[bestN];
     124
     125    // print/dump psf parameters
     126    if (psTraceGetLevel("psphot") >= 5) {
     127        for (int i = PM_PAR_SXX; i < try->psf->params_NEW->n; i++) {
     128            psPolynomial2D *poly = try->psf->params_NEW->data[i];
     129            for (int nx = 0; nx <= poly->nX; nx++) {
     130                for (int ny = 0; ny <= poly->nY; ny++) {
     131                    if (poly->mask[nx][ny]) continue;
     132                    fprintf (stderr, "%g x^%d y^%d\n", poly->coeff[nx][ny], nx, ny);
     133                }
     134            }
     135        }
     136    }
    128137
    129138    // measure and save the median value of dparams[PM_PAR_SXX],dparams[PM_PAR_SYY]
     
    275284    // XXX we are not saving the fitted sources
    276285    // XXX do we want to keep them so we may optionally write them out?
    277     psf = psMemIncrRefCounter(try->psf);
     286    pmPSF *psf = psMemIncrRefCounter(try->psf);
    278287    psFree (models);
    279288
     
    284293    }
    285294
    286     modelName = pmModelGetType (psf->type);
     295    char *modelName = pmModelGetType (psf->type);
    287296    psLogMsg ("psphot.pspsf", PS_LOG_INFO, "select psf model: %f sec\n", psTimerMark ("psphot"));
    288297    psLogMsg ("psphot.pspsf", PS_LOG_INFO, "psf model %s, ApResid: %f +/- %f\n", modelName, psf->ApResid, psf->dApResid);
  • trunk/psphot/src/psphotEvalFLT.c

    r12792 r13804  
    1111    }
    1212
    13     // did the model fit fail for one or another reason?
    14     switch (model->status) {
    15       case PM_MODEL_SUCCESS:
    16         break;
    17       case PM_MODEL_UNTRIED:
     13    // was the model actually fitted?
     14    if (!(model->flags & PM_MODEL_STATUS_FITTED)) {
    1815        source->mode &= ~PM_SOURCE_MODE_FITTED;
    1916        return false;
    20       case PM_MODEL_BADARGS:
    21       case PM_MODEL_NONCONVERGE:
    22       case PM_MODEL_OFFIMAGE:
    23       default:
     17    }
     18    // did the model fit fail for one or another reason?
     19    if (model->flags & (PM_MODEL_STATUS_BADARGS |
     20                        PM_MODEL_STATUS_NONCONVERGE |
     21                        PM_MODEL_STATUS_OFFIMAGE)) {
     22        source->mode |= PM_SOURCE_MODE_FAIL;
    2423        psLogMsg ("psphot", 5, "EXT fail fit\n");
    25         source->mode |= PM_SOURCE_MODE_FAIL;
    2624        return false;
    2725    }
  • trunk/psphot/src/psphotEvalPSF.c

    r12792 r13804  
    6767    }
    6868
    69     // did the model fit fail for one or another reason?
    70     switch (model->status) {
    71       case PM_MODEL_SUCCESS:
    72         break;
    73       case PM_MODEL_UNTRIED:
     69    // was the model actually fitted?
     70    if (!(model->flags & PM_MODEL_STATUS_FITTED)) {
    7471        source->mode &= ~PM_SOURCE_MODE_FITTED;
    7572        if (source->mode & PM_SOURCE_MODE_SATSTAR) {
     
    7774        }
    7875        return false;
    79       case PM_MODEL_BADARGS:
    80       case PM_MODEL_NONCONVERGE:
    81       case PM_MODEL_OFFIMAGE:
    82       default:
     76    }
     77    // did the model fit fail for one or another reason?
     78    if (model->flags & (PM_MODEL_STATUS_BADARGS |
     79                        PM_MODEL_STATUS_NONCONVERGE |
     80                        PM_MODEL_STATUS_OFFIMAGE)) {
    8381        source->mode |= PM_SOURCE_MODE_FAIL;
    8482        if (source->mode & PM_SOURCE_MODE_SATSTAR) {
     
    193191    }
    194192
     193    // was the model actually fitted?
     194    if (!(model->flags & PM_MODEL_STATUS_FITTED)) {
     195        source->mode &= ~PM_SOURCE_MODE_FITTED;
     196        return false;
     197    }
    195198    // did the model fit fail for one or another reason?
    196     switch (model->status) {
    197       case PM_MODEL_SUCCESS:
    198         break;
    199       case PM_MODEL_UNTRIED:
    200         source->mode &= ~PM_SOURCE_MODE_FITTED;
    201         return false;
    202       case PM_MODEL_BADARGS:
    203       case PM_MODEL_NONCONVERGE:
    204       case PM_MODEL_OFFIMAGE:
    205       default:
     199    if (model->flags & (PM_MODEL_STATUS_BADARGS |
     200                        PM_MODEL_STATUS_NONCONVERGE |
     201                        PM_MODEL_STATUS_OFFIMAGE)) {
    206202        source->mode |= PM_SOURCE_MODE_FAIL;
    207203        return false;
  • trunk/psphot/src/psphotReadout.c

    r13609 r13804  
    132132        }
    133133    }
     134
     135    // XXX Test dump of PSF parameters across image field.
     136
    134137    if (!strcasecmp (breakPt, "PSFMODEL")) {
    135138        return psphotReadoutCleanup (config, readout, recipe, psf, sources);
Note: See TracChangeset for help on using the changeset viewer.