IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29323


Ignore:
Timestamp:
Oct 5, 2010, 2:36:44 PM (16 years ago)
Author:
eugene
Message:

allow recipe value to specify convolution direction

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100823/ppSub/src/ppSubMatchPSFs.c

    r28119 r29323  
    184184}
    185185
     186pmSubtractionMode subModeFromString (char *string) {
     187
     188    if (!strcasecmp(string, "AUTO")) return PM_SUBTRACTION_MODE_UNSURE;
     189    if (!strcasecmp(string, "DUAL")) return PM_SUBTRACTION_MODE_DUAL;
     190    if (!strcasecmp(string, "SINGLE1")) return PM_SUBTRACTION_MODE_1;
     191    if (!strcasecmp(string, "SINGLE2")) return PM_SUBTRACTION_MODE_2;
     192    if (!strcasecmp(string, "1")) return PM_SUBTRACTION_MODE_1;
     193    if (!strcasecmp(string, "2")) return PM_SUBTRACTION_MODE_2;
     194
     195    return PM_SUBTRACTION_MODE_UNSURE;
     196}
    186197
    187198bool ppSubMatchPSFs(ppSubData *data)
     
    317328    psImageMaskType maskBad = pmConfigMaskGet("BLANK", config); // Bits to mask for bad pixels
    318329
     330    // we have three things to control the convolution choice:
     331
     332    // 1) in the recipe, the keyword DUAL can be TRUE or FALSE.  if TRUE, DUAL is used. If not
     333    // DUAL, then we are doing SINGLE convolution (but see CONVOLVE.TARGET below).
     334
     335    // 2) if the -convolve option is given on the command line, the specified input (1 or 2) is
     336    // the one convolved.  Allowed values are 1 or 2.
     337
     338    // 3) if the -convolve option is NOT given, then the value of the recipe keyword
     339    // CONVOLVE.TARGET is used.  this may have the value DUAL, AUTO, SINGLE1, SINGLE2, 1, 2.
     340    // thus, DUAL convolution can be turned on with either DUAL = T or CONVOLVE.TARGET = DUAL
     341
    319342    bool dual = psMetadataLookupBool(&mdok, recipe, "DUAL"); // Dual convolution?
    320343    pmSubtractionMode subMode;          // Subtraction mode
     
    322345        subMode = PM_SUBTRACTION_MODE_DUAL;
    323346    } else {
    324         int convolve = psMetadataLookupS32(NULL, config->arguments, "-convolve"); // Image number to convolve
    325         switch (convolve) {
    326           case 0:
    327             subMode = PM_SUBTRACTION_MODE_UNSURE;
    328             break;
    329           case 1:
    330             subMode = PM_SUBTRACTION_MODE_1;
    331             break;
    332           case 2:
    333             subMode = PM_SUBTRACTION_MODE_2;
    334             break;
    335           default:
    336             psError(PPSUB_ERR_ARGUMENTS, false, "Invalid value for -convolve");
    337             return false;
    338         }
     347        char *convolveName = psMetadataLookupStr(&mdok, recipe, "CONVOLVE.TARGET"); // recipe value for target
     348        int convolve = psMetadataLookupS32(&mdok, config->arguments, "-convolve"); // override with command-line option
     349        switch (convolve) {
     350          case 0:
     351            // convolve is 0 if it is not supplied on the command line
     352            subMode = subModeFromString(convolveName);
     353            break;
     354          case 1:
     355            subMode = PM_SUBTRACTION_MODE_1;
     356            break;
     357          case 2:
     358            subMode = PM_SUBTRACTION_MODE_2;
     359            break;
     360          default:
     361            psError(PPSUB_ERR_ARGUMENTS, false, "Invalid value for -convolve");
     362            return false;
     363        }
    339364    }
    340365
Note: See TracChangeset for help on using the changeset viewer.