IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 6, 2011, 1:56:22 PM (15 years ago)
Author:
watersc1
Message:

merge from trunk before working on new stacking code

Location:
branches/czw_branch/20110406
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20110406

  • branches/czw_branch/20110406/psphot

  • branches/czw_branch/20110406/psphot/src/psphotMagnitudes.c

    r31154 r31606  
    167167        pmSource *source = (pmSource *) sources->data[i];
    168168
     169        bool saveTest = false;
     170        psImage *testImage = NULL;
     171# if (0)
     172        if ((fabs(source->peak->xf-3518) < 5) && (fabs(source->peak->yf-3178) < 5)) {
     173            saveTest = true;
     174            psRegion subregion = psRegionSet (source->peak->xf - 200, source->peak->xf + 200, source->peak->yf - 200, source->peak->yf + 200);
     175            testImage = psImageSubset ((psImage *) source->pixels->parent, subregion);
     176        }
     177# endif
     178
     179        if (saveTest) {
     180            psphotSaveImage(NULL, testImage, "test.image.1.fits");
     181        }
     182
    169183        // replace object in image
    170184        if (source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED) {
     
    172186        }
    173187
     188        if (saveTest) {
     189            psphotSaveImage(NULL, testImage, "test.image.2.fits");
     190        }
     191
     192        float xPos = source->peak->xf;
     193        float yPos = source->peak->yf;
     194
     195        pmModel *model = source->modelPSF;
     196        if (model) {
     197            xPos = model->params->data.F32[PM_PAR_XPOS];
     198            yPos = model->params->data.F32[PM_PAR_YPOS];
     199        } else {
     200            bool useMoments = pmSourcePositionUseMoments(source);
     201            if (useMoments) {
     202                xPos = source->moments->Mx;
     203                yPos = source->moments->My;
     204            }
     205        }
     206
    174207        // clear the mask bit and set the circular mask pixels
    175208        psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal));
    176         psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, source->apRadius, "OR", markVal);
     209        psImageKeepCircle (source->maskObj, xPos, yPos, source->apRadius, "OR", markVal);
    177210
    178211        status = pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, source->apRadius);
    179         if (status && isfinite(source->apMag)) Nap ++;
     212        if (status && isfinite(source->apFlux)) {
     213            Nap ++;
     214        } else {
     215            fprintf (stderr, "failed to measure mag for source @ %f,%f\n", source->peak->xf, source->peak->yf);
     216        }
    180217
    181218        // clear the mask bit
     
    185222        pmSourceSub (source, PM_MODEL_OP_FULL, maskVal);
    186223
     224        if (saveTest) {
     225            psphotSaveImage(NULL, testImage, "test.image.3.fits");
     226        }
     227
    187228        if (backModel) {
    188229            psAssert (binning, "if backModel is defined, so should binning be");
    189             source->sky = psImageUnbinPixel(source->peak->x, source->peak->y, backModel->image, binning);
     230            source->sky = psImageUnbinPixel(xPos, yPos, backModel->image, binning);
    190231            if (isnan(source->sky) && false) {
    191232                psLogMsg ("psphot.magnitudes", PS_LOG_DETAIL, "error setting pmSource.sky");
     
    197238        if (backStdev) {
    198239            psAssert (binning, "if backStdev is defined, so should binning be");
    199             source->skyErr = psImageUnbinPixel(source->peak->x, source->peak->y, backStdev->image, binning);
     240            source->skyErr = psImageUnbinPixel(xPos, yPos, backStdev->image, binning);
    200241            if (isnan(source->skyErr) && false) {
    201242                psLogMsg ("psphot.magnitudes", PS_LOG_DETAIL, "error setting pmSource.skyErr");
Note: See TracChangeset for help on using the changeset viewer.