IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 13, 2008, 2:23:30 PM (17 years ago)
Author:
bills
Message:

For chip processed files, copy the wcs from the astrometry
file to the headers. Fix bug in selecting mask and weight images

File:
1 edited

Legend:

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

    r20708 r20730  
    22#include "libgen.h"
    33#include "unistd.h"
    4 
    5 // XXX: I don't think we need the lock and unlock functions
    6 extern bool  sFileLock(sFile * sfile);
    7 extern bool  sFileUnlock(sFile * sfile);
    8 extern bool  sFileReplace(sFile *dest, sFile *src);
    94
    105static nebServer *ourNebServer = NULL;
     
    343338
    344339    return sf;
    345 }
    346 
    347 
    348 bool
    349 streakFilesLock(streakFiles *sf)
    350 {
    351     if (sf->inImage->inNebulous ) {
    352         // TODO: make the nebulous call to lock the file
    353     }
    354     return true;
    355 }
    356 bool
    357 streakFilesUnlock(streakFiles *sf)
    358 {
    359     if (sf->inImage->inNebulous ) {
    360         // TODO: make the nebulous call to unlock the file
    361     }
    362     return true;
    363340}
    364341
     
    535512            return NULL;
    536513        }
    537         psMetadataAddStr(config->arguments, PS_LIST_TAIL, "MASK", 0,
     514        psMetadataAddStr(config->arguments, PS_LIST_TAIL, "INPUT.MASK", 0,
    538515                "name of input mask image", argv[argnum]);
    539516        psArgumentRemove(argnum, &argc, argv);
     
    547524            return NULL;
    548525        }
    549         psMetadataAddStr(config->arguments, PS_LIST_TAIL, "WEIGHT", 0,
     526        psMetadataAddStr(config->arguments, PS_LIST_TAIL, "INPUT.WEIGHT", 0,
    550527                "name of input weight image", argv[argnum]);
    551528        psArgumentRemove(argnum, &argc, argv);
     
    611588        streaksremoveExit("", PS_EXIT_DATA_ERROR);
    612589    }
     590
    613591   
    614592    // TODO: add keyword indicating that streaks have been removed
     
    895873readAndCopyToOutput(streakFiles *sf)
    896874{
     875    bool    updateAstrometry = false;
    897876    if (sf->inImage->pmfile) {
    898877        // image data from pmFPAfile (diff or warp file)
     
    909888    }
    910889    if (!sf->astrom) {
    911         psError(PS_ERR_UNKNOWN, false, "failed to set up astrometry for extnsion %d", sf->extnum);
     890        psError(PS_ERR_UNKNOWN, false, "failed to set up astrometry for extension %d", sf->extnum);
    912891        streaksremoveExit("", PS_EXIT_UNKNOWN_ERROR);
     892    }
     893    if (sf->stage == IPP_STAGE_CHIP) {
     894        // For the chip level files, copy the WCS from the astrometry file to the header
     895        updateAstrometry = true;
     896        if (!pmAstromWriteWCS(sf->inImage->header, sf->inAstrom->fpa, sf->chip, 0.001)) {
     897            psError(PS_ERR_UNKNOWN, false, "failed to update astrometry for extension %d", sf->extnum);
     898            streaksremoveExit("", PS_EXIT_UNKNOWN_ERROR);
     899        }
    913900    }
    914901    sf->outImage->header = (psMetadata*) psMemIncrRefCounter(sf->inImage->header);
     
    930917
    931918    // set up the compression parameters
    932 //    copyFitsOptions(sf->outImage, sf->recImage, sf->inImage);
     919    //  copyFitsOptions(sf->outImage, sf->recImage, sf->inImage);
    933920
    934921    // XXX: TODO: can we derive these values from the input header?
    935922    // psFitsCompressionGet(sf->inImage->image) gives compression none
    936923    // perhaps we should just use the definition of COMP_IMG in the configuration
    937 //    psFitsSetCompression(sf->outImage->fits, PS_FITS_COMPRESS_RICE, sf->tiles, 8, 0, 0);
     924    //    psFitsSetCompression(sf->outImage->fits, PS_FITS_COMPRESS_RICE, sf->tiles, 8, 0, 0);
     925
    938926    psFitsSetCompression(sf->recImage->fits, PS_FITS_COMPRESS_RICE, sf->tiles, 8, 0, 0);
    939927
     
    941929        readImage(sf->inMask, sf->extnum, sf->stage);
    942930        sf->outMask->header = (psMetadata*) psMemIncrRefCounter(sf->inMask->header);
     931        if (updateAstrometry) {
     932            pmAstromWriteWCS(sf->outMask->header, sf->inAstrom->fpa, sf->chip, 0.001);
     933        }
    943934        sf->outMask->image = (psImage*) psMemIncrRefCounter(sf->inMask->image);
    944935        sf->recMask->image = (psImage*) psMemIncrRefCounter(sf->inMask->image);
     
    955946        readImage(sf->inWeight, sf->extnum, sf->stage);
    956947        sf->outWeight->header = (psMetadata*) psMemIncrRefCounter(sf->inWeight->header);
     948        if (updateAstrometry) {
     949            pmAstromWriteWCS(sf->outWeight->header, sf->inAstrom->fpa, sf->chip, 0.001);
     950        }
    957951        sf->outWeight->image = (psImage*) psMemIncrRefCounter(sf->inWeight->image);
    958952
     
    14501444        computeWarpedPixels(sfiles);
    14511445    }
     1446   
    14521447
    14531448    if (sfiles->stage == IPP_STAGE_RAW) {
Note: See TracChangeset for help on using the changeset viewer.