IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 9, 2010, 6:15:15 PM (16 years ago)
Author:
Paul Price
Message:

Fix SEGV in measuring the PSF FWHM. I'm guessing this is from the PSF not being defined at the centre of the image, so now I measure it over the various areas of the image and take the average.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091201/ppStack/src/ppStackPrepare.c

    r26785 r26832  
    178178        bool redoPhot = psMetadataLookupBool(NULL, recipe, "PHOT");
    179179
    180         pmDetections *detections = NULL;
     180        pmDetections *detections = NULL;
    181181        if (options->convolve || options->matchZPs || options->photometry || redoPhot) {
    182182            pmReadout *ro = pmFPAviewThisReadout(view, inputFile->fpa); // Readout with sources
     
    186186                return NULL;
    187187            }
    188             psAssert (detections->allSources, "missing sources?");
    189            
     188            psAssert (detections->allSources, "missing sources?");
     189
    190190            options->sourceLists->data[index] = psMemIncrRefCounter(detections->allSources);
    191191        }
     
    238238        }
    239239        havePSFs = true;
    240         float fwhm = pmPSFtoFWHM(psf, 0.5 * numCols, 0.5 * numRows); // FWHM for image
    241         psStringAppend(&log, "Input %d: %f\n", i, fwhm);
    242         options->inputSeeing->data.F32[i] = fwhm;
     240
     241        double sumFWHM = 0.0;           // FWHM for image
     242        int numFWHM = 0;                // Number of FWHM measurements
     243        for (int y = 0; y < psf->trendNy; y++) {
     244            float yPos = ((float)y + 0.5) / (float)psf->trendNy * numRows;
     245            for (int x = 0; x < psf->trendNx; x++) {
     246                float xPos = ((float)x + 0.5) / (float)psf->trendNx * numCols;
     247                float fwhm = pmPSFtoFWHM(psf, xPos, yPos); // FWHM for image
     248                if (isfinite(fwhm)) {
     249                    sumFWHM += fwhm;
     250                    numFWHM++;
     251                }
     252            }
     253        }
     254        if (numFWHM == 0) {
     255            options->inputSeeing->data.F32[i] = NAN;
     256            options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = PPSTACK_MASK_PSF;
     257            psLogMsg("ppStack", PS_LOG_INFO, "Unable to measure PSF FWHM for image %d --- rejected.", i);
     258        } else {
     259            options->inputSeeing->data.F32[i] = sumFWHM / (float)numFWHM;
     260        }
     261        psStringAppend(&log, "Input %d: %f\n", i, options->inputSeeing->data.F32[i]);
    243262    }
    244263    if (havePSFs) {
Note: See TracChangeset for help on using the changeset viewer.