- Timestamp:
- Feb 5, 2010, 1:12:28 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091201/ppImage/src/ppImageDetrendPattern.c
r26776 r26780 5 5 #include "ppImage.h" 6 6 7 #define ESCAPE( MESSAGE) {\8 psError(PS_ERR_UNKNOWN, false, MESSAGE);\7 #define ESCAPE(STATUS,...) { \ 8 psError(PS_ERR_UNKNOWN, STATUS, __VA_ARGS__); \ 9 9 psFree(view); \ 10 10 return false; \ 11 11 } 12 13 static bool doPatternForView (bool *doit, const pmConfig *config, const pmChip *chip, const pmFPAview *view, const char *recipename, const char *recipevalue); 12 14 13 15 bool ppImageDetrendPatternApply(pmConfig *config, pmChip *chip, const pmFPAview *inputView, … … 31 33 } 32 34 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 33 ESCAPE("load failure for Cell");35 ESCAPE(false, "load failure for Cell"); 34 36 } 35 37 … … 43 45 } 44 46 45 psMetadataItem *doPattern = pmConfigRecipeValueByView(config, RECIPE_NAME, "PATTERN.ROW.SUBSET", 46 chip->parent, view); // Do pattern corr? 47 if (!doPattern || doPattern->type != PS_DATA_BOOL) { 48 ESCAPE("Unable to determine whether row pattern correction should be applied."); 49 } 50 if (!doPattern->data.B) { 51 continue; 52 } 47 bool doPattern = false; 48 if (!doPatternForView(&doPattern, config, chip, view, RECIPE_NAME, "PATTERN.ROW.SUBSET")) { 49 ESCAPE(false, "Unable to determine whether row pattern matching should be applied."); 50 } 51 if (!doPattern) continue; 53 52 54 53 psLogMsg("ppImage", PS_LOG_INFO, "Performing row pattern correction for %d,%d\n", … … 59 58 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 60 59 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 61 ESCAPE("load failure for Readout");60 ESCAPE(false, "load failure for Readout"); 62 61 } 63 62 if (!readout->data_exists) { … … 84 83 for (int i = 0; i < chip->cells->n; i++) { 85 84 view->cell = i; 86 psMetadataItem *doPattern = pmConfigRecipeValueByView(config, RECIPE_NAME, "PATTERN.CELL.SUBSET", 87 chip->parent, view); // Do pattern sub? 88 if (!doPattern || doPattern->type != PS_DATA_BOOL) {89 ESCAPE("Unable to determine whether cell pattern correctionshould be applied.");90 }91 if (doPattern->data.B) {92 tweak->data.U8[i] = 0xFF;93 }85 86 bool doPattern = false; 87 if (!doPatternForView(&doPattern, config, chip, view, RECIPE_NAME, "PATTERN.CELL.SUBSET")) { 88 ESCAPE(false, "Unable to determine whether row pattern matching should be applied."); 89 } 90 if (doPattern) { 91 tweak->data.U8[i] = 0xFF; 92 } 94 93 } 95 94 … … 108 107 } 109 108 109 static bool doPatternForView (bool *doit, const pmConfig *config, const pmChip *chip, const pmFPAview *view, const char *recipeName, const char *recipeValue) { 110 110 111 *doit = false; 112 113 psMetadataItem *doPattern = pmConfigRecipeValueByView(config, recipeName, recipeValue, chip->parent, view); 114 if (!doPattern) { 115 psError(PS_ERR_UNKNOWN, false, "Unable to determine whether row pattern matching should be applied."); 116 return false; 117 } 118 if (doPattern->type == PS_DATA_BOOL) { 119 *doit = doPattern->data.B; 120 return true; 121 } 122 if (doPattern->type == PS_DATA_STRING) { 123 // expect a string of the form "000110001001" with at least view->cell entries 124 char *string = doPattern->data.str; 125 if (strlen(string) < view->cell) { 126 psError(PS_ERR_UNKNOWN, true, "error in PATTERN.ROW.SUBSET chip string (too few elements %d)", (int) strlen(string)); 127 return false; 128 } 129 switch (string[view->cell]) { 130 case '0': 131 case 'f': 132 case 'F': 133 case 'n': 134 case 'N': 135 *doit = false; 136 return true; 137 case '1': 138 case 't': 139 case 'T': 140 case 'y': 141 case 'Y': 142 *doit = true; 143 return true; 144 default: 145 psError(PS_ERR_UNKNOWN, true, "error in PATTERN.ROW.SUBSET chip string %s (unknown value %c))", string, string[view->cell]); 146 return false; 147 } 148 psAbort("imposible to reach here"); 149 } 150 psError(PS_ERR_UNKNOWN, true, "error in PATTERN.ROW.SUBSET : invalid data type"); 151 return false; 152 }
Note:
See TracChangeset
for help on using the changeset viewer.
