comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Missing data and MPFITFUN
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Missing data and MPFITFUN [message #50924 is a reply to message #50920] Mon, 23 October 2006 07:20 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Allan Whiteford writes:

> Set the weight of the missing data values to zero when doing the fit.

Humm. There must be more to it than that. -(
Consider this test program:

PRO TEST
npts = 101
time = Findgen(npts)
signal = 4.3 * Findgen(npts)^2.52
noisySignal = (Randomu(-3L, N_Elements(signal)) - 0.5) * 50000L + $
signal
noisySignal[ [ 3, 5, 22, 54, 66, 87] ] = !VALUES.F_NAN
Plot, time, noisySignal, PSym=2
model = 'p[0] * x^p[1]'
error = Replicate(100, npts)
params = [1.0,2.0]
weights = Replicate(1.0, npts)
weights[ [ 3, 5, 22, 54, 66, 87] ] = 0.0
fit = MPFITEXPR(model, time, noisySignal, error, params, $
WEIGHTS=weights)
OPlot, time, fit[0] * Findgen(npts)^fit[1]
END

If you comment out the line where I set certain values
to !VALUES.F_NAN the program works great. If I leave
the line uncommented, it doesn't work so well, even
though the WEIGHTS have been set to 0. :-(

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Title in iPlot
Next Topic: Re: Postscript and MikTeX 2.5

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 09:14:57 PDT 2025

Total time taken to generate the page: 1.44071 seconds