IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 24, 2022, 4:27:00 PM (4 years ago)
Author:
eugene
Message:

catch errors in psphotForcedReadout and defer to the end; raise bad quality if no chips succeed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20220316/fpcamera/src/fpcameraAnalysis.c

    r42186 r42225  
    4141    if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE(FPCAMERA_ERR_DATA, "failed to load images at FPA level");
    4242
     43    // count the number of sucesses and raise bad quality if none succeed
     44    int nChipGood = 0;
     45    int nChipTotal = 0;
     46
    4347    // load images at chip level (if appropriate)
    4448    while ((chip = pmFPAviewNextChip (view, input->fpa, 1)) != NULL) {
     49        nChipTotal ++;
    4550        psTrace ("fpcamera", 4, "Chip %d: %x %x\n", view->chip, chip->file_exists, chip->process);
    4651        if (!chip->process || !chip->file_exists) { continue; }
     
    6873                psFree (psf);
    6974
    70                 if (!psphotForcedReadout (config, view, "FPCAMERA.INPUT")) ESCAPE(FPCAMERA_ERR_DATA, "failure in psphotForcedReadout");
     75                if (!psphotForcedReadout (config, view, "FPCAMERA.INPUT")) {
     76                    // This is likely a data quality issue, e.g. no stars on a chip
     77                    // Do not raise an error, but do not add to count of good chips
     78                    psErrorStackPrint(stderr, "Unable to perform photometry on image");
     79                    psWarning("Unable to perform photometry on image --- suspect bad data quality.");
     80                    psErrorClear();
     81                    continue;
     82                }
     83                nChipGood ++;
    7184            }
    7285            // drop all versions of the internal files
     
    8093    }
    8194    if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE(FPCAMERA_ERR_IO, "failure in IOChecks(AFTER) at FPA");
     95
     96    if (!nChipGood) {
     97        if (stats && psMetadataLookupS32(NULL, stats, "QUALITY") == 0) {
     98            psMetadataAddS32(stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE, "Unable to perform photometry on image", FPCAMERA_ERR_DATA);
     99        }
     100    }
     101    psLogMsg("fpcamera", 3, "fpcameraAnalysis: %d of %d chips are good\n", nChipGood, nChipTotal);
    82102
    83103    psFree (view);
Note: See TracChangeset for help on using the changeset viewer.