[SciPy-User] Voigt function?

Christian K. ckkart at hoc.net
Sun Jan 30 11:29:14 EST 2011


Am 30.01.11 12:33, schrieb Thøger Emil Juul Thorsen:
> Hello Scipy-gurus;
>
> I was wondering if there was any scipy Voigt profile function out there,
> similar to the one that exists for IDL which takes in the values of A
> and U...?
>
> It would be immensely helpful to be able to quickly and flexibly plot
> the function for different values to explain e.g. the curve of growth
> etc., without having to go to a university computer running IDL.


I have been using scipy.special.wofz for quite a while:

from scipy import special

def voigt(x,amp,pos,fwhm,shape):
     """\
voigt profile

V(x,sig,gam) = Re(w(z))/(sig*sqrt(2*pi))
z = (x+i*gam)/(sig*sqrt(2))
     """

     tmp = 1/special.wofz(N.zeros((len(x))) \
           +1j*N.sqrt(N.log(2.0))*shape).real
     tmp = tmp*amp* \
           special.wofz(2*N.sqrt(N.log(2.0))*(x-pos)/fwhm+1j* \
           N.sqrt(N.log(2.0))*shape).real
     return tmp

Regards, Christian




More information about the SciPy-User mailing list