Changeset 5643 for trunk/psphot/src/pmSourceFitFixed.c
- Timestamp:
- Nov 30, 2005, 2:32:16 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/pmSourceFitFixed.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/pmSourceFitFixed.c
r5629 r5643 1 1 # include "psphot.h" 2 # define USECLIP 0 2 3 3 bool pmSourceFitFixed (pmSource *source, 4 pmModel *model) 5 { 4 bool pmSourceFitFixed (pmSource *source, pmModel *model) { 5 6 6 PS_ASSERT_PTR_NON_NULL(source, false); 7 7 PS_ASSERT_PTR_NON_NULL(source->peak, false); … … 11 11 PS_ASSERT_PTR_NON_NULL(source->weight, false); 12 12 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; 20 14 21 15 psVector *params = model->params; 22 16 psVector *dparams = model->dparams; 23 psVector *paramMask = NULL;24 17 25 18 pmModelFunc modelFunc = pmModelFunc_GetFunction (model->type); … … 52 45 yErr->data.F32[count] = sqrt (source->weight->data.F32[i][j] * Ro); 53 46 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); 57 50 count++; 58 51 } … … 61 54 psPolynomial1D *poly = psPolynomial1DAlloc (1, PS_POLYNOMIAL_ORD); 62 55 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 66 65 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]; 71 69 72 70 // XXX need to get errors back from psVectorClipFit... … … 82 80 psFree(y); 83 81 psFree(yErr); 82 83 # if (USECLIP) 84 84 psFree(stats); 85 psFree(mask); 86 # endif 85 87 86 88 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
