[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Convolution of Stick Spectra

Hi Todd

It helps a bit to pre-calculate your variance term.
Cuts execution time from 27 to 18 seconds on my PC.

variance_term= ( ( (.12*sqrt(energy/1000))/1.6651)*1000)^2
FOR indx=0L,nstick-1 DO BEGIN
   result = result + intensity[indx]* $
               exp(-((energy_scale - energy[indx])^2)/
variance_term[indx] )

Nothing else springs to mind.  Your energy dependent
width is a real problem ie. can't use single FFT for

If precision isn't a major issue, you could pre-calculate
Gaussians for each energy bin (2048 of them) and just
multiply by the appropriate intensities.  Only useful
if you'll be reading in lots of different spectra in
each run.

It'll be interesting to see what others come up with...

				Brian Jackel

Todd Clements wrote:
> Hi all...
> In my on-going effort to speed up the code in our lab, I have another
> 'challenge' for you (I have to put 'challenge' in quotes because it seems
> that no matter what I ask, someone knows the ansewr off (or at least
> nearly off) the top of their head!)
> We have a situation where we need to convolute (with energy dependent
> gaussians) a number of stick spectra on a well-defined energy axis. The
> stick spectra are read in from another program as a 2-dimensional array,
> using ddread. The [0,*] elements are the energies of the sticks, and the
> [1,*] values are the intensities. These have no inherent spacing, they are
> just calculated intensities at whatever energy the calculation returns.