Using splines in a DRS

In this post I’m going to give a description of how someone making or modifying a DRS can take advantage of the DRS support functions included in Iolite for working with splines. I’ll use the existing “Sr_isotopes_REE” DRS as an example – it’s distributed with Iolite, which should make life easy for anyone that wants to use it as a template.
The below image is all of the lines of code required – thanks to Iolite’s built in DRS support functions things are kept pretty short and simple…

Before I start on the nitty gritty, there’s one important detail that I think is important to understand about splines. They are made and updated by the underlying Iolite code, not the DRS. It is possible to prompt Iolite to update splines, but you won’t actually be making them in the DRS. Instead, the aim in the DRS is to implement splines that already exist.

So, presumably if you’re at the stage where you’re trying to use splines you know the basics of editing a DRS, so I’ll skip to the particulars. Firstly, you need to make sure that the wave you’re interested in has a spline. In order to be splined, your wave has to be in a list of channels, so make sure that you’ve added it to one, e.g.:

One other thing is worth noting, and that is that only pre-defined standards (i.e., those that pop up in the list of integrations) and the Baseline_1 integration type will be splined. Output_1, and any integration types you make yourself will never get a spline.
Now, to check whether the spline you’re interested in exists, you should use the function:

A couple of things are worth noting about the above function. Firstly, it looks only at the integration type that you specify, so it will not consider other integration types (in the above example I’ve used the Global String from the header of the DRS called ReferenceStandard, but you could put something else in there. like “G_NIST612”).
The first thing that the function does is check whether the spline exists. If it doesn’t then it will stop the DRS and report in the history window to let you know what happened. If this happens, everything above that line in the DRS will have been done as per usual, but nothing below that point will have been calculated.
If the spline does exist then the function will try to make sure that all other splines for that integration type are properly built and ready to use.

Ok, now that we know the spline we’re interested in exists, we need to make it accessible for use in the DRS. The reason for this is that splines can have a variable number of points, depending on what type of spline they are, and the spacing of the points in the wave will not match the spacing of the Index_Time wave. The following function is used to interpolate the spline onto the Index_Time wave, after which it can be used like any other wave in the DRS:

As with the MakeIoliteWave function, you can choose whatever name for the wave that you feel is appropriate(“StdSpline_Sr87_86” in this case), just be sure to keep their length <20 characters, as longer than this can potentially cause bugs. Now you have the same spline that you would see in the graph display (e.g., the main control window) available as a regular wave. Assuming that you want to normalise using the spline, the next step is to get a value for your reference standard. You can just hardwire in a value, but if you want to get more sophisticated you can also pull the value from the standard file. This way, as the reference standard is changed, your DRS will automatically use the appropriate value. To do this, you can use the following function:

This line will create a variable with the name you choose (“StdValue_Sr87_86” in this case) and get the value from the standard’s text file. Just keep in mind that the name you provide needs to exactly match that in the text file (“87Sr/86Sr” in this case). Ok, now we have all the pieces required, so it’s time to make a wave to hold the normalised data:

And do the actual calculation

Now the channel of normalised data is ready, so the final step is to add the new channel to the list of output channels:

All done!