IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 29, 2005, 5:44:55 PM (21 years ago)
Author:
eugene
Message:

various psphot updates

File:
1 edited

Legend:

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

    r4642 r4901  
    77    bool        status;
    88    char       *modelName;
    9     char        key[64], filename[64];
     9    char        key[64];
    1010    pmPSF_Test *test  = NULL;
    1111    psArray    *stars = NULL;
     
    3131    psArray *tests = psArrayAlloc (Ntest);
    3232    for (int i = 0; i < tests->n; i++) {
    33         sprintf (key, "PSF_MODEL_%d", i);
     33        snprintf (key, 64, "PSF_MODEL_%d", i);
    3434        modelName = psMetadataLookupPtr (&status, config, key);
     35
    3536        tests->data[i] = pmPSF_TestModel (stars, modelName, RADIUS);
    3637        psFree (modelName);
     
    5556        }
    5657    }
     58    // keep only the selected test:
    5759    test = tests->data[bestN];
    5860    modelName = psModelGetType (test->modelType);
    5961    psLogMsg ("psphot.pspsf", 3, "selected psf model %s, ApResid: %f +/- %f\n", modelName, test->ApResid, test->dApResid);
    60     psFree (modelName);
    6162
     63    // XXX I am having trouble tracking down the double frees vs leaks
     64    # if (0)
    6265    // we are keeping the modelPSF fits from the PSF test,
    6366    // but we replace these later on (apply_psf_model)
     
    7073          source->modelPSF = NULL;
    7174        } else {
     75          // source->modelPSF = psMemCopy(test->modelPSF->data[i]);
    7276          source->modelPSF = test->modelPSF->data[i];
    7377        }
    7478    }
    75     pmPSF *psf = test->psf;
     79    # endif
    7680
    77     // free unused test models:
    78     psFree (test);
    79     psFree (stars);
    80 
     81    pmPSF *psf = psMemCopy(test->psf);
     82    psFree (tests);
    8183    return (psf);
    8284}
Note: See TracChangeset for help on using the changeset viewer.