Changeset 27517 for branches/eam_branches/20100225/ppStack/src/ppStack.c
- Timestamp:
- Mar 29, 2010, 3:55:49 PM (16 years ago)
- Location:
- branches/eam_branches/20100225
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ppStack/src/ppStack.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20100225
- Property svn:mergeinfo changed
-
branches/eam_branches/20100225/ppStack/src/ppStack.c
r27076 r27517 19 19 psTimerStart("PPSTACK_STEPS"); 20 20 21 pmErrorRegister(); 22 ppStackErrorRegister(); 23 psphotErrorRegister(); 24 21 25 pmConfig *config = pmConfigRead(&argc, argv, PPSTACK_RECIPE); // Configuration 26 ppStackOptions *options = NULL; // Options for stacking 22 27 if (!config) { 23 28 goto die; … … 50 55 } 51 56 52 if (!ppStackLoop(config)) { 57 options = ppStackOptionsAlloc(); 58 if (!ppStackLoop(config, options)) { 53 59 goto die; 54 60 } … … 58 64 // Common code for the death. 59 65 { 60 psExit exitValue = PS_EXIT_SUCCESS; // Exit value for program 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 exitValue = PS_EXIT_UNKNOWN_ERROR; 68 break; 69 case PS_ERR_IO: 70 case PS_ERR_DB_CLIENT: 71 case PS_ERR_DB_SERVER: 72 case PS_ERR_BAD_FITS: 73 case PS_ERR_OS_CALL_FAILED: 74 case PPSTACK_ERR_IO: 75 exitValue = PS_EXIT_SYS_ERROR; 76 break; 77 case PS_ERR_BAD_PARAMETER_VALUE: 78 case PS_ERR_BAD_PARAMETER_TYPE: 79 case PS_ERR_BAD_PARAMETER_NULL: 80 case PS_ERR_BAD_PARAMETER_SIZE: 81 case PPSTACK_ERR_ARGUMENTS: 82 case PPSTACK_ERR_CONFIG: 83 exitValue = PS_EXIT_CONFIG_ERROR; 84 break; 85 case PPSTACK_ERR_PSF: 86 case PPSTACK_ERR_REJECTED: 87 case PPSTACK_ERR_DATA: 88 exitValue = PS_EXIT_DATA_ERROR; 89 break; 90 case PS_ERR_UNEXPECTED_NULL: 91 case PS_ERR_PROGRAMMING: 92 case PPSTACK_ERR_NOT_IMPLEMENTED: 93 case PPSTACK_ERR_PROG: 94 default: 95 // It's a programming error if we're not dealing with the error correctly 96 exitValue = PS_EXIT_PROG_ERROR; 97 break; 98 } 99 } 66 psExit exitValue = ppStackExitCode(PS_EXIT_SUCCESS); // Exit code 100 67 101 68 // Ensure everything closes … … 103 70 ppStackFileActivation(config, PPSTACK_FILES_PREPARE, true); 104 71 ppStackFileActivation(config, PPSTACK_FILES_CONVOLVE, true); 105 ppStackFileActivation(config, PPSTACK_FILES_COMBINE, true); 72 ppStackFileActivation(config, PPSTACK_FILES_STACK, true); 73 ppStackFileActivation(config, PPSTACK_FILES_UNCONV, true); 106 74 ppStackFileActivation(config, PPSTACK_FILES_PHOT, true); 107 75 if (!ppStackFilesIterateUp(config)) { 108 psErrorStackPrint(stderr, "Unable to close files."); 76 psError(psErrorCodeLast(), false, "Unable to close files."); 77 exitValue = ppStackExitCode(exitValue); 78 pmFPAfileFreeSetStrict(false); 109 79 } 80 } 81 82 // Write out summary statistics 83 if (options && options->stats) { 84 85 psMetadataAddS32(options->stats, PS_LIST_TAIL, "QUALITY", PS_META_REPLACE, 86 "Bad data quality flag", options->quality); 87 psMetadataAddF32(options->stats, PS_LIST_TAIL, "TIME_STACK", 0, 88 "Total time", psTimerClear("PPSTACK_TOTAL")); 89 90 const char *statsMDC = psMetadataConfigFormat(options->stats); 91 if (!statsMDC || strlen(statsMDC) == 0) { 92 psError(PS_ERR_IO, false, "Unable to get statistics MDC file."); 93 return false; 94 } 95 if (fprintf(options->statsFile, "%s", statsMDC) != strlen(statsMDC)) { 96 psError(PS_ERR_IO, false, "Unable to write statistics MDC file."); 97 return false; 98 } 99 psFree(statsMDC); 100 if (fclose(options->statsFile) == EOF) { 101 psError(PS_ERR_IO, false, "Unable to close statistics MDC file."); 102 return false; 103 } 104 options->statsFile = NULL; 105 pmConfigRunFilenameAddWrite(config, "STATS", 106 psMetadataLookupStr(NULL, config->arguments, "STATS")); 107 } 108 psFree(options); 109 110 // Dump configuration 111 bool mdok; // Status of MD lookup 112 psString dump = psMetadataLookupStr(&mdok, config->arguments, "DUMP_CONFIG"); // File for config 113 if (dump && !pmConfigDump(config, dump)) { 114 psError(psErrorCodeLast(), false, "Unable to dump configuration."); 115 exitValue = ppStackExitCode(exitValue); 110 116 } 111 117 … … 119 125 pmVisualClose(); 120 126 127 exitValue = ppStackExitCode(exitValue); 121 128 exit(exitValue); 122 129 }
Note:
See TracChangeset
for help on using the changeset viewer.
