Probe Software Users Forum

Software => CalcZAF and Standard => Topic started by: Ben Buse on April 26, 2018, 03:15:19 AM

Title: plotting PAP phi-rho-z
Post by: Ben Buse on April 26, 2018, 03:15:19 AM
Hi,

This might be an off-the-wall idea, but would it be possible to extract the phi-rho-z curves and plot them from the calculations in calc-zaf. I think it might offer an alternative to monte-carlo when considering interaction volume (ok its only z, and you'd have to factor in density), it might also be useful for teaching matrix corrections? It would also allow direct comparison with phi-rho-z curves produced from monte carlo simulations aiding R&D.

Ben
Title: Re: plotting PAP phi-rho-z
Post by: John Donovan on April 26, 2018, 09:03:22 AM
Quote from: Ben Buse on April 26, 2018, 03:15:19 AM
Hi,

This might be an off-the-wall idea, but would it be possible to extract the phi-rho-z curves and plot them from the calculations in calc-zaf. I think it might offer an alternative to monte-carlo when considering interaction volume (ok its only z, and you'd have to factor in density), it might also be useful for teaching matrix corrections? It would also allow direct comparison with phi-rho-z curves produced from monte carlo simulations aiding R&D.

Ben

Hi Ben,
Actually I think it's a very interesting idea and it very much relates to the topic here that Mike and I were discussing just recently:

http://smf.probesoftware.com/index.php?topic=1065.0

Perhaps when you have a few minutes we can skype and discuss what might be possible?
john
Title: Re: plotting PAP phi-rho-z
Post by: Ben Buse on April 30, 2018, 05:26:22 AM
Hi John,

That's interesting, this could be your answer!

As I see it it could either be a separate menu like x-ray range - where you ask for (1) material [composition as string]. (2) voltage, (3) density optional for distance, (4) element. Or what might be better is when you "calculate" in calczaf, there is an option to display phi-rho-curve for current sample for all elements or select element

The output could be a graph and a text file containing raw data.

Graph is no density supplied [graphs below are calculated using Armstrong 1990] Orange line after x-ray absorption

(https://smf.probesoftware.com/gallery/453_30_04_18_5_21_02.png)

Graph if density supplied.

(https://smf.probesoftware.com/gallery/453_30_04_18_5_21_17.png)

You could also if you like return depth at X% percentile

Ben
Title: Re: plotting PAP phi-rho-z
Post by: Ben Buse on April 30, 2018, 05:42:40 AM
And just for fun here's a comparison to casino

(https://smf.probesoftware.com/gallery/453_30_04_18_5_42_07.png)
Title: Re: plotting PAP phi-rho-z
Post by: John Donovan on May 09, 2018, 01:59:58 PM
Quote from: Ben Buse on April 26, 2018, 03:15:19 AM
This might be an off-the-wall idea, but would it be possible to extract the phi-rho-z curves and plot them from the calculations in calc-zaf. I think it might offer an alternative to monte-carlo when considering interaction volume (ok its only z, and you'd have to factor in density), it might also be useful for teaching matrix corrections? It would also allow direct comparison with phi-rho-z curves produced from monte carlo simulations aiding R&D.

Hi Ben,
Easier said than done, but with a lot of help from Paul Carpenter and Brian Joy we managed to implement something that hopefully will be useful.  Here's an example of Fe2SiO4 (D=3) at 15 keV:

(https://smf.probesoftware.com/gallery/1_09_05_18_1_20_53.png)

Right now we only calculate these curves for the phi-rho-z methods *other* than PAP and XPP.  Brian Joy is working on the PAP and XPP curves and as soon as he finishes, we will implement that next.  Basically one simply checks the Plot Phi-Rho-Z Curves checkbox here and then runs a calculation in CalcZAF to obtain the plot output:

(https://smf.probesoftware.com/gallery/1_09_05_18_1_28_00.png)

But you can also plot microns depth if you have properly specified the density from the Calculation Options dialog:

(https://smf.probesoftware.com/gallery/1_09_05_18_1_21_08.png)

Note that the generated intensity curve is a thick line and the emitted intensity is a thin line. Finally here is a more complicated sample (NIST K-411 glass):

(https://smf.probesoftware.com/gallery/1_09_05_18_1_21_23.png)

This feature is now available in CalcZAF v. 12.3.2 by updating CalcZAF from the Help menu.
Title: Re: plotting PAP phi-rho-z
Post by: John Donovan on May 10, 2018, 10:49:09 PM
With Brian Joy's help we implemented prz plots for the PAP and XPP methods in CalcZAF v. 12.3.3.  Here is a plot of the PAP curves for Fe2SiO4:

(https://smf.probesoftware.com/gallery/1_10_05_18_10_30_33.png)

And here is the XPP plot:

(https://smf.probesoftware.com/gallery/1_10_05_18_10_30_47.png)

As many of you know, the PAP prz method is interesting because it attempts to be physically accurate with regard to depth as opposed to other analytical models that focused primarily on the area under the curve (the genesis of PAP was thin film modeling by Pouchou). However, the validity of area under the curve analytical models is demonstrated by the surprising accuracy of the Love/Scott quadrilateral "prz" method which assumes the x-ray production distribution curve with depth is a rectangle!  But since we're essentially comparing the ratio of the calculated intensity in a pure element with that of the compound, shape really doesn't matter.

Unless you really want to know the actual depth distribution of the x-ray production (e.g., a thin film).  This is basically what I was getting at in this recent topic here:

http://smf.probesoftware.com/index.php?topic=1065.0

Also, just as a reminder, the intensities plotted here are normalized intensities and only reflect the elements present, regardless of their concentrations.  The only effect concentration has on the plotted intensities are seen in the emitted intensity curves due to the average mass absorption coefficients.

To demonstrate, here is a PAP model of TiO2 at 15 keV:

(https://smf.probesoftware.com/gallery/1_10_05_18_10_31_01.png)

Here we can see that although oxygen x-rays are generated at a considerable depth, the O Ka x-ray emission volume is mostly within the top 200 nm of the sample.  Download the latest CalcZAF 12.3.3 and try the same calculation but with the formula Ti99O or TiO99.
Title: Re: plotting PAP phi-rho-z
Post by: Brian Joy on May 11, 2018, 08:00:42 AM
Quote from: John Donovan on May 10, 2018, 10:49:09 PM
Also, just as a reminder, the intensities plotted here are normalized intensities and only reflect the elements present, regardless of their concentrations.  The only effect concentration has on the plotted intensities are seen in the emitted intensity curves due to the average mass absorption coefficients.

But keep in mind that the model parameters, for instance phi0, Rm, Rc, and Rx in the PAP model are functions of composition, so phi(rho*z), the integral of which (between limits rho*z = 0 and rho*z = Rx) gives generated intensity, does in fact vary with composition.
Title: Re: plotting PAP phi-rho-z
Post by: John Donovan on May 11, 2018, 08:34:28 AM
Quote from: Brian Joy on May 11, 2018, 08:00:42 AM
Quote from: John Donovan on May 10, 2018, 10:49:09 PM
Also, just as a reminder, the intensities plotted here are normalized intensities and only reflect the elements present, regardless of their concentrations.  The only effect concentration has on the plotted intensities are seen in the emitted intensity curves due to the average mass absorption coefficients.

But keep in mind that the model parameters, for instance phi0, Rm, Rc, and Rx in the PAP model are functions of composition, so phi(rho*z), the integral of which (between limits rho*z = 0 and rho*z = Rx) gives generated intensity, does in fact vary with composition.

But the generated curves are normalized to the intensity at the surface, yes?
Title: Re: plotting PAP phi-rho-z
Post by: Brian Joy on May 11, 2018, 08:58:26 AM
Quote from: John Donovan on May 11, 2018, 08:34:28 AM
Quote from: Brian Joy on May 11, 2018, 08:00:42 AM
Quote from: John Donovan on May 10, 2018, 10:49:09 PM
Also, just as a reminder, the intensities plotted here are normalized intensities and only reflect the elements present, regardless of their concentrations.  The only effect concentration has on the plotted intensities are seen in the emitted intensity curves due to the average mass absorption coefficients.

But keep in mind that the model parameters, for instance phi0, Rm, Rc, and Rx in the PAP model are functions of composition, so phi(rho*z), the integral of which (between limits rho*z = 0 and rho*z = Rx) gives generated intensity, does in fact vary with composition.

But the generated curves are normalized to the intensity at the surface, yes?

No, the generated intensity is normalized to the intensity produced by a thin film (mass thickness = d(rho*z)) of the pure element in a vacuum.  See, for instance, Electron Probe Quantitation, bottom of p. 32.
Title: Re: plotting PAP phi-rho-z
Post by: John Donovan on May 11, 2018, 09:09:45 AM
Quote from: Brian Joy on May 11, 2018, 08:58:26 AM
Quote from: John Donovan on May 11, 2018, 08:34:28 AM
Quote from: Brian Joy on May 11, 2018, 08:00:42 AM
Quote from: John Donovan on May 10, 2018, 10:49:09 PM
Also, just as a reminder, the intensities plotted here are normalized intensities and only reflect the elements present, regardless of their concentrations.  The only effect concentration has on the plotted intensities are seen in the emitted intensity curves due to the average mass absorption coefficients.

But keep in mind that the model parameters, for instance phi0, Rm, Rc, and Rx in the PAP model are functions of composition, so phi(rho*z), the integral of which (between limits rho*z = 0 and rho*z = Rx) gives generated intensity, does in fact vary with composition.

But the generated curves are normalized to the intensity at the surface, yes?

No, the generated intensity is normalized to the intensity produced by a thin film (mass thickness = d(rho*z)) of the pure element in a vacuum.  See, for instance, Electron Probe Quantitation, bottom of p. 32.

Yes, by "at the surface" I meant "a thin film".
Title: Re: plotting PAP phi-rho-z
Post by: Brian Joy on May 11, 2018, 09:16:43 AM
Quote from: John Donovan on May 11, 2018, 09:09:45 AM
Quote from: Brian Joy on May 11, 2018, 08:58:26 AM
Quote from: John Donovan on May 11, 2018, 08:34:28 AM
Quote from: Brian Joy on May 11, 2018, 08:00:42 AM
Quote from: John Donovan on May 10, 2018, 10:49:09 PM
Also, just as a reminder, the intensities plotted here are normalized intensities and only reflect the elements present, regardless of their concentrations.  The only effect concentration has on the plotted intensities are seen in the emitted intensity curves due to the average mass absorption coefficients.

But keep in mind that the model parameters, for instance phi0, Rm, Rc, and Rx in the PAP model are functions of composition, so phi(rho*z), the integral of which (between limits rho*z = 0 and rho*z = Rx) gives generated intensity, does in fact vary with composition.

But the generated curves are normalized to the intensity at the surface, yes?

No, the generated intensity is normalized to the intensity produced by a thin film (mass thickness = d(rho*z)) of the pure element in a vacuum.  See, for instance, Electron Probe Quantitation, bottom of p. 32.

Yes, by "at the surface" I meant "a thin film".

I haven't stated it precisely enough, so I'll just quote Pouchou and Pichoir:  "Phi(rho*z) is the ratio between the intensity of an elemental [fictive] layer of mass thickness d(rho*z) and that of an identical but unsupported layer."

Here is one way to look at it:  If the matrix composition varies, then varying proportions of electrons (due to deceleration/energy loss as a function of composition) will have the appropriate energy to ionize the element of interest in its fictive pure layer of thickness d(rho*z) at a given mass depth, rho*z.  Since the intensity produced by the same isolated ("unsupported") layer is constant for a given beam energy, then phi(rho*z) must vary with composition at given mass depth, rho*z.
Title: Re: plotting PAP phi-rho-z
Post by: John Donovan on May 11, 2018, 09:23:48 AM
Thanks Brian.   It is great to have your help on the physics modeling.    8)
Title: Re: plotting PAP phi-rho-z
Post by: Paul Carpenter on May 11, 2018, 10:12:58 AM
John,
This is an excellent addition to CalcZAF. We will use it at Lehigh 2018.
Inspection of the equations used for the prz curve do show that it is a function of composition via the backscatter fraction and overvoltage parameters, and those are weighted by concentration; so yes, the curves are specific to the composition. As well the emitted curve clearly depends on the mac of the matrix material, again weighted by concentration.

My understanding is that the monte carlo simulation is superior for determining the lateral and vertical limits of electron scattering compared to the prz algorithm which is based on a small number of tracer experiments and via curve fitting generalized to all compositions. That is, the MC calculation is truly composition specific.

One problem with defining the depth of the analytical volume is that it is a cumulative distribution function. Is the depth the limit of electron scattering at zero residual energy, or the 99.99% limit of characteristic X-ray production, or emission. These are all quite different. There are cumulative plots in the older versions of Goldstein that allow you to quote the resolution at a specific percentage of total. The contoured energy deposition plot of Casino is very nice in outlining the volume from which a given X-ray energy can be generated.

Cheers,

Paul
Title: Re: plotting PAP phi-rho-z
Post by: John Donovan on May 11, 2018, 10:22:18 AM
Quote from: Paul Carpenter on May 11, 2018, 10:12:58 AM
My understanding is that the monte carlo simulation is superior for determining the lateral and vertical limits of electron scattering compared to the prz algorithm which is based on a small number of tracer experiments and via curve fitting generalized to all compositions. That is, the MC calculation is truly composition specific.

Hi Paul,
No question that Monte Carlo is the most accurate method (and for that the Penepma GUI in Standard.exe companion app is the way to go), but this is what Ben and I wanted for a "quick and dirty" evaluation of where the x-rays are coming from without setting up an entire Monte Carlo simulation.
Title: Re: plotting PAP phi-rho-z
Post by: Brian Joy on May 11, 2018, 02:39:03 PM
Also, I should point out that the reason the value of phi(rho*z) is typically greater than one at the surface is that the (generally fictive) thin pure layer of the element under consideration can be ionized from below by backscattered electrons, an effect that is absent in the thin isolated layer of that same element.  As can be seen in the plot below (with curves labeled for different accelerating potentials), as the beam energy decreases to that of the critical excitation energy (here Zn Kabs), the value of phi(0) should decrease to unity.

Edit:  Fluorescence due to the continuum emitted by the substrate (or overlying material) can also contribute to phi(rho*z) within the thin layer of interest, and this (depending on beam energy) could be more significant for Zn Ka than for the Ka lines of elements of lower atomic number.  I believe that this is what Armstrong is hinting at near the bottom of p. 278 in EPQ, where he states, "...phi(rho*z) equations probably inadvertently incorporate some correction for continuum fluorescence."  Heinrich also makes brief mention of this effect in section 10.2.1 of "Electron Beam X-ray Microanalysis."

(https://smf.probesoftware.com/gallery/381_11_05_18_2_32_10.png)
Title: Re: plotting PAP phi-rho-z
Post by: John Donovan on May 13, 2018, 08:35:30 PM
Quote from: Brian Joy on May 11, 2018, 02:39:03 PM
Edit:  Fluoresence due to the continuum emitted by the substrate (or overlying material) can also contribute to phi(rho*z) within the thin layer of interest, and this (depending on beam energy) could be more significant for Zn Ka than for the Ka lines of elements of lower atomic number.  I believe that this is what Armstrong is hinting at near the bottom of p. 278 in EPQ, where he states, "...phi(rho*z) equations probably inadvertently incorporate some correction for continuum fluorescence."  Heinrich also makes brief mention of this effect in section 10.2.1 of "Electron Beam X-ray Microanalysis."

Thanks for the explanation.  This makes perfect sense.
Title: Re: plotting PAP phi-rho-z
Post by: John Donovan on May 14, 2018, 08:42:47 PM
Quote from: Paul Carpenter on May 11, 2018, 10:12:58 AM
This is an excellent addition to CalcZAF. We will use it at Lehigh 2018.
Inspection of the equations used for the prz curve do show that it is a function of composition via the backscatter fraction and overvoltage parameters, and those are weighted by concentration; so yes, the curves are specific to the composition. As well the emitted curve clearly depends on the mac of the matrix material, again weighted by concentration.

My understanding is that the monte carlo simulation is superior for determining the lateral and vertical limits of electron scattering compared to the prz algorithm which is based on a small number of tracer experiments and via curve fitting generalized to all compositions. That is, the MC calculation is truly composition specific.

One problem with defining the depth of the analytical volume is that it is a cumulative distribution function. Is the depth the limit of electron scattering at zero residual energy, or the 99.99% limit of characteristic X-ray production, or emission. These are all quite different. There are cumulative plots in the older versions of Goldstein that allow you to quote the resolution at a specific percentage of total. The contoured energy deposition plot of Casino is very nice in outlining the volume from which a given X-ray energy can be generated.

Hi Paul,
That's a good idea.  We should be able to output a table of the % emitted volume vs. depth for each x-ray. 

Give us a few days to think about it.
john
Title: Re: plotting PAP phi-rho-z
Post by: Ben Buse on May 15, 2018, 06:06:40 AM
This looks really good, I look forward to trying it. I didn't realise how complex it was when I asked, thank you John, Brian and Paul for all your hard work and the useful discussion here regarding them

Ben
Title: Re: plotting PAP phi-rho-z
Post by: John Donovan on May 16, 2018, 09:19:01 AM
Quote from: Paul Carpenter on May 11, 2018, 10:12:58 AM
One problem with defining the depth of the analytical volume is that it is a cumulative distribution function. Is the depth the limit of electron scattering at zero residual energy, or the 99.99% limit of characteristic X-ray production, or emission. These are all quite different. There are cumulative plots in the older versions of Goldstein that allow you to quote the resolution at a specific percentage of total. The contoured energy deposition plot of Casino is very nice in outlining the volume from which a given X-ray energy can be generated.

Hi Paul,
The latest CalcZAF (and PFE) update (v. 12.3.4) now outputs the 60, 80, 90, 95 and 99% area depths for the emitted x-rays.  Here is a table for Fe2SiO4 where I adjusted the keVs (using the Combined Conditions button dialog in CalcZAF) to give similar emitted intensities depths for the 99% emission volumes for Fe, Si and O:

Fe2SiO4, sample 1, Emitted intensity area vs. depth for 60, 80, 90, 95 and 99% areas:
   Fe ka    Mass Depth  Micron Depth, TO = 40, keV = 16, d = 4.39
     60%     0.1711894      0.389953
     80%     0.2519391     0.5738931
     90%     0.3197691     0.7284034
     95%     0.3779091     0.8608409
     99%     0.4909591      1.118358

   Si ka    Mass Depth  Micron Depth, TO = 40, keV = 15, d = 4.39
     60%      0.160497     0.3655969
     80%     0.2426119     0.5526467
     90%     0.3097965     0.7056869
     95%     0.3695162     0.8417225
     99%      0.492688      1.122296

   O  ka    Mass Depth  Micron Depth, TO = 40, keV = 17, d = 4.39
     60%     0.1483749     0.3379839
     80%     0.2275082      0.518242
     90%     0.3016956     0.6872336
     95%     0.3659912     0.8336929
     99%     0.4995283      1.137878

And here is the prz plot output for a "combined condition" sample in CalcZAF:

(https://smf.probesoftware.com/gallery/1_16_05_18_9_17_05.png)
Title: Re: plotting PAP phi-rho-z
Post by: Paul Carpenter on May 16, 2018, 11:28:07 AM
John,
Yes, this is very nice to have and we will use it at Lehigh Microscopy School for the "Quantitative X-ray Microanalysis: Problem Solving using EDS and WDS Techniques" course.

Cheers,
Paul
Title: Re: plotting PAP phi-rho-z
Post by: John Donovan on May 20, 2018, 06:22:34 PM
I made a small tweak to the prz table output to the log window.  So just as the prz absorption model info is output to the plot:

(https://smf.probesoftware.com/gallery/1_10_05_18_10_30_33.png)

The same info is now output to the log window as seen here:

Fe2SiO4, sample 1, Emitted intensity area vs. depth for 60, 80, 90, 95 and 99% areas:
ZAF or Phi-Rho-Z Calculations
LINEMU   Henke (LBL, 1985) < 10KeV / CITZMU > 10KeV
Phi(pz) Absorption of Pouchou and Pichoir-Full (Original)

   Fe ka    Mass Depth  Micron Depth, TO = 40, keV = 15, d = 5
     60%     0.1563522     0.3127044
     80%     0.2387924     0.4775849
     90%     0.3070188     0.6140377
     95%     0.3610314     0.7220629
     99%     0.4463145     0.8926289

   Si ka    Mass Depth  Micron Depth, TO = 40, keV = 15, d = 5
     60%     0.1648737     0.3297475
     80%     0.2456282     0.4912564
     90%     0.3162884     0.6325768
     95%      0.380219     0.7604381
     99%     0.4878917     0.9757833

   O  ka    Mass Depth  Micron Depth, TO = 40, keV = 15, d = 5
     60%     0.1348381     0.2696762
     80%     0.2039859     0.4079717
     90%     0.2662188     0.5324376
     95%      0.321537      0.643074
     99%     0.4356308     0.8712616
Title: Re: plotting PAP phi-rho-z
Post by: Sander on January 27, 2022, 09:36:05 AM
Quote from: Brian Joy on May 11, 2018, 02:39:03 PM
(https://smf.probesoftware.com/gallery/381_11_05_18_2_32_10.png)

Dear prof. Joy, I stumbled across this thread when I was trying to understand the shape of phi(rhoZ) curves.  I implemented the algorithms from the P&P paper as published in the EPQ book (some formulas contain quite some typos, actually) and I managed to reproduce the graphs as you posted them.  I do have a question about the horizontal axis; I can't figure out how to reproduce your micrometer scale.  If I divide the rho-z scale (which is in mg/cm^2) by the density of Zn (7.14 g/cm^3) then I should get the scale in "milli-centimeters", right?  But however I fiddle with the scale factor, I can't get a proper scale in micrometers that matches yours...
Title: Re: plotting PAP phi-rho-z
Post by: Probeman on January 27, 2022, 09:58:48 AM
Until Brian responds, you might want to look at the CalcZAF code here:

https://github.com/openmicroanalysis/calczaf

which also displays the phi-rho-z curves in mass thickness and linear thickness.  See procedure PlotPhiRhoZCurves in the code module PlotPhiRhoZ.bas.
Title: Re: plotting PAP phi-rho-z
Post by: Brian Joy on January 27, 2022, 02:05:13 PM
Quote from: Sander on January 27, 2022, 09:36:05 AM
Quote from: Brian Joy on May 11, 2018, 02:39:03 PM
(https://smf.probesoftware.com/gallery/381_11_05_18_2_32_10.png)

Dear prof. Joy, I stumbled across this thread when I was trying to understand the shape of phi(rhoZ) curves.  I implemented the algorithms from the P&P paper as published in the EPQ book (some formulas contain quite some typos, actually) and I managed to reproduce the graphs as you posted them.  I do have a question about the horizontal axis; I can't figure out how to reproduce your micrometer scale.  If I divide the rho-z scale (which is in mg/cm^2) by the density of Zn (7.14 g/cm^3) then I should get the scale in "milli-centimeters", right?  But however I fiddle with the scale factor, I can't get a proper scale in micrometers that matches yours...

Hi Sander,

I've attached the spreadsheet that I used to plot the curves using output from my matrix correction program.  (You'll need to be logged in to see the attachment.)  In order to get depth in microns rather than mass-depth [mg cm-2] on the horizontal axis, it's necessary to divide mass-depth by the density, 7140 mg cm-3, and then multiply the resulting quantity by 10000 μm cm-1.

Let me know if the spreadsheet solves your problem.

Brian
Title: Re: plotting PAP phi-rho-z
Post by: Sander on January 28, 2022, 01:25:49 AM
Quote from: Probeman on January 27, 2022, 09:58:48 AM
Until Brian responds, you might want to look at the CalcZAF code here:

https://github.com/openmicroanalysis/calczaf

which also displays the phi-rho-z curves in mass thickness and linear thickness.  See procedure PlotPhiRhoZCurves in the code module PlotPhiRhoZ.bas.

I did see that code, which confirmed some of my doubts about the formulas in the P&P paper.  For example, equation 13 says F = (R/S)* Q(E0), and I thought that should be a division by Q (in correspondence with equations 2 and 3).  Also, I did the integrals and derivations by hand and in equation 24 (for the average depth of ionization), their result misses the 1/F factor.  I saw that the CalcZAF code was doing the same things I did, so that was helpful.
Title: Re: plotting PAP phi-rho-z
Post by: Sander on January 28, 2022, 01:31:27 AM
Hi Brian,

Can it be that your axis is then actually in rho*Z rather than in microns?  In that case, I *am* getting (nearly) identical results.
Title: Re: plotting PAP phi-rho-z
Post by: Nicholas Ritchie on January 28, 2022, 04:10:00 AM
Sander,
   You are right that PAP equation 13 is wrong in the way you indicate. "F=(R/S)(1/Q(E0)".  Drove me nuts until I figured it out!  Dale Newbury told me that back when they were collecting the material for the "Green Book", Heinrich and he had to pressure P&P to fill in all the missing gaps in their models.  I really wish they'd have provided more details about units too.  Write me directly and I'll forward addition articles by this pair that provide more clues.

Personally, I've basically given up on the full PAP in favor of XPP. It is simpler and generally gives better answers.

Nicholas
Title: Re: plotting PAP phi-rho-z
Post by: Brian Joy on January 28, 2022, 01:21:34 PM
Quote from: Sander on January 28, 2022, 01:31:27 AM
Hi Brian,

Can it be that your axis is then actually in rho*Z rather than in microns?  In that case, I *am* getting (nearly) identical results.

Hi Sander,

Sometimes I make mistakes, but I don't make mistakes like that.  I was the one who contributed the Fortran 90 code that John translated to VB for the purpose of plotting these curves.

Have you tried to duplicate Figure 7 from Pouchou and Pichoir's paper in the Green Book?  I've attached another Excel file in which I do this and then convert from mass-depth to depth (in microns).

Brian
Title: Re: plotting PAP phi-rho-z
Post by: Brian Joy on January 28, 2022, 01:30:05 PM
Quote from: NicholasRitchie on January 28, 2022, 04:10:00 AM
Sander,
   You are right that PAP equation 13 is wrong in the way you indicate. "F=(R/S)(1/Q(E0)".  Drove me nuts until I figured it out!  Dale Newbury told me that back when they were collecting the material for the "Green Book", Heinrich and he had to pressure P&P to fill in all the missing gaps in their models.  I really wish they'd have provided more details about units too.  Write me directly and I'll forward addition articles by this pair that provide more clues.

Personally, I've basically given up on the full PAP in favor of XPP. It is simpler and generally gives better answers.

Nicholas

There is also a sign error in equation 21 (PAP).  The expression for F2(X) should read:

F2(Χ) = (A2/X)*{[(Rx-Rc)*(Rx-Rc-2/X)+2/X2]*exp(-X*Rc)-(2/X2)*exp(-X*Rx)}

What is your justification for stating that XPP "generally gives better answers" than PAP?
Title: Re: plotting PAP phi-rho-z
Post by: Sander on January 29, 2022, 05:18:26 AM
Quote from: Brian Joy on January 28, 2022, 01:21:34 PM
Sometimes I make mistakes, but I don't make mistakes like that.  I was the one who contributed the Fortran 90 code that John translated to VB for the purpose of plotting these curves.

Have you tried to duplicate Figure 7 from Pouchou and Pichoir's paper in the Green Book?  I've attached another Excel file in which I do this and then convert from mass-depth to depth (in microns).

Brian

My humble apologies; I am well aware of who I'm talking to.  It turns out I do make mistakes like that, and my issue was elsewhere in my code.  Your Excel file was very helpful in tracking this down because I could find equivalent points on the curve and directly compare the values.

Unfortunately, the fact that my original phi(rho Z) curves were correct, means that my original issue remains a mystery.  The reason I started diving into this is that I have a series of spectra from pure iron at various working distances, and was trying to simulate the ratio between the K and L lines as a function of WD.  The effect I'm seeing is much larger than the correction by XPP.  I was trying to rule out all the possible causes of this one by one, and one obvious choice would be that I had the scale of my phi curve wrong, meaning that the X-rays were being generated at a different depth than I thought they were (and hence, get a different absorption)...
Title: Re: plotting PAP phi-rho-z
Post by: Brian Joy on January 29, 2022, 04:04:49 PM
Hi Sander,

I'm glad I could help.  No need to apologize!  I'm not that important.  I just got my hackles up a little because I'm extremely picky about units.  I carry them through all calculations and use them to check my work.

Brian
Title: Re: plotting PAP phi-rho-z
Post by: sem-geologist on January 30, 2022, 05:59:27 AM
Quote from: NicholasRitchie on January 28, 2022, 04:10:00 AM
Personally, I've basically given up on the full PAP in favor of XPP. It is simpler and generally gives better answers.

While XPP is by default on DTSA-II, I saw that NeXL has also X-PHI. I am quite satisfied with X-PHI on Cameca Peaksight (default matrix correction there). What I get impression of X-PHI is that it works pretty reasonable with under voltage. Nicholas, could you give some opinion on XPP vs X-PHI?
Title: Re: plotting PAP phi-rho-z
Post by: Sander on January 31, 2022, 01:11:39 AM
Quote from: Brian Joy on January 29, 2022, 04:04:49 PM
I'm glad I could help.  No need to apologize!  I'm not that important.  I just got my hackles up a little because I'm extremely picky about units.  I carry them through all calculations and use them to check my work.

I wish "certain other people" would be as picky in their publications... :-)
Title: Re: plotting PAP phi-rho-z
Post by: Nicholas Ritchie on January 31, 2022, 09:39:06 AM
Sander, what do you mean "as a function of WD?"

Brian & Sander:  With respect to the choice of XPP vs PAP vs XPHI, I personally almost always use XPP.  There may be algorithms that in certain circumstances that might work better.  However, it bothers me when people "shop for matrix correction algorithms" which work for a particular problem.  If you have a principled reason a priori to favor one algorithm over another, then great use that algorithm.  Selecting an algorithm because it gives the answers you expect seems suspect - not good scientific method.

That isn't to say that you can't do studies and based on those studies select one algorithm for a specific type of problem.  However, since my microanalysis is in multiple domains (geological, material science, forensics, nuclear etc.) and since I don't have time to study each algorithm with each class of problem in each domain, I've settled on XPP as a "good enough" algorithm for all domains.   (One of my hopes for the k-ratio database that Aurelien Moy is championing is that it would allow us to really evaluate the algorithms against a broad swath of data types.)  It has served me well but there are other viable alternatives including PAP, XPHI, CITZAF etc.  If I want to improve my accuracy, I endevour to find a better matched standard rather than abandon XPP.
Title: Re: plotting PAP phi-rho-z
Post by: John Donovan on January 31, 2022, 10:27:12 AM
Quote from: NicholasRitchie on January 31, 2022, 09:39:06 AM
If you have a principled reason a priori to favor one algorithm over another, then great use that algorithm.  Selecting an algorithm because it gives the answers you expect seems suspect - not good scientific method.

I completely agree with Nicholas on these points.   

It's also important to keep in mind that most of these matrix correction methods were tuned to one particular data set of another. PAP and XPP were tuned to the Pouchou k-ratio dataset, Bastin's matrix method was tuned to his k-ratio dataset, while John Armstrong tuned his Phi-Rho-z to the Shaw dataset. Others were tuned to others.

And that is why his CITZAF (and now CalcZAF/Probe for EPMA) offer all these matrix correction methods for comparison.  Paul Carpenter spent many years of work plotting these datsets against the 10 matrix methods in CalcZAF and also the 6 different MAC tables!  It's an exercise worth pursuing:

https://smf.probesoftware.com/index.php?topic=924.0

As an example (using just one MAC table) here is a GaSb synthetic (which should be 50:50 atomic concentrations) analyzed using GaAs and Sb metal as primary standards for all 10 matrix corrections in Probe for EPMA:

Summary of All Calculated (averaged) Matrix Corrections:
Un    2  GaSb as unk
LINEMU   Henke (LBL, 1985) < 10KeV / CITZMU > 10KeV

Elemental Weight Percents:
ELEM:       Sb      Ga      In      As   TOTAL
     1  62.757  38.023   -.014    .043 100.809   Armstrong/Love Scott (default)
     2  63.973  32.855   -.014    .038  96.852   Conventional Philibert/Duncumb-Reed
     3  63.144  33.355   -.014    .040  96.525   Heinrich/Duncumb-Reed
     4  62.761  35.664   -.014    .058  98.468   Love-Scott I
     5  62.904  36.426   -.014    .069  99.384   Love-Scott II
     6  64.539  37.036   -.014    .035 101.596   Packwood Phi(pz) (EPQ-91)
     7  63.281  37.885   -.014    .055 101.207   Bastin (original) Phi(pz)
     8  63.826  36.720   -.014    .063 100.594   Bastin PROZA Phi(pz) (EPQ-91)
     9  63.718  36.467   -.014    .039 100.211   Pouchou and Pichoir-Full (PAP)
    10  63.725  36.151   -.014    .043  99.905   Pouchou and Pichoir-Simplified (XPP)

AVER:   63.463  36.058   -.014    .048  99.555
SDEV:     .589   1.720    .000    .012   1.757
SERR:     .186    .544    .000    .004

MIN:    62.757  32.855   -.014    .035  96.525
MAX:    64.539  38.023   -.014    .069 101.596

Atomic Percents:
ELEM:       Sb      Ga      In      As   TOTAL
     1  48.570  51.387   -.012    .054 100.000   Armstrong/Love Scott (default)
     2  52.699  47.262   -.012    .051 100.000   Conventional Philibert/Duncumb-Reed
     3  51.996  47.963   -.012    .054 100.000   Heinrich/Duncumb-Reed
     4  50.161  49.776   -.012    .075 100.000   Love-Scott I
     5  49.683  50.241   -.012    .088 100.000   Love-Scott II
     6  49.931  50.037   -.012    .044 100.000   Packwood Phi(pz) (EPQ-91)
     7  48.861  51.082   -.012    .069 100.000   Bastin (original) Phi(pz)
     8  49.850  50.082   -.012    .080 100.000   Bastin PROZA Phi(pz) (EPQ-91)
     9  49.995  49.966   -.012    .050 100.000   Pouchou and Pichoir-Full (PAP)
    10  50.213  49.743   -.012    .055 100.000   Pouchou and Pichoir-Simplified (XPP)

AVER:   50.196  49.754   -.012    .062 100.000
SDEV:    1.266   1.261    .000    .015    .000
SERR:     .400    .399    .000    .005

MIN:    48.570  47.262   -.012    .044 100.000
MAX:    52.699  51.387   -.012    .088 100.000


It's interesting to see which methods do a better job...

The point being (as Nicholas mentions further on) that depending on the material, different matrix methods may or may not work very well. That's because none of them are really "universal" methods, as they've all been tuned to one dataset over another.  If one is analyzed a stoichiometric standard material, one can see that, but if the sample is an unknown, one must be careful not to "pick and choose" what one is hoping for.

The Si-Ir alloy is a classic example of this accuracy issue:

https://smf.probesoftware.com/index.php?topic=158.0

My personal hope is that a more physics based fundamental parameters methods will finally get us a universal matrix correction method.
Title: Re: plotting PAP phi-rho-z
Post by: Probeman on January 31, 2022, 11:33:35 AM
If anyone wants to play with the binary k-ratio datasets from Heinrich and Pouchou they are installed in the CALCZAFDATData folder in the UserData folder. Look for these files:

NISTBIN.DAT
NISTBIN2.DAT
NISTBIN3.DAT

Pouchou.dat
Pouchou2.dat

These are easily re-processed using the menus in the CalcZAF app using the Analytical | Calculate Binary Intensities... menus.  Some discussion on this is found here:

https://smf.probesoftware.com/index.php?topic=1256.0

Attached below are some other binary k-ratio data files from Bastin using the same CalcZAF binary k-ratio ASCII format.
Title: Re: plotting PAP phi-rho-z
Post by: Brian Joy on January 31, 2022, 12:16:10 PM
Quote from: NicholasRitchie on January 31, 2022, 09:39:06 AM
Brian & Sander:  With respect to the choice of XPP vs PAP vs XPHI, I personally almost always use XPP.  There may be algorithms that in certain circumstances that might work better.  However, it bothers me when people "shop for matrix correction algorithms" which work for a particular problem.  If you have a principled reason a priori to favor one algorithm over another, then great use that algorithm.  Selecting an algorithm because it gives the answers you expect seems suspect - not good scientific method.

Hi Nicholas,

I definitely don't "shop" for a matrix correction method and then choose the one that gives the results I like.  I analyze a huge range of materials (mostly natural), and, with reasonable choices of standards, I find that PAP produces acceptable results for most oxides (including silicates), sulfides, sulfosalts, arsenides, selenides, tellurides, etc.  I like P&P's internal consistency, their detailed treatment/improvement of the atomic number correction, and also their accurate phi(rho*z) curves, which should produce more accurate results for cases in which f(chi) is relatively small.  For the sake of consistency, I use PAP (with MAC30) exclusively.  Other models that appear acceptable to me are XPP, X-Phi, and PROZA96, but not Armstrong.  I was simply wondering why you seem to express a preference for XPP over PAP.  (After all, you did write that you had "given up" on PAP and that XPP "generally gives better answers.")

It is also one of my "dreams" to collect new k-ratio data and expand that database greatly...  if I ever get the time.

Brian
Title: Re: plotting PAP phi-rho-z
Post by: Sander on February 01, 2022, 12:52:28 AM
Quote from: NicholasRitchie on January 31, 2022, 09:39:06 AM
Sander, what do you mean "as a function of WD?"

I have access to a system with a motorized Z sample holder and collected spectra of some pure elements at varying working distance.  This obviously changes the absorption path length towards the detector a little bit, and the ratio between the K and L lines is different in each spectrum.  My XPP implementation didn't account for the whole effect I was seeing, which is what set me off on this whole investigation.  I don't want to say too much yet because I can't even get my units right, so it's probably something stupid somewhere.
Title: Re: plotting PAP phi-rho-z
Post by: Sander on February 01, 2022, 01:05:13 AM
Quote from: Brian Joy on January 31, 2022, 12:16:10 PM
I definitely don't "shop" for a matrix correction method and then choose the one that gives the results I like.

I think EPMA (especially EDS) is slowly becoming a "mainstream technology".  Especially on the current batch of more affordable systems, end-users expect a "point and shoot" functionality.  We should realize that the people on this forum are not your average analysts, and neither are the people using DTSA or CalcZAF.  For us, having a huge panel of buttons and algorithms to choose from is different: We'll select various algorithms and try to understand the results.  I can tell you from experience that not everybody works like this.  I have been in many customer escalations where someone would say "I am not getting the right results" and the "solution" was to select different ZAF models, different peak fitting strategies, different background fits, until the results were in line with their expectations.  Including people hitting crunchy particles and whatnot.  Most people on this forum would pull their hair out and tell the customer "No!! This is not how any of this works!!" but you can just hear them think "OK, nerd!" and continue with their day.
Title: Re: plotting PAP phi-rho-z
Post by: Probeman on February 01, 2022, 10:18:24 AM
Sander,
You have a point.

Reminds me of the old joke: "Half of all Americans are below average intelligence".  Yeah, yeah, it should be "median" but "average" sounds better!   :)

But it's worse than that because as you just alluded to: half of all scientists are below average in scientific ability.  And that might be an underestimation...

It's one reason NIST and others have been pushing for using actual standards in SEM-EDS, with a corresponding honest to goodness analytical total. Yes, it won't help in the case of "crunchy particles", then again, it certainly won't hurt!

And then there's Dale Newbury's studies about mis-identification of emission lines when using the auto-ID from some (all?) vendors...  so before we get to quantification, we're already not even wrong!
Title: Re: plotting PAP phi-rho-z
Post by: Nicholas Ritchie on February 01, 2022, 11:02:41 AM
Sander,
    You have to be really careful when interpreting data when you change the working distance.   You are not simply changing the take off angle.  I'm going to assume EDS and an ultra-thin window.  Maybe this is relevant, maybe it isn't.  Ultra thin windows are a polymer layer on a venician blind-like support.  The support grid is actually very thick.   100's of microns of Si usually and are very sensitive to orientation.  As long as you are on axis, the X-rays see the full 80% or so open area and 20% of the grid.   As soon as you start to go off the optimal axis, the incident X-rays start to strike the sides of the support.  The open area drops and a larger and larger fraction of the X-rays strike the support.   
   Of course, how this will effect your working distance data depends on the orientation of the window support grid (vertical vs horizontal vs ???.)
   I'm less clear about the construction of silicon nitride windows and if there is a similar issue with them.  Good old Be windows wouldn't have this problem.

Nicholas
Title: Re: plotting PAP phi-rho-z
Post by: Sander on February 02, 2022, 01:35:21 AM
Hi Nicholas,

That is a very interesting remark, which definitely goes on the list of "possible causes of what I'm seeing".  I am indeed using a silicon nitride window, but as far as I know it's mounted on a "honeycomb" support.  This support structure is in the order of 15 microns thick, according to the manufacturer.  Also, the distance of the detector to the point of beam impact is in the order of 4cm.  I take into account the fact that X-rays arriving from different working distances don't reach the detector window perpendicularly, and the absorption path through the window goes with cos(real_TOA - optimum_TOA), which in my case was less than 2% difference - but I didn't take the support structure into account.

"Good old" Be windows probably would eat up most of that FeLa anyway :-)

Thanks a lot for your thoughts.  I'll do some goniometry homework.
Title: Re: plotting PAP phi-rho-z
Post by: Sander on February 02, 2022, 03:10:55 AM
So I did the homework, and threw a detector cap under a microscope.  It indeed has a honeycomb structure and each "cell" is about 200 microns side-to-side, and the silicon support structures are about 20 microns wide.  If they are indeed only 15 microns thick as per the manufacturer's specification, then the effect of non-perpendicular incidence should not as big as you scared me for.

Some back-of-the-envelope calculations:  At the shortest WD, I have a TOA of 24 degrees, at the longest, 36 degrees.  The optimum (design) TOA is 28.5 in my system.  At the shortest WD, I would get a factor of 0.076 extra occlusion, at the longest, 0.137.  Calculating the average extra Si absorption would be hard because these numbers are "pure shadow" numbers and the X-rays would not pass to the full thickness of the Si.  Also, I'm seeing much more FeLa absorption at the shorter working distance as opposed to the longer one.

The extra "virtual thickness factor" of the window itself under those angles would be 1.003 and 1.009 respectively, so that can safely be ignored.