IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 23, 2007, 2:11:02 PM (19 years ago)
Author:
magnier
Message:
  • added function pointers to pmModel to provide class-dependent functions
  • dropped pmModel*_GetFunction functions (use pmModel->func functions instead)
  • added modelParamsFromPSF functions to model classes
  • changed pmModelGroup to pmModelClass
  • added pmSourceFitSet.[ch]
  • updated pmSourceFitSet to allow variable model classes
  • added functions to add/sub and eval models & sources with an offset between image and chip
  • added function to set a pmModel flux
  • added function to instatiate a pmModel from a pmPSF at a coordinate
  • moved pmPSF I/O to chip->analysis from readout->analysis
  • changed pmPSF I/O function names from *ForPSFmodel to pmPSFmodel*
  • changed pmModel.params_NEW back to pmModel.params
  • changed pmFind*Peaks to pmPeaksIn* (* = Image,Vector)
  • dropped pmCullPeaks (deprecated)
  • changed pmModelSetType to pmModelClassGetType
  • changed pmModelGetType to pmModelClassGetName
  • fixed PGAUSS implementation of modelRadius function
File:
1 edited

Legend:

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

    r13898 r14652  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-06-20 02:22:26 $
     8 *  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-08-24 00:11:02 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2828#include "pmMoments.h"
    2929#include "pmResiduals.h"
     30#include "pmGrowthCurve.h"
     31#include "pmPSF.h"
    3032#include "pmModel.h"
    3133#include "pmSource.h"
    32 #include "pmGrowthCurve.h"
    33 #include "pmPSF.h"
    34 #include "pmModelGroup.h"
     34#include "pmModelClass.h"
     35#include "pmModelUtils.h"
    3536#include "pmSourcePhotometry.h"
    3637#include "pmFPAMaskWeight.h"
     
    7475    psFree (psf->ApTrend);
    7576    psFree (psf->growth);
    76     psFree (psf->params_NEW);
     77    psFree (psf->params);
    7778    psFree (psf->residuals);
    7879    return;
     
    103104    psf->skyBias  = 0.0;
    104105    psf->skySat   = 0.0;
     106    psf->nPSFstars  = 0;
     107    psf->nApResid   = 0;
    105108    psf->poissonErrors = poissonErrors;
    106109
     
    124127    psf->residuals = NULL;
    125128
    126     Nparams = pmModelParameterCount (type);
     129    Nparams = pmModelClassParameterCount (type);
    127130    if (!Nparams) {
    128131        psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType");
    129132        return(NULL);
    130133    }
    131     psf->params_NEW = psArrayAlloc(Nparams);
     134    psf->params = psArrayAlloc(Nparams);
    132135
    133136    // the order of the PSF parameter (X,Y) fits is determined by the psfTrendMask polynomial
     
    139142
    140143    if (psfTrendMask) {
    141         for (int i = 0; i < psf->params_NEW->n; i++) {
     144        for (int i = 0; i < psf->params->n; i++) {
    142145            if (i == PM_PAR_SKY)
    143146                continue;
     
    155158                }
    156159            }
    157             psf->params_NEW->data[i] = param;
     160            psf->params->data[i] = param;
    158161        }
    159162    }
     
    161164    psMemSetDeallocator(psf, (psFreeFunc) pmPSFFree);
    162165    return(psf);
    163 }
    164 
    165 /*****************************************************************************
    166 pmModelFromPSF (*modelEXT, *psf):  use the model position parameters to
    167 construct a realization of the PSF model at the object coordinates
    168  *****************************************************************************/
    169 pmModel *pmModelFromPSF (pmModel *modelEXT, pmPSF *psf)
    170 {
    171 
    172     // need to define the relationship between the modelEXT and modelPSF ?
    173 
    174     // find function used to set the model parameters
    175     pmModelFromPSFFunc modelFromPSFFunc = pmModelFromPSFFunc_GetFunction (psf->type);
    176 
    177     // allocate a new pmModel to hold the PSF version
    178     pmModel *modelPSF = pmModelAlloc (psf->type);
    179 
    180     // set model parameters for this source based on PSF information
    181     if (!modelFromPSFFunc (modelPSF, modelEXT, psf)) {
    182         psError(PM_ERR_PSF, false, "Failed to set model params from PSF");
    183         psFree(modelPSF);
    184         return NULL;
    185     }
    186     // XXX note that model->residuals is just a reference
    187     modelPSF->residuals = psf->residuals;
    188 
    189     return (modelPSF);
    190166}
    191167
     
    335311    va_start(ap, sxy);
    336312
    337     pmModelType type = pmModelSetType (typeName);
     313    pmModelType type = pmModelClassGetType (typeName);
    338314    psPolynomial2D *psfTrend = psPolynomial2DAlloc (PS_POLYNOMIAL_ORD, 0, 0);
    339315    pmPSF *psf = pmPSFAlloc (type, true, psfTrend);
    340316
    341     psVector *par = psVectorAlloc (psf->params_NEW->n, PS_TYPE_F32);
     317    psVector *par = psVectorAlloc (psf->params->n, PS_TYPE_F32);
    342318    par->data.F32[PM_PAR_SXX] = sxx;
    343319    par->data.F32[PM_PAR_SYY] = syy;
     
    348324    // set the psf shape parameters
    349325    psPolynomial2D *poly = NULL;
    350     poly = psf->params_NEW->data[PM_PAR_E0];
     326    poly = psf->params->data[PM_PAR_E0];
    351327    poly->coeff[0][0] = pol.e0;
    352328
    353     poly = psf->params_NEW->data[PM_PAR_E1];
     329    poly = psf->params->data[PM_PAR_E1];
    354330    poly->coeff[0][0] = pol.e1;
    355331
    356     poly = psf->params_NEW->data[PM_PAR_E2];
     332    poly = psf->params->data[PM_PAR_E2];
    357333    poly->coeff[0][0] = pol.e2;
    358334
    359     for (int i = PM_PAR_SXY + 1; i < psf->params_NEW->n; i++) {
    360         poly = psf->params_NEW->data[i];
     335    for (int i = PM_PAR_SXY + 1; i < psf->params->n; i++) {
     336        poly = psf->params->data[i];
    361337        poly->coeff[0][0] = (psF32)va_arg(ap, psF64);
    362338    }
Note: See TracChangeset for help on using the changeset viewer.