IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 28, 2007, 5:20:02 PM (19 years ago)
Author:
eugene
Message:

adding source plots

File:
1 edited

Legend:

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

    r12625 r12665  
    5353    return true;
    5454}
     55
     56// add or sub source replace or if the source has
     57bool psphotAddWithTest (pmSource *source, bool useState) {
     58
     59    // what is current state? (true : add; false : sub)
     60    bool state = !(source->mode & PM_SOURCE_MODE_SUBTRACTED);
     61    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]);
     69   
     70    // replace the model if 1) state says it is missing or 2) useState is false (just do it)
     71    if (!state || !useState) {
     72        pmModelAdd (source->pixels, source->mask, model, false, false);
     73    }
     74    return true;
     75}
     76
     77// add or sub source replace or if the source has
     78bool psphotSubWithTest (pmSource *source, bool useState) {
     79
     80    // what is current state? (true : sub; false : add)
     81    bool state = (source->mode & PM_SOURCE_MODE_SUBTRACTED);
     82    if (state && useState) return true;
     83
     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   
     91    // replace the model if 1) state says it is missing or 2) useState is false (just do it)
     92    if (!state || !useState) {
     93        pmModelSub (source->pixels, source->mask, model, false, false);
     94    }
     95    return true;
     96}
     97
     98// add or sub source replace or if the source has
     99bool psphotSetState (pmSource *source, bool curState) {
     100
     101    // what is desired state? (true : add; false : sub)
     102    bool newState = !(source->mode & PM_SOURCE_MODE_SUBTRACTED);
     103    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]);
     111   
     112    if (curState && !newState) {
     113        pmModelSub (source->pixels, source->mask, model, false, false);
     114    }
     115    if (newState && !curState) {
     116        pmModelAdd (source->pixels, source->mask, model, false, false);
     117    }
     118    return true;
     119}
Note: See TracChangeset for help on using the changeset viewer.