cctbx.xfel GUI/Energy tab
The Energy tab calibrates the per-shot photon energy at LCLS. It is present only when the facility is LCLS and the GUI is not in monitoring mode; otherwise both the tab and the Calib Worker light are absent. The Calib Worker light turns yellow while a calibration is running, green when it is idle, and red when a calibration failed; the reason is printed in the terminal, and the next calibration can be started straight away.
Back to cctbx.xfel GUI.
Background
At LCLS each shot's photon energy can be measured two ways: from the electron beam energy reported by the accelerator (the ebeam), and from the FEE spectrometer, which records the spectrum of every pulse on a one-dimensional detector. The spectrometer gives the better value, but its pixel axis must be calibrated into eV. This tab does that in two steps:
- FEE calibration: several short runs are collected with the beam energy stepped through a notch of known energy. Fitting the notch position in each run's average spectrum against the known energies gives the spectrometer's eV per pixel and eV offset.
- Ebeam calibration: with the spectrometer calibrated, its per-shot energies are compared with the ebeam energies over a set of ordinary runs to find the constant ebeam offset (and the equivalent wavelength offset), so that the ebeam value can be corrected on shots where the spectrometer is unusable.
The results are entered into run block settings (the Spectrum and Wavelength rows) so that processing jobs use the calibrated energies. The run block dialog can take them straight from this tab, or from a file it saved.
FEE Energy Scan Description
- Experiment: the LCLS experiment the scan runs belong to. Defaults to the experiment in Settings; change it if the scan was collected under a different experiment.
- Max events: how many shots of each run to average (200 by default). Must be a positive integer. More shots give a cleaner spectrum but take longer.
- Run / Notch Energy (eV) table: one row per calibration run. Click a cell to edit it. Add Row appends a row and Clear All empties the table.
- Run Calibration: checks that each run exists and each energy is a number (a dialog reports the offending entry otherwise), clears the previous results, then runs the calibration in the background. Two plots fill in when it finishes: the trendline (notch position against energy, with the fitted line) and the spectra (each run's averaged spectrum, with the detected notches labelled on the plot and a draggable legend listing the runs). Each plot has a matplotlib toolbar for zooming and saving.
Starting a new FEE calibration also discards the ebeam result, since that was measured against the previous spectrometer calibration; run the ebeam comparison again afterwards.
Runs for Ebeam Calibration
- The checklist shows every run in the database; Refresh picks up runs that arrived since the tab was opened and Clear unticks everything and clears the plot.
- Tick the runs to compare and press Run Calibration. The FEE calibration must have been run first (the button refuses with a dialog otherwise), and each run must belong to a run block (the detector address is taken from it). Runs that are in no run block, or that have no events with both a spectrometer and an ebeam reading, are skipped: the former with a message in the terminal, the latter with a note in the plot legend.
- The plot overlays the ebeam energies with the calibrated spectrometer energies for the selected runs.
- Clear unticks the runs and discards the ebeam result and its plot.
Calibration Results
The box shows FEE eV per pixel, FEE eV offset and Ebeam offset (in eV, with the equivalent wavelength offset in Å). Save calibration is enabled once there is a result to save; it writes the results as a PHIL file (default fee/fee_calib.phil next to the output folder) and confirms the file name in the box:
spectrum_eV_per_pixel=... spectrum_eV_offset=... ebeam_eV_offset=... wavelength_offset=...
The run block dialog has two buttons under its Spectrum row: Use Energy tab calibration copies the current results from this tab (enabled once the FEE calibration has run), and Load calibration file... reads a file saved here. Both fill the eV per pixel and eV offset fields, and the Wavelength offset when the ebeam comparison has been run. Since changing those fields creates a new run block, do the calibration before starting the main processing where possible, or create a new trial with the calibrated run block afterwards.