Gaussian line profile using numeric python

Konrad Hinsen hinsen at cnrs-orleans.fr
Thu Mar 29 06:45:02 EST 2001


"Geoff Low" <geoff at ou043085.otago.ac.nz> writes:

> I have an extensive set of xy data that I want to convolute with a gaussian
> profile.  Below is my algorithm,  which doesn't work.  Can anyone see where
> I'm being dumb?

To be honest, I am too lazy to look through this. However,

1) The function Numeric.convolve is certainly a lot more efficient
   than your code, and should make it simpler.

2) If you work with large data sets, you ought to use FFTs to
   compute the convolution, that's O(N*log(N)) in the size of the
   data set, instead of O(N**2) for the straightforward method.
   Any good book on FFTs should explain how this works in detail.

> P.S.  I'm no math wizard but this is my interpretation of the gaussian lineshape
> function
> G(v) = 1/(sqrt(2*PI)*FWHM)*exp(-(v-vo)^2/(2*FWHM^2))

Assuming that FWHM stands for full width at half minimum, no, it's not
correct. What you call FWHM is the variance sigma of the Gaussian, the
FWHM is around 2.35*sigma (quick calculation, no guarantee).
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen at cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------



More information about the Python-list mailing list