IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 17, 2007, 11:01:59 AM (19 years ago)
Author:
magnier
Message:

substantial cleanups of APIs:

changed pmModelGroup to pmModelClass

dropped the _GetFunctions, and moved the modelClass-specific functions
to functions pointers in the pmModel structure. These are assigned
when the model is allocated, based on the model type. Now, instead of
calling, for example,

modelFunc = pmModelFunc_GetFunctions(model->type)
modelFunc();

you just do:

model->modelFunc()

moved some of the support functions into pmModelUtils and
pmSourceUtils.

changed pmIsFooBar to pmFooBarTest for better api listing.

added functions to evaluate and add/subtract models applying an offset
between the image coordinate frame and the chip frame (required frame
for model parameters)

added function(s) to instatiate a pmModel from a pmPSF based on a
given coordinate and peak flux.

added a function to set the model normalization based on a source flux
value.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20070817/psModules/src/objects/pmPSF_IO.c

    r14207 r14544  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-07-14 03:20:22 $
     8 *  @version $Revision: 1.20.4.1 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-08-17 21:01:59 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4444#include "pmPSF_IO.h"
    4545#include "pmSource.h"
    46 #include "pmModelGroup.h"
     46#include "pmModelClass.h"
    4747#include "pmSourceIO.h"
    4848
     
    313313        psMetadata *header = psMetadataAlloc();
    314314
    315         char *modelName = pmModelGetType (psf->type);
     315        char *modelName = pmModelClassGetName (psf->type);
    316316        psMetadataAddStr (header, PS_LIST_TAIL, "PSF_NAME", 0, "PSF model name", modelName);
    317317
    318318        psMetadataAddBool (header, PS_LIST_TAIL, "POISSON",  0, "Use Poisson errors in fits?", psf->poissonErrors);
    319319
    320         int nPar = pmModelParameterCount (psf->type)    ;
     320        int nPar = pmModelClassParameterCount (psf->type)    ;
    321321        psMetadataAdd (header, PS_LIST_TAIL, "PSF_NPAR", PS_DATA_S32, "PSF model parameter count", nPar);
    322322
     
    599599    // load the PSF model parameters from the FITS table
    600600    char *modelName = psMetadataLookupStr (&status, header, "PSF_NAME");
    601     pmModelType type = pmModelSetType (modelName);
     601    pmModelType type = pmModelClassGetType (modelName);
    602602    if (type == -1) {
    603603        psError(PS_ERR_UNKNOWN, true, "invalid model name %s in psf file %s", modelName, file->filename);
     
    612612    // check the number of expected parameters
    613613    int nPar = psMetadataLookupS32 (&status, header, "PSF_NPAR");
    614     if (nPar != pmModelParameterCount (psf->type))
     614    if (nPar != pmModelClassParameterCount (psf->type))
    615615        psAbort("mismatch model par count");
    616616
     
    717717    }
    718718
    719     char *modelName = pmModelGetType (psf->type);
     719    char *modelName = pmModelClassGetName (psf->type);
    720720    psMetadataAdd (metadata, PS_LIST_TAIL, "PSF_MODEL_NAME", PS_DATA_STRING, "PSF model name", modelName);
    721721
    722     int nPar = pmModelParameterCount (psf->type)    ;
     722    int nPar = pmModelClassParameterCount (psf->type)    ;
    723723    psMetadataAdd (metadata, PS_LIST_TAIL, "PSF_MODEL_NPAR", PS_DATA_S32, "PSF model parameter count", nPar);
    724724
     
    749749
    750750    char *modelName = psMetadataLookupPtr (&status, metadata, "PSF_MODEL_NAME");
    751     pmModelType type = pmModelSetType (modelName);
     751    pmModelType type = pmModelClassGetType (modelName);
    752752
    753753    bool poissonErrors = psMetadataLookupPtr (&status, metadata, "PSF_POISSON_ERRORS");
     
    759759
    760760    int nPar = psMetadataLookupS32 (&status, metadata, "PSF_MODEL_NPAR");
    761     if (nPar != pmModelParameterCount (psf->type))
     761    if (nPar != pmModelClassParameterCount (psf->type))
    762762        psAbort("mismatch model par count");
    763763
Note: See TracChangeset for help on using the changeset viewer.