IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 18, 2006, 8:30:56 PM (20 years ago)
Author:
magnier
Message:

added NaN tests to psMinimizeLMM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/rel10_ifa/psLib/src/math/psMinimizeLMM.c

    r6431 r6898  
    1010 *  @author EAM, IfA
    1111 *
    12  *  @version $Revision: 1.5.6.1 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2006-02-16 08:01:04 $
     12 *  @version $Revision: 1.5.6.2 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2006-04-19 06:30:56 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2323#include <math.h>
    2424
     25#include "psAbort.h"
    2526#include "psMinimizeLMM.h"
    2627#include "psImage.h"
     
    174175    psF64 rcF64 = p_psMinLM_SetABX(alpha, beta, params, paramMask, x, y, dy, func);
    175176    if (isnan(rcF64)) {
    176         psError(PS_ERR_UNKNOWN, false, "p_psMinLM_SetABX() retruned a NAN.\n");
     177        psError(PS_ERR_UNKNOWN, false, "p_psMinLM_SetABX() returned a NAN.\n");
    177178        rc = false;
    178179    }
     
    181182    psBool rcBool = p_psMinLM_GuessABP(Alpha, delta, Params, alpha, beta, params, paramMask, NULL, NULL, NULL, 0.0);
    182183    if (rcBool == false) {
    183         psError(PS_ERR_UNKNOWN, false, "p_psMinLM_GuessABP() retruned FALSE.\n");
     184        psError(PS_ERR_UNKNOWN, false, "p_psMinLM_GuessABP() returned FALSE.\n");
    184185        rc = false;
    185186    }
     
    255256        delta = ymodel - y->data.F32[i];
    256257        chisq += PS_SQR(delta) * dy->data.F32[i];
     258        if (isnan(dy->data.F32[i]))
     259            psAbort ("psMinLMM", "nan in weights");
     260        if (isnan(delta))
     261            psAbort ("psMinLMM", "nan in delta");
     262        if (isnan(chisq))
     263            psAbort ("psMinLMM", "nan in chisq");
    257264
    258265        for (psS32 j = 0; j < params->n; j++) {
     
    432439        // calculate Chisq for new guess, update Alpha & Beta
    433440        Chisq = p_psMinLM_SetABX(Alpha, Beta, Params, paramMask, x, y, dy, func);
     441        if (isnan(Chisq)) {
     442            min->iter ++;
     443            lambda *= 10.0;
     444            continue;
     445        }
    434446
    435447        // XXX EAM alternate convergence criterion:
Note: See TracChangeset for help on using the changeset viewer.