IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 22, 2009, 2:39:53 PM (16 years ago)
Author:
bills
Message:

Add version information to headers. In streaksremove write the astrometry
to the header in the same place regardless if we have to do a fit or not.
Print error message if fit to astrometry fails.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/magic/remove/src/streaksremove.c

    r26457 r26477  
    2020static long censorPixels(streakFiles *sfiles, psImage * pixels, bool checkNonDiffedPixels, psU16 maskStreak);
    2121
     22char *streaksProgram = "streaksremove";
     23
    2224// Note: For clarity the flow of this program is in main().
    2325// There is not a lot of error checking is done in main.
     
    109111    psF64 cs_t = 0;
    110112    psF64 wi_t = 0;
     113    psF64 ua_t = 0;
    111114    // Iterate through each component of the input (except for raw images there is only one)
    112115    do {
     
    182185            // chip processed files with the data calcuated by psastro at the camera stage
    183186            // (actually we use a linear approximation)
     187            psTimerStart("UPDATE_ASTROMETRY");
    184188            updateAstrometry(sfiles);
     189            ua_t += psTimerClear("UPDATE_ASTROMETRY");
     190            psMetadataAddF32(sfiles->stats, PS_LIST_TAIL, "UPDATE_ASTROMETRY", PS_META_REPLACE, "", ua_t);
     191            psLogMsg("streaksremove", PS_LOG_INFO, "time to update astrometry: %f\n", ua_t);
    185192        }
    186193
     
    544551updateAstrometry(streakFiles *sf)
    545552{
    546     // XXX: why do I check this here? Shouldn't it be just around the call to linearizeTransforms?
    547553    if (sf->bilevelAstrometry) {
    548 
    549554        if (!linearizeTransforms(sf->astrom)) {
    550             // fit failed, leave the astrometry unchanged
     555            // fit failed, leave the transform in the file unchanged
    551556            return;
    552557        }
    553 
    554         if (!pmAstromWriteWCS(sf->outImage->header, sf->inAstrom->fpa, sf->chip, 0.001)) {
    555             psError(PS_ERR_UNKNOWN, false, "failed to update astrometry for extension %d", sf->extnum);
    556             streaksExit("", PS_EXIT_UNKNOWN_ERROR);
    557         }
    558         if (sf->outMask) {
    559             pmAstromWriteWCS(sf->outMask->header, sf->inAstrom->fpa, sf->chip, 0.001);
    560         }
    561         if (sf->outWeight) {
    562             pmAstromWriteWCS(sf->outWeight->header, sf->inAstrom->fpa, sf->chip, 0.001);
    563         }
     558    }
     559    if (!pmAstromWriteWCS(sf->outImage->header, sf->inAstrom->fpa, sf->chip, 0.001)) {
     560        psError(PS_ERR_UNKNOWN, false, "failed to update astrometry for extension %d", sf->extnum);
     561        streaksExit("", PS_EXIT_UNKNOWN_ERROR);
     562    }
     563    if (sf->outMask) {
     564        pmAstromWriteWCS(sf->outMask->header, sf->inAstrom->fpa, sf->chip, 0.001);
     565    }
     566    if (sf->outWeight) {
     567        pmAstromWriteWCS(sf->outWeight->header, sf->inAstrom->fpa, sf->chip, 0.001);
    564568    }
    565569}
     
    579583readAndCopyToOutput(streakFiles *sf, bool exciseAll)
    580584{
    581     bool    updateAstrometry = false;
    582585    if (sf->inImage->pmfile) {
    583586        // image data from pmFPAfile (diff or warp file)
     
    597600        streaksExit("", PS_EXIT_UNKNOWN_ERROR);
    598601    }
    599     // For the chip level files, copy the WCS from the astrometry file to the header
    600     // XXX: do we want to do this for raw images as well?
    601     if (sf->stage == IPP_STAGE_CHIP) {
    602         if (!sf->bilevelAstrometry) {
    603             updateAstrometry = true;
    604             if (!pmAstromWriteWCS(sf->inImage->header, sf->inAstrom->fpa, sf->chip, 0.001)) {
    605                 psError(PS_ERR_UNKNOWN, false, "failed to update astrometry for extension %d", sf->extnum);
    606                 streaksExit("", PS_EXIT_UNKNOWN_ERROR);
    607             }
    608         }
    609     }
    610602    sf->outImage->header =  psMemIncrRefCounter(sf->inImage->header);
    611603    if (sf->recImage) {
     
    640632            }
    641633            addDestreakKeyword(sf->outMask->header);
    642             if (updateAstrometry) {
    643                 pmAstromWriteWCS(sf->outMask->header, sf->inAstrom->fpa, sf->chip, 0.001);
    644             }
    645634            // Note: we don't excise the mask pixels even if exciseAll is true.
    646635            setupImageRefs(sf->outMask, sf->recMask, sf->inMask, sf->extnum, false);
     
    675664        }
    676665        addDestreakKeyword(sf->outWeight->header);
    677         if (updateAstrometry) {
    678             pmAstromWriteWCS(sf->inWeight->header, sf->inAstrom->fpa, sf->chip, 0.001);
    679         }
    680666        setupImageRefs(sf->outWeight, sf->recWeight, sf->inWeight, sf->extnum, exciseAll);
    681667
Note: See TracChangeset for help on using the changeset viewer.