IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 29, 2012, 4:55:13 PM (14 years ago)
Author:
eugene
Message:

add MODEL_VAR option to weighting scheme

Location:
branches/eam_branches/ipp-20120405/psModules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120405/psModules

  • branches/eam_branches/ipp-20120405/psModules/src/objects/pmSource.c

    r33690 r33947  
    5050    psFree(tmp->pixels);
    5151    psFree(tmp->variance);
     52    psFree(tmp->modelVar);
    5253    psFree(tmp->maskObj);
    5354    psFree(tmp->maskView);
     
    7677    psFree (source->pixels);
    7778    psFree (source->variance);
     79    psFree (source->modelVar);
    7880    psFree (source->maskObj);
    7981    psFree (source->maskView);
     
    8385    source->pixels = NULL;
    8486    source->variance = NULL;
     87    source->modelVar = NULL;
    8588    source->maskObj = NULL;
    8689    source->maskView = NULL;
     
    112115    source->pixels = NULL;
    113116    source->variance = NULL;
     117    source->modelVar = NULL;
    114118    source->maskObj = NULL;
    115119    source->maskView = NULL;
     
    198202    source->pixels   = in->pixels   ? psImageCopyView(NULL, in->pixels)   : NULL;
    199203    source->variance = in->variance ? psImageCopyView(NULL, in->variance) : NULL;
     204    source->modelVar = NULL;
    200205    source->maskView = in->maskView ? psImageCopyView(NULL, in->maskView) : NULL;
    201206
     
    10261031
    10271032    bool addNoise = mode & PM_MODEL_OP_NOISE;
     1033    bool addModelVar = mode & PM_MODEL_OP_MODELVAR;
     1034
     1035    if (addModelVar) psAssert (source->modelVar, "programming error");
    10281036
    10291037    // require the use of pmModelAddWithOffset if we are adding noise (because the model size and norm are rescaled)
     
    10481056        }
    10491057
    1050         psF32 **target = source->pixels->data.F32;
     1058        psF32 **target = addModelVar ? source->modelVar->data.F32 : source->pixels->data.F32;
    10511059
    10521060        for (int iy = 0; iy < source->modelFlux->numRows; iy++) {
     
    10631071            }
    10641072        }
    1065         if (add) {
    1066             source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
    1067         } else {
    1068             source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
     1073        if (!addModelVar) {
     1074            if (add) {
     1075                source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
     1076            } else {
     1077                source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
     1078            }
    10691079        }
    10701080        return true;
     
    10751085        target = source->variance;
    10761086    }
     1087    if (addModelVar) {
     1088        target = source->modelVar;
     1089    }
    10771090
    10781091    if (add) {
    10791092        status = pmModelAddWithOffset (target, source->maskObj, model, PM_MODEL_OP_FULL, maskVal, dx, dy);
    1080         source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
     1093        if (!addNoise && !addModelVar) source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
    10811094    } else {
    10821095        status = pmModelSubWithOffset (target, source->maskObj, model, PM_MODEL_OP_FULL, maskVal, dx, dy);
    1083         source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
     1096        if (!addNoise && !addModelVar) source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
    10841097    }
    10851098
Note: See TracChangeset for help on using the changeset viewer.