- Timestamp:
- May 26, 2009, 1:59:32 PM (17 years ago)
- Location:
- branches/cnb_branches/cnb_branch_20090301
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/cnb_branches/cnb_branch_20090301
- Property svn:mergeinfo changed
-
branches/cnb_branches/cnb_branch_20090301/ppSim/src
- Property svn:ignore
-
old new 8 8 .libs 9 9 ppSimSequence 10 ppSimVersionDefinitions.h
-
- Property svn:ignore
-
branches/cnb_branches/cnb_branch_20090301/ppSim/src/ppSimUtils.c
r20365 r24244 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."); … … 133 133 134 134 char *typeStr = psMetadataLookupStr(NULL, recipe, "IMAGE.TYPE"); // Type of image to simulate 135 char *obs_mode = psMetadataLookupStr(NULL, recipe, "OBS_MODE"); 135 136 136 137 psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.OBSTYPE", PS_META_REPLACE, "Observation type", typeStr); 137 138 psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.OBJECT", PS_META_REPLACE, "Observation name", typeStr); 139 psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.OBS.MODE", PS_META_REPLACE, "Observation mode", obs_mode); 138 140 psMetadataAddF32(fpa->concepts, PS_LIST_TAIL, "FPA.EXPOSURE", PS_META_REPLACE, "Exposure time (sec)", expTime); 139 141 psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.FILTERID", PS_META_REPLACE, "Filter name", filter); … … 174 176 if (binning <= 0) { 175 177 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Binning (%d) is non-positive.", binning); 176 exit(PS_EXIT_CONFIG_ERROR);178 exit(PS_EXIT_CONFIG_ERROR); 177 179 } 178 180 return true; … … 181 183 // Get a value from the command-line arguments and add it to recipe options 182 184 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 arguments185 psMetadata *options, // Target to which to add value 186 const char *recipeName, // Name for value in the recipe 187 psMetadata *arguments, // Command-line arguments 188 const char *argName // Argument name in the command-line arguments 187 189 ) 188 190 { … … 198 200 // Get a value from the command-line arguments and add it to recipe options 199 201 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 arguments202 psMetadata *options, // Target to which to add value 203 const char *recipeName, // Name for value in the recipe 204 psMetadata *arguments, // Command-line arguments 205 const char *argName // Argument name in the command-line arguments 204 206 ) 205 207 { … … 214 216 // Get a value from the command-line arguments and add it to recipe options 215 217 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 arguments218 psMetadata *options, // Target to which to add value 219 const char *recipeName, // Name for value in the recipe 220 psMetadata *arguments, // Command-line arguments 221 const char *argName // Argument name in the command-line arguments 220 222 ) 221 223 { … … 231 233 // if it is not specified, do not override the existing recipe value 232 234 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 arguments235 psMetadata *options, // Target to which to add value 236 const char *recipeName, // Name for value in the recipe 237 psMetadata *arguments, // Command-line arguments 238 const char *argName // Argument name in the command-line arguments 237 239 ) 238 240 { … … 241 243 char *value = psMetadataLookupStr(&myStatus, arguments, argName); // Value of interest 242 244 if (status) { 243 *status = myStatus;245 *status = myStatus; 244 246 } 245 247 if (!value) return NULL; … … 248 250 } 249 251 250 float ppSimGetZeroPoint (psMetadata *recipe, char *filter) {251 252 bool mdok;253 float zp;252 float ppSimGetZeroPoint(psMetadata *recipe, const char *filter) 253 { 254 PS_ASSERT_METADATA_NON_NULL(recipe, NAN); 255 PS_ASSERT_STRING_NON_EMPTY(filter, NAN); 254 256 255 257 // 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; 258 psMetadata *zeropoints = psMetadataLookupMetadata(NULL, recipe, "ZEROPTS"); 259 if (!zeropoints) { 260 psError(PS_ERR_UNKNOWN, false, "Unable to find ZEROPTS in recipe"); 261 return NAN; 262 } 263 264 return psMetadataLookupF32(NULL, zeropoints, filter); 278 265 } 279 266 … … 295 282 296 283 for (int i = 0; i < sources->n; i++) { 297 pmSource *source = sources->data[i];284 pmSource *source = sources->data[i]; 298 285 299 286 // allocate image, weight, mask arrays for each peak (square of radius OUTER)
Note:
See TracChangeset
for help on using the changeset viewer.
