IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17351


Ignore:
Timestamp:
Apr 6, 2008, 2:42:31 PM (18 years ago)
Author:
eugene
Message:

move psf normalization into psphotKernelFromPSF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080324/psphot/src/psphotKernelFromPSF.c

    r17344 r17351  
    1212  psKernel *psf = psKernelAlloc (-nPix, +nPix, -nPix, +nPix);
    1313
     14  double sum = 0.0;
     15
    1416  for (int j = psf->yMin; j <= psf->yMax; j++) {
    1517    for (int i = psf->xMin; i <= psf->xMax; i++) {
    16       psf->kernel[j][i] = source->psfFlux->data.F32[y0 + j][x0 + i];
     18        double value = source->psfFlux->data.F32[y0 + j][x0 + i];
     19        psf->kernel[j][i] = value;
     20        sum += value;
    1721    }
    1822  }
     23  assert (sum > 0.0);
     24
     25  // psf must be normalized (integral = 1.0)
     26  for (int i = 0; i < psf->image->numRows; i++) {
     27      for (int j = 0; j < psf->image->numCols; j++) {
     28          psf->image->data.F32[i][j] /= sum;
     29      }
     30  }
     31
    1932  return psf;
    2033}
Note: See TracChangeset for help on using the changeset viewer.