IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10477


Ignore:
Timestamp:
Dec 5, 2006, 10:30:01 AM (20 years ago)
Author:
Paul Price
Message:

Adding metadata to header.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmReadoutCombine.c

    r10248 r10477  
    99
    1010#include "pmFPA.h"
     11#include "pmHDUUtils.h"
    1112#include "pmFPAMaskWeight.h"
    1213#include "pmConceptsAverage.h"
     
    6465    }
    6566
     67    bool first = !output->image || (output->row0 == 0 && output->col0 == 0); // First pass through?
     68
     69    pmHDU *hdu = pmHDUFromReadout(output); // Output HDU
     70    if (!hdu) {
     71        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find HDU for readout.\n");
     72        return false;
     73    }
     74
     75    if (first) {
     76        psString comment = NULL;        // Comment to add to header
     77        psStringAppend(&comment, "Combining using statistic: %x", params->combine);
     78        psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, comment, "");
     79        psFree(comment);
     80    }
     81
    6682    psStats *stats = psStatsAlloc(params->combine); // The statistics to use in the combination
    6783    if (params->combine == PS_STAT_CLIPPED_MEAN) {
    6884        stats->clipSigma = params->rej;
    6985        stats->clipIter = params->iter;
     86
     87        if (first) {
     88            psString comment = NULL;    // Comment to add to header
     89            psStringAppend(&comment, "Combination clipping: %d iter, %f rej", params->iter, params->rej);
     90            psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, comment, "");
     91            psFree(comment);
     92        }
    7093    }
    7194
     
    165188            psFree(output->weight);
    166189            output->weight = newWeight;
     190        }
     191
     192        if (first) {
     193            psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK,
     194                             "Using input weights to combine images", "");
    167195        }
    168196
     
    210238
    211239    float keepFrac = 1.0 - params->fracLow - params->fracHigh; // Fraction of pixels to keep
     240    if (keepFrac != 1.0 && first) {
     241        psString comment = NULL;        // Comment to add to header
     242        psStringAppend(&comment, "Min/max rejection: %f high, %f low, keep %d",
     243                       params->fracHigh, params->fracLow, params->nKeep);
     244        psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, comment, "");
     245        psFree(comment);
     246    }
     247
    212248    psMaskType maskVal = params->maskVal; // The mask value
     249    if (maskVal && first) {
     250        psString comment = NULL;        // Comment to add to header
     251        psStringAppend(&comment, "Mask for combination: %x", maskVal);
     252        psMetadataAddStr(hdu->header, PS_LIST_TAIL, "HISTORY", PS_META_DUPLICATE_OK, comment, "");
     253        psFree(comment);
     254    }
    213255
    214256    #ifndef PS_NO_TRACE
    215 
    216257    psTrace("psModules.imcombine", 3, "Iterating output: %d --> %d, %d --> %d\n",
    217258            minInputCols - output->col0, maxInputCols - output->col0,
Note: See TracChangeset for help on using the changeset viewer.