Two newbie problems: Igor can't "find" waves in an open table, and how to multipeak-fit all columns

A week ago I decided to bite the bullet and stop using Excel, but it's been very tough going. I figured out multipeak curve fitting and it's a very nice implementation. I'm impressed with the graphing and some capabilities but seem to be quite thoroughly stuck now.

Would really appreciate any input on the following two things:

1) I use Igor 6.12A, and use excel import. Each wave is named by the excel column header. No problem. But after loading some different sheets and files etc into one experiment, when I go to Window->New Graph, I can't find any of the waves that I've imported. Even though they are in a table right in front of me. If I start a new experiment, reimport the excel file, then I can graph the columns, but I want to use my main experiment with all the graphs etc. Is this a bug or am I missing some fundamental thing?

2) What I really want to do, is import an excel file with arbitrary column names "alpha, beta,, etc", and process each of the waves (columns) in the following way: multipeak fit (like package version2), and extract the fit line fit_alpha, and save the fit_alpha. For simplicity, I can even overwrite the original alpha wave because I only want to process the fit.

Any help would be great.
Quote:

A week ago I decided to bite the bullet and stop using Excel, but it's been very tough going.


If you have not already done it, take an hour or two and go through the first half of the Igor guided tour. Choose Help->Getting Started. This will save you many more hours than it takes and will make the Igor learning curve a lot less painful.

Quote:
I use Igor 6.12A

You can update for free to the latest, 6.22A. Choose Help->Updates for Igor.

Quote:
and use excel import. Each wave is named by the excel column header. No problem. But after loading some different sheets and files etc into one experiment, when I go to Window->New Graph, I can't find any of the waves that I've imported.


Most likely the data was imported into text waves. This may be because of how it is stored in Excel or may be because you inadvertently selected "Treat all columns as text" in the Load Excel Binary File dialog. You need to load the data into numeric waves. If you can't figure this out, send the file and the command you used to load it to WaveMetrics support and I will investigate.

You can check the type of a wave using Data->Browse Waves.

Quote:

Even though they are in a table right in front of me. If I start a new experiment, reimport the excel file, then I can graph the columns, but I want to use my main experiment with all the graphs etc. Is this a bug or am I missing some fundamental thing?


Now I am thinking that the problem is that you loaded the data into different data folders. To learn about data folders, execute:
DisplayHelpTopic "Data Folders"


Quote:

2) What I really want to do, is import an excel file with arbitrary column names "alpha, beta,, etc", and process each of the waves (columns) in the following way: multipeak fit (like package version2), and extract the fit line fit_alpha, and save the fit_alpha. For simplicity, I can even overwrite the original alpha wave because I only want to process the fit.


If you want to force specific wave names you can use the XLLoadWave /NAME flag. This is not available from the dialog, you must do it from the command line or from a user-defined function. To get help for XLLoadWave, choose Help->Command Help.

I presume that you want to automate this. I'm not familiar with programmatically using the MultiPeak Fit package. At any rate, start by getting everything working manually. To automate it you will need to learn at least the basics of Igor programming.


Thanks very much for the help. I appreciate it.

Quote:

If you have not already done it, take an hour or two and go through the first half of the Igor guided tour. Choose Help->Getting Started. This will save you many more hours than it takes and will make the Igor learning curve a lot less painful.


I had basically done it, but I went back and had another go at the introduction.

Quote:
You can update for free to the latest, 6.22A. Choose Help->Updates for Igor.


I went ahead and did that, and noticed that actually the multi-peak fit function had been improved, which is nice.

Quote:

Most likely the data was imported into text waves. This may be because of how it is stored in Excel or may be because you inadvertently selected "Treat all columns as text" in the Load Excel Binary File dialog. You need to load the data into numeric waves. If you can't figure this out, send the file and the command you used to load it to WaveMetrics support and I will investigate.
You can check the type of a wave using Data->Browse Waves.


The data seemed to have been loaded as numerical data, because I had been able to create both a table and graph up in front of me, but Data->Browse Waves wasn't showing them. Further investigation shows that all the waves seemed to have been moved into a nested folder (there are many) as a result of the multi-peak fitting function. This happened 3 times in a row, I kept starting a new experiment, loading data, plotting it, then fitting it and the waves would seem to disappear and I couldn't find it.

