IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8823


Ignore:
Timestamp:
Sep 18, 2006, 11:20:24 AM (20 years ago)
Author:
Paul Price
Message:

Making sure CELL.XPARITY and CELL.YPARITY (along with some others) are set when copying or mosaicking

Location:
trunk/psModules/src/camera
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPACopy.c

    r8815 r8823  
    7474    psArray *sourceReadouts = source->readouts; // The source readouts
    7575    int numReadouts = sourceReadouts->n; // Number of readouts copied
     76
     77    // Copy the value for a concept
     78    #define COPY_CONCEPT(TARGET, SOURCE, NAME, TYPE) \
     79    psMetadataItem *targetItem = psMetadataLookup(TARGET, NAME); \
     80    psMetadataItem *sourceItem = psMetadataLookup(SOURCE, NAME); \
     81    targetItem->data.TYPE = sourceItem->data.TYPE;
    7682
    7783    // Need to check/change CELL.XPARITY and CELL.YPARITY
     
    8793                xFlip = true;
    8894            }
     95        } else
     96        {
     97            // Use the source parity
     98            COPY_CONCEPT(target->concepts, source->concepts, "CELL.XPARITY", S32);
    8999        }
    90100        int yParityTarget = psMetadataLookupS32(&mdok, target->concepts, "CELL.YPARITY"); // Target y parity
     
    95105                yFlip = true;
    96106            }
     107        } else
     108        {
     109            // Use the source parity
     110            COPY_CONCEPT(target->concepts, source->concepts, "CELL.YPARITY", S32);
    97111        }
    98112        psTrace("psModules.camera", 3, "xFlip: %d; yFlip: %d\n", xFlip, yFlip);
  • trunk/psModules/src/camera/pmFPAMosaic.c

    r8815 r8823  
    3434}
    3535
     36// Update a concept to the assumed value
     37#define FIX_CONCEPT(SOURCE, NAME, TYPE, VALUE) \
     38psMetadataItem *item = psMetadataLookup(SOURCE, NAME); \
     39item->data.TYPE = VALUE;
    3640
    3741// Get the bounds for an chip's pixels on the HDU
     
    726730    if (!mdok) {
    727731        psLogMsg(__func__, PS_LOG_WARN, "CELL.X0 is not set for the target cell; assuming 0.\n");
     732        FIX_CONCEPT(targetCell->concepts, "CELL.X0", S32, 0);
    728733    }
    729734    int y0Target = psMetadataLookupS32(&mdok, targetCell->concepts, "CELL.Y0");
    730735    if (!mdok) {
    731736        psLogMsg(__func__, PS_LOG_WARN, "CELL.Y0 is not set for the target cell; assuming 0.\n");
     737        FIX_CONCEPT(targetCell->concepts, "CELL.Y0", S32, 0);
    732738    }
    733739    int xParityTarget = psMetadataLookupS32(&mdok, targetCell->concepts, "CELL.XPARITY");
    734740    if (!mdok || (xParityTarget != -1 && xParityTarget != 1)) {
    735741        psLogMsg(__func__, PS_LOG_WARN, "CELL.XPARITY is not set for the target cell; assuming 1.\n");
     742        FIX_CONCEPT(targetCell->concepts, "CELL.XPARITY", S32, 1);
    736743        xParityTarget = 1;
    737744    }
     
    739746    if (!mdok || (yParityTarget != -1 && yParityTarget != 1)) {
    740747        psLogMsg(__func__, PS_LOG_WARN, "CELL.YPARITY is not set for the target cell; assuming 1.\n");
     748        FIX_CONCEPT(targetCell->concepts, "CELL.YPARITY", S32, 1);
    741749        yParityTarget = 1;
    742750    }
     
    763771    if (!mdok || xBinTarget == 0) {
    764772        psLogMsg(__func__, PS_LOG_WARN, "CELL.XBIN is not set for the target cell; assuming %d.\n",*xBinChip);
     773        FIX_CONCEPT(targetCell->concepts, "CELL.XBIN", S32, *xBinChip);
    765774    } else {
    766775        *xBinChip = xBinTarget;
     
    769778    if (!mdok || yBinTarget == 0) {
    770779        psLogMsg(__func__, PS_LOG_WARN, "CELL.YBIN is not set for the target cell; assuming %d.\n",*yBinChip);
     780        FIX_CONCEPT(targetCell->concepts, "CELL.YBIN", S32, *yBinChip);
    771781    } else {
    772782        *yBinChip = yBinTarget;
     
    828838    if (!mdok) {
    829839        psLogMsg(__func__, PS_LOG_WARN, "CHIP.X0 is not set for the target chip; assuming 0.\n");
     840        FIX_CONCEPT(targetChip->concepts, "CHIP.X0", S32, 0);
    830841    }
    831842    int y0Target = psMetadataLookupS32(&mdok, targetChip->concepts, "CHIP.Y0");
    832843    if (!mdok) {
    833844        psLogMsg(__func__, PS_LOG_WARN, "CHIP.Y0 is not set for the target chip; assuming 0.\n");
     845        FIX_CONCEPT(targetChip->concepts, "CHIP.Y0", S32, 0);
    834846    }
    835847    x0Target += psMetadataLookupS32(&mdok, targetCell->concepts, "CELL.X0");
    836848    if (!mdok) {
    837849        psLogMsg(__func__, PS_LOG_WARN, "CELL.X0 is not set for the target cell; assuming 0.\n");
     850        FIX_CONCEPT(targetCell->concepts, "CELL.X0", S32, 0);
    838851    }
    839852    y0Target += psMetadataLookupS32(&mdok, targetCell->concepts, "CELL.Y0");
    840853    if (!mdok) {
    841854        psLogMsg(__func__, PS_LOG_WARN, "CELL.Y0 is not set for the target cell; assuming 0.\n");
     855        FIX_CONCEPT(targetCell->concepts, "CELL.Y0", S32, 0);
    842856    }
    843857    int xParityChipTarget = psMetadataLookupS32(&mdok, targetChip->concepts, "CHIP.XPARITY");
    844858    if (!mdok || (xParityChipTarget != -1 && xParityChipTarget != 1)) {
    845859        psLogMsg(__func__, PS_LOG_WARN, "CHIP.XPARITY is not set for the target chip; assuming 1.\n");
     860        FIX_CONCEPT(targetChip->concepts, "CHIP.XPARITY", S32, 1);
    846861        xParityChipTarget = 1;
    847862    }
     
    849864    if (!mdok || (yParityChipTarget != -1 && yParityChipTarget != 1)) {
    850865        psLogMsg(__func__, PS_LOG_WARN, "CHIP.YPARITY is not set for the target chip; assuming 1.\n");
     866        FIX_CONCEPT(targetChip->concepts, "CHIP.YPARITY", S32, 1);
    851867        yParityChipTarget = 1;
    852868    }
     
    854870    if (!mdok || (xParityCellTarget != -1 && xParityCellTarget != 1)) {
    855871        psLogMsg(__func__, PS_LOG_WARN, "CELL.XPARITY is not set for the target cell; assuming 1.\n");
     872        FIX_CONCEPT(targetCell->concepts, "CELL.XPARITY", S32, 1);
    856873        xParityCellTarget = 1;
    857874    }
     
    859876    if (!mdok || (yParityCellTarget != -1 && yParityCellTarget != 1)) {
    860877        psLogMsg(__func__, PS_LOG_WARN, "CELL.YPARITY is not set for the target cell; assuming 1.\n");
     878        FIX_CONCEPT(targetCell->concepts, "CELL.YPARITY", S32, 1);
    861879        yParityCellTarget = 1;
    862880    }
Note: See TracChangeset for help on using the changeset viewer.