pyXRayTracer logo

Table Of Contents

Next topic

Using pyXRayTracer

This Page

pyXRayTracer

Release:0.4.4
Date:April 12, 2011
Author:Konstantin Klementiev
License:Open Source, MIT License

Package pyXRayTracer is a python frontend for x-ray tracing. It defines classes and functions which allow running a ray-tracing backend and representing the results as 1D and 2D position- and energy-dependent histograms in publication quality.

Features of pyXRayTracer

  • 1D and 2D position histograms simultaneously represent energy- and intensity- distributions. Energy is shown by colors, intensity is represented by brightness. In Raycing backend, colors represent ray status instead of energy.
  • The colored histograms are cumulative: they can accept an unlimited number of rays. The accumulation can be saved and resumed.
  • It can be run in parallel in several threads or processes (can be opted), which accelerates the execution on multi-core computers. It can even run on remote servers.
  • Publication quality plots are provided by matplotlib with image formats PNG, PostScript, PDF, SVG.
  • It can be run within Python scripts to automatically generate a series of images under changing geometrical or physical parameters. The image intensity (brightness) and 1D histograms can be normalized to the global maximum throughout the series.

Ray-tracing backends

Ray-tracing backend is a module or an external program that provides with ray distributions which are then histogrammed and accumulated by pyXRayTracer. Currently, pyXRayTracer supports two backends:

  1. Shadow, needs to be installed separately. I recommend the installation from here: ShadowVUI extension to XOP program.
  2. Raycing: an internal backend (new in version 0.4).

Examples

  1. Run this module as main script.
  2. Look the examples folder of the distribution archive and the Gallery of plots and scripts for several script examples and output images done for CLÆSS beamline and for CLEAR spectrometer.

Platforms

pyXRayTracer should run on Windows and all Unix-like platforms. It was tested under Windows(XP,Vista,7) and Linux(Ubuntu9.10-10.10, OpenSUSE11.3).

Note

on Shadow:

Under Windows Vista and 7 Shadow does not work out of the box because of epath (a part of Shadow) reporting an error. Roman Chernikov (Hasylab) offered a workaround consisting of simply stopping the Windows’ Error Reporting Service. Also on Linux, Shadow could not run after fresh installation of ShadowVUI. I asked Manuel Sanchez del Rio (ESRF) for help and he sent me some library files for replacement, which solved the problem. Ask him for the files or find them in Linux-add-ons folder.

Dependencies

The histogramming is done by means of numpy.

matplotlib is used for plotting. Qt4 drawing backend of matplotlib is assumed. If it is not a default one, specify it manually in matplotlib. For using another drawing backend, plotter must be slightly rewritten in the part of timer event handling.

Get pyXRayTracer

pyXRayTracer is available as source distribution. The distribution archive also includes documentation and examples.

Installation

Unzip the .zip file into a suitable directory, chdir to that directory and run python setup.py install.

Roadmap

0.4:own ray-tracing backend (Raycing) implemented without intensity (reflectivity) and without synchrotron sources
0.5:Raycing implemented with synchrotron sources
0.6:Raycing implemented with intensity (reflectivity)