Changeset 5049 for trunk/psphot/src/pmObjects_EAM.c
- Timestamp:
- Sep 13, 2005, 4:06:55 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/pmObjects_EAM.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/pmObjects_EAM.c
r5048 r5049 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-09-14 0 1:35:20$8 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-09-14 02:06:55 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 102 102 psFree(tmp->peak); 103 103 psFree(tmp->pixels); 104 psFree(tmp-> noise);104 psFree(tmp->weight); 105 105 psFree(tmp->mask); 106 106 psFree(tmp->moments); … … 118 118 tmp->peak = NULL; 119 119 tmp->pixels = NULL; 120 tmp-> noise= NULL;120 tmp->weight = NULL; 121 121 tmp->mask = NULL; 122 122 tmp->moments = NULL; … … 662 662 pmSource->peak 663 663 pmSource->pixels 664 pmSource-> noise664 pmSource->weight 665 665 pmSource->mask 666 666 … … 678 678 // PS_PTR_CHECK_NULL(source->peak, NULL); 679 679 // PS_PTR_CHECK_NULL(source->pixels, NULL); 680 // PS_PTR_CHECK_NULL(source-> noise, NULL);680 // PS_PTR_CHECK_NULL(source->weight, NULL); 681 681 PS_FLOAT_COMPARE(0.0, radius, NULL); 682 682 … … 736 736 // XXX EAM : check for valid S/N in pixel 737 737 // XXX EAM : should this limit be user-defined? 738 if (pDiff / sqrt(source-> noise->data.F32[row][col]) < 1) continue;738 if (pDiff / sqrt(source->weight->data.F32[row][col]) < 1) continue; 739 739 740 740 Sum += pDiff; … … 1461 1461 PS_ASSERT_PTR_NON_NULL(source->pixels, false); 1462 1462 PS_ASSERT_PTR_NON_NULL(source->mask, false); 1463 PS_ASSERT_PTR_NON_NULL(source-> noise, false);1463 PS_ASSERT_PTR_NON_NULL(source->weight, false); 1464 1464 psBool fitStatus = true; 1465 1465 psBool onPic = true; 1466 1466 psBool rc = true; 1467 1467 1468 // XXX EAM : is it necessary for the mask & noiseto exist? the1468 // XXX EAM : is it necessary for the mask & weight to exist? the 1469 1469 // tests below could be conditions (!NULL) 1470 1470 … … 1508 1508 x->data[tmpCnt] = (psPtr *) coord; 1509 1509 y->data.F32[tmpCnt] = source->pixels->data.F32[i][j]; 1510 yErr->data.F32[tmpCnt] = sqrt (source-> noise->data.F32[i][j]);1510 yErr->data.F32[tmpCnt] = sqrt (source->weight->data.F32[i][j]); 1511 1511 // XXX EAM : note the wasted effort: we carry dY^2, take sqrt(), then 1512 1512 // the minimization function calculates sq() … … 1576 1576 } 1577 1577 1578 // XXX EAM : new version with parameter range limits and noiseenhancement1578 // XXX EAM : new version with parameter range limits and weight enhancement 1579 1579 bool pmSourceFitModel (pmSource *source, 1580 1580 pmModel *model, … … 1586 1586 PS_ASSERT_PTR_NON_NULL(source->pixels, false); 1587 1587 PS_ASSERT_PTR_NON_NULL(source->mask, false); 1588 PS_ASSERT_PTR_NON_NULL(source-> noise, false);1589 1590 // XXX EAM : is it necessary for the mask & noiseto exist? the1588 PS_ASSERT_PTR_NON_NULL(source->weight, false); 1589 1590 // XXX EAM : is it necessary for the mask & weight to exist? the 1591 1591 // tests below could be conditions (!NULL) 1592 1592 … … 1602 1602 pmModelFunc modelFunc = pmModelFunc_GetFunction (model->type); 1603 1603 1604 // XXX EAM : I need to use the sky value to constrain the noisemodel1604 // XXX EAM : I need to use the sky value to constrain the weight model 1605 1605 int nParams = PSF ? params->n - 4 : params->n; 1606 1606 psF32 So = params->data.F32[0]; … … 1641 1641 ymodel = modelFunc (NULL, model->params, coord); 1642 1642 1643 // this test enhances the noisebased on deviation from the model flux1643 // this test enhances the weight based on deviation from the model flux 1644 1644 Ro = 1.0 + fabs (y->data.F32[tmpCnt] - ymodel) / sqrt(PS_SQR(ymodel - So) + PS_SQR(So)); 1645 1645 1646 // XXX EAM : note the wasted effort: we carry dY^2, take sqrt(), then 1647 // the minimization function calculates sq(). 1648 // should psMinimizeLMChi2 take dY^2? 1649 yErr->data.F32[tmpCnt] = sqrt (source->noise->data.F32[i][j] * Ro); 1646 // psMinimizeLMChi2_EAM takes wt = 1/dY^2 1647 if (source->weight->data.F32[i][j] == 0) { 1648 yErr->data.F32[tmpCnt] = 0.0; 1649 } else { 1650 yErr->data.F32[tmpCnt] = 1.0 / (source->weight->data.F32[i][j] * Ro); 1651 } 1650 1652 tmpCnt++; 1651 1653 } … … 1708 1710 if (paramMask != NULL) { 1709 1711 psVector *delta = psVectorAlloc (params->n, PS_TYPE_F64); 1710 psMinimizeGaussNewtonDelta (delta, params, NULL, x, y, yErr, modelFunc);1712 psMinimizeGaussNewtonDelta_EAM (delta, params, NULL, x, y, yErr, modelFunc); 1711 1713 for (int i = 0; i < dparams->n; i++) { 1712 1714 if (!paramMask->data.U8[i]) continue;
Note:
See TracChangeset
for help on using the changeset viewer.
