IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 20, 2006, 10:37:50 PM (20 years ago)
Author:
Paul Price
Message:

Checking data_exists on chips and cells.
Setting data_exists on mosaic chips and cells.
Since the source FPA may have multiple headers (e.g., in the case of
GPC, where each chip corresponds to a different file), take the first
one we find as the source to copy to the target.

File:
1 edited

Legend:

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

    r7595 r7605  
    810810    for (int i = 0; i < cells->n; i++) {
    811811        pmCell *cell = cells->data[i];  // The cell of interest
    812         if (!cell) {
     812        if (!cell || !cell->data_exists) {
    813813            continue;
    814814        }
     
    870870    for (int i = 0; i < chips->n; i++) {
    871871        pmChip *chip = chips->data[i];  // The chip of interest
    872         if (!chip) {
     872        if (!chip || !chip->data_exists) {
    873873            continue;
    874874        }
     
    876876        for (int j = 0; j < cells->n; j++) {
    877877            pmCell *cell = cells->data[j];  // The cell of interest
    878             if (!cell) {
     878            if (!cell || !cell->data_exists) {
    879879                continue;
    880880            }
     
    997997    psFree(newReadout);                 // Drop reference
    998998
     999    // Data now exists in the targets
     1000    pmChipSetDataStatus(target, true);
     1001    pmCellSetDataStatus(targetCell, true);
     1002    newReadout->data_exists = true;
     1003
    9991004    // Update the headers
    10001005    pmHDU *sourceHDU = pmHDUFromChip(source); // The HDU for the source
     
    10621067    psList *sourceCells = psListAlloc(NULL); // List of source cells
    10631068    psArray *chips = source->chips;        // Array of chips
     1069    pmChip *firstSourceChip = NULL;     // The first chip in the source FPA; for headers
     1070    pmCell *firstSourceCell = NULL;     // The first cell in the source FPA; for headers
    10641071    for (long i = 0; i < chips->n; i++) {
    10651072        pmChip *chip = chips->data[i];  // Chip of interest
    1066         if (!chip) {
     1073        if (!chip || !chip->data_exists) {
    10671074            continue;
    10681075        }
     
    10701077        for (long j = 0; j < cells->n; j++) {
    10711078            pmCell *cell = cells->data[j]; // Cell of interest
    1072             if (!cell) {
     1079            if (!cell || !cell->data_exists) {
    10731080                continue;
    10741081            }
    10751082            psListAdd(sourceCells, PS_LIST_TAIL, cell);
     1083
     1084            // These are valid chip and cell to use for the header; grab the first such
     1085            if (!firstSourceCell && !firstSourceChip) {
     1086                firstSourceCell = cell;
     1087                firstSourceChip = chip;
     1088            }
    10761089        }
    10771090    }
     
    10921105    psFree(newReadout);                 // Drop reference
    10931106
     1107    // Data now exists in the targets
     1108    pmChipSetDataStatus(targetChip, true);
     1109    pmCellSetDataStatus(targetCell, true);
     1110    newReadout->data_exists = true;
     1111
    10941112    // Update the headers
    1095     pmHDU *sourceHDU = pmHDUFromFPA(source); // The HDU for the source
    1096     pmHDU *targetHDU = pmHDUFromFPA(target); // The HDU for the target
     1113    pmHDU *sourceHDU = pmHDUGetHighest(source, firstSourceChip, firstSourceCell); // The HDU for the source
     1114    if (!sourceHDU) {
     1115        psLogMsg(__func__, PS_LOG_WARN, "Unable to find HDU in source FPA; unable to copy headers.\n");
     1116        return false;
     1117    }
     1118    pmHDU *targetHDU = pmHDUGetHighest(target, targetChip, targetCell); // The HDU for the target
     1119    if (!targetHDU) {
     1120        psLogMsg(__func__, PS_LOG_WARN, "Unable to find HDU in target FPA; unable to copy headers.\n");
     1121        return false;
     1122    }
    10971123    targetHDU->header = psMetadataCopy(targetHDU->header, sourceHDU->header);
    10981124
Note: See TracChangeset for help on using the changeset viewer.