Home Forums Iolite User Forum Question related to development of new DRS (δ values and baseline substration)

This topic contains 5 replies, has 2 voices, and was last updated by  Dr Tephy Marillo-Sialer 6 months, 2 weeks ago.

  • Creator
    Topic
  • #8280

    Hello all,

    We are trying to develop some new routines in our lab and we would like to use Iolite for data processing. We are trying to create/modify a DRS but we are founding some problems.

    The first one is related to δ values (“delta values” – I hope you could see the symbol properly). We want the δ to be calculated directly by using the DRS, and for that purpose, it is necessary to divide “sample ratio wave” by “reference standard ratio wave”. However, we are not able to do it… Is there any specific function to do it?

    Additionally, we would like to know if it is possible to make the baseline subtraction only in some of the waves? We are using liquid standard (continuously introduced) together with the laser input in order to correct mass fractionation of the unknown. If we select a baseline integration time to subtract it to the main signal for the lasers’ input channels, those time ranges are used also to calculate the ratios of the standard. But as we mentioned before, the liquid standard is continuously introduced, so the “baseline” and the “main beam” are the same signal, i.e. if we subtract the baseline to the main beam it results in zero.
    We have thought that by using a high enough standard concentration the blank levels could be discarded in solution. However, the blank introduced by the laser system could be also significant in some cases.
    So is it possible to subtract the baseline in some masses and to use the signals without baseline subtraction in others?

    Thank you in advance. Best regards,

    Sonia

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #8652

    Hi Sonia,

    The code below is an extract from the Trace_Elements_DRS that you can use as starting point. This portion of the DRS handles creating output waves and calculating values for each point of the waves.

    Your modifications to this code should include naming the new waves appropriately (e.g. Ca_delta) and adding them to the ‘ListOfOutputChannels’.

    Have a go at modifying this and if you have any issues please post your modifications so we can provide further help.

    //This part of the DRS calculates output waves: Get absolute concentrations in the specifed ratio unit, for all elements for which data are availiable for this standard.
    		CurrentChannelNo=0  ; NoOfChannels=itemsinlist(ListOfInputChannels) //Create local variables to hold the current input channel number and the total number of input channels
    		OutputUnitDivisor=RatioUnit2AbsoluteAbundance(OutputUnits) //Get the equivalent absolute abundance ratio for the specified ratio unit
    		Units=CleanUpUnitName(OutputUnits) //get a "cleaned" version of the ratio unit name (e.g. "ng/g" will become "ng_g", "%" will become "Percent", "ppm" will stay"ppm")
    		Do //Start to loop through the available channels
    			NameOfCurrentChannel=StringFromList(CurrentChannelNo,ListOfInputChannels) //Get the name of the nth channel from the input list
    			CurrentElement=GetInfoFromChannelName(NameOfCurrentChannel, "element") //get name of the element ("Null" if channel is not an isotope)
    			CurrentMassNo=str2num( GetInfoFromChannelName(NameOfCurrentChannel, "massNo") )//get current mass number (NAN if channel is not an isotope)
    			CurrentSuffix = GetInfoFromChannelName(NameOfCurrentChannel, "suffix")
    			if(cmpstr(CurrentSuffix, "Null" ) == 0)	//If this channel has no suffix
    				CurrentSuffix = ""		//Set to zero characters so that it won't change the channel name
    			endif
    			
    			if(cmpstr(CurrentElement,"Null")!=0) //if this element is not "null" (i.e. is an element), then..
    				ThisElementConcInStd=GetValueFromStandard(CurrentElement,ReferenceStandard) //get the value of this element from the specified standard
    				Wave ThisChannelBLSub=$ioliteDFpath("CurrentDRS",NameOfCurrentChannel+"_"+DefaultIntensityUnits)  //and create a reference to its intermediate ratio to index wave
    			
    				if(numtype(ThisElementConcInStd)==0) //If a finite number was returned fom the standard, then there was a value for this std, so..
    					wave ThisChnlBLSubInStandard = $InterpSplineOntoIndexTime(NameOfCurrentChannel+"_"+DefaultIntensityUnits,ReferenceStandard) //interpolate and reference its [channel]_v_[index] spline wave.
    					Wave ThisChannelConcOut=$MakeioliteWave("CurrentDRS",CurrentElement+CurrentSuffix+"_"+Units+"_SQ"+"_m"+num2str(CurrentMassNo),n=NoOfPoints)//Create this channel's output wave, of the pre-determined length, including unit name and mass no., and reference it
    					ThisChannelConcOut=ThisChannelBLSub/ThisChnlBLSubInStandard*ThisElementConcInStd/OutputUnitDivisor //Calc, per point: Conc=meas.smp/meas.std*knwn.std/SampVsStdAbltn/units
    					ListOfOutputChannels+=CurrentElement+CurrentSuffix+"_"+Units+"_SQ"+"_m"+num2str(CurrentMassNo)+";" //Add the name of this new output channel to the list of outputs
    			
    				Else //otherwise, value of this element in std was NAN, so cannot convert to the ratio unit - output baseline-subtracted intensity units instead..
    					ListOfOutputChannels+=NameOfCurrentChannel+"_"+DefaultIntensityUnits+";" //Add the name of this intermediate  channel to the list of output channels (a single wave is able to exist as both an intermediate and an output simultaneously)
    			
    				endif //now this channel has been processed if it was an isotope, either as a concentration or as CPS
    			endif // end of code for this channel
    			
    			SetProgress(60+((CurrentChannelNo+1)/NoOfChannels)*30,"Calculating concentrations...")	//Update progress for each channel
    			
    			CurrentChannelNo+=1 //So move the channel counter on to the next channel..
    		While(CurrentChannelNo<NoOfChannels) //..and continue to loop until the last channel has been processed.
    		//End of per-channel output wave calculation
    		ListOfOutputChannels = removeFromList(IndexChannel+"_"+DefaultIntensityUnits+";", ListOfOutputChannels, ";", 0)
    #8702

    Hi!

    Thanks for your reply. I am obtaining delta values after modify this code. Thank you very much!!

    What about baseline substraction? Is it possible to use a different baseline for each isotope? At this moment I am acquiring some data prior to the experiment, without any signal (neither laser nor dissolution), but during the experiment the internal standard is continuously added and I can not use intermediate signals for the baseline. I would like to use as baseline for Fe the signal produced during the warmup of the laser system, and not those obtained at the start of the day … I found this subject difficult to explain, so I attached to this message a screenshot of the signals. I hope it helps to understand me.

    Best regards,
    Sonia
    IMAGE LINK

    Signal FeNi

    #8745

    Hi Sonia,

    It is possible to skip the baseline subtraction step for any channel if this is not the Index Channel. For this, look for the portion of the DRS code that handles the baseline subtraction in the DRS you are using. It should look like the extract below.

    To skip the baseline subtraction step you just have to add a conditional within the Do-While loop. Something in the lines of:
    if(cmpstr(NameOfCurrentChannel,”Ni53″)!=0 && cmpstr(NameOfCurrentChannel, IndexChannel)!=0). Then just add the channel directly to the list of intermediate channels skipping the InterpOntoIndexTimeAndBLSub.

    	//Baseline-subtract and ratio to the (already baseline-subtracted) index chanel, for every remaining channel
    	variable CurrentChannelNo=0,NoOfChannels=itemsinlist(ListOfInputChannels) //Create local variables to hold the current input channel number and the total number of input channels
    	String NameOfCurrentChannel,CurrentElement, CurrentSuffix //Create a local string to contain the name of the current channel, and its corresponding element
    	Do //Start to loop through the available channels
    		NameOfCurrentChannel=StringFromList(CurrentChannelNo,ListOfInputChannels) //Get the name of the nth channel from the input list
    		
    		//Need to change the line below to read in any suffixes etc and add it to the end of the BLsub channel name
    		
    		CurrentElement=GetInfoFromChannelName(NameOfCurrentChannel, "element") //get name of the element
    
    		if(cmpstr(CurrentElement,"Null")!=0 && cmpstr(NameOfCurrentChannel, IndexChannel)!=0) //if this element is not "null" (i.e. is an element), and it is not the index isotope, then..
    			wave ThisChannelBLsub = $InterpOntoIndexTimeAndBLSub(NameOfCurrentChannel)		//use this external function to interpolate the input onto index_time then subtract it's baseline
    			ListOfIntermediateChannels+=NameOfCurrentChannel+"_"+DefaultIntensityUnits+";" //Add the name of this new output channel to the list of outputs
    		endif //Have now created a (baseline-subtracted channel)/(baseline-subtracted index) output wave for the current input channel, unless it was TotalBeam or index
    		SetProgress(10+((CurrentChannelNo+1)/NoOfChannels)*20,"Processing baselines", OverwritePreviousLine = 1)	//Update progress for each channel
    		CurrentChannelNo+=1 //So move the counter on to the next channel..
    	While(CurrentChannelNo<NoOfChannels) //..and continue to loop until the last channel has been processed.
    	//Now all intermediate waves required by this DRS have been created.
    #8831

    Dear Tephy,

    We have worked in order to include in our DRS your suggestions, but I am not able to use the code that you send me. The DRS that I am using is very simple and my knowledge in Iolite programming isn´t so wide.
    In my DRS, after I have defined the IndexChannel, I use this code to all required intermediate waves:

    `//Create the required intermediate waves (These are the equivalent of creating all variables at the top of the VBasic code on the Nu, you will need to declare here every variable you use in calculations)
    //baseline subtract all input channels – explicitly stating each channel is preferable for multi-collector data.
    Wave Fe56 = $InterpOntoIndexTimeAndBLSub(DRS_FindInputChannel(“56”, “wavename”),name=”Fe56″)
    Wave Cr53 = $InterpOntoIndexTimeAndBLSub(DRS_FindInputChannel(“53”, “wavename”),name=”Cr53″)
    Wave FeCr54 = $InterpOntoIndexTimeAndBLSub(DRS_FindInputChannel(“54”, “wavename”),name=”FeCr54″)
    Wave Fe57 = $InterpOntoIndexTimeAndBLSub(DRS_FindInputChannel(“57”, “wavename”),name=”Fe57″)
    Wave FeNi58 = $InterpOntoIndexTimeAndBLSub(DRS_FindInputChannel(“58”, “wavename”),name=”FeNi58″)
    Wave Ni60 = $InterpOntoIndexTimeAndBLSub(DRS_FindInputChannel(“60”, “wavename”),name=”Ni60″)

    I have tried to modify your code to define the waves FeNi58 and Ni60 without Baseline Subtraction, but I cannot…
    Can you help me again?? Is there another easier option to skip baseline subtraction??
    Thank you very much!!

    #8936

    Hi Sonia,

    Could you please send a copy of the DRS you are working on to support@iolite-software.com?
    I could have a look at your changes and give you clearer suggestions for further modifications.

Viewing 5 replies - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.