Showing posts with label intermediate. Show all posts
Showing posts with label intermediate. Show all posts

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





Wednesday, November 30, 2011

How to add more globals to a DRS


This is just a quick tutorial to show you how to add more global variables or global strings to a DRS. These globals are useful because they're acessible via the Edit Settings window, which means that people not comfortable with the code can quickly and easily view and modify them (e.g., the "ReferenceStandard" global string). These globals are given a default setting in the header of the DRS, which is used every time a new experiment is opened. If a user decides that they don't want to change the setting in the experiment they're working in then they do this via the "Edit Settings" window.

Below is an image of the header text in the Trace_Elements DRS.

To add a new global is pretty straightforward. First, you need to make a new line in the DRS header - the easiest way to do this is to copy an existing line of the header. Pick a GlobalVariable if you want to store a number, or GlobalString if you want to store text (in most cases you'll want to use a variable).
Put the newly copied line directly beneath the line that says "//**** Any global strings or variables you wish to use in addition to those above can be placed here", like this:
Now change the name to what you'd like to use (make sure it doesn't start with a number, isn't more than 30 characters long, and contains no spaces or special characters), and input your default value (or string):
Now we're done with the header text, and for the next step you'll need to look a little lower in the DRS for these lines:
All you need to do here is add your item to the "NVar" list if it's a GlobalVariable, or the "SVar" list if it's a Global String. Make sure you add a comma prior to your item, and that the name is identical to what you put in the line above (copy and paste is the best way to ensure this). Here's my example added to the list of variables:
Now you're all done. To use the global variable within the DRS just use it like a normal variable, e.g.:
Just note that for the change to take effect in any existing experiments you have you'll need to go to the Iolite menu and choose "Update old experiment" so that the new global gets detected by the system.
And remember, if you want to change the setting for your global, you should do this via the Edit Settings window. The header of the DRS stores the default value, which will only be read in at the beginning of a new experiment.

If you have any questions then just post a question on the forum.