Special Tools

Return to start page

Global analysis

We are currently preparing an open-source tool for global analysis that is very flexible and powerful. Please contact us if you would like to have access to the tool before the publication is ready.It will be available as python packagewith extensive documentation:

    * Documentation: https://kimopack.readthedocs.io/
    * PyPI Releases: https://pypi.org/project/KiMoPack/
    * Source Code: https://github.com/erdzeichen/KiMoPack
    * Issue Tracker: https://github.com/erdzeichen/KiMoPack/issues
    * Website: https://www.chemphys.lu.se/research/projects/kimopack/
    * Zenodo: https://doi.org/10.5281/zenodo.5720587

Alternative: Glotaran:   http://glotaran.org/ the data format is a bit tricky.
I wrote a quick python script (see end of this page) to convert the data collection format in Lund into the right file format.
While this conversion file is specifically designed for Lund it will be useful for other places too.The file format in Lund is tab separated, one line with the wavelength, then in front of each block a time at which it was taken. My script reads in every file in the directory where the script lays (so you have to copy it into your data directory) with the ending .SIA and converts it into a file with the ending .ascii with the right format for Glotaran.
to use the script simply go in the folder and type: python transpose_files.py  or start it out a python session


A nice and very usefull calculator can be found from this company http://www.toptica.com/support/topticalc/free_topticalc_download.html
There is a nice simulation software for ultrafast optics and what happens to pulses in glas and other materials offered from Venteon http://www.venteon.com/software.php

Optical design

While this is in general understood as raytracing (see next section) there are a number of free tools available that allow the designing and following evaluation of optical setups. The main difference to pure raytracing softwares is often that these have some kind of comfortable way to create larger setups. I have not dug to deep into the matter and there might be quite some interesting candidates missing
Pyoptical tools is a powerful python based tool that offers raytraing and wavefront analysis of a a larger set of elements. It has a toolbox for Freecad that can be used to very comfortable design the optics (and import stuff from e.g. Thorlabs)
Rayoptics is also a powerful python based tool that offers raytraing and wavefront analysis. It has build in libraries for the import of Thorlabs or Edmund optical elements.
Also pyrate provides interfaces to freecad designing of optical systems. It seems to be actively developed, but somwhat more oriented to coding type of persons, but hard to judge, as I have not played with it.
3doptics offers a free online modeller as introduction into the simulation of optical systems. Might be worth a visit.


A colleagues tested OSLO and said it is good for small simulations (up to 10 surfaces)
Gnu Optical seems to be a powerfull package
A python frontend and language
one classical not super scientific way is also to generate a scene with program like space-claim http://www.spaceclaim.com/ or sketchup and then use the very powerfull raytracer povray http://www.povray.org/ with the "photon map" feature to forward raytrace those elements.

X-ray raytracing

XOP and shadow raytracing http://www.esrf.eu/home/Instrumentation/software/data-analysis/xop2.4/extensions.html
Ray-UI  http://www.helmholtz-berlin.de/forschung/oe/fg/nanometeroptik/science/layout/ray_de.html%20
XrayTracer Geant4 http://xraytracer.com/
I stumbled over a new tool for x-ray and optical https://pypi.python.org/pypi/xrt

X-ray source simulation:

While they are part of GEANT or any raytracing code from above there are a few specialized codes out there.
For undulators and similar things the defacto standard is SPECTRA: http://radiant.harima.riken.go.jp/spectra/
For x-ray tubes i found: pyPENELOPE very useful: https://sourceforge.net/projects/pypenelope

X-ray analysis

new things are always coming, neXus seems to be a general data format based on hdf5. This gui has a build in interface to lmfit
There is a lot of specialized software for analysing and simulating x-ray optics/experiments this page offers a overview http://www.esrf.eu/Instrumentation/software/data-analysis
A good start is the IFEFFIT package it contains http://cars9.uchicago.edu/ifeffit/  or the updated version called Demeter http://bruceravel.github.io/demeter/
a database program called Hephaestus for looking up nearly everything a spectroscopist could need
Athena a data reduction and preanalysis program
Artemis a EXAFS fitting program and some more speciallised tools are included there too

Different X-ray tools for differenet tasks

curves simulation there are two tools "FEFF" costs money http://leonardo.phys.washington.edu/feff/   A free tool calculation similar features is  http://neel.cnrs.fr/spip.php?rubrique1007&lang=fr
As a fitting tools for NEXAFS i recommend  http://xafs.org/Software/FitIt
http://xafs.org/  Is a page with a lot of informations and tutorials
comfortably displaying of fluoresence data the PyMCA tool from the ESRF is quite usefull http://pymca.sourceforge.net/index.html

Moldraw also shows the molecular data, additionally it can export FEFF input files, so can be used to convert structure files into feff input files http://rsc.anu.edu.au/opensource/index.php?option=com_docman&task=cat_view&gid=69&Itemid=32

Peak Fitting / XPS analysis

XPS: can be done with peakfit. http://xpspeak.software.informer.com/4.1/ Here you can constrain very nicely many parameters. I downloaded the file from there and you can find it at the end of this page. Also I downloaded the manual from  from https://www2.warwick.ac.uk/fac/sci/physics/research/condensedmatt/surface/exp/xps/links/xpspeak_manual.doc  and offer it at the end of this page.

At Lund University we have a campus license for CASA XPS - contact me for help with this.

The mayor data analysis tools have their own fitting routines build in, but often it is very desirable to have a a tool where beside background also many of the fitting parameters can easily linked and controlled. I found 3 tools up to now and all are actually developed for XPS fitting:
XPSfit  http://www.sljus.lu.se/download.html
EWA http://wxewa.sourceforge.net/
XPSPEAK http://www.uksaf.org/xpspeak41.zip  (this webpage is down now and I provide the files on the previous page!)
I also found an interesting module with name eXPFit for Excel that allows peak fitting http://www.chem.qmul.ac.uk/software/eXPFit.htm

