Author Topic: Multiple background "sharing"  (Read 14802 times)

Karsten Goemann

  • Global Moderator
  • Professor
  • *****
  • Posts: 227
Re: Multiple background "sharing"
« Reply #30 on: February 26, 2020, 03:49:30 PM »
Awesome! I'm the same as Philipp.

This is particularly great for absorption edges (like Ar K on P10 counters, or major element K edges).
I did have up to 8 elements on a spectro before (when the additional backgrounds were just discarded when sharing).

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3277
  • Other duties as assigned...
    • Probe Software
Re: Multiple background "sharing"
« Reply #31 on: February 26, 2020, 03:56:41 PM »
Awesome! I'm the same as Philipp.

This is particularly great for absorption edges (like Ar K on P10 counters, or major element K edges).
I did have up to 8 elements on a spectro before (when the additional backgrounds were just discarded when sharing).

We're pleased that several labs find this expansion of the multi-point background method useful.

This is really complicated code and not easy to modify (and maintain backward compatibility!).
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

John Donovan

  • Administrator
  • Emeritus
  • *****
  • Posts: 3277
  • Other duties as assigned...
    • Probe Software
Re: Multiple background "sharing"
« Reply #32 on: December 21, 2020, 02:11:15 PM »
Sorry for this long post but we wanted to update you all on a new and somewhat subtle behavior for the "shared" background method. Our story most recently begins when Mike Williams at U Mass, who has been utilizing the "shared" MPB method in Probe for EPMA (see this this topic for more details), had a suggestion that we thought was quite interesting, but seemingly somewhat difficult to implement.

As most of you know, the multi-point background (MPB) method, originally proposed by Mike Jercinovic, Julien Allaz and Mike Williams,  allows the analyst to acquire *multiple* background measurements on each side (or just one side!) of the peak position. Up to 18 off-peak measurements on each side of the peak for a total of 36(!) off-peak measurements. Very useful when one is trying to characterize the background curvature with high accuracy for trace elements.

Actually the MPB method used to be limited to (only!) 12 off-peak measurements on each side for a total of 24 background measurements, but then Mike Jercinovic and Mike Williams actually found a need for larger MPB arrays (those guys are just crazy about trace elements!) when searching off-peak elements for use as "shared" backgrounds as described in reply #28 above. For those not familiar,  the "shared" background method was an idea from Karsten Goemann and Gareth Seward which utilizes multiple (two background) off-peak elements, acquired on the same spectrometer and Bragg crystal, to allow all the off-peak intensities to be fitted as MPB measurements for each element.  The idea was quite clever because it utilized the already implemented MPB method structures and arrays.

Anyway back to recent events, in very complex spectra Mike and Mike found that there sometimes isn't room for each element to have two off-peak backgrounds, so they asked if we could simply skip acquisition of one of the normal off-peak backgrounds for a particular element.  Well the long and short of that discussion is that it is just not practical, as there is simply too much code that depends on there being two off-peak backgrounds for each element. Also, allowing the analyst to acquire a single background measurement is (in our humble opinion) not very rigorous, since the continuum is generally sloped at a sufficient level of precision.

However there are several off-peak background *fitting* methods in Probe for EPMA that allows the analyst to specify that either only the high or only the low of-peak measurement be included in the background fit. These are respectively the "high only" and "low only" off-peak background fit options (and also the slope high and slope low options) as described here:

https://probesoftware.com/smf/index.php?topic=68.msg6255#msg6255

So we proposed that they acquire two point backgrounds as usual, but then just set the acquisition time for the background they don't need, to a very short time.  There's still the spectrometer motion, but that is pretty quick. Then, they just assign the off-peak background fit on those elements to either "high only" or "low only" depending on which off-peak measurement they want to ignore.

Finally (whew) from the Analyze! window when they do search for "shared" backgrounds, the modified code now also checks the off-peak background fit option and ignores the off-peak measurement that is not being utilized in the off-peak fit. Here is an example of 4 off-peak elements fit using the "shared" background option, but where V Ka was specified as "high only" and Cr Ka was specified as "low only", so only these off-peak measurements for those two elements were utilized in the MPB fit:



And in case anyone is interested here is the source code for searching/removing "shared" backgrounds:

Code: [Select]
Sub AnalyzeSharedBgdSearchOrRemove(mode As Integer, tForm As Form, sample() As TypeSample)
' Search and load or search and remove shared backgrounds to or from multi-point bgd arrays for the selected samples
' 1 = search and load multi-point background arrays
' 2 = search and delete multi-point background arrays

