IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30006


Ignore:
Timestamp:
Dec 9, 2010, 3:08:33 PM (15 years ago)
Author:
eugene
Message:

update output headers with WCS; add mean PSF parameters 7 & 8 (if used) and model names to headers

Location:
branches/eam_branches/ipp-20101205/psphot
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20101205/psphot/doc/stack.txt

    r28013 r30006  
     1
     220101207
     3
     4  header fields for PSPS:
     5
     6  * stack needs to count # of inputs
     7  * propagate the input header to the output image (DONE)
     8  * save PSF parameters in header
     9  * stack type is only known to the launcher
     10
     11  * what are we doing for the stack calibrations??
     12
     13skycellID    : code
     14surveyID     : code
     15filterID     : code
     16stackMetaID  : stack_id
     17photoCalID   : photcode -> number
     18magSat       : FSATUR       saturation magnitude level ** not correctly set
     19completMag   : FLIMIT       95% completion level in mag ** not correctly set
     20stackTypeID  :              stack type identifier ** deep stack, nightly stack, best IQ stack?
     21refImageID   :              identifier of image used as reference for analysis
     22subtrImageID : N/A (stack)  identifier of image subtracted to generate difference image
     23analVer      :              analysis version index  ** index for tess_id + skycell_id + filter?
     24nP2Images    :              number of P2 images contributing to this cell ** missing from input stack
     25astroScat    :              astrometric scatter for chip ** measure scatter on stack creation?
     26photoScat    :              photometric scatter for chip ** internal scatter? 
     27nAstroRef    :              number of astrometric reference sources ** (connected to above)
     28nPhoRef      :              number of photometric reference sources ** same
     29psfFwhm      :              PSF full width at half maximum ** 0.5(FWHM_MAJ + FWHM_MIN)
     30psfmodelID   : * PSFMODEL   PSF model identifier ** save the PSF model name in the header
     31psfWidMajor  : * FWHM_MAJ     PSF parameters
     32psfWidMinor  : * FWHM_MIN     PSF parameters
     33psfTheta     : * ANGLE        PSF parameters
     34psfExtra1    : * PSF_EXT1   PSF parameters ** (at field center?)
     35psfExtra2    : * PSF_EXT2   PSF parameters ** (not set for all models)
     36photoZero    :              local derived photometric zero point
     37photoColor   :              local derived photometric color term
     38ctype1       : * CTYPE1             name of astrometric projection in RA ** propagate from input stacks
     39ctype2       : * CTYPE2             name of astrometric projection in DEC
     40crval1       : * CRVAL1             RA corresponding to reference pixel
     41crval2       : * CRVAL2             DEC corresponding to reference pixel
     42crpix1       : * CRPIX1             reference pixel value for RA
     43crpix2       : * CRPIX2             reference pixel value for DEC
     44cdelt1       : * CDELT1             scale factor for RA
     45cdelt2       : * CDELT2             scale factor for DEC
     46pc001001     : * PC001001           elements of rotation/Dcale matrix
     47pc001002     : * PC001002           elements of rotation/Dcale matrix
     48pc002001     : * PC002001           elements of rotation/Dcale matrix
     49pc002002     : * PC002002           elements of rotation/Dcale matrix
     50polyOrder    : * NPLYTERM           polynomial order of astrometry fit ** default to 1
     51pca1x3y0     : * PCA1X3Y0     polynomial coefficients for the astrometric fit
     52pca1x2y1     : * PCA1X2Y1     polynomial coefficients for the astrometric fit
     53pca1x1y2     : * PCA1X1Y2     polynomial coefficients for the astrometric fit
     54pca1x0y3     : * PCA1X0Y3     polynomial coefficients for the astrometric fit
     55pca1x2y0     : * PCA1X2Y0     polynomial coefficients for the astrometric fit
     56pca1x1y1     : * PCA1X1Y1     polynomial coefficients for the astrometric fit
     57pca1x0y2     : * PCA1X0Y2     polynomial coefficients for the astrometric fit
     58pca2x3y0     : * PCA2X3Y0     polynomial coefficients for the astrometric fit
     59pca2x2y1     : * PCA2X2Y1     polynomial coefficients for the astrometric fit
     60pca2x1y2     : * PCA2X1Y2     polynomial coefficients for the astrometric fit
     61pca2x0y3     : * PCA2X0Y3     polynomial coefficients for the astrometric fit
     62pca2x2y0     : * PCA2X2Y0     polynomial coefficients for the astrometric fit
     63pca2x1y1     : * PCA2X1Y1     polynomial coefficients for the astrometric fit
     64pca2x0y2     : * PCA2X0Y2     polynomial coefficients for the astrometric fit
     65calibModNum  :              calibration modification number
     66dataRelease  :              Data release
    167
    26820100506:
  • branches/eam_branches/ipp-20101205/psphot/src/psphotChoosePSF.c

    r29936 r30006  
    434434    psVector *fwhmMajor = psVectorAllocEmpty (100, PS_DATA_F32);
    435435    psVector *fwhmMinor = psVectorAllocEmpty (100, PS_DATA_F32);
     436    psVector *psfExtra1 = psVectorAllocEmpty (100, PS_DATA_F32);
     437    psVector *psfExtra2 = psVectorAllocEmpty (100, PS_DATA_F32);
    436438
    437439    for (float ix = -0.4; ix <= +0.4; ix += 0.1) {
     
    466468            psVectorAppend (fwhmMajor, FWHM_MAJOR);
    467469            psVectorAppend (fwhmMinor, FWHM_MINOR);
     470
     471            if (modelPSF->params->n >= 7) {
     472              psVectorAppend (psfExtra1, modelPSF->params->data.F32[7]);
     473            }
     474            if (modelPSF->params->n >= 8) {
     475              psVectorAppend (psfExtra2, modelPSF->params->data.F32[8]);
     476            }
    468477        }
    469478    }
     
    499508    }
    500509
     510    if (!psVectorStats (stats, psfExtra1, NULL, NULL, 0)) {
     511        psError(PS_ERR_UNKNOWN, false, "failure to measure stats for PSF EXTRA 1");
     512        return false;
     513    }
     514    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "PSF_EXT1", PS_META_REPLACE, "PSF extra param 1", stats->sampleMean);
     515
     516    if (!psVectorStats (stats, psfExtra2, NULL, NULL, 0)) {
     517        psError(PS_ERR_UNKNOWN, false, "failure to measure stats for PSF EXTRA 2");
     518        return false;
     519    }
     520    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "PSF_EXT2", PS_META_REPLACE, "PSF extra param 2", stats->sampleMean);
     521
    501522    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "ANGLE",    PS_META_REPLACE, "PSF angle",           axes.theta);
    502523    psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "NPSFSTAR", PS_META_REPLACE, "Number of stars used to make PSF", psf->nPSFstars);
    503     psMetadataAddBool(readout->analysis, PS_LIST_TAIL, "PSFMODEL", PS_META_REPLACE, "Valid PSF Model?", true);
     524
     525    char *psfModelName = pmModelClassGetName(psf->type);
     526    psMetadataAddStr(readout->analysis,  PS_LIST_TAIL, "PSFMODEL", PS_META_REPLACE, "PSF Model Name", psfModelName);
     527    psMetadataAddBool(readout->analysis, PS_LIST_TAIL, "PSF_OK",   PS_META_REPLACE, "Valid PSF Model?", true);
    504528
    505529    psFree (fwhmMajor);
     
    566590    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MN_LQ",   PS_META_REPLACE, "PSF FWHM Minor axis (lower quartile)", 0);
    567591    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "FW_MN_UQ",   PS_META_REPLACE, "PSF FWHM Minor axis (upper quartile)", 0);
    568     psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "ANGLE",    PS_META_REPLACE, "PSF angle",           FWHM_T);
    569     psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "NPSFSTAR", PS_META_REPLACE, "Number of stars used to make PSF", 0);
    570     psMetadataAddBool(readout->analysis, PS_LIST_TAIL, "PSFMODEL", PS_META_REPLACE, "Valid PSF Model?", false);
     592    psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "ANGLE",      PS_META_REPLACE, "PSF angle",           FWHM_T);
     593    psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "NPSFSTAR",   PS_META_REPLACE, "Number of stars used to make PSF", 0);
     594    psMetadataAddStr(readout->analysis,  PS_LIST_TAIL, "PSFMODEL",   PS_META_REPLACE, "PSF Model Name", "NONE");
     595    psMetadataAddBool(readout->analysis, PS_LIST_TAIL, "PSF_OK",     PS_META_REPLACE, "Valid PSF Model?", false);
    571596
    572597    return true;
  • branches/eam_branches/ipp-20101205/psphot/src/psphotOutput.c

    r29936 r30006  
    261261    psMetadataItemSupplement (&status, header, analysis, "ANGLE");
    262262
     263    psMetadataItemSupplement (&status, header, analysis, "PSFMODEL");
     264    psMetadataItemSupplement (&status, header, analysis, "PSF_OK");
     265
    263266    // Image Quality measurements
    264267    psMetadataItemSupplement (&status, header, analysis, "IQ_NSTAR");
  • branches/eam_branches/ipp-20101205/psphot/src/psphotStackArguments.c

    r28013 r30006  
    4141    if ((N = psArgumentGet (argc, argv, "-break"))) {
    4242        if (argc <= N+1) {
    43           psErrorStackPrint(stderr, "Expected to see 1 more argument; saw %d", argc - 1);
     43          psErrorStackPrint(stderr, "Expected to see an argument for -break");
    4444          exit(PS_EXIT_CONFIG_ERROR);
    4545        }
  • branches/eam_branches/ipp-20101205/psphot/src/psphotStackImageLoop.c

    r29936 r30006  
    101101*/
    102102
    103 # define UPDATE_HEADER 0
     103# define UPDATE_HEADER 1
    104104
    105105bool GetAstrometryFPA (pmConfig *config, pmFPAview *view) {
     
    174174        pmChip *outChip = pmFPAviewThisChip(view, output->fpa); ///< Chip in the output
    175175
    176 # if (UPDATE_HEADER)
    177176        pmHDU *outHDU = pmFPAviewThisHDU (view, output->fpa);
    178177        if (!outHDU) {
    179             pmFPAAddSourceFromView(output->fpa, "name", view, output->format);
     178            pmFPAAddSourceFromView(output->fpa, view, output->format);
    180179            outHDU = pmFPAviewThisHDU (view, output->fpa);
    181180            psAssert (outHDU, "failed to make HDU");
    182181        }
    183 # endif
     182        if (!outHDU->header) {
     183          outHDU->header = psMetadataAlloc();
     184        }
    184185
    185186        if (bilevelAstrometry) {
     
    188189                continue;
    189190            }
    190 # if (UPDATE_HEADER)
    191191            if (!pmAstromWriteBilevelChip(outHDU->header, outChip, WCS_NONLIN_TOL)) {
    192192                psWarning("Unable to generate WCS header.");
    193193                continue;
    194194            }
    195 # endif
    196195        } else {
    197196            // we use a default FPA pixel scale of 1.0
     
    200199                continue;
    201200            }
    202 # if (UPDATE_HEADER)
    203             if (UPDATE_HEADER && !pmAstromWriteWCS(outHDU->header, output->fpa, outChip, WCS_NONLIN_TOL)) {
     201            if (!pmAstromWriteWCS(outHDU->header, output->fpa, outChip, WCS_NONLIN_TOL)) {
    204202                psWarning("Unable to generate WCS header.");
    205203                continue;
    206204            }
    207 # endif
    208205        }
    209206    }
     
    225222        psAssert (output, "missing file?");
    226223
    227 # if (UPDATE_HEADER)
    228224        pmHDU *PHU = pmFPAviewThisPHU(view, output->fpa);
    229225        if (!PHU) {
    230             pmFPAAddSourceFromView(output->fpa, "name", view, output->format);
     226            pmFPAAddSourceFromView(output->fpa, view, output->format);
    231227            PHU = pmFPAviewThisPHU (view, output->fpa);
    232228            psAssert (PHU, "failed to make PHU");
    233229        }
     230        if (!PHU->header) {
     231          PHU->header = psMetadataAlloc();
     232        }
    234233
    235234        if (!pmAstromWriteBilevelMosaic(PHU->header, output->fpa, WCS_NONLIN_TOL)) {
    236235            psWarning("Unable to generate WCS header.");
    237236        }
    238 # endif
    239237    }
    240238
  • branches/eam_branches/ipp-20101205/psphot/src/psphotStackMatchPSFs.c

    r29936 r30006  
    6565bool psphotStackMatchPSFsReadout (pmConfig *config, const pmFPAview *view, psphotStackOptions *options, int index) {
    6666
     67    psImageMaskType maskValue;
     68    psImageMaskType markValue;
     69
     70    // get the PSPHOT.MASK value from the config
     71    if (!pmConfigMaskSetBits (&maskValue, &markValue, config)) {
     72        psError (PS_ERR_UNKNOWN, true, "Unable to define the mask bit values");
     73        return false;
     74    }
     75
    6776    pmFPAfile *fileSrc = psphotStackGetConvolveSource(config, options, index);
    6877    if (!fileSrc) {
     
    8493
    8594    // set NAN pixels to 'SAT'
    86     // XXX replace this is pmReadoutMaskInvalid?
    87     psImageMaskType maskVal = pmConfigMaskGet("SAT", config);
    88     if (!pmReadoutMaskNonfinite(readoutSrc, maskVal)) {
     95    psImageMaskType maskSat = pmConfigMaskGet("SAT", config);
     96    if (!pmReadoutMaskInvalid(readoutSrc, maskValue, maskSat)) {
    8997        psError(psErrorCodeLast(), false, "Unable to mask non-finite pixels in readout.");
    9098        return false;
     
    95103        matchKernel(config, readoutOut, readoutSrc, options, index);
    96104        saveMatchData(readoutOut, options, index);
    97         // renormKernel(readoutCnv, options, index);
    98     } else {
    99         // only match the flux (NO! not for multi-filter, at least!)
    100         // XXX do not generate readoutCnv in this case?
    101         // float norm = powf(10.0, -0.4 * options->norm->data.F32[index]); // Normalisation
    102         // psBinaryOp(readoutRaw->image, readoutRaw->image, "*", psScalarAlloc(norm, PS_TYPE_F32));
    103         // psBinaryOp(readoutRaw->variance, readoutRaw->variance, "*", psScalarAlloc(PS_SQR(norm), PS_TYPE_F32));
    104105    }
    105 
    106106    rescaleData(readoutOut, config, options, index);
    107107
     
    110110    return true;
    111111}
    112 
    113 
    114 # if (0)
    115 // Read previously produced kernel
    116 if (psMetadataLookupBool(NULL, config->arguments, "PPSTACK.DEBUG.STACK")) {
    117     loadKernel(config, readoutCnv, options, index);
    118 } else {
    119     matchKernel(config, readoutCnv, readoutRaw, options, index);
    120 }
    121 # endif
Note: See TracChangeset for help on using the changeset viewer.