McStas / McXtrace User Tools Cheat Sheet
Source: McCode/tools/Python (plus McCode/tools/matlab for the legacy Matlab/Octave/iFit variants)
Naming convention: almost everything named mc<something> on the McStas
side has a direct mx<something> counterpart on the McXtrace side, built
from the same source, with the neutron/photon ("particle") wording
and a few McStas-only options (e.g. --gravity, time-of-flight mode)
adjusted accordingly. Where a tool has several rendering variants
(html / matplotlib / pyqtgraph / webgl / ...), the variant is appended after
a dash, e.g. mcplot-html / mxplot-html.
On the commandline: Most tools accept --help
Tool-class pages
Page
Covers
Code generators
mcstas/mcxtrace, mcstas-pygen/mcxtrace-pygen, mcstas-jupylab/mcxtrace-jupylab
mcgui
mcgui / mxgui
mcrun
mcrun / mxrun
mcplot family
mcplot / mxplot, mcplotdiff / mxplotdiff, mccoplot / mxcoplot — html / matplotlib / pyqtgraph / plopp / matlab variants
mcdisplay family
mcdisplay / mxdisplay — pyqtgraph (default) / matplotlib / webgl / webgl-classic / plopp / cad / mantid / matlab variants
mctest family
mctest / mxtest, mcviewtest / mxviewtest; statistical acceptance of test values
mcdoc
mcdoc / mxdoc
I want to...
Use
Compile an .instr file to C directly (rarely needed by hand)
mcstas / mcxtrace
Convert an .instr model to Python for use with McStasScript
mcstas-pygen / mcxtrace-pygen
Explore an instrument interactively in Jupyter via McStasScript
mcstas-jupylab / mcxtrace-jupylab
Edit/compile/run instruments interactively
mcgui / mxgui
Run a simulation from the command line, or a parameter scan/optimisation
mcrun / mxrun
Plot one simulation's results
mcplot-{html,matplotlib,pyqtgraph,plopp} mxplot-{html,matplotlib,pyqtgraph,plopp}
Compare exactly two simulations (a - b)
mcplotdiff-{html,matplotlib,pyqtgraph} mxplotdiff-{html,matplotlib,pyqtgraph}
Overlay 2+ simulations for direct comparison
mccoplot-{html,matplotlib,pyqtgraph} mxcoplot-{html,matplotlib,pyqtgraph}
Visualise instrument geometry + particle trajectories
mcdisplay-{pyqtgraph,matplotlib,webgl,webgl-classic,plopp} mxdisplay-{pyqtgraph,matplotlib,webgl,webgl-classic,plopp}
Export instrument geometry to a CAD file
mcdisplay-cad mxdisplay-cad
Export instrument geometry to a Mantid IDF (.xml)
mcdisplay-mantid mxdisplay-mantid
Plot/display results in Matlab, Octave, or iFit instead
mcplot-matlab / mxplot-matlab mcdisplay-matlab / mxdisplay-matlab
Test/benchmark the whole instrument library against a McCode installation
mctest / mxtest
Build a browsable pass/fail + diff report from mctest results
mcviewtest / mxviewtest
Generate/browse instrument & component documentation
mcdoc / mxdoc
Plot the resolution ellipsoid from Res_monitor output (McStas only)
mcresplot (no page: see mcresplot --help)
Last Modified: Tue Nov 3 18:52:15 2026