IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 4, 2006, 5:37:16 PM (20 years ago)
Author:
Paul Price
Message:

Moving format back into options --- we need to know the camera configuration in order to get the recipe

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppMerge/src/ppMergeOptions.c

    r7067 r7073  
    1414    )
    1515{
     16    psFree(options->format);
    1617    psFree(options->combine);
    1718}
     
    2324    psMemSetDeallocator(options, (psFreeFunc)mergeOptionsFree);
    2425
     26    options->format = NULL;
    2527    options->rows = 0;
    2628    options->minElectrons = NAN;
     
    9193    ppMergeOptions *options = ppMergeOptionsAlloc(); // The merge options
    9294
     95    // We need to work out the camera before we can get the recipe.  Take the first input and inspect it.
     96    if (!config->camera) {
     97        psArray *filenames = psMetadataLookupPtr(NULL, config->arguments, "INPUT"); // The input file names
     98        psFits *inFile = psFitsOpen(filenames->data[0], "r"); // The FITS file to read
     99        if (!inFile) {
     100            psError(PS_ERR_IO, false, "Unable to open input file %s to determine camera.\n",
     101                    filenames->data[0]);
     102            exit(EXIT_FAILURE);
     103        }
     104        psMetadata *header = psFitsReadHeader(NULL, inFile); // The FITS (primary) header
     105        psFitsClose(inFile);
     106
     107        options->format = pmConfigCameraFormatFromHeader(config, header);
     108        psFree(header);
     109        if (!options->format) {
     110            psLogMsg(__func__, PS_LOG_WARN, "Unable to identify camera format for input file %s\n",
     111                     filenames->data[0]);
     112            exit(EXIT_FAILURE);
     113        }
     114    }
     115
     116    // Get the recipes
     117    if (!config->recipes && !pmConfigReadRecipes(config)) {
     118        psError(PS_ERR_IO, false, "Unable to read recipes.\n");
     119        exit(EXIT_FAILURE);
     120    }
     121
     122    // Now we can read the recipe
    93123    bool mdok = true;                   // Status of MD lookup
    94124    psMetadata *recipe = psMetadataLookupMD(&mdok, config->recipes, RECIPENAME); // Recipe information
Note: See TracChangeset for help on using the changeset viewer.