IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 26, 2009, 1:59:32 PM (17 years ago)
Author:
beaumont
Message:

merged with trunk

Location:
branches/cnb_branches/cnb_branch_20090301
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090301

  • branches/cnb_branches/cnb_branch_20090301/ppSim/src

    • Property svn:ignore
      •  

        old new  
        88.libs
        99ppSimSequence
         10ppSimVersionDefinitions.h
  • branches/cnb_branches/cnb_branch_20090301/ppSim/src/ppSimUtils.c

    r20365 r24244  
    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.");
     
    133133
    134134    char *typeStr = psMetadataLookupStr(NULL, recipe, "IMAGE.TYPE"); // Type of image to simulate
     135    char *obs_mode = psMetadataLookupStr(NULL, recipe, "OBS_MODE");
    135136
    136137    psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.OBSTYPE", PS_META_REPLACE, "Observation type", typeStr);
    137138    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);
    138140    psMetadataAddF32(fpa->concepts, PS_LIST_TAIL, "FPA.EXPOSURE", PS_META_REPLACE, "Exposure time (sec)", expTime);
    139141    psMetadataAddStr(fpa->concepts, PS_LIST_TAIL, "FPA.FILTERID", PS_META_REPLACE, "Filter name", filter);
     
    174176    if (binning <= 0) {
    175177        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);
    177179    }
    178180    return true;
     
    181183// Get a value from the command-line arguments and add it to recipe options
    182184float 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
     185                          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
    187189    )
    188190{
     
    198200// Get a value from the command-line arguments and add it to recipe options
    199201int 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
     202                        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
    204206    )
    205207{
     
    214216// Get a value from the command-line arguments and add it to recipe options
    215217bool 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
     218                          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
    220222    )
    221223{
     
    231233// if it is not specified, do not override the existing recipe value
    232234char *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
     235                          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
    237239    )
    238240{
     
    241243    char *value = psMetadataLookupStr(&myStatus, arguments, argName); // Value of interest
    242244    if (status) {
    243         *status = myStatus;
     245        *status = myStatus;
    244246    }
    245247    if (!value) return NULL;
     
    248250}
    249251
    250 float ppSimGetZeroPoint (psMetadata *recipe, char *filter) {
    251 
    252     bool mdok;
    253     float zp;
     252float ppSimGetZeroPoint(psMetadata *recipe, const char *filter)
     253{
     254    PS_ASSERT_METADATA_NON_NULL(recipe, NAN);
     255    PS_ASSERT_STRING_NON_EMPTY(filter, NAN);
    254256
    255257    // 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);
    278265}
    279266
     
    295282
    296283    for (int i = 0; i < sources->n; i++) {
    297         pmSource *source = sources->data[i];
     284        pmSource *source = sources->data[i];
    298285
    299286        // allocate image, weight, mask arrays for each peak (square of radius OUTER)
Note: See TracChangeset for help on using the changeset viewer.