IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 8, 2008, 9:51:39 AM (18 years ago)
Author:
Paul Price
Message:

Propagate WCS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackLoop.c

    r18393 r18435  
    1313
    1414//#define TESTING
     15
     16#define WCS_TOLERANCE 0.001             // Tolerance for WCS
    1517
    1618// Here follows lists of files for activation/deactivation at various stages.  Each must be NULL-terminated.
     
    702704
    703705        // Close up
     706        bool wcsDone = false;           // Have we done the WCS?
    704707        for (int i = 0; i < num; i++) {
    705708            if (!readouts->data[i]) {
    706709                continue;
    707710            }
     711            if (!wcsDone) {
     712                // Copy astrometry over
     713                wcsDone = true;
     714                pmReadout *inRO = readouts->data[i]; // Template readout
     715                pmHDU *inHDU = pmHDUFromCell(inRO->parent); // Template HDU
     716                pmHDU *outHDU = pmHDUFromCell(outRO->parent); // Output HDU
     717                pmChip *outChip = outRO->parent->parent; // Output chip
     718                pmFPA *outFPA = outChip->parent; // Output FPA
     719                if (!outHDU || !inHDU) {
     720                    psWarning("Unable to find HDU at FPA level to copy astrometry.");
     721                } else {
     722                    if (!pmAstromReadWCS(outFPA, outChip, inHDU->header, 1.0)) {
     723                        psErrorClear();
     724                        psWarning("Unable to read WCS astrometry from input FPA.");
     725                        wcsDone = false;
     726                    } else {
     727                        if (!outHDU->header) {
     728                            outHDU->header = psMetadataAlloc();
     729                        }
     730                        if (!pmAstromWriteWCS(outHDU->header, outFPA, outChip, WCS_TOLERANCE)) {
     731                            psErrorClear();
     732                            psWarning("Unable to write WCS astrometry to output FPA.");
     733                            wcsDone = false;
     734                        }
     735                    }
     736                }
     737            }
     738
    708739            psFitsClose(imageFits->data[i]);
    709740            psFitsClose(maskFits->data[i]);
Note: See TracChangeset for help on using the changeset viewer.