IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 28, 2010, 5:51:55 PM (16 years ago)
Author:
eugene
Message:

compile-time option to use the windowed fft

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmSubtraction.c

    r29543 r29599  
    2727#include "pmSubtraction.h"
    2828
     29# define FFT_WINDOW 0
    2930//#define TESTING
    3031
     
    9697    return;
    9798}
    98 
    9999
    100100// Generate an image of the solved kernel
     
    187187    }
    188188
     189    /* we have three possible implementations for handling flux conservation and photometric scaling.
     190       
     191       1) the original implementation of Alard-Lupton subtracted the 0th kernel gaussian from
     192          the rest of the kernels.  the non-zero integral of the 0th kernel allows for some
     193          flux re-scaling if needed.
     194
     195       2) the original ppSub implementation subtracted a delta function from the kernels.  this
     196          seems to make the solution sensitive to noise terms.
     197
     198       3) accept the measured flux normalization and make all kernels have zero integral, but
     199          use a gaussian to zero the flux. 
     200
     201          *** the operation below is only needed if we use option (2) ***
     202    */
     203
    189204    if (normalise) {
    190205        // Put in the normalisation component
    191206        kernel->kernel[0][0] += (wantDual ? 1.0 : p_pmSubtractionSolutionNorm(kernels));
    192207    }
    193 
    194208    return kernel;
    195209}
     
    243257    psImage *subMask = mask ? psImageSubset(mask, border) : NULL; // Subimage mask
    244258
     259# if (FFT_WINDOW)
     260    psImage *convolved = psImageConvolveFFTwithWindow(NULL, subImage, subMask, maskVal, kernel); // Convolution
     261# else
    245262    psImage *convolved = psImageConvolveFFT(NULL, subImage, subMask, maskVal, kernel); // Convolution
     263# endif
    246264
    247265    psFree(subImage);
     
    287305
    288306    // XXX Can trim this a little by combining the convolution: only have to take the FFT of the kernel once
     307# if (FFT_WINDOW)
     308    psImage *convVariance = psImageConvolveFFTwithWindow(NULL, subVariance, subMask, maskVal, kernel); // Convolved variance
     309    psImage *convKE = subKE ? psImageConvolveFFTwithWindow(NULL, subKE, subMask, maskVal, kernel) : NULL; // Conv KE
     310# else
    289311    psImage *convVariance = psImageConvolveFFT(NULL, subVariance, subMask, maskVal, kernel); // Convolved variance
    290312    psImage *convKE = subKE ? psImageConvolveFFT(NULL, subKE, subMask, maskVal, kernel) : NULL; // Conv KE
     313# endif
    291314
    292315    psFree(subVariance);
     
    539562    PS_ASSERT_KERNEL_NON_NULL(kernel, NULL);
    540563
     564# if (FFT_WINDOW)
     565    psImage *conv = psImageConvolveFFTwithWindow(NULL, image->image, NULL, 0, kernel); // Convolved image
     566# else
    541567    psImage *conv = psImageConvolveFFT(NULL, image->image, NULL, 0, kernel); // Convolved image
     568# endif
    542569
    543570    // note: do not attempt to renormalize kernels here: cannot have different stars with
     
    9781005}
    9791006
     1007// generate an image of the convolution kernel realized at the given coordinate
     1008// if 'wantDual' is set, solution2 is supplied
    9801009psImage *pmSubtractionKernelImage(const pmSubtractionKernels *kernels, float x, float y, bool wantDual)
    9811010{
     
    12851314
    12861315            psRegion *subRegion = psRegionAlloc(i, xSubMax, j, ySubMax); // Bounds of subtraction
    1287             if (threaded) {
     1316            // for a TEST, do not run threaded for testing
     1317            // if (false && threaded) {
     1318            if (threaded) {
    12881319                psThreadJob *job = psThreadJobAlloc("PSMODULES_SUBTRACTION_CONVOLVE");
    12891320                psArray *args = job->args;
Note: See TracChangeset for help on using the changeset viewer.