IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 22, 2011, 5:08:37 PM (15 years ago)
Author:
eugene
Message:

allow pcm fitting with a 1d gauss instead of full convolution

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110710/psModules/src/objects/pmPCM_MinimizeChisq.c

    r29012 r31926  
    4545# define USE_FFT 1
    4646# define PRE_CONVOLVE 1
     47# define TESTCOPY 0
    4748
    4849bool pmPCM_MinimizeChisq (
     
    9394        psFree (pcm->psfFFT);
    9495    }
    95     pcm->psfFFT = psImageConvolveKernelInit(pcm->modelFlux, pcm->psf);
     96# if (!TESTCOPY)
     97    if (!pcm->use1Dgauss) {
     98        pcm->psfFFT = psImageConvolveKernelInit(pcm->modelFlux, pcm->psf);
     99    }
     100# endif
    96101# endif   
    97102
     
    309314# if (PRE_CONVOLVE)
    310315    // convolve model image and derivative images with pre-convolved kernel
    311     psImageConvolveKernel (pcm->modelConvFlux, pcm->modelFlux, NULL, 0, pcm->psfFFT);
     316
     317// XXX for a test, just copy, rather than convolve
     318# if (TESTCOPY)
     319    psImageCopy (pcm->modelConvFlux, pcm->modelFlux, pcm->modelFlux->type.type);
     320# else
     321    if (pcm->use1Dgauss) {
     322        // do not use the threaded, mask-aware version of this code (psImageSmoothMaskPixelsThread):
     323        // * the model flux is not masked
     324        // * threading takes place above this level
     325        pcm->modelConvFlux = psImageCopy (pcm->modelConvFlux, pcm->modelFlux, pcm->modelFlux->type.type);
     326        psImageSmooth (pcm->modelConvFlux, pcm->sigma, pcm->nsigma);
     327    } else {
     328        psImageConvolveKernel (pcm->modelConvFlux, pcm->modelFlux, NULL, 0, pcm->psfFFT);
     329    }
     330# endif
     331
    312332    for (int n = 0; n < pcm->dmodelsFlux->n; n++) {
    313333        if (pcm->dmodelsFlux->data[n] == NULL) continue;
     
    315335        psImage *dmodel = pcm->dmodelsFlux->data[n];
    316336        psImage *dmodelConv = pcm->dmodelsConvFlux->data[n];
    317         psImageConvolveKernel (dmodelConv, dmodel, NULL, 0, pcm->psfFFT);
     337# if (TESTCOPY)
     338        psImageCopy (dmodelConv, dmodel, dmodel->type.type);
     339# else
     340        if (pcm->use1Dgauss) {
     341            // do not use the threaded, mask-aware version of this code (psImageSmoothMaskPixelsThread):
     342            // * the model flux is not masked
     343            // * threading takes place above this level
     344            dmodelConv = psImageCopy (dmodelConv, dmodel, dmodel->type.type);
     345            psImageSmooth (dmodelConv, pcm->sigma, pcm->nsigma);
     346        } else {
     347            psImageConvolveKernel (dmodelConv, dmodel, NULL, 0, pcm->psfFFT);
     348        }
     349# endif
    318350    }
    319351# else
     
    325357        psImage *dmodel = pcm->dmodelsFlux->data[n];
    326358        psImage *dmodelConv = pcm->dmodelsConvFlux->data[n];
    327         psImageConvolveFFT (dmodelConv, dmodel, NULL, 0, pcm->psf);
     359
     360        if (pcm->use1Dgauss) {
     361            // do not use the threaded, mask-aware version of this code (psImageSmoothMaskPixelsThread):
     362            // * the model flux is not masked
     363            // * threading takes place above this level
     364            dmodelConv = psImageCopy (dmodelConv, dmodel, dmodel->type.type);
     365            psImageSmooth (dmodelConv, pcm->sigma, pcm->nsigma);
     366        } else {
     367            psImageConvolveFFT (dmodelConv, dmodel, NULL, 0, pcm->psf);
     368        }
    328369    }
    329370# endif // PRE-CONVOLVE
Note: See TracChangeset for help on using the changeset viewer.