- Timestamp:
- May 3, 2010, 8:50:52 AM (16 years ago)
- Location:
- branches/simtest_nebulous_branches
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ppStack/src (modified) (1 prop)
-
ppStack/src/ppStack.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simtest_nebulous_branches
- Property svn:mergeinfo changed
-
branches/simtest_nebulous_branches/ppStack/src
- Property svn:ignore
-
old new 10 10 stamp-h1 11 11 ppStackVersionDefinitions.h 12 ppStackErrorCodes.c 13 ppStackErrorCodes.h
-
- Property svn:ignore
-
branches/simtest_nebulous_branches/ppStack/src/ppStack.c
r23341 r27840 15 15 int main(int argc, char *argv[]) 16 16 { 17 ps Exit exitValue = PS_EXIT_SUCCESS; // Exit value17 psLibInit(NULL); 18 18 psTimerStart(TIMER_NAME); 19 19 psTimerStart("PPSTACK_STEPS"); 20 psLibInit(NULL); 20 21 pmErrorRegister(); 22 ppStackErrorRegister(); 23 psphotErrorRegister(); 21 24 22 25 pmConfig *config = pmConfigRead(&argc, argv, PPSTACK_RECIPE); // Configuration 26 ppStackOptions *options = NULL; // Options for stacking 23 27 if (!config) { 24 psErrorStackPrint(stderr, "Error reading configuration.");25 exitValue = PS_EXIT_CONFIG_ERROR;26 goto die;27 }28 29 (void) psTraceSetLevel("ppStack", 5);30 31 if (!ppStackArgumentsSetup(argc, argv, config)) {32 psErrorStackPrint(stderr, "Error reading arguments.\n");33 exitValue = PS_EXIT_CONFIG_ERROR;34 28 goto die; 35 29 } … … 38 32 39 33 if (!pmModelClassInit()) { 40 psErrorStackPrint(stderr, "Error initialising model classes.\n"); 41 exitValue = PS_EXIT_PROG_ERROR; 34 psError(PPSTACK_ERR_PROG, false, "Unable to initialise model classes."); 42 35 goto die; 43 36 } 44 37 45 38 if (!psphotInit()) { 46 psErrorStackPrint(stderr, "Error initialising psphot.\n"); 47 exitValue = PS_EXIT_PROG_ERROR; 39 psError(PPSTACK_ERR_PROG, false, "Error initialising psphot."); 40 goto die; 41 } 42 43 (void)psTraceSetLevel("ppStack", 5); 44 45 if (!ppStackArgumentsSetup(argc, argv, config)) { 48 46 goto die; 49 47 } 50 48 51 49 if (!ppStackCamera(config)) { 52 psErrorStackPrint(stderr, "Error setting up input files.\n");53 exitValue = PS_EXIT_CONFIG_ERROR;54 50 goto die; 55 51 } 56 52 57 53 if (!ppStackArgumentsParse(config)) { 58 psErrorStackPrint(stderr, "Error reading arguments.\n");59 exitValue = PS_EXIT_CONFIG_ERROR;60 54 goto die; 61 55 } 62 56 63 if (!ppStackLoop(config)) { 64 psErrorStackPrint(stderr, "Error performing combination.\n"); 65 exitValue = PS_EXIT_DATA_ERROR; 57 options = ppStackOptionsAlloc(); 58 if (!ppStackLoop(config, options)) { 66 59 goto die; 67 60 } 68 61 69 62 70 // Common code for the death.71 die: 72 psTrace("ppStack", 1, "Finished at %f sec\n", psTimerMark(TIMER_NAME));73 psTimerStop();63 die: 64 // Common code for the death. 65 { 66 psExit exitValue = ppStackExitCode(PS_EXIT_SUCCESS); // Exit code 74 67 75 psFree(config); 76 pmModelClassCleanup(); 77 pmConfigDone(); 78 psLibFinalize(); 79 pmVisualClose(); 80 exit(exitValue); 68 // Ensure everything closes 69 if (config) { 70 ppStackFileActivation(config, PPSTACK_FILES_PREPARE, true); 71 ppStackFileActivation(config, PPSTACK_FILES_CONVOLVE, true); 72 ppStackFileActivation(config, PPSTACK_FILES_STACK, true); 73 ppStackFileActivation(config, PPSTACK_FILES_UNCONV, true); 74 ppStackFileActivation(config, PPSTACK_FILES_PHOT, true); 75 if (!ppStackFilesIterateUp(config)) { 76 psError(psErrorCodeLast(), false, "Unable to close files."); 77 exitValue = ppStackExitCode(exitValue); 78 pmFPAfileFreeSetStrict(false); 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); 116 } 117 118 psTrace("ppStack", 1, "Finished at %f sec\n", psTimerMark(TIMER_NAME)); 119 psTimerStop(); 120 121 psFree(config); 122 pmModelClassCleanup(); 123 pmConfigDone(); 124 psLibFinalize(); 125 pmVisualClose(); 126 127 exitValue = ppStackExitCode(exitValue); 128 exit(exitValue); 129 } 81 130 } 82 131
Note:
See TracChangeset
for help on using the changeset viewer.
