IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26832


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.

Location:
branches/eam_branches/20091201
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091201/ppStack/src/ppStack.h

    r26076 r26832  
    1313typedef enum {
    1414    PPSTACK_MASK_CAL    = 0x01,         // Photometric calibration failed
    15     PPSTACK_MASK_MATCH  = 0x02,         // PSF-matching failed
    16     PPSTACK_MASK_CHI2   = 0x04,         // Chi^2 too deviant
    17     PPSTACK_MASK_REJECT = 0x08,         // Rejection failed
    18     PPSTACK_MASK_BAD    = 0x10,         // Bad image (too many pixels rejected)
     15    PPSTACK_MASK_PSF    = 0x02,         // PSF measurement failed
     16    PPSTACK_MASK_MATCH  = 0x04,         // PSF-matching failed
     17    PPSTACK_MASK_CHI2   = 0x08,         // Chi^2 too deviant
     18    PPSTACK_MASK_REJECT = 0x10,         // Rejection failed
     19    PPSTACK_MASK_BAD    = 0x20,         // Bad image (too many pixels rejected)
    1920    PPSTACK_MASK_ALL    = 0xff          // All errors
    2021} ppStackMask;
  • 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) {
  • branches/eam_branches/20091201/psModules/src/objects/pmPSF.c

    r26669 r26832  
    415415
    416416    pmModel *model = pmModelFromPSFforXY(psf, x, y, 1.0); // Model of source
     417    if (!model) {
     418        psError(PS_ERR_UNKNOWN, false, "Unable to determine PSF model at %f,%f\n", x, y);
     419        return NAN;
     420    }
    417421    psF32 *params = model->params->data.F32; // Model parameters
    418422    psEllipseAxes axes = pmPSF_ModelToAxes(params, MAX_AXIS_RATIO); // Ellipse axes
Note: See TracChangeset for help on using the changeset viewer.