Home »
Public Forums »
archive »
MPFIT question
MPFIT question [message #64701] |
Tue, 13 January 2009 11:33 |
j.coenia@gmail.com
Messages: 36 Registered: December 2008
|
Member |
|
|
I'm fitting data to a gamma variate function using Craig Markwardt's
MPFIT. This has been working great except for a chronic error message
that occurs once every 50 fits or so:
MPFIT: Error detected while calling mpfitfun_eval:
MPFIT: Array dimensions must be greater than 0.
MPFIT: Error condition detected. Returning to MAIN level.
MPFITFUN: Error detected while calling mpfitfun_eval: Array dimensions
must be greater than 0.
Attempt to subscript P with <INT ( 1)> is out of range.
My five parameters are getting lost. The parameters are first passed
to MPFITFUN via the parinfo structure because some are constrained.
Then the parameters are passed along by MPFITFUN to the user-supplied
model function as a double array, p. When the error occurs, the p
array has shrunk from five doubles to just one NaN, as you can see
from the abbreviated output reproduced at the end of this post. The
subscripting error happens when the user-supplied model function tries
to subscript the suddenly nonexistent second element of p, which is
supposed to have five parameters/elements (and had five elements at
all previous iterations). This can happen during any MPFIT iteration,
but usually around iteration 4.
Does anyone know what's going on? I checked to make sure that there
are no NaN values in the data, and that my gamma variate model
function is not producing any NaN values at any iteration. I have the
latest version of the MPFIT library. I've just been catching the
error and fitting the problematic data with IDL's routine, but MPFIT
does a much better job when it works for me. Hopefully someone else
who has encountered this issue knows what I am doing wrong. Thanks.
Iter 1 CHI-SQUARE = 9182.7891 DOF = 353
P DOUBLE = Array[5]
.
.
Iter 2 CHI-SQUARE = 6448.4258 DOF = 353
P DOUBLE = Array[5]
.
.
Iter 3 CHI-SQUARE = 8402.1122 DOF = 353
P DOUBLE = Array[5]
.
.
Iter 4 CHI-SQUARE = 1564.3159 DOF = 353
P DOUBLE = Array[5]
.
.
MPFIT: Error detected while calling mpfitfun_eval:
MPFIT: Array dimensions must be greater than 0.
MPFIT: Error condition detected. Returning to MAIN level.
P DOUBLE = NaN
Attempt to subscript P with <INT ( 1)> is out of range.
|
|
|
Current Time: Wed Oct 08 15:27:05 PDT 2025
Total time taken to generate the page: 0.00522 seconds