IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29551


Ignore:
Timestamp:
Oct 25, 2010, 3:20:10 PM (16 years ago)
Author:
eugene
Message:

merge changes from eam_branches/ipp-20100823

Location:
trunk/ppSub/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSub/src/ppSub.c

    r27135 r29551  
    109109        pmModelClassCleanup();
    110110        pmConfigDone();
     111        pmVisualCleanup ();
    111112        psLibFinalize();
    112113
  • trunk/ppSub/src/ppSubConvolve.c

    r28567 r29551  
    241241            psThreadPoolInit(threads);
    242242        }
     243
     244        // Mask the NAN values (USE BLANK instead of SAT?)
     245        if (!pmReadoutMaskInvalid(input, maskVal, maskBad)) {
     246          psError(PPSUB_ERR_DATA, false, "Unable to mask non-finite pixels in input.");
     247          return false;
     248        }
     249        if (!pmReadoutMaskInvalid(ref, maskVal, maskBad)) {
     250          psError(PPSUB_ERR_DATA, false, "Unable to mask non-finite pixels in reference.");
     251          return false;
     252        }
     253
    243254        if (!pmSubtractionMatchPrecalc(inConv, refConv, input, ref, inRO->analysis,
    244255                                       stride, kernelErr, covarFrac, maskVal, maskBad, maskPoor,
  • trunk/ppSub/src/ppSubMatchPSFs.c

    r28119 r29551  
    110110    pmReadout *kernelRO = pmFPAfileThisReadout(config->files, view, "PPSUB.OUTPUT.KERNELS"); // RO with kernel
    111111    if (kernelRO) {
     112        psAbort("we probably need to set the FWHM values");
    112113        psFree(view);
    113114        return true;
     
    117118    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim
    118119    psAssert(recipe, "We checked this earlier, so it should be here.");
    119     if (!psMetadataLookupBool(NULL, recipe, "SCALE")) {
    120         // No scaling requested
    121         psFree(view);
    122         return true;
    123     }
    124120
    125121    // Input images
     
    131127    pmReadout *refSourceRO = pmFPAfileThisReadout(config->files, view, "PPSUB.REF.SOURCES");
    132128    if (!inSourceRO || !refSourceRO) {
    133         psWarning("Unable to scale kernel, since no sources were provided.");
    134         return true;
     129        psError(PPSUB_ERR_DATA, false, "Unable to scale kernel, since no sources were provided.");
     130        return false;
    135131    }
    136132
     
    141137
    142138    if (!inDetections || !refDetections) {
    143         psWarning("Unable to scale kernel, since no sources were provided.");
    144         return true;
     139        psError(PPSUB_ERR_DATA, false, "Unable to set FWHM or scale kernel, since no sources were provided.");
     140        return false;
    145141    }
    146142
     
    161157    psLogMsg("ppSub", PS_LOG_INFO, "Input FWHM: %f\nReference FWHM: %f\n", inFWHM, refFWHM);
    162158    if (!isfinite(inFWHM) || !isfinite(refFWHM)) {
    163         psWarning("Unable to scale kernel, since unable to measure PSFs.");
     159        psError(PPSUB_ERR_DATA, false, "Cannot determine FHWM for images, giving up.");
     160        return false;
     161    }
     162
     163    // we need to register the FWHM values for use downstream
     164    pmSubtractionSetFWHMs(inFWHM, refFWHM);
     165
     166    // is auto-scaling needed?
     167    if (!psMetadataLookupBool(NULL, recipe, "SCALE")) {
     168        // No scaling requested
     169        psFree(view);
    164170        return true;
    165171    }
     
    175181    }
    176182
    177     if (!pmSubtractionParamsScale(kernelSize, stampSize, kernelWidths, inFWHM, refFWHM,
    178                                   scaleRef, scaleMin, scaleMax)) {
     183    if (!pmSubtractionParamsScale(kernelSize, stampSize, kernelWidths, scaleRef, scaleMin, scaleMax)) {
    179184        psError(PPSUB_ERR_DATA, false, "Unable to scale parameters.");
    180185        return false;
     
    184189}
    185190
     191pmSubtractionMode subModeFromString (char *string) {
     192
     193    if (!strcasecmp(string, "AUTO")) return PM_SUBTRACTION_MODE_UNSURE;
     194    if (!strcasecmp(string, "DUAL")) return PM_SUBTRACTION_MODE_DUAL;
     195    if (!strcasecmp(string, "SINGLE1")) return PM_SUBTRACTION_MODE_1;
     196    if (!strcasecmp(string, "SINGLE2")) return PM_SUBTRACTION_MODE_2;
     197    if (!strcasecmp(string, "1")) return PM_SUBTRACTION_MODE_1;
     198    if (!strcasecmp(string, "2")) return PM_SUBTRACTION_MODE_2;
     199
     200    return PM_SUBTRACTION_MODE_UNSURE;
     201}
    186202
    187203bool ppSubMatchPSFs(ppSubData *data)
     
    317333    psImageMaskType maskBad = pmConfigMaskGet("BLANK", config); // Bits to mask for bad pixels
    318334
     335    // we have three things to control the convolution choice:
     336
     337    // 1) in the recipe, the keyword DUAL can be TRUE or FALSE.  if TRUE, DUAL is used. If not
     338    // DUAL, then we are doing SINGLE convolution (but see CONVOLVE.TARGET below).
     339
     340    // 2) if the -convolve option is given on the command line, the specified input (1 or 2) is
     341    // the one convolved.  Allowed values are 1 or 2.
     342
     343    // 3) if the -convolve option is NOT given, then the value of the recipe keyword
     344    // CONVOLVE.TARGET is used.  this may have the value DUAL, AUTO, SINGLE1, SINGLE2, 1, 2.
     345    // thus, DUAL convolution can be turned on with either DUAL = T or CONVOLVE.TARGET = DUAL
     346
    319347    bool dual = psMetadataLookupBool(&mdok, recipe, "DUAL"); // Dual convolution?
    320348    pmSubtractionMode subMode;          // Subtraction mode
     
    322350        subMode = PM_SUBTRACTION_MODE_DUAL;
    323351    } 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         }
     352        char *convolveName = psMetadataLookupStr(&mdok, recipe, "CONVOLVE.TARGET"); // recipe value for target
     353        int convolve = psMetadataLookupS32(&mdok, config->arguments, "-convolve"); // override with command-line option
     354        switch (convolve) {
     355          case 0:
     356            // convolve is 0 if it is not supplied on the command line
     357            subMode = subModeFromString(convolveName);
     358            break;
     359          case 1:
     360            subMode = PM_SUBTRACTION_MODE_1;
     361            break;
     362          case 2:
     363            subMode = PM_SUBTRACTION_MODE_2;
     364            break;
     365          default:
     366            psError(PPSUB_ERR_ARGUMENTS, false, "Invalid value for -convolve");
     367            return false;
     368        }
    339369    }
    340370
  • trunk/ppSub/src/ppSubSetMasks.c

    r26982 r29551  
    7777    }
    7878
    79     // Mask the NAN values
    80     if (!pmReadoutMaskNonfinite(inRO, satValue)) {
     79    // Mask the NAN values (USE BLANK instead of SAT?)
     80    if (!pmReadoutMaskInvalid(inRO, maskValue, satValue)) {
    8181        psError(PPSUB_ERR_DATA, false, "Unable to mask non-finite pixels in input.");
    8282        return false;
    8383    }
    84     if (!pmReadoutMaskNonfinite(refRO, satValue)) {
     84    if (!pmReadoutMaskInvalid(refRO, maskValue, satValue)) {
    8585        psError(PPSUB_ERR_DATA, false, "Unable to mask non-finite pixels in reference.");
    8686        return false;
    8787    }
    88 
    8988
    9089#if 0
Note: See TracChangeset for help on using the changeset viewer.