Skip to content
sbodorkos edited this page Apr 18, 2017 · 2 revisions

2016.03.08

Step 2: Background- and SBMzero-corrections, and 'total CPS' columns

For each analysis/fraction, we have thus far generated a matrix of data comprising Nscans (= 6 in demo XML) measurements at each of Nspecies (= 10 in demo XML) nuclides, for a total of 60 "peak" measurements. For each of these peaks, the previously calculated values of interest (from Step 1) can be defined as:

For j = 1 to Nscans [in time order from  first to last]  
  For k = 1 to Nspecies [in SHRIMP acquisition order, usually ascending mass]  
    PkCounts[j, k] = 'total counts at mass'[j, k]  
    SBMCounts[j, k] = 'total SBM counts'[j, k]  
  Next k  
Next j  

For each peak, start by calculating the PkCps and SBMCps values, correcting the latter for the measured SBM_zero_cps.

[SBM_zero_cps is a measure of the reading on the secondary beam monitor when the beam is off, and its numeric value depends on the range to which the SBM monitor has been set, using the SHRIMP control software. There is only one sbm_zero_cps value per analysis.]

In implementing the below, note that a means of identifying the background peak is needed, including determination of whether a background peak even exists in the XML file being processed. (This is because there is no formal analytical requirement to measure background, and obviously background-correction should not happen if background has not been measured.) In the demo XML, background corresponds to k = 3.

For j = 1 to Nscans    
  For k = 1 to Nspecies  
    PkCps[j, k] = PkCounts[j, k] / count_time_sec[k]  
      SBMCps[j, k] = ( SBMCounts[j, k] / count_time_sec[k] ) - SBM_zero_cps  
        
      If k = background --isolate its PkCps vector of length Nscans,  
                        --and maintain its sum:  
        BkrdCps[k] = PkCps[j, k]  
        SumBkrdCps = SumBkrdCps + BkrdCps[k]  
      End If  
  Next j  
Next k  
  
If [background exists within collection of species]  
  CalcBkrdCps = SumBkrdCps / Nscans  
      
  If CalcBkrdCps < 10  
    BackgroundCps = CalcBkrdCps  
  Else  
    BackgroundCps = [biweight value of BkrdCps, with tuning = 9]  
  End If  
Else  
  BackgroundCps = 0  
End If  

Now use this value to perform the background correction for each peak, and calculate the associated fractional error:

For k = 1 to Nspecies  
  If k is NOT background  
    For j = 1 to Nscans  
      NetPkCps[j, k] = PkCps[j, k] – BackgroundCps  
      AbsNetPkCps[j, k] = abs( NetPkCps[j, k] )  
              
      If AbsNetPkCps[j, k] > 1e-6  
        CalcVariance = PkCounts[j, k] + ( abs( BackgroundCps ) *  
                       ( count_time_sec[k] / count_time_sec[background] ) ^2 )  
        PkFerr[j, k] = sqrt( CalcVariance ) /  
                       ( AbsNetPkCps[j, k] * count_time_sec[k] )  
      Else  
        PkFerr[j, k] = 1 --this is to control the magnitudes of  
                         --errors associated with ~0 cps  
      End If  
    Next k  
  End If  
Next j  

Now calculate 'total cps' values for placement as columns on StandardData and SampleData sheets:

For k = 1 to Nspecies  
  For j = 1 to Nscans  
    NetCps[j] = NetPkCps[j, k]  
  Next j  
     
  MeanNetCps = average( NetCps )  
  TotCps[k] = MeanNetCps + BackgroundCps  
  
  --Bodorkos 2017-04-04: next line inserted to force VBA-Java match
  TotCps[k] = SigDigStrDbl( TotCps[k], 12 ) --12 sig. digits
Next k  

--Bodorkos 2017-04-04: next line inserted to force VBA-Java match
BackgroundCps = SigDigStrDbl( BackgroundCps, 12 ) --12 sig. digits

Sanity check: At this point, you should be able to generate an array with one row per analysis, and one column per species. Filling this array with the relevant TotCps value for each analysis-species combination should yield output that matches the content of columns J to S of the StandardData and SampleData sheets (depending on whether the individual analyses are 'standards' (i.e. TEMORA2: prefix 'T' in demo XML) or not (all other prefixes in demo XML) in the originally supplied 'frozen' SQUID-book 100142_G6147_original_frozen.xls.


Next: Step 3: Calculation of interpolated ratios of measured species

Clone this wiki locally