Using xrtQook for script generation¶
Start xrtQook: type
python xrtQookStart.pyw
from xrt/gui or, if you have installed xrt by running setup.py, typexrtQookStart.pyw
from any location.Note
The scaling of GUI may behave differently in different systems and Qt versions. If it looks wrong, try the scaling options in
xrtQookStart.pyw
.Note
If you want to start xrtQook from Spyder, select the run option “Execute in an external system terminal”.
Rename beamLine to myTestBeamline by double clicking on it (you do not have to, only for demonstration).
Right-click on myTestBeamline and Add Source → BendingMagnet. The same can be done from the icon buttons on the left.
In its properties change eMin to 10000-10 and eMax to 10000+10. The middle of this range will be used to automatically align crystals (one crystal in this example) unless the parameter myTestBeamline.alignE sets another value. Blue color indicates non-default values. These will be included into the generated script. All the default-valued parameters do not propagate into the script.
Create a crystalline material CrystalSi. This will create a Si111 crystal at room temperature.
Add a generic OE -> OE. This will add an optical element with a flat surface.
Note
The sequence of the inserted optical elements does matter! This sequence determines the order of beam propagation.
In its properties select the created crystal as ‘material’, put [0, 20000, 0] as ‘center’ (i.e. 20 m from source) and “auto” (with or without quotes) as ‘pitch’.
Add a screen to the beamline.
Give it [0, 21000, auto] as ‘center’. Its height – the last coordinate – will be automatically calculated from the previous elements.
Check the beamline layout with xrtGlow.
Add a plot and select the local screen beam.
Define an offset to the color (energy) axis.
Save the beamline layout as xml.
Generate python script (the button with a code page and the python logo), save the script and run it.
In the console output you can read the actual pitch (Bragg angle) for the crystal and the screen position.
Using custom optical elements in xrtQook¶
Create custom classes of optical elements in a module located in a writable folder. Copy xrt/gui/xrtQookStart.py starter script to that folder, edit it and run it. Editing is very simple: uncomment a few lines at the top of the script that import the custom module and enable integration with xrtQook.