IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 31, 2006, 3:24:14 PM (20 years ago)
Author:
Paul Price
Message:

ppImage now working again.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImageOptions.c

    r6396 r6747  
    11#include <stdio.h>
    22#include "pslib.h"
    3 #include "ppConfig.h"
     3#include "ppImage.h"
    44#include "ppImageData.h"
    55#include "ppImageOptions.h"
     
    2828// XXX EAM : this needs signficant work to choose the detrend images based on the detrend database
    2929
    30 bool ppImageOptionsParse(ppImageData *data, ppImageOptions *options, ppConfig *config)
     30bool ppImageOptionsParse(ppImageData *data, ppImageOptions *options, pmConfig *config)
    3131{
    3232
     
    5656
    5757    bool mdStatus = false;              // Result of MD lookup
    58     const char *depth = psMetadataLookupStr(&mdStatus, config->recipe, "LOAD.DEPTH");
     58    psMetadata *recipe = psMetadataLookupMD(&mdStatus, config->recipes, RECIPE_NAME);
     59    if (! mdStatus || !recipe) {
     60        psLogMsg("ppImage", PS_LOG_ERROR, "Can't find recipe %s in the RECIPES.\n", RECIPE_NAME);
     61        exit(EXIT_FAILURE);
     62    }
     63
     64    const char *depth = psMetadataLookupStr(&mdStatus, recipe, "LOAD.DEPTH");
    5965    if (! mdStatus || ! depth || strlen(depth) == 0) {
    6066        psLogMsg("ppImage", PS_LOG_ERROR, "LOAD.DEPTH not specified in recipe.");
     
    6874        options->imageLoadDepth = PP_LOAD_CELL;
    6975    } else {
    70         psLogMsg(__func__, PS_LOG_ERROR, "LOAD.DEPTH in recipe is not FPA, CHIP or CELL.");
     76        psLogMsg(__func__, PS_LOG_ERROR, "LOAD.DEPTH in recipe %s is not FPA, CHIP or CELL.", RECIPE_NAME);
    7177        exit(EXIT_FAILURE);
    7278    }
    7379
    7480    // Mask recipe options
    75     if (psMetadataLookupBool(NULL, config->recipe, "MASK")) {
     81    if (psMetadataLookupBool(NULL, recipe, "MASK")) {
    7682        data->mask->filename = psMetadataLookupStr(NULL, config->arguments, "-mask");
    7783        if (data->mask->filename && strlen(data->mask->filename) > 0) {
     
    8490
    8591    // Non-linearity recipe options
    86     if (psMetadataLookupBool(NULL, config->recipe, "NONLIN")) {
    87         psMetadataItem *dataItem = psMetadataLookup(config->recipe, "NONLIN.DATA");
     92    if (psMetadataLookupBool(NULL, recipe, "NONLIN")) {
     93        psMetadataItem *dataItem = psMetadataLookup(recipe, "NONLIN.DATA");
    8894        if (! dataItem) {
    8995            psLogMsg(__func__, PS_LOG_ERROR, "Non-linearity correction desired, but unable to "
    90                      "find NONLIN.DATA in recipe.");
     96                     "find NONLIN.DATA in recipe %s.", RECIPE_NAME);
    9197            exit(EXIT_FAILURE);
    9298        }
     
    106112            {
    107113                bool status;
    108                 options->nonLinearSource = psMetadataLookupStr(&status, config->recipe, "NONLIN.SOURCE");
     114                options->nonLinearSource = psMetadataLookupStr(&status, recipe, "NONLIN.SOURCE");
    109115                if (! status || ! options->nonLinearSource) {
    110116                    psLogMsg(__func__, PS_LOG_ERROR, "Non-linearity correction desired, but unable to "
    111                             "find NONLIN.SOURCE in recipe");
     117                            "find NONLIN.SOURCE in recipe %s.", RECIPE_NAME);
    112118                    exit(EXIT_FAILURE);
    113119                }
     
    116122          default:
    117123            psLogMsg(__func__, PS_LOG_ERROR, "Non-linearity correction desired, but "
    118                     "NONLIN.DATA is of invalid type.");
     124                    "NONLIN.DATA is of invalid type in recipe %s.", RECIPE_NAME);
    119125            exit(EXIT_FAILURE);
    120126        }
     
    122128
    123129    // Bias recipe options
    124     if (psMetadataLookupBool(NULL, config->recipe, "BIAS")) {
     130    if (psMetadataLookupBool(NULL, recipe, "BIAS")) {
    125131        data->bias->filename = psMetadataLookupStr(NULL, config->arguments, "-bias");
    126132        if (data->bias->filename && strlen(data->bias->filename) > 0) {
    127133            options->doBias = true;
    128134        } else {
    129             psLogMsg(__func__, PS_LOG_WARN, "Bias subtraction is desired, but no bias was supplied --- "
    130                      "no bias subtraction will be performed.\n");
     135            psLogMsg(__func__, PS_LOG_WARN, "Bias subtraction is desired in recipe %s, but no bias was "
     136                     "supplied --- no bias subtraction will be performed.\n", RECIPE_NAME);
    131137        }
    132138    }
    133139
    134140    // Dark recipe options
    135     if (psMetadataLookupBool(NULL, config->recipe, "DARK")) {
     141    if (psMetadataLookupBool(NULL, recipe, "DARK")) {
    136142        data->dark->filename = psMetadataLookupStr(NULL, config->arguments, "-dark");
    137143        if (data->dark->filename && strlen(data->dark->filename) > 0) {
    138144            options->doDark = true;
    139145        } else {
    140             psLogMsg(__func__, PS_LOG_WARN, "Dark subtraction is desired, but no dark was supplied --- "
    141                      "no dark subtraction will be performed.\n");
     146            psLogMsg(__func__, PS_LOG_WARN, "Dark subtraction is desired in recipe %s, but no dark was "
     147                     "supplied --- no dark subtraction will be performed.\n", RECIPE_NAME);
    142148        }
    143149    }
     
    147153    // Overscan recipe options
    148154    // XXX EAM : we should abort on invalid options. default options?
    149     if (psMetadataLookupBool(NULL, config->recipe, "OVERSCAN")) {
     155    if (psMetadataLookupBool(NULL, recipe, "OVERSCAN")) {
    150156        options->doOverscan = true;
    151157
    152158        // Do the overscan as a single value?
    153         overscanSingle = psMetadataLookupBool(NULL, config->recipe, "OVERSCAN.SINGLE");
     159        overscanSingle = psMetadataLookupBool(NULL, recipe, "OVERSCAN.SINGLE");
    154160
    155161        // How do we fit it?
    156         psString fit = psMetadataLookupStr(NULL, config->recipe, "OVERSCAN.FIT");
     162        psString fit = psMetadataLookupStr(NULL, recipe, "OVERSCAN.FIT");
    157163        if (! strcasecmp(fit, "POLYNOMIAL")) {
    158164            overscanFit = PM_FIT_POLY_ORD;
    159             overscanOrder = psMetadataLookupS32(NULL, config->recipe, "OVERSCAN.ORDER");
     165            overscanOrder = psMetadataLookupS32(NULL, recipe, "OVERSCAN.ORDER");
    160166        } else if (! strcasecmp(fit, "CHEBYSHEV")) {
    161167            overscanFit = PM_FIT_POLY_CHEBY;
    162             overscanOrder = psMetadataLookupS32(NULL, config->recipe, "OVERSCAN.ORDER");
     168            overscanOrder = psMetadataLookupS32(NULL, recipe, "OVERSCAN.ORDER");
    163169        } else if (! strcasecmp(fit, "SPLINE")) {
    164170            overscanFit = PM_FIT_SPLINE;
    165171        } else if (strcasecmp(fit, "NONE")) {
    166             psLogMsg(__func__, PS_LOG_WARN, "OVERSCAN.FIT (%s) is not one of NONE, POLYNOMIAL, or SPLINE:"
    167                      " assuming NONE.\n", fit);
    168         }
    169 
    170         psString stat = psMetadataLookupStr(NULL, config->recipe, "OVERSCAN.STAT");
     172            psLogMsg(__func__, PS_LOG_WARN, "OVERSCAN.FIT (%s) in recipe %s is not one of NONE, "
     173                     "POLYNOMIAL, or SPLINE: assuming NONE.\n", fit, RECIPE_NAME);
     174        }
     175
     176        psString stat = psMetadataLookupStr(NULL, recipe, "OVERSCAN.STAT");
    171177        if (! strcasecmp(stat, "MEAN")) {
    172178            overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
     
    174180            overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN);
    175181        } else {
    176             psErrorStackPrint(stderr, "OVERSCAN.STAT (%s) is not one of MEAN, MEDIAN: assuming MEAN\n", stat);
     182            psErrorStackPrint(stderr, "OVERSCAN.STAT (%s) in recipe %s is not one of MEAN, MEDIAN: "
     183                              "assuming MEAN\n", stat, RECIPE_NAME);
    177184            overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
    178185        }
     
    184191
    185192    // flat-field - recipe options
    186     if (psMetadataLookupBool(NULL, config->recipe, "FLAT")) {
     193    if (psMetadataLookupBool(NULL, recipe, "FLAT")) {
    187194        data->flat->filename = psMetadataLookupStr(NULL, config->arguments, "-flat");
    188195        if (strlen(data->flat->filename) > 0) {
    189196            options->doFlat = true;
    190197        } else {
    191             psLogMsg(__func__, PS_LOG_WARN, "Flat-fielding is desired, but no flat was supplied --- "
    192                      "no flat-fielding will be performed.\n");
     198            psLogMsg(__func__, PS_LOG_WARN, "Flat-fielding is desired in recipe %s, but no flat was "
     199                     "supplied --- no flat-fielding will be performed.\n", RECIPE_NAME);
    193200        }
    194201    }
Note: See TracChangeset for help on using the changeset viewer.