IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 13, 2009, 2:16:23 PM (17 years ago)
Author:
Paul Price
Message:

Zero point when loading input image was being derived from FPA.FILTER (e.g., r.00000) instead of FPA.FILTERID (e.g., r). Reworked how this is defined from a MULTI to a menu.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSim/src/ppSimUtils.c

    r20365 r23836  
    112112ppSimType ppSimTypeFromString (char *typeStr) {
    113113
    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;
    117117    if (!strcasecmp (typeStr, "OBJECT")) return PPSIM_TYPE_OBJECT;
    118118    psAbort("Should never get here.");
     
    174174    if (binning <= 0) {
    175175        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);
    177177    }
    178178    return true;
     
    181181// Get a value from the command-line arguments and add it to recipe options
    182182float ppSimArgToRecipeF32(bool *status,
    183                           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
     183                          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
    187187    )
    188188{
     
    198198// Get a value from the command-line arguments and add it to recipe options
    199199int ppSimArgToRecipeS32(bool *status,
    200                         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
     200                        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
    204204    )
    205205{
     
    214214// Get a value from the command-line arguments and add it to recipe options
    215215bool ppSimArgToRecipeBool(bool *status,
    216                           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
     216                          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
    220220    )
    221221{
     
    231231// if it is not specified, do not override the existing recipe value
    232232char *ppSimArgToRecipeStr(bool *status,
    233                           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
     233                          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
    237237    )
    238238{
     
    241241    char *value = psMetadataLookupStr(&myStatus, arguments, argName); // Value of interest
    242242    if (status) {
    243         *status = myStatus;
     243        *status = myStatus;
    244244    }
    245245    if (!value) return NULL;
     
    248248}
    249249
    250 float ppSimGetZeroPoint (psMetadata *recipe, char *filter) {
    251 
    252     bool mdok;
    253     float zp;
     250float ppSimGetZeroPoint(psMetadata *recipe, const char *filter)
     251{
     252    PS_ASSERT_METADATA_NON_NULL(recipe, NAN);
     253    PS_ASSERT_STRING_NON_EMPTY(filter, NAN);
    254254
    255255    // 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);
    278263}
    279264
     
    295280
    296281    for (int i = 0; i < sources->n; i++) {
    297         pmSource *source = sources->data[i];
     282        pmSource *source = sources->data[i];
    298283
    299284        // allocate image, weight, mask arrays for each peak (square of radius OUTER)
Note: See TracChangeset for help on using the changeset viewer.