IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27759


Ignore:
Timestamp:
Apr 23, 2010, 1:21:45 PM (16 years ago)
Author:
Paul Price
Message:

Fixing ppSubCopyPSF so it doesn't clobber the output analysis (which contains entries we need for the photometry, specifically SKY_STDEV from the background model). This is also much cleaner.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSub/src/ppSubMakePSF.c

    r27698 r27759  
    121121}
    122122
    123 bool ppSubCopyPSF (pmFPAfile *output, pmFPAfile *input, pmFPAview *view) {
    124 
     123bool ppSubCopyPSF(pmFPAfile *output, pmFPAfile *input, pmFPAview *view)
     124{
    125125    bool mdok = false;
    126126
     
    134134        pmCell *outputCell  = pmFPAviewThisCell(view, output->fpa);
    135135        outputRO = pmReadoutAlloc(outputCell);
    136         outputRO->image = psMemIncrRefCounter (inputRO->image);
     136        outputRO->image = psMemIncrRefCounter(inputRO->image);
    137137    }
    138138
    139     // copy the PSF-related data to PSPHOT.PSF.LOAD for safe-keeping
    140     psMetadata *psfRegions = psMetadataAlloc();
    141 
    142     int nRegions = psMetadataLookupS32 (&mdok, inputRO->analysis, "PSF.CLUMP.NREGIONS");
    143     if (!nRegions) {
    144         psErrorStackPrint(stderr, "No PSF available");
    145         return false;
     139    // Copy the PSF-related data
     140    psMetadataIterator *iter = psMetadataIteratorAlloc(inputRO->analysis, PS_LIST_HEAD, "^PSF\\.CLUMP.*");
     141    psMetadataItem *item;               // Item from iteration
     142    while ((item = psMetadataGetAndIncrement(iter))) {
     143        psMetadataAddItem(outputRO->analysis, item, PS_LIST_TAIL, PS_META_REPLACE);
    146144    }
    147     psMetadataAddS32 (psfRegions, PS_LIST_TAIL, "PSF.CLUMP.NREGIONS",  PS_META_REPLACE, "psf clump regions", nRegions);
    148 
    149     for (int i = 0; i < nRegions; i++) {
    150         char fieldName[80];
    151         snprintf (fieldName, 80, "PSF.CLUMP.REGION.%03d", i);
    152         psMetadata *regionMD = psMetadataLookupPtr (&mdok, inputRO->analysis, fieldName);
    153         if (!regionMD) {
    154             psWarning ("missing psf clump region metadata for entry %d", i);
    155             continue;
    156         }
    157         psMetadataAddMetadata (psfRegions, PS_LIST_TAIL, fieldName, PS_META_REPLACE, "psf clump region", regionMD);
    158     }
    159 
    160     // XXX why am I replacing the entire analysis MD?
    161     psFree(outputRO->analysis);
    162     outputRO->analysis = psfRegions;
     145    psFree(iter);
    163146
    164147    // copy the PSF model data
     
    169152    }
    170153
    171     psMetadataAddPtr(outputChip->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN | PS_META_REPLACE, "PSF from ppSubMakePSF", psf);
     154    psMetadataAddPtr(outputChip->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN | PS_META_REPLACE,
     155                     "PSF from ppSubMakePSF", psf);
    172156
    173157    return true;
Note: See TracChangeset for help on using the changeset viewer.