IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37633


Ignore:
Timestamp:
Nov 19, 2014, 1:02:03 PM (12 years ago)
Author:
bills
Message:

add code to measure the Blakeslee bumpiness paramter

File:
1 edited

Legend:

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

    r37626 r37633  
    1010
    1111    fprintf (stdout, "\n");
    12     psLogMsg ("psphot", PS_LOG_INFO, "--- psphot Galaxy Paramters ---");
     12    psLogMsg ("psphot", PS_LOG_INFO, "--- psphot Galaxy Parameters ---");
    1313
    1414    // select the appropriate recipe information
     
    3333    for (int i = 0; i < num; i++) {
    3434        if (!psphotGalaxyParamsReadout (config, view, filerule, i, recipe)) {
    35             psError (PSPHOT_ERR_CONFIG, false, "failed on galaxy paramter measurements for %s entry %d", filerule, i);
     35            psError (PSPHOT_ERR_CONFIG, false, "failed on galaxy parameter measurements for %s entry %d", filerule, i);
    3636            return false;
    3737        }
     
    256256    // don't try and use bad models
    257257    pmModelStatus badModel = PM_MODEL_STATUS_NONE;
     258    badModel |= PM_MODEL_STATUS_NONCONVERGE;
    258259    badModel |= PM_MODEL_STATUS_BADARGS;
    259260    badModel |= PM_MODEL_STATUS_OFFIMAGE;
     
    337338            // do we need this?
    338339            source->mode |= PM_SOURCE_MODE_NONLINEAR_FIT;
    339             if (source->modelEXT->isPCM) {
    340                 pmPCMCacheModel (source, maskVal, psfSize, fitNsigmaConv);
    341             } else {
    342                 pmSourceCacheModel (source, maskVal);
    343             }
    344         }
     340#ifdef notdef
     341#endif
     342        }
     343
    345344
    346345        psF32 *PAR = sersicModel->params->data.F32;
    347346        psF32 Xo = PAR[PM_PAR_XPOS];
    348347        psF32 Yo = PAR[PM_PAR_YPOS];
    349        
     348        psF32 Io = PAR[PM_PAR_I0];
    350349        // For now: set the half light radius to the major axis of the model
    351350        psEllipseAxes axes = pmPSF_ModelToAxes (PAR, sersicModel->class->useReff);
     
    363362        pmSourceRedefinePixels (source, readout, source->peak->xf, source->peak->yf, 2*radius);
    364363
     364        // RedefinePixels frees modelFlux
     365        if (source->modelEXT->isPCM) {
     366            pmPCMCacheModel (source, maskVal, psfSize, fitNsigmaConv);
     367        } else {
     368            pmSourceCacheModel (source, maskVal);
     369        }
    365370
    366371#ifdef DUMP_IMAGES
     
    485490        vPix = source->pixels->data.F32;
    486491        vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA;
     492        psF32 **vVar = source->variance->data.F32;
     493        psF32 **vModel = source->modelFlux->data.F32;
    487494        // Accumulate Rt and Ra
    488495        psF32 sumRt = 0;
    489496        psF32 sumRa = 0;
    490497        int numPixels = 0;
     498        psF32 sumB = 0;
     499        psF32 sumModel = 0;
     500        int numB = 0;
    491501        for (psS32 row = 0; row < source->pixels->numRows ; row++) {
    492502            psF32 yDiff = row - yCM;
     
    506516                if (r2 > R2) continue;
    507517
     518                // Measurement of bumpiness parameter excludes the pixels
     519                // within 2 pixels of the center
     520                if (r2 > 4) {
     521                    psF32 variance = vVar[row][col];
     522                    if (isfinite(variance)) {
     523                        psF32 modelPixel = vModel[row][col];
     524                        if (!isfinite(modelPixel)) {
     525                            // XXX: Can this happen in a good model?
     526                            fprintf(stderr, "non-finite modelPixel %4d (%4d, %4d)\n", source->id, col, row);
     527                        }
     528                        numB++;
     529                        sumB += PS_SQR(pixel) - variance;
     530                        sumModel += Io * modelPixel;
     531                    }
     532                }
     533
    508534                // x coordinate of mirror pixel
    509535                int xFlip = xCM - xDiff;
     
    519545                ++numPixels;
    520546            }
     547        }
     548
     549        if (numB > 0) {
     550            source->extpars->gbumpy = sqrt(sumB/numB)  / (sumModel / numB);
    521551        }
    522552
Note: See TracChangeset for help on using the changeset viewer.