IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10589


Ignore:
Timestamp:
Dec 8, 2006, 2:43:04 PM (20 years ago)
Author:
Paul Price
Message:

Adding error checking; only close files after all operations are pau.

Location:
trunk/ppImage/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImageLoop.c

    r10439 r10589  
    142142            }
    143143
     144#if 0
    144145            if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
    145146                return false;
    146147            }
    147         }
    148 
    149         ppImageMosaicChip(config, view, "PPIMAGE.OUTPUT.CHIP", "PPIMAGE.OUTPUT");
    150         ppImageRebinChip(config, view, "PPIMAGE.BIN1", "PPIMAGE.OUTPUT.CHIP");
    151         ppImageRebinChip(config, view, "PPIMAGE.BIN2", "PPIMAGE.OUTPUT.CHIP");
     148#endif
     149
     150        }
     151
     152        if (!ppImageMosaicChip(config, view, "PPIMAGE.OUTPUT.CHIP", "PPIMAGE.OUTPUT")) {
     153            psError(PS_ERR_UNKNOWN, false, "Unable to mosaic chip.\n");
     154            return false;
     155        }
     156        if (!ppImageRebinChip(config, view, "PPIMAGE.BIN1", "PPIMAGE.OUTPUT.CHIP")) {
     157            psError(PS_ERR_UNKNOWN, false, "Unable to bin chip.\n");
     158            return false;
     159        }
     160        if (!ppImageRebinChip(config, view, "PPIMAGE.BIN2", "PPIMAGE.OUTPUT.CHIP")) {
     161            psError(PS_ERR_UNKNOWN, false, "Unable to bin chip.\n");
     162            return false;
     163        }
    152164
    153165        // we perform photometry on the readouts of this chip in the output
     
    156168        }
    157169
     170        // Close cells
     171        view->cell = -1;
     172        while ((cell = pmFPAviewNextCell(view, input->fpa, 1)) != NULL) {
     173            if (!cell->process || !cell->file_exists) {
     174                continue;
     175            }
     176
     177            if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
     178                return false;
     179            }
     180        }
     181
     182        // Close chip
    158183        if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
    159184            return false;
  • trunk/ppImage/src/ppImageMosaic.c

    r10214 r10589  
    2121    }
    2222
    23     pmFPAAddSourceFromView(out->fpa, view, out->format);
    2423    pmChip *outChip = pmFPAviewThisChip(view, out->fpa);
    2524    pmChip *inChip = pmFPAviewThisChip(view, in->fpa);
     25    if (!outChip->hdu && !outChip->parent->hdu) {
     26        pmFPAAddSourceFromView(out->fpa, view, out->format);
     27    }
    2628
    2729    // Copy over concepts
  • trunk/ppImage/src/ppImageRebinReadout.c

    r10502 r10589  
    1111
    1212    pmFPAfile *inFile = psMetadataLookupPtr (NULL, config->files, inName);
    13     if (inFile == NULL) return NULL;
     13    if (inFile == NULL) return false;
    1414
    1515    pmFPAfile *outFile = psMetadataLookupPtr (NULL, config->files, outName);
    16     if (outFile == NULL) return NULL;
     16    if (outFile == NULL) return false;
    1717
    1818    // XXX double check that chip != -1?
     
    2020    pmChip *inChip = pmFPAviewThisChip (view, inFile->fpa);
    2121    pmChip *outChip = pmFPAviewThisChip (view, outFile->fpa);
    22     pmChipCopyStructure (outChip, inChip, outFile->xBin, outFile->yBin);
     22    if (!pmChipCopyStructure (outChip, inChip, outFile->xBin, outFile->yBin)) {
     23        psError(PS_ERR_UNKNOWN, false, "Unable to copy chip structure.");
     24        return false;
     25    }
    2326
    2427    while ((cell = pmFPAviewNextCell (view, inFile->fpa, 1)) != NULL) {
     
    5659        binItem->data.S32 = yBin * outFile->yBin;
    5760    }
     61
    5862    return true;
    5963}
Note: See TracChangeset for help on using the changeset viewer.