IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4949


Ignore:
Timestamp:
Sep 5, 2005, 8:44:00 PM (21 years ago)
Author:
eugene
Message:

adding pmObjects stuff

Location:
trunk/psphot/src
Files:
2 added
13 edited

Legend:

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

    r4946 r4949  
    11# include "psphot.h"
    22
    3 bool pmSourceDefinePixels(psSource *mySource,
     3bool pmSourceDefinePixels(pmSource *mySource,
    44                          const psImageData *imdata,
    55                          psF32 x,
     
    2626}
    2727
    28 bool pmSourcePhotometry (float *fitMag, float *obsMag, psModel *model, psImage *image, psImage *mask) {
     28bool pmSourcePhotometry (float *fitMag, float *obsMag, pmModel *model, psImage *image, psImage *mask) {
    2929
    3030    float obsSum = 0;
     
    3232    float sky = model->params->data.F32[0];
    3333
    34     psModelFlux modelFluxFunc = psModelFlux_GetFunction (model->type);
     34    pmModelFlux modelFluxFunc = pmModelFlux_GetFunction (model->type);
    3535    fitSum = modelFluxFunc (model->params);
    3636
     
    3939            if (mask->data.U8[iy][ix]) continue;
    4040            obsSum += image->data.F32[iy][ix] - sky;
    41             // fitSum += psModelEval (model, image, ix, iy) - sky;
    4241        }
    4342    }
  • trunk/psphot/src/psModulesUtils.c

    r4946 r4949  
    44
    55// this sets and clears bit 0x80
    6 bool pmSourceLocalSky_EAM (psSource *source,
     6bool pmSourceLocalSky_EAM (pmSource *source,
    77                           psStatsOptions statsOptions,
    88                           psF32 Radius)
     
    3636# define PM_SOURCE_FIT_MODEL_NUM_ITERATIONS 15
    3737# define PM_SOURCE_FIT_MODEL_TOLERANCE 0.1
    38 bool pmSourceFitModel_EAM(psSource *source,
    39                           psModel *model,
    40                           const bool PSF)
     38bool pmSourceFitModel_EAM (pmSource *source,
     39                             pmModel *model,
     40                             const bool PSF)
    4141{
    4242    PS_PTR_CHECK_NULL(source, false);
     
    5555    //           tests below could be conditions (!NULL)
    5656
    57     psModelFunc modelFunc = psModelFunc_GetFunction (model->type);
    58     psModelLimits modelLimits = psModelLimits_GetFunction (model->type);
     57    pmModelFunc modelFunc = pmModelFunc_GetFunction (model->type);
     58    pmModelLimits modelLimits = pmModelLimits_GetFunction (model->type);
    5959
    6060    psVector *params = model->params;
     
    177177/******************************************************************************
    178178pmSourceMoments(source, radius): this function takes a subImage defined in the
    179 psSource data structure, along with the peak location, and determines the
     179pmSource data structure, along with the peak location, and determines the
    180180various moments associated with that peak.
    181181 
    182182Requires the following to have been created:
    183     psSource
    184     psSource->peak
    185     psSource->pixels
     183    pmSource
     184    pmSource->peak
     185    pmSource->pixels
    186186 
    187187XXX: The peak calculations are done in image coords, not subImage coords.
     
    191191# define VALID_RADIUS(X,Y) (((R2) >= (PS_SQR(X) + PS_SQR(Y))) ? 1 : 0)
    192192
    193 bool pmSourceMoments_EAM(psSource *source,
     193bool pmSourceMoments_EAM(pmSource *source,
    194194                         psF32 radius)
    195195{
     
    310310}
    311311
    312 bool pmModelFitStatus (psModel *model) {
     312bool pmModelFitStatus (pmModel *model) {
    313313
    314314    bool status;
    315315
    316     psModelFitStatusFunc statusFunc = psModelFitStatusFunc_GetFunction (model->type);
     316    pmModelFitStatusFunc statusFunc = pmModelFitStatusFunc_GetFunction (model->type);
    317317    status = statusFunc (model);
    318318
  • trunk/psphot/src/psphot.h

    r4946 r4949  
    11# include <pslib.h>
    2 # include <pmObjects.h>
     2// # include <pmObjects.h>
     3// my additions and modifications:
     4# include "pmObjects_EAM.h"
    35# include <string.h>
    46# include <strings.h>
     
    79# include <math.h>
    810
    9 # define  M_PI 3.14159265358979323846264338328      /* pi */
     11// # define  M_PI 3.14159265358979323846264338328      /* pi */
    1012
    1113typedef struct {
     
    1820// data to test a given PSF model type
    1921typedef struct {
    20   psModelType modelType;
     22  pmModelType modelType;
    2123  pmPSF      *psf;
    2224  psArray    *sources;      // pointers to the original sources
     
    6163void         psphotOutput (psImageData *imdata, psMetadata *config, psArray *sources);
    6264
    63 bool         psphotMarkPSF (psSource *source, float shapeNsigma, float minSN, float maxChi, float SATURATE);
    64 bool         psphotSubtractPSF (psSource *source);
     65bool         psphotMarkPSF (pmSource *source, float shapeNsigma, float minSN, float maxChi, float SATURATE);
     66bool         psphotSubtractPSF (pmSource *source);
    6567int          psphotSortBySN (const void **a, const void **b);
    6668
     
    6971
    7072// psf utilities
    71 pmPSF       *pmPSFAlloc (psModelType type);
     73pmPSF       *pmPSFAlloc (pmModelType type);
    7274pmPSF_Test  *pmPSF_TestAlloc (psArray *stars, char *modelName);
    7375pmPSF_Test  *pmPSF_TestModel (psArray *sources, char *modelName, float radius);
    7476bool         pmPSFFromModels (pmPSF *psf, psArray *models, psVector *mask);
    75 psModel     *psModelFromPSF (psModel *model, pmPSF *psf);
    76 bool         pmSourcePhotometry (float *fitMag, float *obsMag, psModel *model, psImage *image, psImage *mask);
     77pmModel     *pmModelFromPSF (pmModel *model, pmPSF *psf);
     78bool         pmSourcePhotometry (float *fitMag, float *obsMag, pmModel *model, psImage *image, psImage *mask);
    7779bool         pmPSFMetricModel (pmPSF_Test *test, float RADIUS);
    7880
     
    8385bool         pmSourcesWriteCMF (psImageData *imdata, char *filename, psArray *sources);
    8486bool         pmSourcesWriteSX (psImageData *imdata, char *filename, psArray *sources);
    85 int          pmSourcesDophotType (psSource *source);
    86 bool         psPeaksWriteText (psArray *sources, char *filename);
    87 bool         psMomentsWriteText (psArray *sources, char *filename);
    88 bool         psModelWritePSFs (psArray *sources, char *filename);
    89 bool         psModelWriteFLTs (psArray *sources, char *filename);
    90 bool         psModelWriteNULLs (psArray *sources, char *filename);
     87int          pmSourcesDophotType (pmSource *source);
     88bool         pmPeaksWriteText (psArray *sources, char *filename);
     89bool         pmMomentsWriteText (psArray *sources, char *filename);
     90bool         pmModelWritePSFs (psArray *sources, char *filename);
     91bool         pmModelWriteFLTs (psArray *sources, char *filename);
     92bool         pmModelWriteNULLs (psArray *sources, char *filename);
    9193
    9294// psModule extra utilities
    93 bool         pmSourceDefinePixels(psSource *mySource, const psImageData *imdata, psF32 x, psF32 y, psF32 Radius);
    94 bool         pmSourceLocalSky_EAM (psSource *source, psStatsOptions statsOptions, psF32 Radius);
    95 bool         pmSourceFitModel_EAM(psSource *source, psModel *model, const bool PSF);
    96 bool         pmSourceMoments_EAM(psSource *source, psF32 radius);
    97 bool         pmModelFitStatus (psModel *model);
    98 int          pmSourceDophotType (psSource *source);
     95bool         pmSourceDefinePixels(pmSource *mySource, const psImageData *imdata, psF32 x, psF32 y, psF32 Radius);
     96bool         pmSourceLocalSky_EAM (pmSource *source, psStatsOptions statsOptions, psF32 Radius);
     97bool         pmSourceFitModel_EAM(pmSource *source, pmModel *model, const bool PSF);
     98bool         pmSourceMoments_EAM(pmSource *source, psF32 radius);
     99bool         pmModelFitStatus (pmModel *model);
     100int          pmSourceDophotType (pmSource *source);
    99101
    100102// minimize
     
    114116psF32        pmConfigLookupF32 (bool *status, psMetadata *config, psMetadata *header, char *name);
    115117psVector    *psVectorCreate (double lower, double upper, double delta, psElemType type);
    116 void         psImageMaskRegion (psImage *image, psRegion *region, bool logical_and, int maskValue);
    117 void         psImageKeepRegion (psImage *image, psRegion *region, bool logical_and, int maskValue);
    118 void         psImageMaskCircle (psImage *image, double x, double y, double radius, bool logical_and, int maskValue);
    119 void         psImageKeepCircle (psImage *image, double x, double y, double radius, bool logical_and, int maskValue);
     118//void       psImageMaskRegion (psImage *image, psRegion *region, bool logical_and, int maskValue);
     119//void       psImageKeepRegion (psImage *image, psRegion *region, bool logical_and, int maskValue);
     120//void       psImageMaskCircle (psImage *image, double x, double y, double radius, bool logical_and, int maskValue);
     121//void       psImageKeepCircle (psImage *image, double x, double y, double radius, bool logical_and, int maskValue);
    120122psVector    *psGetRowVectorFromImage(psImage *image, psU32 row);
    121123
    122124// basic image functions
    123125bool         psImageInit (psImage *image,...);
    124 void         psImageSmooth (psImage *image, float sigma, float Nsigma);
    125 psRegion    *psRegionForImage (psRegion *out, psImage *image, psRegion *in);
     126//void       psImageSmooth (psImage *image, float sigma, float Nsigma);
     127//psRegion    *psRegionForImage (psRegion *out, psImage *image, psRegion *in);
    126128psRegion    *psRegionSquare (psF32 x, psF32 y, psF32 radius);
    127129int          psphotSaveImage (psMetadata *header, psImage *image, char *filename);
     
    153155int             fs_usage ();
    154156bool            DumpImage (psImage *image, char *filename);
    155 
    156 // deprecated
    157 // void pmSourceMaskRegion (psSource *source, psRegion *region);
    158 //psVector    *p_psGetRowVectorFromImage(psImage *image, psU32 row);
  • trunk/psphot/src/psphotApplyPSF.c

    r4946 r4949  
    3131
    3232    // this function specifies the radius at this the model hits the given flux
    33     psModelRadius modelRadius = psModelRadius_GetFunction (psf->type);
     33    pmModelRadius modelRadius = pmModelRadius_GetFunction (psf->type);
    3434
    3535    for (int i = 0; i < sources->n; i++) {
    3636
    37         psSource *source = sources->data[i];
     37        pmSource *source = sources->data[i];
    3838
    3939        // skip non-astronomical objects (very likely defects)
     
    4343
    4444        // use the source moments, etc to guess basic model parameters
    45         psModel *modelFLT = pmSourceModelGuess (source, psf->type);
     45        pmModel *modelFLT = pmSourceModelGuess (source, psf->type);
    4646
    4747        // set PSF parameters for this model
    48         psModel *model = psModelFromPSF (modelFLT, psf);
     48        pmModel *model = pmModelFromPSF (modelFLT, psf);
    4949        x = model->params->data.F32[2];
    5050        y = model->params->data.F32[3];
     
    6666
    6767        // fit PSF model (set/unset the pixel mask)
    68         psImageKeepCircle (source->mask, x, y, model->radius, OR, PSPHOT_MASK_KEEP);
     68        psImageKeepCircle (source->mask, x, y, model->radius, "or", PSPHOT_MASK_KEEP);
    6969        status = pmSourceFitModel (source, model, true);
    70         psImageKeepCircle (source->mask, x, y, model->radius, AND, ~PSPHOT_MASK_KEEP);
     70        psImageKeepCircle (source->mask, x, y, model->radius, "and", ~PSPHOT_MASK_KEEP);
    7171        if (!status || (model->params->data.F32[1] < 0)) {
    7272          psLogMsg ("psphot", 3, "PSF fit failed for %f, %f (%d iterations)\n", x, y, model->nIter);
  • trunk/psphot/src/psphotChoosePSF.c

    r4946 r4949  
    1717    // select the candidate PSF stars (pointers to original sources)
    1818    for (int i = 0; i < sources->n; i++) {
    19         psSource *source = sources->data[i];
     19        pmSource *source = sources->data[i];
    2020        if (source->type != PS_SOURCE_PSFSTAR) continue;
    2121        psArrayAdd (stars, 200, source);
     
    3535
    3636    // set up an array to store the test results
    37     psArray *tests = psArrayAlloc (list->size);
    38     // XXX EAM : new value : psArray *tests = psArrayAlloc (list->n);
     37    psArray *tests = psArrayAlloc (list->n);
    3938
    4039    // test each model option listed in config
     
    6867    // keep only the selected test:
    6968    test = tests->data[bestN];
    70     modelName = psModelGetType (test->modelType);
     69    modelName = pmModelGetType (test->modelType);
    7170    psLogMsg ("psphot.pspsf", 3, "selected psf model %s, ApResid: %f +/- %f\n", modelName, test->ApResid, test->dApResid);
    7271
     
    7776    // set source->model based on best psf model fit
    7877    for (int i = 0; i < test->sources->n; i++) {
    79         psSource *source = test->sources->data[i];
     78        pmSource *source = test->sources->data[i];
    8079        // drop masked sources from PSFSTAR list
    8180        if (test->mask->data.U8[i]) {
  • trunk/psphot/src/psphotFitGalaxies.c

    r4946 r4949  
    2121
    2222    char         *modelName   = psMetadataLookupPtr (&status, config, "GAL_MODEL");
    23     psModelType   modelType   = psModelSetType (modelName);
    24     psModelRadius modelRadius = psModelRadius_GetFunction (modelType);
     23    pmModelType   modelType   = pmModelSetType (modelName);
     24    pmModelRadius modelRadius = pmModelRadius_GetFunction (modelType);
    2525
    2626    psTimerStart ("psphot");
    2727
    2828    for (int i = 0; i < sources->n; i++) {
    29         psSource *source = sources->data[i];
     29        pmSource *source = sources->data[i];
    3030
    3131        // sources which should not be fitted
     
    5050
    5151        // recalculate the source moments using the larger galaxy moments radius
    52         status = pmSourceMoments_EAM (source, GAL_MOMENTS_RAD);
     52        status = pmSourceMoments (source, GAL_MOMENTS_RAD);
    5353        if (!status) {
    5454          source->type = PS_SOURCE_DROP_GALAXY;  // better choice?
     
    5757
    5858        // use the source moments, etc to guess basic model parameters
    59         psModel  *model  = pmSourceModelGuess (source, modelType);
     59        pmModel  *model  = pmSourceModelGuess (source, modelType);
    6060        x = model->params->data.F32[2];
    6161        y = model->params->data.F32[3];
     
    7575        // fit FLT (not PSF) model (set/unset the pixel mask)
    7676        psImageKeepCircle (source->mask, x, y, model->radius, OR, PSPHOT_MASK_KEEP);
    77         status = pmSourceFitModel_EAM (source, model, false);
     77        status = pmSourceFitModel (source, model, false);
    7878        psImageKeepCircle (source->mask, x, y, model->radius, AND, ~PSPHOT_MASK_KEEP);
    7979        if (!status) {
  • trunk/psphot/src/psphotMarkPSF.c

    r4946 r4949  
    2424# define MIN_DS 0.01
    2525
    26 bool psphotMarkPSF (psSource *source, float shapeNsigma, float minSN, float maxChi, float SATURATE)
     26bool psphotMarkPSF (pmSource *source, float shapeNsigma, float minSN, float maxChi, float SATURATE)
    2727{
    2828    int keep;
  • trunk/psphot/src/psphotOutput.c

    r4946 r4949  
    5252
    5353    sprintf (name, "%s.psf.dat", filename);
    54     psModelWritePSFs (sources, name);
     54    pmModelWritePSFs (sources, name);
    5555
    5656    sprintf (name, "%s.flt.dat", filename);
    57     psModelWriteFLTs (sources, name);
     57    pmModelWriteFLTs (sources, name);
    5858
    5959    sprintf (name, "%s.nul.dat", filename);
    60     psModelWriteNULLs (sources, name);
     60    pmModelWriteNULLs (sources, name);
    6161
    6262    sprintf (name, "%s.mnt.dat", filename);
    63     psMomentsWriteText (sources, name);
     63    pmMomentsWriteText (sources, name);
    6464
    6565    psFree (name);
     
    7171
    7272    int i, type, status;
    73     psModel *model;
     73    pmModel *model;
    7474    psF32 *PAR, *dPAR;
    7575    float sky, dmag, apMag, fitMag;
     
    8585    // write sources with models first
    8686    for (i = 0; i < sources->n; i++) {
    87         psSource *source = (psSource *) sources->data[i];
     87        pmSource *source = (pmSource *) sources->data[i];
    8888
    8989        // use the correct model
     
    162162
    163163    int i, status, flags;
    164     psModel *model;
     164    pmModel *model;
    165165    psF32 *PAR, *dPAR;
    166166    float sky, dmag, apMag, fitMag;
     
    176176    // write sources with models first
    177177    for (i = 0; i < sources->n; i++) {
    178         psSource *source = (psSource *) sources->data[i];
     178        pmSource *source = (pmSource *) sources->data[i];
    179179        flags = 0;
    180180
     
    260260
    261261    int i, type, status;
    262     psModel *model;
     262    pmModel *model;
    263263    psF32 *PAR, *dPAR;
    264264    float sky, dmag, apMag, fitMag, lsky, Theta;
     
    282282    // write sources with models first
    283283    for (i = 0; i < sources->n; i++) {
    284         psSource *source = (psSource *) sources->data[i];
     284        pmSource *source = (pmSource *) sources->data[i];
    285285
    286286        // use the correct model
     
    395395
    396396// write the moments to an output file
    397 bool psMomentsWriteText (psArray *sources, char *filename) {
     397bool pmMomentsWriteText (psArray *sources, char *filename) {
    398398
    399399    int i;
    400400    FILE *f;
    401     psSource *source;
     401    pmSource *source;
    402402       
    403403    f = fopen (filename, "w");
    404404    if (f == NULL) {
    405         psLogMsg ("psMomentsWriteText", 3, "can't open output file for moments%s\n", filename);
    406         return false;
    407     }
    408 
    409     for (i = 0; i < sources->n; i++) {
    410         source = (psSource *) sources->data[i];
     405        psLogMsg ("pmMomentsWriteText", 3, "can't open output file for moments%s\n", filename);
     406        return false;
     407    }
     408
     409    for (i = 0; i < sources->n; i++) {
     410        source = (pmSource *) sources->data[i];
    411411        if (source->moments == NULL) continue;
    412412        fprintf (f, "%5d %5d  %7.1f  %7.1f %7.1f  %6.3f %6.3f  %8.1f %7.1f %7.1f %7.1f  %4d %2d\n",
     
    423423
    424424// dump the sources to an output file
    425 bool psModelWritePSFs (psArray *sources, char *filename) {
     425bool pmModelWritePSFs (psArray *sources, char *filename) {
    426426
    427427    double dP, flux;
     
    430430    psVector *params;
    431431    psVector *dparams;
    432     psModel  *model;
     432    pmModel  *model;
    433433
    434434    f = fopen (filename, "w");
    435435    if (f == NULL) {
    436         psLogMsg ("psModelWritePSFs", 3, "can't open output file for moments%s\n", filename);
     436        psLogMsg ("pmModelWritePSFs", 3, "can't open output file for moments%s\n", filename);
    437437        return false;
    438438    }
     
    440440    // write sources with models first
    441441    for (i = 0; i < sources->n; i++) {
    442         psSource *source = (psSource *) sources->data[i];
    443         model = (psModel  *) source->modelPSF;
     442        pmSource *source = (pmSource *) sources->data[i];
     443        model = (pmModel  *) source->modelPSF;
    444444        if (model == NULL) continue;
    445445
     
    459459        dP = sqrt (dP);
    460460       
    461         psModelFlux modelFluxFunc = psModelFlux_GetFunction (model->type);
     461        pmModelFlux modelFluxFunc = pmModelFlux_GetFunction (model->type);
    462462        flux = modelFluxFunc (params);
    463463
     
    489489
    490490// dump the sources to an output file
    491 bool psModelWriteFLTs (psArray *sources, char *filename) {
     491bool pmModelWriteFLTs (psArray *sources, char *filename) {
    492492
    493493    double dP;
     
    496496    psVector *params;
    497497    psVector *dparams;
    498     psModel  *model;
     498    pmModel  *model;
    499499
    500500    f = fopen (filename, "w");
    501501    if (f == NULL) {
    502         psLogMsg ("psModelWriteFLTs", 3, "can't open output file for moments%s\n", filename);
     502        psLogMsg ("pmModelWriteFLTs", 3, "can't open output file for moments%s\n", filename);
    503503        return false;
    504504    }
     
    506506    // write sources with models first
    507507    for (i = 0; i < sources->n; i++) {
    508         psSource *source = (psSource *) sources->data[i];
    509         model = (psModel  *) source->modelFLT;
     508        pmSource *source = (pmSource *) sources->data[i];
     509        model = (pmModel  *) source->modelFLT;
    510510        if (model == NULL) continue;
    511511        if (source->type == PS_SOURCE_GALAXY) goto valid;
     
    551551
    552552// dump the sources to an output file
    553 bool psModelWriteNULLs (psArray *sources, char *filename)
     553bool pmModelWriteNULLs (psArray *sources, char *filename)
    554554{
    555555
     
    563563    }
    564564
    565     psMoments *empty = pmMomentsAlloc ();
     565    pmMoments *empty = pmMomentsAlloc ();
    566566
    567567    // write sources with models first
    568568    for (i = 0; i < sources->n; i++) {
    569         psSource *source = (psSource *) sources->data[i];
     569        pmSource *source = (pmSource *) sources->data[i];
    570570
    571571        // skip these sources (in PSF or FLT)
     
    598598
    599599// translations between psphot object types and dophot object types
    600 int pmSourceDophotType (psSource *source) {
     600int pmSourceDophotType (pmSource *source) {
    601601
    602602    switch (source->type) {
  • trunk/psphot/src/psphotSetup.c

    r4946 r4949  
    7373    float YMIN  = psMetadataLookupF32 (&status, config, "YMIN");
    7474    float YMAX  = psMetadataLookupF32 (&status, config, "YMAX");
    75     psRegion *keep = psRegionAlloc (XMIN, XMAX, YMIN, YMAX);
    76     keep = psRegionForImage (keep, image, keep);
    77     psImageKeepRegion (mask, keep, OR, PSPHOT_MASK_INVALID);
    78     psFree (keep);
     75    psRegion keep = psRegionSet (XMIN, XMAX, YMIN, YMAX);
     76    keep = psRegionForImage (image, &keep);
     77    psImageKeepRegion (mask, &keep, OR, PSPHOT_MASK_INVALID);
     78    // XXX EAM : psRegionForImage should not take psRegion *keep
    7979
    8080    // mask the saturated pixels
  • trunk/psphot/src/psphotSortBySN.c

    r4946 r4949  
    44int psphotSortBySN (const void **a, const void **b)
    55{
    6     psSource *A = *(psSource **)a;
    7     psSource *B = *(psSource **)b;
     6    pmSource *A = *(pmSource **)a;
     7    pmSource *B = *(pmSource **)b;
    88
    99    psF32 fA = (A->moments == NULL) ? 0 : A->moments->SN;
  • trunk/psphot/src/psphotSourceStats.c

    r4946 r4949  
    1919
    2020        // create a new source, add peak
    21         psSource *source = pmSourceAlloc();
    22         source->peak = (psPeak *)psMemCopy(peaks->data[i]);
     21        pmSource *source = pmSourceAlloc();
     22        source->peak = (pmPeak *)psMemCopy(peaks->data[i]);
    2323
    2424        // allocate image, noise, mask arrays for each peak (square of radius OUTER)
  • trunk/psphot/src/psphotSubtractPSF.c

    r4946 r4949  
    44// need to control application of this with some thresholding
    55
    6 bool psphotSubtractPSF (psSource *source)
     6bool psphotSubtractPSF (pmSource *source)
    77{
    88  float sky;
    9   psModel *model;
     9  pmModel *model;
    1010  psImage *pixels;
    1111
  • trunk/psphot/src/pspsf.c

    r4901 r4949  
    1010
    1111// a PSF always has 4 parameters fewer than the equivalent model
    12 pmPSF *pmPSFAlloc (psModelType type) {
     12pmPSF *pmPSFAlloc (pmModelType type) {
    1313
    1414    int Nparams;
     
    1919    psf->chisq = 0.0;
    2020
    21     Nparams = psModelParameterCount (type);
     21    Nparams = pmModelParameterCount (type);
    2222    if (!Nparams) {
    23         psError(PS_ERR_UNKNOWN, true, "Undefined psModelType");
     23        psError(PS_ERR_UNKNOWN, true, "Undefined pmModelType");
    2424        return(NULL);
    2525    }     
     
    5454
    5555    // XXX probably need to increment ref counter
    56     test->modelType   = psModelSetType (modelName);
     56    test->modelType   = pmModelSetType (modelName);
    5757    test->psf         = pmPSFAlloc (test->modelType);
    5858    test->sources     = psMemCopy(sources);
     
    9999    for (int i = 0; i < test->sources->n; i++) {
    100100
    101         psSource *source = test->sources->data[i];
    102         psModel  *model  = pmSourceModelGuess (source, test->modelType);
     101        pmSource *source = test->sources->data[i];
     102        pmModel  *model  = pmSourceModelGuess (source, test->modelType);
    103103        x = source->peak->x;
    104104        y = source->peak->y;
     
    134134        if (test->mask->data.U8[i]) continue;
    135135
    136         psSource *source = test->sources->data[i];
    137         psModel  *modelFLT = test->modelFLT->data[i];
     136        pmSource *source = test->sources->data[i];
     137        pmModel  *modelFLT = test->modelFLT->data[i];
    138138
    139139        // set shape for this model based on PSF
    140         psModel *modelPSF = psModelFromPSF (modelFLT, test->psf);
     140        pmModel *modelPSF = pmModelFromPSF (modelFLT, test->psf);
    141141        x = source->peak->x;
    142142        y = source->peak->y;
     
    185185}
    186186
    187 // input: an array of psModels, pre-allocated psf
     187// input: an array of pmModels, pre-allocated psf
    188188// some of the array entries may be NULL, ignore them
    189189bool pmPSFFromModels (pmPSF *psf, psArray *models, psVector *mask) {
     
    197197
    198198    for (int i = 0; i < models->n; i++) {
    199         psModel *model = models->data[i];
     199        pmModel *model = models->data[i];
    200200        if (model == NULL) continue;
    201201
     
    211211    for (int i = 0; i < psf->params->n; i++) {
    212212        for (int j = 0; j < models->n; j++) {
    213             psModel *model = models->data[j];
     213            pmModel *model = models->data[j];
    214214            if (model == NULL) continue;
    215215            z->data.F64[j] = model->params->data.F32[i + 4];
     
    231231}
    232232
    233 psModel *psModelFromPSF (psModel *modelFLT, pmPSF *psf) {
     233pmModel *pmModelFromPSF (pmModel *modelFLT, pmPSF *psf) {
    234234
    235235    // need to define the relationship between the modelFLT and modelPSF ?
    236236   
    237237    // find function used to set the model parameters
    238     psModelFromPSFFunc modelFromPSFFunc = psModelFromPSFFunc_GetFunction (psf->type);
     238    pmModelFromPSFFunc modelFromPSFFunc = pmModelFromPSFFunc_GetFunction (psf->type);
    239239
    240240    // do we need a different model for the PSF vs FLT version?
    241     psModel *modelPSF = psModelAlloc (psf->type);
     241    pmModel *modelPSF = pmModelAlloc (psf->type);
    242242
    243243    // set model parameters for this source based on PSF information
Note: See TracChangeset for help on using the changeset viewer.