Anyway, for now I can find it, so that's some progress.

Quote:

If you want to force specific wave names you can use the XLLoadWave /NAME flag. This is not available from the dialog, you must do it from the command line or from a user-defined function. To get help for XLLoadWave, choose Help->Command Help.

I presume that you want to automate this. I'm not familiar with programmatically using the MultiPeak Fit package. At any rate, start by getting everything working manually. To automate it you will need to learn at least the basics of Igor programming.


Thanks for that XLLoadWave /NAME flag tip, I'll look into it. I got the multipeak fit working manually. I had a look at the code for multi-peak fit, and it's a huge amount of code. I'm sure automating the input and output won't be easy, but I had assumed that running some operation on all arbitrarily named waves in a table or something would be trivial, but I couldn't figure out how to approach the problem. I'll keep working on it.
Quote:
Further investigation shows that all the waves seemed to have been moved into a nested folder (there are many) as a result of the multi-peak fitting function.


I have a vague recollection that this may have been a bug in MPF2 (multi peak fit 2) in Igor Pro 6.12 that was corrected later.

If it is still happening in 6.22A then you will need to manually reset the current data folder. For a discussion of the "current data folder":
DisplayHelpTopic "Data Folders"


Quote:
had a look at the code for multi-peak fit, and it's a huge amount of code. I'm sure automating the input and output won't be easy, but I had assumed that running some operation on all arbitrarily named waves in a table or something would be trivial, but I couldn't figure out how to approach the problem. I'll keep working on it.


You're wading into the deep end of the pool. That said, the expert on MPF2 wrote this to another Igor user:
Quote:

1) If you have multiple peaks in your data set and you have successfully used Multipeak Fit 2 to fit single data sets, then you may be able to use functions from the Multipeak Fit 2 package that are designed to be used by Igor programmers. View them by executing this command on Igor's command line:

DisplayHelpTopic "Multi-Peak Fitting for Igor Programmers"

The function MPF2_DoMPFit() is the central part of Multi-peak Fit 2. It does one fit once you have put together all the correct inputs. It could be used in a custom-programmed loop to fit multiple data sets.

The function MPF2_AutoMPFit() does batch fitting- it will loop through multiple data sets. You must arrange your data sets in certain ways. The function is pretty flexible, which makes it somewhat difficult to understand. But the bulk of the programming has been done for you.


Here is a function that shows how to iterate through the waves in the top table:
Function PrintPathToWavesInTopTable()
    String tableName = WinName(0, 2, 1) // Name of top visible table
    if (strlen(tableName) == 0)
        Abort "There are no visible tables"
    endif
   
    Variable index = 0
    do
        Wave/Z w = WaveRefIndexed(tableName, index, 1)
        if (!WaveExists(w))
            break           // No more waves
        endif
        String path = GetWavesDataFolder(w, 2)
        Print path
        index += 1
    while(1)
End

Quote:
The data seemed to have been loaded as numerical data, because I had been able to create both a table and graph up in front of me, but Data->Browse Waves wasn't showing them. Further investigation shows that all the waves seemed to have been moved into a nested folder (there are many) as a result of the multi-peak fitting function. This happened 3 times in a row, I kept starting a new experiment, loading data, plotting it, then fitting it and the waves would seem to disappear and I couldn't find it.

hrodstein wrote:
I have a vague recollection that this may have been a bug in MPF2 (multi peak fit 2) in Igor Pro 6.12 that was corrected later.

If it is still happening in 6.22A then you will need to manually reset the current data folder. For a discussion of the "current data folder":
DisplayHelpTopic "Data Folders"


HRodstein is correct- earlier versions of Multipeak Fit would, under certain circumstances, leave the current data folder set to the wrong data folder. It didn't move your waves, it moved the "view". Using MPF2 from 6.22a should not have that problem, but if you saved an experiment file with the current data folder incorrectly set, it will still be incorrectly set when you re-open it. All you need to do is drag the red arrow in the Data Browser back to root.

I don't know if it would be helpful- I wrote a function for another customer (quite a while ago) to apply MultipeakFit to all the rows or columns in a matrix. I could send you a copy if you like- write to support@wavemetrics.com.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com