IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 36329


Ignore:
Timestamp:
Dec 2, 2013, 9:59:15 AM (13 years ago)
Author:
eugene
Message:

add some TMPF bits to specify if the petrosian and/or galaxy model should be fitted; deactivate the covar matrix output; add a BEST_FIT model flag

Location:
branches/eam_branches/ipp-20130904/psModules/src/objects
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20130904/psModules/src/objects/pmModelFuncs.h

    r36326 r36329  
    4747    PM_MODEL_SERSIC_PCM_FAIL_GRID  = 0x100, ///< sersic model fit failed on the grid search
    4848    PM_MODEL_PCM_FAIL_GUESS        = 0x200, ///< non-sersic model fit failed on the initial moments-based guess
     49    PM_MODEL_BEST_FIT              = 0x400, ///< this model was the best fit and was subtracted
    4950} pmModelStatus;
    5051
  • branches/eam_branches/ipp-20130904/psModules/src/objects/pmSource.h

    r36157 r36329  
    4040    PM_SOURCE_TMPF_PETRO_KEEP        = 0x0100,
    4141    PM_SOURCE_TMPF_PETRO_SKIP        = 0x0200,
     42    PM_SOURCE_TMPF_GALAXY_FIT        = 0x0400,  // not just galaxies (trails as well)
     43    PM_SOURCE_TMPF_PETRO_FIT         = 0x0800,
    4244} pmSourceTmpF;
    4345
  • branches/eam_branches/ipp-20130904/psModules/src/objects/pmSourceIO_CMF.c.in

    r36326 r36329  
    789789    char name[64];
    790790
     791    pmModelType modelTypeTrail = pmModelClassGetType("PS_MODEL_TRAIL");
     792
    791793    // create a header to hold the output data
    792794    psMetadata *outhead = psMetadataAlloc ();
     
    798800    sources = psArraySort (sources, pmSourceSortByFlux);
    799801
    800     @>PS1_DV2@ float magOffset;
    801     @>PS1_DV2@ float zeroptErr;
    802     @>PS1_DV2@ float fwhmMajor;
    803     @>PS1_DV2@ float fwhmMinor;
    804     @>PS1_DV2@ pmSourceOutputsCommonValues (&magOffset, &zeroptErr, &fwhmMajor, &fwhmMinor, readout, imageHeader);
     802    float magOffset;
     803    float zeroptErr;
     804    float fwhmMajor;
     805    float fwhmMinor;
     806    pmSourceOutputsCommonValues (&magOffset, &zeroptErr, &fwhmMajor, &fwhmMinor, readout, imageHeader);
    805807
    806808    // we are writing one row per model; we need to write out same number of columns for each row: find the max Nparams
     
    853855            xPos = PAR[PM_PAR_XPOS];
    854856            yPos = PAR[PM_PAR_YPOS];
    855             xErr = dPAR[PM_PAR_XPOS];
    856             yErr = dPAR[PM_PAR_YPOS];
     857
     858            // for the extended source models, we do not always fit the centroid in the non-linear fitting process
     859            // current situation (hard-wired into psphotSourceFits.c:psphotFitPCM,
     860            // SERSIC, DEV, EXP : X,Y not fitted (PCM and not PCM)
     861            // TRAIL : X,Y are fitted
     862            //
     863           
     864            // XXX this should be based on what happened, not on the model type
     865            if (model->type == modelTypeTrail) {
     866                xErr = dPAR[PM_PAR_XPOS];
     867                yErr = dPAR[PM_PAR_YPOS];
     868            } else {
     869                // this is definitely an underestimate since it does not
     870                // account for the extent of the source
     871                xErr = fwhmMajor * model->magErr / 2.35;
     872                yErr = fwhmMinor * model->magErr / 2.35;
     873            }
    857874
    858875            @>PS1_DV2@ psSphere ptSky = {0.0, 0.0, 0.0, 0.0};
     
    870887            row = psMetadataAlloc ();
    871888
    872             // XXX we are not writing out the mode (flags) or the type (psf, ext, etc)
    873889            // the psMetadataAdd entry and the double quotes are used by grep to select the output fields for automatic documentation
    874890            // This set of psMetadataAdd Entries marks the "----" "Start of the XFIT segment"
     
    950966
    951967                snprintf (name, 64, "EXT_PAR_%02d", k);
    952 
     968               
    953969                if (k < model->params->n) {
    954970                    psMetadataAddF32 (row, PS_LIST_TAIL, name, 0, "", model->params->data.F32[k]);
     
    960976            // optionally, write out the covariance matrix values
    961977            // XXX do I need to pad this to match the biggest covar matrix?
    962             if (model->covar) {
     978            if (false && model->covar) {
    963979                for (int iy = 0; iy < model->covar->numCols; iy++) {
    964980                    for (int ix = iy; ix < model->covar->numCols; ix++) {
     
    10891105        if (model->params->n > 7) {
    10901106            PAR[7] = psMetadataLookupF32(&status, row, "EXT_PAR_07");
    1091         }
    1092         // read the covariance matrix
    1093         int nparams = model->params->n;
    1094         psImage *covar = psImageAlloc(nparams, nparams, PS_TYPE_F32);
    1095         for (int y = 0; y < nparams; y++) {
    1096             for (int x = 0; x < nparams; x++) {
    1097                 char name[64];
    1098                 snprintf(name, 64, "EXT_COVAR_%02d_%02d", y, x);
    1099                 covar->data.F32[y][x] = psMetadataLookupF32(&status, row, name);
    1100             }
    1101         }
    1102         model->covar = covar;
     1107            // XXX add an error:
     1108            // dPAR[7] = psMetadataLookupF32(&status, row, "EXT_PAR_07_");
     1109        }
     1110
     1111        // XXX : make this depend on what is in the cmf
     1112        if (0) {
     1113            // read the covariance matrix
     1114            int nparams = model->params->n;
     1115            psImage *covar = psImageAlloc(nparams, nparams, PS_TYPE_F32);
     1116            for (int y = 0; y < nparams; y++) {
     1117                for (int x = 0; x < nparams; x++) {
     1118                    char name[64];
     1119                    snprintf(name, 64, "EXT_COVAR_%02d_%02d", y, x);
     1120                    covar->data.F32[y][x] = psMetadataLookupF32(&status, row, name);
     1121                }
     1122            }
     1123            model->covar = covar;
     1124        }
    11031125
    11041126        if (modelType == extModelType) {
Note: See TracChangeset for help on using the changeset viewer.