Skip to content

SHRIMP: Sub SamRadiogenicCols

sbodorkos edited this page Jul 5, 2018 · 12 revisions

SQUID 2.50 Sub: StdRadiogenicCols

This subroutine (which is solely for the Standard) places, row-by-row, formulae to calculate radiogenic (i.e. corrected for common Pb) ratios for Pb/U (and Pb/Th, as a proxy) in the StandardData sheet.

Usage

StdRadiogenicCols plaFirstDatRw, plaLastDatRw

Mandatory variables

plaFirstDatRw: Integer index number of the first row containing spot-by-spot data (for the Standard).
plaLastDatRw: Integer index number of the last row containing spot-by-spot data (for the Standard).


Definition of variables NEEDS UPDATING

Values of type Boolean
pbTh, pbU

Values of type Integer
f, L, piNumDauPar

Values of type String
q, s, SA, sae, t, WtdMnA

Values of type Range
rw1, rw2, r4


The subroutine starts by determining the address of the column in which the row-by-row ["206Pb/238U calibr. const."] values will be found. In truth, this column occurs as the primary calibration constant for both Perm1 and Perm2, and as the secondary calibration constant in Perm4. However, Perm3 does not include a direct calculation of ["206Pb/238U calibr. const."], so this code incorporates an (isotopic) "kluge" where 208Pb*/232Th is substituted for 206Pb*/238U. It is important to note that this does not make sense in terms of portraying the data (e.g. on a Concordia diagram), but at the same time, it is clear that Ludwig did this Perm3-specific substitution deliberately, as will become clear from the following code.

Note also that all of this SQUID 2.50 code is predicated on the calculation of no more than one of each calibration constant (206Pb*/238U and/or 208Pb*/232Th), because in SQUID 2.50, the index isotope has already been uniquely specified by the user. This means that in due course, some of this code will require additional generalisation, with particular respect to Perm1 and catering for the possibility of 208-corrected data. The following documents the SQUID 2.50 code as written, but also points out gaps to be addressed later.

The following "If" incorporates bug-fixes required in the SQUID 2.50 code (and implemented by me there, dated 2018-07-02). Ludwig realised that "SA" (which is the column of ["206Pb/238U calibr. const."] values) would be located in a different column for Perm4 than is the case for Perms1-3, as described above. However, he appears not to have realised that "WtdMnA" (i.e. the value of the weighted mean of ["206Pb/238U calibr. const."]) and "sae" (i.e. the location of ["206Pb/238U calibr. const. %err"] both also required analogous Perm4-specific addressing. Instead, the Perm1-3 addresses were used universally for WtdMnA and sae, with nonsensical results in Perm4.

If (pbTh = TRUE) and piNumDauPar = 2 --i.e. Perm4
  
  SA = " sA(2) " 
  WtdMnA = " WtdMeanA2 "
  sae = " sAe(2) "
  --because 206/238 is the "secondary" calibr. const. in Perm4
  
Else --Perm1, Perm2, Perm3
  
  SA = " sA(1) " 
  WtdMnA = " WtdMeanA1 "
  sae = " sAe(1) "
  --because 206/238 is the "primary" calibr. const. in Perm1 and Perm2, and 
  --because for Perm3, 206/238 is being "kluged" using 208/232, which is the 
  --"primary" calibr. const. in Perm3 

End If  

f = plaFirstDatRw
L = plaLastDatRw  

Note that the following headers are not always an accurate representation of the data within the column. It is true that "207*/235" = ["4corr-207Pb*/235U"] always, but the same is not always true for "206*/238". In fact, for Perm1, Perm2, and Perm4, "206*/238" = ["Xcorr-206Pb*/238U"], where X denotes the (user-specified) index isotope for common-Pb correction (i.e. one of 4, 7, or (in the case of Perm1 only) 8). In the case of Perm3, "206*/238" = ["Xcorr-208Pb*/232Th"], where X denotes the (user-specified) index isotope for common-Pb correction (i.e. 4 or 7). This is definitely odd, but it seems clear in the code that it is deliberate...

If piStdPb7U5_4col > 0 --i.e. if column 204corr 207Pb*/235U exists on StandardData
  
  If (pi204PkOrder > 0) AND (pi207PkOrder > 0) AND (pbHasU = TRUE)  
  --i.e. if mass stations 204Pb AND 207Pb AND at least one U-bearing mass-station
  --(e.g. 238U, 254UO, 270UO2) have ALL been measured, then define the headers:
    
    CFs plHdrRw, piStdPb7U5_4col, "207*|/235", -1 --header for 204corr 207Pb*/235U
    CFs plHdrRw, piStdPb7U5_4eCol, "%err", -1 --header for 204cor 207Pb*/235U %err 
    
    --The following are so-called 204corr 206*/238 (and err corr) but see above!
    CFs plHdrRw, piStdPb6U8_4col, "206*|/238", -1 --header for 204corr 206Pb*/238U
    CFs plHdrRw, piStdPb6U8_4eCol, "%err", -1 --header 204corr 206Pb*/238U %err
    CFs plHdrRw, piStdPb7U5Pb6U8_4rhoCol, "err|corr", -1 --header 204c err correl.
    
  End If
  
End If

The next step is to specify the IDTIMS-determined reference isotopic ratio for the Standard (part of the Standard-specific "model", and derived in SQUID 2.50 simply by converting the reference "age" of the Standard (206Pb*/238U, or 208Pb*/232Th, or both) to the corresponding isotopic ratio value. As described previously, those age-specific reference isotopic ratios are stored as StdUPbRatio (206Pb*/238U), StdThPbRatio (208Pb*/232Th), and Std_76 (207Pb*/206Pb*), respectively. The code continues:

If piStdPb6U8_4col > 0 --i.e. if column 204corr 206Pb*/238U exists on StandardData
  
  If (pbTh = TRUE) AND (piNumDauPar = 1) --i.e. Perm3
    
    q = "StdThPbRatio"
  
  Else --i.e. Perm1, Perm2, Perm4
    
    q = "StdUPbRatio"
   
  End If
  
  s = "=" & SA & "/" & WtdMnA & "*" & q    
  --so-called ["4corr-206Pb*/238U"], with Ludwig bugs repaired.
  
  --Now place the expression for so-called ["4corr-206Pb*/238U"]:
  PlaceFormulae s, f, piStdPb6U8_4col, L
  
  --The following line places the expression for so-called 
  --["4corr-206*/238 %err"], but Ludwig's code contains a bug!
  
  --PlaceFormulae "= sAe(1) ", f, 1 + piStdPb6U8_4col, L --Ludwig original
  
  s = "=" & sae --Bodorkos 2018-07-02 addition
  PlaceFormulae s, f, 1 + piStdPb6U8_4col, L --Bodorkos 2018-07-02 revision
   
  --When primary D/P ratio = 208/232 and piNumDauPar = 2 (i.e. 206/238 calculated
  --directly as secondary ratio), corresponding to Perm4, Ludwig's original code
  --wrongly equates ["206*/238 %err"] with the %err of the 208/232 calibr. const.
  --This is obviously bad: instead, ["206*/238 %err"] should be equated with %err
  --of the 206/238 calibr. const. Easily fixed via Perm-dependent definition of
  --"sae" near the start of sub StdRadiogenicCols.
  
End If
 
If piStdPb7U5_4col > 0 --i.e. if column 204corr 207Pb*/235U exists on StandardData
  
  --Place the expression for ["4corr-207Pb*/235U"]:
  t = " = ["4corr-207Pb*/206Pb*] * ["4corr-206Pb*/238U"] * [Present 238U/235U] "
  --where SQUID 2.50 specifies [Present 238U/235U] = 137.88.  
  PlaceFormulae t, f, piStdPb7U5_4col, L
  
  --Place the expression for ["4corr-207Pb*/235U %err"]:
  q = " =sqrt( ["4corr-206Pb*/238U %err"]^2 + ["4corr-207Pb*/206Pb* %err]^2 ) "
  PlaceFormulae q, f, piStdPb7U5_4eCol, L
  
  --Place the expression for ["4corr-errcorr"]:
  q = " = ["4corr-206Pb*/238U %err"] / ["4corr-207Pb*/235U %err"] "
  PlaceFormulae q, f, 2 + piStdPb6U8_4col, L  
  --Note that "2 + piStdPb6U8_4col" corresponds to the "err corr" column.
 
