IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 13, 2011, 11:52:31 AM (15 years ago)
Author:
eugene
Message:

some reorganization: create ppStackUpdateHeader, ppStackStats, ppStackJPEG functions to clean up ppStackLoop; plug some leaks; cleanup include sections; create ppStackCleanup for end of processing (renamed old ppStackCleanup to ppStackCleanupFiles); move jpeg creation from ppStackCleanupFiles to ppStackJPEG; same for stats; adjust kernel auto-scaling to take place after we have measured the source sizes; update headers with stack_id, skycell_id, tess_id (optional)

File:
1 edited

Legend:

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

    r29552 r30620  
    1 #ifdef HAVE_CONFIG_H
    2 #include <config.h>
    3 #endif
    4 
    5 #include <stdio.h>
    6 #include <pslib.h>
    7 #include <psmodules.h>
    8 
    91#include "ppStack.h"
    10 #include "ppStackLoop.h"
    11 
    12 #define WCS_TOLERANCE 0.001             // Tolerance for WCS
    132
    143//#define TESTING                         // Enable test output
     
    10796    }
    10897
    109     // Propagate WCS
    110     bool wcsDone = false;           // Have we done the WCS?
    111     for (int i = 0; i < options->num && !wcsDone; i++) {
    112         if (options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) {
    113             continue;
    114         }
    115 
    116         ppStackThread *thread = stack->threads->data[0]; // Representative stack
    117         pmReadout *inRO = thread->readouts->data[i]; // Template readout
    118         if (inRO && !wcsDone) {
    119             // Copy astrometry over
    120             wcsDone = true;
    121             pmHDU *inHDU = pmHDUFromCell(inRO->parent); // Template HDU
    122             pmHDU *outHDU = pmHDUFromCell(outRO->parent); // Output HDU
    123             pmChip *outChip = outRO->parent->parent; // Output chip
    124             pmFPA *outFPA = outChip->parent; // Output FPA
    125             if (!outHDU || !inHDU) {
    126                 psWarning("Unable to find HDU at FPA level to copy astrometry.");
    127             } else {
    128                 if (!pmAstromReadWCS(outFPA, outChip, inHDU->header, 1.0)) {
    129                     psErrorClear();
    130                     psWarning("Unable to read WCS astrometry from input FPA.");
    131                     wcsDone = false;
    132                 } else {
    133                     if (!outHDU->header) {
    134                         outHDU->header = psMetadataAlloc();
    135                     }
    136                     if (!pmAstromWriteWCS(outHDU->header, outFPA, outChip, WCS_TOLERANCE)) {
    137                         psErrorClear();
    138                         psWarning("Unable to write WCS astrometry to output FPA.");
    139                         wcsDone = false;
    140                     }
    141                 }
    142             }
    143         }
    144     }
    145 
    146     // Put version information into the header
    147     pmHDU *hdu = pmHDUFromCell(outRO->parent);
    148     if (!hdu) {
    149         psError(PPSTACK_ERR_PROG, false, "Unable to find HDU for output.");
    150         return false;
    151     }
    152     if (!hdu->header) {
    153         hdu->header = psMetadataAlloc();
    154     }
    155     ppStackVersionHeader(hdu->header);
    156 
    157 
    15898#ifdef TESTING
    15999    static int pass = 0;                // Pass through
Note: See TracChangeset for help on using the changeset viewer.