IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 12, 2006, 4:49:23 PM (20 years ago)
Author:
eugene
Message:

substantial work to make formats all work, added error checking

File:
1 edited

Legend:

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

    r7508 r7531  
    1818    options->nonLinearSource = NULL;
    1919
    20     return options;
    21 }
    22 
    23 ppImageOptions *ppImageOptionsParse(pmConfig *config)
    24 {
    25     bool status;
    26     ppImageOptions *options = ppImageOptionsAlloc ();
    27 
    2820    // default flags for various activities
    2921    options->doMask     = false;        // Mask bad pixels
     
    3628    options->doFlat     = false;        // Flat-field normalisation
    3729    options->doFringe   = false;        // Fringe subtraction
    38     options->doSource   = false;        // Source identification and photometry
     30    options->doPhotom   = false;        // Source identification and photometry
    3931    options->doAstrom   = false;        // Astrometry
     32
     33    options->doBin1     = false;        // create binned image (scale 1)
     34    options->doBin2     = false;        // create binned image (scale 2)
     35    options->doBin1JPG  = false;        // create jpg of binned image (scale 1)
     36    options->doBin2JPG  = false;        // create jpg of binned image (scale 2)
    4037
    4138    // Overscan defaults
    4239    options->overscan      = NULL;      // Overscan options
    43     bool overscanSingle    = false;     // A single value for entire overscan?
    44     pmFit overscanFit      = PM_FIT_NONE; // Fit type for overscan
    45     int overscanOrder      = 0;         // Order for overscan fit
    46     psStats *overscanStats = NULL;      // Statistics for overscan
    4740
    4841    // Non-linearity default options
     
    5043    options->nonLinearData   = NULL;    // The non-linearity data
    5144    options->nonLinearSource = NULL;    // If the non-linearity data is a menu, this provides the key
     45
     46    return options;
     47}
     48
     49ppImageOptions *ppImageOptionsParse(pmConfig *config)
     50{
     51    bool status;
     52    ppImageOptions *options = ppImageOptionsAlloc ();
    5253
    5354    // select the recipe for this analysis
     
    105106
    106107        // Do the overscan as a single value?
    107         overscanSingle = psMetadataLookupBool(NULL, recipe, "OVERSCAN.SINGLE");
     108        bool overscanSingle = psMetadataLookupBool(NULL, recipe, "OVERSCAN.SINGLE");
    108109
    109110        // How do we fit it?
     111        pmFit overscanFit = PM_FIT_NONE; // Fit type for overscan
     112        int overscanOrder = 0;          // Order for overscan fit
    110113        psString fit = psMetadataLookupStr(NULL, recipe, "OVERSCAN.FIT");
    111114        if (! strcasecmp(fit, "POLYNOMIAL")) {
     
    118121            overscanFit = PM_FIT_SPLINE;
    119122        } else if (strcasecmp(fit, "NONE")) {
    120             psLogMsg(__func__, PS_LOG_WARN, "OVERSCAN.FIT (%s) in recipe %s is not one of NONE, "
    121                      "POLYNOMIAL, or SPLINE: assuming NONE.\n", fit, RECIPE_NAME);
     123            psLogMsg(__func__, PS_LOG_WARN, "OVERSCAN.FIT (%s) in recipe %s is not one of NONE, POLYNOMIAL, or SPLINE", fit, RECIPE_NAME);
     124            exit(EXIT_FAILURE);
    122125        }
    123126
     127        // What method do we use to measure the overscan statistics?
     128        psStats *overscanStats = NULL;  // Statistics for overscan
    124129        psString stat = psMetadataLookupStr(NULL, recipe, "OVERSCAN.STAT");
    125130        if (! strcasecmp(stat, "MEAN")) {
     
    128133            overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN);
    129134        } else {
    130             psErrorStackPrint(stderr, "OVERSCAN.STAT (%s) in recipe %s is not one of MEAN, MEDIAN: "
    131                               "assuming MEAN\n", stat, RECIPE_NAME);
    132             overscanStats = psStatsAlloc(PS_STAT_SAMPLE_MEAN);
     135            psErrorStackPrint(stderr, "OVERSCAN.STAT (%s) in recipe %s is not one of MEAN or MEDIAN", stat, RECIPE_NAME);
     136            exit(EXIT_FAILURE);
    133137        }
    134138
     
    161165
    162166    options->doBin1 = psMetadataLookupBool(NULL, recipe, "BIN1.FITS");
     167    options->doBin1JPG = psMetadataLookupBool(NULL, recipe, "BIN1.JPEG");
     168    if (options->doBin1JPG && !options->doBin1) {
     169        psLogMsg(__func__, PS_LOG_ERROR, "Invalid Phase2 Options: cannot make JPG of Bin1 image without Bin1 image");
     170        exit(EXIT_FAILURE);
     171    }
     172
    163173    options->doBin2 = psMetadataLookupBool(NULL, recipe, "BIN2.FITS");
     174    options->doBin2JPG = psMetadataLookupBool(NULL, recipe, "BIN2.JPEG");
     175    if (options->doBin2JPG && !options->doBin2) {
     176        psLogMsg(__func__, PS_LOG_ERROR, "Invalid Phase2 Options: cannot make JPG of Bin2 image without Bin2 image");
     177        exit(EXIT_FAILURE);
     178    }
     179   
     180    options->doPhotom = psMetadataLookupBool(NULL, recipe, "PHOTOM");
     181    options->doAstrom = psMetadataLookupBool(NULL, recipe, "ASTROM");
     182    if (options->doAstrom && !options->doPhotom) {
     183        psLogMsg(__func__, PS_LOG_ERROR, "Invalid Phase2 Options: cannot do ASTROMetry without PHOTOMetry");
     184        exit(EXIT_FAILURE);
     185    }
    164186
    165     // options->doBin1JPEG = psMetadataLookupBool(NULL, recipe, "BIN1.JPEG");
    166     // options->doBin2JPEG = psMetadataLookupBool(NULL, recipe, "BIN2.JPEG");
    167    
    168187    return options;
    169188}
Note: See TracChangeset for help on using the changeset viewer.