News:

:) Please keep your software updated for best results!

Main Menu

Time Dependent Intensity (TDI) Corrections

Started by John Donovan, July 05, 2013, 09:34:51 AM

Previous topic - Next topic

John Donovan

#75
Quote from: Ben Buse on June 25, 2025, 07:59:07 AMMy next question is how do I extract aggregated tdi intensities. For Fe Flank measurements I have La on two spectrometers, which PFE aggregates, however when I view the graphical display of TDI in PFE and when I export the data using the flank export format I can only see the individual tdi values.

I had to check the code and make a simulated test run to see what the case is and I don't think you are quite correct about the TDI display. For example, I made this sample:



Then when I acquired the data, I got these net intensities:

On-Peak (off-peak corrected) or EDS (bgd corrected) or MAN On-Peak X-ray Counts (cps/1nA) (and Faraday/Absorbed Currents):
ELEM:    si ka   na ka   na ka   BEAM1   BEAM2
BGD:       OFF     OFF     OFF
SPEC:        1       3       4
CRYST:     PET     TAP     TAP
ORDER:       1       1       1
    1G   88.40   18.01   18.29  29.983  30.016

AVER:    88.40   18.01   18.29  29.983  30.016
SDEV:      .00     .00     .00    .000    .000


So 18 cps/nA for each Na spectrometer. Next I plotted the TDI intensities for spec3:



and you can see the natural log of 18 is ~2.9. Same for spec4:



But if I turn on the "aggregate" intensity feature in the Analysis Option window:



Now the output in the log window is 36 cps/nA for the first Na spectrometer since it is aggregated:

On-Peak (off-peak corrected) or EDS (bgd corrected) or MAN On-Peak X-ray Counts (cps/1nA) (and Faraday/Absorbed Currents):
ELEM:    si ka   na ka   na ka   BEAM1   BEAM2
BGD:       OFF     OFF     OFF
SPEC:        1       3       4
CRYST:     PET     TAP     TAP
ORDER:       1       1       1
    1G   88.40   36.30     .00  29.983  30.016

AVER:    88.40   36.30     .00  29.983  30.016
SDEV:      .00     .00     .00    .000    .000


And the TDI plot shows this:



Note that the plot title no longer states the spectrometer number, but says "Aggregate Intensities". And the natural log of 36 is ~3.6.

We had previously tried to alert the user to this by not displaying the TDI fit type in the Standard Assignments dialog as seen here:



but it's a little confusing because in the past one could click on the duplicate element (to assign standards and interferences, etc.), but one could still display the TDI intensities.  However, because the code aggregates only from the current element to subsequent duplicate elements, you would only see the intensities from the 2nd Na channel even if the aggregate option is elected.

So in the latest version of the code, we've disabled the TDI controls for duplicate elements, if the aggregate option is selected. Here's the Standard Assignments dialog for Na on spec 4 (duplicate) and aggregate mode selected in Analysis Options:



As for exporting TDI intensities, your best bet is the Run | Display Time Dependent (TDI) Intensities menu. These intensities will always be unaggregated.  Or you can access the TDI tables directly in the MDB file using MicroSoft Access. The SQL code is:

Sub DataVolatileGetData2(mode As Integer, samplerow As Integer, sampleline As Integer, samplechan As Integer, ttxdata() As Double, ttydata() As Single, tttdata() As Single, ttadata() As Single, npts As Integer)
' Get (self) volatile intensities and time from volatile table (no beam drift correction is applied because only the slope matters)
'  mode = 1 get on-peak data (volatile correction or alternating on and off peak)
'  mode = 2 get hi-off peak data (alternating on and off peak only)
'  mode = 3 get lo-off peak data (alternating on and off peak only)
'  samplerow points to sample row array  (1 to MAXSAMPLES%)
'  sampleline points to data row array (1 TO MAXROW%)
'  samplechan points to element row array (1 to MAXCHAN%)
'  ttxdata() = date time values (double precision)
'  ttydata() = counts per sec
'  tttdata() = count time data in seconds
'  ttadata() = absorbed current data
'  npts = number of TDI points

ierror = False
On Error GoTo DataVolatileGetData2Error

Dim temp As Double
Dim SQLQ  As String

Dim PrDb As Database
Dim PrRs As Recordset

' Check for valid file name
If ProbeDataFile$ = vbNullString Then GoTo DataVolatileGetData2NoProbeDataFile

' Check if data is available
npts% = 0
If mode% > 1 And ProbeDataFileVersionNumber! < 6.52 Then Exit Sub

' Open probe database and "Volatile" table
Screen.MousePointer = vbHourglass

