Friday, June 7, 2013

Customising Iolite, Part II

In our previous post, we discussed some basic ways to customise Iolite. Continuing on from there, we'll look at how to set up the Traces Window so that it displays your favourite channels, with your preferred zoom levels, each time you crunch your data.



It's quite common that if you're analysing similar samples regularly, such as zircons, you might use the same channels over and over to select your baselines, reference materials and unknowns. Every time you'll have to choose your favourite channels from the list and set up the axis limits. However, if you use one of the more common DRS, you may have noticed these buttons in the top left of the Traces Window:



By default, if you're using the Trace_Elements DRS and click on the View Baselines button, it will automatically try to show the Ca43, Sr88, Ba138 and a bunch of other channels. Ca43 will be the Primary Channel, and the axis will be set to display between 0 and 15000 CPS. The View Intermediates button does something similar, but with intermediate channels. You can change what channels are displayed, what order they are displayed in, and what zoom levels to use.

The setup for these buttons is stored in the DRS. A lot of the DRS we distribute with Iolite don't have the code in there by default. But you can easily add it by copying and pasting the code below into the bottom of your DRS beneath all the other code, and customise it to suit your needs. Here's what the codes looks like:

Function AutoBaselines(buttonstructure) //Setup Auto Baselines button --- This is based off a button, so has button structure for the next few lines
STRUCT WMButtonAction&buttonstructure
if( buttonstructure.eventCode != 2 )
return 0  // we only want to handle mouse up (i.e. a released click), so exit if this wasn't what caused it
endif  //otherwise, respond to the popup click
ClearAllTraces()

 AutoTrace(0, "Ca43", 0, 15000, extraflag = "Primary")
AutoTrace(1, "Sr88", 0, 5000)
AutoTrace(2, "Ba138", 0, 4000)
AutoTrace(3, "Pb208", 0, 5000)
AutoTrace(4, "Th232", 0, 2000)
AutoTrace(5, "U238", 0, 800, extraflag = "Right")
AutoTrace(6, "Ce140", 0, 500, extraflag = "Hidden")

End           //end of code


You can ignore all the code up to where it first says "AutoTrace(.......)". This is where you can customise it. Let's look at what the stuff between the brackets means:

AutoTrace(TraceNumber, "ChannelName", AxisMinimum, AxisMaximum)

TraceNumber is just the order of the traces, and should be a number, as in the example.
"ChannelName" is the name of the channel you want to display. Don't forget the quotation marks!
AxisMinimum and AxisMaximum are the minimum and maximum values for the axis this trace will be plotted on.

There are also a few extra flags you can add between the brackets (see the Ca43, U238, and Ce140 traces in the example above). If you're going to use them, make sure you include the "extraflag = " part too!

Setting up the View Intermediates button is exactly the same. The only difference is in the Function name. Here's an example:

Function AutoIntermediates(buttonstructure) //Setup the View Intermediates button --- This is based off a button, so has button structure for the next few lines
STRUCT WMButtonAction&buttonstructure
if( buttonstructure.eventCode != 2 )
return 0  // we only want to handle mouse up (i.e. a released click), so exit if this wasn't what caused it
endif  //otherwise, respond to the popup click
ClearAllTraces()

AutoTrace(0, "Ca43_CPS", 0, 0)
AutoTrace(1, "Sr88_v_Ca43", 0, 0)
AutoTrace(2, "Ba138_v_Ca43", 0, 0)
AutoTrace(3, "Pb208_v_Ca43", 0, 0, extraflag = "Primary")
AutoTrace(4, "Th232_v_Ca43", 0, 0)
AutoTrace(5, "U238_v_Ca43", 0, 0, extraflag = "Right")
AutoTrace(6, "Ce140_v_Ca43", 0, 0, extraflag = "Hidden")

End      //End setup function

Notice the different function name (this time it's "AutoIntermediates") and that the channel names are intermediate channels, but they don't have to be! You can use input or intermediate channels in whatever combination you like. The setup for the AutoTrace lines is exactly the same, but you'll notice that in this example, AxisMinimum and AxisMaximum all set to 0. If they're both set to 0, Iolite will automatically set the zoom levels.

After you've pasted the code into your DRS, make sure you save the DRS file by going to File -> Save Procedure. And then whenever you click on the View Baselines or View Intermediates buttons in the Traces Window, it will automatically set up the Traces Window with your favourite settings.

If you have any troubles with setting up these buttons, feel free to create a new topic on the Iolite forum, or add a comment to this post.


The Iolite Team