Changeset 13999
- Timestamp:
- Jul 3, 2007, 10:00:03 AM (19 years ago)
- Location:
- trunk/ppStats/src
- Files:
-
- 2 added
- 6 edited
-
Makefile.am (modified) (1 diff)
-
ppStats.config (modified) (1 diff)
-
ppStats.h (modified) (3 diffs)
-
ppStatsData.c (modified) (2 diffs)
-
ppStatsLoop.c (modified) (15 diffs)
-
ppStatsMetadata.c (added)
-
ppStatsPixels.c (added)
-
ppStatsSetupFromRecipe.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppStats/src/Makefile.am
r13993 r13999 17 17 ppStatsFringe.c \ 18 18 ppStatsLoop.c \ 19 ppStatsPixels.c \ 20 ppStatsMetadata.c \ 19 21 ppStatsSetupFromRecipe.c \ 20 22 ppStatsSetupFromArgs.c \ -
trunk/ppStats/src/ppStats.config
r7902 r13999 2 2 3 3 MULTI HEADERS # May specify multiple HEADERS 4 HEADERS STR HEADER1,HEADER2 # Read these headers 5 HEADERS STR HEADER3 # Read these headers too 4 HEADER STR HEADER1,HEADER2 # Read these headers 5 HEADER STR HEADER3 # Read these headers too 6 6 7 MULTI STATS # May specify multiple STATS 7 STATS STR SAMPLE_MEAN,SAMPLE_STDEV # Calculate these statistics 8 STATS STR ROBUST_MEDIAN # Calculate these statistics too 8 STAT STR SAMPLE_MEAN,SAMPLE_STDEV # Calculate these statistics 9 STAT STR ROBUST_MEDIAN # Calculate these statistics too 10 11 MULTI ANALYSIS # metadata blocks to search in chip/cell/readout->analysis 12 ANALYSIS STR PSPHOT.HEADER 13 ANALYSIS STR PSASTRO.HEADER 9 14 10 15 SAMPLE F32 0.1 # Fraction of cell to sample -
trunk/ppStats/src/ppStats.h
r13993 r13999 11 11 pmFPAview *view; // View to analyse 12 12 // Stuff to output 13 psStats *stats; // Statistics to calculate14 bool doStats; // Do statistics?13 psStats *stats; // pixel Statistics to calculate 14 bool doStats; // Do pixel statistics? 15 15 bool fileLevel; // Output file level? 16 16 psList *headers; // Headers to read 17 17 psList *concepts; // Concepts to read 18 psList *analysis; // Analysis entries to read 18 19 psList *summary; // Summary statistics to calculate 19 20 // Options for input data … … 35 36 ); 36 37 38 psExit ppStatsChip(psMetadata *fpaResults, // Metadata holding the fpa results 39 pmChip *chip, // Chip for which to get statistics 40 psFits *fits, // FITS file handle 41 pmFPAview *view, // View for analysis 42 ppStatsData *data,// The data 43 const pmConfig *config // Configuration 44 ); 45 46 psExit ppStatsCell(psMetadata *chipResults, // Metadata holding the chip results 47 pmCell *cell, // Cell for which to get statistics 48 psFits *fits, // FITS file handle 49 ppStatsData *data,// The data 50 const pmConfig *config // Configuration 51 ); 52 37 53 /// Supplement the statistics with the fringe solution 38 54 bool ppStatsFringe(psMetadata *stats, ///< Statistics metadata to supplement … … 42 58 ); 43 59 60 61 // measure only the pixel-related statistics (stats, summary) 62 psMetadata *ppStatsPixels(psMetadata *out, 63 pmFPA *fpa, // FPA for which to get statistics 64 pmFPAview *view, // View for analysis 65 psMaskType maskVal, // Value to mask 66 pmConfig *config // Configuration 67 ); 68 69 // measure only the non-pixel-related statistics (headers, concepts) 70 psMetadata *ppStatsMetadata(psMetadata *out, 71 pmFPA *fpa, // FPA for which to get statistics 72 pmFPAview *view, // View for analysis 73 psMaskType maskVal, // Value to mask 74 pmConfig *config // Configuration 75 ); 44 76 45 77 /// Loop over the input image and do all the hard work -
trunk/ppStats/src/ppStatsData.c
r13993 r13999 12 12 psFree(data->headers); 13 13 psFree(data->concepts); 14 psFree(data->analysis); 14 15 psFree(data->summary); 15 16 … … 34 35 data->headers = psListAlloc(NULL); 35 36 data->concepts = psListAlloc(NULL); 37 data->analysis = psListAlloc(NULL); 36 38 data->summary = psListAlloc(NULL); 37 39 data->stats = psStatsAlloc(0); -
trunk/ppStats/src/ppStatsLoop.c
r13993 r13999 1 # include "ppStatsInternal.h"1 # include "ppStatsInternal.h" 2 2 3 3 static void getMetadata(psMetadata *target, // Target for metadata … … 12 12 if (item) { 13 13 psMetadataAddItem(target, item, PS_LIST_TAIL, 0); 14 } 15 } 16 psFree(iterator); 17 return; 18 } 19 20 static void getAnalysis(psMetadata *target, // Output Target for metadata 21 psList *headers, // List containing desired keywords 22 psMetadata *source, // Input Source for metadata 23 psList *list // List containing analysis blocks 24 ) 25 { 26 bool status; 27 28 psListIterator *iterator = psListIteratorAlloc(list, PS_LIST_HEAD, false); // Iterator 29 psString name; // Name from iteration 30 while ((name = psListGetAndIncrement(iterator))) { 31 psMetadata *folder = psMetadataLookupMetadata(&status, source, name); // Item of interest, or NULL 32 if (folder) { 33 getMetadata (target, folder, headers); 14 34 } 15 35 } … … 55 75 56 76 57 static psExit cellStats(psMetadata *chipResults, // Metadata holding the chip results58 pmCell *cell,// Cell for which to get statistics59 psFits *fits,// FITS file handle60 ppStatsData *data,// The data61 const pmConfig *config // Configuration77 psExit ppStatsCell(psMetadata *chipResults, // Metadata holding the chip results 78 pmCell *cell, // Cell for which to get statistics 79 psFits *fits, // FITS file handle 80 ppStatsData *data, // The data 81 const pmConfig *config // Configuration 62 82 ) 63 83 { … … 73 93 return PS_EXIT_SUCCESS; 74 94 } 95 96 // select the header unit for this cell 75 97 pmHDU *hdu = pmHDUFromCell(cell); // HDU for cell 76 98 if (!hdu || hdu->blankPHU) { … … 84 106 } 85 107 86 // Cell-level results 108 /*** psphot and psastro put their results on the readout->analysis metadata (PSPHOT.HEADER, 109 PSASTRO.HEADER). we need to pull quantities of interest from those locations. to do 110 this, we need to select the appropriate readout. ***/ 111 112 // Select the readout 113 psArray *readouts = cell->readouts; // Array of component readouts 114 if (readouts->n == 0) { 115 psLogMsg(__func__, PS_LOG_WARN, "No readouts present in cell %s --- skipping\n", cellName); 116 goto cellDone; 117 } 118 if (readouts->n > 1) { 119 psLogMsg(__func__, PS_LOG_WARN, "Multiple readouts (%ld) present in cell %s --- " 120 "using only the first.\n", readouts->n, cellName); 121 } 122 pmReadout *readout = readouts->data[0]; // The readout of interest 123 124 // Extract Header and Concept values from the Cell and Readout->analysis level 87 125 bool mdok; // Status of MD lookup 88 126 psMetadata *cellResults = psMemIncrRefCounter(psMetadataLookupMetadata(&mdok, chipResults, cellName)); … … 91 129 } 92 130 131 // Extract Header values 93 132 if (psListLength(data->headers) > 0 && cell->hdu) { 94 133 if (fits && !pmCellReadHeader(cell, fits)) { … … 99 138 pmHDU *hdu = cell->hdu; // HDU for headers 100 139 getMetadata(cellResults, hdu->header, data->headers); 101 } 140 141 // search in the readout->analysis metadata blocks listed in data->analysis 142 if (psListLength(data->analysis) > 0) { 143 getAnalysis (cellResults, data->headers, readout->analysis, data->analysis); 144 } 145 } 146 147 // Extract Concept values 102 148 if (psListLength(data->concepts) > 0) { 103 149 if (fits && cell->hdu && !pmCellReadHeader(cell, fits)) { … … 110 156 } 111 157 158 // Do we want to measure pixel statistics? 112 159 if (!data->doStats && psListLength(data->summary)) { 113 160 // Nothing further to do --- don't want to waste our time reading the data … … 115 162 } 116 163 164 // Read the image pixel data 117 165 if (fits && !pmCellRead(cell, fits, config->database)) { 118 166 psError (PS_ERR_IO, false, "trouble reading cell data\n"); … … 121 169 } 122 170 123 psArray *readouts = cell->readouts; // Array of component readouts124 if (readouts->n == 0) {125 psLogMsg(__func__, PS_LOG_WARN, "No readouts present in cell %s --- skipping\n", cellName);126 goto cellDone;127 }128 if (readouts->n > 1) {129 psLogMsg(__func__, PS_LOG_WARN, "Multiple readouts (%ld) present in cell %s --- "130 "using only the first.\n", readouts->n, cellName);131 }132 pmReadout *readout = readouts->data[0]; // The readout of interest133 171 if (!readout->image) { 134 172 psLogMsg(__func__, PS_LOG_WARN, "No image associated with readout in cell %s --- ignored.\n", cellName); … … 243 281 } 244 282 245 static psExit chipStats(psMetadata *fpaResults, // Metadata holding the fpa results246 pmChip *chip, // Chip for which to get statistics247 psFits *fits, // FITS file handle248 pmFPAview *view, // View for analysis249 ppStatsData *data,// The data250 const pmConfig *config // Configuration283 psExit ppStatsChip(psMetadata *fpaResults, // Metadata holding the fpa results 284 pmChip *chip, // Chip for which to get statistics 285 psFits *fits, // FITS file handle 286 pmFPAview *view, // View for analysis 287 ppStatsData *data,// The data 288 const pmConfig *config // Configuration 251 289 ) 252 290 { … … 301 339 if (view->cell >= 0) { 302 340 pmCell *cell = cells->data[view->cell]; // Cell of interest 303 result = cellStats(chipResults, cell, fits, data, config);341 result = ppStatsCell(chipResults, cell, fits, data, config); 304 342 if (result != PS_EXIT_SUCCESS) { 305 343 psError(PS_ERR_UNKNOWN, false, "trouble with cell stats for %d\n", view->cell); … … 316 354 for (int i = 0; i < cells->n; i++) { 317 355 pmCell *cell = cells->data[i]; // Cell of interest 318 result = cellStats(chipResults, cell, fits, data, config);356 result = ppStatsCell(chipResults, cell, fits, data, config); 319 357 if (result != PS_EXIT_SUCCESS) { 320 358 psError(PS_ERR_UNKNOWN, false, "trouble with cell stats for %d\n", i); … … 380 418 if (view->chip >= 0) { 381 419 pmChip *chip = chips->data[view->chip]; // Chip of interest 382 *result = chipStats(newResults, chip, fits, view, data, config);420 *result = ppStatsChip(newResults, chip, fits, view, data, config); 383 421 if (*result != PS_EXIT_SUCCESS) { 384 422 psError(PS_ERR_UNKNOWN, false, "trouble with stats for cell %d\n", view->cell); … … 394 432 } 395 433 396 // Iterate over c ells434 // Iterate over chips 397 435 for (int i = 0; i < chips->n; i++) { 398 436 pmChip *chip = chips->data[i]; // Chip of interest 399 *result = chipStats(newResults, chip, fits, view, data, config);437 *result = ppStatsChip(newResults, chip, fits, view, data, config); 400 438 if (*result != PS_EXIT_SUCCESS) { 401 439 psError(PS_ERR_UNKNOWN, false, "trouble with stats for chip %d\n", i); -
trunk/ppStats/src/ppStatsSetupFromRecipe.c
r13993 r13999 73 73 listFromRecipe(data->headers, recipe, "HEADER"); 74 74 listFromRecipe(data->concepts, recipe, "CONCEPT"); 75 listFromRecipe(data->analysis, recipe, "ANALYSIS"); 75 76 76 77 // Parse SUMMARY statistics information
Note:
See TracChangeset
for help on using the changeset viewer.
