PyRod


So what is it? PyRod is an X-ray diffraction (mainly CTR) analysis tool for data acquired by 2D detectors. It currently supports only the edf data format used at the ESRF. The user interface (python-gtk) is designed for 5×1 Maxipix detector but could be adjusted to contain data of any size. New rules should be implemented if data collected elsewhere than BM32 and ID03 are to be imported since there is no existing standard for naming the data files.
What can it do? PyRod offers possibilities for real time analysis such as line cut and re-integration within customised ROI as well as 2D integration (correction factors included) of the peak intensity for omega scan, stationary rod scan, and reflectivity measurements. Moreover, one can calculate the theoretical structure factors with a given model and fit it “on the fly” with the integrated data. (Most of the calculation are inspired by the ANA-ROD project )
Will it work? The first (integration) part is being tested by Nils BLANC on his data and myself of course while the second (simulation) part has been tested for simple models and experimental data and demonstrated coherent result with that analyzed by ROD.
Acknowledgement Nils BLANC (poor beta tester), Odile ROBACH (useful discussion), Gilles RENAUD (for letting me do it), ANA-ROD project…

 

Features:

- Co-relate spec files with MPX images
- Raw integration in new arbitrary ROI
- Line cut on MPX Images
- Integration (correction) of Omage scan, Stationary rod scan and reflectivity measurements
- Qualitative GISAXS analysis
- Visualisation of the structure model provided
- Position dependent displacement and occupancy model
- Fitting(Plotting) of the structure model with(against) the data
- plus all that I’ve forgot to mention

 

Prerequisite:

Linux : The required modules are usually packed with installation
Just download the source file and run
(To enable atomic structure visualisation, one should install visvis , python-opengl and pygtkglext )

Windows : A Windows x86 binary can be found here (also works to x64)
If you wish to run the source code yourself, you will need to
1. install enthought python package
2. install gtk+ ( x86 , x64 )
add [key=GTK_BASEPATH value=your_gtk_bin_folder_path] to your environmental variable -> system variable
2. install pygobject ( x86 , x64 )
3. install pycairo ( x86 , x64 )
4. install pygtk ( x86 , x64 )
5. test
open pylab (ipython – pylab) from enthought distribution
import pygtk
import gtk
6. download the source file and run
7. To enable atomic structure visualisation, one should install visvis , python-opengl and finally pygtkglext1.

Mac OS X [MacPorts] : (won’t work for the moment, see step 10, but the whole procedure takes less time)
1. install X11 from the OS X installation disc (not necessary for Mac OS X > 10.5)
2. install Xcode (included also in the installation disc)
3. install MacPorts
4. sudo port -v install python27
5. sudo port select –set python python27
6. sudo port -v install py27-scipy (py27-numpy wll be automatically included by MacPorts)
7. sudo port -v install py27-pil (needed for GISAXS images)
8. sudo port -v install py27-pygtk (gtk2, py27-cairo, py27-gobject are automatically included by MacPorts)
9. The following method allows one to install an older version of matplotlib : download matplotlib 1.0.1 Portfile for python27 as well as the entire files folder, open the Terminal, cd to the directory containing the Portfile, type “sudo port -v install subport=py27-matplotlib”
9.1 matplotlib 1.0.1 is perferred here as I have problem running PyRod with the current stable version (1.1.0)
9.2 you need to specify the subport as py27 or matplotlib for py24 will be installed instead
9.3 should you ever encounter a permission problem, try change the “macportsuser” in macports.conf file to “root”
9.4 if you fail to open a X11 session from Application/Utilities/X11.app please install XQuartz
9.5 for easy install, run sudo port install py27-matplotlib +gtk2
10. This will however not suffice to run PyRod as the gtk backend (of matplotlib) has not been properly installed. This is due to the absence of the pygtk-2.0.pc file to be found in the pygtk-dev package which is not yet available as a port. The procedure is nevertheless kept here in case the missing port is added one day.

Mac OS X [Fink] : (working perfectly but the compilation takes much longer than using MacPorts)
1. install X11 from the OS X installation disc (not necessary for Mac OS X > 10.5)
2. install Xcode (included also in the installation disc)
3. download Fink and follow the source install instructions
4. sudo fink install python27
5. sudo fink install scipy-py27 (numpy-py27 included)
6. sudo fink install pil-py27 (needed for GISAXS images)
7. sudo fink install pygtk2-gtk-py27 (all the dependencies will be installed, so will the devel package)
8. sudo fink install matplotlib-py27 (this will install matplotlib 1.1.0 as it is the only version available from “fink dumpinfo -fallversions matplotlib-py27″)
Optional:
1. If you fail to open a X11 session from Application/Utilities/X11.app please install XQuartz
2. install gtk2-engines and gtk-change-theme to make the program look better.

 

Known Issue:

1.2.4 will be the last version to support 0.99.3 < matplotlib < 1.1.0, as future versions will be developped under matplotlib > = 1.1.1

 

User Manual:

I’ll make a wiki one day…

 

Windows Binary:

PyRod v1.2.10 binary

 

Source Code:

PyRod v1.2.13 source code

 

ChangeLog:

V 1.2.13 (2014-12-17)
- – -Minor modifications

 

V 1.2.12 (2013-11-14)
- – -Minor modifications

 

V 1.2.11 (2013-07-11)
- – -I wish I knew

 

V 1.2.10 (2013-07-04)
- – -GISAXS Support
- – -And other stuffs that I don’t recall

 

V 1.2.9 (2013-05-??)
- – -I sincerely do not remember

 

