IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 21150


Ignore:
Timestamp:
Jan 22, 2009, 9:06:25 AM (17 years ago)
Author:
Paul Price
Message:

Adding new input parameter: limit to the 'maximum deconvolution fraction' --- when this value is in excess of unity (e.g., 1.01 is probably OK, 1.1 is bad), the convolved image tends to be bad. We now detect these and throw them out.

Location:
branches/pap_branch_20090108/ppStack/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_branch_20090108/ppStack/src/ppStackArguments.c

    r20995 r21150  
    152152    psMetadataAddF32(arguments, PS_LIST_TAIL, "-threshold-mask", 0, "Threshold for mask deconvolution", NAN);
    153153    psMetadataAddF32(arguments, PS_LIST_TAIL, "-poor-frac", 0, "Fraction of weight for poor pixels", NAN);
     154    psMetadataAddF32(arguments, PS_LIST_TAIL, "-deconv-limit", 0, "Maximum deconvolution fraction limit", NAN);
    154155    psMetadataAddF32(arguments, PS_LIST_TAIL, "-image-rej", 0,
    155156                     "Pixel rejection fraction threshold for rejecting entire image", NAN);
     
    236237    VALUE_ARG_RECIPE_FLOAT("-threshold-mask", "THRESHOLD.MASK", F32);
    237238    VALUE_ARG_RECIPE_FLOAT("-image-rej",      "IMAGE.REJ",      F32);
     239    VALUE_ARG_RECIPE_FLOAT("-deconv-limit",   "DECONV.LIMIT",   F32);
    238240    VALUE_ARG_RECIPE_INT("-rows",             "ROWS",           S32, 0);
    239241    VALUE_ARG_RECIPE_FLOAT("-poor-frac",      "POOR.FRACTION",  F32);
  • branches/pap_branch_20090108/ppStack/src/ppStackMatch.c

    r21114 r21150  
    173173    psAssert(recipe, "We've thrown an error on this before.");
    174174
     175    float deconvLimit = psMetadataLookupF32(NULL, recipe, "DECONV.LIMIT"); // Limit on deconvolution fraction
     176
    175177    // Look up appropriate values from the ppSub recipe
    176178    psMetadata *ppsub = psMetadataLookupMetadata(NULL, config->recipes, "PPSUB"); // PPSUB recipe
     
    204206        assert(outName);
    205207        // Read convolution kernel
    206         {
    207             psString filename = NULL;   // Output filename
    208             psStringAppend(&filename, "%s.%d.kernel", outName, numInput);
    209             psString resolved = pmConfigConvertFilename(filename, config, false, false); // Resolved filename
    210             psFree(filename);
    211             psFits *fits = psFitsOpen(resolved, "r"); // FITS file for subtraction kernel
    212             psFree(resolved);
    213             if (!fits || !pmReadoutReadSubtractionKernels(output, fits)) {
    214                 psError(PS_ERR_IO, false, "Unable to read previously produced kernel");
    215                 psFitsClose(fits);
    216                 return false;
    217             }
     208        psString filename = NULL;   // Output filename
     209        psStringAppend(&filename, "%s.%d.kernel", outName, numInput);
     210        psString resolved = pmConfigConvertFilename(filename, config, false, false); // Resolved filename
     211        psFree(filename);
     212        psFits *fits = psFitsOpen(resolved, "r"); // FITS file for subtraction kernel
     213        psFree(resolved);
     214        if (!fits || !pmReadoutReadSubtractionKernels(output, fits)) {
     215            psError(PS_ERR_IO, false, "Unable to read previously produced kernel");
    218216            psFitsClose(fits);
    219 
    220             // Add in variance factor
    221             pmSubtractionKernels *kernels = psMetadataLookupPtr(NULL, output->analysis,
    222                                                                 PM_SUBTRACTION_ANALYSIS_KERNEL); // Kernels
    223             float vf = pmSubtractionVarianceFactor(kernels, 0.0, 0.0, false); // Variance factor
    224             psMetadataItem *vfItem = psMetadataLookup(readout->parent->concepts, "CELL.VARFACTOR");
    225             if (!isfinite(vf)) {
    226                 vf = 1.0;
    227             }
    228             if (isfinite(vfItem->data.F32)) {
    229                 vfItem->data.F32 *= vf;
    230             } else {
    231                 vfItem->data.F32 = vf;
    232             }
     217            return false;
     218        }
     219        psFitsClose(fits);
     220
     221        // Add in variance factor
     222        pmSubtractionKernels *kernels = psMetadataLookupPtr(NULL, output->analysis,
     223                                                            PM_SUBTRACTION_ANALYSIS_KERNEL); // Kernels
     224        float vf = pmSubtractionVarianceFactor(kernels, 0.0, 0.0, false); // Variance factor
     225        psMetadataItem *vfItem = psMetadataLookup(readout->parent->concepts, "CELL.VARFACTOR");
     226        if (!isfinite(vf)) {
     227            vf = 1.0;
     228        }
     229        if (isfinite(vfItem->data.F32)) {
     230            vfItem->data.F32 *= vf;
     231        } else {
     232            vfItem->data.F32 = vf;
    233233        }
    234234
     
    253253        psFree(maskName);
    254254        psFree(weightName);
     255
     256        psRegion *region = psMetadataLookupPtr(NULL, output->analysis,
     257                                               PM_SUBTRACTION_ANALYSIS_REGION); // Convolution region
     258
     259        pmSubtractionAnalysis(readout->analysis, kernels, region,
     260                              readout->image->numCols, readout->image->numRows);
    255261    } else {
    256262#endif
     
    535541    }
    536542
     543    // Reject image completely if the maximum deconvolution fraction exceeds the limit
     544    float deconv = psMetadataLookupF32(NULL, output->analysis,
     545                                       PM_SUBTRACTION_ANALYSIS_DECONV_MAX); // Maximum deconvolution fraction
     546    if (deconv > deconvLimit) {
     547        psWarning("Maximum deconvolution fraction (%f) exceeds limit (%f) --- rejecting\n",
     548                  deconv, deconvLimit);
     549        psFree(output);
     550        return NULL;
     551    }
     552
    537553    // Renormalise the variances if desired
    538554    if (renorm) {
Note: See TracChangeset for help on using the changeset viewer.