IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 21, 2010, 3:01:12 PM (16 years ago)
Author:
eugene
Message:

for psf-matched images: re-determine the psf; re-generate the models with the new psf; re-fit the fluxes; subtract all sources; as radial aperture fluxes are measured only replace the current source of interest; replace all sources before convolving to the next psf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20101205/psphot/src/psphotStackMatchPSFsNext.c

    r30101 r30141  
    2626    }
    2727
    28     float targetFWHM = fwhmValues->data.F32[lastSize + 1];
    29     float currentFWHM = fwhmValues->data.F32[lastSize];
    30 
    3128    int num = psphotFileruleCount(config, filerule);
    3229
     
    3633    // loop over the available readouts
    3734    for (int i = 0; i < num; i++) {
    38         if (!psphotStackMatchPSFsNextReadout (config, view, filerule, i, recipe, currentFWHM, targetFWHM)) {
    39             psError (PSPHOT_ERR_CONFIG, false, "failed to smooth image %s (%d) to target PSF %f", filerule, i, targetFWHM);
     35        if (!psphotStackMatchPSFsNextReadout (config, view, filerule, i, recipe, fwhmValues, lastSize)) {
     36            psError (PSPHOT_ERR_CONFIG, false, "failed to smooth image %s (%d) to target PSF %f", filerule, i, fwhmValues->data.F32[lastSize+1]);
    4037            psImageConvolveSetThreads(oldThreads);
    4138            return false;
     
    4744}
    4845
    49 bool psphotStackMatchPSFsNextReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, float currentFWHM, float targetFWHM) {
     46bool psphotStackMatchPSFsNextReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, psVector *fwhmValues, int lastSize) {
    5047
    5148    bool status = false;
     
    7067        minGauss = 0.5;
    7168    }
     69
     70    float targetFWHM = fwhmValues->data.F32[lastSize + 1];
     71    float currentFWHM = fwhmValues->data.F32[lastSize];
    7272
    7373    if (targetFWHM <= currentFWHM) {
     
    131131    // so we save this in a vector.  if the vector is not yet defined, create it
    132132
    133     psVector *fwhmValues = psMetadataLookupVector(&status, readout->analysis, "STACK.PSF.FWHM.VALUES");
    134     psAssert(fwhmValues, "should already exist..");
    135     psVectorAppend(fwhmValues, targetFWHM);
     133    psVector *fwhmValuesOut = psMetadataLookupVector(&status, readout->analysis, "STACK.PSF.FWHM.VALUES");
     134    psAssert(fwhmValuesOut, "should already exist..");
     135    psVectorAppend(fwhmValuesOut, targetFWHM);
     136
     137    // do not generate a PSF if we already were supplied one
     138    pmPSF *psfOld = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.PSF");
     139    if (psfOld) {
     140        // save PSF on readout->analysis
     141        char psfEntry[64];
     142        snprintf (psfEntry, 64, "PSPHOT.PSF.V%d", lastSize);
     143        if (!psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, psfEntry, PS_META_REPLACE | PS_DATA_UNKNOWN, "psphot psf model", psfOld)) {
     144            psError (PSPHOT_ERR_UNKNOWN, false, "problem saving sources on readout");
     145            return false;
     146        }
     147        psMetadataRemoveKey(readout->analysis, "PSPHOT.PSF");
     148    }
    136149
    137150    return true;
Note: See TracChangeset for help on using the changeset viewer.