IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 27, 2009, 10:23:42 AM (17 years ago)
Author:
eugene
Message:

adding or subtracting the source sets / unsets PM_SOURCE_TMPF_SUBTRACTED

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090715/psModules/src/objects/pmSource.c

    r25354 r25588  
    933933    if (model == NULL) return false;  // model must be defined
    934934
     935    bool addNoise = mode & PM_MODEL_OP_NOISE;
     936
    935937    if (source->modelFlux) {
    936938        // add in the pixels from the modelFlux image
     
    954956
    955957        psF32 **target = source->pixels->data.F32;
    956         if (mode & PM_MODEL_OP_NOISE) {
    957             // XXX need to scale by the gain...
     958        if (addNoise) {
     959            // when adding noise, we assume the shape and Io have been modified
    958960            target = source->variance->data.F32;
    959961        }
    960962
    961         // XXX need to respect the source and model masks?
    962963        for (int iy = 0; iy < source->modelFlux->numRows; iy++) {
    963964            int oy = iy + dY;
     
    973974            }
    974975        }
     976        if (!addNoise) {
     977            if (add) {
     978                source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
     979            } else {
     980                source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
     981            }
     982        }
    975983        return true;
    976984    }
    977985
    978986    psImage *target = source->pixels;
    979     if (mode & PM_MODEL_OP_NOISE) {
     987    if (addNoise) {
    980988        target = source->variance;
    981989    }
    982990
    983     if (add) {
    984         status = pmModelAddWithOffset (target, source->maskObj, model, PM_MODEL_OP_FULL, maskVal, dx, dy);
    985     } else {
    986         status = pmModelSubWithOffset (target, source->maskObj, model, PM_MODEL_OP_FULL, maskVal, dx, dy);
     991    if (!addNoise) {
     992        if (add) {
     993            status = pmModelAddWithOffset (target, source->maskObj, model, PM_MODEL_OP_FULL, maskVal, dx, dy);
     994            source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
     995        } else {
     996            status = pmModelSubWithOffset (target, source->maskObj, model, PM_MODEL_OP_FULL, maskVal, dx, dy);
     997            source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
     998        }
    987999    }
    9881000
Note: See TracChangeset for help on using the changeset viewer.