IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 30, 2005, 2:32:16 PM (21 years ago)
Author:
eugene
Message:

adding fixed-psf fitting

File:
1 edited

Legend:

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

    r5629 r5643  
    11# include "psphot.h"
     2# define USECLIP 0
    23
    3 bool pmSourceFitFixed (pmSource *source,
    4                        pmModel *model)
    5 {
     4bool pmSourceFitFixed (pmSource *source, pmModel *model) {
     5
    66    PS_ASSERT_PTR_NON_NULL(source, false);
    77    PS_ASSERT_PTR_NON_NULL(source->peak, false);
     
    1111    PS_ASSERT_PTR_NON_NULL(source->weight, false);
    1212
    13     // XXX EAM : is it necessary for the mask & weight to exist?  the
    14     //           tests below could be conditions (!NULL)
    15 
    16     psBool fitStatus = true;
    17     psBool onPic     = true;
    18     psBool rc        = true;
    19     psF32  Ro, ymodel;
     13    psF32 Ro, ymodel;
    2014
    2115    psVector *params = model->params;
    2216    psVector *dparams = model->dparams;
    23     psVector *paramMask = NULL;
    2417
    2518    pmModelFunc modelFunc = pmModelFunc_GetFunction (model->type);
     
    5245            yErr->data.F32[count] = sqrt (source->weight->data.F32[i][j] * Ro);
    5346
    54             psVectorExtend (x, 1, 100);
    55             psVectorExtend (y, 1, 100);
    56             psVectorExtend (yErr, 1, 100);
     47            psVectorExtend (x,    100, 1);
     48            psVectorExtend (y,    100, 1);
     49            psVectorExtend (yErr, 100, 1);
    5750            count++;
    5851        }
     
    6154    psPolynomial1D *poly = psPolynomial1DAlloc (1, PS_POLYNOMIAL_ORD);
    6255
    63     // psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
    64     // stats->clipIter = 3;
    65     // poly = psVectorClipFitPolynomial1D (poly, stats, NULL, 0, y, yErr, x);
     56# if (USECLIP)
     57    psVector *mask = psVectorAlloc (count, PS_TYPE_U8);
     58    psVectorInit (mask, 0);
     59    psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
     60    stats->clipIter = 3;
     61    poly = psVectorClipFitPolynomial1D (poly, stats, mask, 0, y, yErr, x);
     62# else
     63    poly = psVectorFitPolynomial1D (poly, NULL, 0, y, yErr, x);
     64# endif
    6665
    67     poly = psVectorFitPolynomial1D (poly, stats, NULL, 0, y, yErr, x);
    68 
    69     params->data.F32[0] = poly->coeff[0];
    70     params->data.F32[1] = poly->coeff[1];
     66    // fitted values are variations from current values
     67    params->data.F32[0] += poly->coeff[0];
     68    params->data.F32[1] *= poly->coeff[1];
    7169
    7270    // XXX need to get errors back from psVectorClipFit...
     
    8280    psFree(y);
    8381    psFree(yErr);
     82
     83# if (USECLIP)
    8484    psFree(stats);
     85    psFree(mask);
     86# endif
    8587
    8688    return true;
Note: See TracChangeset for help on using the changeset viewer.