PyXRF: Python-based X-ray fluorescence analysis package

Li Li, Hanfei Yan, Wei Xu, Dantong Yu, Annie Heroux, Wah Keat Lee, Stuart I. Campbell, Yong S. Chu

Research output: Chapter in Book/Report/Conference proceedingConference contribution

38 Scopus citations


We developed a python-based fluorescence analysis package (PyXRF) at the National Synchrotron Light Source II (NSLS-II) for the X-ray fluorescence-microscopy beamlines, including Hard X-ray Nanoprobe (HXN), and Submicron Resolution X-ray Spectroscopy (SRX). This package contains a high-level fitting engine, a comprehensive commandline/ GUI design, rigorous physics calculations, and a visualization interface. PyXRF offers a method of automatically finding elements, so that users do not need to spend extra time selecting elements manually. Moreover, PyXRF provides a convenient and interactive way of adjusting fitting parameters with physical constraints. This will help us perform quantitative analysis, and find an appropriate initial guess for fitting. Furthermore, we also create an advanced mode for expert users to construct their own fitting strategies with a full control of each fitting parameter. PyXRF runs single-pixel fitting at a fast speed, which opens up the possibilities of viewing the results of fitting in real time during experiments. A convenient I/O interface was designed to obtain data directly from NSLS-II's experimental database. PyXRF is under open-source development and designed to be an integral part of NSLS-II's scientific computation library.

Original languageEnglish (US)
Title of host publicationX-Ray Nanoimaging
Subtitle of host publicationInstruments and Methods III
EditorsAndrea Somogyi, Barry Lai
ISBN (Electronic)9781510612358
StatePublished - 2017
EventX-Ray Nanoimaging: Instruments and Methods III 2017 - San Diego, United States
Duration: Aug 7 2017Aug 8 2017

Publication series

NameProceedings of SPIE - The International Society for Optical Engineering
ISSN (Print)0277-786X
ISSN (Electronic)1996-756X


OtherX-Ray Nanoimaging: Instruments and Methods III 2017
Country/TerritoryUnited States
CitySan Diego

All Science Journal Classification (ASJC) codes

  • Electronic, Optical and Magnetic Materials
  • Condensed Matter Physics
  • Computer Science Applications
  • Applied Mathematics
  • Electrical and Electronic Engineering


  • Quantitative analysis
  • X-ray fluorescence


Dive into the research topics of 'PyXRF: Python-based X-ray fluorescence analysis package'. Together they form a unique fingerprint.

Cite this