IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13982


Ignore:
Timestamp:
Jun 26, 2007, 9:27:37 AM (19 years ago)
Author:
magnier
Message:

adding cached psf model, holder for convolved psf model

Location:
trunk/psModules/src/objects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSource.c

    r13898 r13982  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-06-20 02:22:26 $
     8 *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-06-26 19:27:37 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4242    psFree(tmp->maskView);
    4343    psFree(tmp->modelFlux);
     44    psFree(tmp->psfFlux);
    4445    psFree(tmp->moments);
    4546    psFree(tmp->modelPSF);
    4647    psFree(tmp->modelEXT);
     48    psFree(tmp->modelConv);
    4749    psFree(tmp->blends);
    4850    psTrace("psModules.objects", 5, "---- end ----\n");
     
    6163    psFree (source->maskView);
    6264    psFree (source->modelFlux);
     65    psFree (source->psfFlux);
    6366
    6467    source->pixels = NULL;
     
    6770    source->maskView = NULL;
    6871    source->modelFlux = NULL;
     72    source->psfFlux = NULL;
    6973    return;
    7074}
     
    8690    source->maskView = NULL;
    8791    source->modelFlux = NULL;
     92    source->psfFlux = NULL;
    8893    source->moments = NULL;
    8994    source->blends = NULL;
    9095    source->modelPSF = NULL;
    9196    source->modelEXT = NULL;
     97    source->modelConv = NULL;
    9298    source->type = PM_SOURCE_TYPE_UNKNOWN;
    9399    source->mode = PM_SOURCE_MODE_DEFAULT;
     
    223229        psFree (mySource->modelFlux);
    224230        mySource->modelFlux = NULL;
     231
     232        // drop the old psfFlux pixels and force the user to re-create
     233        psFree (mySource->psfFlux);
     234        mySource->psfFlux = NULL;
    225235    }
    226236    return extend;
     
    765775}
    766776
     777// construct a realization of the source model
     778// XXX this function should optionally save an existing psf image from modelFlux
     779bool pmSourceCachePSF (pmSource *source, psMaskType maskVal) {
     780
     781    // select appropriate model
     782    if (source->modelPSF == NULL) return false;  // model must be defined
     783
     784    // if we already have a cached image, re-use that memory
     785    source->psfFlux = psImageCopy (source->psfFlux, source->pixels, PS_TYPE_F32);
     786    psImageInit (source->psfFlux, 0.0);
     787
     788    // in some places (psphotEnsemble), we need a normalized version
     789    // in others, we just want the model.  which is more commonly used?
     790    // psfFlux always has unity normalization (I0 = 1.0)
     791    pmModelAdd (source->psfFlux, source->maskObj, source->modelPSF, PM_MODEL_OP_FULL | PM_MODEL_OP_NORM, maskVal);
     792    return true;
     793}
     794
    767795// should we call pmSourceCacheModel if it does not exist?
    768796bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add, psMaskType maskVal) {
     
    864892        return model;
    865893
     894// XXX when should I return the modelConv ??
    866895    case PM_SOURCE_TYPE_EXTENDED:
    867896        model = source->modelEXT;
  • trunk/psModules/src/objects/pmSource.h

    r13898 r13982  
    33 * @author EAM, IfA; GLG, MHPCC
    44 *
    5  * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    6  * @date $Date: 2007-06-20 02:22:26 $
     5 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     6 * @date $Date: 2007-06-26 19:27:37 $
    77 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    88 */
     
    6363    psImage *pixels;                    ///< Rectangular region including object pixels.
    6464    psImage *weight;                    ///< Image variance.
    65     psImage *modelFlux;                 ///< cached copy of the model for this source
    6665    psImage *maskObj;                   ///< unique mask for this object which marks included pixels associated with objects.
    6766    psImage *maskView;                  ///< view into global image mask for this object region
     67    psImage *modelFlux;                 ///< cached copy of the best model for this source
     68    psImage *psfFlux;                   ///< cached copy of the psf model for this source
    6869    pmMoments *moments;                 ///< Basic moments measure for the object.
    6970    pmModel *modelPSF;                  ///< PSF Model fit (parameters and type)
    7071    pmModel *modelEXT;                  ///< EXT (floating) Model fit (parameters and type).
     72    pmModel *modelConv;                 ///< PSF-Convolved Model fit (parameters and type).
    7173    pmSourceType type;                  ///< Best identification of object.
    7274    pmSourceMode mode;                  ///< Best identification of object.
Note: See TracChangeset for help on using the changeset viewer.