IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24203


Ignore:
Timestamp:
May 15, 2009, 1:54:47 PM (17 years ago)
Author:
Paul Price
Message:

Need to check to see if image quality was measured.

File:
1 edited

Legend:

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

    r20769 r24203  
    99    if (psErrorCodeLast() == PSPHOT_ERR_DATA) {
    1010        psErrorStackPrint(stderr, "Error in the psphot readout analysis");
    11         psErrorClear();
    12     } 
    13     if (psErrorCodeLast() != PS_ERR_NONE) { 
    14         psFree (psf);
    15         psFree (sources);
    16         psFree (detections);
    17         return false;
     11        psErrorClear();
     12    }
     13    if (psErrorCodeLast() != PS_ERR_NONE) {
     14        psFree (psf);
     15        psFree (sources);
     16        psFree (detections);
     17        return false;
    1818    }
    1919
     
    2222        if (!psphotPSFstats (readout, recipe, psf)) {
    2323            psError(PSPHOT_ERR_PROG, false, "Failed to measure PSF shape parameters");
    24             psFree (psf);
    25             psFree (sources);
    26             psFree (detections);
     24            psFree (psf);
     25            psFree (sources);
     26            psFree (detections);
    2727            return false;
    2828        }
     
    3232        if (!psphotMomentsStats (readout, recipe, sources)) {
    3333            psError(PSPHOT_ERR_PROG, false, "Failed to measure Moment shape parameters");
    34             psFree (psf);
    35             psFree (sources);
    36             psFree (detections);
     34            psFree (psf);
     35            psFree (sources);
     36            psFree (detections);
    3737            return false;
    3838        }
    3939    }
     40
     41    // Check to see if the image quality was measured
     42    if (!psf) {
     43        bool mdok;                      // Status of MD lookup
     44        int nIQ = psMetadataLookupS32(&mdok, recipe, "IQ_NSTAR"); // Number of stars for IQ measurement
     45        if (!mdok || nIQ <= 0) {
     46            psError(PSPHOT_ERR_DATA, false, "Unable to measure image quality");
     47            psFree (psf);
     48            psFree (sources);
     49            psFree (detections);
     50            return false;
     51        }
     52    }
     53
    4054
    4155    // write NSTARS to the image header
     
    4862    psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.HEADER",  PS_DATA_METADATA, "header stats", header);
    4963    if (sources) {
    50         psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "psphot sources", sources);
     64        psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "psphot sources", sources);
    5165    }
    5266    if (psf) {
    53         // save the psf for possible output.  if there was already an entry, it was loaded from external sources
    54         // the new one may have been updated or modified, so replace the existing entry.  We
    55         // are required to save it on the chip, but this will cause problems if we ever want to
    56         // run psphot on an unmosaiced image
    57         pmCell *cell = readout->parent;
    58         pmChip *chip = cell->parent;
    59         psMetadataAdd (chip->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN | PS_META_REPLACE,  "psphot psf", psf);
     67        // save the psf for possible output.  if there was already an entry, it was loaded from external sources
     68        // the new one may have been updated or modified, so replace the existing entry.  We
     69        // are required to save it on the chip, but this will cause problems if we ever want to
     70        // run psphot on an unmosaiced image
     71        pmCell *cell = readout->parent;
     72        pmChip *chip = cell->parent;
     73        psMetadataAdd (chip->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN | PS_META_REPLACE,  "psphot psf", psf);
    6074    }
    6175
    6276    if (psErrorCodeLast() != PS_ERR_NONE) {
    6377        psErrorStackPrint(stderr, "unexpected remaining errors");
    64         abort();
     78        abort();
    6579    }
    6680
Note: See TracChangeset for help on using the changeset viewer.