IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 26, 2012, 11:31:38 AM (14 years ago)
Author:
eugene
Message:

re-enable MODEL_VAR option for linear photometry fit

Location:
trunk/psModules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules

  • trunk/psModules/src/objects/pmSource.c

    r33993 r34085  
    5151    psFree(tmp->pixels);
    5252    psFree(tmp->variance);
    53 # if (HAVE_MODEL_VAR)
    5453    psFree(tmp->modelVar);
    55 # endif
    5654    psFree(tmp->maskObj);
    5755    psFree(tmp->maskView);
     
    8078    psFree (source->pixels);
    8179    psFree (source->variance);
    82 # if (HAVE_MODEL_VAR)
    8380    psFree (source->modelVar);
    84 # endif
    8581    psFree (source->maskObj);
    8682    psFree (source->maskView);
     
    9086    source->pixels = NULL;
    9187    source->variance = NULL;
    92 # if (HAVE_MODEL_VAR)
    9388    source->modelVar = NULL;
    94 # endif
    9589    source->maskObj = NULL;
    9690    source->maskView = NULL;
     
    122116    source->pixels = NULL;
    123117    source->variance = NULL;
    124 # if (HAVE_MODEL_VAR)
    125118    source->modelVar = NULL;
    126 # endif
    127119    source->maskObj = NULL;
    128120    source->maskView = NULL;
     
    212204    source->pixels   = in->pixels   ? psImageCopyView(NULL, in->pixels)   : NULL;
    213205    source->variance = in->variance ? psImageCopyView(NULL, in->variance) : NULL;
    214 # if (HAVE_MODEL_VAR)
    215206    source->modelVar = NULL;
    216 # endif
    217207    source->maskView = in->maskView ? psImageCopyView(NULL, in->maskView) : NULL;
    218208
     
    10441034    bool addNoise = mode & PM_MODEL_OP_NOISE;
    10451035
    1046 # if (HAVE_MODEL_VAR)
    10471036    bool addModelVar = mode & PM_MODEL_OP_MODELVAR;
    10481037    if (addModelVar) psAssert (source->modelVar, "programming error");
    1049 # endif
    10501038
    10511039    // require the use of pmModelAddWithOffset if we are adding noise (because the model size and norm are rescaled)
     
    10701058        }
    10711059
    1072 # if (HAVE_MODEL_VAR)
    1073         psF32 **target = addModelVar ? source->modelVar->data.F32 : source->pixels->data.F32;
    1074 # else
    1075         psF32 **target = source->pixels->data.F32;
    1076 # endif
     1060        psF32 **target = NULL;
     1061        target = addModelVar ? source->modelVar->data.F32 : source->pixels->data.F32;
    10771062
    10781063        for (int iy = 0; iy < source->modelFlux->numRows; iy++) {
     
    10891074            }
    10901075        }
    1091 # if (HAVE_MODEL_VAR)
     1076        // do not change the flag here if we are adding/subtracting from modelVar
    10921077        if (!addModelVar) {
    1093             if (add) {
    1094                 source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
    1095             } else {
    1096                 source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
    1097             }
     1078          if (add) {
     1079            source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
     1080          } else {
     1081            source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
     1082          }
    10981083        }
    1099 # else
    1100         if (add) {
    1101             source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
    1102         } else {
    1103             source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
    1104         }
    1105 # endif
    11061084        return true;
    11071085    }
     
    11111089        target = source->variance;
    11121090    }
    1113 # if (HAVE_MODEL_VAR)
    11141091    if (addModelVar) {
    1115         target = source->modelVar;
    1116     }
    1117 # endif
     1092      target = source->modelVar;
     1093    }
    11181094
    11191095    if (add) {
    11201096        status = pmModelAddWithOffset (target, source->maskObj, model, PM_MODEL_OP_FULL, maskVal, dx, dy);
    1121 # if (HAVE_MODEL_VAR)
    11221097        if (!addNoise && !addModelVar) source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
    1123 # else
    1124         source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;
    1125 # endif
    11261098    } else {
    11271099        status = pmModelSubWithOffset (target, source->maskObj, model, PM_MODEL_OP_FULL, maskVal, dx, dy);
    1128 # if (HAVE_MODEL_VAR)
    11291100        if (!addNoise && !addModelVar) source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
    1130 # else
    1131         source->tmpFlags |= PM_SOURCE_TMPF_SUBTRACTED;
    1132 # endif
     1101    }
     1102    if (!status) {
     1103        // XXX maybe raise an error or warning?
    11331104    }
    11341105
     
    12001171        status = pmModelSubWithOffset (target, source->maskObj, model, mode, maskVal, dx, dy);
    12011172    }
     1173    if (!status) {
     1174        // XXX raise an error or warning?
     1175    }
    12021176
    12031177    // restore original values
     
    12871261    } else {
    12881262        status = pmModelSubWithOffset (target, source->maskObj, model, mode, maskVal, dx, dy);
     1263    }
     1264    if (!status) {
     1265        // XXX raise an error or warning?
    12891266    }
    12901267
Note: See TracChangeset for help on using the changeset viewer.