- Timestamp:
- May 26, 2009, 1:59:32 PM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090301
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
psastro (modified) (1 prop)
-
psastro/src (modified) (1 prop)
-
psastro/src/psastroMetadataStats.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090301
- Property svn:mergeinfo changed
-
branches/cnb_branches/cnb_branch_20090301/psastro
- Property svn:mergeinfo changed
-
branches/cnb_branches/cnb_branch_20090301/psastro/src
- Property svn:ignore
-
old new 17 17 psastroModelFit 18 18 psastroExtract 19 psastroVersionDefinitions.h
-
- Property svn:ignore
-
branches/cnb_branches/cnb_branch_20090301/psastro/src/psastroMetadataStats.c
r21409 r24244 13 13 # include "psastroInternal.h" 14 14 15 bool psastroMetadataStats (pmConfig *config ) {15 bool psastroMetadataStats (pmConfig *config, psMetadata *stats) { 16 16 17 17 bool status; … … 24 24 25 25 if (!output) { 26 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find output file (PSASTRO.OUTPUT).");27 return false;26 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find output file (PSASTRO.OUTPUT)."); 27 return false; 28 28 } 29 29 30 // create output stats metadata 31 psMetadata *stats = psMetadataAlloc (); 32 33 // extract stats for the complete fpa 30 // extract stats for the complete fpa 34 31 pmFPAview *view = pmFPAviewAlloc(0); 35 32 36 33 if (!ppStatsMetadata(stats, output->fpa, view, 0, config)) { 37 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate stats for image."); 38 psFree(view); 39 psFree(stats); 40 return false; 34 psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to generate stats for image."); 35 psFree(view); 36 return false; 41 37 } 42 38 43 39 // if we did not request any specific stats, the structure is empty 44 40 if (stats && stats->list->n == 0) { 45 psWarning ("stats output specified, but no requested stats entries in headers"); 46 psFree(view); 47 psFree(stats); 48 return true; 41 psWarning ("stats output specified, but no requested stats entries in headers"); 42 psFree(view); 43 return true; 49 44 } 50 45 … … 52 47 char *statsMDC = psMetadataConfigFormat(stats); 53 48 if (!statsMDC || strlen(statsMDC) == 0) { 54 psError(PS_ERR_IO, false, "Unable to serialize stats metadata.\n");55 return false;56 } 49 psError(PS_ERR_IO, false, "Unable to serialize stats metadata.\n"); 50 return false; 51 } 57 52 58 53 // convert to a real UNIX filename … … 60 55 FILE *statsFile = fopen (resolved, "w"); 61 56 if (!statsFile) { 62 psError(PS_ERR_IO, true, "Unable to open statistics file %s for writing.\n", resolved); 63 psFree(stats); 64 psFree(view); 65 psFree(statsMDC); 66 psFree(resolved); 67 return false; 57 psError(PS_ERR_IO, true, "Unable to open statistics file %s for writing.\n", resolved); 58 psFree(view); 59 psFree(statsMDC); 60 psFree(resolved); 61 return false; 68 62 } 69 63 70 64 // write the stats MDC to a file 71 // XXX why does this not call psMetadataConfigPrint?72 65 fprintf(statsFile, "%s", statsMDC); 73 66 fclose(statsFile); 67 68 pmConfigRunFilenameAddWrite(config, "STATS", filename); 74 69 75 70 psFree(resolved); 76 71 psFree(statsMDC); 77 72 psFree(view); 78 psFree(stats);79 73 return true; 80 74 }
Note:
See TracChangeset
for help on using the changeset viewer.
