IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 21252


Ignore:
Timestamp:
Feb 1, 2009, 11:49:46 AM (17 years ago)
Author:
eugene
Message:

allow background model to be undefined (sky & skyErr go to NAN)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotMagnitudes.c

    r21183 r21252  
    1919    // nThreads = 0; // XXX until testing is complete, do not thread this function
    2020
     21    // if backModel or backStdev are missing, the values of sky and/or skyErr will be set to NAN
    2122    pmReadout *backModel = psphotSelectBackground (config, view);
    2223    pmReadout *backStdev = psphotSelectBackgroundStdev (config, view);
    23 
    24     // XXX require that we have a background model, or
    25     // allow it to be missing, setting local sky to 0.0?
    26     PS_ASSERT (backModel, false);
    27     PS_ASSERT (backStdev, false);
    2824
    2925    // bit-masks to test for good/bad pixels
     
    4238    // the binning details are saved on the analysis metadata
    4339    psImageBinning *binning = psMetadataLookupPtr(&status, recipe, "PSPHOT.BACKGROUND.BINNING");
    44     PS_ASSERT (status, false);
    4540
    4641    bool IGNORE_GROWTH = psMetadataLookupBool (&status, recipe, "IGNORE_GROWTH");
     
    128123        if (status && isfinite(source->apMag)) Nap ++;
    129124
    130         source->sky = psImageUnbinPixel(source->peak->x, source->peak->y, backModel->image, binning);
    131         if (isnan(source->sky) && false) {
    132             psLogMsg ("psphot.magnitudes", PS_LOG_DETAIL, "error setting pmSource.sky");
    133         }
     125        if (backModel) {
     126            psAssert (binning, "if backModel is defined, so should binning be");
     127            source->sky = psImageUnbinPixel(source->peak->x, source->peak->y, backModel->image, binning);
     128            if (isnan(source->sky) && false) {
     129                psLogMsg ("psphot.magnitudes", PS_LOG_DETAIL, "error setting pmSource.sky");
     130            }
     131        } else {
     132            source->sky = NAN;
     133        }
    134134
    135         source->skyErr = psImageUnbinPixel(source->peak->x, source->peak->y, backStdev->image, binning);
    136         if (isnan(source->skyErr) && false) {
    137             psLogMsg ("psphot.magnitudes", PS_LOG_DETAIL, "error setting pmSource.skyErr");
    138         }
     135        if (backStdev) {
     136            psAssert (binning, "if backStdev is defined, so should binning be");
     137            source->skyErr = psImageUnbinPixel(source->peak->x, source->peak->y, backStdev->image, binning);
     138            if (isnan(source->skyErr) && false) {
     139                psLogMsg ("psphot.magnitudes", PS_LOG_DETAIL, "error setting pmSource.skyErr");
     140            }
     141        } else {
     142            source->skyErr = NAN;
     143        }
    139144    }
    140145
Note: See TracChangeset for help on using the changeset viewer.