IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 11, 2012, 6:56:47 AM (15 years ago)
Author:
eugene
Message:

adding MODEL_VAR option for psf-fit weighting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/psModules/src/objects/pmSource.c

    r32695 r33085  
    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;
     
    197201    source->pixels   = in->pixels   ? psImageCopyView(NULL, in->pixels)   : NULL;
    198202    source->variance = in->variance ? psImageCopyView(NULL, in->variance) : NULL;
     203    source->modelVar = in->modelVar ? psImageCopyView(NULL, in->modelVar) : NULL;
    199204    source->maskView = in->maskView ? psImageCopyView(NULL, in->maskView) : NULL;
    200205
     
    10251030
    10261031    bool addNoise = mode & PM_MODEL_OP_NOISE;
     1032    bool addModelVar = mode & PM_MODEL_OP_MODELVAR;
     1033
     1034    if (addModelVar) psAssert (source->modelVar, "programming error");
    10271035
    10281036    // require the use of pmModelAddWithOffset if we are adding noise (because the model size and norm are rescaled)
     
    10471055        }
    10481056
    1049         psF32 **target = source->pixels->data.F32;
     1057        psF32 **target = addModelVar ? source->modelVar->data.F32 : source->pixels->data.F32;
    10501058
    10511059        for (int iy = 0; iy < source->modelFlux->numRows; iy++) {
     
    10621070            }
    10631071        }
    1064         if (add) {
    1065             source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
    1066         } else {
    1067             source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
     1072        if (!addModelVar) {
     1073            if (add) {
     1074                source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
     1075            } else {
     1076                source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
     1077            }
    10681078        }
    10691079        return true;
     
    10741084        target = source->variance;
    10751085    }
     1086    if (addModelVar) {
     1087        target = source->modelVar;
     1088    }
    10761089
    10771090    if (add) {
    10781091        status = pmModelAddWithOffset (target, source->maskObj, model, PM_MODEL_OP_FULL, maskVal, dx, dy);
    1079         source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
     1092        if (!addNoise && !addModelVar) source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
    10801093    } else {
    10811094        status = pmModelSubWithOffset (target, source->maskObj, model, PM_MODEL_OP_FULL, maskVal, dx, dy);
    1082         source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
     1095        if (!addNoise && !addModelVar) source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
    10831096    }
    10841097
Note: See TracChangeset for help on using the changeset viewer.