IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 25, 2007, 3:35:50 PM (19 years ago)
Author:
eugene
Message:

incorporating changes from eam_02_branch (pmSourceAdd/Sub, modified API for pmModelAdd, cached models)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotReplaceUnfit.c

    r12792 r13035  
    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         pmModelAdd (source->pixels, source->mask, source->modelPSF, false, false);
     18        pmSourceAdd (source, PM_MODEL_OP_FULL);
    2319        source->mode &= ~PM_SOURCE_MODE_SUBTRACTED;
    2420        source->mode &= ~PM_SOURCE_MODE_TEMPSUB;
     
    4036      if (!(source->mode & PM_SOURCE_MODE_SUBTRACTED)) continue;
    4137
    42       // select appropriate model
    43       pmModel *model = pmSourceGetModel (NULL, source);
    44       if (model == NULL) continue;  // model must be defined
    45        
    46       psTrace ("psphot", 3, "replacing object at %f,%f\n",
    47                model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]);
    48 
    49       pmModelAdd (source->pixels, source->mask, model, false, false);
     38      pmSourceAdd (source, PM_MODEL_OP_FULL);
    5039      source->mode &= ~PM_SOURCE_MODE_SUBTRACTED;
    5140    }
     
    5443}
    5544
    56 // 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)
    5746bool psphotAddWithTest (pmSource *source, bool useState) {
    5847
     
    6049    bool state = !(source->mode & PM_SOURCE_MODE_SUBTRACTED);
    6150    if (state && useState) return true;
    62 
    63     // select appropriate model
    64     pmModel *model = pmSourceGetModel (NULL, source);
    65     if (model == NULL) return false;  // model must be defined
    66    
    67     psTrace ("psphot", 3, "replacing object at %f,%f\n",
    68              model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]);
    6951   
    7052    // replace the model if 1) state says it is missing or 2) useState is false (just do it)
    7153    if (!state || !useState) {
    72         pmModelAdd (source->pixels, source->mask, model, false, false);
     54        pmSourceAdd (source, PM_MODEL_OP_FULL);
    7355    }
    7456    return true;
    7557}
    7658
    77 // 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)
    7860bool psphotSubWithTest (pmSource *source, bool useState) {
    7961
     
    8264    if (state && useState) return true;
    8365
    84     // select appropriate model
    85     pmModel *model = pmSourceGetModel (NULL, source);
    86     if (model == NULL) return false;  // model must be defined
    87    
    88     psTrace ("psphot", 3, "replacing object at %f,%f\n",
    89              model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]);
    90    
    9166    // replace the model if 1) state says it is missing or 2) useState is false (just do it)
    9267    if (!state || !useState) {
    93         pmModelSub (source->pixels, source->mask, model, false, false);
     68        pmSourceSub (source, PM_MODEL_OP_FULL);
    9469    }
    9570    return true;
     
    10277    bool newState = !(source->mode & PM_SOURCE_MODE_SUBTRACTED);
    10378    if (curState == newState) return true;
    104 
    105     // select appropriate model
    106     pmModel *model = pmSourceGetModel (NULL, source);
    107     if (model == NULL) return false;  // model must be defined
    108    
    109     psTrace ("psphot", 3, "replacing object at %f,%f\n",
    110              model->params->data.F32[PM_PAR_XPOS], model->params->data.F32[PM_PAR_YPOS]);
    11179   
    11280    if (curState && !newState) {
    113         pmModelSub (source->pixels, source->mask, model, false, false);
     81        pmSourceSub (source, PM_MODEL_OP_FULL);
    11482    }
    11583    if (newState && !curState) {
    116         pmModelAdd (source->pixels, source->mask, model, false, false);
     84        pmSourceAdd (source, PM_MODEL_OP_FULL);
    11785    }
    11886    return true;
Note: See TracChangeset for help on using the changeset viewer.