ierror = False
On Error GoTo AnalyzeSharedBgdSearchOrRemoveError

Dim i As Integer, samplerow As Integer
Dim chan1 As Integer, chan2 As Integer
Dim j As Integer, sampleorder As Integer, nsams As Integer
Dim samplemultihi As Integer, samplemultilo As Integer
Dim sampleupdated As Boolean

Dim tVolatile As TypeVolatile

' Check for at least one selected sample
Call SampleCheckSampleList(tForm.ListAnalyze, nsams%, samplerow%)
If nsams% = 0 Or samplerow% = 0 Or ierror Then Exit Sub

' Loop through all selected samples and find "shared" bgds
For i% = 0 To tForm.ListAnalyze.ListCount - 1
If tForm.ListAnalyze.Selected(i%) = True Then
samplerow% = tForm.ListAnalyze.ItemData(i%)
If SampleTyps%(samplerow%) <> 3 And Not SampleDels%(samplerow%) Then

' Update status
Call IOStatusAuto("Loading sample " & SampleGetString$(samplerow%) & "...")
Call AnalyzeStatusAnal("Loading sample " & SampleGetString$(samplerow%) & "...")
DoEvents

' Get sample data (do not call DataCorrect so intensities are "raw" cps)
Call DataGetMDBSample(samplerow%, sample())
If ierror Then Exit Sub

' Loop on data points
For j% = 1 To sample(1).Datarows%
sampleupdated = False

' Check for acquired off-peak bgds (only off-peak channel multi-point data arrays can be overwritten)
For chan1% = 1 To sample(1).LastElm%
If sample(1).CrystalNames$(chan1%) <> EDS_CRYSTAL$ And sample(1).BackgroundTypes%(chan1%) = 0 Then   ' 0 = off-peak, 1 = MAN, 2 = MultiPoint

' Find other elements (with same keV, spectro and xtal, PHA?)
If mode% = 1 Then
samplemultihi% = 0
samplemultilo% = 0
sampleorder% = 1    ' in case alternating on/off arrays are not found
sample(1).MultiPointNumberofPointsAcquireHi%(chan1%) = 0
sample(1).MultiPointNumberofPointsIterateHi(chan1%) = 0
sample(1).MultiPointNumberofPointsAcquireLo%(chan1%) = 0
sample(1).MultiPointNumberofPointsIterateLo(chan1%) = 0
MPB_Flag(chan1%) = False
tOffPeakCorrectionTypes%(chan1%) = sample(1).OffPeakCorrectionTypes%(chan1%)    ' save original off-peak correction types (won't work if file is closed)

' Search all elements to see if shared MPBs are available to load
For chan2% = 1 To sample(1).LastElm%
If sample(1).DisableAcqFlag(chan2%) = 0 Then
If sample(1).DisableQuantFlag(chan2%) = 0 Then

' Check for off-peak acquisition (because MPB arrays are writable)
If sample(1).CrystalNames$(chan2%) <> EDS_CRYSTAL$ And sample(1).BackgroundTypes%(chan2%) = 0 Then   ' 0 = off-peak, 1 = MAN, 2 = MultiPoint

' Check for same keV, spectro and xtal, and PHA?)
If sample(1).KilovoltsArray!(chan1%) = sample(1).KilovoltsArray!(chan2%) Then
If sample(1).MotorNumbers%(chan1%) = sample(1).MotorNumbers%(chan2%) Then
If Trim$(UCase$(sample(1).CrystalNames$(chan1%))) = Trim$(UCase$(sample(1).CrystalNames$(chan2%))) Then

' Warn user if only PHA bias values are different (Goemann, 02/07/2018)
If AnalysisCheckForSamePHASettings And sample(1).Biases!(chan1%) <> sample(1).Biases!(chan2%) Then
msg$ = "AnalyzeSharedBgdSearchOrRemove: Only PHA bias values are different for " & sample(1).Elsyms$(chan1%) & " on channel " & Format$(chan1%) & " and " & sample(1).Elsyms$(chan2%) & " on channel " & Format$(chan2%)
Call IOWriteLogRichText(msg$, vbNullString, Int(LogWindowFontSize%), vbMagenta, Int(FONT_REGULAR%), Int(0))
End If

If Not AnalysisCheckForSamePHASettings Or (AnalysisCheckForSamePHASettings And sample(1).Biases!(chan1%) = sample(1).Biases!(chan2%)) Then

