Edit IPF files to add baseline functions into multi peak package? Version 6.3.7.2

I'm new to igor programming, but am in need of a simple exponential baseline in the multi peak package.

The situation is exponentially falling noise and gaussian signal peaks. This is a convolution right? Is there any difference between making a exponential baseline function and using the gaussian peak fitting vs using the ExpModGaus already present?

If so and a function needs to be added should I be modifying the PeakFunction2 procedural file? I can't seem to do that. All my permissions are "writable" for folders and files and it isn't open in another experiment.

Thanks for any help,

Mark
The IPF files contained within the Multi Peak Fitting 2 package shouldn't be modified themselves, but you can make your own procedure file that effectively adds on your own custom functions. The function names you use just have to be named in a way that the package realized that you're writing functions for its use. The help file (Multi-peak Fitting 2 Help.ipf) is very useful.

If I understand correctly, you're not talking about a convolution (a convolution is like two functions smeared onto each other). Instead you're talking about some exponential background added to some gaussian signal. I've attached a procedure here that will add that baseline function to your Multi Peak Fitting 2 package options. Be sure you load this IPF file after loading the Multi Peak Fitting 2 package, and after you say "compile" on the procedure, the "Exponential" option will be added to your baseline options. You need to enter reasonable values for the fitting coefficients, especially the decay parameter "tau." See the files I attached.
ajleenheer is right about the help files and how to add a new baseline function. You should be aware that there is no auto guessing for baseline functions, so when you use your own you will need to edit the initial guesses in the peak list.

But you also seem to be somewhat confused about baselines and peak shapes. The baseline function is a curve that stretches over the entire width of the data you're fitting. The peaks are added to the baseline, so they sort of sit on top of the baseline.

The ExpModGauss peak shape does not have any sort of baseline to it- it is just a peak shape formed by a convolution of a Gaussian peak with an exponential. That convolution gives it an asymmetric shape- the tails are longer on one side than the other. If you really want an exponential baseline (which I suspect you really do) then use ajleenheer's solution for that. And tell him thank you because these things can be tough to figure out and get right!

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Ah, a much quicker response than I was expecting (asked before finals). You are both right about my confusion and thanks for explaining the difference.

ajleenheer, that was exactly what I was looking for so thanks for the links.

Now I am only fiddling with taking the integral of those fitted peaks with the baseline subtracted. However, there seems to be some confusion in calculating the sum between cursors in the baseline-subtracted file one gets from the multi-peak fitting. I frequently get the result that a larger spacing between cursors gets a smaller sum in my histogram data or the the sum of the total counts in a wave matches the sum of a smaller range within that wave.

I need to look further for a better tool rather than just 'Wave Stats' between cursors I think. The goal is the number of counts in a peak minus said baseline.

Sorry for the late confirmation of satisfaction with the responses.
When you use Multipeak Fit to fit a bunch of peaks over a baseline, the peaks represent only the peak, not the baseline. So the area of a peak as reported by MPF2 should be what you're looking for. You may need to apply some calibration factor to go from area to counts, but you don't need to worry that it includes baseline.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Instead of applying some calibration and getting the counts from the area, would I get the same result by taking the wave fitted minus the baseline over the x-range of the peak?
My attached jpg shows the sum of the peak itself and the sum of the wave minus the baseline between cursors roughly at the ends of the peak. The area of the peak is much greater in this case. (sorry that it is small and in the lower left corner)

Thanks for all the explanations (and patience).
I'm not exactly sure what you're doing with those curves. WaveStats doesn't give you area.

You say, "The area of the peak is much greater in this case." I suspect that you are neglecting the X scale. Consider a box of height 1 and width (in X) of .1. The area is, of course, 0.1, but if you were to simply add up a bunch of samples from the top of the box (the Y values, as it were) you would get an "area" much larger than the actual area.

There are also inaccuracies in what you are trying to do: the peaks have significant tails beyond the cursors you have set. The peaks have signicant overlap, so the minimum points between the peaks are elevated above the baseline because the peaks still have significant intensity there. And Peak 0 is truncated on the left where it fall outside the range of the graph.

The overlapping peaks is one of the advantages of fitting peaks+baseline: you get a better estimate of the baseline than you would by connecting the minimum points.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
johnweeks wrote:
I suspect that you are neglecting the X scale.

Exactly -- simply summing the y values isn't the same thing as the peak area. Gotta account for the "dx" in the integral.

Another handy feature in the MultiPeakFit is after you do the fit, press "peak results" then "baseline-subtracted data" which makes a new wave of your data minus the baseline. If you plot that new data, it's easier to play around with cursors to estimate peak areas based on counts, WaveStats, delta x values, etc.