News:

:) We are a community of analysts, that cares about EPMA

Main Menu

Fast and Easy Modeling of Matrix Corrections in Standard.exe (Penfluor/Fanal)

Started by Probeman, January 22, 2014, 04:11:35 PM

Previous topic - Next topic

John Donovan

Speaking of large numbers, the latest version of the matrix.mdb Penepma database database now contains 721556 k-ratios.  Update the CalcZAF app from the Help menu to get this latest k-ratio database.
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

Probeman

The latest version of the Probe for EPMA/CalcZAF matrix.mdb database now contains over 860K binary k-ratios.

To learn more about this database and its uses please see this post:

https://smf.probesoftware.com/index.php?topic=152.msg9711#msg9711

I am also interested if anyone is willing to work with me to create some data visualizations of these k-ratios.
The only stupid question is the one not asked!

John Donovan

The latest version of the matrix.mdb database now contains over 1 million binary k-ratios from PENEPMA (PENFLUOR/FANAL):



The complete calculations for full periodic table of binaries will probably be complete before the end of the year!

Update to the latest CalcZAF software using the Help menu (or download the CalcZAF installer from our resources download page):

https://www.probesoftware.com/resources/

and you can find this Microsoft Access database in the C:\ProgramData\Probe Software\Probe for EPMA folder.  The matrix database can also be opened in Excel...
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"

John Donovan

The latest release of CalcZAF/Standard includes an updated matrix.mdb k-ratio database with 1.04 million k-ratios for all K, L and M alpha/beta emissions lines for 11 compositions (1 to 99 wt%) for all binaries from B to Cm in the periodic tables from 4 to 50 keV:



https://www.probesoftware.com/resources/

The only binaries missing are for Mg-Pm and Xe-Tm which need to be modeled with better statistics and are running now (was hoping to finish completely by the end of this year!).

This file is in Microsoft Access format, but one might be able to open it in a new version of Excel (I know it's too large for Excel 2010).

Here is code which can be used to query the database:

Sub Penepma12MatrixReadMDB2(tTakeoff As Single, tKilovolt As Single, tEmitter As Integer, tXray As Integer, tMatrix As Integer, tKratios() As Double, notfound As Boolean)
' This routine reads the Matrix.mdb file for the specified beam energy, emitter, x-ray, matrix.
'  tKratios#(1 to MAXBINARY%) are the k-ratios for this x-ray and binary composition

ierror = False
On Error GoTo Penepma12MatrixReadMDB2Error

Dim i As Integer
Dim nrec As Long

Dim SQLQ As String
Dim MtDb As Database
Dim MtDs As Recordset

' Check for file
If Dir$(MatrixMDBFile$) = vbNullString Then GoTo Penepma12MatrixReadMDB2NoMatrixMDBFile

' Check for use keV rounding flag for fractional keVs
If Penepma12UseKeVRoundingFlag Then
tKilovolt! = Int(tKilovolt! + 0.5)
End If

' Open matrix database (non exclusive and read only)
Screen.MousePointer = vbHourglass
Set MtDb = OpenDatabase(MatrixMDBFile$, MatrixDatabaseNonExclusiveAccess%, dbReadOnly)

' Try to find requested emitter, matrix, etc
SQLQ$ = "SELECT Matrix.BeamTakeOff, Matrix.BeamEnergy, Matrix.EmittingElement, Matrix.EmittingXray, Matrix.MatrixElement, Matrix.MatrixNumber FROM Matrix WHERE"
SQLQ$ = SQLQ$ & " BeamTakeOff = " & Format$(tTakeoff!) & " AND BeamEnergy = " & Format$(tKilovolt!) & " AND"
SQLQ$ = SQLQ$ & " EmittingElement = " & Format$(tEmitter%) & " AND EmittingXray = " & Format$(tXray%) & " AND"
SQLQ$ = SQLQ$ & " MatrixElement = " & Format$(tMatrix%)
Set MtDs = MtDb.OpenRecordset(SQLQ$, dbOpenSnapshot)

' If record not found, return notfound
If MtDs.BOF And MtDs.EOF Then
notfound = True
Screen.MousePointer = vbDefault
Exit Sub
End If

' Load return values based on "MatrixNumber"
nrec& = MtDs("MatrixNumber")
MtDs.Close

' Search for k-ratio records
SQLQ$ = "SELECT MatrixKRatio.* FROM MatrixKRatio WHERE MatrixKRatioNumber = " & Format$(nrec&)
Set MtDs = MtDb.OpenRecordset(SQLQ$, dbOpenSnapshot)
If MtDs.BOF And MtDs.EOF Then GoTo Penepma12MatrixReadMDB2NoKRatios

' Load kratio array
Do Until MtDs.EOF
i% = MtDs("MatrixKRatioOrder")          ' load order (1 to MAXBINARY%)
tKratios#(i%) = MtDs("MatrixKRatio_ZAF_KRatio")
MtDs.MoveNext
Loop
MtDs.Close

notfound = False
MtDb.Close

Screen.MousePointer = vbDefault
Exit Sub

' Errors
Penepma12MatrixReadMDB2Error:
Screen.MousePointer = vbDefault
MsgBox Error$, vbOKOnly + vbCritical, "Penepma12MatrixReadMDB2"
Call IOStatusAuto(vbNullString)
ierror = True
Exit Sub

Penepma12MatrixReadMDB2NoMatrixMDBFile:
msg$ = "File " & MatrixMDBFile$ & " was not found"
MsgBox msg$, vbOKOnly + vbExclamation, "Penepma12MatrixReadMDB2"
ierror = True
Exit Sub

Penepma12MatrixReadMDB2NoKRatios:
msg$ = "File " & MatrixMDBFile$ & " did not contain any k-ratio records for " & Format$(tTakeoff!) & " degrees, " & Format$(tKilovolt!) & " keV, " & Symup$(tEmitter%) & " " & Xraylo$(tXray%) & " in " & Symup$(tMatrix%)
MsgBox msg$, vbOKOnly + vbExclamation, "Penepma12MatrixReadMDB2"
ierror = True
Exit Sub

End Sub

All the code for reading and writing the matrix.mdb k-ratio database can be found in the CalcZAF Open Microanalysis source repository:

https://github.com/openmicroanalysis/calczaf

The source files to check would be:

Penepma12b.bas, Penepma12Matrix.bas and Penepma12Matrix2.bas.
John J. Donovan, Pres. 
(541) 343-3400

"Not Absolutely Certain, Yet Reliable"