Changeset 6747 for trunk/ppImage/src/ppImageOptions.c
- Timestamp:
- Mar 31, 2006, 3:24:14 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImageOptions.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImageOptions.c
r6396 r6747 1 1 #include <stdio.h> 2 2 #include "pslib.h" 3 #include "pp Config.h"3 #include "ppImage.h" 4 4 #include "ppImageData.h" 5 5 #include "ppImageOptions.h" … … 28 28 // XXX EAM : this needs signficant work to choose the detrend images based on the detrend database 29 29 30 bool ppImageOptionsParse(ppImageData *data, ppImageOptions *options, p pConfig *config)30 bool ppImageOptionsParse(ppImageData *data, ppImageOptions *options, pmConfig *config) 31 31 { 32 32 … … 56 56 57 57 bool mdStatus = false; // Result of MD lookup 58 const char *depth = psMetadataLookupStr(&mdStatus, config->recipe, "LOAD.DEPTH"); 58 psMetadata *recipe = psMetadataLookupMD(&mdStatus, config->recipes, RECIPE_NAME); 59 if (! mdStatus || !recipe) { 60 psLogMsg("ppImage", PS_LOG_ERROR, "Can't find recipe %s in the RECIPES.\n", RECIPE_NAME); 61 exit(EXIT_FAILURE); 62 } 63 64 const char *depth = psMetadataLookupStr(&mdStatus, recipe, "LOAD.DEPTH"); 59 65 if (! mdStatus || ! depth || strlen(depth) == 0) { 60 66 psLogMsg("ppImage", PS_LOG_ERROR, "LOAD.DEPTH not specified in recipe."); … … 68 74 options->imageLoadDepth = PP_LOAD_CELL; 69 75 } else { 70 psLogMsg(__func__, PS_LOG_ERROR, "LOAD.DEPTH in recipe is not FPA, CHIP or CELL.");76 psLogMsg(__func__, PS_LOG_ERROR, "LOAD.DEPTH in recipe %s is not FPA, CHIP or CELL.", RECIPE_NAME); 71 77 exit(EXIT_FAILURE); 72 78 } 73 79 74 80 // Mask recipe options 75 if (psMetadataLookupBool(NULL, config->recipe, "MASK")) {81 if (psMetadataLookupBool(NULL, recipe, "MASK")) { 76 82 data->mask->filename = psMetadataLookupStr(NULL, config->arguments, "-mask"); 77 83 if (data->mask->filename && strlen(data->mask->filename) > 0) { … … 84 90 85 91 // Non-linearity recipe options 86 if (psMetadataLookupBool(NULL, config->recipe, "NONLIN")) {87 psMetadataItem *dataItem = psMetadataLookup( config->recipe, "NONLIN.DATA");92 if (psMetadataLookupBool(NULL, recipe, "NONLIN")) { 93 psMetadataItem *dataItem = psMetadataLookup(recipe, "NONLIN.DATA"); 88 94 if (! dataItem) { 89 95 psLogMsg(__func__, PS_LOG_ERROR, "Non-linearity correction desired, but unable to " 90 "find NONLIN.DATA in recipe .");96 "find NONLIN.DATA in recipe %s.", RECIPE_NAME); 91 97 exit(EXIT_FAILURE); 92 98 } … … 106 112 { 107 113 bool status; 108 options->nonLinearSource = psMetadataLookupStr(&status, config->recipe, "NONLIN.SOURCE");114 options->nonLinearSource = psMetadataLookupStr(&status, recipe, "NONLIN.SOURCE"); 109 115 if (! status || ! options->nonLinearSource) { 110 116 psLogMsg(__func__, PS_LOG_ERROR, "Non-linearity correction desired, but unable to " 111 "find NONLIN.SOURCE in recipe ");117 "find NONLIN.SOURCE in recipe %s.", RECIPE_NAME); 112 118 exit(EXIT_FAILURE); 113 119 } … … 116 122 default: 117 123 psLogMsg(__func__, PS_LOG_ERROR, "Non-linearity correction desired, but " 118 "NONLIN.DATA is of invalid type .");124 "NONLIN.DATA is of invalid type in recipe %s.", RECIPE_NAME); 119 125 exit(EXIT_FAILURE); 120 126 } … … 122 128 123 129 // Bias recipe options 124 if (psMetadataLookupBool(NULL, config->recipe, "BIAS")) {130 if (psMetadataLookupBool(NULL, recipe, "BIAS")) { 125 131 data->bias->filename = psMetadataLookupStr(NULL, config->arguments, "-bias"); 126 132 if (data->bias->filename && strlen(data->bias->filename) > 0) { 127 133 options->doBias = true; 128 134 } else { 129 psLogMsg(__func__, PS_LOG_WARN, "Bias subtraction is desired , but no bias was supplied ---"130 " no bias subtraction will be performed.\n");135 psLogMsg(__func__, PS_LOG_WARN, "Bias subtraction is desired in recipe %s, but no bias was " 136 "supplied --- no bias subtraction will be performed.\n", RECIPE_NAME); 131 137 } 132 138 } 133 139 134 140 // Dark recipe options 135 if (psMetadataLookupBool(NULL, config->recipe, "DARK")) {141 if (psMetadataLookupBool(NULL, recipe, "DARK")) { 136 142 data->dark->filename = psMetadataLookupStr(NULL, config->arguments, "-dark"); 137 143 if (data->dark->filename && strlen(data->dark->filename) > 0) { 138 144 options->doDark = true; 139 145 } else { 140 psLogMsg(__func__, PS_LOG_WARN, "Dark subtraction is desired , but no dark was supplied ---"141 " no dark subtraction will be performed.\n");146 psLogMsg(__func__, PS_LOG_WARN, "Dark subtraction is desired in recipe %s, but no dark was " 147 "supplied --- no dark subtraction will be performed.\n", RECIPE_NAME); 142 148 } 143 149 } … … 147 153 // Overscan recipe options 148 154 // XXX EAM : we should abort on invalid options. default options? 149 if (psMetadataLookupBool(NULL, config->recipe, "OVERSCAN")) {155 if (psMetadataLookupBool(NULL, recipe, "OVERSCAN")) { 150 156 options->doOverscan = true; 151 157 152 158 // Do the overscan as a single value? 153 overscanSingle = psMetadataLookupBool(NULL, config->recipe, "OVERSCAN.SINGLE");159 overscanSingle = psMetadataLookupBool(NULL, recipe, "OVERSCAN.SINGLE"); 154 160 155 161 // How do we fit it? 156 psString fit = psMetadataLookupStr(NULL, config->recipe, "OVERSCAN.FIT");162 psString fit = psMetadataLookupStr(NULL, recipe, "OVERSCAN.FIT"); 157 163 if (! strcasecmp(fit, "POLYNOMIAL")) { 158 164 overscanFit = PM_FIT_POLY_ORD; 159 overscanOrder = psMetadataLookupS32(NULL, config->recipe, "OVERSCAN.ORDER");165 overscanOrder = psMetadataLookupS32(NULL, recipe, "OVERSCAN.ORDER"); 160 166 } else if (! strcasecmp(fit, "CHEBYSHEV")) { 161 167 overscanFit = PM_FIT_POLY_CHEBY; 162 overscanOrder = psMetadataLookupS32(NULL, config->recipe, "OVERSCAN.ORDER");168 overscanOrder = psMetadataLookupS32(NULL, recipe, "OVERSCAN.ORDER"); 163 169 } else if (! strcasecmp(fit, "SPLINE")) { 164 170 overscanFit = PM_FIT_SPLINE; 165 171 } else if (strcasecmp(fit, "NONE")) { 166 psLogMsg(__func__, PS_LOG_WARN, "OVERSCAN.FIT (%s) i s not one of NONE, POLYNOMIAL, or SPLINE:"167 " assuming NONE.\n", fit);168 } 169 170 psString stat = psMetadataLookupStr(NULL, config->recipe, "OVERSCAN.STAT");172 psLogMsg(__func__, PS_LOG_WARN, "OVERSCAN.FIT (%s) in recipe %s is not one of NONE, " 173 "POLYNOMIAL, or SPLINE: assuming NONE.\n", fit, RECIPE_NAME); 174 } 175 176 psString stat = psMetadataLookupStr(NULL, recipe, "OVERSCAN.STAT"); 171 177 if (! strcasecmp(stat, "MEAN")) { 172 178 overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN); … … 174 180 overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN); 175 181 } else { 176 psErrorStackPrint(stderr, "OVERSCAN.STAT (%s) is not one of MEAN, MEDIAN: assuming MEAN\n", stat); 182 psErrorStackPrint(stderr, "OVERSCAN.STAT (%s) in recipe %s is not one of MEAN, MEDIAN: " 183 "assuming MEAN\n", stat, RECIPE_NAME); 177 184 overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN); 178 185 } … … 184 191 185 192 // flat-field - recipe options 186 if (psMetadataLookupBool(NULL, config->recipe, "FLAT")) {193 if (psMetadataLookupBool(NULL, recipe, "FLAT")) { 187 194 data->flat->filename = psMetadataLookupStr(NULL, config->arguments, "-flat"); 188 195 if (strlen(data->flat->filename) > 0) { 189 196 options->doFlat = true; 190 197 } else { 191 psLogMsg(__func__, PS_LOG_WARN, "Flat-fielding is desired , but no flat was supplied ---"192 " no flat-fielding will be performed.\n");198 psLogMsg(__func__, PS_LOG_WARN, "Flat-fielding is desired in recipe %s, but no flat was " 199 "supplied --- no flat-fielding will be performed.\n", RECIPE_NAME); 193 200 } 194 201 }
Note:
See TracChangeset
for help on using the changeset viewer.