End If

Now all that is left in this subroutine is to perform a row-by-row assessment of the radiogenic ratios, to assess their usefulness for plotting on a Wetherill concordia diagram. Data-rows that have returned errors, or nonsensical numerical values, are marked for exclusion via application of Strikethrough font:

If (piStdPb7U5_4col > 0) AND (piStdPb6U8_4col > 0) 
--i.e. if columns 204corr 207Pb*/235U and 204corr 206Pb*/238U both
--exist on StandardData:

  For i = f To L  --row-by-row assessment of recently calculated data
  ---with respect to its fitness for use on a Concordia diagram 
    Set rw1 = Cells(i, piStdPb7U5_4col) --i.e. 207*/235 value
    Set rw2 = Cells(i, piStdPb6U8_4col) --i.e. so-called 206*/238 value
    Set r4 = Cells(i, 2 + piStdPb6U8_4col) --i.e. err corr value
    
    --frSr defines 5-column range in row i:
    With frSr(i, piStdPb7U5_4col, , 2 + piStdPb6U8_4col)

      If (IsError(rw1) = TRUE) OR (IsError(rw2) = TRUE) OR 
      (rw1 < 1e-5) OR (rw2 < 1e-4) OR (r4 >= 1) OR (r4 <= 0)
      
        Font.Strikethrough = TRUE
      
      End If
  
    End With
  Next i
    
End If

End Sub

Note that this subroutine makes no attempt to calculate 208corr 207Pb*/235U (as could be legitimately required by Perm1 where index isotope = 208Pb, nor (by analogy) 208corr 207Pb*/206Pb*. Similarly, for the radiogenic daughter-parent pair, the focus is exclusively on 206Pb*/238U, whereas in Perm2 and Perm4, there ought to be an analogous calculation for 208Pb*/232Th (it's possible that this is done later, but there isn't much code left!). Furthermore, in Perm3, we see the calculation for 208Pb*/232Th (as the sole daughter-parent pair) deliberately inserted into the column labelled "206*/238", which really shouldn't happen, although I can see why Ludwig found it expedient.

So at some future point, it will be necessary to revisit these calculations to ensure that all the relevant calculations for each Perm are performed and tabulated. This should not require the invention of new arithmetic; it should rather just involve a wider range of analogous calculations in each Perm.

Clone this wiki locally