No Output in Fitting with Convolution - Intermediate Free Wave Not Fully Populating

Hi all,

I'm working with some time-resolved spectroscopy data where my signal is the sum of three exponential functions and my IRF is a Gaussian that I am convolving with said signal. My data extends up to 3000 ps, and my three time constants are ~1.5 ps, ~120 ps, and one is fixed at 10,000 ps based on information from the literature.

I successfully adapted the procedure on pp. III-257 to III-260 of the manual to work with other data sets where there isn't such a disparity between the time constants (60 ps and 380 ps), but it keeps failing for this. I click "Graph Now" in the curve fitting dialog and nothing happens, or I click "Do It" and it freezes. I opened the debugger and found that the free wave that's supposed to be my signal has a lot of blank spaces at the beginning of the wave, then a lot of 0's (as it's supposed to have for the convolution to work), then the non-zero values at x>=0 (again, as it's supposed to). But then when it reaches the Convolve/A step, the output wave is completely blank.

Am I simply exceeding the maximum number of points in a free wave due to the small dT arising from the shortest time constant and the large maximum time based on the longest time constant? Is there a better overall strategy for fitting the sum of exponentials with convolution when the exponentials have vastly different time constants?

 

Thanks in advance!

Will

Update:

I tried with only two exponentials with closer-together time constants and set resolutionFactor to 1, so now there are only 12001 points in the wave, and still:

When the free wave is created, all points are populated with "0."

When the following line is executed:

expwave = (x>=0)*((abs(pw[1])*(exp(-(x)/pw[4]))+abs(pw[5])*exp(-(x)/pw[6])+abs(pw[0])))

All of a sudden, entries 0 through 677 become blank. No zeroes, no nothing.

Nevermind, I had copied the following bits from the section in the manual I referenced without changing them:

Make/D/FREE/O/N=(nExpWavePnts) expwave

Variable nYPnts = max(resolutionFactor*numpnts(yw), nExpWavePnts)
Make/D/FREE/O/N=(nYPnts) yWave // Double-precision free wave
SetScale/P x -dT*(nExpWavePnts/2),dT,expwave
SetScale/P x xw[0],dT, yWave

Swapping the waves in SetScale seems to have solved the problem. I guess it makes sense, since in the example in the manual the Gaussian is the signal and is convolved with the exponential, but here it is the other way around.

Hello Will,

you fixed the bug, but may be some explanation would help in the future.

When you see "missing numbers", these are NaNs (not a number) in Igor and it means, that your calculation does not result in meaningful number for that wave type. Basically, your results made no sense for some parameters. And this is something which you must prevent when doing fitting as FuncFit fails if you get not a number (and should report so).

Finding bugs which result - for some combination of parameters - in NaNs inside fitting functions is challenging.  Testing the code for extreme range of parameters you allow (using limits, for example) is usually helpful. There are Igor help topics for all of this, you can browse them through Igor help browser. 

To debug code that produces NaNs, I often use a bit of code like this:

    if (numtype(myVariable))
        print "Oops."
    endif

Now you can put a breakpoint on the print line to inspect the situation that makes NaNs.