IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 22, 2007, 5:39:10 PM (19 years ago)
Author:
eugene
Message:

changed PM_MODEL_ADD_.. to PM_MODEL_OP_..; added pmSourceAdd/Sub; adding modelFlux and maskView/maskObj to pmSource

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_02_branch/psphot/src/psphotReplaceUnfit.c

    r12955 r12957  
    11# include "psphotInternal.h"
    22
     3// replace the flux for sources which failed
    34bool psphotReplaceUnfit (psArray *sources) {
    45
     
    1516
    1617    replace:
    17         if (source->modelPSF == NULL) continue;
    18 
    19         psTrace ("psphot", 3, "replacing object at %f,%f\n",
    20                  source->modelPSF->params->data.F32[PM_PAR_XPOS], source->modelPSF->params->data.F32[PM_PAR_YPOS]);
    21 
    22         // why am i assuming below that this is a PSF?
    23         // pmSourceAdd (!NORM, +)
    24         pmModelAdd (source->pixels, source->mask, source->modelPSF, PM_MODEL_ADD_FULL);
     18        pmSourceAdd (source, PM_MODEL_OP_FULL);
    2519        source->mode &= ~PM_SOURCE_MODE_SUBTRACTED;
    2620        source->mode &= ~PM_SOURCE_MODE_TEMPSUB;
     
    4236      if (!(source->mode & PM_SOURCE_MODE_SUBTRACTED)) continue;
    4337
    44       // select appropriate model
    45       pmModel *model = pmSourceGetModel (NULL, source);
    46       if (model == NULL) continue;  // model must be defined
    47        
    48       psTrace ("psphot", 3, "replacing object at %f,%f\n",
    49                model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]);
    50 
    51       // pmSourceAdd (source, !NORM, "+");
    52       // XXX remove model selection and ps
    53       pmModelAdd (source->pixels, source->mask, model, PM_MODEL_ADD_FULL);
     38      pmSourceAdd (source, PM_MODEL_OP_FULL);
    5439      source->mode &= ~PM_SOURCE_MODE_SUBTRACTED;
    5540    }
     
    5843}
    5944
    60 // add or sub source replace or if the source has
     45// add source, if the source has been subtracted (or if we ignore the state)
    6146bool psphotAddWithTest (pmSource *source, bool useState) {
    6247
     
    6449    bool state = !(source->mode & PM_SOURCE_MODE_SUBTRACTED);
    6550    if (state && useState) return true;
    66 
    67     // select appropriate model
    68     pmModel *model = pmSourceGetModel (NULL, source);
    69     if (model == NULL) return false;  // model must be defined
    70    
    71     psTrace ("psphot", 3, "replacing object at %f,%f\n",
    72              model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]);
    7351   
    7452    // replace the model if 1) state says it is missing or 2) useState is false (just do it)
    7553    if (!state || !useState) {
    76         pmModelAdd (source->pixels, source->mask, model, PM_MODEL_ADD_FULL);
     54        pmSourceAdd (source, PM_MODEL_OP_FULL);
    7755    }
    7856    return true;
    7957}
    8058
    81 // add or sub source replace or if the source has
     59// sub source, if the source has been added (or if we ignore the state)
    8260bool psphotSubWithTest (pmSource *source, bool useState) {
    8361
     
    8664    if (state && useState) return true;
    8765
    88     // select appropriate model
    89     pmModel *model = pmSourceGetModel (NULL, source);
    90     if (model == NULL) return false;  // model must be defined
    91    
    92     psTrace ("psphot", 3, "replacing object at %f,%f\n",
    93              model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]);
    94    
    9566    // replace the model if 1) state says it is missing or 2) useState is false (just do it)
    9667    if (!state || !useState) {
    97       // pmSourceSub (!NORM, -)
    98         pmModelSub (source->pixels, source->mask, model, PM_MODEL_ADD_FULL);
     68        pmSourceSub (source, PM_MODEL_OP_FULL);
    9969    }
    10070    return true;
     
    10777    bool newState = !(source->mode & PM_SOURCE_MODE_SUBTRACTED);
    10878    if (curState == newState) return true;
    109 
    110     // select appropriate model
    111     pmModel *model = pmSourceGetModel (NULL, source);
    112     if (model == NULL) return false;  // model must be defined
    113    
    114     psTrace ("psphot", 3, "replacing object at %f,%f\n",
    115              model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]);
    11679   
    11780    if (curState && !newState) {
    118       // pmSourceSub (!NORM, -)
    119         pmModelSub (source->pixels, source->mask, model, PM_MODEL_ADD_FULL);
     81        pmSourceSub (source, PM_MODEL_OP_FULL);
    12082    }
    12183    if (newState && !curState) {
    122       // pmSourceAdd (!NORM, +)
    123         pmModelAdd (source->pixels, source->mask, model, PM_MODEL_ADD_FULL);
     84        pmSourceAdd (source, PM_MODEL_OP_FULL);
    12485    }
    12586    return true;
Note: See TracChangeset for help on using the changeset viewer.