IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20568


Ignore:
Timestamp:
Nov 6, 2008, 2:07:23 PM (18 years ago)
Author:
Paul Price
Message:

Adding parameter 'stride' to control the size of convolution patches (in pmSubtractionConvolve). Previously we have made this the (full) size of the kernel, but there's no reason why it can't be bigger. Making this value larger means the kernel doesn't have to be generated as often.

Location:
trunk
Files:
10 edited

Legend:

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

    r20494 r20568  
    772772        }
    773773
     774        int stride = psMetadataLookupS32(NULL, ppsub, "STRIDE"); // Size of convolution patches
     775
    774776        // Reject bad pixels
    775777        for (int i = 0; i < num; i++) {
     
    791793#endif
    792794
    793             psPixels *reject = pmStackReject(inspect->data[i], numCols, numRows, threshold, poorFrac,
     795            psPixels *reject = pmStackReject(inspect->data[i], numCols, numRows, threshold, poorFrac, stride,
    794796                                             subRegions->data[i], subKernels->data[i]); // Rejected pixels
    795797
  • trunk/ppStack/src/ppStackMatch.c

    r20508 r20568  
    151151            int footprint = psMetadataLookupS32(NULL, ppsub, "STAMP.FOOTPRINT"); // Stamp half-size
    152152            float threshold = psMetadataLookupF32(NULL, ppsub, "STAMP.THRESHOLD"); // Threshold for stmps
     153            int stride = psMetadataLookupS32(NULL, ppsub, "STRIDE"); // Size of convolution patches
    153154            int iter = psMetadataLookupS32(NULL, ppsub, "ITER"); // Rejection iterations
    154155            float rej = psMetadataLookupF32(NULL, ppsub, "REJ"); // Rejection threshold
     
    228229
    229230            // Do the image matching
    230             if (!pmSubtractionMatch(output, NULL, readout, fake, footprint, regionSize, spacing, threshold,
    231                                     sources, stampsName, type, size, order, widths, orders, inner, ringsOrder,
    232                                     binning, penalty, optimum, optWidths, optOrder, optThresh, iter, rej,
    233                                     sysError, maskVal, maskBad, maskPoor, poorFrac, badFrac,
     231            if (!pmSubtractionMatch(output, NULL, readout, fake, footprint, stride, regionSize, spacing,
     232                                    threshold, sources, stampsName, type, size, order, widths, orders, inner,
     233                                    ringsOrder, binning, penalty, optimum, optWidths, optOrder, optThresh,
     234                                    iter, rej, sysError, maskVal, maskBad, maskPoor, poorFrac, badFrac,
    234235                                    PM_SUBTRACTION_MODE_1)) {
    235236                psError(PS_ERR_UNKNOWN, false, "Unable to match images.");
  • trunk/ppSub/src/ppSubArguments.c

    r20517 r20568  
    211211    psMetadataAddF32(arguments, PS_LIST_TAIL, "-spacing", 0, "Typical stamp spacing (pixels)", NAN);
    212212    psMetadataAddS32(arguments, PS_LIST_TAIL, "-footprint", 0, "Stamp footprint half-size (pixels)", -1);
     213    psMetadataAddS32(arguments, PS_LIST_TAIL, "-stride", 0, "Size of convolution patches (pixels)", -1);
    213214    psMetadataAddF32(arguments, PS_LIST_TAIL, "-threshold", 0, "Minimum threshold for stamps (ADU)", NAN);
    214215    psMetadataAddS32(arguments, PS_LIST_TAIL, "-iter", 0, "Number of rejection iterations", -1);
     
    300301    VALUE_ARG_RECIPE_INT("-spam-binning", "SPAM.BINNING",    S32, 0);
    301302    VALUE_ARG_RECIPE_INT("-footprint",    "STAMP.FOOTPRINT", S32, -1);
     303    VALUE_ARG_RECIPE_INT("-stride",       "STRIDE",          S32, -1);
    302304    VALUE_ARG_RECIPE_FLOAT("-threshold",  "STAMP.THRESHOLD", F32);
    303305    VALUE_ARG_RECIPE_INT("-iter",         "ITER",            S32, -1);
  • trunk/ppSub/src/ppSubReadout.c

    r20554 r20568  
    9191    int footprint = psMetadataLookupS32(NULL, recipe, "STAMP.FOOTPRINT"); // Stamp half-size
    9292    float threshold = psMetadataLookupF32(NULL, recipe, "STAMP.THRESHOLD"); // Threshold for stmps
     93    int stride = psMetadataLookupS32(NULL, recipe, "STRIDE"); // Size of convolution patches
    9394    int iter = psMetadataLookupS32(NULL, recipe, "ITER"); // Rejection iterations
    9495    float rej = psMetadataLookupF32(NULL, recipe, "REJ"); // Rejection threshold
     
    191192
    192193    // Match the PSFs
    193     if (!pmSubtractionMatch(inConv, refConv, inRO, refRO, footprint, regionSize, spacing, threshold, sources,
    194                             stampsName, type, size, order, widths, orders, inner, ringsOrder, binning,
    195                             penalty, optimum, optWidths, optOrder, optThresh, iter, rej, sys, maskVal,
    196                             maskBad, maskPoor, poorFrac, badFrac, subMode)) {
     194    if (!pmSubtractionMatch(inConv, refConv, inRO, refRO, footprint, stride, regionSize, spacing, threshold,
     195                            sources, stampsName, type, size, order, widths, orders, inner, ringsOrder,
     196                            binning, penalty, optimum, optWidths, optOrder, optThresh, iter, rej, sys,
     197                            maskVal, maskBad, maskPoor, poorFrac, badFrac, subMode)) {
    197198        psError(PS_ERR_UNKNOWN, false, "Unable to match images.");
    198199        psFree(inConv);
     
    580581            psArray *sources = psMetadataLookupPtr(NULL, photRO->analysis, "PSPHOT.SOURCES"); // Sources
    581582            FILE *sourceFile = fopen("sources.dat", "w"); // File for sources
    582             fprintf(sourceFile, "# x y mag mag_err psf_chisq cr_nsigma ext_nsigma psf_qf flags m_x m_y m_xx m_xy m_yy\n");
     583            fprintf(sourceFile,
     584                    "# x y mag mag_err psf_chisq cr_nsigma ext_nsigma psf_qf flags m_x m_y m_xx m_xy m_yy\n");
    583585            for (int i = 0; i < sources->n; i++) {
    584586                pmSource *source = sources->data[i];
  • trunk/psModules/src/imcombine/pmStackReject.c

    r20505 r20568  
    126126
    127127psPixels *pmStackReject(const psPixels *in, int numCols, int numRows, float threshold, float poorFrac,
    128                         const psArray *subRegions, const psArray *subKernels)
     128                        int stride, const psArray *subRegions, const psArray *subKernels)
    129129{
    130130    PS_ASSERT_PIXELS_NON_NULL(in, NULL);
     
    168168        psRegion *region = subRegions->data[i]; // Region of interest
    169169        pmSubtractionKernels *kernels = subKernels->data[i]; // Kernel of interest
    170         if (!pmSubtractionConvolve(convRO, NULL, inRO, NULL, NULL, 0, 0, 1.0, NAN,
     170        if (!pmSubtractionConvolve(convRO, NULL, inRO, NULL, NULL, stride, 0, 0, 1.0, NAN,
    171171                                   region, kernels, false, true)) {
    172172            psError(PS_ERR_UNKNOWN, false, "Unable to convolve mask image in region %d.", i);
  • trunk/psModules/src/imcombine/pmStackReject.h

    r19345 r20568  
    1313                        float threshold, ///< Threshold on convolved image, 0..1
    1414                        float poorFrac, ///< Fraction for "poor"
     15                        int stride,     ///< Size of convolution patches
    1516                        const psArray *regions, ///< Array of image regions for image
    1617                        const psArray *kernels ///< Array of kernel parameters for each region
  • trunk/psModules/src/imcombine/pmSubtraction.c

    r20561 r20568  
    10881088
    10891089bool pmSubtractionConvolve(pmReadout *out1, pmReadout *out2, const pmReadout *ro1, const pmReadout *ro2,
    1090                            psImage *subMask, psMaskType maskBad, psMaskType maskPoor, float poorFrac,
    1091                            float sysError, const psRegion *region, const pmSubtractionKernels *kernels,
    1092                            bool doBG, bool useFFT)
     1090                           psImage *subMask, int stride, psMaskType maskBad, psMaskType maskPoor,
     1091                           float poorFrac, float sysError, const psRegion *region,
     1092                           const pmSubtractionKernels *kernels, bool doBG, bool useFFT)
    10931093{
    10941094    int numCols = 0, numRows = 0;       // Image dimensions
     
    11241124        PS_ASSERT_IMAGE_SIZE(subMask, numCols, numRows, false);
    11251125    }
     1126    PS_ASSERT_INT_NONNEGATIVE(stride, false);
     1127    PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(poorFrac, 0.0, false);
     1128    PS_ASSERT_FLOAT_LESS_THAN_OR_EQUAL(poorFrac, 1.0, false);
     1129    PS_ASSERT_FLOAT_LARGER_THAN_OR_EQUAL(sysError, 0.0, false);
     1130    PS_ASSERT_FLOAT_LESS_THAN_OR_EQUAL(sysError, 1.0, false);
    11261131    if (region && psRegionIsNaN(*region)) {
    11271132        psString string = psRegionToString(*region);
     
    12121217
    12131218    int size = kernels->size;           // Half-size of kernel
    1214     int fullSize = 2 * size + 1;        // Full size of kernel
    12151219
    12161220    // Get region for convolution: [xMin:xMax,yMin:yMax]
     
    12361240    psImageConvolveSetThreads(false);
    12371241
    1238     for (int j = yMin; j < yMax; j += fullSize) {
    1239         int ySubMax = PS_MIN(j + fullSize, yMax); // Range for subregion of interest
    1240         for (int i = xMin; i < xMax; i += fullSize) {
    1241             int xSubMax = PS_MIN(i + fullSize, xMax); // Range for subregion of interest
     1242    if (stride == 0) {
     1243        // Use the full size of the kernel
     1244        stride = 2 * size + 1;
     1245    }
     1246
     1247    for (int j = yMin; j < yMax; j += stride) {
     1248        int ySubMax = PS_MIN(j + stride, yMax); // Range for subregion of interest
     1249        for (int i = xMin; i < xMax; i += stride) {
     1250            int xSubMax = PS_MIN(i + stride, xMax); // Range for subregion of interest
    12421251
    12431252            psRegion *subRegion = psRegionAlloc(i, xSubMax, j, ySubMax); // Bounds of subtraction
  • trunk/psModules/src/imcombine/pmSubtraction.h

    r20505 r20568  
    66 * @author GLG, MHPCC
    77 *
    8  * @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
    9  * @date $Date: 2008-11-01 03:36:01 $
     8 * @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
     9 * @date $Date: 2008-11-07 00:03:18 $
    1010 * Copyright 2004-207 Institute for Astronomy, University of Hawaii
    1111 */
     
    103103                           const pmReadout *ro2, // Input image 2
    104104                           psImage *subMask, ///< Subtraction mask (or NULL)
     105                           int stride,  ///< Size of convolution patches
    105106                           psMaskType maskBad, ///< Mask value to give bad pixels
    106107                           psMaskType maskPoor, ///< Mask value to give poor pixels
  • trunk/psModules/src/imcombine/pmSubtractionMatch.c

    r20505 r20568  
    9292
    9393bool pmSubtractionMatch(pmReadout *conv1, pmReadout *conv2, const pmReadout *ro1, const pmReadout *ro2,
    94                         int footprint, float regionSize, float stampSpacing, float threshold,
     94                        int footprint, int stride, float regionSize, float stampSpacing, float threshold,
    9595                        const psArray *sources, const char *stampsName,
    9696                        pmSubtractionKernelsType type, int size, int spatialOrder,
     
    139139
    140140    PS_ASSERT_INT_NONNEGATIVE(footprint, false);
     141    PS_ASSERT_INT_NONNEGATIVE(stride, false);
    141142    // regionSize can be just about anything (except maybe negative, but it can be NAN)
    142143    PS_ASSERT_FLOAT_LARGER_THAN(stampSpacing, 0.0, false);
     
    396397
    397398            psTrace("psModules.imcombine", 2, "Convolving...\n");
    398             if (!pmSubtractionConvolve(conv1, conv2, ro1, ro2, subMask, maskBad, maskPoor, poorFrac,
     399            if (!pmSubtractionConvolve(conv1, conv2, ro1, ro2, subMask, stride, maskBad, maskPoor, poorFrac,
    399400                                       sysError, region, kernels, true, useFFT)) {
    400401                psError(PS_ERR_UNKNOWN, false, "Unable to convolve image.");
  • trunk/psModules/src/imcombine/pmSubtractionMatch.h

    r20505 r20568  
    1616                        // Stamp parameters
    1717                        int footprint,  ///< Stamp half-size
     18                        int stride,     ///< Size for convolution patches
    1819                        float regionSize, ///< Typical size of iso-kernel regions
    1920                        float stampSpacing, ///< Typical spacing between stamps
Note: See TracChangeset for help on using the changeset viewer.