i found this the most versatile software package, since you can lock and unlock parameters during the reduction and have full control over most parameters
this is a very fast and easy peak fitting tool with a strong interface to python, it however does not allow for easy parameter linking and fix http://lorentz.sourceforge.net/

This tool is based on labview seams to be pretty powerful (I didn;t test it yet!). However you need to have labview installed: http://spectools.sourceforge.net/

some general curve fitting tools can be useful here too, After some testing it is very powerful, even if the parameter locking is difficult: http://sourceforge.net/projects/fityk/

At a certain time I would however recommend to use a real coding language liek python and the very nice fitting routines in there. For peak fitting I found these modules very useful
http://pythonhosted.org/PeakUtils/   a small project that focuses on finding peak positions and doe some quick an dirty fitting of gaussians

Otherwise you will want to look on lmfit https://lmfit.github.io/lmfit-py/builtin_models.html this module does not only offer fitting with any method that sipy.optimise offers, but also has the the parameter object that allows very easy linking, fixing of parameter.
There has been some guis developed for a more comfortable use of lmfit,
this package contains a module that seems useful (not tested yet) http://nexpy.github.io/nexpy/pythongui.html
mQfit is another attempt (not tested)  for general data fittng https://forge.epn-campus.eu/projects/software/wiki
as seems the lpbuilder to be https://github.com/thriveth/lpbuilder

Some interesting databases

Scattering angle and scattering factors: Sergey Stephanovs X-ray server http://sergey.gmca.aps.anl.gov/
Overview over all the synchrotrons and some great tutorials: http://www.lightsources.org/cms/
summarized coarse overview in periodic system: McMasters tables http://cars9.uchicago.edu/mcbook/
NIST databases http://www.nist.gov/pml/data/index.cfm
Electron stopping power  http://physics.nist.gov/PhysRefData/Star/Text/ESTAR.html
X-ray periodic system with  http://www.csrri.iit.edu/periodic-table.html
X-ray data booklet    http://xdb.lbl.gov/
X-Ray Interactions With Matter    http://henke.lbl.gov/optical_constants/
X-Ray metal reference data: http://exafsmaterials.com/ReferenceSpectra.html

Terminals for port communication

under XP there is still the powerfull hyper terminal, since windows Vista this is gone and some alternatives are always handy.
Of course you can use the serial extensions from python (pyserial) and matlab but some GUI like these two might be more comfortable:
termite: a simple terminal software http://www.compuphase.com/software_termite.htm that is free
a stronger and opensource terminal is realterm: http://realterm.sourceforge.net/

other usefull tools

Using the soundcard as an AD converter (e.g. with an eternal soundcard makes an simple oscilloscope with this software http://www.zeitnitz.de/Christian/scope%20en
A PC on the internet and a webcam becomes a camera server with this software under windows http://www.watchmycam.de/
chemical compatibility: there are plenty of tables online available. I found this one quite usefull:
small tool for kind of all the chemical calculations needed: http://chemtoolbox.free.fr/uk/download.php

X-ray emission spectroscopy calculations

This is a little python module to predict the measured flux in a emission spectroscopy setup. At the moment it is written for a crystal based setup, however with a few tricks it can be used for microcalorimeters too(drop me a mail to get explanations). The Knut och Alice Wallenbergs Stiftelse financed me during the stay at the ESRF during which this code was written and I am very grateful for their support.
Simply double click the "gui_generated.py".  each field has its explanations if you hover over it. The basis of this program is the xraylib library from the ESRF. I however compiled a offline version of the tool, so it can be run without the library installed.
The gui is only the frontend and dumps all information first in three pandas.Dataframe and then as Ascii in three files on the disc. After this it calls the functions from "python_calculation.py"
By using the functions from "python_calculation.py" in the command line the information can be used further. "python_calculation.py" runs if not otherwise set the "standard"experiment which is the last run.
So i mostly use the gui to set the values and then go to the command line
In the gui: (floating the mouse over a field gives a text which might help to use the tool)
pressing enter in any text field executes the program and gives the expected countrate for the settings the same does clicking on "run single". The "run loop" function loops over different parameters.
I programmed two loops. the inner loop is designed to be run over many values and typically is used for energy scans and the like.
The outer loop is run over any of the parameters but takes much longer for large sets of data if the loop is run the results are shown in a plot.

command line:     emission_detection() runs the tool once and gives the expected emission intensity
                            run_loop_from_save()  runs the loops
I tried to comment each function extensively, if you have questions however don't hesitate to drop me an email or leave a comment.
I'm actively working on the tool so there might still be some bugs and i'm working on more functionality. Just let me know about bugs or wishes and i will try to fix/include them.
Hint beside the standard python modules you will need the python "wx" and "pandas" packages. They come with most installations based on Pythonxy or EPD (see https://sites.google.com/site/quickwrapupoffreesoftware/home/programming). Under Linux you will have to install these packages. The first start might take a few seconds, since some modules will be precompiled.
Broadband calculation: make a plot with emission intensity as function of incoming photon energy and a fixed number of incoming photons. Multiply this afterwards with the source spectrum
For microcalorimeter: set the fudge factor 1, the reflectivity 1, one crystal and the diameter corresponding to the effective area of the detector. After the emission is calculated multiply with the spectral sensitivity of the detector, et voila
I moved the whole project to github now to enable active contributions from other people, please find the latest version here: https://github.com/erdzeichen/calculate_measured_XES_intensity