' Open the database using error trapping for databases already open for exclusive use
Call DataOpenDatabase("DataVolatileGetData", PrDb, ProbeDataFile$, ProbeDatabaseNonExclusiveAccess%, dbReadOnly)
If ierror Then Exit Sub

If mode% = 1 Then
SQLQ$ = "SELECT Volatile.* FROM Volatile WHERE Volatile.VolatileToRow = " & Str$(samplerow%) & " "
SQLQ$ = SQLQ$ & "and Volatile.VolatileLineOrder = " & Str$(sampleline%) & " "
SQLQ$ = SQLQ$ & "and Volatile.VolatileElementOrder = " & Str$(samplechan%) & " "
SQLQ$ = SQLQ$ & "ORDER BY Volatile.VolatileOrder ASC"       ' order by volatile acquisition order
End If

If mode% = 2 Then
SQLQ$ = "SELECT VolatileHi.* FROM VolatileHi WHERE VolatileHi.VolatileToRow = " & Str$(samplerow%) & " "
SQLQ$ = SQLQ$ & "and VolatileHi.VolatileLineOrder = " & Str$(sampleline%) & " "
SQLQ$ = SQLQ$ & "and VolatileHi.VolatileElementOrder = " & Str$(samplechan%) & " "
SQLQ$ = SQLQ$ & "ORDER BY VolatileHi.VolatileOrder ASC"       ' order by volatile acquisition order
End If

If mode% = 3 Then
SQLQ$ = "SELECT VolatileLo.* FROM VolatileLo WHERE VolatileLo.VolatileToRow = " & Str$(samplerow%) & " "
SQLQ$ = SQLQ$ & "and VolatileLo.VolatileLineOrder = " & Str$(sampleline%) & " "
SQLQ$ = SQLQ$ & "and VolatileLo.VolatileElementOrder = " & Str$(samplechan%) & " "
SQLQ$ = SQLQ$ & "ORDER BY VolatileLo.VolatileOrder ASC"       ' order by volatile acquisition order
End If

Set PrRs = PrDb.OpenRecordset(SQLQ$, dbOpenSnapshot)

' Load into arrays
Do Until PrRs.EOF
npts% = npts% + 1
ReDim Preserve ttxdata(1 To npts%) As Double
ReDim Preserve ttydata(1 To npts%) As Single
ReDim Preserve tttdata(1 To npts%) As Single
ReDim Preserve ttadata(1 To npts%) As Single

