Author Topic: "Strip background" by using Clayton's algorithm  (Read 170 times)

ZhaiQ

  • Graduate
  • **
  • Posts: 6
"Strip background" by using Clayton's algorithm
« on: July 11, 2024, 11:06:59 AM »
Hi all,

I am new to DTSA software and I am trying to use it to analyze our EDS spectra. The X-ray peak we are looking for has different shape from normal characteristic peaks. It is not Gaussian (even after the convolved with the detector). In this case, the background subtraction is very important for us to eliminate the bremsstrahlung and then compare the experimental data with theoretical results.

When I read the DTSA document, I found the "Strip background" algorithm comes from "A DISCUSSION OF PIXAN AND PIXANPC: THE AAEC PIXE ANALYSIS COMPUTER PACKAGES" by Clayton. And after reading the original paper I noticed the number of iterates N will affect the final results.

My questions is how does DTSA determine the number of iterates N? Is it a fixed number? Thank you very much!

Nicholas Ritchie

  • Moderator
  • Professor
  • *****
  • Posts: 155
    • NIST DTSA-II
Re: "Strip background" by using Clayton's algorithm
« Reply #1 on: July 11, 2024, 11:38:59 AM »
This is how I implemented Clayton's algorithm

Code: [Select]
static public class Clayton1987PeakStripping extends PeakStripping {
      public Clayton1987PeakStripping() {
         super("Clayton - 1987", "Clayton E, Duerden P, Cohen DD. Nuclear Instrum Methods B22:91, 1987");
      }

      private final int MAX_ITERATIONS = 1000;

      @Override
      protected void initializeDefaultStrategy() {
      }

      @Override
      public ISpectrumData computeBackground(ISpectrumData src) {
         final double[] ch = SpectrumUtils.toDoubleArray(src);
         double delta = 0.0, delta0 = -Double.MAX_VALUE;
         for (int iter = 0; (iter < MAX_ITERATIONS) && (delta > (1.0e-6 * delta0)); ++iter) {
            delta = 0.0;
            for (int i = ch.length - 2; i >= 1; --i) {
               final double m = 0.5 * (ch[i + 1] + ch[i - 1]);
               if (ch[i] > m) {
                  delta += ch[i] - m;
                  ch[i] = m;
               }
            }
            if (delta0 == -Double.MAX_VALUE)
               delta0 = delta;
         }
         return new DerivedSpectrum.BasicDerivedSpectrum(src, ch, "Clayton[" + src.toString() + "]");
      }
   }

So it uses a dynamic test to determine the number of iterations.

On the other hand, the mechanism that DTSA-II uses to fit spectra does not depend on the peak being a Gaussian shape so it might work just fine on your spectra.
"Do what you can, with what you have, where you are"
  - Teddy Roosevelt

ZhaiQ

  • Graduate
  • **
  • Posts: 6
Re: "Strip background" by using Clayton's algorithm
« Reply #2 on: July 12, 2024, 10:54:35 PM »
Hi Prof Ritchie,

Thanks for your answer about the algorithm. Meanwhile, may I consult what is the formula DTSA uses to "fit spectra"? Is it polynomial equation? Thanks!
« Last Edit: July 13, 2024, 07:01:59 AM by John Donovan »