Auto MultiPeak Fitting (User Interface) and Negative Peaks


I am looking to run through a large number of NIR spectra and from the MultiPeakFit I am getting acceptable fits with using negative peaks on singular spectra. Fine no problem.  I would like to use the MultiPeakFIt User Interface to no further test on a larger set to further test consistency of results.  But it is giving errors in the fit "-15: Fit resulted in NaN or Inf."

I am using option 5 on auto-guess, but I see no option to allow for negative peaks and my guess is it is not happening and hence the error.

My test is a single spectra run through Multipeak Git 1.2 and then the same wave in the Auto Multipeak interface.

Is my hunch correct and if so is there a remedy or should I look elsewhere for potential mess ups on my part?


I'm not sure what your reference to Git is about. I presume you're using Multipeak Fit 2 with IP 8, or perhaps the vastly improved Multipeak Fit in IP 9 (thank you, chozo!). I also presume that you are trying to use MPF2AutoMPFit() to do batch peak fitting.

Indeed, the automatic peak picker doesn't actually know anything about negative peaks; that functionality in the UI for Multipeak Fit is bodged in by inverting the Y data before doing the auto peak detection. That bit of trickery was omitted from MPF2AutoMPFit(), which was meant partly as a starting point for Igor users to write their own. But it has now taken on a life of its own, including sprouting a UI (again, thank you, chozo!).

So you have two choices at present: invert your data sets before applying the peak detector, or supply your own initial guesses. If a single initial guess from one of your data sets will work for all the data sets, then you can use the option that uses a supplied initial guess and applies it to all data sets. The UI in IP9 makes this all quite a bit easier, including a new facility for converting between MPF UI sets and the data folders created by MPF2AutoMPFit(). If you want that, you will need the latest update of IP9 beta, plus ask me or chozo for the latest MPF files.


I am using IP9 Beta with the new interface.  I did the workaround of inverting the incoming spectra so I am good for now.


Are you fitting transmittance spectra for the peaks to be negative? What is the lineshape?


I am guessing it is transmission.  The client is a bit vague.  I am playing around with Gaussians to start.  I have series of samples that have had supposedly minor modifications so I focusing on differences in the scans.  There is other metrology data and the goal is to see if there is correlation where we could use the NIR spectra as an in situ monitor.  So my goal is not so much complete understanding of the spectra but more correlation analysis and predictive modeling.


In reply to by hegedus

If decomposition of the spectra into realistic components plays a part in this, you might think about converting to absorbance (A=log(1/T)) and fitting (positive) Gaussian or Voigt peaks.

Just to chime in on the fundamentals ... The baseline in IR can/will vary, sometime significantly, simply because a sample changes position. So the spectrum will change even when the sample chemistry does not change.

This is also the point where folks may start to whisper in your ear about the advantages of doing PCA and its analogs.

Finally, as Tony says ... convert to absorbance rather than transmittance even for something as simple as taking differences (or ratios) of spectra as a function of changes in sample conditions.

Hi Andy, I guess you can look forward to a small update which implements negative peak guessing. :)

Hi Chozo,

If I could put in a feature request is a bit more data tracking provenance. The base folder naming structure doesn't have direct obvious link to the waves processed.  You need to go back and attach names.  One idea is to include the y wave and x wave full path in the wave note of the peaks and baseline,...

This would make it easier to follow what what is what in the work flow.  Otherwise this a terrific tool and thank you very much for putting it together.


Hi Andy, that is certainly a good idea. I will discuss with John what would be a good solution. BTW, note that I only provided the graphical user interface, and the underlying MPF2_AutoMPFit() code, which does all the heavy lifting, is mostly John's hard work.

I've given chozo the go-ahead to implement some sort of scheme for marking the batch fits with the names of the input data waves. He is kind to credit me; I am the author of the original package and MPF2_AutoMPFit(). But chozo has put in a great deal of work making it *much* better for Igor 9.

Andy, the used waves get marked now (in the next update) in two ways: There will be two string variables in each result folder called usedYWave and usedXWave, which store the full path to the fitted waves. Also, information about the fit will be saved into a folder note. This is a new feature in Igor 9, which makes it possible to show notes for folders in the Data Browser. You can then just select a result folder to see all kinds of fit details including the used data waves. I hope this covers your use case.

Hi Chozo,

That sounds great.  I am sitting with 130+ spectra to push through it.


These changes should be included in the next IP9 beta release. It's been hanging fire for a few days...