' Load intensities for volatile and on/off peak alternating intensities
If mode% = 1 Then
ttxdata#(npts%) = PrRs("VolatileDateTime")      ' variant (dbDateTime)
If IsNull(ttxdata#(npts%)) Then ttxdata#(npts%) = 0#
ttydata!(npts%) = PrRs("VolatileOnCount")
tttdata!(npts%) = PrRs("VolatileOnTime")
If ProbeDataFileVersionNumber! >= 10.75 Then ttadata!(npts%) = PrRs("VolatileOnAbsorbed")
End If

If ProbeDataFileVersionNumber! >= 6.52 Then  ' for alternating off peak data
If mode% = 2 Then
ttxdata#(npts%) = PrRs("VolatileHiDateTime")    ' variant (dbDateTime)
If IsNull(ttxdata#(npts%)) Then ttxdata#(npts%) = 0#
ttydata!(npts%) = PrRs("VolatileHiCount")
tttdata!(npts%) = PrRs("VolatileHiTime")
If ProbeDataFileVersionNumber! >= 10.75 Then ttadata!(npts%) = PrRs("VolatileHiAbsorbed")
End If

If mode% = 3 Then
ttxdata#(npts%) = PrRs("VolatileLoDateTime")    ' variant (dbDateTime)
If IsNull(ttxdata#(npts%)) Then ttxdata#(npts%) = 0#
ttydata!(npts%) = PrRs("VolatileLoCount")
tttdata!(npts%) = PrRs("VolatileLoTime")
If ProbeDataFileVersionNumber! >= 10.75 Then ttadata!(npts%) = PrRs("VolatileLoAbsorbed")
End If
End If

If VerboseMode And DebugMode Then
temp# = (ttxdata#(npts%) - ttxdata#(1)) / SECPERDAY#
Call IOWriteLog("Time Dependent Intensity (TDI) elapsed time: " & Str$(npts%) & ", " & Str$(temp#))
End If

PrRs.MoveNext
Loop

PrRs.Close

' Check for no valid data for this line and channel (will only occur when using Nth points with zero time fraction, so handle in calling routine)
'If npts% = 0 Then GoTo DataVolatileGetData2NoPoints

Screen.MousePointer = vbDefault
Exit Sub

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

DataVolatileGetData2NoProbeDataFile:
msg$ = "Probe database file name is blank"
MsgBox msg$, vbOKOnly + vbExclamation, "DataVolatileGetData2"
ierror = True
Exit Sub

'DataVolatileGetData2NoPoints:
'Screen.MousePointer = vbDefault
'msg$ = "No Time Dependent Intensity (TDI) self-calibration or Alternating On/Off Peak acquisition data for sample " & SampleGetString$(samplerow%) & ", row " & Str$(samplerow%) & ", line " & Str$(sampleline%) & ", channel " & Str$(samplechan%)
'MsgBox msg$, vbOKOnly + vbExclamation, "DataVolatileGetData2"
'ierror = True
'Exit Sub

End Sub
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

bek425

Hi John,

Sorry if this is a dumb question (I'm new to using this software), but I was wondering how to export data so it has a quadratic TDI?

I've been able to successfully export versions of my data with no TDI correction and linear TDI correction (on elements that can be TDI corrected) using Analyze! -> Standard Assignments -> selecting the type of fit I want for the elements I want a TDI correction for using 'Use TDI "Self" Calibration Correction', and then going to Analytical -> Analysis Options -> and using 'Use Assigned or Self Time Dependent Intensity (TDI) Corrections on Unknowns.'

However, when I go through the same process and set the TDI element fit type for F and Cl to log-quadratic (hyper-exponential) in the Analyze! -> Standard Assignments window, none of the points I've tested this on end up exporting with having a quadratic TDI correction. I've also tried doing Run -> 'Display Time Dependent (TDI) and Alternating (on/off) Intensities' and manually setting specific elements for specific data points to have a quadratic TDI (by checking 'Quadratic' and then selecting 'Assign Fit to Sample'). Neither of these methods seemed to have worked--it seems to export my data as either as having no TDI or a linear one, based off of comparisons to my other data sets.

Is there some easy way to just set everything that can have a quadratic TDI applied to it to export that way that I'm missing?

Thanks! :)

Probeman

#77
Quote from: bek425 on January 01, 2026, 03:31:15 PMHi John,

Sorry if this is a dumb question (I'm new to using this software), but I was wondering how to export data so it has a quadratic TDI?

I've been able to successfully export versions of my data with no TDI correction and linear TDI correction (on elements that can be TDI corrected) using Analyze! -> Standard Assignments -> selecting the type of fit I want for the elements I want a TDI correction for using 'Use TDI "Self" Calibration Correction', and then going to Analytical -> Analysis Options -> and using 'Use Assigned or Self Time Dependent Intensity (TDI) Corrections on Unknowns.'

However, when I go through the same process and set the TDI element fit type for F and Cl to log-quadratic (hyper-exponential) in the Analyze! -> Standard Assignments window, none of the points I've tested this on end up exporting with having a quadratic TDI correction. I've also tried doing Run -> 'Display Time Dependent (TDI) and Alternating (on/off) Intensities' and manually setting specific elements for specific data points to have a quadratic TDI (by checking 'Quadratic' and then selecting 'Assign Fit to Sample'). Neither of these methods seemed to have worked--it seems to export my data as either as having no TDI or a linear one, based off of comparisons to my other data sets.

Is there some easy way to just set everything that can have a quadratic TDI applied to it to export that way that I'm missing?

Thanks! :)

What exactly do you mean by "successfully export versions of my data"?

Do you mean exporting the TDI fits to an external file using the Output menu?   Or do you mean just specifying different fits to the TDI data within PFE?
The only stupid question is the one not asked!

bek425

Sorry for not specifying. I meant the first one (exporting the TDI fits to an external file using the Output menu), specifically as DAT and Excel files.

Probeman

#79
Quote from: bek425 on January 02, 2026, 05:58:52 PMSorry for not specifying. I meant the first one (exporting the TDI fits to an external file using the Output menu), specifically as DAT and Excel files.

That's odd.  Are your quantitative results different as reported in the log window for the different TDI fits?

When I assign different TDI fits to the sample, either from the Standard Assignments dialog or the Run | Save Time Independent (TDI) or Alternating (on/off) Intensities menu, when exporting using the Output | Save Time Dependent Intensities menu window, it exports different fit coefficients for the different assigned fits.



I assume you've watched the TDI video tutorial?

https://www.youtube.com/watch?v=PmikwXCy5LA&;

See also export file attachments below.
The only stupid question is the one not asked!