IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26918


Ignore:
Timestamp:
Feb 11, 2010, 4:24:37 PM (16 years ago)
Author:
Paul Price
Message:

Cleaning up measurement of PSF size.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackPrepare.c

    r26898 r26918  
    239239        havePSFs = true;
    240240
    241         if (psf->trendNx > 0 && psf->trendNy > 0) {
    242             double sumFWHM = 0.0;           // FWHM for image
    243             int numFWHM = 0;                // Number of FWHM measurements
    244             for (int y = 0; y < psf->trendNy; y++) {
    245                 float yPos = ((float)y + 0.5) / (float)psf->trendNy * numRows;
    246                 for (int x = 0; x < psf->trendNx; x++) {
    247                     float xPos = ((float)x + 0.5) / (float)psf->trendNx * numCols;
    248                     float fwhm = pmPSFtoFWHM(psf, xPos, yPos); // FWHM for image
    249                     if (isfinite(fwhm)) {
    250                         sumFWHM += fwhm;
    251                         numFWHM++;
    252                     }
     241        int xNum = PS_MAX(psf->trendNx, 1), yNum = PS_MAX(psf->trendNy, 1); // Number of realisations
     242        double sumFWHM = 0.0;           // FWHM for image
     243        int numFWHM = 0;                // Number of FWHM measurements
     244        for (int y = 0; y < yNum; y++) {
     245            float yPos = ((float)y + 0.5) / (float)yNum * numRows;
     246            for (int x = 0; x < xNum; x++) {
     247                float xPos = ((float)x + 0.5) / (float)xNum * numCols;
     248                float fwhm = pmPSFtoFWHM(psf, xPos, yPos); // FWHM for image
     249                if (isfinite(fwhm)) {
     250                    sumFWHM += fwhm;
     251                    numFWHM++;
    253252                }
    254253            }
    255             if (numFWHM == 0) {
    256                 options->inputSeeing->data.F32[i] = NAN;
    257                 options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PPSTACK_MASK_PSF;
    258                 psLogMsg("ppStack", PS_LOG_INFO, "Unable to measure PSF FWHM for image %d --- rejected.", i);
    259             } else {
    260                 options->inputSeeing->data.F32[i] = sumFWHM / (float)numFWHM;
    261             }
     254        }
     255        if (numFWHM == 0) {
     256            options->inputSeeing->data.F32[i] = NAN;
     257            options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PPSTACK_MASK_PSF;
     258            psLogMsg("ppStack", PS_LOG_INFO, "Unable to measure PSF FWHM for image %d --- rejected.", i);
    262259        } else {
    263             options->inputSeeing->data.F32[i] = pmPSFtoFWHM(psf, 0.5 * numCols, 0.5 * numRows);
     260            options->inputSeeing->data.F32[i] = sumFWHM / (float)numFWHM;
    264261        }
    265262
Note: See TracChangeset for help on using the changeset viewer.