' Write chan2 "shared" alternating on-peak intensity data to chan1 alternating on/off multi-point bgd tables
If sample(1).AlternatingOnAndOffPeakAcquisitionFlag Then
Call DataVolatileGetData(Int(1), samplerow%, j%, chan2%, tVolatile)
If ierror Then Exit Sub
For sampleorder% = 1 To tVolatile.VolatilePoints%
If sample(1).CombinedConditionsFlag Then    ' re-normalize chan2% cps to beam current of chan1%
tVolatile.VolatileIntensity!(sampleorder%) = tVolatile.VolatileIntensity!(sampleorder%) * sample(1).OnBeamCountsArray!(j%, chan1%) / sample(1).OnBeamCountsArray!(j%, chan2%)
End If                                      ' "samplemulti" is always "1" for alternating on-peak intensities
Call DataMultiPointOnOffSendData(Int(1), samplerow%, j%, chan1%, Int(1), sampleorder%, tVolatile.VolatileIntensity!(sampleorder%), tVolatile.VolatileInterval!(sampleorder%), tVolatile.VolatileDateTime#(sampleorder%))
If ierror Then Exit Sub
Next sampleorder%
End If

' Start checking for high side off-peaks (0=linear, 1=average, 2=high only, 3=low only, 4=exponential, 5=slope hi, 6=slope lo, 7=polynomial, 8=multi-point)
If sample(1).HiPeaks!(chan2%) > sample(1).OnPeaks!(chan1%) And sample(1).OffPeakCorrectionTypes%(chan2%) <> 3 Then      ' modified to exclude high off-peaks if low only off-peaks (Williams and Jercinovic, 12-10-2020)
If samplemultihi% + 1 <= MAXMULTI% Then
If samplemultihi% + 1 <= MAXMULTI_OLD% Or ProbeDataFileVersionNumber! >= 12.84 Then
samplemultihi% = samplemultihi% + 1

' Write chan2 "shared" alternating hi off-peak intensity data (from HiPeak channels) to chan1 alternating on/off multi-point bgd tables
If sample(1).AlternatingOnAndOffPeakAcquisitionFlag Then
Call DataVolatileGetData(Int(2), samplerow%, j%, chan2%, tVolatile)
If ierror Then Exit Sub
For sampleorder% = 1 To tVolatile.VolatilePoints%
If sample(1).CombinedConditionsFlag Then    ' re-normalize chan2% cps to beam current of chan1%
tVolatile.VolatileIntensity!(sampleorder%) = tVolatile.VolatileIntensity!(sampleorder%) * sample(1).OnBeamCountsArray!(j%, chan1%) / sample(1).OnBeamCountsArray!(j%, chan2%)
End If
Call DataMultiPointOnOffSendData(Int(2), samplerow%, j%, chan1%, samplemultihi%, sampleorder%, tVolatile.VolatileIntensity!(sampleorder%), tVolatile.VolatileInterval!(sampleorder%), tVolatile.VolatileDateTime#(sampleorder%))
If ierror Then Exit Sub
Next sampleorder%
End If

' Now write high off-peak intensities to MPB arrays for chan2% (normalize to chan1% beam current if combined condition sample)
If Not sample(1).CombinedConditionsFlag Then
sample(1).MultiPointAcquireCountsHi!(j%, chan1%, samplemultihi%) = sample(1).HiPeakCounts!(j%, chan2%)
Else
sample(1).MultiPointAcquireCountsHi!(j%, chan1%, samplemultihi%) = sample(1).HiPeakCounts!(j%, chan2%) * sample(1).OnBeamCountsArray!(j%, chan1%) / sample(1).OnBeamCountsArray!(j%, chan2%)
End If

sample(1).MultiPointAcquireCountTimesHi!(j%, chan1%, samplemultihi%) = sample(1).HiCountTimes!(j%, chan2%)
sample(1).MultiPointAcquirePositionsHi!(chan1%, samplemultihi%) = sample(1).HiPeaks!(chan2%)
sample(1).MultiPointAcquireLastCountTimesHi!(chan1%, samplemultihi%) = sample(1).LastHiCountTimes!(chan2%)
End If
End If
End If

' Now check low peaks for high side  (0=linear, 1=average, 2=high only, 3=low only, 4=exponential, 5=slope hi, 6=slope lo, 7=polynomial, 8=multi-point)
If sample(1).LoPeaks!(chan2%) > sample(1).OnPeaks!(chan1%) And sample(1).OffPeakCorrectionTypes%(chan2%) <> 2 Then      ' modified to exclude low off-peaks if high only off-peaks (Williams and Jercinovic, 12-10-2020)
If samplemultihi% + 1 <= MAXMULTI% Then
If samplemultihi% + 1 <= MAXMULTI_OLD% Or ProbeDataFileVersionNumber! >= 12.84 Then
samplemultihi% = samplemultihi% + 1

' Write chan2 "shared" alternating hi off-peak intensity data (from LoPeak channels) to chan1 alternating on/off multi-point bgd tables
If sample(1).AlternatingOnAndOffPeakAcquisitionFlag Then
Call DataVolatileGetData(Int(2), samplerow%, j%, chan2%, tVolatile)
If ierror Then Exit Sub
For sampleorder% = 1 To tVolatile.VolatilePoints%
If sample(1).CombinedConditionsFlag Then    ' re-normalize chan2% cps to beam current of chan1%
tVolatile.VolatileIntensity!(sampleorder%) = tVolatile.VolatileIntensity!(sampleorder%) * sample(1).OnBeamCountsArray!(j%, chan1%) / sample(1).OnBeamCountsArray!(j%, chan2%)
End If
Call DataMultiPointOnOffSendData(Int(2), samplerow%, j%, chan1%, samplemultihi%, sampleorder%, tVolatile.VolatileIntensity!(sampleorder%), tVolatile.VolatileInterval!(sampleorder%), tVolatile.VolatileDateTime#(sampleorder%))
If ierror Then Exit Sub
Next sampleorder%
End If

' Now write low off-peak intensities to MPB arrays for chan2% (normalize to chan1% beam current if combined condition sample)
If Not sample(1).CombinedConditionsFlag Then
sample(1).MultiPointAcquireCountsHi!(j%, chan1%, samplemultihi%) = sample(1).LoPeakCounts!(j%, chan2%)
Else
sample(1).MultiPointAcquireCountsHi!(j%, chan1%, samplemultihi%) = sample(1).LoPeakCounts!(j%, chan2%) * sample(1).OnBeamCountsArray!(j%, chan1%) / sample(1).OnBeamCountsArray!(j%, chan2%)
End If

sample(1).MultiPointAcquireCountTimesHi!(j%, chan1%, samplemultihi%) = sample(1).LoCountTimes!(j%, chan2%)
sample(1).MultiPointAcquirePositionsHi!(chan1%, samplemultihi%) = sample(1).LoPeaks!(chan2%)
sample(1).MultiPointAcquireLastCountTimesHi!(chan1%, samplemultihi%) = sample(1).LastLoCountTimes!(chan2%)
End If
End If
End If

' Update high side MPB arrays for new data
If samplemultihi% > sample(1).MultiPointNumberofPointsAcquireHi%(chan1%) Then
sample(1).MultiPointNumberofPointsAcquireHi%(chan1%) = samplemultihi%
sample(1).MultiPointNumberofPointsIterateHi(chan1%) = samplemultihi%
sample(1).MultiPointBackgroundFitType(chan1%) = 2   ' assume exponential
End If

' Start checking for low side off-peaks (0=linear, 1=average, 2=high only, 3=low only, 4=exponential, 5=slope hi, 6=slope lo, 7=polynomial, 8=multi-point)
If sample(1).LoPeaks!(chan2%) < sample(1).OnPeaks!(chan1%) And sample(1).OffPeakCorrectionTypes%(chan2%) <> 2 Then      ' modified to exclude low off-peaks if high only off-peaks (Williams and Jercinovic, 12-10-2020)
If samplemultilo% + 1 <= MAXMULTI% Then
If samplemultilo% + 1 <= MAXMULTI_OLD% Or ProbeDataFileVersionNumber! >= 12.84 Then
samplemultilo% = samplemultilo% + 1

' Write chan2 "shared" alternating lo off-peak intensity data (from LoPeak channels) to chan1 alternating on/off multi-point bgd tables
If sample(1).AlternatingOnAndOffPeakAcquisitionFlag Then
Call DataVolatileGetData(Int(3), samplerow%, j%, chan2%, tVolatile)
If ierror Then Exit Sub
For sampleorder% = 1 To tVolatile.VolatilePoints%
If sample(1).CombinedConditionsFlag Then    ' re-normalize chan2% cps to beam current of chan1%
tVolatile.VolatileIntensity!(sampleorder%) = tVolatile.VolatileIntensity!(sampleorder%) * sample(1).OnBeamCountsArray!(j%, chan1%) / sample(1).OnBeamCountsArray!(j%, chan2%)
End If
Call DataMultiPointOnOffSendData(Int(3), samplerow%, j%, chan1%, samplemultilo%, sampleorder%, tVolatile.VolatileIntensity!(sampleorder%), tVolatile.VolatileInterval!(sampleorder%), tVolatile.VolatileDateTime#(sampleorder%))
If ierror Then Exit Sub
Next sampleorder%
End If

' Now write low off-peak intensities to MPB arrays for chan2% (normalize to chan1% beam current if combined condition sample)
If Not sample(1).CombinedConditionsFlag Then
sample(1).MultiPointAcquireCountsLo!(j%, chan1%, samplemultilo%) = sample(1).LoPeakCounts!(j%, chan2%)
Else
sample(1).MultiPointAcquireCountsLo!(j%, chan1%, samplemultilo%) = sample(1).LoPeakCounts!(j%, chan2%) * sample(1).OnBeamCountsArray!(j%, chan1%) / sample(1).OnBeamCountsArray!(j%, chan2%)
End If

sample(1).MultiPointAcquireCountTimesLo!(j%, chan1%, samplemultilo%) = sample(1).LoCountTimes!(j%, chan2%)
sample(1).MultiPointAcquirePositionsLo!(chan1%, samplemultilo%) = sample(1).LoPeaks!(chan2%)
sample(1).MultiPointAcquireLastCountTimesLo!(chan1%, samplemultilo%) = sample(1).LastLoCountTimes!(chan2%)
End If
End If
End If

' Start checking for high side off-peaks  (0=linear, 1=average, 2=high only, 3=low only, 4=exponential, 5=slope hi, 6=slope lo, 7=polynomial, 8=multi-point)
If sample(1).HiPeaks!(chan2%) < sample(1).OnPeaks!(chan1%) And sample(1).OffPeakCorrectionTypes%(chan2%) <> 3 Then       ' modified to exclude high off-peaks if low only off-peaks (Williams and Jercinovic, 12-10-2020)
If samplemultilo% + 1 <= MAXMULTI% Then
If samplemultilo% + 1 <= MAXMULTI_OLD% Or ProbeDataFileVersionNumber! >= 12.84 Then
samplemultilo% = samplemultilo% + 1

' Write chan2 "shared" alternating lo off-peak intensity data (from HiPeak channels) to chan1 alternating on/off multi-point bgd tables
If sample(1).AlternatingOnAndOffPeakAcquisitionFlag Then
Call DataVolatileGetData(Int(3), samplerow%, j%, chan2%, tVolatile)
If ierror Then Exit Sub
For sampleorder% = 1 To tVolatile.VolatilePoints%
If sample(1).CombinedConditionsFlag Then    ' re-normalize chan2% cps to beam current of chan1%
tVolatile.VolatileIntensity!(sampleorder%) = tVolatile.VolatileIntensity!(sampleorder%) * sample(1).OnBeamCountsArray!(j%, chan1%) / sample(1).OnBeamCountsArray!(j%, chan2%)
End If
Call DataMultiPointOnOffSendData(Int(3), samplerow%, j%, chan1%, samplemultilo%, sampleorder%, tVolatile.VolatileIntensity!(sampleorder%), tVolatile.VolatileInterval!(sampleorder%), tVolatile.VolatileDateTime#(sampleorder%))
If ierror Then Exit Sub
Next sampleorder%
End If

' Now write low off-peak intensities to MPB arrays for chan2% (normalize to chan1% beam current if combined condition sample)
If Not sample(1).CombinedConditionsFlag Then
sample(1).MultiPointAcquireCountsLo!(j%, chan1%, samplemultilo%) = sample(1).HiPeakCounts!(j%, chan2%)
Else
sample(1).MultiPointAcquireCountsLo!(j%, chan1%, samplemultilo%) = sample(1).HiPeakCounts!(j%, chan2%) * sample(1).OnBeamCountsArray!(j%, chan1%) / sample(1).OnBeamCountsArray!(j%, chan2%)
End If

sample(1).MultiPointAcquireCountTimesLo!(j%, chan1%, samplemultilo%) = sample(1).HiCountTimes!(j%, chan2%)
sample(1).MultiPointAcquirePositionsLo!(chan1%, samplemultilo%) = sample(1).HiPeaks!(chan2%)
sample(1).MultiPointAcquireLastCountTimesLo!(chan1%, samplemultilo%) = sample(1).LastHiCountTimes!(chan2%)
End If
End If
End If

' Update low side MPB arrays for new data
If samplemultilo% > sample(1).MultiPointNumberofPointsAcquireLo%(chan1%) Then
sample(1).MultiPointNumberofPointsAcquireLo%(chan1%) = samplemultilo%
sample(1).MultiPointNumberofPointsIterateLo(chan1%) = samplemultilo%
sample(1).MultiPointBackgroundFitType(chan1%) = 2   ' assume exponential
End If

End If  ' bias
End If  ' crystal
End If  ' spectrometer
End If  ' kilovolts

End If  ' off-peak acquisition
End If  ' disable quant
End If  ' disable acquisition
Next chan2%

' Check if less than two shared bgds were loaded
If sample(1).MultiPointNumberofPointsAcquireHi%(chan1%) + sample(1).MultiPointNumberofPointsAcquireLo%(chan1%) > 2 Then
sampleupdated = True
MPB_Flag(chan1%) = True             ' flag to set MPB background type below

' If two or fewer shared backgrounds were found, clear shared MPB data and re-set back to original off-peak type
Else
Call AnalyzeSharedBgdDeleteChannel(j%, chan1%, tOffPeakCorrectionTypes%(chan1%), sample())
If ierror Then Exit Sub
End If

End If  ' end of mode = 1 section

' If removing shared bgds, clear MPB data for shared backgrounds and re-set to original off-peak type
If mode% = 2 Then
Call AnalyzeSharedBgdDeleteChannel(j%, chan1%, tOffPeakCorrectionTypes%(chan1%), sample())
If ierror Then Exit Sub
End If

End If           ' off-peak acquisition channel and not EDS channel
Next chan1%

' Display status
If ProbeDataFileVersionNumber! > 8.45 Then
If mode% = 1 Then
If sampleupdated Then
Call IOWriteLog("Updating shared multi-point bgd sample arrays for " & sample(1).Name$ & ", line " & Format$(sample(1).Linenumber&(j%)) & "...")
DoEvents

Else
Call IOWriteLog("No shared multi-point bgd sample intensities found for " & sample(1).Name$ & ", line " & Format$(sample(1).Linenumber&(j%)) & "...")
DoEvents
End If
End If

If mode% = 2 Then
Call IOWriteLog("Clearing shared multi-point bgd sample arrays for " & sample(1).Name$ & ", line " & Format$(sample(1).Linenumber&(j%)) & "...")
DoEvents
End If
End If

Next j%

' Clear out all MPB records for this sample in the MDB file (this is slightly dangerous, but actual MPB acquisitions will get written back properly by DataReplaceAddSample)
Call DataMultiPointDeleteSample(samplerow%)
If ierror Then Exit Sub

' If mode% = 1 specify MPB off-peak correction for new MPB shared channels
If mode% = 1 Then
For chan1% = 1 To sample(1).LastElm%
If MPB_Flag(chan1%) Then sample(1).OffPeakCorrectionTypes%(chan1%) = MAXOFFBGDTYPES%
Next chan1%
End If

' Save sample with searched/removed shared MPB data and parameters
Call DataReplaceAddSample(Int(2), samplerow%, sample())
If ierror Then Exit Sub

End If  ' sampletyps and sampledels
End If  ' selected samples
Next i%

Call IOStatusAuto(vbNullString)
Call AnalyzeStatusAnal(vbNullString)
DoEvents

' Confirm with user
msg$ = Format$(nsams%) & " shared multi-point background (MPB) array samples were updated or cleared"
MsgBox msg$, vbOKOnly + vbInformation, "AnalyzeSharedBgdSearchOrRemove"

Exit Sub

' Errors
AnalyzeSharedBgdSearchOrRemoveError:
Screen.MousePointer = vbDefault
MsgBox Error$, vbOKOnly + vbCritical, "AnalyzeSharedBgdSearchOrRemove"
ierror = True
Exit Sub

End Sub

Of course another approach that wouldn't have required any code changes at all, would be to have some off-peak background positions be the same for two elements, and then simply count half as long on those "doubled up" background positions. I think the statistics would be equivalent...
« Last Edit: December 21, 2020, 02:58:30 PM by John Donovan »
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"