This chapter describes usage of the McXtrace simulation package. In case of problems regarding installation or usage, the McXtrace mailing list [Mcx] or the authors should be contacted.
Performing a simulation using McXtrace can be divided into the following steps/elements
To use McXtrace, an instrument definition file describing the instrument to be simulated must be written. Alternatively, an example instrument file can be obtained from the examples/ directory in the distribution or from another source.
The input files (instrument and component files) are written in the McXtrace meta-language and are edited either by using your favorite editor or by using the built-in editor of the graphical user interface (mxgui).
Next, the McXtrace compiler mcxtrace is invoked to translate the instrument and component files into a C program. The program mcxtrace itself is written in C, using the parser flex and the compiler compiler bison.
The resulting C program can then be compiled with a C compiler and run in combination with various front-end programs for example to present the intensity at the detector as a motor position is varied.
The output data may be analyzed and visualized in the same way as regular experiments by using the data handling and visualization tools in McXtrace. As of McXtrace 3.x, these front-ends (mxplot, mxdisplay, …) are all implemented in Python, using matplotlib, pyqtgraph and browser/HTML (D3.js) back-ends, see section 5.4. Further data output formats including NeXus are available, see section 5.5.
It is a known problem that some of the McXtrace tools do not support filenames / directories with spaces. We recommend avoiding spaces in the paths used for McXtrace work directories and instrument files. As of McXtrace 3.x, all tools (mxgui, mxrun, mxplot, mxdisplay, …) are pure Python and are bundled with the conda-forge package, so no separate Perl installation is required on any platform, including Windows.