IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 18, 2009, 12:19:57 PM (16 years ago)
Author:
Paul Price
Message:

Ensure unconvolved output gets header updates (software version, WCS) as well as the convolved output.

File:
1 edited

Legend:

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

    r26076 r26184  
    99#include "ppStack.h"
    1010#include "ppStackLoop.h"
     11
     12#define WCS_TOLERANCE 0.001             // Tolerance for WCS
    1113
    1214//#define TESTING                         // Enable test output
     
    8486    }
    8587
     88    // Propagate WCS
     89    bool wcsDone = false;           // Have we done the WCS?
     90    for (int i = 0; i < options->num && !wcsDone; i++) {
     91        if (options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) {
     92            continue;
     93        }
     94
     95        ppStackThread *thread = stack->threads->data[0]; // Representative stack
     96        pmReadout *inRO = thread->readouts->data[i]; // Template readout
     97        if (inRO && !wcsDone) {
     98            // Copy astrometry over
     99            wcsDone = true;
     100            pmHDU *inHDU = pmHDUFromCell(inRO->parent); // Template HDU
     101            pmHDU *outHDU = pmHDUFromCell(target->parent); // Output HDU
     102            pmChip *outChip = target->parent->parent; // Output chip
     103            pmFPA *outFPA = outChip->parent; // Output FPA
     104            if (!outHDU || !inHDU) {
     105                psWarning("Unable to find HDU at FPA level to copy astrometry.");
     106            } else {
     107                if (!pmAstromReadWCS(outFPA, outChip, inHDU->header, 1.0)) {
     108                    psErrorClear();
     109                    psWarning("Unable to read WCS astrometry from input FPA.");
     110                    wcsDone = false;
     111                } else {
     112                    if (!outHDU->header) {
     113                        outHDU->header = psMetadataAlloc();
     114                    }
     115                    if (!pmAstromWriteWCS(outHDU->header, outFPA, outChip, WCS_TOLERANCE)) {
     116                        psErrorClear();
     117                        psWarning("Unable to write WCS astrometry to output FPA.");
     118                        wcsDone = false;
     119                    }
     120                }
     121            }
     122        }
     123    }
     124
     125    // Put version information into the header
     126    pmHDU *hdu = pmHDUFromCell(target->parent);
     127    if (!hdu) {
     128        psError(PS_ERR_UNKNOWN, false, "Unable to find HDU for output.");
     129        return false;
     130    }
     131    if (!hdu->header) {
     132        hdu->header = psMetadataAlloc();
     133    }
     134    ppStackVersionHeader(hdu->header);
     135
     136
    86137#ifdef TESTING
    87138    static int pass = 0;                // Pass through
Note: See TracChangeset for help on using the changeset viewer.