How to create channels in iolite v3

iolite was designed from the beginning to be flexible. One example of flexibility is being able to create your own channels. For example, you may want to create a custom ratio channel, or perhaps you want to calculate a concentration based on the concentration of other elements. All of this is possible by adding to your DRS code.

Coding can look a little intimidating for beginners. I think the secret is to keep a backup of whatever you’re editing. If everything goes wrong, you can always just copy over your changes with your backup and you’re good to go again.

For this example, we’re just going to add a custom ratio channel to the end of the Trace_Elements DRS, but the idea is much the same for other DRS. Let’s say we wanted to calculate the U/Th ratio for our samples. We could do this at the results stage (that is, calculating the U/Th ratio of each selection), but this deprives us of the time-resolved nature of LA-ICP-MS analysis. The time resolved data may be much more important than the average. For example, you may be doing transects across a speleothem, and you’re looking for the high U/Th regions to indicate which layers you want to sample by micro-drilling. This is just one example, but in this case, it illustrates that the average value doesn’t give us much info about where to sample.

So, to the code. The code that runs when you click “Crunch Data” in the DRS tab is kept in a file called “Trace_Elements.ipf”. You can see this file within Igor Pro (and I recommend editing the DRS in Igor Pro than in another program) by going to the Windows menu -> Procedure Windows -> Trace Elements (you must select this DRS in the DRS tab for it to be visible here).

When Trace_Elements procedure file opens, it will have a couple of lines starting with #Pragma at the top. You can ignore almost all of this. This is just the stuff the iolite reads to get the DRS started (although this is where you’d change your default standard and index channel if you wanted to customise those). Remember to have a backup of this file before you make any changes. The file itself is in the Data Reduction Schemes folder within your iolite folder.

If you scroll down, you’ll see there are a bunch of “functions”, which are labelled in blue. The function that runs when you click “Crunch Data” is the “RunActiveDRS()” function. To add your custom channel, scroll right to the end of this function, just before this line:

SetProgress(100,"Finished DRS")	//Update progress for each channel

Just immediately before this line is where you’ll add your custom code. To create your own channel you need the following basic template that I’ll try to example as best I can:

Wave U_ppm_m238 = $ioliteDFpath("CurrentDRS","U_ppm_m238")

Wave Th_ppm_m232 = $ioliteDFpath("CurrentDRS","Th_ppm_m232")
 IF(WaveExists(U_ppm_m238) && WaveExists(Th_ppm_m232))
 Wave U_Th = $MakeIoliteWave("CurrentDRS","U_Th", N = NoOfPoints)
 U_Th = U_ppm_m238 / Th_ppm_m232
 If(WhichListItem("U_Th", ListOfOutputChannels) < 0)
 ListOfOutputChannels += "U_Th;"

The first two lines (which have the form Wave SomeChannel …) are called “declarations” which basically just tell Igor what the names mean. In this case, we’re telling it “U_ppm_m238” is a wave (is a channel). The key here is to get the channel names right, and to remember to put it in the brackets as well.

Then we have an IF statement. This is just to make sure the two channels were measured. Remember, this code will stay with this DRS, and you don’t want it to put up an error if you haven’t measured one of your channels. So that’s what it’s doing here.

Then we have the MakeIoliteWave line. Here we give our channel a name (U_Th in this example). Make sure that you put the same name in the brackets, and leave the rest of the line the same.

The next line actually calculates the channel values. This one is simple: just divide the channel we declared by the other channel. This will fill our U_Th channel with values for every data point measured.

Then we have another If statement. This one just adds U_Th to our list of output channel. This list is the one that appears when you want to change channel in the Sample/Ref Mats tabs, or in the Image tabs. Yes, by creating a new output channel you can create an image from your new channel. In the line “ListOfOutputChannels += “U_Th;” ” just make sure that you remember the semi-colon after your channel’s name.

And after that, you just need to click the little “Compile” button at the bottom of the Procedure window (bottom left). Now, when you click Crunch, it will automatically calculate your channel’s values for you, and you should be able to see the channel in the Channel Panel or as an option in the imaging interfaces.