[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Perform Gauss-broadening on line spectrum
From: |
Maxim Gawrilow |
Subject: |
Perform Gauss-broadening on line spectrum |
Date: |
Wed, 28 Aug 2019 14:57:38 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
Dear Octave users,
I have created a bunch of spectral lines and would like to simulate the
Gaussian broadened spectrum of these. The spectral lines are a Nx2
matrix where the first column contains the position and the second the
intensity of each line. What I want is to place a Gaussian at each
position, scale it with the appropriate intensity and calculate the sum.
In theory, this code would do the job:
gauss = @(x,x0,Int,sigma)
Int./(sigma.*sqrt(2*pi)).*exp(-0.5*((x-x0)./sigma).^2);
x = linspace (0, 4000, 20000);
outdata = sum(gauss(x,inputdata(:,1),inputdata(:,2),0.8),1);
exportdata = [x', outdata'];
However, inputdata contains quite a few lines: at least half a million,
sometimes even several dozen million entries. Execution of said code
results in "out of memory of dimension too large for Octave's index
type". Therefore I'd need a different approach.
I am able to get the correct result in gnuplot with
plot "inputdata" smooth kdensity bandwidth 0.8
but this is extremely slow. Already for half a million entries it takes
5 minutes for a single plot, and will obviously take hours to compute
cases with dozens of millions of entries.
Does anyone have an idea of speeding up this process? I guess
convolution with a Gaussian would be a correct approach as well, but I
didn't find any function that suits my case (conv only takes equidistant
vectors, and I'm a bit of a loss at understanding kernel_density from
econometrics).
With kind regards, Maxim
--
Maxim Gawrilow
Georg-August-Universität Göttingen
Institut für Physikalische Chemie
AG Suhm
Tammannstr. 6
37077 Göttingen
- Perform Gauss-broadening on line spectrum,
Maxim Gawrilow <=