IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 19283


Ignore:
Timestamp:
Aug 28, 2008, 6:05:19 PM (18 years ago)
Author:
Paul Price
Message:

Added bad/poor distinction for pmStackReject: API change. This reduces the amount of bad pixels in the stacked image. New recipe value: POOR.FRACTION.

Location:
trunk/ppStack/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackArguments.c

    r19231 r19283  
    152152    psMetadataAddF32(arguments, PS_LIST_TAIL, "-combine-rej", 0,
    153153                     "Combination rejection thresold (sigma)", NAN);
    154     psMetadataAddStr(arguments,  PS_LIST_TAIL, "-mask-val", 0, "Mask value of input bad pixels", NULL);
    155     psMetadataAddStr(arguments,  PS_LIST_TAIL, "-mask-bad", 0, "Mask value to give bad pixels", NULL);
    156     psMetadataAddStr(arguments,  PS_LIST_TAIL, "-mask-poor", 0, "Mask value to give poor pixels", NULL);
     154    psMetadataAddStr(arguments, PS_LIST_TAIL, "-mask-val", 0, "Mask value of input bad pixels", NULL);
     155    psMetadataAddStr(arguments, PS_LIST_TAIL, "-mask-bad", 0, "Mask value to give bad pixels", NULL);
     156    psMetadataAddStr(arguments, PS_LIST_TAIL, "-mask-poor", 0, "Mask value to give poor pixels", NULL);
    157157    psMetadataAddF32(arguments, PS_LIST_TAIL, "-threshold-mask", 0, "Threshold for mask deconvolution", NAN);
     158    psMetadataAddF32(arguments, PS_LIST_TAIL, "-poor-frac", 0, "Fraction of weight for poor pixels", NAN);
    158159    psMetadataAddF32(arguments, PS_LIST_TAIL, "-image-rej", 0,
    159160                     "Pixel rejection fraction threshold for rejecting entire image", NAN);
     
    233234    VALUE_ARG_RECIPE_FLOAT("-image-rej",      "IMAGE.REJ",      F32);
    234235    VALUE_ARG_RECIPE_INT("-rows",             "ROWS",           S32, 0);
     236    VALUE_ARG_RECIPE_FLOAT("-poor-frac",      "POOR.FRACTION",  F32);
    235237
    236238    valueArgRecipeStr(arguments, recipe, "-mask-val",  "MASK.VAL",  recipe);
  • trunk/ppStack/src/ppStackLoop.c

    r19269 r19283  
    220220    float imageRej = psMetadataLookupF32(NULL, recipe, "IMAGE.REJ"); // Maximum fraction of image to reject
    221221                                                                     // before rejecting entire image
     222    float poorFrac = psMetadataLookupF32(&mdok, recipe, "POOR.FRACTION"); // Fraction for "poor"
    222223
    223224    const char *statsName = psMetadataLookupStr(&mdok, config->arguments, "STATS"); // Filename for statistics
     
    410411    psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0); // Random number generator
    411412    int numGood = 0;                    // Number of good frames
     413    int numCols = 0, numRows = 0;       // Size of image
    412414    for (int i = 0; i < num; i++) {
    413415        psTrace("ppStack", 2, "Convolving input %d of %d to target PSF....\n", i, num);
     
    426428        pmReadout *readout = pmFPAviewThisReadout(view, file->fpa); // Input readout
    427429        psFree(view);
     430
     431        if (numCols == 0 && numRows == 0) {
     432            numCols = readout->image->numCols;
     433            numRows = readout->image->numRows;
     434        } else if (numCols != readout->image->numCols || numRows != readout->image->numRows) {
     435            psError(PS_ERR_UNKNOWN, true, "Sizes of input images don't match: %dx%d vs %dx%d",
     436                    readout->image->numCols, readout->image->numRows, numCols, numRows);
     437            psFree(globalSources);
     438            psFree(indSources);
     439            psFree(targetPSF);
     440            psFree(rng);
     441            return false;
     442        }
    428443
    429444        // Background subtraction, scaling and normalisation is performed automatically by the image matching
     
    621636#ifdef TESTING
    622637            {
    623                 psImage *pix = psPixelsToMask(NULL, inspect, psRegionSet(0, outRO->image->numCols - 1,
    624                                                                          0, outRO->image->numRows - 1), 0xff);
     638                psImage *mask = psPixelsToMask(NULL, inspect, psRegionSet(0, numCols - 1, 0, numRows - 1),
     639                                               0xff); // Mask image
    625640                psString name = NULL;           // Name of image
    626641                psStringAppend(&name, "inspect_%03d.fits", i);
    627642                psFits *fits = psFitsOpen(name, "w");
    628643                psFree(name);
    629                 psFitsWriteImage(fits, NULL, pix, 0, NULL);
    630                 psFree(pix);
     644                psFitsWriteImage(fits, NULL, mask, 0, NULL);
     645                psFree(mask);
    631646                psFitsClose(fits);
    632647            }
    633648#endif
    634649
    635             psPixels *reject = pmStackReject(inspect, NULL, threshold, subRegions->data[i],
    636                                              subKernels->data[i]); // Pixels to reject
     650            psPixels *reject = pmStackReject(inspect, numCols, numRows, threshold, poorFrac,
     651                                             subRegions->data[i], subKernels->data[i]); // Pixels to reject
    637652
    638653#ifdef TESTING
    639654            {
    640                 psImage *pix = psPixelsToMask(NULL, reject, psRegionSet(0, outRO->image->numCols - 1,
    641                                                                         0, outRO->image->numRows - 1), 0xff);
     655                psImage *mask = psPixelsToMask(NULL, reject, psRegionSet(0, numCols - 1, 0, numRows - 1),
     656                                               0xff); // Mask image
    642657                psString name = NULL;           // Name of image
    643658                psStringAppend(&name, "reject_%03d.fits", i);
    644659                psFits *fits = psFitsOpen(name, "w");
    645660                psFree(name);
    646                 psFitsWriteImage(fits, NULL, pix, 0, NULL);
    647                 psFree(pix);
     661                psFitsWriteImage(fits, NULL, mask, 0, NULL);
     662                psFree(mask);
    648663                psFitsClose(fits);
    649664            }
  • trunk/ppStack/src/ppStackMatch.c

    r19251 r19283  
    1515                     PM_SOURCE_MODE_CR_LIMIT) // Mask to apply to input sources
    1616
    17 //#define TESTING                         // Enable debugging output
     17#define TESTING                         // Enable debugging output
    1818
    1919
Note: See TracChangeset for help on using the changeset viewer.