IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 29, 2010, 3:55:49 PM (16 years ago)
Author:
eugene
Message:

update merges from trunk

Location:
branches/eam_branches/20100225
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20100225

  • branches/eam_branches/20100225/ppStack/src/ppStackFinish.c

    r27059 r27517  
    77#include <pslib.h>
    88#include <psmodules.h>
    9 #include <ppStats.h>
     9#include <psphot.h>
    1010
    1111#include "ppStack.h"
     
    4949
    5050
    51     // Statistics on output
    52     if (options->stats) {
    53         psTrace("ppStack", 1, "Gathering statistics on stacked image....\n");
    54         psString maskBadStr = psMetadataLookupStr(NULL, recipe, "MASK.BAD"); // Name of bits for bad
    55         psImageMaskType maskBad = pmConfigMaskGet(maskBadStr, config); // Bits to mask for bad pixels
     51    return true;
     52}
    5653
    57         pmFPAview *view = pmFPAviewAlloc(0); // View to readout
    58         view->chip = view->cell = view->readout = 0;
    5954
    60         ppStatsFPA(options->stats, options->outRO->parent->parent->parent, view, maskBad, config);
    61 
    62         psFree(view);
     55psExit ppStackExitCode(psExit exitValue)
     56{
     57    if (exitValue != PS_EXIT_SUCCESS) {
     58        return exitValue;
    6359    }
    6460
    65     ppStackMemDump("stats");
    66 
    67     psFree(options->outRO); options->outRO = NULL;
    68 
    69     // Write out the output files
    70     if (!ppStackFilesIterateUp(config)) {
    71         return false;
    72     }
    73 
    74     // Write out summary statistics
    75     if (options->stats) {
    76         psMetadataAddF32(options->stats, PS_LIST_TAIL, "TIME_STACK", 0,
    77                          "Total time", psTimerClear("PPSTACK_TOTAL"));
    78 
    79         const char *statsMDC = psMetadataConfigFormat(options->stats);
    80         if (!statsMDC || strlen(statsMDC) == 0) {
    81             psError(PS_ERR_IO, false, "Unable to get statistics MDC file.");
    82             return false;
    83         }
    84         if (fprintf(options->statsFile, "%s", statsMDC) != strlen(statsMDC)) {
    85             psError(PS_ERR_IO, false, "Unable to write statistics MDC file.");
    86             return false;
    87         }
    88         psFree(statsMDC);
    89         if (fclose(options->statsFile) == EOF) {
    90             psError(PS_ERR_IO, false, "Unable to close statistics MDC file.");
    91             return false;
    92         }
    93         options->statsFile = NULL;
    94         pmConfigRunFilenameAddWrite(config, "STATS", psMetadataLookupStr(NULL, config->arguments, "STATS"));
    95     }
    96 
    97     // Dump configuration
    98     psString dump = psMetadataLookupStr(&mdok, config->arguments, "DUMP_CONFIG"); // File for config
    99     if (dump) {
    100         if (!pmConfigDump(config, dump)) {
    101             psError(psErrorCodeLast(), false, "Unable to dump configuration.");
    102             return false;
     61    psErrorCode errorCode = psErrorCodeLast(); // Error code
     62    if (errorCode != PS_ERR_NONE) {
     63        psErrorStackPrint(stderr, "Unable to perform stack.");
     64        switch (errorCode) {
     65          case PPSTACK_ERR_UNKNOWN:
     66          case PS_ERR_UNKNOWN:
     67            psLogMsg("ppStack", PS_LOG_WARN, "Unknown error code: %x", errorCode);
     68            exitValue = PS_EXIT_UNKNOWN_ERROR;
     69            break;
     70          case PS_ERR_IO:
     71          case PS_ERR_DB_CLIENT:
     72          case PS_ERR_DB_SERVER:
     73          case PS_ERR_BAD_FITS:
     74          case PS_ERR_OS_CALL_FAILED:
     75          case PM_ERR_SYS:
     76          case PPSTACK_ERR_IO:
     77            psLogMsg("ppStack", PS_LOG_WARN, "I/O error code: %x", errorCode);
     78            exitValue = PS_EXIT_SYS_ERROR;
     79            break;
     80          case PS_ERR_BAD_PARAMETER_VALUE:
     81          case PS_ERR_BAD_PARAMETER_TYPE:
     82          case PS_ERR_BAD_PARAMETER_NULL:
     83          case PS_ERR_BAD_PARAMETER_SIZE:
     84          case PPSTACK_ERR_ARGUMENTS:
     85          case PPSTACK_ERR_CONFIG:
     86            psLogMsg("ppStack", PS_LOG_WARN, "Configuration error code: %x", errorCode);
     87            exitValue = PS_EXIT_CONFIG_ERROR;
     88            break;
     89          case PPSTACK_ERR_PSF:
     90          case PSPHOT_ERR_PSF:
     91          case PM_ERR_STAMPS:
     92          case PM_ERR_SMALL_AREA:
     93          case PPSTACK_ERR_REJECTED:
     94          case PPSTACK_ERR_DATA:
     95            psLogMsg("ppStack", PS_LOG_WARN, "Data error code: %x", errorCode);
     96            exitValue = PS_EXIT_DATA_ERROR;
     97            break;
     98          case PS_ERR_UNEXPECTED_NULL:
     99          case PS_ERR_PROGRAMMING:
     100          case PPSTACK_ERR_NOT_IMPLEMENTED:
     101          case PPSTACK_ERR_PROG:
     102            psLogMsg("ppStack", PS_LOG_WARN, "Programming error code: %x", errorCode);
     103            exitValue = PS_EXIT_PROG_ERROR;
     104            break;
     105          default:
     106            // It's a programming error if we're not dealing with the error correctly
     107            psLogMsg("ppStack", PS_LOG_WARN, "Unrecognised error code: %x", errorCode);
     108            exitValue = PS_EXIT_PROG_ERROR;
     109            break;
    103110        }
    104111    }
    105 
    106     return true;
     112    return exitValue;
    107113}
Note: See TracChangeset for help on using the changeset viewer.