IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7567


Ignore:
Timestamp:
Jun 14, 2006, 12:34:46 PM (20 years ago)
Author:
Paul Price
Message:

Add check that science and fringe regions are the same.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/detrend/pmFringeStats.c

    r7566 r7567  
    33 *  @author Eugene Magnier, IfA
    44 *
    5  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-06-14 22:23:18 $
     5 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-06-14 22:34:46 $
    77 *
    88 *  Copyright 2004 IfA
     
    542542    pmFringeRegions *regions = science->regions; // The fringe regions
    543543    int numRegions = regions->nRequested; // Number of regions
     544
     545    // Ensure we are dealing with the SAME fringe points for all the inputs.
     546    // Otherwise, we're going to get crazy results.
     547    for (long i = 0; i < numRegions; i++) {
     548        float xScience = regions->x->data.F32[i]; // The x position for the science image
     549        float yScience = regions->y->data.F32[i]; // The y position for the science image
     550        for (long j = 0; j < fringes->n; j++) {
     551            pmFringeStats *fringe = fringes->data[j]; // The fringe statistics from a fringe image
     552            pmFringeRegions *fringeRegions = fringe->regions; // The fringe regions for that fringe image
     553            if (fringeRegions->x->data.F32[i] != xScience ||
     554                    fringeRegions->y->data.F32[i] != yScience) {
     555                psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Science and fringe measurement regions "
     556                        "don't match.\n");
     557                return NULL;
     558            }
     559        }
     560    }
     561
     562    // Set up the mask
    544563    if (!regions->mask) {
    545564        regions->mask = psVectorAlloc(numRegions, PS_TYPE_U8);
     
    547566        psVectorInit(regions->mask, 0);
    548567    }
    549 
    550568    psVector *mask = regions->mask;     // The region mask
    551569    psStats *median = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN); // Median statistics
Note: See TracChangeset for help on using the changeset viewer.