IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 31, 2008, 5:36:01 PM (18 years ago)
Author:
Paul Price
Message:

Making relative systematic error in kernel a configurable parameter instead of #define.

File:
1 edited

Legend:

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

    r20466 r20505  
    2929#define PIXEL_LIST_BUFFER 100           // Number of entries to add to pixel list at a time
    3030#define MIN_SAMPLE_STATS    7           // Minimum number to use sample statistics; otherwise use quartiles
    31 
    32 //#define SYS_ERROR 0.00                  // Relative error in derived convolution kernel pixels
    3331
    3432//////////////////////////////////////////////////////////////////////////////////////////////////////////////
     
    459457
    460458// Generate an image that can be used to track systematic errors
    461 static psImage *subtractionSysErrImage(const psImage *image     // Image from which to make sys err image
     459static psImage *subtractionSysErrImage(const psImage *image, // Image from which to make sys err image
     460                                       float sysError // Relative systematic error
    462461                                       )
    463462{
    464 #ifndef SYS_ERROR
    465     return NULL;
    466 #else
     463    if (!isfinite(sysError) || sysError == 0.0) {
     464        return NULL;
     465    }
     466
    467467    int numCols = image->numCols, numRows = image->numRows; // Size of image
    468468    psImage *sys = psImageAlloc(numCols, numRows, PS_TYPE_F32); // Systematic error image
    469469
     470    float sysError2 = PS_SQR(sysError); // Square of the systematic error
    470471    for (int y = 0; y < numRows; y++) {
    471472        for (int x = 0; x < numCols; x++) {
    472             sys->data.F32[y][x] = PS_SQR(image->data.F32[y][x]) * PS_SQR(SYS_ERROR);
     473            sys->data.F32[y][x] = PS_SQR(image->data.F32[y][x]) * sysError2;
    473474        }
    474475    }
    475476
    476477    return sys;
    477 #endif
    478478}
    479479
     
    10891089bool pmSubtractionConvolve(pmReadout *out1, pmReadout *out2, const pmReadout *ro1, const pmReadout *ro2,
    10901090                           psImage *subMask, psMaskType maskBad, psMaskType maskPoor, float poorFrac,
    1091                            const psRegion *region, const pmSubtractionKernels *kernels,
     1091                           float sysError, const psRegion *region, const pmSubtractionKernels *kernels,
    10921092                           bool doBG, bool useFFT)
    10931093{
     
    11971197    psImage *sys1 = NULL, *sys2 = NULL; // Systematic error images
    11981198    if (kernels->mode == PM_SUBTRACTION_MODE_1 || kernels->mode == PM_SUBTRACTION_MODE_DUAL) {
    1199         sys1 = subtractionSysErrImage(ro1->image);
     1199        sys1 = subtractionSysErrImage(ro1->image, sysError);
    12001200        if (threaded && sys1) {
    12011201            psMutexInit(sys1);
     
    12031203    }
    12041204    if (kernels->mode == PM_SUBTRACTION_MODE_2 || kernels->mode == PM_SUBTRACTION_MODE_DUAL) {
    1205         sys2 = subtractionSysErrImage(ro2->image);
     1205        sys2 = subtractionSysErrImage(ro2->image, sysError);
    12061206        if (threaded && sys2) {
    12071207            psMutexInit(sys2);
Note: See TracChangeset for help on using the changeset viewer.