IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26477


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.

Location:
trunk/magic/remove/src
Files:
9 edited

Legend:

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

    r25082 r26477  
    11#include "streaksremove.h"
     2
     3char *streaksProgram = "isdestreaked";
    24
    35int
  • trunk/magic/remove/src/streaksVersion.c

    r26438 r26477  
    3838    psString source = streaksSource();    // Source
    3939
    40     psStringPrepend(&version, "streaks ");
     40    psStringPrepend(&version, "%s ", streaksProgram);
    4141    psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__);
    4242    psFree(source);
     
    5858    psString source = streaksSource();   // Software source
    5959
    60     psStringPrepend(&version, "streaks version: ");
    61     psStringPrepend(&source, "streaks source: ");
     60    psStringPrepend(&version, "%s version: ", streaksProgram);
     61    psStringPrepend(&source, "%s source: ", streaksProgram);
    6262
    6363    psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, version);
     
    7878    psFree(time);
    7979    psString history = NULL;               // History string
    80     psStringAppend(&history, "streaks at %s", timeString);
     80    psStringAppend(&history, "%s at %s", streaksProgram, timeString);
    8181    psFree(timeString);
    8282    psMetadataAddStr(header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, NULL, history);
     
    9595    psString timeString = psTimeToISO(time); // The time in an ISO string
    9696    psFree(time);
    97     psLogMsg("streaks", PS_LOG_INFO, "streaks at %s", timeString);
     97    psLogMsg("streaks", PS_LOG_INFO, "%s at %s", streaksProgram, timeString);
    9898    psFree(timeString);
    9999
  • trunk/magic/remove/src/streaksastrom.c

    r25082 r26477  
    379379{
    380380    if (!pmAstromLinearizeTransforms((pmFPA *) astrom->fpa, (pmChip *) astrom->chip)) {
    381         // streaksExit("linear fit to astrometry failed\n", PS_EXIT_UNKNOWN_ERROR);
    382         psError(PS_ERR_UNKNOWN, false, "linear fit to astrometry failed ignoring");
     381        psErrorStackPrint(stderr, "linear fit to astrometry failed. ignoring\n");
    383382        return false;
    384383    }
  • trunk/magic/remove/src/streakscompare.c

    r25082 r26477  
    11#include "streaksremove.h"
     2
     3char *streaksProgram = "streakscompare";
    24
    35static pmConfig * parseArguments(int, char **);
  • trunk/magic/remove/src/streaksio.c

    r26438 r26477  
    404404addDestreakKeyword(psMetadata *header)
    405405{
     406    streaksVersionHeaderFull(header);
    406407    psMetadataAddBool(header, PS_LIST_TAIL, "PSDESTRK", PS_META_REPLACE,
    407408        "Have streaks been removed from image?", true);
     
    411412addRecoveryKeyword(psMetadata *header)
    412413{
     414    streaksVersionHeaderFull(header);
    413415    psMetadataAddBool(header, PS_LIST_TAIL, "PSRECOVR", PS_META_REPLACE,
    414416        "Does this image contain excised streak pixels?", true);
  • trunk/magic/remove/src/streaksrelease.c

    r26408 r26477  
    44static bool readAndCopyToOutput(streakFiles *sf, bool exciseAll);
    55static void writeImages(streakFiles *sf, bool exciseImageCube);
     6
     7char *streaksProgram = "streaksrelease";
    68
    79int
  • 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
  • trunk/magic/remove/src/streaksremove.h

    r26438 r26477  
    3333    int         yParity;
    3434    double      exciseValue;
     35    psString    program;
    3536} sFile;
    3637
     38// used for error messages
     39extern char * streaksProgram;
    3740
    3841typedef enum {
     
    9699extern void setStreakFiles( streakFiles *);
    97100
     101extern bool streaksVersionHeaderFull(psMetadata *header);
     102extern psString streaksVersionLong(void);
     103
    98104#define CHIP_LEVEL_INPUT(_stage) ((_stage == IPP_STAGE_RAW) || (_stage == IPP_STAGE_CHIP))
    99105#define USE_SUPPLIED_ASTROM(_stage) CHIP_LEVEL_INPUT(_stage)
  • trunk/magic/remove/src/streaksreplace.c

    r25082 r26477  
    55static void writeImages(streakFiles *sf, bool exciseImageCube);
    66static bool readAndCopyToOutput(streakFiles *sf, bool restoreImageCube);
     7
     8char *streaksProgram = "streaksreplace";
    79
    810int main(int argc, char *argv[])
Note: See TracChangeset for help on using the changeset viewer.