IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 7, 2006, 5:57:23 PM (20 years ago)
Author:
eugene
Message:

substantial upgrade to work with the pmFPAfile paradigm

File:
1 edited

Legend:

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

    r6747 r6817  
    1 #include <stdio.h>
    2 #include "pslib.h"
    31#include "ppImage.h"
    4 #include "ppImageData.h"
    5 #include "ppImageOptions.h"
    62
    73static void imageOptionsFree(ppImageOptions *options)
     
    2521}
    2622
    27 
    28 // XXX EAM : this needs signficant work to choose the detrend images based on the detrend database
    29 
    30 bool ppImageOptionsParse(ppImageData *data, ppImageOptions *options, pmConfig *config)
     23ppImageOptions *ppImageOptionsParse(pmConfig *config)
    3124{
    3225
    33     // Flags for various activities
    34     options->doMask = false;            // Mask bad pixels
    35     options->doNonLin = false;          // Non-linearity correction
    36     options->doBias = false;            // Bias subtraction
    37     options->doDark = false;            // Dark subtraction
     26    ppImageOptions *options = ppImageOptionsAlloc ();
     27
     28    // default flags for various activities
     29    options->doMask     = false;        // Mask bad pixels
     30    options->doNonLin   = false;        // Non-linearity correction
     31    options->doBias     = false;        // Bias subtraction
     32    options->doDark     = false;        // Dark subtraction
    3833    options->doOverscan = false;        // Overscan subtraction
    39     options->doFlat = false;            // Flat-field normalisation
    40     options->doFringe = false;          // Fringe subtraction
    41     options->doSource = false;          // Source identification and photometry
    42     options->doAstrom = false;          // Astrometry
    43     // Overscan options
    44     options->overscan = NULL;           // Overscan options
    45     bool overscanSingle = false;        // A single value for entire overscan?
    46     pmFit overscanFit = PM_FIT_NONE;    // Fit type for overscan
    47     int overscanOrder = 0;              // Order for overscan fit
     34    options->doFlat     = false;        // Flat-field normalisation
     35    options->doFringe   = false;        // Fringe subtraction
     36    options->doSource   = false;        // Source identification and photometry
     37    options->doAstrom   = false;        // Astrometry
     38
     39    // Overscan defaults
     40    options->overscan      = NULL;      // Overscan options
     41    bool overscanSingle    = false;     // A single value for entire overscan?
     42    pmFit overscanFit      = PM_FIT_NONE; // Fit type for overscan
     43    int overscanOrder      = 0;         // Order for overscan fit
    4844    psStats *overscanStats = NULL;      // Statistics for overscan
    49     // Non-linearity options
    50     options->nonLinearType = 0;         // Type of non-linearity data (vector, string or metadata)
    51     options->nonLinearData = NULL;      // The non-linearity data
     45
     46    // Non-linearity default options
     47    options->nonLinearType   = 0;       // Type of non-linearity data (vector, string or metadata)
     48    options->nonLinearData   = NULL;    // The non-linearity data
    5249    options->nonLinearSource = NULL;    // If the non-linearity data is a menu, this provides the key
    53     // Various others
    54     options->imageLoadDepth = PP_LOAD_NONE; // No load depth specified yet
    5550
    56 
     51    // select the recipe for this analysis
    5752    bool mdStatus = false;              // Result of MD lookup
    5853    psMetadata *recipe = psMetadataLookupMD(&mdStatus, config->recipes, RECIPE_NAME);
     
    6055        psLogMsg("ppImage", PS_LOG_ERROR, "Can't find recipe %s in the RECIPES.\n", RECIPE_NAME);
    6156        exit(EXIT_FAILURE);
    62     }
    63 
    64     const char *depth = psMetadataLookupStr(&mdStatus, recipe, "LOAD.DEPTH");
    65     if (! mdStatus || ! depth || strlen(depth) == 0) {
    66         psLogMsg("ppImage", PS_LOG_ERROR, "LOAD.DEPTH not specified in recipe.");
    67         exit(EXIT_FAILURE);
    68     }
    69     if (!strcasecmp(depth, "FPA")) {
    70         options->imageLoadDepth = PP_LOAD_FPA;
    71     } else if (!strcasecmp(depth, "CHIP")) {
    72         options->imageLoadDepth = PP_LOAD_CHIP;
    73     } else if (!strcasecmp(depth, "CELL")) {
    74         options->imageLoadDepth = PP_LOAD_CELL;
    75     } else {
    76         psLogMsg(__func__, PS_LOG_ERROR, "LOAD.DEPTH in recipe %s is not FPA, CHIP or CELL.", RECIPE_NAME);
    77         exit(EXIT_FAILURE);
    78     }
    79 
    80     // Mask recipe options
    81     if (psMetadataLookupBool(NULL, recipe, "MASK")) {
    82         data->mask->filename = psMetadataLookupStr(NULL, config->arguments, "-mask");
    83         if (data->mask->filename && strlen(data->mask->filename) > 0) {
    84             options->doMask = true;
    85         } else {
    86             psLogMsg(__func__, PS_LOG_WARN, "Masking is desired, but no mask was supplied"
    87                      " --- no masking will be performed.\n");
    88         }
    8957    }
    9058
     
    12492                    "NONLIN.DATA is of invalid type in recipe %s.", RECIPE_NAME);
    12593            exit(EXIT_FAILURE);
    126         }
    127     }
    128 
    129     // Bias recipe options
    130     if (psMetadataLookupBool(NULL, recipe, "BIAS")) {
    131         data->bias->filename = psMetadataLookupStr(NULL, config->arguments, "-bias");
    132         if (data->bias->filename && strlen(data->bias->filename) > 0) {
    133             options->doBias = true;
    134         } else {
    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);
    137         }
    138     }
    139 
    140     // Dark recipe options
    141     if (psMetadataLookupBool(NULL, recipe, "DARK")) {
    142         data->dark->filename = psMetadataLookupStr(NULL, config->arguments, "-dark");
    143         if (data->dark->filename && strlen(data->dark->filename) > 0) {
    144             options->doDark = true;
    145         } else {
    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);
    14894        }
    14995    }
     
    190136    }
    191137
    192     // flat-field - recipe options
    193     if (psMetadataLookupBool(NULL, recipe, "FLAT")) {
    194         data->flat->filename = psMetadataLookupStr(NULL, config->arguments, "-flat");
    195         if (strlen(data->flat->filename) > 0) {
    196             options->doFlat = true;
    197         } else {
    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);
    200         }
     138    // Mask recipe options
     139    if (psMetadataLookupBool(NULL, recipe, "MASK")) {
     140        options->doMask = true;
    201141    }
    202142
    203     // XXX need to add the following:
     143    // Bias recipe options
     144    if (psMetadataLookupBool(NULL, recipe, "BIAS")) {
     145        options->doBias = true;
     146    }
    204147
    205     // fringe - recipe options
     148    // Dark recipe options
     149    if (psMetadataLookupBool(NULL, recipe, "DARK")) {
     150        options->doDark = true;
     151    }
    206152
    207     // photom - recipe options
     153    // Flat recipe options
     154    if (psMetadataLookupBool(NULL, recipe, "FLAT")) {
     155        options->doFlat = true;
     156    }
    208157
    209     // astrom - recipe options
    210 
    211     return true;
     158    return options;
    212159}
Note: See TracChangeset for help on using the changeset viewer.