News:

:) We depend on your feedback and ideas!

Main Menu

Show emitted spectrum by using DTSA-II script

Started by ZhaiQ, July 07, 2024, 01:33:51 PM

Previous topic - Next topic

ZhaiQ

Hi everyone,

I am a new user of the DTSA-II software, and trying to run multiple Monte Carlo simulations by using the script. Currently I am able to run thin film simulations with different material thicknesses, which is exactly what I want. However I've noticed that all my results are "Noisy". There're always two spectra when I use "smilation alien" GUI to run Monte Carlo simulations, one is "Noisy" and another one is "Emitted". May I ask how should I get the "Emitted" spectrum by using script? Thank you very much!

Nicholas Ritchie

#1
import dtsa2.mcSimulate3 as mc3
mc3.simulate("NaAlSi3O8", d1, 20.0, withPoisson=False)




This does convolve the displayed spectrum with the detector function.

In the simulation alien you can also uncheck "Apply simulated noise statistics" or to reduce noise just increase the dose (probe current x live time)
"Do what you can, with what you have, where you are"
  - Teddy Roosevelt

ZhaiQ

#2
Hi Prof Ritchie,

Thank you for your answer! I've tried out your method and I attached the result below. Seems the Poisson=False option still gives a spectrum convolved with the detector response. May I consult how should I can get the "Emitted" spectrum (blue one in the figure) by using the script?

I paste my code here as well for your reference:

Graphite # my material of films
thick # thickness of films
d201 # EDS detector I defined

import dtsa2.mcSimulate3 as mc3
for thick in range(1,10,1):
     mc3.multiFilm([[Graphite,thick*1e-6],[Graphite,1e-6]],d201,e0=20.0,withPoisson=False,nTraj=5000,dose=1000).display()

Nicholas Ritchie

In the function
def base(det, e0, withPoisson, nTraj, dose, sf, bf, name, buildSample, buildParams, xtraParams): (line 383)
in mcSimulate3.py, replace the call to
spec = det.getSpectrum((dose * 1.0e-9) / (nTraj * epq.PhysicalConstants.ElectronCharge))
with
spec = det.getgetRawXRayData((dose * 1.0e-9) / (nTraj * epq.PhysicalConstants.ElectronCharge))
"Do what you can, with what you have, where you are"
  - Teddy Roosevelt

ZhaiQ

Hi Prof,

Thank you for your reply, this method works well ;D!

For other users who may have the similar problem, you can find mcSimulate3.py here: your installation location\NIST\Lib\dtsa2\mcSimulate3.py. And there's a typo in Prof Ritchie's reply (one extra "get"). Just replace
spec = det.getSpectrum((dose * 1.0e-9) / (nTraj * epq.PhysicalConstants.ElectronCharge))
with
spec = det.getRawXRayData((dose * 1.0e-9) / (nTraj * epq.PhysicalConstants.ElectronCharge))

Nicholas Ritchie

"Do what you can, with what you have, where you are"
  - Teddy Roosevelt