IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 24, 2005, 5:38:37 AM (21 years ago)
Author:
eugene
Message:

adding model tests

File:
1 edited

Legend:

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

    r4251 r4375  
    33// test PSF models and select best option
    44
    5 pmPSF *choose_psf_model (psMetadata *config, psArray *sources)
     5pmPSF *choose_psf_model (psMetadata *config, psArray *sources, psStats *skystats)
    66{
    77    bool        status;
     
    3434        modelName = psMetadataLookupPtr (&status, config, key);
    3535        tests->data[i] = pmPSF_TestModel (stars, modelName, RADIUS);
     36
     37        // dump psf test data to file:
     38        {
     39          sprintf (key, "metric.%d.dat", i);
     40          FILE *f = fopen (key, "w");
     41          test = tests->data[i];
     42
     43
     44          for (int j = 0; j < test->sources->n; j++) {
     45            psSource *source = test->sources->data[j];
     46            psModel  *model  = test->modelPSF->data[j];     
     47            float sky = 0;
     48
     49            if (model != NULL) sky = model->params->data.F32[0];
     50
     51            fprintf (f, "%3d %6.1f %6.1f  %7.4f %7.4f  %8.4f\n",
     52                     j, source->moments->x, source->moments->y,
     53                     test->metric->data.F64[j], test->fitMag->data.F64[j], sky);
     54          }
     55          fclose (f);
     56        }
    3657    }
    3758
     
    4061    test = tests->data[0];
    4162    int   bestN = 0;
    42     float bestM = test->metricStats->clippedStdev;
     63    float bestM = test->dApResid;
    4364    for (int i = 1; i < Ntest; i++) {
    4465        test = tests->data[i];
    45         int M = test->metricStats->clippedStdev;
     66        int M = test->dApResid;
    4667        if (M < bestM) {
    4768            bestM = M;
     
    5172    test = tests->data[bestN];
    5273    modelName = psModelGetType (test->modelType);
    53     psLogMsg ("psphot.pspsf", 3, "selected psf model %s, metric: %f +/- %f\n", modelName, test->metricStats->clippedMean, test->metricStats->clippedStdev);
     74    psLogMsg ("psphot.pspsf", 3, "selected psf model %s, ApResid: %f +/- %f\n", modelName, test->ApResid, test->dApResid);
    5475
    5576    // set source->model based on best psf model fit
Note: See TracChangeset for help on using the changeset viewer.