IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23580


Ignore:
Timestamp:
Mar 27, 2009, 4:46:10 PM (17 years ago)
Author:
Paul Price
Message:

Get QUALITY (error code from non-fatal failure, e.g., psphot) into the output statistics and parse for flag to give to ippTools.

Location:
branches/pap
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/pap/ippconfig/recipes/ppStatsFromMetadata.config

    r20302 r23580  
    5050  ENTRY  VAL  ROBUST_MEDIAN       F32  ROBUST_STDEV      -bg_mean_stdev     
    5151  ENTRY  VAL  ROBUST_STDEV        F32  RMS               -bg_stdev           
     52  ENTRY  VAL  QUALITY             BOOL CONSTANT          -quality
    5253END
    5354
     
    168169  ENTRY  VAL  IQ_M2S_L            F32  SAMPLE_MEAN      -iq_m2s_lq           
    169170  ENTRY  VAL  IQ_M2S_U            F32  SAMPLE_MEAN      -iq_m2s_uq           
     171  ENTRY  VAL  QUALITY             BOOL CONSTANT          -quality
    170172END
    171173
     
    253255  ENTRY  VAL  RANGE.YMAX          S32  CONSTANT          -ymax         
    254256  ENTRY  VAL  ACCEPT              BOOL CONSTANT          -accept
     257  ENTRY  VAL  QUALITY             BOOL CONSTANT          -quality
    255258END
    256259
     
    279282  ENTRY  VAL  NUM_SOURCES         S32  SUM               -sources                       
    280283  ENTRY  VAL  GOOD_PIXEL_FRAC     F32  MEAN              -good_frac                     
     284  ENTRY  VAL  QUALITY             BOOL CONSTANT          -quality
    281285END
    282286
     
    301305  ENTRY  VAL  NUM_SOURCES           S32  SUM               -sources       
    302306  ENTRY  VAL  GOOD_PIXEL_FRAC       F32  MEAN              -good_frac     
     307  ENTRY  VAL  QUALITY               BOOL CONSTANT          -quality
    303308END
    304309
  • branches/pap/ppImage/src/ppImage.h

    r23411 r23580  
    4040    bool doAstromMosaic;                // full-mosaic Astrometry
    4141    bool doStats;                       // call ppStats on the image
    42     bool checkCTE;                      // measure pixel-based variance
     42    bool checkCTE;                      // measure pixel-based variance
    4343
    4444    // output files requested
     
    8888    float remnanceThresh;               // Threshold for remnance detection
    8989
    90     char *normClass;                    // class to use for per-class normalization
     90    char *normClass;                    // class to use for per-class normalization
    9191} ppImageOptions;
    9292
     
    146146bool ppImageRebinChip (pmConfig *config, pmFPAview *view, ppImageOptions *options, char *outName);
    147147
    148 bool ppImagePhotom (pmConfig *config, pmFPAview *view);
    149 bool ppImageAstrom (pmConfig *config);
    150 bool ppImageAddstar (pmConfig *config);
     148bool ppImagePhotom(psMetadata *stats, pmConfig *config, pmFPAview *view);
     149bool ppImageAstrom(pmConfig *config);
     150bool ppImageAddstar(pmConfig *config);
    151151
    152152// Subtract background from the chip-mosaicked image
  • branches/pap/ppImage/src/ppImageLoop.c

    r23411 r23580  
    1313bool ppImageLoop(pmConfig *config, ppImageOptions *options)
    1414{
    15     psMetadata *stats = options->doStats ? psMetadataAlloc() : NULL; // Statistics to output
     15    psMetadata *stats = NULL;          // Statistics to output
    1616    float timeDetrend = 0;              // Amount of time spent in detrend
    1717    float timePhot = 0;                 // Amount of time spent in photometry
     18
     19    if (options->doStats) {
     20        stats = psMetadataAlloc();
     21        psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", 0, "No problems", 0);
     22    }
    1823
    1924    bool status;                        // Status of MD lookup
     
    139144        psTimerStart(TIMER_PHOT);
    140145        if (options->doPhotom) {
    141             if (!ppImagePhotom(config, view)) {
     146            if (!ppImagePhotom(stats, config, view)) {
    142147                ESCAPE("error running photometry.");
    143148            }
  • branches/pap/ppImage/src/ppImagePhotom.c

    r20410 r23580  
    66
    77// In this function, we perform the psphot analysis routine for the chip-mosaicked images
    8 bool ppImagePhotom (pmConfig *config, pmFPAview *view) {
     8bool ppImagePhotom(psMetadata *stats, pmConfig *config, pmFPAview *view) {
    99
    1010    bool status;
     
    1212    pmReadout *readout;
    1313
    14     psphotInit ();
     14    psphotInit();
    1515
    1616    // find or define a pmFPAfile PSPHOT.INPUT
     
    3737            // run the actual photometry analysis
    3838            if (!psphotReadout (config, view)) {
    39                 psError(psErrorCodeLast(), false, "failure in psphotReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout);
    40                 return false;
     39                // This is likely a data quality issue
     40                // XXX Split into multiple cases using error codes?
     41                psErrorStackPrint("Unable to perform photometry on image");
     42                psWarning("Unable to perform photometry on image --- suspect bad data quality.");
     43                if (stats && psMetadataLookupS32(NULL, stats, "QUALITY") == 0) {
     44                    psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE,
     45                                     "Unable to perform photometry on image", psErrorCodeLast());
     46                }
     47                psErrorClear();
     48                psphotFilesActivate(config, false);
    4149            }
    4250
    43             // we want to save the MASK as modified by psphot, but not the data or weight
    44             // free the old mask and replace with a memory copy of the new mask
    45             pmReadout *oldReadout = pmFPAviewThisReadout (view, input->src);
    46             pmReadout *newReadout = pmFPAviewThisReadout (view, input->fpa);
    47             psFree (oldReadout->mask);
    48             oldReadout->mask = psMemIncrRefCounter (newReadout->mask);
     51            // we want to save the MASK as modified by psphot, but not the data or weight
     52            // free the old mask and replace with a memory copy of the new mask
     53            pmReadout *oldReadout = pmFPAviewThisReadout(view, input->src);
     54            pmReadout *newReadout = pmFPAviewThisReadout(view, input->fpa);
     55            psFree (oldReadout->mask);
     56            oldReadout->mask = psMemIncrRefCounter(newReadout->mask);
    4957        }
    5058    }
  • branches/pap/ppStack/src/ppStackPhotometry.c

    r23462 r23580  
    6969
    7070    if (!psphotReadoutKnownSources(config, photView, inSources)) {
    71         // Clear the error, so that the output files are written.
    72         psError(PS_ERR_UNKNOWN, false, "Unable to perform photometry on stacked image.");
    73         psFree(photView);
    74         return false;
     71        // This is likely a data quality issue
     72        // XXX Split into multiple cases using error codes?
     73        psErrorStackPrint("Unable to perform photometry on image");
     74        psWarning("Unable to perform photometry on image --- suspect bad data quality.");
     75        if (stats && psMetadataLookupS32(NULL, stats, "QUALITY") == 0) {
     76            psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE,
     77                             "Unable to perform photometry on image", psErrorCodeLast());
     78        }
     79        psErrorClear();
     80        psphotFilesActivate(config, false);
    7581    }
    7682
  • branches/pap/ppStack/src/ppStackSetup.c

    r23341 r23580  
    3434        psFree(resolved);
    3535        options->stats = psMetadataAlloc();
     36        psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", 0, "No problems", 0);
    3637    }
    3738
  • branches/pap/ppSub/src/ppSubMakePSF.c

    r23235 r23580  
    8383    psArray *sources = psMetadataLookupPtr(&mdok, minuend->analysis, "PSPHOT.SOURCES");
    8484    if (!psphotReadoutFindPSF(config, view, sources)) {
    85         psError(PS_ERR_UNKNOWN, false, "Unable to perform photometry on subtracted image.");
    86         return false;
     85        // This is likely a data quality issue
     86        // XXX Split into multiple cases using error codes?
     87        psErrorStackPrint("Unable to determine PSF");
     88        psWarning("Unable to determine PSF --- suspect bad data quality.");
     89        if (stats && psMetadataLookupS32(NULL, stats, "QUALITY") == 0) {
     90            psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE,
     91                             "Unable to determine PSF", psErrorCodeLast());
     92        }
     93        psErrorClear();
     94        psphotFilesActivate(config, false);
    8795    }
    8896
     
    98106    return true;
    99107}
    100 
    101 // XXX we used to need this, is it still needed?
    102 
    103 // pmCell *photCell = pmFPAfileThisCell(config->files, view, "PSPHOT.INPUT");
    104 // pmCellFreeReadouts(photCell);
    105 
    106 // if (!pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL") ||
    107 //     !pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL.STDEV") ||
    108 //     !pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND")) {
    109 //     psError(PS_ERR_UNKNOWN, false, "Unable to drop PSPHOT internal files.");
    110 //     return false;
    111 // }
    112 
    113 // Blow away the sources psphot found --- they're irrelevant for the subtraction
    114 // XXX is this still needed?  These are now probably not being set
    115 // pmReadout *photRO = pmFPAviewThisReadout(view, photFile->fpa); // Readout with sources
    116 // psMetadataRemoveKey(photRO->analysis, "PSPHOT.SOURCES");
    117 // psMetadataRemoveKey(photRO->analysis, "PSPHOT.HEADER");
    118 
  • branches/pap/ppSub/src/ppSubReadoutPhotometry.c

    r21524 r23580  
    4545    pmPSF *psf = psMetadataLookupPtr(NULL, psfInputChip->analysis, "PSPHOT.PSF"); // PSF for photometry
    4646    if (!psf) {
    47         psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find PSF from psphot");
    48         return false;
     47        psWarning("No PSF available --- suspect bad data quality.");
     48        if (stats && psMetadataLookupBool(NULL, stats, "QUALITY")) {
     49            psError(PS_ERR_UNEXPECTED_NULL, false, "Bad or unset QUALITY flag");
     50            return false;
     51        }
     52        psErrorClear();
     53        psphotFilesActivate(config, false);
    4954    }
    5055    psMetadataAddPtr(psfLoadChip->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN | PS_META_REPLACE,
     
    8691
    8792    if (!psphotReadoutMinimal(config, view)) {
    88         psWarning("Unable to perform photometry on subtracted image.");
    89         psErrorStackPrint(stderr, "Error stack from photometry:");
     93        // This is likely a data quality issue
     94        // XXX Split into multiple cases using error codes?
     95        psErrorStackPrint("Unable to perform photometry on image");
     96        psWarning("Unable to perform photometry on image --- suspect bad data quality.");
     97        if (stats && psMetadataLookupS32(NULL, stats, "QUALITY") == 0) {
     98            psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE,
     99                             "Unable to perform photometry on image", psErrorCodeLast());
     100        }
    90101        psErrorClear();
     102        psphotFilesActivate(config, false);
    91103    }
    92104#if 1
  • branches/pap/psphot/src/psphot.h

    r23492 r23580  
    3131bool            psphotReadoutCleanup (pmConfig *config, pmReadout *readout, psMetadata *recipe, pmDetections *detections, pmPSF *psf, psArray *sources);
    3232bool            psphotDefineFiles (pmConfig *config, pmFPAfile *input);
     33void            psphotFilesActivate(pmConfig *config, bool state);
     34
    3335bool            psphotSetMaskBits (pmConfig *config);
    3436bool            psphotSetMaskRecipe (pmConfig *config, psImageMaskType maskValue, psImageMaskType markValue);
  • branches/pap/psphot/src/psphotDefineFiles.c

    r14892 r23580  
    11# include "psphotInternal.h"
     2
     3// List of output files
     4static const char *outputFiles = { "PSPHOT.OUTPUT", "PSPHOT.RESID", "PSPHOT.BACKMDL", "PSPHOT.BACKMDL.STDEV",
     5                                   "PSPHOT.BACKGND", "PSPHOT.BACKSUB", "PSPHOT.PSF.SAVE",
     6                                   "SOURCE.PLOT.MOMENTS", "SOURCE.PLOT.PSFMODEL", "SOURCE.PLOT.APRESID",
     7                                   NULL };
    28
    39// XXX we need to be able to distinguish several cases:
     
    133139    return true;
    134140}
     141
     142void psphotFilesActivate(pmConfig *config, bool state)
     143{
     144    for (int i = 0; outputFiles[i]; i++) {
     145        if (!pmFPAfileActivate(config->files, state, outputFiles[i])) {
     146            psErrorClear();
     147        }
     148    }
     149
     150    return;
     151}
  • branches/pap/pswarp/src/pswarpLoop.c

    r23314 r23580  
    142142        psFree(resolved);
    143143        stats = psMetadataAlloc();
     144        psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", 0, "No problems", 0);
    144145    }
    145146
     
    364365    fileActivation(config, independentFiles, false);
    365366
    366     // We need a new PSF model for the warped frame.  It would be good to generate this analytically, but that's going to be tricky.
    367     // We have a list of sources, so we use those to redetermine the PSF model.
     367    // We need a new PSF model for the warped frame.  It would be good to generate this analytically, but
     368    // that's going to be tricky.  We have a list of sources, so we use those to redetermine the PSF model.
    368369
    369370    if (psMetadataLookupBool(&mdok, config->arguments, "PSF")) {
     
    394395        // measure the PSF using these sources
    395396        if (!psphotReadoutFindPSF(config, view, sources)) {
    396             psError(PS_ERR_UNKNOWN, false, "Unable to determine PSF for warped image.");
    397             return false;
     397            // This is likely a data quality issue
     398            // XXX Split into multiple cases using error codes?
     399            psErrorStackPrint("Unable to determine PSF");
     400            psWarning("Unable to determine PSF --- suspect bad data quality.");
     401            if (stats && psMetadataLookupS32(NULL, stats, "QUALITY") == 0) {
     402                psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE,
     403                                 "Unable to determine PSF", psErrorCodeLast());
     404            }
     405            psErrorClear();
     406            psphotFilesActivate(config, false);
    398407        }
    399408
Note: See TracChangeset for help on using the changeset viewer.