[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
!ERR and MPFIT
When I set out to translate MPFIT from MINPACK, I wanted to stay as
faithful as possible, but I also wanted it to be as simple as
possible. When it came to error handling, I wanted the user's model
routine to be able to report an error condition.
Unfortunately I chose to use the !ERR system variable. If !ERR is set
to a negative number, then MPFIT aborts the run, assuming that there
was an unrecoverable error.
I now realize that using !ERR was probably a mistake. Why? RSI seems
to want to make it obsolete. Through their error-handling flavor of
the month program, !ERR seems to have fallen out of favor. Also,
there are quite a few actions which might set !ERR accidentally in the
user's function without actually signalling an error condition.
So I have two questions:
* to people who use MPFIT: does anybody actually use the !ERR status
variable to control the fitting process? If not, then I would
consider removing it.
* to everybody: any suggestions on how to generically signal an error
condition? My thoughts were:
- ERROR keyword variable - don't like this, since then the
function has to accept keywords
- define a new system variable - don't like this either, since
it's hard to do system variables right
- common block variable - not very pretty, but gets the job done.
To be clear, this is some kind of error flag that a user routine would
(optionally!) set to signal an abnormal termination condition. Right
now I am leaning toward the common-block approach. Sorry David.
Thanks,
Craig
--
--------------------------------------------------------------------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
--------------------------------------------------------------------------