IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 13, 2005, 4:06:55 PM (21 years ago)
Author:
eugene
Message:

changed noise to weight, psImageData to eamReadout

File:
1 edited

Legend:

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

    r5048 r5049  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-09-14 01:35:20 $
     8 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-09-14 02:06:55 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    102102    psFree(tmp->peak);
    103103    psFree(tmp->pixels);
    104     psFree(tmp->noise);
     104    psFree(tmp->weight);
    105105    psFree(tmp->mask);
    106106    psFree(tmp->moments);
     
    118118    tmp->peak = NULL;
    119119    tmp->pixels = NULL;
    120     tmp->noise = NULL;
     120    tmp->weight = NULL;
    121121    tmp->mask = NULL;
    122122    tmp->moments = NULL;
     
    662662    pmSource->peak
    663663    pmSource->pixels
    664     pmSource->noise
     664    pmSource->weight
    665665    pmSource->mask
    666666 
     
    678678    // PS_PTR_CHECK_NULL(source->peak, NULL);
    679679    // PS_PTR_CHECK_NULL(source->pixels, NULL);
    680     // PS_PTR_CHECK_NULL(source->noise, NULL);
     680    // PS_PTR_CHECK_NULL(source->weight, NULL);
    681681    PS_FLOAT_COMPARE(0.0, radius, NULL);
    682682
     
    736736            // XXX EAM : check for valid S/N in pixel
    737737            // 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;
    739739           
    740740            Sum += pDiff;
     
    14611461    PS_ASSERT_PTR_NON_NULL(source->pixels, false);
    14621462    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);
    14641464    psBool fitStatus = true;
    14651465    psBool onPic     = true;
    14661466    psBool rc        = true;
    14671467
    1468     // XXX EAM : is it necessary for the mask & noise to exist?  the
     1468    // XXX EAM : is it necessary for the mask & weight to exist?  the
    14691469    //           tests below could be conditions (!NULL)
    14701470
     
    15081508                x->data[tmpCnt] = (psPtr *) coord;
    15091509                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]);
    15111511                // XXX EAM : note the wasted effort: we carry dY^2, take sqrt(), then
    15121512                //           the minimization function calculates sq()
     
    15761576}
    15771577
    1578 // XXX EAM : new version with parameter range limits and noise enhancement
     1578// XXX EAM : new version with parameter range limits and weight enhancement
    15791579bool pmSourceFitModel (pmSource *source,
    15801580                       pmModel *model,
     
    15861586    PS_ASSERT_PTR_NON_NULL(source->pixels, false);
    15871587    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 & noise to exist?  the
     1588    PS_ASSERT_PTR_NON_NULL(source->weight, false);
     1589
     1590    // XXX EAM : is it necessary for the mask & weight to exist?  the
    15911591    //           tests below could be conditions (!NULL)
    15921592
     
    16021602    pmModelFunc modelFunc = pmModelFunc_GetFunction (model->type);
    16031603
    1604     // XXX EAM : I need to use the sky value to constrain the noise model
     1604    // XXX EAM : I need to use the sky value to constrain the weight model
    16051605    int nParams = PSF ? params->n - 4 : params->n;
    16061606    psF32 So = params->data.F32[0];
     
    16411641                ymodel = modelFunc (NULL, model->params, coord);
    16421642               
    1643                 // this test enhances the noise based on deviation from the model flux
     1643                // this test enhances the weight based on deviation from the model flux
    16441644                Ro = 1.0 + fabs (y->data.F32[tmpCnt] - ymodel) / sqrt(PS_SQR(ymodel - So) + PS_SQR(So));
    16451645
    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                }
    16501652                tmpCnt++;
    16511653            }
     
    17081710    if (paramMask != NULL) {
    17091711        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);
    17111713        for (int i = 0; i < dparams->n; i++) {
    17121714            if (!paramMask->data.U8[i]) continue;
Note: See TracChangeset for help on using the changeset viewer.