xpecgen

A package with a GUI to calculate X-ray sPECtra GENerated in tungsten anodes


Keywords
X-ray, spectra, Tungsten, anode, Computer, modeling
License
GPL-3.0
Install
pip install xpecgen==1.0.1

Documentation

xpecgen

Github release PyPI Semantic Versioning

license GNU GPLv3 DOI Joss status

Build Status Documentation Status

A python package with a GUI to calculate x-ray spectra generated in tungsten anodes, as well as the bremsstrahlung component in other media.

Features

  • X-ray spectra calculation using the models from [1].
  • HVL calculation.
  • Python library and Graphical User Interface.
  • Export to xlsx files (Excel Spreadsheet).
  • Python API.

Usage example

GUI

alt tag alt tag

Python interpreter

alt tag

Installation

If you have pip you can install xpecgen as a package by running

pip install xpecgen

and then you can launch the GUI by just executing xpecgen, see the command line interface by executing xpecgencli -h, or check the demo.py explaining its use as a library,

You will need tk to make use of the GUI. You can check the advanced guide if you need help for this.

If you do not have python installed yet, check the advanced guide.

Documentation

The updated API documentation is available here.

You can also use the python help system to check it:

from xpecgen import xpecgen as xg
help(xg)

Contributing

See CONTRIBUTING.md.

Model details

To have a general overview of the model see [1]. The bremsstrahlung calculation is done using full interpolations for the electron fluence, so none of the simplifications in section IV.C were used in this implementation. This description of the fluence can be used with others materials, always via the CSDA scaling, if requested. However, note that its accuracy has not been tested. Both characteristic peaks models in section II.D were implemented. The polynomial one is used by default. Half-value layers are calculated using the exponential model of attenuation (aka narrow beam geometry). In the GUI they are calculated in the sense of dose, but the library allows for generalizing this to any desired reponse function.

Despite the GUI and the API allow selecting different target materials, note the model only considered tungsten in detail. When a different material is selected, its bremsstrahlung cross-section and range scaling are used instead. However, differences in the electron fluence in the target might affect the results. In particular, the penetration depth is increased in low Z materials in units of the CSDA range, so the results should be used with caution, specially in that case.

Citation

If you use this application to make use of the models in [1], you should cite it. If you also want to acknowledge the implementation itself you can also cite [2].

References

[1] Hernández, G., Fernández F. 2016. "A model of tungsten x-ray anode spectra." Medical Physics, 43 4655. doi:10.1118/1.4955120.

[2] Hernández, G., Fernández F. 2016. "xpecgen: A program to calculate x-ray spectra generated in tungsten anodes." The Journal of Open Source Software, 00062. doi:10.21105/joss.00062.