Gaussian line profile using numeric python

Tim Hochberg tim.hochberg at ieee.org
Thu Mar 29 10:45:12 EST 2001


Like Konrad, I'm too lazy to completely figure this out, but I do have some
comments on it below.

Konrad Hinsen is ">"
Geoff Low is ">>":
>
> > 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,

Ditto. However some thoughts / questions. Is your data evenly spaced in x?
If it is you might want to pass in deltaX instead of x to make that clear.
If it's not, you're going to need a considerably more sophisticated
algorithm. If it is, go with Numeric.convolve as Konrad suggests.

> 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.

One thing to watch for is that convolution using FFT makes an implicit
assumption that your data is periodic. If it's not, and you want to try this
route, look up zero padding  in that FFT book that I'm _sure_ you'll consult
before you try this <0.5 wink>.

-tim





More information about the Python-list mailing list