Help to calculate the peak of waves

Hello everyone,

I am a new Igor pro 8 user.

My data include a huge number of mass-spectrometry data. I recorded the mass and intensity of each sample (the total sample number is about 100-200). 

All data are in excel file (I can transfer to the tab-delimited file). Each sample contains two columns, one is named "mass1" and one is named "intent1". The mass will be the number from 400 to 1200 while the intensity will be the recorded value for each mass. Since the mass and intensity are scattered, for example:

401.04 1.50E+01
401.11 1.50E+01
401.18 3.71E+02
401.25 5.57E+02
401.32 1.90E+01
401.39 1.70E+01
401.46 0.00E+00
401.53 1.50E+01
401.60 0.00E+00
401.67 0.00E+00
401.74 5.20E+01
401.81 0.00E+00
401.95 0.00E+00

With this data, we can observe a wave with the peak of intensity is 5.57E+2 at the mass of 401.25.

I want to get this value and export into another table.

Would you please help to suggest a code that:

  1. import the whole *txt file with the first row as a variable name.
  2. Generate the wave from each pair of data. For example, sample 1 will have a wave that came from the function: display 'intent1' vs 'mass1'. (I want to make all waves from the input data - about 100 samples).
  3. The wave from each sample contains many peaks. I want to get the peak information of mass and its related intensity (see the example).
  4. Then, make the output data with two columns for each sample including "mass1" and "intent1" as same as the input data. However, the output data will contain the mass and its correlated intensity the peak of waves.

Thank you,


I would suggest you try DisplayHelpTopic "The Waveform Model of Data". In Igor you would just import the intensity column and generate the mass column based on the uniform step size.

The easiest would be to find the peak maximum of the most intense peak and shift the mass axis to line up the peaks at the correct masses with SetScale.

You could then simply Resample your intensity wave to a resolution of 1 amu and every data point would correspond to the integrated intensity within one mass unit. 

You could also fit each mass with a Gaussian peak, but that would be much more complicated.

In reply to by olelytken

Hi Olelytken,

Thank you so much for your answer.


Can you please tell me more detail about that?

I have the problem that my mass data include the gap of mass sometimes. It means that the mass axis may have a small gap.

Secondly, is there any way to make a code that I can do this function automatically?


Thank you,


It would be easier to suggest code if you could share an example data file (maybe even a shortened version), to see what format you are dealing with.

Yo could do the resampling and all other steps during loading of the data automatically. I think it is no problem that you have gaps in your scale as the resampling will just skip those. I do not fully understand why you would like to create graphs for each data set. I think with 200 sets this will just be a huge mess.