Changeset 23836 for trunk/ppSim/src/ppSimUtils.c
- Timestamp:
- Apr 13, 2009, 2:16:23 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ppSim/src/ppSimUtils.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppSim/src/ppSimUtils.c
r20365 r23836 112 112 ppSimType ppSimTypeFromString (char *typeStr) { 113 113 114 if (!strcasecmp (typeStr, "BIAS")) return PPSIM_TYPE_BIAS;115 if (!strcasecmp (typeStr, "DARK")) return PPSIM_TYPE_DARK;116 if (!strcasecmp (typeStr, "FLAT")) return PPSIM_TYPE_FLAT;114 if (!strcasecmp (typeStr, "BIAS")) return PPSIM_TYPE_BIAS; 115 if (!strcasecmp (typeStr, "DARK")) return PPSIM_TYPE_DARK; 116 if (!strcasecmp (typeStr, "FLAT")) return PPSIM_TYPE_FLAT; 117 117 if (!strcasecmp (typeStr, "OBJECT")) return PPSIM_TYPE_OBJECT; 118 118 psAbort("Should never get here."); … … 174 174 if (binning <= 0) { 175 175 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Binning (%d) is non-positive.", binning); 176 exit(PS_EXIT_CONFIG_ERROR);176 exit(PS_EXIT_CONFIG_ERROR); 177 177 } 178 178 return true; … … 181 181 // Get a value from the command-line arguments and add it to recipe options 182 182 float ppSimArgToRecipeF32(bool *status, 183 psMetadata *options, // Target to which to add value184 const char *recipeName, // Name for value in the recipe185 psMetadata *arguments, // Command-line arguments186 const char *argName// Argument name in the command-line arguments183 psMetadata *options, // Target to which to add value 184 const char *recipeName, // Name for value in the recipe 185 psMetadata *arguments, // Command-line arguments 186 const char *argName // Argument name in the command-line arguments 187 187 ) 188 188 { … … 198 198 // Get a value from the command-line arguments and add it to recipe options 199 199 int ppSimArgToRecipeS32(bool *status, 200 psMetadata *options, // Target to which to add value201 const char *recipeName, // Name for value in the recipe202 psMetadata *arguments, // Command-line arguments203 const char *argName// Argument name in the command-line arguments200 psMetadata *options, // Target to which to add value 201 const char *recipeName, // Name for value in the recipe 202 psMetadata *arguments, // Command-line arguments 203 const char *argName // Argument name in the command-line arguments 204 204 ) 205 205 { … … 214 214 // Get a value from the command-line arguments and add it to recipe options 215 215 bool ppSimArgToRecipeBool(bool *status, 216 psMetadata *options, // Target to which to add value217 const char *recipeName, // Name for value in the recipe218 psMetadata *arguments, // Command-line arguments219 const char *argName// Argument name in the command-line arguments216 psMetadata *options, // Target to which to add value 217 const char *recipeName, // Name for value in the recipe 218 psMetadata *arguments, // Command-line arguments 219 const char *argName // Argument name in the command-line arguments 220 220 ) 221 221 { … … 231 231 // if it is not specified, do not override the existing recipe value 232 232 char *ppSimArgToRecipeStr(bool *status, 233 psMetadata *options, // Target to which to add value234 const char *recipeName, // Name for value in the recipe235 psMetadata *arguments, // Command-line arguments236 const char *argName// Argument name in the command-line arguments233 psMetadata *options, // Target to which to add value 234 const char *recipeName, // Name for value in the recipe 235 psMetadata *arguments, // Command-line arguments 236 const char *argName // Argument name in the command-line arguments 237 237 ) 238 238 { … … 241 241 char *value = psMetadataLookupStr(&myStatus, arguments, argName); // Value of interest 242 242 if (status) { 243 *status = myStatus;243 *status = myStatus; 244 244 } 245 245 if (!value) return NULL; … … 248 248 } 249 249 250 float ppSimGetZeroPoint (psMetadata *recipe, char *filter) {251 252 bool mdok;253 float zp;250 float ppSimGetZeroPoint(psMetadata *recipe, const char *filter) 251 { 252 PS_ASSERT_METADATA_NON_NULL(recipe, NAN); 253 PS_ASSERT_STRING_NON_EMPTY(filter, NAN); 254 254 255 255 // use the filter to get the zeropoint from the recipe 256 psMetadataItem *zpItem = psMetadataLookup (recipe, "ZEROPTS"); 257 // check that item is multi... 258 259 psArray *entries = psListToArray (zpItem->data.list); 260 261 // search for matching filter 262 for (int i = 0; i < entries->n; i++) { 263 psMetadataItem *item = entries->data[i]; 264 psMetadata *entry = item->data.V; 265 266 char *filterName = psMetadataLookupStr (&mdok, entry, "FILTER"); 267 assert (filterName); 268 269 if (strcmp(filterName, filter)) continue; 270 271 zp = psMetadataLookupF32 (&mdok, entry, "ZERO_PT"); 272 assert (mdok); 273 psFree (entries); 274 return zp; 275 } 276 psFree (entries); 277 return NAN; 256 psMetadata *zeropoints = psMetadataLookupMetadata(NULL, recipe, "ZEROPTS"); 257 if (!zeropoints) { 258 psError(PS_ERR_UNKNOWN, false, "Unable to find ZEROPTS in recipe"); 259 return NAN; 260 } 261 262 return psMetadataLookupF32(NULL, zeropoints, filter); 278 263 } 279 264 … … 295 280 296 281 for (int i = 0; i < sources->n; i++) { 297 pmSource *source = sources->data[i];282 pmSource *source = sources->data[i]; 298 283 299 284 // allocate image, weight, mask arrays for each peak (square of radius OUTER)
Note:
See TracChangeset
for help on using the changeset viewer.
