IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33085


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

adding MODEL_VAR option for psf-fit weighting

Location:
branches/eam_branches/ipp-20111122/psModules/src/objects
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20111122/psModules/src/objects/pmModelFuncs.h

    r29004 r33085  
    4646
    4747typedef enum {
    48     PM_MODEL_OP_NONE    = 0x00,
    49     PM_MODEL_OP_FUNC    = 0x01,
    50     PM_MODEL_OP_RES0    = 0x02,
    51     PM_MODEL_OP_RES1    = 0x04,
    52     PM_MODEL_OP_FULL    = 0x07,
    53     PM_MODEL_OP_SKY     = 0x08,
    54     PM_MODEL_OP_CENTER  = 0x10,
    55     PM_MODEL_OP_NORM    = 0x20,
    56     PM_MODEL_OP_NOISE   = 0x40,
     48    PM_MODEL_OP_NONE     = 0x00,
     49    PM_MODEL_OP_FUNC     = 0x01,
     50    PM_MODEL_OP_RES0     = 0x02,
     51    PM_MODEL_OP_RES1     = 0x04,
     52    PM_MODEL_OP_FULL     = 0x07,
     53    PM_MODEL_OP_SKY      = 0x08,
     54    PM_MODEL_OP_CENTER   = 0x10,
     55    PM_MODEL_OP_NORM     = 0x20,
     56    PM_MODEL_OP_NOISE    = 0x40,
     57    PM_MODEL_OP_MODELVAR = 0x80,
    5758} pmModelOpMode;
    5859
  • 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
  • branches/eam_branches/ipp-20111122/psModules/src/objects/pmSourcePhotometry.c

    r33044 r33085  
    903903{
    904904    PS_ASSERT_PTR_NON_NULL(Mi, NAN);
    905     double flux = 0, wt = 0, factor = 0;
     905    double flux = 0, wt = 1.0, factor = 0;
    906906
    907907    const psImage *Pi = Mi->modelFlux;
     
    920920        psAssert (Wi, "programming error");
    921921        break;
     922      case PM_SOURCE_PHOTFIT_NONE:
     923        psAbort("programming error");
    922924    }   
    923925
     
    947949            }
    948950
    949             if (unweighted_sum) {
    950                 flux += (factor * Pi->data.F32[yi][xi]);
    951             } else {
    952                 flux += (factor * Pi->data.F32[yi][xi]) / wt;
    953             }
     951            // wt is 1.0 for CONST
     952            flux += (factor * Pi->data.F32[yi][xi]) / wt;
    954953        }
    955954    }
     
    984983        psAssert (Wi, "programming error");
    985984        break;
     985      case PM_SOURCE_PHOTFIT_NONE:
     986        psAbort("programming error");
    986987    }   
    987988
     
    10231024                wt = covarFactor * Wi->data.F32[yi][xi];
    10241025                break;
     1026              case PM_SOURCE_PHOTFIT_NONE:
     1027                psAbort("programming error");
    10251028            }
    10261029            // skip pixels with nonsense weight values
     
    10601063        psAssert (Wi, "programming error");
    10611064        break;
     1065      case PM_SOURCE_PHOTFIT_NONE:
     1066        psAbort("programming error");
    10621067    }   
    10631068
     
    10991104                wt = covarFactor * Wi->data.F32[yi][xi];
    11001105                break;
     1106              case PM_SOURCE_PHOTFIT_NONE:
     1107                psAbort("programming error");
    11011108            }
    11021109            // skip pixels with nonsense weight values
  • branches/eam_branches/ipp-20111122/psModules/src/objects/pmSourcePhotometry.h

    r33044 r33085  
    3939
    4040typedef enum {
     41    PM_SOURCE_PHOTFIT_NONE,
    4142    PM_SOURCE_PHOTFIT_CONST,
    4243    PM_SOURCE_PHOTFIT_IMAGE_VAR,
Note: See TracChangeset for help on using the changeset viewer.