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

Home » Public Forums » archive » Voigt function fit using MPFIT
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: Voigt function fit using MPFIT [message #86115 is a reply to message #86086] Mon, 07 October 2013 18:39 Go to previous messageGo to previous message
Sreelakshmi S is currently offline  Sreelakshmi S
Messages: 8
Registered: April 2013
Junior Member
On Wednesday, October 2, 2013 4:42:55 PM UTC+5:30, Sreelakshmi S wrote:
> Hi,
>
>
>
> I have a set of observed data of flux vs wavelength.I am trying MPFIT to fit a voigt function. I defined the function as
>
>
>
> FUNCTION fit,p,X=x2,Y=nflux2
>
>
>
> model=double((voigt(p[0],p[1])*1e-13)/(p[3]*sqrt(!pi)))
>
> return,(Y-model)/err
>
>
>
> END
>
>
>
> But when I run this, the following errors are coming
>
>
>
> FUNCTION fit,x2=X,nflux2=Y,p
>
> ^
>
> % Programs can't be compiled from single statement mode.
>
>
>
>
>
> return,(Y-model)/1
>
> ^
>
> % Syntax error.
>
>
>
> Why is this happening?

Hi,
Thank you for your inputs.
I have modified the function as

FUNCTION voigtfit,p,x,y,er

lambda1=1025.7230
gamma1=1.897e08
f1=2.638e-2

av1=double((gamma1*lambda1*1e-13)/(4*!pi*p[0]))
u1=(y/p[0])-(p[1]/p[0])
dop1=double(p[0]/lambda1)

phi1=double((voigt(av1,u1)*1e-13)/(dop1*sqrt(!pi)))
tau1=double(2.654e-02*p[2]*f1*phi1)
model1=double(exp(-tau1))
return,(y-model1)/er
END

and I am calling this function from IDL as below

fac={X:vel,Y:nflux2,ERR:dy}
result=double(mpfit('voigtfit',p,functargs=fac))

Now when I run this an error comes
% MPFIT: Error detected while calling voigtfit:
% MPFIT:Keyword parameter not allowed in call.
% MPFIT: Error condition detected. Returning to main level.

Which is the keyword here? What is this error?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: plotting different sized circles
Next Topic: ENVI kml file generation

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

Current Time: Wed Oct 08 15:50:10 PDT 2025

Total time taken to generate the page: 0.00383 seconds