IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42947


Ignore:
Timestamp:
Dec 1, 2025, 3:27:15 PM (5 months ago)
Author:
tdeboer
Message:

adding changes to pswarp to propagate skycell and ZPT keywords

Location:
trunk/pswarp/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/src/pswarp.h

    r41705 r42947  
    199199pswarpBounds *pswarpBoundsAlloc();
    200200
    201 bool pswarpLoadAstrometry (pmFPAfile *target, pmFPAfile *astrom, pmConfig *config);
     201bool pswarpLoadAstrometry (pmFPAfile *target, pmFPAfile *astrom, pmConfig *config, float *zptObs, float *zptErr);
    202202
    203203bool pswarpTransformToTarget (pmFPA *output, pmReadout *input, pmConfig *config, bool backgroundWarp);
  • trunk/pswarp/src/pswarpArguments.c

    r35563 r42947  
    2121    fprintf(stderr, "    [-mask mask.fits] : provide a corresponding mask image\n");
    2222    fprintf(stderr, "    [-variance variance.fits] : provide a corresponding variance image\n");
     23    fprintf(stderr, "    [-skycell_id skycell_id] : input skycell_id\n");
    2324    psErrorStackPrint(stderr, "\n");
    2425    exit(PS_EXIT_CONFIG_ERROR);
     
    7677        psMetadataAddStr(config->arguments, PS_LIST_TAIL, "STATS", PS_DATA_STRING,
    7778                         "Filename for statistics of output image", argv[N]);
     79        psArgumentRemove(N, &argc, argv);
     80    }
     81    // Skycell id
     82    if ((N = psArgumentGet(argc, argv, "-skycell_id"))) {
     83        psArgumentRemove(N, &argc, argv);
     84        psMetadataAddStr(config->arguments, PS_LIST_TAIL, "SKYCELL_ID", PS_DATA_STRING,
     85                         "Skycell_id to use", argv[N]);
    7886        psArgumentRemove(N, &argc, argv);
    7987    }
  • trunk/pswarp/src/pswarpDefineLayout.c

    r41526 r42947  
    1111# include "pswarp.h"
    1212
    13 bool pswarpGenerateOutputCell (pmChip *chip, pmCell *cell, pmCell *refcell, float xBin, float yBin);
     13bool pswarpGenerateOutputCell (pmChip *chip, pmCell *cell, pmCell *refcell, float xBin, float yBin, float zptObs, float zptErr);
    1414
    1515// load the astrometry header info and generate the tranformations
     
    1717
    1818    bool status = false;
     19    float zptObs = 0.;
     20    float zptErr = 0.;
    1921
    2022    pmFPAfile *output = psMetadataLookupPtr(&status, config->files, "PSWARP.OUTPUT");
     
    2931        return false;
    3032    }
    31     if (!pswarpLoadAstrometry (output, skycell, config)) {
     33    if (!pswarpLoadAstrometry (output, skycell, config,&zptObs,&zptErr)) {
    3234        psError(PSWARP_ERR_CONFIG, false, "problem loading output astrometry\n");
    3335        return false;
    3436    }
     37
    3538
    3639    // if a background model is supplied and the output is requested, then
     
    6871            return false;
    6972        }
    70         if (!pswarpLoadAstrometry (input, astrom, config)) {
     73        if (!pswarpLoadAstrometry (input, astrom, config,&zptObs,&zptErr)) {
    7174            psError(PSWARP_ERR_CONFIG, false, "problem loading input astrometry\n");
    7275            return false;
     
    126129            pmCell *refcell = pmFPAviewThisCell(view, skycell->fpa); ///< Target cell
    127130
    128             if (!pswarpGenerateOutputCell (chip, cell, refcell, output->xBin, output->yBin)){
     131            if (!pswarpGenerateOutputCell (chip, cell, refcell, output->xBin, output->yBin,zptObs,zptErr)){
    129132                psError(PSWARP_ERR_DATA, false, "failed to generate output cell");
    130133                psFree(view);
    131134                return false;
    132135            }
     136           
     137            //also output the skycell id
     138            char *skycell_id = psMetadataLookupStr(&status, config->arguments, "SKYCELL_ID");
     139            pmHDU *outHDU = pmHDUFromCell (cell);           ///< HDU for the output warped image
     140            psMetadataAddStr (outHDU->header, PS_LIST_TAIL, "SKYCELL_ID", PS_META_REPLACE, "skycell_id",  skycell_id);
    133141
    134142            if (bkgModel) {
    135143                pmChip *bkgChip = pmFPAviewThisChip(view, bkgModel->fpa); ///< Target cell
    136144                pmCell *bkgCell = pmFPAviewThisCell(view, bkgModel->fpa); ///< Target cell
    137                 if (!pswarpGenerateOutputCell (bkgChip, bkgCell, refcell, bkgModel->xBin, bkgModel->yBin)) {
     145                if (!pswarpGenerateOutputCell (bkgChip, bkgCell, refcell, bkgModel->xBin, bkgModel->yBin,zptObs,zptErr)) {
    138146                    psError(PSWARP_ERR_DATA, false, "failed to generate output cell");
    139147                    psFree(view);
     
    152160}
    153161
    154 bool pswarpGenerateOutputCell (pmChip *chip, pmCell *cell, pmCell *refcell, float xBin, float yBin) {
     162bool pswarpGenerateOutputCell (pmChip *chip, pmCell *cell, pmCell *refcell, float xBin, float yBin, float zptObs, float zptErr) {
    155163
    156164    bool status = false;
     
    197205    pmHDU *outHDU = pmHDUFromCell (cell);           ///< HDU for the output warped image
    198206    outHDU->header = psMetadataCopy(outHDU->header, hdu->header);
     207
     208    psMetadataAddF32 (outHDU->header, PS_LIST_TAIL, "ZPT_OBS", PS_META_REPLACE, "measured zero point",  zptObs);
     209    psMetadataAddF32 (outHDU->header, PS_LIST_TAIL, "ZPT_ERR", PS_META_REPLACE, "error on zero point",  zptErr);
    199210    pswarpVersionHeader(outHDU->header);
    200211    return true;
  • trunk/pswarp/src/pswarpLoadAstrometry.c

    r41897 r42947  
    1414// WCS and read the headers.  We place the resulting info on the target astrometry
    1515// containers
    16 bool pswarpLoadAstrometry (pmFPAfile *target, pmFPAfile *astrom, pmConfig *config) {
     16bool pswarpLoadAstrometry (pmFPAfile *target, pmFPAfile *astrom, pmConfig *config, float *zptObs,float *zptErr) {
    1717
    1818    pmChip *chip = NULL;
     
    126126            return false;
    127127        }
     128        *zptObs = psMetadataLookupF32 (NULL, hdu->header, "ZPT_OBS");
     129        *zptErr = psMetadataLookupF32 (NULL, hdu->header, "ZPT_ERR");
    128130
    129131        if (bilevelAstrometry) {
Note: See TracChangeset for help on using the changeset viewer.