IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14670


Ignore:
Timestamp:
Aug 27, 2007, 9:25:01 AM (19 years ago)
Author:
eugene
Message:

added sample code for galaxy convolution

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSim/src/ppSimInsertGalaxies.c

    r14667 r14670  
    137137        // XXX add the sources to a source array
    138138
     139# if (0)       
     140        if (CONVOLVED_FIT) {
     141
     142            // select the PSF (XXX : move out of loop)
     143            pmPSF *psfModel = psMetadataLookupPtr (&mdok, chip->analysis, "PSPHOT.PSF");
     144            assert (psf);
     145           
     146            // supply the psf to the source (normalized?)
     147            source->modelPSF = pmModelFromPSFforXY (psfModel, xChip, yChip, 1.0);
     148
     149            // instantiate the psf flux
     150            pmSourceCachePSF (source, maskVal);
     151
     152            // convert the cached cached psf model for this source to a psKernel
     153            // XXX for the moment, hard-wire the kernel to be 5x5 (2 pix radius)
     154            // XXX for the moment, hard-wire the kernel to be 9x9 (4 pix radius)
     155            psKernel *psf = psphotKernelFromPSF (source, psfSize);
     156
     157            // instantiate the source model flux
     158            // XXX this may need to handle the offset?
     159            pmSourceCacheModel (source, maskVal);
     160
     161            // make a storage buffer for the output image
     162            psImage *buffer = psImageCopy (source->modelFlux, PS_TYPE_F32);
     163
     164            // convolve the psf image with the model image
     165            psImageConvolveDirect (buffer, source->modelFlux, psf);
     166
     167            // save the result back in the source
     168            psFree (source->modelFlux);
     169            source->modelFlux = buffer;
     170        }
     171# endif
     172
    139173        // insert the source flux in the image
    140174        pmSourceAddWithOffset (source, PM_MODEL_OP_FULL, 0xff, dX, dY);
Note: See TracChangeset for help on using the changeset viewer.