V 1.2.8 (2013-04-18)
- – -Live Image Read Out using SLS library (ESRF)
- – -The fitting routine now works much better!!!
- – -Loading Scans with CapsLock enabled will not load the corresponding image files
- – -Mapping plot when multiple scans are selected
- – -and a lot of other minor modifications that I did during the last 12 months…

 

V 1.2.4 (2012-05-02)
- – -Add support to very weak peak search (a binning operation replacing the old auto threshold)
- – -GISAXS routine improvement
- – -Minor Improvement in animation performance

 

V 1.2.3 (2012-04-22)
- – -Peak search quality verification via mplot3D plot

 

V 1.2.2 (2012-04-19)
- – -A Pseudo Binning is provided in case you have too much points in your image folder than necessary
- – -A new way of eliminating hot pixels is available under Spec/Routine

 

V 1.2.1 (2012-04-12)
- – -Bug fix
- – -Optimization of the peak search

 

V 1.2.0 (2012-04-04)
- – -Bug fix
- – -GISAXS routine analysis
- – -Support for MPX 2×2 or 1×1 detectors
- – -Mouse related operation added to the Plot Canvas (zoom, etc.)

 

V 1.1.2 (2012-03-17)
- – -Bug fix
- – -Windows binary now has the full functionality (structure visualization)

 

V 1.1.1 (2012-03-12)
- – -Minor modification

 

V 1.1.0 (2012-03-11)
- – -Everything concerning the simulation part plus some minor modification to the analysis part

 

V 1.0.13 (2012-03-01)
- – -Atomic Structure Visualisation thanks to visvis

 

V 1.0.12 (2012-02-28)
General
- – -bug fix

 

V 1.0.11 (2012-02-27)
ROD
- – -Import Panel changed, to be compatible with futur’s advanced analysis panel
- – -ROD parameters interface has been partially implemented, check it out with F9

 

V 1.0.10 (2012-02-26)
SPEC->Routine
- – -User ROI definitions are now imported via an editable treeview object

 

V 1.0.9 (2012-02-25)
MPX->Omega
- – -Done
General
- – -A console has been added (F12 or Menu->Tools)

 

V 1.0.8 (2012-02-21)
MPX->Omega
- – -Some small progress has been made, the entire feature will be available in the coming version
MPX->Routine
- – -Now possible to trace the displayed image on the spec canvas
- – -Line cut implemented (including recalculation of the HKL values after the operation)

 

V 1.0.7 (2012-02-20)
MPX
- – -Omega scan has been partially implemented (not functioning for the moment)
General
- – -Support of the file formats for ID03 has been added.

 

V 1.0.6 (2012-02-01)
SPEC
- – -A temporal solution has been added with regard to the lack of an embedded fitting function by adding a button which copies the data displayed in the default clipboard which can then be easily imported to OriginLab or Excel.

 

V 1.0.5 (2012-01-19)
SPEC Routine comes to life
- – -User defined ROI plotting
- – -Show existing ROI definition

 

V 1.0.4 (2012-01-17)
General
- – -Re-structuring the program
- – -Hot pixel correction can now be accessed via the main menu
Stationary
- – -Now almost completely functional

 

V 1.0.3 (2011-11-17)
General
- – -Re-structuring the program

 

V 1.0.2 (2011-11-07)
General
- – -Panning is allowed once MPX gets zoomed (by dragging with left button pressed in)
- – -Scrolling is added as another way of zooming
- – -Rectangle is now displayed correctly when zoomed
- – -Correcting some small bugs
Thoughts
- – -Do we need “values to be-annotated once at large (zoom) magnitudes” (complicated, and heavy)

 

V 1.0.1 (2011-11-03)
Stationary Scan Analysis:
- – -Automatic Peak Search based on Sjolin & Wlodawer ‘s paper published in 1981.
- – -Manual peak / background definition now depends on a user-defined threshold value.
- – -Error bar estimation implemented.
- – -Multiple options on plotting (several remains to be implemented)
- – -LSpan, HSlit are reduced to labels (output only), they are no longer spinbuttons (previously input)
- – -ROI is now defined by dragging with mouse right button pressed
- – -If current image has been analysed, the Integrated Intensity is marked as hollow circle in Spec_Canvas while its used mask will be recalled in MPX_Canvas
- – -Normalised Background (corrected and normalised to pixel number to make it comparable for all scans)
Omega Scan Analysis:
- – -To be completely re-written in the future
Routine Analysis:
- – -To be completely re-written in the future
Rod Output:
- – -Now stores only l-values, integrated intensities (Peak-Background), uncertainties plus the MPX file num (The correction factors are not listed as corrections are applied seperately on each pixels)
- – -When import analyzed result to Output panel, data are automatically sorted by their l-values. (this has its pros and cons)
- – -Write to file implemented
- – -Load file implemented
Known Bugs:
- – -A certain kind of zoom-in (magnification of image) will cause some rendering issue which jams the whole process.
Thoughts:
- – -For stationary scan, when bet is small, it is possible that the detector is not large enough to include the whole peak, in this case, if the Lorentz factor is applied seperately to each pixels (very critical in this case), one can probably choose to integrate half of the peak, and then multiply the result by 2. This approach can be simply verified by comparing the intensity distribution of the integrated half with that of the incomplete half left untouched.
General
- – -Continuous restructuring the programme
- – -MPX Canvas now shows corresponding l-values, deviation of in plane and out of plane distance from detector center in reciprocal units
- – -Cross Cursor when entering MPX Canvas
- – -Zooming is now achieved by dragging with mouse left button pressed (zoom a second time is bugged, need to re-write axhspan or just live with it), restore by middle click

 

V 1.0.0 (2011-10-28)
Everything…

Go to Top