<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://viper.lbl.gov:8080/cctbx.xfel/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Aaron</id>
	<title>cctbx_xfel - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://viper.lbl.gov:8080/cctbx.xfel/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Aaron"/>
	<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php/Special:Contributions/Aaron"/>
	<updated>2026-11-29T01:41:20Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.15</generator>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Troubleshooting&amp;diff=1825</id>
		<title>Cctbx.xfel GUI/Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Troubleshooting&amp;diff=1825"/>
		<updated>2026-11-12T00:08:57Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Troubleshooting}}&lt;br /&gt;
What to check when something does not behave. The GUI prints errors and progress to the terminal it was started from, so that terminal is always the first place to look.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== A status light is red ==&lt;br /&gt;
A red light means that background task failed and stopped; the error is in the terminal. Common causes: the database connection dropped (the server was restarted or the job running it ended), the queuing system command failed (&amp;lt;code&amp;gt;squeue&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;bjobs&amp;lt;/code&amp;gt; not on the path), or a run block refers to a run that no longer exists. Fix the cause, then restart it: toggle &#039;&#039;&#039;Watch for new runs&#039;&#039;&#039; or &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039; off and on, or switch away from and back to the tab for the tab-specific sentinels. If the database itself is gone, restart the GUI.&lt;br /&gt;
&lt;br /&gt;
== The Calib Worker light is red ==&lt;br /&gt;
A FEE or ebeam calibration failed; the message is in the terminal. Correct the inputs and press &#039;&#039;Run Calibration&#039;&#039; again. Common causes: a scan run that is not in the run database, a wrong experiment name, runs with no spectrometer data, or runs not yet in any run block (the ebeam comparison takes the detector address from the block).&lt;br /&gt;
&lt;br /&gt;
== No runs appear ==&lt;br /&gt;
* &#039;&#039;Watch for new runs&#039;&#039; must be on (the Run Sentinel light green).&lt;br /&gt;
* LCLS: check the experiment name and the XTC stream location in the credentials dialog, and that the run database web service is reachable from this machine.&lt;br /&gt;
* Standalone: check the folder, the template (it is a glob, so &amp;lt;code&amp;gt;*.h5&amp;lt;/code&amp;gt;, not &amp;lt;code&amp;gt;.h5&amp;lt;/code&amp;gt;), and the completion criteria; a file younger than &#039;&#039;Minimum time since last modified&#039;&#039; or smaller than &#039;&#039;Minimum file size&#039;&#039; is not picked up yet. Folders need the status file or the required number of files.&lt;br /&gt;
&lt;br /&gt;
== Jobs are not submitted ==&lt;br /&gt;
* &#039;&#039;Auto-submit jobs&#039;&#039; must be on, the trial must be &#039;&#039;&#039;active&#039;&#039;&#039;, and it must have a run block containing the runs.&lt;br /&gt;
* In &#039;&#039;local&#039;&#039; mode only one job runs at a time; the next is submitted when it finishes.&lt;br /&gt;
* &amp;lt;code&amp;gt;mp.max_queued&amp;lt;/code&amp;gt; in the settings file limits the number of queued and running jobs.&lt;br /&gt;
* For datasets: the dataset must be active and must have at least one tag; all its tags must be in use on the trial&#039;s runs; the runs&#039; indexing jobs must be &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;; and each stage waits for the previous stage of the same run to be &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;. A failed stage (&amp;lt;code&amp;gt;EXIT&amp;lt;/code&amp;gt;) blocks the rest of the pipeline for that run until it is restarted.&lt;br /&gt;
* Watch the terminal: the job sentinel prints what it submits and why it is waiting.&lt;br /&gt;
&lt;br /&gt;
== The GUI asks me to confirm &amp;quot;about N jobs&amp;quot; ==&lt;br /&gt;
Activating a trial or dataset, saving a run block on an active trial, or saving an active dataset counts the jobs the job sentinel would then submit and asks when the total reaches &amp;lt;code&amp;gt;job_count_warning&amp;lt;/code&amp;gt; (50 by default). The count by stage tells you what is about to happen: a replaced run block reprocesses all of its runs, a changed early stage re-runs every later stage, and an open run block on a long experiment covers every run collected since its start. Answer &#039;&#039;No&#039;&#039; to go back and narrow the selection, or raise or disable the setting in the project file if the numbers are routine for your experiment.&lt;br /&gt;
&lt;br /&gt;
== The run block dialog warns about the detector address ==&lt;br /&gt;
On saving, an address that names none of Jungfrau, Rayonix, ePix or CSPAD is queried, because no image format would read it. Pick an alias from the drop-down, or type the full psana address if the detector is one of those under another name. Saving anyway is allowed, for example for a custom format.&lt;br /&gt;
&lt;br /&gt;
== A job fails immediately (S_FAIL or EXIT) ==&lt;br /&gt;
Open the job&#039;s log: &amp;lt;code&amp;gt;&amp;lt;output folder&amp;gt;/r&amp;lt;run&amp;gt;/&amp;lt;trial&amp;gt;_rg&amp;lt;block&amp;gt;/stdout/log.out&amp;lt;/code&amp;gt; for indexing jobs, and the queue&#039;s error file next to it. Typical causes are a wrong detector address, a mask or reference geometry file that the compute nodes cannot read, an environment script that does not set up cctbx, or a PHIL parameter that the processing program rejects. After fixing, use &#039;&#039;&#039;Restart job&#039;&#039;&#039; in the Jobs tab (or, for a run block change, let the new block&#039;s jobs run).&lt;br /&gt;
&lt;br /&gt;
== Images index poorly ==&lt;br /&gt;
* Check the unit cell and space group in the trial, and the detector distance and beam centre in the run block (an average image from the Runs tab helps with the latter).&lt;br /&gt;
* In the Run Stats tab, many grey points high in the strong spots panel are hits that did not index: look at some of those images.&lt;br /&gt;
* Too many or too few spots: adjust the spot finding thresholds in a new trial and compare.&lt;br /&gt;
&lt;br /&gt;
== The Run Stats plot is empty ==&lt;br /&gt;
A trial must be selected, and runs ticked (or &#039;&#039;Auto plot last five runs&#039;&#039; pressed). Only runs whose jobs have logged results show up; a run whose job is still pending has nothing to plot yet. If &#039;&#039;Auto update&#039;&#039; is unticked the plot does not refresh. In the per-run view, gaps in the lines and a &amp;quot;still to query&amp;quot; note mean the runs are being read in; wait for the next refreshes. If the Run Stats light is red, a plot or query failed and the message is in the terminal; switch away from the tab and back to restart it.&lt;br /&gt;
&lt;br /&gt;
== The cosym page says there is no plot ==&lt;br /&gt;
The embedding plot is only written when the merging stage runs &amp;lt;code&amp;gt;modify_cosym&amp;lt;/code&amp;gt;, and only for a single selected version. Check the merging stage&#039;s step list under &#039;&#039;Edit PHIL&#039;&#039; and that the merging job is &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== The drift page says there is no ensemble refinement output ==&lt;br /&gt;
The drift plot reads the refined experiments written by the ensemble refinement stage, so the dataset needs that stage and its jobs must have run. A version merged before the stage was added has nothing to read. If the line above the plot says some chunks were skipped, the reason given is for the first one; a chunk still being written is the usual cause and clears on a later refresh.&lt;br /&gt;
&lt;br /&gt;
== The dataset dialog refuses two identical stages ==&lt;br /&gt;
Two consecutive stages of the same type with the same parameters (two merging stages, say) would be the same task and compute the same thing twice. Change one of them, or remove the extra stage.&lt;br /&gt;
&lt;br /&gt;
== The GUI refuses to load a project ==&lt;br /&gt;
While the GUI is connected, a project with a different database connection or experiment tag cannot be loaded. Quit and start the GUI again; the login dialog can load any project.&lt;br /&gt;
&lt;br /&gt;
== Resetting an experiment ==&lt;br /&gt;
To start again with an empty database but the same experiment tag, tick &#039;&#039;Delete and regenerate all tables&#039;&#039; in the credentials dialog at login. This erases every run, trial, job and logged result for that tag (the files on disk are untouched, so delete or move the output folder as well if you want a clean slate). Using a new experiment tag instead keeps the old records available.&lt;br /&gt;
&lt;br /&gt;
== Getting help ==&lt;br /&gt;
The &#039;&#039;About&#039;&#039; entry in the Help menu lists the authors. Questions and bug reports go to the cctbx.xfel developers; include the terminal output and the relevant job log.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Workflows&amp;diff=1824</id>
		<title>Cctbx.xfel GUI/Workflows</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Workflows&amp;diff=1824"/>
		<updated>2026-11-12T00:08:11Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Workflows}}&lt;br /&gt;
Step-by-step recipes for the common things done with the cctbx.xfel GUI. Each step names the tab or dialog it happens in; see the tab pages for the details of every control.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Setting up a new experiment ==&lt;br /&gt;
# Start &amp;lt;code&amp;gt;cctbx.xfel&amp;lt;/code&amp;gt;. In the login dialog press &#039;&#039;&#039;DB Credentials...&#039;&#039;&#039; and enter the database server, database, user and password. If you have no server, fill those in anyway and press &#039;&#039;&#039;Start DB Server&#039;&#039;&#039; (see [[cctbx.xfel GUI/Settings#Starting a local database server|starting a local server]]).&lt;br /&gt;
# Enter a new &#039;&#039;&#039;Experiment Tag&#039;&#039;&#039; for this experiment, choose the &#039;&#039;&#039;Facility&#039;&#039;&#039; and, at LCLS, the &#039;&#039;&#039;Experiment&#039;&#039;&#039; name; in standalone mode press &#039;&#039;&#039;Options...&#039;&#039;&#039; and set the folder to monitor and the file template.&lt;br /&gt;
# Choose the &#039;&#039;&#039;Output&#039;&#039;&#039; folder (on a file system the compute nodes can write to).&lt;br /&gt;
# Press &#039;&#039;&#039;Advanced Settings...&#039;&#039;&#039; and set the multiprocessing method, queue, number of processors and environment script for your cluster. Press OK.&lt;br /&gt;
# Press &#039;&#039;&#039;Save Project As...&#039;&#039;&#039; and name the project, then &#039;&#039;&#039;OK&#039;&#039;&#039;. The main window opens.&lt;br /&gt;
# On the toolbar press &#039;&#039;&#039;Watch for new runs&#039;&#039;&#039;. Runs appear in the Runs tab.&lt;br /&gt;
&lt;br /&gt;
== Processing runs as they are collected ==&lt;br /&gt;
# &#039;&#039;&#039;Runs tab&#039;&#039;&#039;: press &#039;&#039;&#039;Manage Tags&#039;&#039;&#039; and create tags for your samples; press &#039;&#039;&#039;Manage Persistent Tags&#039;&#039;&#039; and tick the tag for the sample currently on the beam, so that every new run gets it. Change the persistent tags when the sample changes.&lt;br /&gt;
# &#039;&#039;&#039;Trials tab&#039;&#039;&#039;: press &#039;&#039;&#039;New Trial&#039;&#039;&#039;. Enter the unit cell and space group if known, adjust spot finding if needed, and press OK. In the new trial press &#039;&#039;&#039;New Block&#039;&#039;&#039;: set the start run, leave &#039;&#039;&#039;Auto add runs&#039;&#039;&#039; selected, enter the detector address, beam centre and distance (LCLS), any mask or reference geometry, and press OK. Tick &#039;&#039;&#039;Active Trial&#039;&#039;&#039;.&lt;br /&gt;
# On the toolbar press &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039;. The job sentinel now submits a job for every run in the block and for each new run as it arrives.&lt;br /&gt;
# &#039;&#039;&#039;Jobs tab&#039;&#039;&#039;: confirm the jobs reach &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt; and then &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;. If one shows &amp;lt;code&amp;gt;EXIT&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;S_FAIL&amp;lt;/code&amp;gt;, read its log (see [[cctbx.xfel GUI/Troubleshooting|Troubleshooting]]).&lt;br /&gt;
# &#039;&#039;&#039;Run Stats tab&#039;&#039;&#039;: select the trial and press &#039;&#039;&#039;Auto plot last five runs&#039;&#039;&#039;. Leave this tab showing during collection. For a summary of every run so far, switch &#039;&#039;Show&#039;&#039; to &#039;&#039;&#039;Per run&#039;&#039;&#039;.&lt;br /&gt;
# &#039;&#039;&#039;Unit Cell tab&#039;&#039;&#039;: select the trial, add a tag set for the sample, and check that the cell histograms are single peaks at the expected values.&lt;br /&gt;
&lt;br /&gt;
== Calibrating the photon energy (LCLS) ==&lt;br /&gt;
# Collect a few short runs with the beam energy stepped through the notch, and note the notch energy of each.&lt;br /&gt;
# Energy tab: enter each run and its notch energy in the table, set &#039;&#039;Max events&#039;&#039;, and press &#039;&#039;&#039;Run Calibration&#039;&#039;&#039; under the scan description. Check the trendline is a clean straight line through the notch positions.&lt;br /&gt;
# Tick a handful of ordinary runs under &#039;&#039;Runs for Ebeam Calibration&#039;&#039; and press its &#039;&#039;&#039;Run Calibration&#039;&#039;&#039;. The runs must already be in a run block. The &#039;&#039;Ebeam offset&#039;&#039; appears in the results box.&lt;br /&gt;
# Press &#039;&#039;&#039;Save calibration&#039;&#039;&#039; to keep a copy of the values.&lt;br /&gt;
# Trials tab: open the run block (or create a new one) and press &#039;&#039;&#039;Use Energy tab calibration&#039;&#039;&#039; under the &#039;&#039;Spectrum&#039;&#039; row, or &#039;&#039;&#039;Load calibration file...&#039;&#039;&#039; if the GUI has been restarted since. Press OK. A new block is created if the values changed, and its jobs use the calibrated energies.&lt;br /&gt;
&lt;br /&gt;
== Tuning spot finding and indexing ==&lt;br /&gt;
# Make a new trial (it copies the previous one) and change one thing: for example lower &#039;&#039;Sigma strong&#039;&#039; or set &#039;&#039;Min spot size&#039;&#039;. Use &#039;&#039;&#039;Copy runblocks from&#039;&#039;&#039; the previous trial so both trials cover the same runs, or give the new trial a block with an explicit end run covering a few representative runs.&lt;br /&gt;
# Activate the new trial. Both trials can be active at once; jobs for the new trial appear in the Jobs tab.&lt;br /&gt;
# In the Run Stats tab switch between the two trials and compare the strong spot counts, indexing rate and resolution for the same runs; the &#039;&#039;&#039;Per run&#039;&#039;&#039; view&#039;s table gives the counts side by side for copying.&lt;br /&gt;
# Deactivate the trial you will not use, so it stops consuming queue time on new runs.&lt;br /&gt;
&lt;br /&gt;
== Reprocessing after a change to a run block ==&lt;br /&gt;
Detector settings live in run blocks, and results are stored per block. To reprocess runs with a new geometry or mask:&lt;br /&gt;
# Trials tab: click the block, change the setting (for example &#039;&#039;Reference geometry&#039;&#039;) and press OK. Because a setting other than the end run or comment changed, the old block is deactivated and a new block is created in the trial.&lt;br /&gt;
# With the trial active and &#039;&#039;Auto-submit jobs&#039;&#039; on, jobs for the new block are submitted. The old block&#039;s results remain on disk under the old block id.&lt;br /&gt;
To instead re-run a single failed job unchanged, use &#039;&#039;&#039;Restart job&#039;&#039;&#039; in the Jobs tab.&lt;br /&gt;
&lt;br /&gt;
== Merging a dataset ==&lt;br /&gt;
# Make sure the runs to merge carry a tag that identifies them (Runs tab) and that their indexing jobs are &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Datasets tab: press &#039;&#039;&#039;New Dataset&#039;&#039;&#039;. Name it, choose the trial and the tag(s), and check that the &#039;&#039;Runs selected&#039;&#039; line shows the number of runs you expect. Choose a reference model, or &#039;&#039;Unknown structure&#039;&#039; with the cell and space group; if the wizard warns that the trial&#039;s symmetry does not match the model, check which of the two is wrong before continuing. Choose the &#039;&#039;Merging schedule&#039;&#039;: the default merges whatever has finished on each pass; &#039;&#039;after every run&#039;&#039; gives a version per run to watch the statistics grow; &#039;&#039;once all runs finish&#039;&#039; gives a single merge when nothing is left running. Keep &#039;&#039;Include ensemble refinement&#039;&#039; ticked unless time is short. Accept or change the cosym suggestion. Set the resolution limit. Finish.&lt;br /&gt;
# Tick &#039;&#039;&#039;Active Dataset&#039;&#039;&#039;. If asked to confirm the number of jobs, check it is what you expect. With &#039;&#039;Auto-submit jobs&#039;&#039; on, ensemble refinement and scaling jobs are submitted per run, then a merging job once some runs are through. Follow them in the Jobs tab.&lt;br /&gt;
# Merging stats tab: select the dataset. Version &#039;&#039;All&#039;&#039; shows CC1/2 and multiplicity growing as versions accumulate; a single version shows its statistics by resolution.&lt;br /&gt;
# The merged MTZ is &amp;lt;code&amp;gt;&amp;lt;output folder&amp;gt;/&amp;lt;dataset name&amp;gt;/v&amp;lt;NNN&amp;gt;/&amp;lt;name&amp;gt;_v&amp;lt;NNN&amp;gt;_all.mtz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Merging without a reference structure ===&lt;br /&gt;
Choose &#039;&#039;Unknown structure&#039;&#039; in the wizard. The merge is a plain average without per-image scaling. Once it has produced an MTZ, create a second dataset with &#039;&#039;Known reference model&#039;&#039; pointing at that MTZ to get a properly scaled and post-refined merge. If the symmetry has an indexing ambiguity, tick cosym in both datasets; the first merge fixes an arbitrary but consistent indexing frame which the second then anchors to.&lt;br /&gt;
&lt;br /&gt;
=== Merging one crystal form out of a mixture ===&lt;br /&gt;
# Unit Cell tab: select the trial and the tag set and tick &#039;&#039;&#039;Plot clusters&#039;&#039;&#039;. Press &#039;&#039;&#039;Options...&#039;&#039;&#039; to adjust &#039;&#039;Cluster epsilon&#039;&#039; until the forms separate, and to add an angle to the feature vector if that is what tells the forms apart; the &#039;&#039;Cell volume histogram&#039;&#039; side plot shows the clusters&#039; sizes at a glance. Note which component (0 is the largest) is the one you want. The cluster file is written to &amp;lt;code&amp;gt;cluster/&amp;lt;/code&amp;gt; in the output folder.&lt;br /&gt;
# Datasets tab: open the dataset, and in the &#039;&#039;&#039;Scaling&#039;&#039;&#039; stage tick &#039;&#039;&#039;Filter by unit-cell cluster&#039;&#039;&#039;, choose the cluster file, enter the component number and, if needed, a tighter Mahalanobis cutoff. Press OK.&lt;br /&gt;
# The next version merged (restart the scaling jobs from the Jobs tab, or wait for new runs) uses only lattices from that cluster.&lt;br /&gt;
&lt;br /&gt;
== Merging the same runs with different settings ==&lt;br /&gt;
Press the copy button on the dataset. The copy is inactive and starts with the original&#039;s pipeline. Open it, change what you want (resolution limit, reference model, a stage&#039;s parameters), give it a comment saying what differs, and activate it. The original is never affected by edits to the copy. Stages that are unchanged, and everything upstream of the first change, reuse the original&#039;s jobs: a copy that differs only in its merging parameters submits just a merging job, while one with a different scaling filter re-runs scaling and merging but keeps the ensemble refinement.&lt;br /&gt;
&lt;br /&gt;
== Checking detector drift ==&lt;br /&gt;
Merging stats tab: select the dataset and a version, and open the &#039;&#039;&#039;Detector drift&#039;&#039;&#039; page. The detector origin and cell lengths are plotted against run and chunk, read from the ensemble refinement results behind that version (the pipeline must include ensemble refinement). Untick &#039;&#039;Auto update&#039;&#039; to zoom in without the plot being redrawn. A step in the origin between runs suggests the detector moved: give those runs their own run block with a refined reference geometry.&lt;br /&gt;
&lt;br /&gt;
== Stopping and restarting jobs ==&lt;br /&gt;
* To stop submitting new jobs, turn off &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039; or untick the trial or dataset&#039;s &#039;&#039;Active&#039;&#039; box.&lt;br /&gt;
* To stop a running job, select it in the Jobs tab and press &#039;&#039;&#039;Stop job&#039;&#039;&#039;.&lt;br /&gt;
* To re-run a job after fixing the cause of a failure, select it, press &#039;&#039;&#039;Stop job&#039;&#039;&#039; if it is still running, then &#039;&#039;&#039;Restart job&#039;&#039;&#039;. Its old results are deleted and the job sentinel resubmits it.&lt;br /&gt;
* To throw away a trial&#039;s results, delete its jobs in the Jobs tab (untick &#039;&#039;Only display jobs from active trials/blocks&#039;&#039; to see jobs of inactive trials), and leave the trial inactive. The trial itself cannot be deleted.&lt;br /&gt;
&lt;br /&gt;
== Watching an experiment from elsewhere ==&lt;br /&gt;
Start a second GUI with the same project (copy &amp;lt;code&amp;gt;~/.cctbx.xfel/settings_&amp;lt;name&amp;gt;.phil&amp;lt;/code&amp;gt; to the other machine, or set the same credentials by hand) and &amp;lt;code&amp;gt;monitoring_mode=True&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;cctbx.xfel monitoring_mode=True&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Run Stats, Unit Cell and Merging stats tabs work as usual; nothing can be submitted from it. Keep job submission to a single GUI instance.&lt;br /&gt;
&lt;br /&gt;
== Standalone mode with files from another source ==&lt;br /&gt;
# Settings: facility &#039;&#039;Standalone&#039;&#039;; &#039;&#039;&#039;Options...&#039;&#039;&#039;: set the folder, &#039;&#039;&#039;Monitor for&#039;&#039;&#039; &#039;&#039;files&#039;&#039; or &#039;&#039;folders&#039;&#039;, the file template (for example &amp;lt;code&amp;gt;*.h5&amp;lt;/code&amp;gt;) and tick &#039;&#039;Files are composite&#039;&#039; for HDF5 or NeXus files. For one-image-per-file data, use &#039;&#039;folders&#039;&#039; with one folder per run and untick &#039;&#039;composite&#039;&#039;.&lt;br /&gt;
# Proceed as for a live experiment. Run blocks select runs by their order of discovery; the detector geometry comes from the image headers unless a reference geometry is set in the block.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Run_Stats_tab&amp;diff=1823</id>
		<title>Cctbx.xfel GUI/Run Stats tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Run_Stats_tab&amp;diff=1823"/>
		<updated>2026-11-12T00:07:20Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Run Stats tab}}&lt;br /&gt;
The &#039;&#039;&#039;Run Stats tab&#039;&#039;&#039; is the live view of how processing is going. It has two views, chosen with the &#039;&#039;&#039;Show&#039;&#039;&#039; selector: &#039;&#039;&#039;Per shot&#039;&#039;&#039; plots every image of the selected runs (strong spots, whether it indexed, resolution, photon energy) with running hit and indexing rates, and is the view to keep open during data collection; &#039;&#039;&#039;Per run&#039;&#039;&#039; plots one point per run (hit, indexing, high quality and solvent rates, and frames) with a table of the counts, and is the view for an overview of a whole experiment. The plot is redrawn every 5 seconds while &#039;&#039;Auto update&#039;&#039; is ticked.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Selecting what to plot ==&lt;br /&gt;
The &#039;&#039;Statistics Options&#039;&#039; box on the lower left:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Trial&#039;&#039;&#039;: which trial&#039;s results to show. The list includes every trial; pick &#039;&#039;None&#039;&#039; to clear the plot.&lt;br /&gt;
* &#039;&#039;&#039;Selected runs&#039;&#039;&#039;: tick the runs to plot. The list contains every run in the trial&#039;s run blocks, and runs are plotted in run order. Ticking runs by hand turns off the two automatic selections below.&lt;br /&gt;
* &#039;&#039;&#039;Auto plot last five runs&#039;&#039;&#039;: keep showing the five most recent runs in the trial, following along as new runs arrive. This is the normal setting during collection. The checklist is ticked to match.&lt;br /&gt;
* &#039;&#039;&#039;Auto plot entire experiment&#039;&#039;&#039;: select every run in the trial. In the per-shot view this uses a compact three-panel form (no per-run annotations or energy panel); for a long experiment the &#039;&#039;&#039;Per run&#039;&#039;&#039; view is the better overview.&lt;br /&gt;
* &#039;&#039;&#039;Hide options&#039;&#039;&#039; collapses the options and image lists to give the plot the whole window.&lt;br /&gt;
* &#039;&#039;&#039;Auto update&#039;&#039;&#039;: untick to freeze the plot, for example to zoom in with the matplotlib toolbar without the view being reset.&lt;br /&gt;
* &#039;&#039;&#039;Show&#039;&#039;&#039;: &#039;&#039;Per shot&#039;&#039; or &#039;&#039;Per run&#039;&#039; (see below). &#039;&#039;&#039;Show table&#039;&#039;&#039; (per run only) shows or hides the table of counts under the plot.&lt;br /&gt;
&lt;br /&gt;
The threshold fields take effect when you press &#039;&#039;&#039;Enter&#039;&#039;&#039; or move to another field. A value that is not a number (or not a whole number, where one is needed) is refused with a message and the previous value is kept:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field !! Default !! Used for&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;High resolution limit&#039;&#039;&#039; || 2.0 Å || An indexed image counts as &#039;&#039;high quality&#039;&#039; if its high-resolution bin (where I/σ(I) drops below the I/σ(I) cutoff) reaches this resolution. The orange line in panel 3 and the parenthesised counts in panel 4 use it.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;# multiples threshold&#039;&#039;&#039; || 2 || An image with at least this many lattices counts as a multi-lattice hit (pink line).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;two theta ratio cutoff&#039;&#039;&#039; || 1 || An image whose radial-average ratio at the run block&#039;s two 2θ angles exceeds this counts as a &#039;&#039;solvent hit&#039;&#039; (green line), that is, a shot that hit the liquid stream or drop whether or not it contained a crystal.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;# strong spots cutoff&#039;&#039;&#039; || 16 || An image with at least this many strong spots counts as a &#039;&#039;crystal hit&#039;&#039;. Also defines which images go into the two image lists below.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;I/sig(I) cutoff&#039;&#039;&#039; || 1 || Defines the high-resolution bin of each indexed image.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;# images to dump&#039;&#039;&#039; || 10 || How many images to convert and open from each list (LCLS XTC processing only).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Per-shot view ==&lt;br /&gt;
The x axis is the image timestamp, with runs laid end to end and separated by vertical lines. Each run is labelled at the top with its tags and its job status, coloured blue for &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;, green for running or queued, red for failed and black if no job was found.&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Strong spots&#039;&#039;&#039;: one point per image, the number of strong spots found. Blue points indexed, grey points did not. The y axis is clipped at 5000.&lt;br /&gt;
# &#039;&#039;&#039;Rates&#039;&#039;&#039; (running averages over a window of images): blue is the percentage of images that indexed, pink the percentage with multiple lattices, and green (right axis) the percentage of solvent hits.&lt;br /&gt;
# &#039;&#039;&#039;Resolution&#039;&#039;&#039;: orange points give each indexed image&#039;s high-resolution bin in Å; the orange line (right axis) is the percentage of images whose resolution reaches the high resolution limit.&lt;br /&gt;
# &#039;&#039;&#039;Energy&#039;&#039;&#039;: the photon energy of each image in eV, with a text summary per run: run number; images collected / crystal hits; images indexed (indexed to the resolution limit); percentage solvent hits / crystal hits; percentage indexed (to the resolution limit).&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Large text&#039;&#039; toolbar button enlarges the markers and labels.&lt;br /&gt;
&lt;br /&gt;
=== Clicking on the plot ===&lt;br /&gt;
At LCLS, clicking on a point in the strong spots or resolution panel opens that image in the DIALS image viewer, with its strong spots and, if it indexed, its indexed reflections overlaid. The viewer stays open and loads a new image on each click. The matplotlib toolbar&#039;s zoom and pan modes must be off for clicks to be interpreted this way.&lt;br /&gt;
&lt;br /&gt;
== Per-run view ==&lt;br /&gt;
With &#039;&#039;Show&#039;&#039; set to &#039;&#039;&#039;Per run&#039;&#039;&#039;, each selected run is one point, so a whole experiment of hundreds of runs fits on the screen and stays quick to refresh.&lt;br /&gt;
&lt;br /&gt;
* The upper panel plots four rates as a percentage of the run&#039;s frames: &#039;&#039;&#039;hits&#039;&#039;&#039; (images with at least &#039;&#039;# strong spots cutoff&#039;&#039; spots), &#039;&#039;&#039;indexed&#039;&#039;&#039;, &#039;&#039;&#039;high quality&#039;&#039;&#039; (indexed to the high resolution limit) and &#039;&#039;&#039;solvent&#039;&#039;&#039; (the solvent hit criterion). The lines use the same colours as the per-shot view.&lt;br /&gt;
* The lower panel is a bar of frames per run, coloured by job status: grey for finished, yellow for running or queued, red for failed. Runs that are not finished are labelled with their status.&lt;br /&gt;
* With &#039;&#039;Show table&#039;&#039; ticked, a table under the plot lists the counts per run (frames, hits, solvent, indexed, lattices, high quality, with percentages, and the job status) and a total row. Select cells, rows or columns and press &#039;&#039;&#039;Ctrl+C&#039;&#039;&#039; to copy them as tab-separated text, ready to paste into a spreadsheet; &#039;&#039;&#039;Ctrl+A&#039;&#039;&#039; selects all.&lt;br /&gt;
&lt;br /&gt;
Selecting many runs for the first time fills the view in a few runs at a time: runs not yet shown appear as gaps in the lines and blank rows in the table, a note in the plot says how many are still to come, and the total row says how many runs it covers. Later refreshes are quick, since finished runs are not re-read. The same counts are printed on the command line by &amp;lt;code&amp;gt;xfel.print_run_stats trial=N&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Image lists (LCLS XTC processing) ==&lt;br /&gt;
When the processing back end is &amp;lt;code&amp;gt;cctbx.xfel.xtc_process&amp;lt;/code&amp;gt;, two lists appear on the right:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Strongest Indexed Images&#039;&#039;&#039;: images that indexed and have at least &#039;&#039;# strong spots cutoff&#039;&#039; spots, with their file paths. &#039;&#039;&#039;Open images&#039;&#039;&#039; opens the first &#039;&#039;# images to dump&#039;&#039; of them in &amp;lt;code&amp;gt;dials.image_viewer&amp;lt;/code&amp;gt; with their indexed reflections (converting them from the XTC stream first if they were not dumped).&lt;br /&gt;
* &#039;&#039;&#039;Strong Images that Didn&#039;t Index&#039;&#039;&#039;: images with many strong spots that failed to index, the ones to look at when the indexing rate is lower than the hit rate suggests it should be. &#039;&#039;&#039;Dump images&#039;&#039;&#039; extracts them from the XTC stream with &amp;lt;code&amp;gt;cctbx.xfel.xtc_dump&amp;lt;/code&amp;gt; into the job&#039;s &amp;lt;code&amp;gt;all/&amp;lt;/code&amp;gt; folder and opens them in the image viewer.&lt;br /&gt;
&lt;br /&gt;
Both commands run in the background; their output appears in the terminal. With the standard &amp;lt;code&amp;gt;cctbx.xfel.process&amp;lt;/code&amp;gt; back end these lists are hidden; use the &#039;&#039;Dump all images to disk&#039;&#039; option in [[cctbx.xfel GUI/Settings#LCLS options|LCLS options]] and look in the &amp;lt;code&amp;gt;all/&amp;lt;/code&amp;gt; folder instead.&lt;br /&gt;
&lt;br /&gt;
== Typical use ==&lt;br /&gt;
* &#039;&#039;&#039;During collection&#039;&#039;&#039;: select the current trial, press &#039;&#039;Auto plot last five runs&#039;&#039;, and watch the hit rate (grey and blue points, green line) to judge sample delivery, and the indexing rate (blue line) and resolution (orange) to judge data quality.&lt;br /&gt;
* &#039;&#039;&#039;Reviewing an experiment&#039;&#039;&#039;: switch to &#039;&#039;Per run&#039;&#039;, press &#039;&#039;Auto plot entire experiment&#039;&#039;, and look for runs whose hit or indexing rate stands out; copy the table into a spreadsheet for the record.&lt;br /&gt;
* &#039;&#039;&#039;Tuning spot finding&#039;&#039;&#039;: create a trial with &#039;&#039;Index&#039;&#039; off, and compare the strong-spot counts of a few runs between trials with different spot finding thresholds. Then open the strongest images to confirm that the spots found are real.&lt;br /&gt;
* &#039;&#039;&#039;Diagnosing indexing&#039;&#039;&#039;: if many images have plenty of strong spots but did not index (grey points high in panel 1), check the unit cell and space group in the trial, the detector distance and beam centre in the run block, and look at a few of those images.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Runs_tab&amp;diff=1822</id>
		<title>Cctbx.xfel GUI/Runs tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Runs_tab&amp;diff=1822"/>
		<updated>2026-11-02T19:32:52Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Runs tab}}&lt;br /&gt;
The &#039;&#039;&#039;Runs tab&#039;&#039;&#039; lists every run the GUI knows about and the sample tags attached to each. It is where tags are created, applied and kept up to date as runs arrive. Tags are the handles that the [[cctbx.xfel GUI/Run Stats tab|Run Stats]], [[cctbx.xfel GUI/Unit Cell tab|Unit Cell]] and [[cctbx.xfel GUI/Datasets tab|Datasets]] tabs use to select runs, so keeping them accurate pays off later.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Where runs come from ==&lt;br /&gt;
Runs appear in the list when the &#039;&#039;&#039;run sentinel&#039;&#039;&#039; finds them, so press &#039;&#039;&#039;Watch for new runs&#039;&#039;&#039; on the toolbar to populate the tab. At LCLS it queries the run database for the experiment named in Settings; in standalone mode it scans the monitored folder (see [[cctbx.xfel GUI/Settings#Standalone options|Standalone options]]). New runs are checked for every 10 seconds, and the list refreshes itself; there is no refresh button.&lt;br /&gt;
&lt;br /&gt;
When the sentinel finds new runs it also:&lt;br /&gt;
* applies the &#039;&#039;&#039;persistent tags&#039;&#039;&#039; (below) to each new run, and&lt;br /&gt;
* adds the new runs to every open (&amp;quot;Auto add runs&amp;quot;) run block, so processing starts without any further clicks if a trial is active and &#039;&#039;Auto-submit jobs&#039;&#039; is on.&lt;br /&gt;
&lt;br /&gt;
== The run list ==&lt;br /&gt;
Each row shows the run number and a wide button listing the run&#039;s tags.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Tag button&#039;&#039;&#039;: click it to open a checklist of all tags and tick the ones that apply to this run. Changes are saved immediately.&lt;br /&gt;
* &#039;&#039;&#039;Drag and drop&#039;&#039;&#039;: press on a row and drag it onto another row to copy all of the source run&#039;s tags onto the target run (the target&#039;s existing tags are kept). The target row is highlighted while you hover over it. A plain click on the tag button still opens the checklist.&lt;br /&gt;
* &#039;&#039;&#039;Average&#039;&#039;&#039;: submits an image averaging job for the run (see below).&lt;br /&gt;
&lt;br /&gt;
== Buttons ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Button !! What it does&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Change Tags on Multiple Runs&#039;&#039;&#039; || Opens a dialog with a checklist of all runs. Tick the runs, then &#039;&#039;&#039;Add tags&#039;&#039;&#039; or &#039;&#039;&#039;Remove tags&#039;&#039;&#039; to choose tags to add to, or remove from, every ticked run. The &#039;&#039;Sort tags by&#039;&#039; radio sorts the tag checklist by creation order or by name.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Manage Persistent Tags&#039;&#039;&#039; || Choose tags that the run sentinel applies automatically to every new run it discovers. Use it when starting a new sample: tick the sample&#039;s tag here, and every run collected from now on carries it. The choice lasts for this GUI session only.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Manage Tags&#039;&#039;&#039; || Create, rename, comment and delete tags. &#039;&#039;&#039;Add Tag&#039;&#039;&#039; inserts a new row with a placeholder name; click the name or comment cell to edit it. &#039;&#039;&#039;Remove Tags&#039;&#039;&#039; deletes the selected rows and &#039;&#039;&#039;Clear All&#039;&#039;&#039; deletes every tag (after a confirmation; this cannot be undone). Tag names must be unique. Nothing is written to the database until you press &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Image averaging ==&lt;br /&gt;
&#039;&#039;&#039;Average&#039;&#039;&#039; submits a &amp;lt;code&amp;gt;dxtbx.image_average&amp;lt;/code&amp;gt; job for the run, using the same queuing settings as processing jobs. It writes three CBF images to &amp;lt;code&amp;gt;averages/&amp;lt;/code&amp;gt; inside the output folder: the mean (&amp;lt;code&amp;gt;avg.cbf&amp;lt;/code&amp;gt;), the per-pixel maximum (&amp;lt;code&amp;gt;max.cbf&amp;lt;/code&amp;gt;) and the standard deviation (&amp;lt;code&amp;gt;std.cbf&amp;lt;/code&amp;gt;). These are useful for checking beam centre and detector distance, finding bad pixels, and making masks.&lt;br /&gt;
&lt;br /&gt;
The dialog asks how many images to &#039;&#039;&#039;skip&#039;&#039;&#039; at the start of the run and whether to &#039;&#039;&#039;use all images&#039;&#039;&#039; or a specified number. The job needs a run block for the detector settings (address, distance, binning): it uses the run&#039;s own run block if it is in one, otherwise the run block whose run range is closest. If no run block exists yet, create one in the [[cctbx.xfel GUI/Trials tab|Trials tab]] first.&lt;br /&gt;
&lt;br /&gt;
The button label changes to &#039;&#039;Running&#039;&#039; once the job is submitted. The job appears in the [[cctbx.xfel GUI/Jobs tab|Jobs tab]] like any other.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
* Decide on a tagging scheme before the beamtime (sample, buffer, laser on/off, detector distance) and create the tags in &#039;&#039;&#039;Manage Tags&#039;&#039;&#039; at the start.&lt;br /&gt;
* Change the persistent tags every time the sample changes. Runs that arrive with the wrong tags can be fixed afterwards with &#039;&#039;&#039;Change Tags on Multiple Runs&#039;&#039;&#039;.&lt;br /&gt;
* A dataset needs at least one tag to select runs by, so even an experiment with a single sample needs one tag applied to its runs.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Jobs_tab&amp;diff=1821</id>
		<title>Cctbx.xfel GUI/Jobs tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Jobs_tab&amp;diff=1821"/>
		<updated>2026-11-02T19:31:14Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Jobs tab}}&lt;br /&gt;
The &#039;&#039;&#039;Jobs tab&#039;&#039;&#039; lists every job the GUI has submitted, with its status in the queuing system, and provides the controls for stopping, deleting and resubmitting jobs. While the tab is showing, the statuses are refreshed from the queuing system every 10 seconds (the &#039;&#039;Job Monitor&#039;&#039; light).&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== The job table ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Column !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Job&#039;&#039;&#039; || The job&#039;s id in the database. Also used in log and error messages.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039; || Empty (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) for indexing jobs submitted by a trial. For dataset jobs, the task type: &amp;lt;code&amp;gt;ensemble_refinement&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;scaling&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;merging&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;phenix&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Dataset&#039;&#039;&#039; || The dataset the job belongs to, for dataset jobs.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Trial&#039;&#039;&#039;, &#039;&#039;&#039;Run&#039;&#039;&#039;, &#039;&#039;&#039;Block&#039;&#039;&#039; || The trial number (&amp;lt;code&amp;gt;t003&amp;lt;/code&amp;gt;), run (&amp;lt;code&amp;gt;r0012&amp;lt;/code&amp;gt;) and run block (&amp;lt;code&amp;gt;rg005&amp;lt;/code&amp;gt;). These make up the job&#039;s output folder, &amp;lt;code&amp;gt;r0012/003_rg005/&amp;lt;/code&amp;gt;. Merging and Phenix jobs have no run or block.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Task&#039;&#039;&#039; || The task id for dataset jobs; its results go in &amp;lt;code&amp;gt;task&amp;lt;id&amp;gt;/&amp;lt;/code&amp;gt; under the run folder.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Version&#039;&#039;&#039; || The dataset version a merging or Phenix job produced.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Subm ID&#039;&#039;&#039; || The id assigned by the queuing system (or the process id for local jobs). Ensemble refinement jobs that run as several chunks list several ids.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Status&#039;&#039;&#039; || See below.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Click a column header to sort by it; click again to reverse.&lt;br /&gt;
&lt;br /&gt;
=== Job statuses ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Status !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SUBMIT&amp;lt;/code&amp;gt; || Submitted; not yet seen in the queue.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PEND&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;HOLD&amp;lt;/code&amp;gt; || Waiting in the queue.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt; || Running.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt; || Finished normally.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EXIT&amp;lt;/code&amp;gt; || Finished with an error, was cancelled, or ran out of memory. Look at the job&#039;s log.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TIMEOUT&amp;lt;/code&amp;gt; || Killed for exceeding the wall time.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SUSP&amp;lt;/code&amp;gt; || Suspended or pre-empted by the scheduler.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; || The queue reported an error for the job.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;S_FAIL&amp;lt;/code&amp;gt; || The submission command itself failed; the message is in the terminal.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;UNKWN&amp;lt;/code&amp;gt; || The queue does not know the job (not yet registered, or expired from the queue&#039;s history). Jobs in this state keep being polled.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DELETED&amp;lt;/code&amp;gt; || Its results were deleted from disk and the database with &#039;&#039;&#039;Delete job&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In the dataset pipeline the next task for a run is only submitted when the previous one is &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;, and a merging job only includes runs whose last local task is &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Filters ==&lt;br /&gt;
* &#039;&#039;&#039;Filter by&#039;&#039;&#039;: &#039;&#039;All jobs&#039;&#039; or the jobs of a single trial.&lt;br /&gt;
* &#039;&#039;&#039;Only display jobs from active trials/blocks&#039;&#039;&#039;: ticked by default, so finished experiments and abandoned trials do not clutter the list. Untick it to see everything.&lt;br /&gt;
&lt;br /&gt;
== Actions ==&lt;br /&gt;
Select one or more rows first (shift-click and control-click work).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Button !! What it does&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Stop job&#039;&#039;&#039; || Cancels the selected jobs in the queuing system. The job&#039;s status becomes &amp;lt;code&amp;gt;EXIT&amp;lt;/code&amp;gt; once the monitor sees it. The job&#039;s database record and results stay.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Delete job&#039;&#039;&#039; || Deletes the selected jobs&#039; results from disk (the job folder) and from the database (the per-image logs), and marks them &amp;lt;code&amp;gt;DELETED&amp;lt;/code&amp;gt;. Only finished jobs can be deleted; stop running jobs first. For a merging job, the version&#039;s folder is removed. You are asked to confirm.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Restart job&#039;&#039;&#039; || Deletes the job&#039;s results as above and submits it again (with &#039;&#039;Auto-submit jobs&#039;&#039; on). Use this after fixing a problem (a bad mask, a full disk, a crashed node). Stop the job first if it is still running.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A job that has failed (&amp;lt;code&amp;gt;EXIT&amp;lt;/code&amp;gt;) is &#039;&#039;&#039;not&#039;&#039;&#039; retried automatically. &#039;&#039;Restart job&#039;&#039; is the way to retry it.&lt;br /&gt;
&lt;br /&gt;
== Finding a job&#039;s log ==&lt;br /&gt;
Indexing jobs log to &amp;lt;code&amp;gt;stdout/log.out&amp;lt;/code&amp;gt; in their output folder, for example &amp;lt;code&amp;gt;&amp;lt;output folder&amp;gt;/r0012/003_rg005/stdout/log.out&amp;lt;/code&amp;gt;; the submission script and queue output are in the same folder. Ensemble refinement logs are under &amp;lt;code&amp;gt;task&amp;lt;id&amp;gt;/combine_experiments_t&amp;lt;trial&amp;gt;/intermediates/&amp;lt;/code&amp;gt;, scaling under &amp;lt;code&amp;gt;task&amp;lt;id&amp;gt;/&amp;lt;/code&amp;gt;, and merging and Phenix under &amp;lt;code&amp;gt;&amp;lt;dataset&amp;gt;/v&amp;lt;version&amp;gt;/&amp;lt;/code&amp;gt;. The queue&#039;s own error output (&amp;lt;code&amp;gt;submit.err&amp;lt;/code&amp;gt; or similar) lives next to the log.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Troubleshooting&amp;diff=1820</id>
		<title>Cctbx.xfel GUI/Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Troubleshooting&amp;diff=1820"/>
		<updated>2026-11-02T19:30:06Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Troubleshooting}}&lt;br /&gt;
What to check when something does not behave. The GUI prints errors and progress to the terminal it was started from, so that terminal is always the first place to look.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== A status light is red ==&lt;br /&gt;
A red light means that background task failed and stopped; the error is in the terminal. Common causes: the database connection dropped (the server was restarted or the job running it ended), the queuing system command failed (&amp;lt;code&amp;gt;squeue&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;bjobs&amp;lt;/code&amp;gt; not on the path), or a run block refers to a run that no longer exists. Fix the cause, then restart it: toggle &#039;&#039;&#039;Watch for new runs&#039;&#039;&#039; or &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039; off and on, or switch away from and back to the tab for the tab-specific sentinels. If the database itself is gone, restart the GUI.&lt;br /&gt;
&lt;br /&gt;
== The Calib Worker light is red ==&lt;br /&gt;
A FEE or ebeam calibration failed; the message is in the terminal. Correct the inputs and press &#039;&#039;Run Calibration&#039;&#039; again. Common causes: a scan run that is not in the run database, a wrong experiment name, runs with no spectrometer data, or runs not yet in any run block (the ebeam comparison takes the detector address from the block).&lt;br /&gt;
&lt;br /&gt;
== No runs appear ==&lt;br /&gt;
* &#039;&#039;Watch for new runs&#039;&#039; must be on (the Run Sentinel light green).&lt;br /&gt;
* LCLS: check the experiment name and the XTC stream location in the credentials dialog, and that the run database web service is reachable from this machine.&lt;br /&gt;
* Standalone: check the folder, the template (it is a glob, so &amp;lt;code&amp;gt;*.h5&amp;lt;/code&amp;gt;, not &amp;lt;code&amp;gt;.h5&amp;lt;/code&amp;gt;), and the completion criteria; a file younger than &#039;&#039;Minimum time since last modified&#039;&#039; or smaller than &#039;&#039;Minimum file size&#039;&#039; is not picked up yet. Folders need the status file or the required number of files.&lt;br /&gt;
&lt;br /&gt;
== Jobs are not submitted ==&lt;br /&gt;
* &#039;&#039;Auto-submit jobs&#039;&#039; must be on, the trial must be &#039;&#039;&#039;active&#039;&#039;&#039;, and it must have a run block containing the runs.&lt;br /&gt;
* In &#039;&#039;local&#039;&#039; mode only one job runs at a time; the next is submitted when it finishes.&lt;br /&gt;
* &amp;lt;code&amp;gt;mp.max_queued&amp;lt;/code&amp;gt; in the settings file limits the number of queued and running jobs.&lt;br /&gt;
* For datasets: the dataset must be active and must have at least one tag; all its tags must be in use on the trial&#039;s runs; the runs&#039; indexing jobs must be &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;; and each stage waits for the previous stage of the same run to be &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;. A failed stage (&amp;lt;code&amp;gt;EXIT&amp;lt;/code&amp;gt;) blocks the rest of the pipeline for that run until it is restarted.&lt;br /&gt;
* Watch the terminal: the job sentinel prints what it submits and why it is waiting.&lt;br /&gt;
&lt;br /&gt;
== The GUI asks me to confirm &amp;quot;about N jobs&amp;quot; ==&lt;br /&gt;
Activating a trial or dataset, saving a run block on an active trial, or saving an active dataset counts the jobs the job sentinel would then submit and asks when the total reaches &amp;lt;code&amp;gt;job_count_warning&amp;lt;/code&amp;gt; (50 by default). The count by stage tells you what is about to happen: a replaced run block reprocesses all of its runs, a changed early stage re-runs every later stage, and an open run block on a long experiment covers every run collected since its start. Answer &#039;&#039;No&#039;&#039; to go back and narrow the selection, or raise or disable the setting in the project file if the numbers are routine for your experiment.&lt;br /&gt;
&lt;br /&gt;
== The run block dialog warns about the detector address ==&lt;br /&gt;
On saving, an address that names none of Jungfrau, Rayonix, ePix or CSPAD is queried, because no image format would read it. Pick an alias from the drop-down, or type the full psana address if the detector is one of those under another name. Saving anyway is allowed, for example for a custom format.&lt;br /&gt;
&lt;br /&gt;
== A job fails immediately (S_FAIL or EXIT) ==&lt;br /&gt;
Open the job&#039;s log: &amp;lt;code&amp;gt;&amp;lt;output folder&amp;gt;/r&amp;lt;run&amp;gt;/&amp;lt;trial&amp;gt;_rg&amp;lt;block&amp;gt;/stdout/log.out&amp;lt;/code&amp;gt; for indexing jobs, and the queue&#039;s error file next to it. Typical causes are a wrong detector address, a mask or reference geometry file that the compute nodes cannot read, an environment script that does not set up cctbx, or a PHIL parameter that the processing program rejects. After fixing, use &#039;&#039;&#039;Restart job&#039;&#039;&#039; in the Jobs tab (or, for a run block change, let the new block&#039;s jobs run).&lt;br /&gt;
&lt;br /&gt;
== Images index poorly ==&lt;br /&gt;
* Check the unit cell and space group in the trial, and the detector distance and beam centre in the run block (an average image from the Runs tab helps with the latter).&lt;br /&gt;
* In the Run Stats tab, many grey points high in the strong spots panel are hits that did not index: look at some of those images.&lt;br /&gt;
* Too many or too few spots: adjust the spot finding thresholds in a new trial and compare.&lt;br /&gt;
&lt;br /&gt;
== The Run Stats plot is empty ==&lt;br /&gt;
A trial must be selected, and runs ticked (or &#039;&#039;Auto plot last five runs&#039;&#039; pressed). Only runs whose jobs have logged results show up; a run whose job is still pending has nothing to plot yet. If &#039;&#039;Auto update&#039;&#039; is unticked the plot does not refresh.&lt;br /&gt;
&lt;br /&gt;
== The cosym page says there is no plot ==&lt;br /&gt;
The embedding plot is only written when the merging stage runs &amp;lt;code&amp;gt;modify_cosym&amp;lt;/code&amp;gt;, and only for a single selected version. Check the merging stage&#039;s step list under &#039;&#039;Edit PHIL&#039;&#039; and that the merging job is &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== The drift page says there is no ensemble refinement output ==&lt;br /&gt;
The drift plot reads the refined experiments written by the ensemble refinement stage, so the dataset needs that stage and its jobs must have run. A version merged before the stage was added has nothing to read. If the line above the plot says some chunks were skipped, the reason given is for the first one; a chunk still being written is the usual cause and clears on a later refresh.&lt;br /&gt;
&lt;br /&gt;
== The dataset dialog refuses two identical stages ==&lt;br /&gt;
Two consecutive stages of the same type with the same parameters (two merging stages, say) would be the same task and compute the same thing twice. Change one of them, or remove the extra stage.&lt;br /&gt;
&lt;br /&gt;
== The GUI refuses to load a project ==&lt;br /&gt;
While the GUI is connected, a project with a different database connection or experiment tag cannot be loaded. Quit and start the GUI again; the login dialog can load any project.&lt;br /&gt;
&lt;br /&gt;
== Resetting an experiment ==&lt;br /&gt;
To start again with an empty database but the same experiment tag, tick &#039;&#039;Delete and regenerate all tables&#039;&#039; in the credentials dialog at login. This erases every run, trial, job and logged result for that tag (the files on disk are untouched, so delete or move the output folder as well if you want a clean slate). Using a new experiment tag instead keeps the old records available.&lt;br /&gt;
&lt;br /&gt;
== Getting help ==&lt;br /&gt;
The &#039;&#039;About&#039;&#039; entry in the Help menu lists the authors. Questions and bug reports go to the cctbx.xfel developers; include the terminal output and the relevant job log.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI&amp;diff=1819</id>
		<title>Cctbx.xfel GUI</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI&amp;diff=1819"/>
		<updated>2026-11-02T19:29:04Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI}}&lt;br /&gt;
The &#039;&#039;&#039;cctbx.xfel GUI&#039;&#039;&#039; is the graphical front end for processing serial crystallography data with cctbx.xfel and DIALS. It watches for new runs as they are collected, submits processing jobs to a cluster or to the local machine, records everything in a database, and shows live feedback on hit rates, indexing rates, unit cells and merging statistics. It can also take a finished set of runs through ensemble refinement, scaling and merging, and on to Phenix.&lt;br /&gt;
&lt;br /&gt;
This page explains the ideas behind the GUI and the layout of the main window. The tabs and dialogs are documented on their own pages, and the GUI&#039;s &#039;&#039;&#039;Help&#039;&#039;&#039; toolbar button opens the page for whichever tab is showing.&lt;br /&gt;
&lt;br /&gt;
== Pages ==&lt;br /&gt;
* [[cctbx.xfel GUI/Settings|Settings and login]]: connecting to the database, choosing the facility, the output folder and the queuing system, saving projects.&lt;br /&gt;
* [[cctbx.xfel GUI/Runs tab|Runs tab]]: the list of runs and their sample tags; image averaging.&lt;br /&gt;
* [[cctbx.xfel GUI/Energy tab|Energy tab]]: FEE spectrometer and ebeam energy calibration (LCLS only).&lt;br /&gt;
* [[cctbx.xfel GUI/Trials tab|Trials tab]]: processing parameters (trials) and which runs they apply to (run blocks).&lt;br /&gt;
* [[cctbx.xfel GUI/Jobs tab|Jobs tab]]: every submitted job and its status; stopping, deleting and restarting jobs.&lt;br /&gt;
* [[cctbx.xfel GUI/Run Stats tab|Run Stats tab]]: live hit rate, indexing rate and resolution plots.&lt;br /&gt;
* [[cctbx.xfel GUI/Unit Cell tab|Unit Cell tab]]: unit cell histograms and clustering.&lt;br /&gt;
* [[cctbx.xfel GUI/Datasets tab|Datasets tab]]: the post-processing pipeline (ensemble refinement, scaling, merging, Phenix).&lt;br /&gt;
* [[cctbx.xfel GUI/Merging Stats tab|Merging Stats tab]]: merging statistics and cosym embedding plots per dataset version.&lt;br /&gt;
* [[cctbx.xfel GUI/Workflows|Workflows]]: step-by-step recipes for common tasks.&lt;br /&gt;
* [[cctbx.xfel GUI/Troubleshooting|Troubleshooting]]: what the red lights mean, where the logs are, and common problems.&lt;br /&gt;
&lt;br /&gt;
== How the GUI works ==&lt;br /&gt;
&lt;br /&gt;
=== Everything lives in a database ===&lt;br /&gt;
The GUI keeps its state in a MySQL database rather than in files. Runs, tags, trials, run blocks, jobs, datasets and the per-image results of processing (spots found, unit cells, resolution, and so on) are all database rows. This has two consequences worth knowing from the start:&lt;br /&gt;
&lt;br /&gt;
* Several copies of the GUI can be connected to the same experiment at once, for example one submitting jobs at the beamline and one just watching the statistics from an office. See &#039;&#039;Monitoring mode&#039;&#039; below.&lt;br /&gt;
* Closing and reopening the GUI loses nothing. Every trial and job is still there when you reconnect.&lt;br /&gt;
&lt;br /&gt;
All tables for one experiment share a prefix called the &#039;&#039;&#039;experiment tag&#039;&#039;&#039; (for example &amp;lt;code&amp;gt;cxi12345_v1&amp;lt;/code&amp;gt;). Changing the experiment tag is effectively starting a fresh, empty experiment in the same database. The tag and the connection settings are entered in the [[cctbx.xfel GUI/Settings|Settings dialog]] when the GUI starts, and cannot be changed without restarting.&lt;br /&gt;
&lt;br /&gt;
The processing jobs themselves write their results to the &#039;&#039;&#039;output folder&#039;&#039;&#039; on disk (see &#039;&#039;Where the results go&#039;&#039; below) and log summaries of each image back to the database as they run. The GUI&#039;s plots are drawn from those database records.&lt;br /&gt;
&lt;br /&gt;
=== Runs and tags ===&lt;br /&gt;
A &#039;&#039;&#039;run&#039;&#039;&#039; is the unit of data collection: at LCLS it is an XTC run number; in standalone mode it is a file or folder of images (see [[cctbx.xfel GUI/Settings#Standalone options|Standalone options]]). The &#039;&#039;&#039;run sentinel&#039;&#039;&#039; polls for new runs and adds them to the database.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tags&#039;&#039;&#039; are free-form labels attached to runs, typically sample names or conditions (&amp;lt;code&amp;gt;lysozyme&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;dark&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;pump_on&amp;lt;/code&amp;gt;, ...). A run can carry any number of tags. Tags are what the later stages use to select data: the Run Stats, Unit Cell and Datasets pages all select runs by tag, so tagging runs consistently as they arrive is the single most useful habit when running the GUI live. The [[cctbx.xfel GUI/Runs tab|Runs tab]] is where tags are created and applied, and &#039;&#039;&#039;persistent tags&#039;&#039;&#039; can be applied automatically to every new run.&lt;br /&gt;
&lt;br /&gt;
=== Trials and run blocks ===&lt;br /&gt;
A &#039;&#039;&#039;trial&#039;&#039;&#039; is a set of processing parameters: spot finding, indexing and integration settings for &amp;lt;code&amp;gt;cctbx.xfel.process&amp;lt;/code&amp;gt; (or whichever back end is configured). Trials are numbered, and a new trial starts as a copy of the previous one so that tuning parameters is a matter of changing a few values and creating a new trial. Trials are never edited after creation (except for their comment); to change parameters, create a new trial. This keeps the provenance of every result unambiguous: results are stored under the trial number that produced them.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;run block&#039;&#039;&#039; (also called a rungroup, and labelled &amp;lt;code&amp;gt;rg&amp;lt;/code&amp;gt; in paths and job listings) is a contiguous range of runs together with the detector and beam settings that apply to them: detector address, beam centre and distance, binning, energy override, reference geometry, pixel mask and so on. A run block can be &#039;&#039;open&#039;&#039; (new runs are added to it automatically as they arrive) or have an explicit end run. Run blocks belong to trials, and the same run block can be shared by several trials.&lt;br /&gt;
&lt;br /&gt;
The GUI submits one processing job for every combination of &#039;&#039;active trial&#039;&#039; × &#039;&#039;run block in that trial&#039;&#039; × &#039;&#039;run in that block&#039;&#039;. Marking a trial active is therefore what starts processing, and deactivating it stops new jobs from being submitted (running jobs continue).&lt;br /&gt;
&lt;br /&gt;
=== Jobs and sentinels ===&lt;br /&gt;
&#039;&#039;&#039;Sentinels&#039;&#039;&#039; are background tasks inside the GUI that watch for new runs, finished jobs and new results. Each has a status light at the bottom of the window (see below). The two most important are toggled from the toolbar:&lt;br /&gt;
&lt;br /&gt;
* The &#039;&#039;&#039;run sentinel&#039;&#039;&#039; (&amp;quot;Watch for new runs&amp;quot;) looks for new runs every 10 seconds, adds them to the database, applies persistent tags, and extends open run blocks to include them.&lt;br /&gt;
* The &#039;&#039;&#039;job sentinel&#039;&#039;&#039; (&amp;quot;Auto-submit jobs&amp;quot;) looks every 10 seconds for work that has not been submitted yet: indexing jobs for active trials, and the pipeline stages of active datasets. It submits them using the multiprocessing settings from the Settings dialog (local, Slurm, LSF, ...).&lt;br /&gt;
&lt;br /&gt;
Because activating a trial or dataset, or saving a run block on an active trial, can commit the queue to a great deal of work, the GUI counts the jobs such an action would submit and asks for confirmation when the total reaches the &amp;lt;code&amp;gt;job_count_warning&amp;lt;/code&amp;gt; setting (50 by default). The message lists the count by stage.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;job monitor&#039;&#039;&#039; queries the queuing system for the status of every unfinished job. It runs while the Jobs or Run Stats tab is showing.&lt;br /&gt;
&lt;br /&gt;
The other sentinels (run stats, unit cell, merging stats, calibration worker) redraw the plots on their tabs and run only while that tab is showing.&lt;br /&gt;
&lt;br /&gt;
=== Datasets, tasks and versions ===&lt;br /&gt;
Indexing and integration produce one result per image. To get a merged reflection file a &#039;&#039;&#039;dataset&#039;&#039;&#039; is needed. A dataset selects runs (one trial, and a set of tags combined by &#039;&#039;intersection&#039;&#039; or &#039;&#039;union&#039;&#039;) and runs a pipeline of &#039;&#039;&#039;tasks&#039;&#039;&#039; over them:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Indexing&#039;&#039;&#039;: the trial&#039;s own integration results (nothing new is run).&lt;br /&gt;
# &#039;&#039;&#039;Ensemble refinement&#039;&#039;&#039; (optional): time-dependent ensemble refinement of detector geometry and crystal models, followed by reintegration, per run.&lt;br /&gt;
# &#039;&#039;&#039;Scaling&#039;&#039;&#039;: filters lattices (unit cell, correlation to a reference) and scales each run against a reference model, or prepares them for a reference-free merge.&lt;br /&gt;
# &#039;&#039;&#039;Merging&#039;&#039;&#039;: merges every scaled run into one MTZ file, with statistics.&lt;br /&gt;
# &#039;&#039;&#039;Phenix&#039;&#039;&#039; (optional): any Phenix command run on the merged MTZ.&lt;br /&gt;
&lt;br /&gt;
The first three are &#039;&#039;local&#039;&#039; tasks that run once per run and chain automatically: each starts when the previous task for that run has finished. Merging and Phenix are &#039;&#039;global&#039;&#039; tasks that run once over all finished runs. Each time merging runs it creates a new &#039;&#039;&#039;dataset version&#039;&#039;&#039; (&amp;lt;code&amp;gt;v000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;v001&amp;lt;/code&amp;gt;, ...). As more runs finish during an experiment, the job sentinel keeps rolling new versions, so the merged data set grows while data are still being collected; the dataset&#039;s &#039;&#039;merging schedule&#039;&#039; chooses between a version per pass, a version per run, or a single version once everything has finished. Changing the parameters of a merging or Phenix stage also rolls a new version from the same per-run results, and the versions made with the old settings are kept.&lt;br /&gt;
&lt;br /&gt;
Datasets that run the same stages with the same parameters share the work automatically, so a second dataset that merges the same runs with a different resolution limit reuses the ensemble refinement and scaling already done. See the [[cctbx.xfel GUI/Datasets tab|Datasets tab]].&lt;br /&gt;
&lt;br /&gt;
=== Projects (saved settings) ===&lt;br /&gt;
All of the settings entered in the Settings dialog (database connection, experiment tag, facility, output folder, queuing) are saved together as a &#039;&#039;&#039;project&#039;&#039;&#039; in &amp;lt;code&amp;gt;~/.cctbx.xfel/settings_&amp;lt;name&amp;gt;.phil&amp;lt;/code&amp;gt;. The GUI starts with the most recently used project, and the Settings dialog can load or save projects by name, so switching between experiments is a matter of loading a different project. The environment variable &amp;lt;code&amp;gt;CCTBX_XFEL_SETTINGS&amp;lt;/code&amp;gt; can point at an explicit settings file instead.&lt;br /&gt;
&lt;br /&gt;
== The main window ==&lt;br /&gt;
&lt;br /&gt;
=== Toolbar ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Button !! What it does&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Quit&#039;&#039;&#039; || Stops all sentinels, saves the settings and closes the GUI. Jobs already submitted keep running.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Watch for new runs&#039;&#039;&#039; || Starts or stops the run sentinel. The icon changes to a pause symbol while it is running and the &#039;&#039;Run Sentinel&#039;&#039; light turns green.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039; || Starts or stops the job sentinel. While it runs, every active trial and dataset gets its jobs submitted automatically. The &#039;&#039;Job Sentinel&#039;&#039; light turns green.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Settings&#039;&#039;&#039; || Opens the [[cctbx.xfel GUI/Settings|Settings dialog]]. The database connection and experiment tag are locked while the GUI is connected; everything else (output folder, queue, number of processors, facility options) can be changed and takes effect for jobs submitted afterwards.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Large text&#039;&#039;&#039; || Toggles larger text and markers in the Run Stats and Unit Cell plots, for reading from across a control room. Takes effect on the next redraw.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Help&#039;&#039;&#039; || Opens this documentation in the default web browser, at the page for the tab currently showing. Also available from the &#039;&#039;Help&#039;&#039; menu as &#039;&#039;Online help&#039;&#039;. The Settings dialog has a Help button of its own.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Watch for new runs&#039;&#039;, &#039;&#039;Auto-submit jobs&#039;&#039; and &#039;&#039;Settings&#039;&#039; buttons are hidden in monitoring mode.&lt;br /&gt;
&lt;br /&gt;
=== Tabs ===&lt;br /&gt;
The tabs, from left to right: [[cctbx.xfel GUI/Runs tab|Runs]], [[cctbx.xfel GUI/Energy tab|Energy]] (LCLS only), [[cctbx.xfel GUI/Trials tab|Trials]], [[cctbx.xfel GUI/Jobs tab|Jobs]], [[cctbx.xfel GUI/Run Stats tab|Run Stats]], [[cctbx.xfel GUI/Unit Cell tab|Unit Cell]], [[cctbx.xfel GUI/Datasets tab|Datasets]] and [[cctbx.xfel GUI/Merging Stats tab|Merging stats]]. They follow the order of a typical experiment: tag the runs, set up a trial, watch the jobs and the statistics, build a dataset, and watch the merging statistics.&lt;br /&gt;
&lt;br /&gt;
=== Status lights ===&lt;br /&gt;
A row of lights along the bottom of the window shows the state of each background task.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Colour !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| grey (off) || Not running.&lt;br /&gt;
|-&lt;br /&gt;
| green (on) || Running, waiting for its next cycle.&lt;br /&gt;
|-&lt;br /&gt;
| yellow || Busy (querying the database or the queue, or redrawing a plot).&lt;br /&gt;
|-&lt;br /&gt;
| red (alert) || It hit an error and has stopped. The error is printed in the terminal the GUI was started from. See [[cctbx.xfel GUI/Troubleshooting|Troubleshooting]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Light !! What it does !! Runs when&lt;br /&gt;
|-&lt;br /&gt;
| Run Sentinel || Finds new runs || &#039;&#039;Watch for new runs&#039;&#039; is on&lt;br /&gt;
|-&lt;br /&gt;
| Calib Worker || Runs FEE and ebeam calibrations (absent when there is no Energy tab) || The Energy tab is showing&lt;br /&gt;
|-&lt;br /&gt;
| Job Sentinel || Submits jobs || &#039;&#039;Auto-submit jobs&#039;&#039; is on&lt;br /&gt;
|-&lt;br /&gt;
| Job Monitor || Tracks job status in the queue || The Jobs or Run Stats tab is showing&lt;br /&gt;
|-&lt;br /&gt;
| Run Stats Sentinel || Redraws the Run Stats plot (every 5 s) || The Run Stats tab is showing and &#039;&#039;Auto update&#039;&#039; is ticked&lt;br /&gt;
|-&lt;br /&gt;
| Unit Cell Sentinel || Redraws the unit cell plot (every 15 s) || The Unit Cell tab is showing and &#039;&#039;Auto update&#039;&#039; is ticked&lt;br /&gt;
|-&lt;br /&gt;
| Merging Stats Sentinel || Redraws the merging statistics and the drift plot (every 5 s) || The Merging stats tab is showing and &#039;&#039;Auto update&#039;&#039; is ticked&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Monitoring mode ===&lt;br /&gt;
Starting the GUI with &amp;lt;code&amp;gt;monitoring_mode=True&amp;lt;/code&amp;gt; (in the settings file or on the command line) gives a read-only view of an experiment: the Runs, Trials, Jobs and Datasets tabs and the submit buttons are hidden, leaving the Run Stats, Unit Cell and Merging stats tabs. Use it for a second copy of the GUI connected to the same database, so that only one copy submits jobs.&lt;br /&gt;
&lt;br /&gt;
== Where the results go ==&lt;br /&gt;
Everything written by jobs goes under the &#039;&#039;output folder&#039;&#039; chosen in the Settings dialog.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Path !! Contents&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;r0012/003_rg005/&amp;lt;/code&amp;gt; || Indexing and integration results for run 12, trial 3, run block 5. Inside: &amp;lt;code&amp;gt;out/&amp;lt;/code&amp;gt; holds the integrated experiments and reflections (&amp;lt;code&amp;gt;*_integrated.expt&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;*_integrated.refl&amp;lt;/code&amp;gt;); &amp;lt;code&amp;gt;stdout/log.out&amp;lt;/code&amp;gt; is the job log; &amp;lt;code&amp;gt;all/&amp;lt;/code&amp;gt; holds every image converted to CBF when &#039;&#039;Dump all images&#039;&#039; is on (LCLS). In standalone mode with non-numeric run names the folder is named after the run instead of &amp;lt;code&amp;gt;r0012&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;r0012/003_rg005/task007/&amp;lt;/code&amp;gt; || Results of dataset task 7 (ensemble refinement or scaling) for that run, trial and block.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;&amp;lt;dataset name&amp;gt;/v001/&amp;lt;/code&amp;gt; || Merging output for version 1 of a dataset: the merged MTZ (&amp;lt;code&amp;gt;&amp;lt;name&amp;gt;_v001_all.mtz&amp;lt;/code&amp;gt;), the merging log, and the cosym embedding plots if cosym ran. Phenix tasks write here too.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;averages/&amp;lt;/code&amp;gt; || Average, maximum and standard deviation images from the Runs tab &#039;&#039;Average&#039;&#039; button.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cluster/&amp;lt;/code&amp;gt; || Unit cell cluster files written by the Unit Cell tab, for use by the scaling stage of a dataset.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MySql/&amp;lt;/code&amp;gt; || Data files of a locally started database server (default location).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The GUI&#039;s own files are in &amp;lt;code&amp;gt;~/.cctbx.xfel/&amp;lt;/code&amp;gt;: the project settings bundles and a &amp;lt;code&amp;gt;cfgs/&amp;lt;/code&amp;gt; folder holding the PHIL and locator files generated for every job.&lt;br /&gt;
&lt;br /&gt;
== Starting the GUI ==&lt;br /&gt;
&amp;lt;pre&amp;gt;cctbx.xfel&amp;lt;/pre&amp;gt;&lt;br /&gt;
opens the login (Settings) dialog followed by the main window. &amp;lt;code&amp;gt;cctbx.xfel -h&amp;lt;/code&amp;gt; prints every configuration parameter with its help text; any of them can be given on the command line, for example &amp;lt;code&amp;gt;cctbx.xfel monitoring_mode=True&amp;lt;/code&amp;gt;. The GUI prints progress and error messages to the terminal it was started from, so keep that terminal visible.&lt;br /&gt;
&lt;br /&gt;
Older documentation: [http://cci.lbl.gov/publications/download/CCN_2019_p22_Brewster.pdf Brewster et al. (2019), Computational Crystallography Newsletter 10, 22].&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Trials_tab&amp;diff=1818</id>
		<title>Cctbx.xfel GUI/Trials tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Trials_tab&amp;diff=1818"/>
		<updated>2026-11-02T19:27:41Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Trials tab}}&lt;br /&gt;
The &#039;&#039;&#039;Trials tab&#039;&#039;&#039; is where processing is set up. A &#039;&#039;&#039;trial&#039;&#039;&#039; is a numbered set of spot finding, indexing and integration parameters; each trial owns one or more &#039;&#039;&#039;run blocks&#039;&#039;&#039; that say which runs it applies to and how their images should be read. Making a trial &#039;&#039;active&#039;&#039; is what causes jobs to be submitted.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Layout ==&lt;br /&gt;
Each trial is a box labelled with its number and the start of its comment, laid out left to right (scroll horizontally when there are many). Inside each box:&lt;br /&gt;
&lt;br /&gt;
* A list of the trial&#039;s &#039;&#039;&#039;run blocks&#039;&#039;&#039;, one button each, labelled &amp;lt;code&amp;gt;[block id] runs first - last&amp;lt;/code&amp;gt;. An open block shows &amp;lt;code&amp;gt;...&amp;lt;/code&amp;gt; in place of the last run. Click a button to edit the block.&lt;br /&gt;
* &#039;&#039;&#039;New Block&#039;&#039;&#039;: create a run block for this trial (pre-filled from the trial&#039;s last block).&lt;br /&gt;
* &#039;&#039;&#039;Select Blocks&#039;&#039;&#039;: tick which of the run blocks from all trials belong to this trial. This is how a block created in one trial is reused by another. A block that no longer belongs to any trial becomes inactive. On an active trial the selection is processed at once, so the same job-count confirmation applies.&lt;br /&gt;
* The magnifying-glass button shows the trial&#039;s parameters. Everything is read-only except the comment.&lt;br /&gt;
* &#039;&#039;&#039;Active Trial&#039;&#039;&#039;: while ticked, the job sentinel submits an indexing job for every run in every one of this trial&#039;s blocks. Untick to stop submitting new jobs; jobs already running are not affected. If activating the trial would submit many jobs (the indexing jobs, plus whatever the active datasets on the trial would then run), the GUI shows the count by stage and asks before going ahead; the threshold is the &amp;lt;code&amp;gt;job_count_warning&amp;lt;/code&amp;gt; setting, 50 by default.&lt;br /&gt;
&lt;br /&gt;
Below the trials: &#039;&#039;&#039;Show Only Active Trials&#039;&#039;&#039; hides inactive trials, and &#039;&#039;&#039;New Trial&#039;&#039;&#039; opens the trial dialog.&lt;br /&gt;
&lt;br /&gt;
== Creating a trial ==&lt;br /&gt;
&#039;&#039;&#039;New Trial&#039;&#039;&#039; opens the &#039;&#039;New Trial Settings&#039;&#039; dialog. A new trial inherits the parameters and comment of the most recent trial, so you normally change a few values and press OK. Trials are created &#039;&#039;inactive&#039;&#039;; tick &#039;&#039;Active Trial&#039;&#039; when you are ready to process.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Control !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Trial number&#039;&#039;&#039; || Allocated automatically (one more than the highest existing trial).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Import PHIL&#039;&#039;&#039; || Load parameters from a PHIL file. The file is validated against the processing program; unknown parameters are reported and the import is rejected.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Edit PHIL&#039;&#039;&#039; || Open the full parameter set as text (only the values that differ from the program&#039;s defaults are shown). Anything the simplified controls do not cover is set here, for example masks, refinement options or integration settings. Changes are validated when you press OK in the editor and the simplified controls update to match.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Comment&#039;&#039;&#039; || Free text, shown in the trial box and in job listings. Say what you changed.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Overall parameters ===&lt;br /&gt;
* &#039;&#039;&#039;Find spots&#039;&#039;&#039;, &#039;&#039;&#039;Index&#039;&#039;&#039;, &#039;&#039;&#039;Integrate&#039;&#039;&#039;: which stages to run. Untick &#039;&#039;Index&#039;&#039; and &#039;&#039;Integrate&#039;&#039; for a quick hit-finding pass, or to tune spot finding on the Run Stats tab before indexing.&lt;br /&gt;
* &#039;&#039;&#039;Min spots&#039;&#039;&#039;: the minimum number of strong spots an image needs before indexing is attempted (the hit finder threshold). Images below it are logged as non-hits and skipped.&lt;br /&gt;
&lt;br /&gt;
=== Spotfinding parameters ===&lt;br /&gt;
These map onto the DIALS spot finder:&lt;br /&gt;
* &#039;&#039;&#039;Min spot size&#039;&#039;&#039; / &#039;&#039;&#039;Max spot size&#039;&#039;&#039;: pixel count limits for a spot. The minimum removes single-pixel noise; the maximum removes ice rings and bad regions.&lt;br /&gt;
* &#039;&#039;&#039;Sigma background&#039;&#039;&#039; / &#039;&#039;&#039;Sigma strong&#039;&#039;&#039;: the dispersion algorithm&#039;s thresholds, in units of the local background standard deviation. Lower &#039;&#039;sigma strong&#039;&#039; finds weaker spots.&lt;br /&gt;
* &#039;&#039;&#039;Global threshold&#039;&#039;&#039;: absolute pixel value below which nothing counts as signal.&lt;br /&gt;
* &#039;&#039;&#039;Gain&#039;&#039;&#039;: detector gain in ADU per photon. Leave blank to use the value reported by the image format. When integration is on, the same gain is also used to scale the integrated intensity variances.&lt;br /&gt;
* &#039;&#039;&#039;Kernel size&#039;&#039;&#039;: size of the local background window in pixels (two numbers).&lt;br /&gt;
* &#039;&#039;&#039;Threshold algorithm&#039;&#039;&#039;: &#039;&#039;dispersion&#039;&#039; (standard), &#039;&#039;dispersion_extended&#039;&#039; (more sensitive at low resolution) or &#039;&#039;radial_profile&#039;&#039; (radial background subtraction).&lt;br /&gt;
&lt;br /&gt;
=== Indexing parameters ===&lt;br /&gt;
* &#039;&#039;&#039;Unit cell&#039;&#039;&#039; and &#039;&#039;&#039;Space group&#039;&#039;&#039;: the known symmetry, if any. Giving both makes indexing much more reliable; the pair is checked for compatibility.&lt;br /&gt;
* &#039;&#039;&#039;d_min indexing&#039;&#039;&#039;: high-resolution cut-off used during indexing refinement.&lt;br /&gt;
* &#039;&#039;&#039;Max lattices&#039;&#039;&#039;: more than 1 enables multi-lattice indexing of the same image.&lt;br /&gt;
* &#039;&#039;&#039;Reflection subsampling&#039;&#039;&#039;: index on a random subset of the strong spots, which can help with very dense patterns.&lt;br /&gt;
&lt;br /&gt;
=== Other options ===&lt;br /&gt;
* &#039;&#039;&#039;Copy runblocks from&#039;&#039;&#039;: give the new trial the same run blocks as an existing trial, so that a parameter change can be tried on exactly the same runs.&lt;br /&gt;
* &#039;&#039;&#039;Percent events processed&#039;&#039;&#039;: process only this percentage of the images in each run (a throttle for a quick look at a large run).&lt;br /&gt;
* &#039;&#039;&#039;Number of bins&#039;&#039;&#039; and &#039;&#039;&#039;High res. limit&#039;&#039;&#039;: used for logging resolution statistics to the database.&lt;br /&gt;
&lt;br /&gt;
== Run blocks ==&lt;br /&gt;
A run block groups a contiguous range of runs with the detector settings needed to read them. &#039;&#039;&#039;New Block&#039;&#039;&#039; and clicking an existing block open the &#039;&#039;Run Block Settings&#039;&#039; dialog.&lt;br /&gt;
&lt;br /&gt;
=== Run range ===&lt;br /&gt;
* &#039;&#039;&#039;Start run&#039;&#039;&#039;: the first run in the block.&lt;br /&gt;
* &#039;&#039;&#039;Auto add runs&#039;&#039;&#039;: the block has no end; every new run the run sentinel finds is added to it. Use this while collecting data.&lt;br /&gt;
* &#039;&#039;&#039;Specify end run&#039;&#039;&#039; / &#039;&#039;&#039;End run&#039;&#039;&#039;: a closed range.&lt;br /&gt;
&lt;br /&gt;
In standalone mode the start and end are database ids (order of discovery) rather than run numbers, since run names there need not be numeric.&lt;br /&gt;
&lt;br /&gt;
=== Run block settings ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Setting !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Extra XTC format parameters&#039;&#039;&#039; (LCLS) || PHIL text passed to the XTC image format, for example a locator override. &#039;&#039;&#039;Import PHIL&#039;&#039;&#039; loads it from a file.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Detector&#039;&#039;&#039; (LCLS) || The detector&#039;s address in the XTC stream. The drop-down offers the psana aliases &#039;&#039;Jungfrau&#039;&#039;, &#039;&#039;Rayonix&#039;&#039;, &#039;&#039;ePix&#039;&#039; and &#039;&#039;CSPAD&#039;&#039;, each of which selects the matching image format; any other address can be typed (use the &amp;lt;code&amp;gt;detnames&amp;lt;/code&amp;gt; tool at LCLS to list them), and an address that names none of those detectors asks for confirmation on OK, since no format would read it.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Beam X, Y, DetZ&#039;&#039;&#039; (LCLS) || Beam centre in pixels and detector distance in mm. Required for Rayonix detectors even when a reference geometry is given (the reference geometry then takes precedence).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Overrides: Rayonix binning, Energy (eV)&#039;&#039;&#039; (LCLS) || Rayonix binning (2, 3, 4, ...), and a fixed photon energy in eV applied to every image in place of the per-shot values. Leave the energy blank to use the measured energies.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Energy override&#039;&#039;&#039; (standalone) || The same fixed photon energy for other facilities.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Wavelength: Offset (Å)&#039;&#039;&#039; (LCLS) || Offset added to each image&#039;s wavelength, from the [[cctbx.xfel GUI/Energy tab|Energy tab]] ebeam comparison.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Spectrum: eV per pixel, eV offset&#039;&#039;&#039; (LCLS) || FEE spectrometer calibration. &#039;&#039;&#039;Use Energy tab calibration&#039;&#039;&#039; fills these (and the wavelength offset, when the ebeam comparison has run) from the Energy tab&#039;s current results; &#039;&#039;&#039;Load calibration file...&#039;&#039;&#039; fills them from a file saved there with &#039;&#039;Save calibration&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Solvent finder: Low 2θ, High 2θ (deg)&#039;&#039;&#039; || Two scattering angles in degrees. The ratio of the radial average at the high angle to that at the low angle is used by the Run Stats tab to count &#039;&#039;solvent hits&#039;&#039; (the defaults are a kapton ring and the water ring).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Untrusted Pixel Mask&#039;&#039;&#039; || A DIALS mask file (&amp;lt;code&amp;gt;.mask&amp;lt;/code&amp;gt;) of pixels to ignore.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Reference geometry&#039;&#039;&#039; || An experiment file (&amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;) whose detector geometry replaces the one from the image headers, typically from a geometry refinement.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Comment&#039;&#039;&#039; || Free text.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Edit PHIL&#039;&#039;&#039; || Any other processing parameter that should apply only to this block (the reference geometry is stored this way, as &amp;lt;code&amp;gt;input.reference_geometry&amp;lt;/code&amp;gt;). Block parameters are combined with the trial&#039;s parameters when a job is submitted.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Editing an existing block ===&lt;br /&gt;
Results on disk are stored by trial and block id, so a block&#039;s settings must not change under results already produced. When you press OK on an existing block:&lt;br /&gt;
* if only the end run, the open/closed state or the comment changed, the block is updated in place;&lt;br /&gt;
* if anything else changed, the old block is made inactive and a &#039;&#039;&#039;new block&#039;&#039;&#039; with a new id is created and attached to the trial. Jobs for the new block are submitted afresh; the old results stay where they were.&lt;br /&gt;
&lt;br /&gt;
Saving a new or changed block on an &#039;&#039;&#039;active&#039;&#039;&#039; trial starts processing its runs immediately (and a replaced block reprocesses every run it covers), so when that means many jobs the GUI shows the count and asks first.&lt;br /&gt;
&lt;br /&gt;
== What happens next ==&lt;br /&gt;
With a trial active, run blocks attached and &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039; on, the job sentinel submits one job per run in each block, each writing to &amp;lt;code&amp;gt;r&amp;lt;run&amp;gt;/&amp;lt;trial&amp;gt;_rg&amp;lt;block&amp;gt;/&amp;lt;/code&amp;gt; in the output folder. Watch them in the [[cctbx.xfel GUI/Jobs tab|Jobs tab]] and the results in the [[cctbx.xfel GUI/Run Stats tab|Run Stats tab]]. Multiple trials can be active at once, for example to compare two parameter sets on the same runs.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Unit_Cell_tab&amp;diff=1817</id>
		<title>Cctbx.xfel GUI/Unit Cell tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Unit_Cell_tab&amp;diff=1817"/>
		<updated>2026-11-02T19:26:16Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Unit Cell tab}}&lt;br /&gt;
The &#039;&#039;&#039;Unit Cell tab&#039;&#039;&#039; plots histograms of the unit cell parameters of every indexed lattice in a trial, so that you can check that indexing is finding the expected cell, compare samples or conditions, spot polymorphs, and define unit cell clusters for the scaling stage of a dataset to filter on. The plot is redrawn every 15 seconds by the &#039;&#039;Unit Cell Sentinel&#039;&#039; while &#039;&#039;Auto update&#039;&#039; is ticked.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Selecting lattices by tag ==&lt;br /&gt;
The tab compares &#039;&#039;&#039;tag sets&#039;&#039;&#039;. Each tag set is a selection of runs from one trial, and each gets its own colour in the histograms.&lt;br /&gt;
&lt;br /&gt;
# Choose the &#039;&#039;&#039;Trial&#039;&#039;&#039;. The &#039;&#039;Available tags&#039;&#039; list fills with the tags carried by that trial&#039;s runs.&lt;br /&gt;
# Tick one or more tags and choose &#039;&#039;&#039;union&#039;&#039;&#039; (runs carrying any of the tags) or &#039;&#039;&#039;intersection&#039;&#039;&#039; (runs carrying all of them). Ticking no tags selects every run in the trial (the set then shows as a blank entry in the list).&lt;br /&gt;
# Press &#039;&#039;&#039;Add selection&#039;&#039;&#039;. The set appears in &#039;&#039;Tag sets to display&#039;&#039;, named after its tags with &#039;&#039;(u)&#039;&#039; or &#039;&#039;(i)&#039;&#039; for the mode when there is more than one tag.&lt;br /&gt;
# Repeat for further sets, for example one per sample. To drop a set, tick it and press &#039;&#039;&#039;Remove selection&#039;&#039;&#039;; &#039;&#039;&#039;Reset selections&#039;&#039;&#039; clears them all.&lt;br /&gt;
&lt;br /&gt;
== Histogram mode ==&lt;br /&gt;
With &#039;&#039;Plot clusters&#039;&#039; unticked, the plot shows a histogram for each of a, b, c, α, β and γ for each tag set, with the legend giving the number of lattices and the mean and standard deviation of each parameter.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Reject outliers&#039;&#039;&#039;: drop lattices whose parameters fall outside 1.5 times the inter-quartile range before plotting, so that a few mis-indexed images do not stretch the axes.&lt;br /&gt;
* The matplotlib toolbar zooms and saves the figure, and &#039;&#039;Large text&#039;&#039; on the toolbar enlarges the labels.&lt;br /&gt;
&lt;br /&gt;
== Cluster mode ==&lt;br /&gt;
With &#039;&#039;Plot clusters&#039;&#039; ticked (available only when the &amp;lt;code&amp;gt;uc_metrics&amp;lt;/code&amp;gt; package is installed), the lattices of the &#039;&#039;&#039;first&#039;&#039;&#039; tag set are clustered with DBSCAN in the space of a chosen set of cell parameters, the &#039;&#039;&#039;feature vector&#039;&#039;&#039;. The plot shows the clusters projected onto each pair of features, a report of the clusters along the bottom, and beside the projections either a probability plot or a volume histogram (see the options below). Its title names the features used.&lt;br /&gt;
&lt;br /&gt;
The trial&#039;s space group decides which parameters are free to vary: by default the clustering uses a, b, c for orthorhombic and lower symmetry, a, c for tetragonal, hexagonal and rhombohedral on hexagonal axes, and a, α on rhombohedral axes. Cubic cells have only one free parameter and cannot be clustered. The space group comes from the trial&#039;s indexing parameters, so set one in the trial. The features return to these defaults whenever a trial with a different space group is selected.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;Reject outliers&#039;&#039; controls whether the cells the clustering left unassigned are drawn, and whether they set the range of the volume histogram.&lt;br /&gt;
&lt;br /&gt;
=== Cluster options ===&lt;br /&gt;
&#039;&#039;&#039;Options...&#039;&#039;&#039; next to &#039;&#039;Plot clusters&#039;&#039; opens the &#039;&#039;Cluster options&#039;&#039; dialog:&lt;br /&gt;
* &#039;&#039;&#039;Cluster epsilon&#039;&#039;&#039; (default 0.8): the DBSCAN neighbourhood distance. Smaller values give tighter, more numerous clusters.&lt;br /&gt;
* &#039;&#039;&#039;Feature vector&#039;&#039;&#039;: tick boxes for a, b, c, α, β and γ. Parameters the space group fixes are greyed out; at least two must be ticked. Add an angle when two populations differ mainly in it, for example two monoclinic forms with different β.&lt;br /&gt;
* &#039;&#039;&#039;Plot all pairs of features&#039;&#039;&#039;: with more than three features, draw a corner plot of every pair. Otherwise the plot shows the first three features only, and says so in its title.&lt;br /&gt;
* &#039;&#039;&#039;Beside the projections&#039;&#039;&#039;: a &#039;&#039;Probability plot&#039;&#039; of each cluster&#039;s Mahalanobis distances against a normal distribution (a straight line means a well-formed cluster), or a &#039;&#039;Cell volume histogram&#039;&#039; with one step per cluster in the cluster&#039;s colour, which is the quickest way to see how the clusters differ in size.&lt;br /&gt;
&lt;br /&gt;
Each clustering writes a covariance file, &amp;lt;code&amp;gt;cluster/cluster_&amp;lt;tag set name&amp;gt;.pickle&amp;lt;/code&amp;gt; in the output folder, describing the Gaussian mixture components found (component 0 is the largest). The &#039;&#039;&#039;scaling stage&#039;&#039;&#039; of a dataset can filter lattices with this file (&#039;&#039;Filter by unit-cell cluster&#039;&#039; in the [[cctbx.xfel GUI/Datasets tab#Scaling|Datasets tab]]), accepting only lattices within a chosen Mahalanobis distance of a chosen component. This is the way to merge only one polymorph when a sample indexes as a mixture.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
* A multi-modal histogram for a single sample usually means a mixture of crystal forms, or an indexing ambiguity producing permuted axes. Try cluster mode, or tighten the unit cell in the trial.&lt;br /&gt;
* Compare samples by adding one tag set per sample tag: differences in mean cell between conditions show up directly.&lt;br /&gt;
* Large trials can take a while to redraw; untick &#039;&#039;Auto update&#039;&#039; once the plot is as you want it.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Datasets_tab&amp;diff=1816</id>
		<title>Cctbx.xfel GUI/Datasets tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Datasets_tab&amp;diff=1816"/>
		<updated>2026-11-02T19:25:41Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Datasets tab}}&lt;br /&gt;
The &#039;&#039;&#039;Datasets tab&#039;&#039;&#039; takes processed runs through to a merged reflection file. A &#039;&#039;&#039;dataset&#039;&#039;&#039; selects runs from a trial by tag and runs a pipeline of tasks over them: optional ensemble refinement, scaling, merging, and optionally Phenix. Each merge creates a new &#039;&#039;&#039;version&#039;&#039;&#039; of the dataset, and new versions keep appearing as further runs finish, so merged data are available while collection is still going on.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Layout ==&lt;br /&gt;
Each dataset is a box labelled with its id and name, laid out left to right. Inside it:&lt;br /&gt;
* the comment,&lt;br /&gt;
* &#039;&#039;&#039;Tags&#039;&#039;&#039;: the tags that select its runs,&lt;br /&gt;
* &#039;&#039;&#039;Trial&#039;&#039;&#039;: the trial whose results it uses,&lt;br /&gt;
* the merging schedule, when it is not the default (see below),&lt;br /&gt;
* the numbered pipeline stages, with the resolution limit and reference model name for the scaling and merging stages.&lt;br /&gt;
* &#039;&#039;&#039;Latest: vNNN&#039;&#039;&#039;: the most recent version merged.&lt;br /&gt;
* The magnifying-glass button opens the full [[#The dataset dialog|dataset dialog]] to edit the dataset.&lt;br /&gt;
* The copy button &#039;&#039;&#039;duplicates&#039;&#039;&#039; the dataset: an inactive copy under a new name with the same pipeline, tags, merging schedule and comment. Use it to merge the same runs with a different resolution limit or reference: open the copy, change what you want, and activate it. Whatever stages are unchanged reuse the original&#039;s jobs (see [[#Tasks shared between datasets|Tasks shared between datasets]]).&lt;br /&gt;
* &#039;&#039;&#039;Active Dataset&#039;&#039;&#039;: while ticked, the job sentinel submits the dataset&#039;s jobs. New datasets start inactive. If activating the dataset would submit many jobs, the GUI shows the count by stage and asks before going ahead; the threshold is the &amp;lt;code&amp;gt;job_count_warning&amp;lt;/code&amp;gt; setting, 50 by default.&lt;br /&gt;
&lt;br /&gt;
Below: &#039;&#039;&#039;Filter&#039;&#039;&#039; narrows the list to names containing the text, &#039;&#039;&#039;Show Only Active Datasets&#039;&#039;&#039; hides inactive ones, and &#039;&#039;&#039;New Dataset&#039;&#039;&#039; opens the wizard.&lt;br /&gt;
&lt;br /&gt;
== How a dataset runs ==&lt;br /&gt;
With the dataset active and &#039;&#039;Auto-submit jobs&#039;&#039; on, the job sentinel does the following on every cycle:&lt;br /&gt;
# It finds the dataset&#039;s runs: the runs in the trial&#039;s run blocks that carry the dataset&#039;s tags, combined by the tag operator (&#039;&#039;intersection&#039;&#039;: all of the tags; &#039;&#039;union&#039;&#039;: any of them). A dataset must have at least one tag, and every one of its tags must be in use on the trial&#039;s runs, otherwise it is skipped.&lt;br /&gt;
# For each run it submits the next &#039;&#039;local&#039;&#039; task (ensemble refinement, then scaling) as soon as the previous one has finished with status &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;. Indexing is the trial&#039;s own integration job, so it must be &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt; for the run to enter the pipeline.&lt;br /&gt;
# Once runs have finished every local task, it creates a new dataset version, links those runs&#039; jobs to it, and submits the &#039;&#039;global&#039;&#039; tasks (merging, then Phenix) for that version. When that happens is the dataset&#039;s &#039;&#039;&#039;merging schedule&#039;&#039;&#039; (below). Re-tagging a run out of the dataset also triggers a corrective version, and so does changing the parameters of a merging or Phenix stage: the versions merged with the old settings are kept as they are, and the new settings get a version of their own from the same per-run results.&lt;br /&gt;
&lt;br /&gt;
=== Merging schedule ===&lt;br /&gt;
The &#039;&#039;Merging&#039;&#039; choice in the dataset dialog (&#039;&#039;Merging schedule&#039;&#039; in the wizard) decides when a new version is cut as runs finish:&lt;br /&gt;
* &#039;&#039;&#039;Merge as runs finish&#039;&#039;&#039; (the default): whenever the GUI checks for finished runs, everything that has finished since the last version goes into one new version. Versions grow in uneven steps, as fast as the queue delivers.&lt;br /&gt;
* &#039;&#039;&#039;Merge after every run&#039;&#039;&#039;: one new version per finished run, in the dataset&#039;s run order, each adding that run to the previous version. This gives the [[cctbx.xfel GUI/Merging Stats tab|Merging Stats tab]] a version per run, so the statistics can be followed improving run by run; it costs a merging job per run.&lt;br /&gt;
* &#039;&#039;&#039;Merge once all runs finish&#039;&#039;&#039;: a single version once no run of the dataset has a local job queued, running or still to submit. A run whose chain failed does not hold it up.&lt;br /&gt;
&lt;br /&gt;
A correction (a run tagged out, or a global stage edited) is always a single version of the runs already merged that are still selected; under &#039;&#039;Merge after every run&#039;&#039; any newly finished runs then follow one version each. Changing the schedule of an existing dataset takes effect from then on; nothing is merged again retrospectively.&lt;br /&gt;
&lt;br /&gt;
Versions are numbered from &amp;lt;code&amp;gt;v000&amp;lt;/code&amp;gt; and their output is in &amp;lt;code&amp;gt;&amp;lt;output folder&amp;gt;/&amp;lt;dataset name&amp;gt;/v&amp;lt;NNN&amp;gt;/&amp;lt;/code&amp;gt;; the merged file is &amp;lt;code&amp;gt;&amp;lt;name&amp;gt;_v&amp;lt;NNN&amp;gt;_all.mtz&amp;lt;/code&amp;gt;. Watch the statistics of each version on the [[cctbx.xfel GUI/Merging Stats tab|Merging Stats tab]].&lt;br /&gt;
&lt;br /&gt;
== The new dataset wizard ==&lt;br /&gt;
&#039;&#039;&#039;New Dataset&#039;&#039;&#039; opens a three-step wizard that covers the usual case. Everything it sets can be changed afterwards in the full dialog.&lt;br /&gt;
&lt;br /&gt;
; Step 1, Trial &amp;amp; tags&lt;br /&gt;
: &#039;&#039;&#039;Name&#039;&#039;&#039; (must be unique), the &#039;&#039;&#039;Trial&#039;&#039;&#039; to merge, the &#039;&#039;&#039;Tags&#039;&#039;&#039; selecting its runs and the &#039;&#039;&#039;Tag operator&#039;&#039;&#039;. A line below the controls reports how many of the trial&#039;s runs the selection picks, counted exactly as job submission will count them, for example &#039;&#039;Runs selected: 37 of 52 in trial 12 (intersection of 2 tags)&#039;&#039;. &#039;&#039;None&#039;&#039; means the dataset would run with no data: no tag is ticked, or a ticked tag is not used by any run of that trial.&lt;br /&gt;
; Step 2, Structure&lt;br /&gt;
: &#039;&#039;&#039;Known reference model&#039;&#039;&#039;: give a &#039;&#039;&#039;Reference model&#039;&#039;&#039; file (MTZ or PDB) to scale and post-refine the data against. &#039;&#039;&#039;Unknown structure&#039;&#039;&#039;: give the &#039;&#039;&#039;Unit cell&#039;&#039;&#039; and &#039;&#039;&#039;Space group&#039;&#039;&#039; instead (pre-filled from the trial). With no reference the data are merged as a plain average (a &#039;&#039;mark1&#039;&#039; merge, with no per-image scaling or post-refinement); the resulting MTZ can then serve as the reference model for a second dataset. On leaving this page with a reference model, the wizard compares the model&#039;s symmetry with the trial&#039;s indexing symmetry the way the merge&#039;s unit cell filter will (same Laue group, cells within 10% and 2°). A trial with no known space group, a different Laue group or a cell too far from the model&#039;s would have every image rejected, so the wizard says so and asks whether to continue. It is a warning, not a refusal: it reads the trial&#039;s indexing parameters, and you may know better.&lt;br /&gt;
; Step 3, Options&lt;br /&gt;
: &#039;&#039;&#039;Merging schedule&#039;&#039;&#039; (see [[#Merging schedule|Merging schedule]]). &#039;&#039;&#039;Include ensemble refinement&#039;&#039;&#039; (on by default). &#039;&#039;&#039;Resolve indexing ambiguity (cosym)&#039;&#039;&#039;: ticked automatically when the trial&#039;s symmetry has an indexing ambiguity; the label says how many indexing modes exist and how far the cell is from the higher lattice symmetry that causes them (an exact match means the ambiguity is certain, a degree or two means it is inferred and may or may not be real). &#039;&#039;&#039;Lattice tolerance&#039;&#039;&#039; (5° by default, the value cosym itself uses) is how far the cell may be from a higher lattice symmetry for that symmetry, and the indexing modes it implies, to count; a pseudo-symmetric cell can pick up spurious modes at a loose tolerance, so tighten it until the count matches what the data show. The label recounts the modes as the tolerance changes, and the value is passed to cosym so that it finds the same symmetry. &#039;&#039;&#039;High res. limit&#039;&#039;&#039; (d_min, 1.5 Å by default) and &#039;&#039;&#039;Number of bins&#039;&#039;&#039; for the statistics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Finish&#039;&#039;&#039; creates the dataset, inactive, with an indexing stage, optionally ensemble refinement, scaling and merging.&lt;br /&gt;
&lt;br /&gt;
== The dataset dialog ==&lt;br /&gt;
The magnifying-glass button opens the full &#039;&#039;Dataset Settings&#039;&#039; dialog.&lt;br /&gt;
&lt;br /&gt;
=== Identity and run selection ===&lt;br /&gt;
&#039;&#039;&#039;Name&#039;&#039;&#039;, &#039;&#039;&#039;Comment&#039;&#039;&#039;, &#039;&#039;&#039;Merging&#039;&#039;&#039; (the [[#Merging schedule|merging schedule]]), &#039;&#039;&#039;Trial&#039;&#039;&#039;, &#039;&#039;&#039;Tags&#039;&#039;&#039; and &#039;&#039;&#039;Tag operator&#039;&#039;&#039; as in the wizard. Changing the trial re-reads its unit cell, space group and integration parameters.&lt;br /&gt;
&lt;br /&gt;
=== Shared parameters (scaling + merging) ===&lt;br /&gt;
These apply to both the scaling and the merging stage so that they agree:&lt;br /&gt;
* &#039;&#039;&#039;Reference&#039;&#039;&#039;: &#039;&#039;Known reference model&#039;&#039; with a &#039;&#039;&#039;Reference model&#039;&#039;&#039; path, or &#039;&#039;No reference model&#039;&#039; with a &#039;&#039;&#039;Unit cell&#039;&#039;&#039; and &#039;&#039;&#039;Space group&#039;&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;High res. limit (d_min)&#039;&#039;&#039;: resolution cut-off for scaling and merging.&lt;br /&gt;
* &#039;&#039;&#039;Resolution scalar&#039;&#039;&#039; (0.96): multiplied by d_min to set the internal limit used when scaling, so that the edge bin is well populated.&lt;br /&gt;
* &#039;&#039;&#039;Number of bins&#039;&#039;&#039;: resolution shells in the statistics tables.&lt;br /&gt;
* &#039;&#039;&#039;Merge anomalous&#039;&#039;&#039;: ticked, Friedel mates are merged. Untick to keep the anomalous signal.&lt;br /&gt;
&lt;br /&gt;
=== Pipeline ===&lt;br /&gt;
Each stage is a box with an &#039;&#039;&#039;Include this stage&#039;&#039;&#039; tick box (except indexing, which is always there) and, for the stages that have parameters, an &#039;&#039;&#039;Edit PHIL&#039;&#039;&#039; button that opens the complete parameter set for that program with the simplified controls&#039; values filled in. Anything not covered by the controls, such as the step list, error model or outlier rejection, is set there.&lt;br /&gt;
&lt;br /&gt;
==== Indexing ====&lt;br /&gt;
Uses the trial&#039;s integration results. No settings.&lt;br /&gt;
&lt;br /&gt;
==== Ensemble refinement ====&lt;br /&gt;
Time-dependent ensemble refinement (&amp;lt;code&amp;gt;cctbx.xfel.time_varying_refinement&amp;lt;/code&amp;gt;): the detector geometry and the crystal models of a run are refined together against all of its images, then the images are reintegrated. It improves the agreement between images and so the merging statistics, at the cost of an extra job per run.&lt;br /&gt;
* &#039;&#039;&#039;Pre-split experiments&#039;&#039;&#039;: split the run into chunks locally before submitting, which gives better balanced chunks; otherwise the splitting happens on the cluster, which is faster but counts chunk sizes less accurately.&lt;br /&gt;
* &#039;&#039;&#039;Expand Nave parameters on reintegration&#039;&#039;&#039;: widen the mosaicity model when reintegrating, to recruit more reflections.&lt;br /&gt;
The trial&#039;s integration parameters (gain in particular) are copied into this stage so that reintegration matches the original integration; they are visible under &#039;&#039;Edit PHIL&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Scaling ====&lt;br /&gt;
Per-run filtering and scaling against the reference (&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; up to the scaling and post-refinement steps):&lt;br /&gt;
* &#039;&#039;&#039;Min. correlation&#039;&#039;&#039;: lattices whose intensities correlate with the reference model below this are rejected (-1 keeps everything).&lt;br /&gt;
* &#039;&#039;&#039;Unit cell rel. length tol.&#039;&#039;&#039;: lattices whose cell edges differ from the reference cell by more than this fraction are rejected (0.1 = 10%).&lt;br /&gt;
* &#039;&#039;&#039;Filter by unit-cell cluster (from Unit Cells tab)&#039;&#039;&#039;: instead of the tolerance, accept only lattices within the &#039;&#039;&#039;Mahalanobis cutoff&#039;&#039;&#039; (default 4) of the chosen &#039;&#039;&#039;Cluster component&#039;&#039;&#039; (0 is the largest) of a &#039;&#039;&#039;Cluster file&#039;&#039;&#039; written by the [[cctbx.xfel GUI/Unit Cell tab|Unit Cell tab]]. Files in the output folder&#039;s &amp;lt;code&amp;gt;cluster/&amp;lt;/code&amp;gt; directory are listed; &#039;&#039;&#039;Browse...&#039;&#039;&#039; finds others.&lt;br /&gt;
* &#039;&#039;&#039;Significance filter sigma&#039;&#039;&#039;: for each image, keep reflections out to the highest resolution bin whose mean I/σ(I) is above this value.&lt;br /&gt;
With a reference model this stage scales and post-refines each run; without one it only filters, since the plain average needs neither.&lt;br /&gt;
&lt;br /&gt;
==== Merging ====&lt;br /&gt;
Merges the scaled runs into one MTZ with statistics. It takes everything from the shared parameters; &#039;&#039;Edit PHIL&#039;&#039; exposes the rest (error model, cosym settings, output options). When cosym was requested, this stage runs &amp;lt;code&amp;gt;modify_cosym&amp;lt;/code&amp;gt; to resolve the indexing ambiguity before scaling and merging; the cosym space group, number of dimensions and resolution limit are filled in from the trial&#039;s symmetry and the shared d_min, and are visible under &#039;&#039;Edit PHIL&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Phenix ====&lt;br /&gt;
Runs any Phenix command on the merged MTZ. The text box holds the command on the first line and PHIL parameters on the following lines; &amp;lt;code&amp;gt;&amp;lt;PREVIOUS_TASK_MTZ&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;DATASET_NAME&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;DATASET_VERSION&amp;gt;&amp;lt;/code&amp;gt; are substituted at run time. Needs a &#039;&#039;Phenix setup script&#039;&#039; in [[cctbx.xfel GUI/Settings#Advanced settings|Advanced settings]]. Add it with &#039;&#039;&#039;Add stage&#039;&#039;&#039; at the bottom of the pipeline; a second scaling stage can be added the same way.&lt;br /&gt;
&lt;br /&gt;
=== Validation ===&lt;br /&gt;
On OK the dialog checks that a reference model or a unit cell and space group are given, that every enabled stage&#039;s parameters parse, that no two consecutive stages of the same type have identical parameters (they would compute the same thing twice), and that a merge which resolves an indexing ambiguity and then post-refines has a reference model to anchor to (cosym fixes the indexing only up to an overall choice; without a model, remove &#039;&#039;postrefine&#039;&#039; from the merging step list instead). Saving an &#039;&#039;&#039;active&#039;&#039;&#039; dataset whose changes would submit many jobs asks for confirmation first. Datasets are only written if every check passes.&lt;br /&gt;
&lt;br /&gt;
== Tasks shared between datasets ==&lt;br /&gt;
Datasets that run the same stages with the same parameters on the same trial share the work: the per-run jobs for those stages run once, and every dataset that needs them uses the results. There is nothing to set up. A duplicated dataset therefore starts out sharing everything with the original, and a dataset that changes only its merging resolution reuses the original&#039;s ensemble refinement and scaling results.&lt;br /&gt;
&lt;br /&gt;
Editing a stage in one dataset never affects another dataset. Changing an early stage re-runs that stage and every stage after it, since their inputs have changed.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Merging_Stats_tab&amp;diff=1815</id>
		<title>Cctbx.xfel GUI/Merging Stats tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Merging_Stats_tab&amp;diff=1815"/>
		<updated>2026-11-02T19:24:11Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Merging Stats tab}}&lt;br /&gt;
The &#039;&#039;&#039;Merging stats tab&#039;&#039;&#039; shows the merging statistics of each version of a dataset, read from the merging job&#039;s log, the cosym embedding plot when the merge resolved an indexing ambiguity, and the drift of the detector geometry and unit cell over the runs behind a version. The &#039;&#039;Merging Stats Sentinel&#039;&#039; re-reads the logs every 5 seconds while the tab is showing and &#039;&#039;Auto update&#039;&#039; is ticked, so a merge that is still running fills in as it goes.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Selecting a dataset ==&lt;br /&gt;
* &#039;&#039;&#039;Select dataset&#039;&#039;&#039;: the list of datasets; &#039;&#039;&#039;Active only&#039;&#039;&#039; (ticked by default) hides inactive ones.&lt;br /&gt;
* &#039;&#039;&#039;Dataset version&#039;&#039;&#039;: &#039;&#039;All&#039;&#039; or a single version number. Only versions built with the dataset&#039;s current pipeline are listed; a version made with a stage the dataset no longer has is hidden.&lt;br /&gt;
* &#039;&#039;&#039;Auto update&#039;&#039;&#039;: untick to stop the sentinel and freeze the plots, for example to zoom into the drift plot with its toolbar without it being redrawn.&lt;br /&gt;
&lt;br /&gt;
== Statistics page ==&lt;br /&gt;
For a &#039;&#039;&#039;single version&#039;&#039;&#039;, the plot shows the statistics by resolution shell, with resolution along the x axis:&lt;br /&gt;
* &#039;&#039;&#039;% accepted&#039;&#039;&#039; (orange): the fraction of lattices accepted into each resolution shell,&lt;br /&gt;
* &#039;&#039;&#039;Completeness&#039;&#039;&#039; (green) and &#039;&#039;&#039;CC1/2&#039;&#039;&#039; (blue), as percentages on the left axis,&lt;br /&gt;
* &#039;&#039;&#039;Multiplicity&#039;&#039;&#039; (red) and &#039;&#039;&#039;Merged I/sigI&#039;&#039;&#039; (purple) on the right axis.&lt;br /&gt;
&lt;br /&gt;
With &#039;&#039;&#039;All&#039;&#039;&#039; versions selected, the plot shows how the merge improves with data: overall CC1/2 and overall multiplicity against the number of images, and resolution against the number of images, one point per version. This is the plot to watch during collection to decide when enough data have been collected. A dataset whose [[cctbx.xfel GUI/Datasets tab#Merging schedule|merging schedule]] is &#039;&#039;Merge after every run&#039;&#039; has one version per run, which makes this plot a run-by-run record.&lt;br /&gt;
&lt;br /&gt;
They are the same numbers as the tables in the merging log. Nothing is shown for a version whose merge has not yet written its tables.&lt;br /&gt;
&lt;br /&gt;
== Cosym embedding page ==&lt;br /&gt;
When the merging stage ran &amp;lt;code&amp;gt;modify_cosym&amp;lt;/code&amp;gt; to resolve an indexing ambiguity, it writes an embedding plot: each lattice is a point, and a successful resolution shows as well-separated clusters, one per indexing mode. A single blob means cosym could not separate the modes (too little signal in common between images, or no real ambiguity) and the merged data may be degraded by mis-indexed lattices. This page shows the plot for a single selected version; a selector appears when the job wrote more than one. The page explains when no plot is available.&lt;br /&gt;
&lt;br /&gt;
== Detector drift page ==&lt;br /&gt;
This page shows the figure of &amp;lt;code&amp;gt;cctbx.xfel.drift&amp;lt;/code&amp;gt; for the selected version: the detector origin and the unit cell lengths as a function of run and chunk (the pieces ensemble refinement splits each run into), read from the refined experiments the ensemble refinement stage wrote for every run behind the version. Bars along the top give the number of reflections and experiments in each chunk. A drifting origin or cell between runs is a sign that the geometry should be re-refined, or that runs should be split into separate run blocks. With &#039;&#039;All&#039;&#039; versions selected the latest version is shown. The page needs an ensemble refinement stage in the pipeline; without one it says so.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Control !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Origin&#039;&#039;&#039; || Which detector origin to plot per chunk: &#039;&#039;first&#039;&#039; (the first experiment&#039;s), &#039;&#039;average&#039;&#039; (reflection-weighted), &#039;&#039;distribution&#039;&#039; (the whole spread as a heat map), or the same three for the centre of mass of the panels (&#039;&#039;panel_com_...&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Color by&#039;&#039;&#039; || What colours the points: run, run group, chunk, task, trial or dataset version (&#039;&#039;merge&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Unit cell&#039;&#039;&#039; || The reflection-weighted &#039;&#039;average&#039;&#039; cell lengths per chunk, or their whole &#039;&#039;distribution&#039;&#039; as a heat map.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Uncertainties&#039;&#039;&#039; || Error bars on the origin from the mean difference between observed and predicted reflection positions. Roughly doubles the reading time.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Reject outliers&#039;&#039;&#039; || Drop a chunk&#039;s cells whose a, b or c lies more than 1.5 inter-quartile ranges beyond the quartiles within that chunk before averaging or plotting. Off by default.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The first display of a version can take a while, since every run&#039;s refined experiments are read; later refreshes are quick. The line above the figure reports how many chunks were read and, if any could not be, the first reason.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
* Compare versions, or two datasets merged with different settings, by switching the selection; the plot is redrawn at the panel size, so enlarge the window for more detail.&lt;br /&gt;
* If CC1/2 or completeness is poor in the outer shells, lower the resolution limit in the dataset&#039;s shared parameters. That changes the scaling and merging stages, so with the dataset active the job sentinel re-runs scaling for every run (ensemble refinement is reused) and merges a new version when they finish. Changing only the merging stage&#039;s own parameters, through its &#039;&#039;Edit PHIL&#039;&#039;, merges a new version at once from the existing scaling results. Earlier versions are kept.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Energy_tab&amp;diff=1814</id>
		<title>Cctbx.xfel GUI/Energy tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Energy_tab&amp;diff=1814"/>
		<updated>2026-11-02T19:22:53Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Energy tab}}&lt;br /&gt;
The &#039;&#039;&#039;Energy tab&#039;&#039;&#039; 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 &#039;&#039;Calib Worker&#039;&#039; light are absent. The &#039;&#039;Calib Worker&#039;&#039; 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.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
At LCLS each shot&#039;s photon energy can be measured two ways: from the electron beam energy reported by the accelerator (the &#039;&#039;ebeam&#039;&#039;), and from the &#039;&#039;FEE spectrometer&#039;&#039;, 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:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;FEE calibration&#039;&#039;&#039;: several short runs are collected with the beam energy stepped through a notch of known energy. Fitting the notch position in each run&#039;s average spectrum against the known energies gives the spectrometer&#039;s &#039;&#039;&#039;eV per pixel&#039;&#039;&#039; and &#039;&#039;&#039;eV offset&#039;&#039;&#039;.&lt;br /&gt;
# &#039;&#039;&#039;Ebeam calibration&#039;&#039;&#039;: with the spectrometer calibrated, its per-shot energies are compared with the ebeam energies over a set of ordinary runs to find the constant &#039;&#039;&#039;ebeam offset&#039;&#039;&#039; (and the equivalent wavelength offset), so that the ebeam value can be corrected on shots where the spectrometer is unusable.&lt;br /&gt;
&lt;br /&gt;
The results are entered into [[cctbx.xfel GUI/Trials tab#Run block settings|run block settings]] (the &#039;&#039;Spectrum&#039;&#039; and &#039;&#039;Wavelength&#039;&#039; 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.&lt;br /&gt;
&lt;br /&gt;
== FEE Energy Scan Description ==&lt;br /&gt;
* &#039;&#039;&#039;Experiment&#039;&#039;&#039;: 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.&lt;br /&gt;
* &#039;&#039;&#039;Max events&#039;&#039;&#039;: 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.&lt;br /&gt;
* &#039;&#039;&#039;Run / Notch Energy (eV)&#039;&#039;&#039; table: one row per calibration run. Click a cell to edit it. &#039;&#039;&#039;Add Row&#039;&#039;&#039; appends a row and &#039;&#039;&#039;Clear All&#039;&#039;&#039; empties the table.&lt;br /&gt;
* &#039;&#039;&#039;Run Calibration&#039;&#039;&#039;: 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 &#039;&#039;&#039;trendline&#039;&#039;&#039; (notch position against energy, with the fitted line) and the &#039;&#039;&#039;spectra&#039;&#039;&#039; (each run&#039;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.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
== Runs for Ebeam Calibration ==&lt;br /&gt;
* The checklist shows every run in the database; &#039;&#039;&#039;Refresh&#039;&#039;&#039; picks up runs that arrived since the tab was opened and &#039;&#039;&#039;Clear&#039;&#039;&#039; unticks everything and clears the plot.&lt;br /&gt;
* Tick the runs to compare and press &#039;&#039;&#039;Run Calibration&#039;&#039;&#039;. 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.&lt;br /&gt;
* The plot overlays the ebeam energies with the calibrated spectrometer energies for the selected runs.&lt;br /&gt;
* &#039;&#039;&#039;Clear&#039;&#039;&#039; unticks the runs and discards the ebeam result and its plot.&lt;br /&gt;
&lt;br /&gt;
== Calibration Results ==&lt;br /&gt;
The box shows &#039;&#039;&#039;FEE eV per pixel&#039;&#039;&#039;, &#039;&#039;&#039;FEE eV offset&#039;&#039;&#039; and &#039;&#039;&#039;Ebeam offset&#039;&#039;&#039; (in eV, with the equivalent wavelength offset in Å). &#039;&#039;&#039;Save calibration&#039;&#039;&#039; is enabled once there is a result to save; it writes the results as a PHIL file (default &amp;lt;code&amp;gt;fee/fee_calib.phil&amp;lt;/code&amp;gt; next to the output folder) and confirms the file name in the box:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;spectrum_eV_per_pixel=...&lt;br /&gt;
spectrum_eV_offset=...&lt;br /&gt;
ebeam_eV_offset=...&lt;br /&gt;
wavelength_offset=...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The [[cctbx.xfel GUI/Trials tab#Run block settings|run block dialog]] has two buttons under its &#039;&#039;Spectrum&#039;&#039; row: &#039;&#039;&#039;Use Energy tab calibration&#039;&#039;&#039; copies the current results from this tab (enabled once the FEE calibration has run), and &#039;&#039;&#039;Load calibration file...&#039;&#039;&#039; reads a file saved here. Both fill the &#039;&#039;eV per pixel&#039;&#039; and &#039;&#039;eV offset&#039;&#039; fields, and the &#039;&#039;Wavelength offset&#039;&#039; 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.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Workflows&amp;diff=1813</id>
		<title>Cctbx.xfel GUI/Workflows</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Workflows&amp;diff=1813"/>
		<updated>2026-11-02T19:21:44Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Workflows}}&lt;br /&gt;
Step-by-step recipes for the common things done with the cctbx.xfel GUI. Each step names the tab or dialog it happens in; see the tab pages for the details of every control.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Setting up a new experiment ==&lt;br /&gt;
# Start &amp;lt;code&amp;gt;cctbx.xfel&amp;lt;/code&amp;gt;. In the login dialog press &#039;&#039;&#039;DB Credentials...&#039;&#039;&#039; and enter the database server, database, user and password. If you have no server, fill those in anyway and press &#039;&#039;&#039;Start DB Server&#039;&#039;&#039; (see [[cctbx.xfel GUI/Settings#Starting a local database server|starting a local server]]).&lt;br /&gt;
# Enter a new &#039;&#039;&#039;Experiment Tag&#039;&#039;&#039; for this experiment, choose the &#039;&#039;&#039;Facility&#039;&#039;&#039; and, at LCLS, the &#039;&#039;&#039;Experiment&#039;&#039;&#039; name; in standalone mode press &#039;&#039;&#039;Options...&#039;&#039;&#039; and set the folder to monitor and the file template.&lt;br /&gt;
# Choose the &#039;&#039;&#039;Output&#039;&#039;&#039; folder (on a file system the compute nodes can write to).&lt;br /&gt;
# Press &#039;&#039;&#039;Advanced Settings...&#039;&#039;&#039; and set the multiprocessing method, queue, number of processors and environment script for your cluster. Press OK.&lt;br /&gt;
# Press &#039;&#039;&#039;Save Project As...&#039;&#039;&#039; and name the project, then &#039;&#039;&#039;OK&#039;&#039;&#039;. The main window opens.&lt;br /&gt;
# On the toolbar press &#039;&#039;&#039;Watch for new runs&#039;&#039;&#039;. Runs appear in the Runs tab.&lt;br /&gt;
&lt;br /&gt;
== Processing runs as they are collected ==&lt;br /&gt;
# &#039;&#039;&#039;Runs tab&#039;&#039;&#039;: press &#039;&#039;&#039;Manage Tags&#039;&#039;&#039; and create tags for your samples; press &#039;&#039;&#039;Manage Persistent Tags&#039;&#039;&#039; and tick the tag for the sample currently on the beam, so that every new run gets it. Change the persistent tags when the sample changes.&lt;br /&gt;
# &#039;&#039;&#039;Trials tab&#039;&#039;&#039;: press &#039;&#039;&#039;New Trial&#039;&#039;&#039;. Enter the unit cell and space group if known, adjust spot finding if needed, and press OK. In the new trial press &#039;&#039;&#039;New Block&#039;&#039;&#039;: set the start run, leave &#039;&#039;&#039;Auto add runs&#039;&#039;&#039; selected, enter the detector address, beam centre and distance (LCLS), any mask or reference geometry, and press OK. Tick &#039;&#039;&#039;Active Trial&#039;&#039;&#039;.&lt;br /&gt;
# On the toolbar press &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039;. The job sentinel now submits a job for every run in the block and for each new run as it arrives.&lt;br /&gt;
# &#039;&#039;&#039;Jobs tab&#039;&#039;&#039;: confirm the jobs reach &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt; and then &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;. If one shows &amp;lt;code&amp;gt;EXIT&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;S_FAIL&amp;lt;/code&amp;gt;, read its log (see [[cctbx.xfel GUI/Troubleshooting|Troubleshooting]]).&lt;br /&gt;
# &#039;&#039;&#039;Run Stats tab&#039;&#039;&#039;: select the trial and press &#039;&#039;&#039;Auto plot last five runs&#039;&#039;&#039;. Leave this tab showing during collection.&lt;br /&gt;
# &#039;&#039;&#039;Unit Cell tab&#039;&#039;&#039;: select the trial, add a tag set for the sample, and check that the cell histograms are single peaks at the expected values.&lt;br /&gt;
&lt;br /&gt;
== Calibrating the photon energy (LCLS) ==&lt;br /&gt;
# Collect a few short runs with the beam energy stepped through the notch, and note the notch energy of each.&lt;br /&gt;
# Energy tab: enter each run and its notch energy in the table, set &#039;&#039;Max events&#039;&#039;, and press &#039;&#039;&#039;Run Calibration&#039;&#039;&#039; under the scan description. Check the trendline is a clean straight line through the notch positions.&lt;br /&gt;
# Tick a handful of ordinary runs under &#039;&#039;Runs for Ebeam Calibration&#039;&#039; and press its &#039;&#039;&#039;Run Calibration&#039;&#039;&#039;. The runs must already be in a run block. The &#039;&#039;Ebeam offset&#039;&#039; appears in the results box.&lt;br /&gt;
# Press &#039;&#039;&#039;Save calibration&#039;&#039;&#039; to keep a copy of the values.&lt;br /&gt;
# Trials tab: open the run block (or create a new one) and press &#039;&#039;&#039;Use Energy tab calibration&#039;&#039;&#039; under the &#039;&#039;Spectrum&#039;&#039; row, or &#039;&#039;&#039;Load calibration file...&#039;&#039;&#039; if the GUI has been restarted since. Press OK. A new block is created if the values changed, and its jobs use the calibrated energies.&lt;br /&gt;
&lt;br /&gt;
== Tuning spot finding and indexing ==&lt;br /&gt;
# Make a new trial (it copies the previous one) and change one thing: for example lower &#039;&#039;Sigma strong&#039;&#039; or set &#039;&#039;Min spot size&#039;&#039;. Use &#039;&#039;&#039;Copy runblocks from&#039;&#039;&#039; the previous trial so both trials cover the same runs, or give the new trial a block with an explicit end run covering a few representative runs.&lt;br /&gt;
# Activate the new trial. Both trials can be active at once; jobs for the new trial appear in the Jobs tab.&lt;br /&gt;
# In the Run Stats tab switch between the two trials and compare the strong spot counts, indexing rate and resolution for the same runs.&lt;br /&gt;
# Deactivate the trial you will not use, so it stops consuming queue time on new runs.&lt;br /&gt;
&lt;br /&gt;
== Reprocessing after a change to a run block ==&lt;br /&gt;
Detector settings live in run blocks, and results are stored per block. To reprocess runs with a new geometry or mask:&lt;br /&gt;
# Trials tab: click the block, change the setting (for example &#039;&#039;Reference geometry&#039;&#039;) and press OK. Because a setting other than the end run or comment changed, the old block is deactivated and a new block is created in the trial.&lt;br /&gt;
# With the trial active and &#039;&#039;Auto-submit jobs&#039;&#039; on, jobs for the new block are submitted. The old block&#039;s results remain on disk under the old block id.&lt;br /&gt;
To instead re-run a single failed job unchanged, use &#039;&#039;&#039;Restart job&#039;&#039;&#039; in the Jobs tab.&lt;br /&gt;
&lt;br /&gt;
== Merging a dataset ==&lt;br /&gt;
# Make sure the runs to merge carry a tag that identifies them (Runs tab) and that their indexing jobs are &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Datasets tab: press &#039;&#039;&#039;New Dataset&#039;&#039;&#039;. Name it, choose the trial and the tag(s), and check that the &#039;&#039;Runs selected&#039;&#039; line shows the number of runs you expect. Choose a reference model, or &#039;&#039;Unknown structure&#039;&#039; with the cell and space group; if the wizard warns that the trial&#039;s symmetry does not match the model, check which of the two is wrong before continuing. Choose the &#039;&#039;Merging schedule&#039;&#039;: the default merges whatever has finished on each pass; &#039;&#039;after every run&#039;&#039; gives a version per run to watch the statistics grow; &#039;&#039;once all runs finish&#039;&#039; gives a single merge when nothing is left running. Keep &#039;&#039;Include ensemble refinement&#039;&#039; ticked unless time is short. Accept or change the cosym suggestion. Set the resolution limit. Finish.&lt;br /&gt;
# Tick &#039;&#039;&#039;Active Dataset&#039;&#039;&#039;. If asked to confirm the number of jobs, check it is what you expect. With &#039;&#039;Auto-submit jobs&#039;&#039; on, ensemble refinement and scaling jobs are submitted per run, then a merging job once some runs are through. Follow them in the Jobs tab.&lt;br /&gt;
# Merging stats tab: select the dataset. Version &#039;&#039;All&#039;&#039; shows CC1/2 and multiplicity growing as versions accumulate; a single version shows its statistics by resolution.&lt;br /&gt;
# The merged MTZ is &amp;lt;code&amp;gt;&amp;lt;output folder&amp;gt;/&amp;lt;dataset name&amp;gt;/v&amp;lt;NNN&amp;gt;/&amp;lt;name&amp;gt;_v&amp;lt;NNN&amp;gt;_all.mtz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Merging without a reference structure ===&lt;br /&gt;
Choose &#039;&#039;Unknown structure&#039;&#039; in the wizard. The merge is a plain average without per-image scaling. Once it has produced an MTZ, create a second dataset with &#039;&#039;Known reference model&#039;&#039; pointing at that MTZ to get a properly scaled and post-refined merge. If the symmetry has an indexing ambiguity, tick cosym in both datasets; the first merge fixes an arbitrary but consistent indexing frame which the second then anchors to.&lt;br /&gt;
&lt;br /&gt;
=== Merging one crystal form out of a mixture ===&lt;br /&gt;
# Unit Cell tab: select the trial and the tag set and tick &#039;&#039;&#039;Plot clusters&#039;&#039;&#039;. Press &#039;&#039;&#039;Options...&#039;&#039;&#039; to adjust &#039;&#039;Cluster epsilon&#039;&#039; until the forms separate, and to add an angle to the feature vector if that is what tells the forms apart; the &#039;&#039;Cell volume histogram&#039;&#039; side plot shows the clusters&#039; sizes at a glance. Note which component (0 is the largest) is the one you want. The cluster file is written to &amp;lt;code&amp;gt;cluster/&amp;lt;/code&amp;gt; in the output folder.&lt;br /&gt;
# Datasets tab: open the dataset, and in the &#039;&#039;&#039;Scaling&#039;&#039;&#039; stage tick &#039;&#039;&#039;Filter by unit-cell cluster&#039;&#039;&#039;, choose the cluster file, enter the component number and, if needed, a tighter Mahalanobis cutoff. Press OK.&lt;br /&gt;
# The next version merged (restart the scaling jobs from the Jobs tab, or wait for new runs) uses only lattices from that cluster.&lt;br /&gt;
&lt;br /&gt;
== Merging the same runs with different settings ==&lt;br /&gt;
Press the copy button on the dataset. The copy is inactive and starts with the original&#039;s pipeline. Open it, change what you want (resolution limit, reference model, a stage&#039;s parameters), give it a comment saying what differs, and activate it. The original is never affected by edits to the copy. Stages that are unchanged, and everything upstream of the first change, reuse the original&#039;s jobs: a copy that differs only in its merging parameters submits just a merging job, while one with a different scaling filter re-runs scaling and merging but keeps the ensemble refinement.&lt;br /&gt;
&lt;br /&gt;
== Checking detector drift ==&lt;br /&gt;
Merging stats tab: select the dataset and a version, and open the &#039;&#039;&#039;Detector drift&#039;&#039;&#039; page. The detector origin and cell lengths are plotted against run and chunk, read from the ensemble refinement results behind that version (the pipeline must include ensemble refinement). Untick &#039;&#039;Auto update&#039;&#039; to zoom in without the plot being redrawn. A step in the origin between runs suggests the detector moved: give those runs their own run block with a refined reference geometry.&lt;br /&gt;
&lt;br /&gt;
== Stopping and restarting jobs ==&lt;br /&gt;
* To stop submitting new jobs, turn off &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039; or untick the trial or dataset&#039;s &#039;&#039;Active&#039;&#039; box.&lt;br /&gt;
* To stop a running job, select it in the Jobs tab and press &#039;&#039;&#039;Stop job&#039;&#039;&#039;.&lt;br /&gt;
* To re-run a job after fixing the cause of a failure, select it, press &#039;&#039;&#039;Stop job&#039;&#039;&#039; if it is still running, then &#039;&#039;&#039;Restart job&#039;&#039;&#039;. Its old results are deleted and the job sentinel resubmits it.&lt;br /&gt;
* To throw away a trial&#039;s results, delete its jobs in the Jobs tab (untick &#039;&#039;Only display jobs from active trials/blocks&#039;&#039; to see jobs of inactive trials), and leave the trial inactive. The trial itself cannot be deleted.&lt;br /&gt;
&lt;br /&gt;
== Watching an experiment from elsewhere ==&lt;br /&gt;
Start a second GUI with the same project (copy &amp;lt;code&amp;gt;~/.cctbx.xfel/settings_&amp;lt;name&amp;gt;.phil&amp;lt;/code&amp;gt; to the other machine, or set the same credentials by hand) and &amp;lt;code&amp;gt;monitoring_mode=True&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;cctbx.xfel monitoring_mode=True&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Run Stats, Unit Cell and Merging stats tabs work as usual; nothing can be submitted from it. Keep job submission to a single GUI instance.&lt;br /&gt;
&lt;br /&gt;
== Standalone mode with files from another source ==&lt;br /&gt;
# Settings: facility &#039;&#039;Standalone&#039;&#039;; &#039;&#039;&#039;Options...&#039;&#039;&#039;: set the folder, &#039;&#039;&#039;Monitor for&#039;&#039;&#039; &#039;&#039;files&#039;&#039; or &#039;&#039;folders&#039;&#039;, the file template (for example &amp;lt;code&amp;gt;*.h5&amp;lt;/code&amp;gt;) and tick &#039;&#039;Files are composite&#039;&#039; for HDF5 or NeXus files. For one-image-per-file data, use &#039;&#039;folders&#039;&#039; with one folder per run and untick &#039;&#039;composite&#039;&#039;.&lt;br /&gt;
# Proceed as for a live experiment. Run blocks select runs by their order of discovery; the detector geometry comes from the image headers unless a reference geometry is set in the block.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Merging_Stats_tab&amp;diff=1812</id>
		<title>Cctbx.xfel GUI/Merging Stats tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Merging_Stats_tab&amp;diff=1812"/>
		<updated>2026-10-22T23:04:23Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Merging Stats tab}}&lt;br /&gt;
The &#039;&#039;&#039;Merging stats tab&#039;&#039;&#039; shows the merging statistics of each version of a dataset, read from the merging job&#039;s log, the cosym embedding plot when the merge resolved an indexing ambiguity, and the drift of the detector geometry and unit cell over the runs behind a version. The &#039;&#039;Merging Stats Sentinel&#039;&#039; re-reads the logs every 5 seconds while the tab is showing and &#039;&#039;Auto update&#039;&#039; is ticked, so a merge that is still running fills in as it goes.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Selecting a dataset ==&lt;br /&gt;
* &#039;&#039;&#039;Select dataset&#039;&#039;&#039;: the list of datasets; &#039;&#039;&#039;Active only&#039;&#039;&#039; (ticked by default) hides inactive ones.&lt;br /&gt;
* &#039;&#039;&#039;Dataset version&#039;&#039;&#039;: &#039;&#039;All&#039;&#039; or a single version number. Only versions built with the dataset&#039;s current pipeline are listed; a version made with a stage the dataset no longer has is hidden.&lt;br /&gt;
* &#039;&#039;&#039;Auto update&#039;&#039;&#039;: untick to stop the sentinel and freeze the plots, for example to zoom into the drift plot with its toolbar without it being redrawn.&lt;br /&gt;
&lt;br /&gt;
== Statistics page ==&lt;br /&gt;
For a &#039;&#039;&#039;single version&#039;&#039;&#039;, the plot shows the statistics by resolution shell, with resolution along the x axis:&lt;br /&gt;
* &#039;&#039;&#039;% accepted&#039;&#039;&#039; (orange): the fraction of lattices accepted into each resolution shell,&lt;br /&gt;
* &#039;&#039;&#039;Completeness&#039;&#039;&#039; (green) and &#039;&#039;&#039;CC1/2&#039;&#039;&#039; (blue), as percentages on the left axis,&lt;br /&gt;
* &#039;&#039;&#039;Multiplicity&#039;&#039;&#039; (red) and &#039;&#039;&#039;Merged I/sigI&#039;&#039;&#039; (purple) on the right axis.&lt;br /&gt;
&lt;br /&gt;
With &#039;&#039;&#039;All&#039;&#039;&#039; versions selected, the plot shows how the merge improves with data: overall CC1/2 and overall multiplicity against the number of images, and resolution against the number of images, one point per version. This is the plot to watch during collection to decide when enough data have been collected.&lt;br /&gt;
&lt;br /&gt;
The statistics are scraped from the merging log (the &amp;lt;code&amp;gt;*main*&amp;lt;/code&amp;gt; file in the version folder), so they match the tables printed there. Nothing is shown for a version whose merge has not yet written its tables.&lt;br /&gt;
&lt;br /&gt;
== Cosym embedding page ==&lt;br /&gt;
When the merging stage ran &amp;lt;code&amp;gt;modify_cosym&amp;lt;/code&amp;gt; to resolve an indexing ambiguity, it writes an embedding plot: each lattice is a point, and a successful resolution shows as well-separated clusters, one per indexing mode. A single blob means cosym could not separate the modes (too little signal in common between images, or no real ambiguity) and the merged data may be degraded by mis-indexed lattices. This page shows the plot for a single selected version; a selector appears when the job wrote more than one (one per plotting rank). The page explains when no plot is available.&lt;br /&gt;
&lt;br /&gt;
== Detector drift page ==&lt;br /&gt;
This page shows the figure of &amp;lt;code&amp;gt;cctbx.xfel.drift&amp;lt;/code&amp;gt; for the selected version: the detector origin and the unit cell lengths as a function of run and chunk (the pieces ensemble refinement splits each run into), read from the refined experiments the ensemble refinement stage wrote for every run behind the version. Bars along the top give the number of reflections and experiments in each chunk. A drifting origin or cell between runs is a sign that the geometry should be re-refined, or that runs should be split into separate run blocks. With &#039;&#039;All&#039;&#039; versions selected the latest version is shown. The page needs an ensemble refinement stage in the pipeline; without one it says so.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Control !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Origin&#039;&#039;&#039; || Which detector origin to plot per chunk: &#039;&#039;first&#039;&#039; (the first experiment&#039;s), &#039;&#039;average&#039;&#039; (reflection-weighted), &#039;&#039;distribution&#039;&#039; (the whole spread as a heat map), or the same three for the centre of mass of the panels (&#039;&#039;panel_com_...&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Color by&#039;&#039;&#039; || What colours the points: run, run group, chunk, task, trial or dataset version (&#039;&#039;merge&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Unit cell&#039;&#039;&#039; || The reflection-weighted &#039;&#039;average&#039;&#039; cell lengths per chunk, or their whole &#039;&#039;distribution&#039;&#039; as a heat map.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Uncertainties&#039;&#039;&#039; || Error bars on the origin from the mean difference between observed and predicted reflection positions. Roughly doubles the reading time.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Reject outliers&#039;&#039;&#039; || Drop a chunk&#039;s cells whose a, b or c lies more than 1.5 inter-quartile ranges beyond the quartiles within that chunk before averaging or plotting. Off by default.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Reading every chunk&#039;s refined experiments is slow, so the results are cached per chunk in the dataset&#039;s folder (&amp;lt;code&amp;gt;&amp;lt;dataset name&amp;gt;/drift_cache_v&amp;lt;NNN&amp;gt;_*.pkl&amp;lt;/code&amp;gt;) and only new chunks are read on later refreshes; the plot is only computed while this page is showing. The line above the figure reports how many chunks were read and, if any could not be, the first reason.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
* Compare versions, or two datasets merged with different settings, by switching the selection; the plot is redrawn at the panel size, so enlarge the window for more detail.&lt;br /&gt;
* If CC1/2 or completeness is poor in the outer shells, lower the resolution limit in the dataset&#039;s shared parameters. That changes the scaling and merging stages, so with the dataset active the job sentinel re-runs scaling for every run (ensemble refinement is reused) and merges a new version when they finish. Changing only the merging stage&#039;s own parameters, through its &#039;&#039;Edit PHIL&#039;&#039;, merges a new version at once from the existing scaling results. Earlier versions are kept.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Troubleshooting&amp;diff=1811</id>
		<title>Cctbx.xfel GUI/Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Troubleshooting&amp;diff=1811"/>
		<updated>2026-10-22T22:57:00Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Troubleshooting}}&lt;br /&gt;
What to check when something does not behave. The GUI prints errors and progress to the terminal it was started from, so that terminal is always the first place to look.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== A status light is red ==&lt;br /&gt;
A red light means that thread hit an exception and stopped; the traceback is in the terminal. Common causes: the database connection dropped (the server was restarted or the job running it ended), the queuing system command failed (&amp;lt;code&amp;gt;squeue&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;bjobs&amp;lt;/code&amp;gt; not on the path), or a run block refers to a run that no longer exists. Fix the cause, then restart the thread: toggle &#039;&#039;&#039;Watch for new runs&#039;&#039;&#039; or &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039; off and on, or switch away from and back to the tab for the tab-specific sentinels. If the database itself is gone, restart the GUI.&lt;br /&gt;
&lt;br /&gt;
== No runs appear ==&lt;br /&gt;
* &#039;&#039;Watch for new runs&#039;&#039; must be on (the Run Sentinel light green).&lt;br /&gt;
* LCLS: check the experiment name and the XTC stream location in the credentials dialog, and that the run database web service is reachable from this machine.&lt;br /&gt;
* Standalone: check the folder, the template (it is a glob, so &amp;lt;code&amp;gt;*.h5&amp;lt;/code&amp;gt;, not &amp;lt;code&amp;gt;.h5&amp;lt;/code&amp;gt;), and the completion criteria; a file younger than &#039;&#039;Minimum time since last modified&#039;&#039; or smaller than &#039;&#039;Minimum file size&#039;&#039; is not picked up yet. Folders need the status file or the required number of files.&lt;br /&gt;
&lt;br /&gt;
== Jobs are not submitted ==&lt;br /&gt;
* &#039;&#039;Auto-submit jobs&#039;&#039; must be on, the trial must be &#039;&#039;&#039;active&#039;&#039;&#039;, and it must have a run block containing the runs.&lt;br /&gt;
* In &#039;&#039;local&#039;&#039; mode only one job runs at a time; the next is submitted when it finishes.&lt;br /&gt;
* &amp;lt;code&amp;gt;mp.max_queued&amp;lt;/code&amp;gt; in the settings file limits the number of queued and running jobs.&lt;br /&gt;
* For datasets: the dataset must be active and must have at least one tag; all its tags must be in use on the trial&#039;s runs; the runs&#039; indexing jobs must be &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;; and each stage waits for the previous stage of the same run to be &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;. A failed stage (&amp;lt;code&amp;gt;EXIT&amp;lt;/code&amp;gt;) blocks the rest of the pipeline for that run until it is restarted.&lt;br /&gt;
* Watch the terminal: the job sentinel prints what it submits and why it is waiting.&lt;br /&gt;
&lt;br /&gt;
== The GUI asks me to confirm &amp;quot;about N jobs&amp;quot; ==&lt;br /&gt;
Activating a trial or dataset, saving a run block on an active trial, or saving an active dataset counts the jobs the job sentinel would then submit and asks when the total reaches &amp;lt;code&amp;gt;job_count_warning&amp;lt;/code&amp;gt; (50 by default). The count by stage tells you what is about to happen: a replaced run block reprocesses all of its runs, a changed early stage re-runs every later stage, and an open run block on a long experiment covers every run collected since its start. Answer &#039;&#039;No&#039;&#039; to go back and narrow the selection, or raise or disable the setting in the project file if the numbers are routine for your experiment.&lt;br /&gt;
&lt;br /&gt;
== A job fails immediately (S_FAIL or EXIT) ==&lt;br /&gt;
Open the job&#039;s log: &amp;lt;code&amp;gt;&amp;lt;output folder&amp;gt;/r&amp;lt;run&amp;gt;/&amp;lt;trial&amp;gt;_rg&amp;lt;block&amp;gt;/stdout/log.out&amp;lt;/code&amp;gt; for indexing jobs, and the queue&#039;s error file next to it. Typical causes are a wrong detector address, a mask or reference geometry file that the compute nodes cannot read, an environment script that does not set up cctbx, or a PHIL parameter that the processing program rejects. After fixing, use &#039;&#039;&#039;Restart job&#039;&#039;&#039; in the Jobs tab (or, for a run block change, let the new block&#039;s jobs run).&lt;br /&gt;
&lt;br /&gt;
== Images index poorly ==&lt;br /&gt;
* Check the unit cell and space group in the trial, and the detector distance and beam centre in the run block (an average image from the Runs tab helps with the latter).&lt;br /&gt;
* In the Run Stats tab, many grey points high in the strong spots panel are hits that did not index: look at some of those images.&lt;br /&gt;
* Too many or too few spots: adjust the spot finding thresholds in a new trial and compare.&lt;br /&gt;
&lt;br /&gt;
== The Run Stats plot is empty ==&lt;br /&gt;
A trial must be selected, and runs ticked (or &#039;&#039;Auto plot last five runs&#039;&#039; pressed). Only runs whose jobs have logged results show up; a run whose job is still pending has nothing to plot yet. If &#039;&#039;Auto update&#039;&#039; is unticked the plot does not refresh.&lt;br /&gt;
&lt;br /&gt;
== The cosym page says there is no plot ==&lt;br /&gt;
The embedding plot is only written when the merging stage runs &amp;lt;code&amp;gt;modify_cosym&amp;lt;/code&amp;gt;, and only for a single selected version. Check the merging stage&#039;s step list under &#039;&#039;Edit PHIL&#039;&#039; and that the merging job is &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== The drift page says there is no ensemble refinement output ==&lt;br /&gt;
The drift plot reads the refined experiments written by the ensemble refinement stage, so the dataset needs that stage and its jobs must have run. A version merged before the stage was added has nothing to read. If the line above the plot says some chunks were skipped, the reason given is for the first one; a chunk still being written is the usual cause and clears on a later refresh.&lt;br /&gt;
&lt;br /&gt;
== The dataset dialog refuses two identical stages ==&lt;br /&gt;
Two consecutive stages of the same type with the same parameters (two merging stages, say) would be the same task and compute the same thing twice. Change one of them, or remove the extra stage.&lt;br /&gt;
&lt;br /&gt;
== The GUI refuses to load a project ==&lt;br /&gt;
While the GUI is connected, a project with a different database connection or experiment tag cannot be loaded. Quit and start the GUI again; the login dialog can load any project.&lt;br /&gt;
&lt;br /&gt;
== Resetting an experiment ==&lt;br /&gt;
To start again with an empty database but the same experiment tag, tick &#039;&#039;Delete and regenerate all tables&#039;&#039; in the credentials dialog at login. This erases every run, trial, job and logged result for that tag (the files on disk are untouched, so delete or move the output folder as well if you want a clean slate). Using a new experiment tag instead keeps the old records available.&lt;br /&gt;
&lt;br /&gt;
== Getting help ==&lt;br /&gt;
The &#039;&#039;About&#039;&#039; entry in the Help menu lists the authors. Questions and bug reports go to the cctbx.xfel developers; include the terminal output and the relevant job log.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Workflows&amp;diff=1810</id>
		<title>Cctbx.xfel GUI/Workflows</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Workflows&amp;diff=1810"/>
		<updated>2026-10-22T22:56:04Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Workflows}}&lt;br /&gt;
Step-by-step recipes for the common things done with the cctbx.xfel GUI. Each step names the tab or dialog it happens in; see the tab pages for the details of every control.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Setting up a new experiment ==&lt;br /&gt;
# Start &amp;lt;code&amp;gt;cctbx.xfel&amp;lt;/code&amp;gt;. In the login dialog press &#039;&#039;&#039;DB Credentials...&#039;&#039;&#039; and enter the database server, database, user and password. If you have no server, fill those in anyway and press &#039;&#039;&#039;Start DB Server&#039;&#039;&#039; (see [[cctbx.xfel GUI/Settings#Starting a local database server|starting a local server]]).&lt;br /&gt;
# Enter a new &#039;&#039;&#039;Experiment Tag&#039;&#039;&#039; for this experiment, choose the &#039;&#039;&#039;Facility&#039;&#039;&#039; and, at LCLS, the &#039;&#039;&#039;Experiment&#039;&#039;&#039; name; in standalone mode press &#039;&#039;&#039;Options...&#039;&#039;&#039; and set the folder to monitor and the file template.&lt;br /&gt;
# Choose the &#039;&#039;&#039;Output&#039;&#039;&#039; folder (on a file system the compute nodes can write to).&lt;br /&gt;
# Press &#039;&#039;&#039;Advanced Settings...&#039;&#039;&#039; and set the multiprocessing method, queue, number of processors and environment script for your cluster. Press OK.&lt;br /&gt;
# Press &#039;&#039;&#039;Save Project As...&#039;&#039;&#039; and name the project, then &#039;&#039;&#039;OK&#039;&#039;&#039;. The main window opens.&lt;br /&gt;
# On the toolbar press &#039;&#039;&#039;Watch for new runs&#039;&#039;&#039;. Runs appear in the Runs tab.&lt;br /&gt;
&lt;br /&gt;
== Processing runs as they are collected ==&lt;br /&gt;
# &#039;&#039;&#039;Runs tab&#039;&#039;&#039;: press &#039;&#039;&#039;Manage Tags&#039;&#039;&#039; and create tags for your samples; press &#039;&#039;&#039;Manage Persistent Tags&#039;&#039;&#039; and tick the tag for the sample currently on the beam, so that every new run gets it. Change the persistent tags when the sample changes.&lt;br /&gt;
# &#039;&#039;&#039;Trials tab&#039;&#039;&#039;: press &#039;&#039;&#039;New Trial&#039;&#039;&#039;. Enter the unit cell and space group if known, adjust spot finding if needed, and press OK. In the new trial press &#039;&#039;&#039;New Block&#039;&#039;&#039;: set the start run, leave &#039;&#039;&#039;Auto add runs&#039;&#039;&#039; selected, enter the detector address, beam centre and distance (LCLS), any mask or reference geometry, and press OK. Tick &#039;&#039;&#039;Active Trial&#039;&#039;&#039;.&lt;br /&gt;
# On the toolbar press &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039;. The job sentinel now submits a job for every run in the block and for each new run as it arrives.&lt;br /&gt;
# &#039;&#039;&#039;Jobs tab&#039;&#039;&#039;: confirm the jobs reach &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt; and then &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;. If one shows &amp;lt;code&amp;gt;EXIT&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;S_FAIL&amp;lt;/code&amp;gt;, read its log (see [[cctbx.xfel GUI/Troubleshooting|Troubleshooting]]).&lt;br /&gt;
# &#039;&#039;&#039;Run Stats tab&#039;&#039;&#039;: select the trial and press &#039;&#039;&#039;Auto plot last five runs&#039;&#039;&#039;. Leave this tab showing during collection.&lt;br /&gt;
# &#039;&#039;&#039;Unit Cell tab&#039;&#039;&#039;: select the trial, add a tag set for the sample, and check that the cell histograms are single peaks at the expected values.&lt;br /&gt;
&lt;br /&gt;
== Tuning spot finding and indexing ==&lt;br /&gt;
# Make a new trial (it copies the previous one) and change one thing: for example lower &#039;&#039;Sigma strong&#039;&#039; or set &#039;&#039;Min spot size&#039;&#039;. Use &#039;&#039;&#039;Copy runblocks from&#039;&#039;&#039; the previous trial so both trials cover the same runs, or give the new trial a block with an explicit end run covering a few representative runs.&lt;br /&gt;
# Activate the new trial. Both trials can be active at once; jobs for the new trial appear in the Jobs tab.&lt;br /&gt;
# In the Run Stats tab switch between the two trials and compare the strong spot counts, indexing rate and resolution for the same runs.&lt;br /&gt;
# Deactivate the trial you will not use, so it stops consuming queue time on new runs.&lt;br /&gt;
&lt;br /&gt;
== Reprocessing after a change to a run block ==&lt;br /&gt;
Detector settings live in run blocks, and results are stored per block. To reprocess runs with a new geometry or mask:&lt;br /&gt;
# Trials tab: click the block, change the setting (for example &#039;&#039;Reference geometry&#039;&#039;) and press OK. Because a setting other than the end run or comment changed, the old block is deactivated and a new block is created in the trial.&lt;br /&gt;
# With the trial active and &#039;&#039;Auto-submit jobs&#039;&#039; on, jobs for the new block are submitted. The old block&#039;s results remain on disk under the old block id.&lt;br /&gt;
To instead re-run a single failed job unchanged, use &#039;&#039;&#039;Restart job&#039;&#039;&#039; in the Jobs tab.&lt;br /&gt;
&lt;br /&gt;
== Merging a dataset ==&lt;br /&gt;
# Make sure the runs to merge carry a tag that identifies them (Runs tab) and that their indexing jobs are &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Datasets tab: press &#039;&#039;&#039;New Dataset&#039;&#039;&#039;. Name it, choose the trial and the tag(s), and check that the &#039;&#039;Runs selected&#039;&#039; line shows the number of runs you expect. Choose a reference model, or &#039;&#039;Unknown structure&#039;&#039; with the cell and space group; if the wizard warns that the trial&#039;s symmetry does not match the model, check which of the two is wrong before continuing. Keep &#039;&#039;Include ensemble refinement&#039;&#039; ticked unless time is short. Accept or change the cosym suggestion. Set the resolution limit. Finish.&lt;br /&gt;
# Tick &#039;&#039;&#039;Active Dataset&#039;&#039;&#039;. If asked to confirm the number of jobs, check it is what you expect. With &#039;&#039;Auto-submit jobs&#039;&#039; on, ensemble refinement and scaling jobs are submitted per run, then a merging job once some runs are through. Follow them in the Jobs tab.&lt;br /&gt;
# Merging stats tab: select the dataset. Version &#039;&#039;All&#039;&#039; shows CC1/2 and multiplicity growing as versions accumulate; a single version shows its statistics by resolution.&lt;br /&gt;
# The merged MTZ is &amp;lt;code&amp;gt;&amp;lt;output folder&amp;gt;/&amp;lt;dataset name&amp;gt;/v&amp;lt;NNN&amp;gt;/&amp;lt;name&amp;gt;_v&amp;lt;NNN&amp;gt;_all.mtz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Merging without a reference structure ===&lt;br /&gt;
Choose &#039;&#039;Unknown structure&#039;&#039; in the wizard. The merge is a plain average without per-image scaling. Once it has produced an MTZ, create a second dataset with &#039;&#039;Known reference model&#039;&#039; pointing at that MTZ to get a properly scaled and post-refined merge. If the symmetry has an indexing ambiguity, tick cosym in both datasets; the first merge fixes an arbitrary but consistent indexing frame which the second then anchors to.&lt;br /&gt;
&lt;br /&gt;
=== Merging one crystal form out of a mixture ===&lt;br /&gt;
# Unit Cell tab: select the trial and the tag set and tick &#039;&#039;&#039;Plot clusters&#039;&#039;&#039;. Press &#039;&#039;&#039;Options...&#039;&#039;&#039; to adjust &#039;&#039;Cluster epsilon&#039;&#039; until the forms separate, and to add an angle to the feature vector if that is what tells the forms apart; the &#039;&#039;Cell volume histogram&#039;&#039; side plot shows the clusters&#039; sizes at a glance. Note which component (0 is the largest) is the one you want. The cluster file is written to &amp;lt;code&amp;gt;cluster/&amp;lt;/code&amp;gt; in the output folder.&lt;br /&gt;
# Datasets tab: open the dataset, and in the &#039;&#039;&#039;Scaling&#039;&#039;&#039; stage tick &#039;&#039;&#039;Filter by unit-cell cluster&#039;&#039;&#039;, choose the cluster file, enter the component number and, if needed, a tighter Mahalanobis cutoff. Press OK.&lt;br /&gt;
# The next version merged (restart the scaling jobs from the Jobs tab, or wait for new runs) uses only lattices from that cluster.&lt;br /&gt;
&lt;br /&gt;
== Merging the same runs with different settings ==&lt;br /&gt;
Press the copy button on the dataset. The copy is inactive and starts with the original&#039;s pipeline. Open it, change what you want (resolution limit, reference model, a stage&#039;s parameters), give it a comment saying what differs, and activate it. The original is never affected by edits to the copy. Stages that are unchanged, and everything upstream of the first change, reuse the original&#039;s jobs: a copy that differs only in its merging parameters submits just a merging job, while one with a different scaling filter re-runs scaling and merging but keeps the ensemble refinement.&lt;br /&gt;
&lt;br /&gt;
== Checking detector drift ==&lt;br /&gt;
Merging stats tab: select the dataset and a version, and open the &#039;&#039;&#039;Detector drift&#039;&#039;&#039; page. The detector origin and cell lengths are plotted against run and chunk, read from the ensemble refinement results behind that version (the pipeline must include ensemble refinement). Untick &#039;&#039;Auto update&#039;&#039; to zoom in without the plot being redrawn. A step in the origin between runs suggests the detector moved: give those runs their own run block with a refined reference geometry.&lt;br /&gt;
&lt;br /&gt;
== Stopping and restarting jobs ==&lt;br /&gt;
* To stop submitting new jobs, turn off &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039; or untick the trial or dataset&#039;s &#039;&#039;Active&#039;&#039; box.&lt;br /&gt;
* To stop a running job, select it in the Jobs tab and press &#039;&#039;&#039;Stop job&#039;&#039;&#039;.&lt;br /&gt;
* To re-run a job after fixing the cause of a failure, select it, press &#039;&#039;&#039;Stop job&#039;&#039;&#039; if it is still running, then &#039;&#039;&#039;Restart job&#039;&#039;&#039;. Its old results are deleted and the job sentinel resubmits it.&lt;br /&gt;
* To throw away a trial&#039;s results, delete its jobs in the Jobs tab (untick &#039;&#039;Only display jobs from active trials/blocks&#039;&#039; to see jobs of inactive trials), and leave the trial inactive. The trial itself cannot be deleted.&lt;br /&gt;
&lt;br /&gt;
== Watching an experiment from elsewhere ==&lt;br /&gt;
Start a second GUI with the same project (copy &amp;lt;code&amp;gt;~/.cctbx.xfel/settings_&amp;lt;name&amp;gt;.phil&amp;lt;/code&amp;gt; to the other machine, or set the same credentials by hand) and &amp;lt;code&amp;gt;monitoring_mode=True&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;cctbx.xfel monitoring_mode=True&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Run Stats, Unit Cell and Merging stats tabs work as usual; nothing can be submitted from it. Keep job submission to a single GUI instance.&lt;br /&gt;
&lt;br /&gt;
== Standalone mode with files from another source ==&lt;br /&gt;
# Settings: facility &#039;&#039;Standalone&#039;&#039;; &#039;&#039;&#039;Options...&#039;&#039;&#039;: set the folder, &#039;&#039;&#039;Monitor for&#039;&#039;&#039; &#039;&#039;files&#039;&#039; or &#039;&#039;folders&#039;&#039;, the file template (for example &amp;lt;code&amp;gt;*.h5&amp;lt;/code&amp;gt;) and tick &#039;&#039;Files are composite&#039;&#039; for HDF5 or NeXus files. For one-image-per-file data, use &#039;&#039;folders&#039;&#039; with one folder per run and untick &#039;&#039;composite&#039;&#039;.&lt;br /&gt;
# Proceed as for a live experiment. Run blocks select runs by their order of discovery; the detector geometry comes from the image headers unless a reference geometry is set in the block.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Merging_Stats_tab&amp;diff=1809</id>
		<title>Cctbx.xfel GUI/Merging Stats tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Merging_Stats_tab&amp;diff=1809"/>
		<updated>2026-10-22T22:53:37Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Merging Stats tab}}&lt;br /&gt;
The &#039;&#039;&#039;Merging stats tab&#039;&#039;&#039; shows the merging statistics of each version of a dataset, read from the merging job&#039;s log, the cosym embedding plot when the merge resolved an indexing ambiguity, and the drift of the detector geometry and unit cell over the runs behind a version. The &#039;&#039;Merging Stats Sentinel&#039;&#039; re-reads the logs every 5 seconds while the tab is showing and &#039;&#039;Auto update&#039;&#039; is ticked, so a merge that is still running fills in as it goes.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Selecting a dataset ==&lt;br /&gt;
* &#039;&#039;&#039;Select dataset&#039;&#039;&#039;: the list of datasets; &#039;&#039;&#039;Active only&#039;&#039;&#039; (ticked by default) hides inactive ones.&lt;br /&gt;
* &#039;&#039;&#039;Dataset version&#039;&#039;&#039;: &#039;&#039;All&#039;&#039; or a single version number. Only versions built with the dataset&#039;s current pipeline are listed; a version made with a stage the dataset no longer has is hidden.&lt;br /&gt;
* &#039;&#039;&#039;Auto update&#039;&#039;&#039;: untick to stop the sentinel and freeze the plots, for example to zoom into the drift plot with its toolbar without it being redrawn.&lt;br /&gt;
&lt;br /&gt;
== Statistics page ==&lt;br /&gt;
For a &#039;&#039;&#039;single version&#039;&#039;&#039;, the plot shows the statistics by resolution shell, with resolution along the x axis:&lt;br /&gt;
* &#039;&#039;&#039;% accepted&#039;&#039;&#039; (orange): the fraction of lattices accepted into each resolution shell,&lt;br /&gt;
* &#039;&#039;&#039;Completeness&#039;&#039;&#039; (green) and &#039;&#039;&#039;CC1/2&#039;&#039;&#039; (blue), as percentages on the left axis,&lt;br /&gt;
* &#039;&#039;&#039;Multiplicity&#039;&#039;&#039; (red) and &#039;&#039;&#039;Merged I/sigI&#039;&#039;&#039; (purple) on the right axis.&lt;br /&gt;
&lt;br /&gt;
With &#039;&#039;&#039;All&#039;&#039;&#039; versions selected, the plot shows how the merge improves with data: overall CC1/2 and overall multiplicity against the number of images, and resolution against the number of images, one point per version. This is the plot to watch during collection to decide when enough data have been collected.&lt;br /&gt;
&lt;br /&gt;
The statistics are scraped from the merging log (the &amp;lt;code&amp;gt;*main*&amp;lt;/code&amp;gt; file in the version folder), so they match the tables printed there. Nothing is shown for a version whose merge has not yet written its tables.&lt;br /&gt;
&lt;br /&gt;
== Cosym embedding page ==&lt;br /&gt;
When the merging stage ran &amp;lt;code&amp;gt;modify_cosym&amp;lt;/code&amp;gt; to resolve an indexing ambiguity, it writes an embedding plot: each lattice is a point, and a successful resolution shows as well-separated clusters, one per indexing mode. A single blob means cosym could not separate the modes (too little signal in common between images, or no real ambiguity) and the merged data may be degraded by mis-indexed lattices. This page shows the plot for a single selected version; a selector appears when the job wrote more than one (one per plotting rank). The page explains when no plot is available.&lt;br /&gt;
&lt;br /&gt;
== Detector drift page ==&lt;br /&gt;
This page shows the figure of &amp;lt;code&amp;gt;cctbx.xfel.drift&amp;lt;/code&amp;gt; for the selected version: the detector origin and the unit cell lengths as a function of run and chunk (the pieces ensemble refinement splits each run into), read from the refined experiments the ensemble refinement stage wrote for every run behind the version. Bars along the top give the number of reflections and experiments in each chunk. A drifting origin or cell between runs is a sign that the geometry should be re-refined, or that runs should be split into separate run blocks. With &#039;&#039;All&#039;&#039; versions selected the latest version is shown. The page needs an ensemble refinement stage in the pipeline; without one it says so.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Control !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Origin&#039;&#039;&#039; || Which detector origin to plot per chunk: &#039;&#039;first&#039;&#039; (the first experiment&#039;s), &#039;&#039;average&#039;&#039; (reflection-weighted), &#039;&#039;distribution&#039;&#039; (the whole spread as a heat map), or the same three for the centre of mass of the panels (&#039;&#039;panel_com_...&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Color by&#039;&#039;&#039; || What colours the points: run, run group, chunk, task, trial or dataset version (&#039;&#039;merge&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Unit cell&#039;&#039;&#039; || The reflection-weighted &#039;&#039;average&#039;&#039; cell lengths per chunk, or their whole &#039;&#039;distribution&#039;&#039; as a heat map.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Uncertainties&#039;&#039;&#039; || Error bars on the origin from the mean difference between observed and predicted reflection positions. Roughly doubles the reading time.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Reject outliers&#039;&#039;&#039; || Drop a chunk&#039;s cells whose a, b or c lies more than 1.5 inter-quartile ranges beyond the quartiles within that chunk before averaging or plotting. Off by default.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Reading every chunk&#039;s refined experiments is slow, so the results are cached per chunk in the dataset&#039;s folder (&amp;lt;code&amp;gt;&amp;lt;dataset name&amp;gt;/drift_cache_v&amp;lt;NNN&amp;gt;_*.pkl&amp;lt;/code&amp;gt;) and only new chunks are read on later refreshes; the plot is only computed while this page is showing. The line above the figure reports how many chunks were read and, if any could not be, the first reason.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
* Compare versions, or two datasets merged with different settings, by switching the selection; the plot is redrawn at the panel size, so enlarge the window for more detail.&lt;br /&gt;
* If CC1/2 or completeness is poor in the outer shells, lower the resolution in the dataset&#039;s shared parameters (which creates no new version by itself; a new version is merged when further runs finish, or restart the merging job from the [[cctbx.xfel GUI/Jobs tab|Jobs tab]]).&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Datasets_tab&amp;diff=1808</id>
		<title>Cctbx.xfel GUI/Datasets tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Datasets_tab&amp;diff=1808"/>
		<updated>2026-10-22T22:51:54Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Datasets tab}}&lt;br /&gt;
The &#039;&#039;&#039;Datasets tab&#039;&#039;&#039; takes processed runs through to a merged reflection file. A &#039;&#039;&#039;dataset&#039;&#039;&#039; selects runs from a trial by tag and runs a pipeline of tasks over them: optional ensemble refinement, scaling, merging, and optionally Phenix. Each merge creates a new &#039;&#039;&#039;version&#039;&#039;&#039; of the dataset, and new versions keep appearing as further runs finish, so merged data are available while collection is still going on.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Layout ==&lt;br /&gt;
Each dataset is a box labelled with its id and name, laid out left to right. Inside it:&lt;br /&gt;
* the comment,&lt;br /&gt;
* &#039;&#039;&#039;Tags&#039;&#039;&#039;: the tags that select its runs,&lt;br /&gt;
* &#039;&#039;&#039;Trial&#039;&#039;&#039;: the trial whose results it uses,&lt;br /&gt;
* the numbered pipeline stages, with the resolution limit and reference model name for the scaling and merging stages.&lt;br /&gt;
* &#039;&#039;&#039;Latest: vNNN&#039;&#039;&#039;: the most recent version merged.&lt;br /&gt;
* The magnifying-glass button opens the full [[#The dataset dialog|dataset dialog]] to edit the dataset.&lt;br /&gt;
* The copy button &#039;&#039;&#039;duplicates&#039;&#039;&#039; the dataset: an inactive copy under a new name with the same pipeline, tags and comment. Use it to merge the same runs with a different resolution limit or reference: open the copy, change what you want, and activate it. Whatever stages are unchanged reuse the original&#039;s jobs (see [[#Tasks shared between datasets|Tasks shared between datasets]]).&lt;br /&gt;
* &#039;&#039;&#039;Active Dataset&#039;&#039;&#039;: while ticked, the job sentinel submits the dataset&#039;s jobs. New datasets start inactive. If activating the dataset would submit many jobs, the GUI shows the count by stage and asks before going ahead; the threshold is the &amp;lt;code&amp;gt;job_count_warning&amp;lt;/code&amp;gt; setting, 50 by default.&lt;br /&gt;
&lt;br /&gt;
Below: &#039;&#039;&#039;Filter&#039;&#039;&#039; narrows the list to names containing the text, &#039;&#039;&#039;Show Only Active Datasets&#039;&#039;&#039; hides inactive ones, and &#039;&#039;&#039;New Dataset&#039;&#039;&#039; opens the wizard.&lt;br /&gt;
&lt;br /&gt;
== How a dataset runs ==&lt;br /&gt;
With the dataset active and &#039;&#039;Auto-submit jobs&#039;&#039; on, the job sentinel does the following on every cycle:&lt;br /&gt;
# It finds the dataset&#039;s runs: the runs in the trial&#039;s run blocks that carry the dataset&#039;s tags, combined by the tag operator (&#039;&#039;intersection&#039;&#039;: all of the tags; &#039;&#039;union&#039;&#039;: any of them). A dataset must have at least one tag, and every one of its tags must be in use on the trial&#039;s runs, otherwise it is skipped.&lt;br /&gt;
# For each run it submits the next &#039;&#039;local&#039;&#039; task (ensemble refinement, then scaling) as soon as the previous one has finished with status &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;. Indexing is the trial&#039;s own integration job, so it must be &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt; for the run to enter the pipeline.&lt;br /&gt;
# Once some runs have finished every local task, it creates a new dataset version, links those runs&#039; jobs to it, and submits the &#039;&#039;global&#039;&#039; tasks (merging, then Phenix) for that version. Each time further runs finish, another version is created that includes them. Re-tagging a run out of the dataset also triggers a corrective version, and so does changing the parameters of a merging or Phenix stage: the versions merged with the old settings are kept as they are, and the new settings get a version of their own from the same per-run results.&lt;br /&gt;
&lt;br /&gt;
Versions are numbered from &amp;lt;code&amp;gt;v000&amp;lt;/code&amp;gt; and their output is in &amp;lt;code&amp;gt;&amp;lt;output folder&amp;gt;/&amp;lt;dataset name&amp;gt;/v&amp;lt;NNN&amp;gt;/&amp;lt;/code&amp;gt;; the merged file is &amp;lt;code&amp;gt;&amp;lt;name&amp;gt;_v&amp;lt;NNN&amp;gt;_all.mtz&amp;lt;/code&amp;gt;. Watch the statistics of each version on the [[cctbx.xfel GUI/Merging Stats tab|Merging Stats tab]].&lt;br /&gt;
&lt;br /&gt;
== The new dataset wizard ==&lt;br /&gt;
&#039;&#039;&#039;New Dataset&#039;&#039;&#039; opens a three-step wizard that covers the usual case. Everything it sets can be changed afterwards in the full dialog.&lt;br /&gt;
&lt;br /&gt;
; Step 1, Trial &amp;amp; tags&lt;br /&gt;
: &#039;&#039;&#039;Name&#039;&#039;&#039; (must be unique), the &#039;&#039;&#039;Trial&#039;&#039;&#039; to merge, the &#039;&#039;&#039;Tags&#039;&#039;&#039; selecting its runs and the &#039;&#039;&#039;Tag operator&#039;&#039;&#039;. A line below the controls reports how many of the trial&#039;s runs the selection picks, counted exactly as job submission will count them, for example &#039;&#039;Runs selected: 37 of 52 in trial 12 (intersection of 2 tags)&#039;&#039;. &#039;&#039;None&#039;&#039; means the dataset would run with no data: no tag is ticked, or a ticked tag is not used by any run of that trial.&lt;br /&gt;
; Step 2, Structure&lt;br /&gt;
: &#039;&#039;&#039;Known reference model&#039;&#039;&#039;: give a &#039;&#039;&#039;Reference model&#039;&#039;&#039; file (MTZ or PDB) to scale and post-refine the data against. &#039;&#039;&#039;Unknown structure&#039;&#039;&#039;: give the &#039;&#039;&#039;Unit cell&#039;&#039;&#039; and &#039;&#039;&#039;Space group&#039;&#039;&#039; instead (pre-filled from the trial). With no reference the data are merged as a plain average (a &#039;&#039;mark1&#039;&#039; merge, with no per-image scaling or post-refinement); the resulting MTZ can then serve as the reference model for a second dataset. On leaving this page with a reference model, the wizard compares the model&#039;s symmetry with the trial&#039;s indexing symmetry the way the merge&#039;s unit cell filter will (same Laue group, cells within 10% and 2°). A trial with no known space group, a different Laue group or a cell too far from the model&#039;s would have every image rejected, so the wizard says so and asks whether to continue. It is a warning, not a refusal: it reads the trial&#039;s indexing parameters, and you may know better.&lt;br /&gt;
; Step 3, Options&lt;br /&gt;
: &#039;&#039;&#039;Include ensemble refinement&#039;&#039;&#039; (on by default). &#039;&#039;&#039;Resolve indexing ambiguity (cosym)&#039;&#039;&#039;: ticked automatically when the trial&#039;s symmetry has an indexing ambiguity; the label says how many indexing modes exist and how far the cell is from the higher lattice symmetry that causes them (an exact match means the ambiguity is certain, a degree or two means it is inferred and may or may not be real). &#039;&#039;&#039;Lattice tolerance&#039;&#039;&#039; (5° by default, the value cosym itself uses) is how far the cell may be from a higher lattice symmetry for that symmetry, and the indexing modes it implies, to count; a pseudo-symmetric cell can pick up spurious modes at a loose tolerance, so tighten it until the count matches what the data show. The label recounts the modes as the tolerance changes, and the value is passed to cosym so that it finds the same symmetry. &#039;&#039;&#039;High res. limit&#039;&#039;&#039; (d_min, 1.5 Å by default) and &#039;&#039;&#039;Number of bins&#039;&#039;&#039; for the statistics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Finish&#039;&#039;&#039; creates the dataset, inactive, with an indexing stage, optionally ensemble refinement, scaling and merging.&lt;br /&gt;
&lt;br /&gt;
== The dataset dialog ==&lt;br /&gt;
The magnifying-glass button opens the full &#039;&#039;Dataset Settings&#039;&#039; dialog.&lt;br /&gt;
&lt;br /&gt;
=== Identity and run selection ===&lt;br /&gt;
&#039;&#039;&#039;Name&#039;&#039;&#039;, &#039;&#039;&#039;Comment&#039;&#039;&#039;, &#039;&#039;&#039;Trial&#039;&#039;&#039;, &#039;&#039;&#039;Tags&#039;&#039;&#039; and &#039;&#039;&#039;Tag operator&#039;&#039;&#039; as in the wizard. Changing the trial re-reads its unit cell, space group and integration parameters.&lt;br /&gt;
&lt;br /&gt;
=== Shared parameters (scaling + merging) ===&lt;br /&gt;
These apply to both the scaling and the merging stage so that they agree:&lt;br /&gt;
* &#039;&#039;&#039;Reference&#039;&#039;&#039;: &#039;&#039;Known reference model&#039;&#039; with a &#039;&#039;&#039;Reference model&#039;&#039;&#039; path, or &#039;&#039;No reference model&#039;&#039; with a &#039;&#039;&#039;Unit cell&#039;&#039;&#039; and &#039;&#039;&#039;Space group&#039;&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;High res. limit (d_min)&#039;&#039;&#039;: resolution cut-off for scaling and merging.&lt;br /&gt;
* &#039;&#039;&#039;Resolution scalar&#039;&#039;&#039; (0.96): multiplied by d_min to set the internal limit used when scaling, so that the edge bin is well populated.&lt;br /&gt;
* &#039;&#039;&#039;Number of bins&#039;&#039;&#039;: resolution shells in the statistics tables.&lt;br /&gt;
* &#039;&#039;&#039;Merge anomalous&#039;&#039;&#039;: ticked, Friedel mates are merged. Untick to keep the anomalous signal.&lt;br /&gt;
&lt;br /&gt;
=== Pipeline ===&lt;br /&gt;
Each stage is a box with an &#039;&#039;&#039;Include this stage&#039;&#039;&#039; tick box (except indexing, which is always there) and, for the PHIL-backed stages, an &#039;&#039;&#039;Edit PHIL&#039;&#039;&#039; button that opens the complete parameter set for that program with the simplified controls&#039; values filled in. Anything not covered by the controls, such as the step list, error model or outlier rejection, is set there.&lt;br /&gt;
&lt;br /&gt;
==== Indexing ====&lt;br /&gt;
Uses the trial&#039;s integration results. No settings.&lt;br /&gt;
&lt;br /&gt;
==== Ensemble refinement ====&lt;br /&gt;
Time-dependent ensemble refinement (&amp;lt;code&amp;gt;cctbx.xfel.time_varying_refinement&amp;lt;/code&amp;gt;): the detector geometry and the crystal models of a run are refined together against all of its images, then the images are reintegrated. It improves the agreement between images and so the merging statistics, at the cost of an extra job per run.&lt;br /&gt;
* &#039;&#039;&#039;Pre-split experiments&#039;&#039;&#039;: split the run into chunks locally before submitting, which gives better balanced chunks; otherwise the splitting happens on the cluster, which is faster but counts chunk sizes less accurately.&lt;br /&gt;
* &#039;&#039;&#039;Expand Nave parameters on reintegration&#039;&#039;&#039;: widen the mosaicity model when reintegrating, to recruit more reflections.&lt;br /&gt;
The trial&#039;s integration parameters (gain in particular) are copied into this stage so that reintegration matches the original integration; they are visible under &#039;&#039;Edit PHIL&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Scaling ====&lt;br /&gt;
Per-run filtering and scaling against the reference (&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; up to the scaling and post-refinement steps):&lt;br /&gt;
* &#039;&#039;&#039;Min. correlation&#039;&#039;&#039;: lattices whose intensities correlate with the reference model below this are rejected (-1 keeps everything).&lt;br /&gt;
* &#039;&#039;&#039;Unit cell rel. length tol.&#039;&#039;&#039;: lattices whose cell edges differ from the reference cell by more than this fraction are rejected (0.1 = 10%).&lt;br /&gt;
* &#039;&#039;&#039;Filter by unit-cell cluster (from Unit Cells tab)&#039;&#039;&#039;: instead of the tolerance, accept only lattices within the &#039;&#039;&#039;Mahalanobis cutoff&#039;&#039;&#039; (default 4) of the chosen &#039;&#039;&#039;Cluster component&#039;&#039;&#039; (0 is the largest) of a &#039;&#039;&#039;Cluster file&#039;&#039;&#039; written by the [[cctbx.xfel GUI/Unit Cell tab|Unit Cell tab]]. Files in the output folder&#039;s &amp;lt;code&amp;gt;cluster/&amp;lt;/code&amp;gt; directory are listed; &#039;&#039;&#039;Browse...&#039;&#039;&#039; finds others.&lt;br /&gt;
* &#039;&#039;&#039;Significance filter sigma&#039;&#039;&#039;: for each image, keep reflections out to the highest resolution bin whose mean I/σ(I) is above this value.&lt;br /&gt;
With a reference model this stage scales and post-refines each run; without one it only filters, since the plain average needs neither.&lt;br /&gt;
&lt;br /&gt;
==== Merging ====&lt;br /&gt;
Merges the scaled runs into one MTZ with statistics. It takes everything from the shared parameters; &#039;&#039;Edit PHIL&#039;&#039; exposes the rest (error model, cosym settings, output options). When cosym was requested, this stage runs &amp;lt;code&amp;gt;modify_cosym&amp;lt;/code&amp;gt; to resolve the indexing ambiguity before scaling and merging; the cosym space group, number of dimensions and resolution limit are filled in from the trial&#039;s symmetry and the shared d_min, and are visible under &#039;&#039;Edit PHIL&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Phenix ====&lt;br /&gt;
Runs any Phenix command on the merged MTZ. The text box holds the command on the first line and PHIL parameters on the following lines; &amp;lt;code&amp;gt;&amp;lt;PREVIOUS_TASK_MTZ&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;DATASET_NAME&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;DATASET_VERSION&amp;gt;&amp;lt;/code&amp;gt; are substituted at run time. Needs a &#039;&#039;Phenix setup script&#039;&#039; in [[cctbx.xfel GUI/Settings#Advanced settings|Advanced settings]]. Add it with &#039;&#039;&#039;Add stage&#039;&#039;&#039; at the bottom of the pipeline; a second scaling stage can be added the same way.&lt;br /&gt;
&lt;br /&gt;
=== Validation ===&lt;br /&gt;
On OK the dialog checks that a reference model or a unit cell and space group are given, that every enabled stage&#039;s parameters parse, that no two consecutive stages of the same type have identical parameters (they would compute the same thing twice), and that a merge which resolves an indexing ambiguity and then post-refines has a reference model to anchor to (cosym fixes the indexing only up to an overall choice; without a model, remove &#039;&#039;postrefine&#039;&#039; from the merging step list instead). Saving an &#039;&#039;&#039;active&#039;&#039;&#039; dataset whose changes would submit many jobs asks for confirmation first. Datasets are only written if every check passes.&lt;br /&gt;
&lt;br /&gt;
== Tasks shared between datasets ==&lt;br /&gt;
A stage&#039;s &#039;&#039;&#039;task&#039;&#039;&#039; is identified by what it computes: its type, the trial, its parameters and the task that feeds it. When a dataset is saved, each enabled stage is matched to the existing task with that identity, and a new task is created only when there is none. There is nothing to set up: two datasets whose pipelines agree up to some stage share that stage&#039;s task, and the per-run jobs for it run once. A duplicated dataset therefore starts out sharing all of the original&#039;s tasks, and a dataset that changes only its merging resolution reuses the original&#039;s ensemble refinement and scaling results.&lt;br /&gt;
&lt;br /&gt;
Editing a stage never alters a task another dataset may be using; the dataset simply moves to a different task (an existing one if some other dataset already has those parameters, otherwise a new one). Because a stage&#039;s identity includes the stage before it, changing an early stage gives every later stage a new task too, and their jobs run again. Tasks no dataset uses any more are removed, unless jobs have already run them, in which case they are kept so that their output folders (named after the task id) stay accounted for.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Unit_Cell_tab&amp;diff=1807</id>
		<title>Cctbx.xfel GUI/Unit Cell tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Unit_Cell_tab&amp;diff=1807"/>
		<updated>2026-10-22T22:44:09Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Unit Cell tab}}&lt;br /&gt;
The &#039;&#039;&#039;Unit Cell tab&#039;&#039;&#039; plots histograms of the unit cell parameters of every indexed lattice in a trial, so that you can check that indexing is finding the expected cell, compare samples or conditions, spot polymorphs, and define unit cell clusters for the scaling stage of a dataset to filter on. The plot is redrawn every 15 seconds by the &#039;&#039;Unit Cell Sentinel&#039;&#039; while &#039;&#039;Auto update&#039;&#039; is ticked.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Selecting lattices by tag ==&lt;br /&gt;
The tab compares &#039;&#039;&#039;tag sets&#039;&#039;&#039;. Each tag set is a selection of runs from one trial, and each gets its own colour in the histograms.&lt;br /&gt;
&lt;br /&gt;
# Choose the &#039;&#039;&#039;Trial&#039;&#039;&#039;. The &#039;&#039;Available tags&#039;&#039; list fills with the tags carried by that trial&#039;s runs.&lt;br /&gt;
# Tick one or more tags and choose &#039;&#039;&#039;union&#039;&#039;&#039; (runs carrying any of the tags) or &#039;&#039;&#039;intersection&#039;&#039;&#039; (runs carrying all of them). Ticking no tags selects every run in the trial (the set then shows as a blank entry in the list).&lt;br /&gt;
# Press &#039;&#039;&#039;Add selection&#039;&#039;&#039;. The set appears in &#039;&#039;Tag sets to display&#039;&#039;, named after its tags with &#039;&#039;(u)&#039;&#039; or &#039;&#039;(i)&#039;&#039; for the mode when there is more than one tag.&lt;br /&gt;
# Repeat for further sets, for example one per sample. To drop a set, tick it and press &#039;&#039;&#039;Remove selection&#039;&#039;&#039;; &#039;&#039;&#039;Reset selections&#039;&#039;&#039; clears them all.&lt;br /&gt;
&lt;br /&gt;
== Histogram mode ==&lt;br /&gt;
With &#039;&#039;Plot clusters&#039;&#039; unticked, the plot shows a histogram for each of a, b, c, α, β and γ for each tag set, with the legend giving the number of lattices and the mean and standard deviation of each parameter.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Reject outliers&#039;&#039;&#039;: drop lattices whose parameters fall outside 1.5 times the inter-quartile range before plotting, so that a few mis-indexed images do not stretch the axes.&lt;br /&gt;
* The matplotlib toolbar zooms and saves the figure, and &#039;&#039;Large text&#039;&#039; on the toolbar enlarges the labels.&lt;br /&gt;
&lt;br /&gt;
== Cluster mode ==&lt;br /&gt;
With &#039;&#039;Plot clusters&#039;&#039; ticked (available only when the &amp;lt;code&amp;gt;uc_metrics&amp;lt;/code&amp;gt; package is installed), the lattices of the &#039;&#039;&#039;first&#039;&#039;&#039; tag set are clustered with DBSCAN in the space of a chosen set of cell parameters, the &#039;&#039;&#039;feature vector&#039;&#039;&#039;. The plot shows the clusters projected onto each pair of features, a report of the clusters along the bottom, and beside the projections either a probability plot or a volume histogram (see the options below). Its title names the features used.&lt;br /&gt;
&lt;br /&gt;
The trial&#039;s space group decides which parameters are free to vary: by default the clustering uses a, b, c for orthorhombic and lower symmetry, a, c for tetragonal, hexagonal and rhombohedral on hexagonal axes, and a, α on rhombohedral axes. Cubic cells have only one free parameter and cannot be clustered. The space group comes from the trial&#039;s indexing parameters, so set one in the trial. The features return to these defaults whenever a trial with a different space group is selected.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;Reject outliers&#039;&#039; controls whether the cells the clustering left unassigned are drawn, and whether they set the range of the volume histogram.&lt;br /&gt;
&lt;br /&gt;
=== Cluster options ===&lt;br /&gt;
&#039;&#039;&#039;Options...&#039;&#039;&#039; next to &#039;&#039;Plot clusters&#039;&#039; opens the &#039;&#039;Cluster options&#039;&#039; dialog:&lt;br /&gt;
* &#039;&#039;&#039;Cluster epsilon&#039;&#039;&#039; (default 0.8): the DBSCAN neighbourhood distance. Smaller values give tighter, more numerous clusters.&lt;br /&gt;
* &#039;&#039;&#039;Feature vector&#039;&#039;&#039;: tick boxes for a, b, c, α, β and γ. Parameters the space group fixes are greyed out; at least two must be ticked. Add an angle when two populations differ mainly in it, for example two monoclinic forms with different β.&lt;br /&gt;
* &#039;&#039;&#039;Plot all pairs of features&#039;&#039;&#039;: with more than three features, draw a corner plot of every pair. Otherwise the plot shows the first three features only, and says so in its title.&lt;br /&gt;
* &#039;&#039;&#039;Beside the projections&#039;&#039;&#039;: a &#039;&#039;Probability plot&#039;&#039; of each cluster&#039;s Mahalanobis distances against a normal distribution (a straight line means a well-formed cluster), or a &#039;&#039;Cell volume histogram&#039;&#039; with one step per cluster in the cluster&#039;s colour, which is the quickest way to see how the clusters differ in size.&lt;br /&gt;
&lt;br /&gt;
Each clustering writes a covariance file, &amp;lt;code&amp;gt;cluster/cluster_&amp;lt;tag set name&amp;gt;.pickle&amp;lt;/code&amp;gt; in the output folder, describing the Gaussian mixture components found (component 0 is the largest). The &#039;&#039;&#039;scaling stage&#039;&#039;&#039; of a dataset can filter lattices with this file (&#039;&#039;Filter by unit-cell cluster&#039;&#039; in the [[cctbx.xfel GUI/Datasets tab#Scaling|Datasets tab]]), accepting only lattices within a chosen Mahalanobis distance of a chosen component. This is the way to merge only one polymorph when a sample indexes as a mixture.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
* A multi-modal histogram for a single sample usually means a mixture of crystal forms, or an indexing ambiguity producing permuted axes. Try cluster mode, or tighten the unit cell in the trial.&lt;br /&gt;
* The selection column scrolls when the window is shorter than its contents; the &#039;&#039;Auto update&#039;&#039; box is at its bottom.&lt;br /&gt;
* Compare samples by adding one tag set per sample tag: differences in mean cell between conditions show up directly.&lt;br /&gt;
* Because the sentinel re-queries the database on every cycle, large trials can take a while to redraw; untick &#039;&#039;Auto update&#039;&#039; once the plot is as you want it.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Trials_tab&amp;diff=1806</id>
		<title>Cctbx.xfel GUI/Trials tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Trials_tab&amp;diff=1806"/>
		<updated>2026-10-21T22:50:23Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Trials tab}}&lt;br /&gt;
The &#039;&#039;&#039;Trials tab&#039;&#039;&#039; is where processing is set up. A &#039;&#039;&#039;trial&#039;&#039;&#039; is a numbered set of spot finding, indexing and integration parameters; each trial owns one or more &#039;&#039;&#039;run blocks&#039;&#039;&#039; that say which runs it applies to and how their images should be read. Making a trial &#039;&#039;active&#039;&#039; is what causes jobs to be submitted.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Layout ==&lt;br /&gt;
Each trial is a box labelled with its number and the start of its comment, laid out left to right (scroll horizontally when there are many). Inside each box:&lt;br /&gt;
&lt;br /&gt;
* A list of the trial&#039;s &#039;&#039;&#039;run blocks&#039;&#039;&#039;, one button each, labelled &amp;lt;code&amp;gt;[block id] runs first - last&amp;lt;/code&amp;gt;. An open block shows &amp;lt;code&amp;gt;...&amp;lt;/code&amp;gt; in place of the last run. Click a button to edit the block.&lt;br /&gt;
* &#039;&#039;&#039;New Block&#039;&#039;&#039;: create a run block for this trial (pre-filled from the trial&#039;s last block).&lt;br /&gt;
* &#039;&#039;&#039;Select Blocks&#039;&#039;&#039;: tick which of the run blocks from all trials belong to this trial. This is how a block created in one trial is reused by another. A block that no longer belongs to any trial becomes inactive. On an active trial the selection is processed at once, so the same job-count confirmation applies.&lt;br /&gt;
* The magnifying-glass button shows the trial&#039;s parameters. Everything is read-only except the comment.&lt;br /&gt;
* &#039;&#039;&#039;Active Trial&#039;&#039;&#039;: while ticked, the job sentinel submits an indexing job for every run in every one of this trial&#039;s blocks. Untick to stop submitting new jobs; jobs already running are not affected. If activating the trial would submit many jobs (the indexing jobs, plus whatever the active datasets on the trial would then run), the GUI shows the count by stage and asks before going ahead; the threshold is the &amp;lt;code&amp;gt;job_count_warning&amp;lt;/code&amp;gt; setting, 50 by default.&lt;br /&gt;
&lt;br /&gt;
Below the trials: &#039;&#039;&#039;Show Only Active Trials&#039;&#039;&#039; hides inactive trials, and &#039;&#039;&#039;New Trial&#039;&#039;&#039; opens the trial dialog.&lt;br /&gt;
&lt;br /&gt;
== Creating a trial ==&lt;br /&gt;
&#039;&#039;&#039;New Trial&#039;&#039;&#039; opens the &#039;&#039;New Trial Settings&#039;&#039; dialog. A new trial inherits the parameters and comment of the most recent trial, so you normally change a few values and press OK. Trials are created &#039;&#039;inactive&#039;&#039;; tick &#039;&#039;Active Trial&#039;&#039; when you are ready to process.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Control !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Trial number&#039;&#039;&#039; || Allocated automatically (one more than the highest existing trial).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Import PHIL&#039;&#039;&#039; || Load parameters from a PHIL file. The file is validated against the processing program; unknown parameters are reported and the import is rejected.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Edit PHIL&#039;&#039;&#039; || Open the full parameter set as text (only the values that differ from the program&#039;s defaults are shown). Anything the simplified controls do not cover is set here, for example masks, refinement options or integration settings. Changes are validated when you press OK in the editor and the simplified controls update to match.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Comment&#039;&#039;&#039; || Free text, shown in the trial box and in job listings. Say what you changed.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Overall parameters ===&lt;br /&gt;
* &#039;&#039;&#039;Find spots&#039;&#039;&#039;, &#039;&#039;&#039;Index&#039;&#039;&#039;, &#039;&#039;&#039;Integrate&#039;&#039;&#039;: which stages to run. Untick &#039;&#039;Index&#039;&#039; and &#039;&#039;Integrate&#039;&#039; for a quick hit-finding pass, or to tune spot finding on the Run Stats tab before indexing.&lt;br /&gt;
* &#039;&#039;&#039;Min spots&#039;&#039;&#039;: the minimum number of strong spots an image needs before indexing is attempted (the hit finder threshold). Images below it are logged as non-hits and skipped.&lt;br /&gt;
&lt;br /&gt;
=== Spotfinding parameters ===&lt;br /&gt;
These map onto the DIALS spot finder:&lt;br /&gt;
* &#039;&#039;&#039;Min spot size&#039;&#039;&#039; / &#039;&#039;&#039;Max spot size&#039;&#039;&#039;: pixel count limits for a spot. The minimum removes single-pixel noise; the maximum removes ice rings and bad regions.&lt;br /&gt;
* &#039;&#039;&#039;Sigma background&#039;&#039;&#039; / &#039;&#039;&#039;Sigma strong&#039;&#039;&#039;: the dispersion algorithm&#039;s thresholds, in units of the local background standard deviation. Lower &#039;&#039;sigma strong&#039;&#039; finds weaker spots.&lt;br /&gt;
* &#039;&#039;&#039;Global threshold&#039;&#039;&#039;: absolute pixel value below which nothing counts as signal.&lt;br /&gt;
* &#039;&#039;&#039;Gain&#039;&#039;&#039;: detector gain in ADU per photon. Leave blank to use the value reported by the image format. When integration is on, the same gain is also used to scale the integrated intensity variances.&lt;br /&gt;
* &#039;&#039;&#039;Kernel size&#039;&#039;&#039;: size of the local background window in pixels (two numbers).&lt;br /&gt;
* &#039;&#039;&#039;Threshold algorithm&#039;&#039;&#039;: &#039;&#039;dispersion&#039;&#039; (standard), &#039;&#039;dispersion_extended&#039;&#039; (more sensitive at low resolution) or &#039;&#039;radial_profile&#039;&#039; (radial background subtraction).&lt;br /&gt;
&lt;br /&gt;
=== Indexing parameters ===&lt;br /&gt;
* &#039;&#039;&#039;Unit cell&#039;&#039;&#039; and &#039;&#039;&#039;Space group&#039;&#039;&#039;: the known symmetry, if any. Giving both makes indexing much more reliable; the pair is checked for compatibility.&lt;br /&gt;
* &#039;&#039;&#039;d_min indexing&#039;&#039;&#039;: high-resolution cut-off used during indexing refinement.&lt;br /&gt;
* &#039;&#039;&#039;Max lattices&#039;&#039;&#039;: more than 1 enables multi-lattice indexing of the same image.&lt;br /&gt;
* &#039;&#039;&#039;Reflection subsampling&#039;&#039;&#039;: index on a random subset of the strong spots, which can help with very dense patterns.&lt;br /&gt;
&lt;br /&gt;
=== Other options ===&lt;br /&gt;
* &#039;&#039;&#039;Copy runblocks from&#039;&#039;&#039;: give the new trial the same run blocks as an existing trial, so that a parameter change can be tried on exactly the same runs.&lt;br /&gt;
* &#039;&#039;&#039;Percent events processed&#039;&#039;&#039;: process only this percentage of the images in each run (a throttle for a quick look at a large run).&lt;br /&gt;
* &#039;&#039;&#039;Number of bins&#039;&#039;&#039; and &#039;&#039;&#039;High res. limit&#039;&#039;&#039;: used for logging resolution statistics to the database.&lt;br /&gt;
&lt;br /&gt;
== Run blocks ==&lt;br /&gt;
A run block groups a contiguous range of runs with the detector settings needed to read them. &#039;&#039;&#039;New Block&#039;&#039;&#039; and clicking an existing block open the &#039;&#039;Run Block Settings&#039;&#039; dialog.&lt;br /&gt;
&lt;br /&gt;
=== Run range ===&lt;br /&gt;
* &#039;&#039;&#039;Start run&#039;&#039;&#039;: the first run in the block.&lt;br /&gt;
* &#039;&#039;&#039;Auto add runs&#039;&#039;&#039;: the block has no end; every new run the run sentinel finds is added to it. Use this while collecting data.&lt;br /&gt;
* &#039;&#039;&#039;Specify end run&#039;&#039;&#039; / &#039;&#039;&#039;End run&#039;&#039;&#039;: a closed range.&lt;br /&gt;
&lt;br /&gt;
In standalone mode the start and end are database ids (order of discovery) rather than run numbers, since run names there need not be numeric.&lt;br /&gt;
&lt;br /&gt;
=== Run block settings ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Setting !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Extra XTC format parameters&#039;&#039;&#039; (LCLS) || PHIL text passed to the XTC image format, for example a locator override. &#039;&#039;&#039;Import PHIL&#039;&#039;&#039; loads it from a file.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Detector Address&#039;&#039;&#039; (LCLS) || The detector&#039;s address in the XTC stream, such as &amp;lt;code&amp;gt;CxiDs2.0:Cspad.0&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;MfxEndstation.0:Rayonix.0&amp;lt;/code&amp;gt;. Use the &amp;lt;code&amp;gt;detnames&amp;lt;/code&amp;gt; tool at LCLS to list them.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Beam X, Y, DetZ&#039;&#039;&#039; (LCLS) || Beam centre in pixels and detector distance in mm. Required for Rayonix detectors even when a reference geometry is given (the reference geometry then takes precedence).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;binning&#039;&#039;&#039; (LCLS) || Rayonix binning (2, 3, 4, ...).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;energy&#039;&#039;&#039; / &#039;&#039;&#039;Energy override&#039;&#039;&#039; || Fixed photon energy in eV applied to every image, overriding the per-shot values. Leave blank to use the measured energies.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;wavelength_offset&#039;&#039;&#039; (LCLS) || Offset added to each image&#039;s wavelength, in Å, from the [[cctbx.xfel GUI/Energy tab|Energy tab]] calibration.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;spectrum_eV_per_pixel&#039;&#039;&#039; / &#039;&#039;&#039;spectrum_eV_offset&#039;&#039;&#039; (LCLS) || FEE spectrometer calibration, from the [[cctbx.xfel GUI/Energy tab|Energy tab]].&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;two_theta_low&#039;&#039;&#039; / &#039;&#039;&#039;two_theta_high&#039;&#039;&#039; || Two scattering angles in degrees. The ratio of the radial average at the high angle to that at the low angle is used by the Run Stats tab to count &#039;&#039;solvent hits&#039;&#039; (the defaults are a kapton ring and the water ring).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Untrusted Pixel Mask&#039;&#039;&#039; || A DIALS mask file (&amp;lt;code&amp;gt;.mask&amp;lt;/code&amp;gt;) of pixels to ignore.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Reference geometry&#039;&#039;&#039; || An experiment file (&amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;) whose detector geometry replaces the one from the image headers, typically from a geometry refinement.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Comment&#039;&#039;&#039; || Free text.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Edit PHIL&#039;&#039;&#039; || Any other processing parameter that should apply only to this block (the reference geometry is stored this way, as &amp;lt;code&amp;gt;input.reference_geometry&amp;lt;/code&amp;gt;). Block parameters are combined with the trial&#039;s parameters when a job is submitted.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Editing an existing block ===&lt;br /&gt;
Results on disk are stored by trial and block id, so a block&#039;s settings must not change under results already produced. When you press OK on an existing block:&lt;br /&gt;
* if only the end run, the open/closed state or the comment changed, the block is updated in place (the job sentinel is paused briefly while the runs are re-synced);&lt;br /&gt;
* if anything else changed, the old block is made inactive and a &#039;&#039;&#039;new block&#039;&#039;&#039; with a new id is created and attached to the trial. Jobs for the new block are submitted afresh; the old results stay where they were.&lt;br /&gt;
&lt;br /&gt;
Saving a new or changed block on an &#039;&#039;&#039;active&#039;&#039;&#039; trial starts processing its runs immediately (and a replaced block reprocesses every run it covers), so when that means many jobs the GUI shows the count and asks first.&lt;br /&gt;
&lt;br /&gt;
== What happens next ==&lt;br /&gt;
With a trial active, run blocks attached and &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039; on, the job sentinel submits one job per run in each block, each writing to &amp;lt;code&amp;gt;r&amp;lt;run&amp;gt;/&amp;lt;trial&amp;gt;_rg&amp;lt;block&amp;gt;/&amp;lt;/code&amp;gt; in the output folder. Watch them in the [[cctbx.xfel GUI/Jobs tab|Jobs tab]] and the results in the [[cctbx.xfel GUI/Run Stats tab|Run Stats tab]]. Multiple trials can be active at once, for example to compare two parameter sets on the same runs.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Settings&amp;diff=1805</id>
		<title>Cctbx.xfel GUI/Settings</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Settings&amp;diff=1805"/>
		<updated>2026-10-21T22:45:59Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Settings}}&lt;br /&gt;
The &#039;&#039;&#039;Settings dialog&#039;&#039;&#039; is the first thing the GUI shows when it starts (titled &#039;&#039;CCTBX.XFEL Login&#039;&#039;) and is also opened by the &#039;&#039;&#039;Settings&#039;&#039;&#039; toolbar button. It collects everything the GUI needs to connect to an experiment: the database, the experiment tag, the facility, the output folder, and how jobs are submitted. All of it is saved as a [[cctbx.xfel GUI#Projects (saved settings)|project]].&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== The Settings dialog ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Experiment Tag&#039;&#039;&#039; || Prefix for every database table belonging to this experiment. Use a new tag for a new experiment, or for a clean restart of the same experiment. Locked while the GUI is connected.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;DB Credentials...&#039;&#039;&#039; || Opens the [[#Database credentials|Database credentials]] dialog. Locked while the GUI is connected.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Facility&#039;&#039;&#039; || &#039;&#039;LCLS&#039;&#039; uses the LCLS run database and XTC streams. &#039;&#039;Standalone&#039;&#039; monitors a folder for image files from any other source. &#039;&#039;&#039;Options...&#039;&#039;&#039; opens the facility-specific settings below.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Experiment&#039;&#039;&#039; || LCLS experiment name, for example &amp;lt;code&amp;gt;cxid9114&amp;lt;/code&amp;gt;. Disabled for standalone.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Output&#039;&#039;&#039; || Folder that will receive all processing results. &#039;&#039;&#039;Browse...&#039;&#039;&#039; picks it with a folder chooser. See [[cctbx.xfel GUI#Where the results go|Where the results go]].&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Load Project...&#039;&#039;&#039; || Choose a saved project from a list (sorted by last modified). Loading a project fills in every field. While the GUI is connected, a project whose database connection or experiment tag differs from the current one is refused, since applying it would require a restart.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Save Project As...&#039;&#039;&#039; || Save the current settings under a name. The file is &amp;lt;code&amp;gt;~/.cctbx.xfel/settings_&amp;lt;name&amp;gt;.phil&amp;lt;/code&amp;gt;. The project most recently saved or loaded becomes the default for the next start.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Advanced Settings...&#039;&#039;&#039; || Opens the [[#Advanced settings|Advanced settings]] dialog: multiprocessing, queue and processing back end.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Help&#039;&#039;&#039; || Opens this page in the web browser.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;OK&#039;&#039;&#039; || At start-up: connects to the database, creates the tables if they do not exist, and opens the main window. If no project has been named yet, you are asked to name one first. From the running GUI: applies the changes and saves them to the current project.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Database credentials ==&lt;br /&gt;
Opened with &#039;&#039;&#039;DB Credentials...&#039;&#039;&#039;. The GUI needs a MySQL server it can create tables on.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;DB Host name&#039;&#039;&#039; || Server host. The default is the LCLS user database host, &amp;lt;code&amp;gt;psdb-user.slac.stanford.edu&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;DB Port number&#039;&#039;&#039; || Usually 3306.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;DB name&#039;&#039;&#039; || The database on that server.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;DB user name&#039;&#039;&#039; / &#039;&#039;&#039;DB Password&#039;&#039;&#039; || Account with rights to create and modify tables in that database. The password is cached in plain text in the project file.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Delete and regenerate all tables&#039;&#039;&#039; || Drops every table with the current experiment tag and recreates them empty when you press OK in the Settings dialog. This destroys all records of the experiment (not the files on disk). You are asked to confirm.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;XTC stream location&#039;&#039;&#039; || LCLS only. Where the XTC files are: &amp;lt;code&amp;gt;SLAC&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;SRCF_FFB&amp;lt;/code&amp;gt; (fast feedback, active experiment only), &amp;lt;code&amp;gt;SDF&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;NERSC&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Start DB Server&#039;&#039;&#039; || Launches your own MySQL server if you do not have one. See below.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Starting a local database server ===&lt;br /&gt;
&#039;&#039;&#039;Start DB Server&#039;&#039;&#039; submits a job (&amp;lt;code&amp;gt;cctbx.xfel.ui_server&amp;lt;/code&amp;gt;) that runs a MySQL server using the queuing settings from Advanced settings. It asks for:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DB Base Directory&#039;&#039;&#039;: where the server keeps its data files. Defaults to &amp;lt;code&amp;gt;MySql&amp;lt;/code&amp;gt; inside the output folder. If the directory already contains a database, the server reuses it.&lt;br /&gt;
* &#039;&#039;&#039;DB Root Password&#039;&#039;&#039;: only needed when the base directory is new, to initialise the server. The database, user and password typed in the credentials dialog are created at that point, so fill those in first.&lt;br /&gt;
&lt;br /&gt;
With the &#039;&#039;local&#039;&#039; multiprocessing method the server runs on this machine and the host is set to &amp;lt;code&amp;gt;127.0.0.1&amp;lt;/code&amp;gt;. With Slurm or Shifter the job runs on a compute node and the GUI fills in that node&#039;s host name once the job starts; the server lives as long as the job&#039;s wall time. The GUI waits for the server to accept connections before continuing and reports the server&#039;s error log if it fails. Make sure a server is not already running on the same base directory.&lt;br /&gt;
&lt;br /&gt;
== Facility options ==&lt;br /&gt;
&lt;br /&gt;
=== LCLS options ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Option !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Use ffb (fast feedback) file system&#039;&#039;&#039; || Read XTC data from the fast feedback system. Only for the active experiment on the priority queues.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Dump all images to disk&#039;&#039;&#039; || Write every image as CBF to the job&#039;s &amp;lt;code&amp;gt;all/&amp;lt;/code&amp;gt; folder, whether or not it indexed. Needed for the &#039;&#039;Strong images that didn&#039;t index&#039;&#039; feature of the [[cctbx.xfel GUI/Run Stats tab|Run Stats tab]] and useful when tuning spot finding. Uses a lot of disk space.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Require stream 80 / 81 (FEE spectrometer) before processing&#039;&#039;&#039; || Do not process a run until the FEE spectrometer stream is present, so that per-image wavelengths are available.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Standalone options ===&lt;br /&gt;
In standalone mode the run sentinel watches a folder for new data and turns each file or folder it finds into a run.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Option !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Folder to monitor&#039;&#039;&#039; || The directory new data appear in.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Monitor for&#039;&#039;&#039; || &#039;&#039;files&#039;&#039;: every file in the folder matching the template is a run. &#039;&#039;folders&#039;&#039;: every sub-folder is a run (or, with composite files, each matching file in each sub-folder is a run).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Run complete criteria&#039;&#039;&#039; || For folders. &#039;&#039;Status file&#039;&#039;: the folder is complete when it contains a Cheetah-style &amp;lt;code&amp;gt;status.txt&amp;lt;/code&amp;gt; whose &amp;lt;code&amp;gt;Status&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;Finished&amp;lt;/code&amp;gt;. &#039;&#039;Number of files&#039;&#039;: complete once it holds at least &#039;&#039;&#039;Number of files per run&#039;&#039;&#039; matching files.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Minimum time since last modified&#039;&#039;&#039; / &#039;&#039;&#039;Minimum file size&#039;&#039;&#039; || For files. A file is only picked up once it has been untouched for this many seconds and is at least this many bytes, so that files still being written are not processed.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;File matching template&#039;&#039;&#039; || Glob pattern for data files, for example &amp;lt;code&amp;gt;*.h5&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;*.cbf&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Files are composite&#039;&#039;&#039; || Tick for formats where one file holds many images (HDF5, NeXus): each file becomes its own run. Untick for one-image-per-file formats, where the whole folder becomes a single run.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Run names in standalone mode are derived from the file or folder names (for example &amp;lt;code&amp;gt;run_0012_data&amp;lt;/code&amp;gt; for a composite file &amp;lt;code&amp;gt;data.h5&amp;lt;/code&amp;gt; in folder &amp;lt;code&amp;gt;run_0012&amp;lt;/code&amp;gt;). Run blocks in standalone mode therefore select runs by database id, in order of discovery, rather than by run number.&lt;br /&gt;
&lt;br /&gt;
== Advanced settings ==&lt;br /&gt;
Opened with &#039;&#039;&#039;Advanced Settings...&#039;&#039;&#039;. The controls shown depend on the chosen multiprocessing method.&lt;br /&gt;
&lt;br /&gt;
=== Multiprocessing options ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Option !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Multiprocessing&#039;&#039;&#039; || How jobs are run: &#039;&#039;local&#039;&#039; (on this machine, one job at a time), &#039;&#039;lsf&#039;&#039;, &#039;&#039;slurm&#039;&#039;, &#039;&#039;shifter&#039;&#039; (Slurm with a Shifter container, for NERSC), &#039;&#039;sge&#039;&#039;, &#039;&#039;pbs&#039;&#039;, &#039;&#039;htcondor&#039;&#039; or &#039;&#039;custom&#039;&#039; (a user-supplied submission template, set in the settings file).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Queue&#039;&#039;&#039; || Queue or partition to submit to. A drop-down of the LCLS queues for LSF at LCLS, a free text field otherwise.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Total number of processors&#039;&#039;&#039; || Processes per job (MPI ranks). With the LCLS queues this snaps to the core count of a node.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Total number of nodes&#039;&#039;&#039; / &#039;&#039;&#039;Max Walltime&#039;&#039;&#039; || Shifter only: nodes per job and the time limit in minutes.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Number of processors per node&#039;&#039;&#039; || &#039;&#039;Auto&#039;&#039; lets the queuing system decide; otherwise an explicit count. Together with the total number of processors this determines the node count.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;MPI command&#039;&#039;&#039; || The command that launches MPI programs, for example &amp;lt;code&amp;gt;mpirun&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt;, with any extra arguments.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Environment setup script&#039;&#039;&#039; || A script that is sourced at the start of each job to set up the cctbx environment, when the compute nodes do not inherit yours.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Phenix setup script&#039;&#039;&#039; || Likewise for Phenix, used by Phenix tasks in datasets.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Nodes per job&#039;&#039;&#039; || Slurm, PBS and Shifter: a separate node count for &#039;&#039;Indexing&#039;&#039;, &#039;&#039;TDER&#039;&#039; (time-dependent ensemble refinement), &#039;&#039;Scaling&#039;&#039; and &#039;&#039;Merging&#039;&#039; jobs, since merging usually needs more nodes than indexing a single run.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Extra submission arguments&#039;&#039;&#039; || One per line; appended to the submission command (&amp;lt;code&amp;gt;sbatch&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bsub&amp;lt;/code&amp;gt;, ...). Use this for account names, memory requests and similar.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Shifter settings&#039;&#039;&#039; || Shifter image name, the sbatch and srun script templates, job name, NERSC project (&amp;lt;code&amp;gt;-A&amp;lt;/code&amp;gt;), reservation, constraint, and whether to stage logs to the DataWarp burst buffer.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;HTCondor settings&#039;&#039;&#039; || Path to the MPI executable script (&amp;lt;code&amp;gt;openmpiscript&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;mp2script&amp;lt;/code&amp;gt;) and the shared file system domain.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Two further parameters have no control and are set in the project&#039;s settings file (or on the command line):&lt;br /&gt;
* &amp;lt;code&amp;gt;mp.max_queued&amp;lt;/code&amp;gt; limits how many jobs may be running or queued at once; the job sentinel waits when the limit is reached.&lt;br /&gt;
* &amp;lt;code&amp;gt;job_count_warning&amp;lt;/code&amp;gt; (default 50) is the number of jobs at which activating a trial or dataset, or saving a run block, asks for confirmation first. &amp;lt;code&amp;gt;None&amp;lt;/code&amp;gt; disables the check.&lt;br /&gt;
&lt;br /&gt;
=== Data analysis options ===&lt;br /&gt;
&#039;&#039;&#039;Processing back end&#039;&#039;&#039; chooses the program each indexing job runs:&lt;br /&gt;
* &#039;&#039;cctbx.xfel&#039;&#039; (&amp;lt;code&amp;gt;cctbx.xfel.process&amp;lt;/code&amp;gt;): DIALS spot finding, indexing, refinement and integration with stills-specific defaults. The usual choice.&lt;br /&gt;
* &#039;&#039;Small cell&#039;&#039; (&amp;lt;code&amp;gt;cctbx.xfel.small_cell_process&amp;lt;/code&amp;gt;): small-cell indexing (Brewster 2015) followed by DIALS refinement and integration.&lt;br /&gt;
* &#039;&#039;custom&#039;&#039;: any other program name. Trial parameters are validated against the chosen program&#039;s PHIL scope.&lt;br /&gt;
&lt;br /&gt;
Changing the back end after trials exist is not recommended, since the trials&#039; parameters were written for the previous program.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI&amp;diff=1804</id>
		<title>Cctbx.xfel GUI</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI&amp;diff=1804"/>
		<updated>2026-10-21T22:44:28Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI}}&lt;br /&gt;
The &#039;&#039;&#039;cctbx.xfel GUI&#039;&#039;&#039; is the graphical front end for processing serial crystallography data with cctbx.xfel and DIALS. It watches for new runs as they are collected, submits processing jobs to a cluster or to the local machine, records everything in a database, and shows live feedback on hit rates, indexing rates, unit cells and merging statistics. It can also take a finished set of runs through ensemble refinement, scaling and merging, and on to Phenix.&lt;br /&gt;
&lt;br /&gt;
This page explains the ideas behind the GUI and the layout of the main window. The tabs and dialogs are documented on their own pages, and the GUI&#039;s &#039;&#039;&#039;Help&#039;&#039;&#039; toolbar button opens the page for whichever tab is showing.&lt;br /&gt;
&lt;br /&gt;
== Pages ==&lt;br /&gt;
* [[cctbx.xfel GUI/Settings|Settings and login]]: connecting to the database, choosing the facility, the output folder and the queuing system, saving projects.&lt;br /&gt;
* [[cctbx.xfel GUI/Runs tab|Runs tab]]: the list of runs and their sample tags; image averaging.&lt;br /&gt;
* [[cctbx.xfel GUI/Energy tab|Energy tab]]: FEE spectrometer and ebeam energy calibration (LCLS only).&lt;br /&gt;
* [[cctbx.xfel GUI/Trials tab|Trials tab]]: processing parameters (trials) and which runs they apply to (run blocks).&lt;br /&gt;
* [[cctbx.xfel GUI/Jobs tab|Jobs tab]]: every submitted job and its status; stopping, deleting and restarting jobs.&lt;br /&gt;
* [[cctbx.xfel GUI/Run Stats tab|Run Stats tab]]: live hit rate, indexing rate and resolution plots.&lt;br /&gt;
* [[cctbx.xfel GUI/Unit Cell tab|Unit Cell tab]]: unit cell histograms and clustering.&lt;br /&gt;
* [[cctbx.xfel GUI/Datasets tab|Datasets tab]]: the post-processing pipeline (ensemble refinement, scaling, merging, Phenix).&lt;br /&gt;
* [[cctbx.xfel GUI/Merging Stats tab|Merging Stats tab]]: merging statistics and cosym embedding plots per dataset version.&lt;br /&gt;
* [[cctbx.xfel GUI/Workflows|Workflows]]: step-by-step recipes for common tasks.&lt;br /&gt;
* [[cctbx.xfel GUI/Troubleshooting|Troubleshooting]]: what the red lights mean, where the logs are, and common problems.&lt;br /&gt;
&lt;br /&gt;
== How the GUI works ==&lt;br /&gt;
&lt;br /&gt;
=== Everything lives in a database ===&lt;br /&gt;
The GUI keeps its state in a MySQL database rather than in files. Runs, tags, trials, run blocks, jobs, datasets and the per-image results of processing (spots found, unit cells, resolution, and so on) are all database rows. This has two consequences worth knowing from the start:&lt;br /&gt;
&lt;br /&gt;
* Several copies of the GUI can be connected to the same experiment at once, for example one submitting jobs at the beamline and one just watching the statistics from an office. See &#039;&#039;Monitoring mode&#039;&#039; below.&lt;br /&gt;
* Closing and reopening the GUI loses nothing. Every trial and job is still there when you reconnect.&lt;br /&gt;
&lt;br /&gt;
All tables for one experiment share a prefix called the &#039;&#039;&#039;experiment tag&#039;&#039;&#039; (for example &amp;lt;code&amp;gt;cxi12345_v1&amp;lt;/code&amp;gt;). Changing the experiment tag is effectively starting a fresh, empty experiment in the same database. The tag and the connection settings are entered in the [[cctbx.xfel GUI/Settings|Settings dialog]] when the GUI starts, and cannot be changed without restarting.&lt;br /&gt;
&lt;br /&gt;
The processing jobs themselves write their results to the &#039;&#039;&#039;output folder&#039;&#039;&#039; on disk (see &#039;&#039;Where the results go&#039;&#039; below) and log summaries of each image back to the database as they run. The GUI&#039;s plots are drawn from those database records.&lt;br /&gt;
&lt;br /&gt;
=== Runs and tags ===&lt;br /&gt;
A &#039;&#039;&#039;run&#039;&#039;&#039; is the unit of data collection: at LCLS it is an XTC run number; in standalone mode it is a file or folder of images (see [[cctbx.xfel GUI/Settings#Standalone options|Standalone options]]). The &#039;&#039;&#039;run sentinel&#039;&#039;&#039; polls for new runs and adds them to the database.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tags&#039;&#039;&#039; are free-form labels attached to runs, typically sample names or conditions (&amp;lt;code&amp;gt;lysozyme&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;dark&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;pump_on&amp;lt;/code&amp;gt;, ...). A run can carry any number of tags. Tags are what the later stages use to select data: the Run Stats, Unit Cell and Datasets pages all select runs by tag, so tagging runs consistently as they arrive is the single most useful habit when running the GUI live. The [[cctbx.xfel GUI/Runs tab|Runs tab]] is where tags are created and applied, and &#039;&#039;&#039;persistent tags&#039;&#039;&#039; can be applied automatically to every new run.&lt;br /&gt;
&lt;br /&gt;
=== Trials and run blocks ===&lt;br /&gt;
A &#039;&#039;&#039;trial&#039;&#039;&#039; is a set of processing parameters: spot finding, indexing and integration settings for &amp;lt;code&amp;gt;cctbx.xfel.process&amp;lt;/code&amp;gt; (or whichever back end is configured). Trials are numbered, and a new trial starts as a copy of the previous one so that tuning parameters is a matter of changing a few values and creating a new trial. Trials are never edited after creation (except for their comment); to change parameters, create a new trial. This keeps the provenance of every result unambiguous: results are stored under the trial number that produced them.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;run block&#039;&#039;&#039; (also called a rungroup, and labelled &amp;lt;code&amp;gt;rg&amp;lt;/code&amp;gt; in paths and job listings) is a contiguous range of runs together with the detector and beam settings that apply to them: detector address, beam centre and distance, binning, energy override, reference geometry, pixel mask and so on. A run block can be &#039;&#039;open&#039;&#039; (new runs are added to it automatically as they arrive) or have an explicit end run. Run blocks belong to trials, and the same run block can be shared by several trials.&lt;br /&gt;
&lt;br /&gt;
The GUI submits one processing job for every combination of &#039;&#039;active trial&#039;&#039; × &#039;&#039;run block in that trial&#039;&#039; × &#039;&#039;run in that block&#039;&#039;. Marking a trial active is therefore what starts processing, and deactivating it stops new jobs from being submitted (running jobs continue).&lt;br /&gt;
&lt;br /&gt;
=== Jobs and sentinels ===&lt;br /&gt;
&#039;&#039;&#039;Sentinels&#039;&#039;&#039; are background threads inside the GUI that poll the database and the queuing system. Each has a status light at the bottom of the window (see below). The two most important are toggled from the toolbar:&lt;br /&gt;
&lt;br /&gt;
* The &#039;&#039;&#039;run sentinel&#039;&#039;&#039; (&amp;quot;Watch for new runs&amp;quot;) looks for new runs every 10 seconds, adds them to the database, applies persistent tags, and extends open run blocks to include them.&lt;br /&gt;
* The &#039;&#039;&#039;job sentinel&#039;&#039;&#039; (&amp;quot;Auto-submit jobs&amp;quot;) looks every 10 seconds for work that has not been submitted yet: indexing jobs for active trials, and the pipeline stages of active datasets. It submits them using the multiprocessing settings from the Settings dialog (local, Slurm, LSF, ...).&lt;br /&gt;
&lt;br /&gt;
Because activating a trial or dataset, or saving a run block on an active trial, can commit the queue to a great deal of work, the GUI counts the jobs such an action would submit and asks for confirmation when the total reaches the &amp;lt;code&amp;gt;job_count_warning&amp;lt;/code&amp;gt; setting (50 by default). The message lists the count by stage.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;job monitor&#039;&#039;&#039; queries the queuing system for the status of every unfinished job and records it in the database. It runs while the Jobs or Run Stats tab is showing.&lt;br /&gt;
&lt;br /&gt;
The other sentinels (run stats, unit cell, merging stats, calibration worker) redraw the plots on their tabs and run only while that tab is showing.&lt;br /&gt;
&lt;br /&gt;
=== Datasets, tasks and versions ===&lt;br /&gt;
Indexing and integration produce one result per image. To get a merged reflection file a &#039;&#039;&#039;dataset&#039;&#039;&#039; is needed. A dataset selects runs (one trial, and a set of tags combined by &#039;&#039;intersection&#039;&#039; or &#039;&#039;union&#039;&#039;) and runs a pipeline of &#039;&#039;&#039;tasks&#039;&#039;&#039; over them:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Indexing&#039;&#039;&#039;: the trial&#039;s own integration results (nothing new is run).&lt;br /&gt;
# &#039;&#039;&#039;Ensemble refinement&#039;&#039;&#039; (optional): time-dependent ensemble refinement of detector geometry and crystal models, followed by reintegration, per run.&lt;br /&gt;
# &#039;&#039;&#039;Scaling&#039;&#039;&#039;: filters lattices (unit cell, correlation to a reference) and scales each run against a reference model, or prepares them for a reference-free merge.&lt;br /&gt;
# &#039;&#039;&#039;Merging&#039;&#039;&#039;: merges every scaled run into one MTZ file, with statistics.&lt;br /&gt;
# &#039;&#039;&#039;Phenix&#039;&#039;&#039; (optional): any Phenix command run on the merged MTZ.&lt;br /&gt;
&lt;br /&gt;
The first three are &#039;&#039;local&#039;&#039; tasks that run once per run and chain automatically: each starts when the previous task for that run has finished. Merging and Phenix are &#039;&#039;global&#039;&#039; tasks that run once over all finished runs. Each time merging runs it creates a new &#039;&#039;&#039;dataset version&#039;&#039;&#039; (&amp;lt;code&amp;gt;v000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;v001&amp;lt;/code&amp;gt;, ...). As more runs finish during an experiment, the job sentinel keeps rolling new versions, so the merged data set grows while data are still being collected. Changing the parameters of a merging or Phenix stage also rolls a new version from the same per-run results, and the versions made with the old settings are kept.&lt;br /&gt;
&lt;br /&gt;
Tasks are identified by what they compute: the task type, the trial, the parameters and the task that feeds them. Two datasets whose pipelines agree up to some stage therefore share that stage&#039;s task and its jobs automatically, so a second dataset that merges the same runs with a different resolution limit reuses the ensemble refinement and scaling already done. See the [[cctbx.xfel GUI/Datasets tab|Datasets tab]].&lt;br /&gt;
&lt;br /&gt;
=== Projects (saved settings) ===&lt;br /&gt;
All of the settings entered in the Settings dialog (database connection, experiment tag, facility, output folder, queuing) are saved together as a &#039;&#039;&#039;project&#039;&#039;&#039; in &amp;lt;code&amp;gt;~/.cctbx.xfel/settings_&amp;lt;name&amp;gt;.phil&amp;lt;/code&amp;gt;. The GUI starts with the most recently used project, and the Settings dialog can load or save projects by name, so switching between experiments is a matter of loading a different project. The environment variable &amp;lt;code&amp;gt;CCTBX_XFEL_SETTINGS&amp;lt;/code&amp;gt; can point at an explicit settings file instead.&lt;br /&gt;
&lt;br /&gt;
== The main window ==&lt;br /&gt;
&lt;br /&gt;
=== Toolbar ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Button !! What it does&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Quit&#039;&#039;&#039; || Stops all sentinels, saves the settings and closes the GUI. Jobs already submitted keep running.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Watch for new runs&#039;&#039;&#039; || Starts or stops the run sentinel. The icon changes to a pause symbol while it is running and the &#039;&#039;Run Sentinel&#039;&#039; light turns green.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039; || Starts or stops the job sentinel. While it runs, every active trial and dataset gets its jobs submitted automatically. The &#039;&#039;Job Sentinel&#039;&#039; light turns green.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Settings&#039;&#039;&#039; || Opens the [[cctbx.xfel GUI/Settings|Settings dialog]]. The database connection and experiment tag are locked while the GUI is connected; everything else (output folder, queue, number of processors, facility options) can be changed and takes effect for jobs submitted afterwards.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Large text&#039;&#039;&#039; || Toggles larger text and markers in the Run Stats and Unit Cell plots, for reading from across a control room. Takes effect on the next redraw.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Help&#039;&#039;&#039; || Opens this documentation in the default web browser, at the page for the tab currently showing. Also available from the &#039;&#039;Help&#039;&#039; menu as &#039;&#039;Online help&#039;&#039;. The Settings dialog has a Help button of its own.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Watch for new runs&#039;&#039;, &#039;&#039;Auto-submit jobs&#039;&#039; and &#039;&#039;Settings&#039;&#039; buttons are hidden in monitoring mode.&lt;br /&gt;
&lt;br /&gt;
=== Tabs ===&lt;br /&gt;
The tabs, from left to right: [[cctbx.xfel GUI/Runs tab|Runs]], [[cctbx.xfel GUI/Energy tab|Energy]] (LCLS only), [[cctbx.xfel GUI/Trials tab|Trials]], [[cctbx.xfel GUI/Jobs tab|Jobs]], [[cctbx.xfel GUI/Run Stats tab|Run Stats]], [[cctbx.xfel GUI/Unit Cell tab|Unit Cell]], [[cctbx.xfel GUI/Datasets tab|Datasets]] and [[cctbx.xfel GUI/Merging Stats tab|Merging stats]]. They follow the order of a typical experiment: tag the runs, set up a trial, watch the jobs and the statistics, build a dataset, and watch the merging statistics.&lt;br /&gt;
&lt;br /&gt;
Switching to a tab starts the sentinel that feeds it and switching away stops it, so only the visible tab costs database queries.&lt;br /&gt;
&lt;br /&gt;
=== Status lights ===&lt;br /&gt;
A row of lights along the bottom of the window shows the state of each background thread.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Colour !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| grey (off) || The thread is not running.&lt;br /&gt;
|-&lt;br /&gt;
| green (on) || The thread is running and waiting for its next cycle.&lt;br /&gt;
|-&lt;br /&gt;
| yellow || The thread is in the middle of a cycle (querying the database or the queue, or redrawing a plot).&lt;br /&gt;
|-&lt;br /&gt;
| red (alert) || The thread hit an error and has stopped. The error is printed in the terminal the GUI was started from. See [[cctbx.xfel GUI/Troubleshooting|Troubleshooting]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Light !! Thread !! Runs when&lt;br /&gt;
|-&lt;br /&gt;
| Run Sentinel || Finds new runs || &#039;&#039;Watch for new runs&#039;&#039; is on&lt;br /&gt;
|-&lt;br /&gt;
| Calib Worker || Runs FEE and ebeam calibrations || The Energy tab is showing&lt;br /&gt;
|-&lt;br /&gt;
| Job Sentinel || Submits jobs || &#039;&#039;Auto-submit jobs&#039;&#039; is on&lt;br /&gt;
|-&lt;br /&gt;
| Job Monitor || Tracks job status in the queue || The Jobs or Run Stats tab is showing&lt;br /&gt;
|-&lt;br /&gt;
| Run Stats Sentinel || Redraws the Run Stats plot (every 5 s) || The Run Stats tab is showing and &#039;&#039;Auto update&#039;&#039; is ticked&lt;br /&gt;
|-&lt;br /&gt;
| Unit Cell Sentinel || Redraws the unit cell plot (every 15 s) || The Unit Cell tab is showing and &#039;&#039;Auto update&#039;&#039; is ticked&lt;br /&gt;
|-&lt;br /&gt;
| Merging Stats Sentinel || Redraws the merging statistics and the drift plot (every 5 s) || The Merging stats tab is showing and &#039;&#039;Auto update&#039;&#039; is ticked&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Monitoring mode ===&lt;br /&gt;
Starting the GUI with &amp;lt;code&amp;gt;monitoring_mode=True&amp;lt;/code&amp;gt; (in the settings file or on the command line) gives a read-only view of an experiment: the Runs, Trials, Jobs and Datasets tabs and the submit buttons are hidden, leaving the Run Stats, Unit Cell and Merging stats tabs. Use it for a second copy of the GUI connected to the same database, so that only one copy submits jobs.&lt;br /&gt;
&lt;br /&gt;
== Where the results go ==&lt;br /&gt;
Everything written by jobs goes under the &#039;&#039;output folder&#039;&#039; chosen in the Settings dialog.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Path !! Contents&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;r0012/003_rg005/&amp;lt;/code&amp;gt; || Indexing and integration results for run 12, trial 3, run block 5. Inside: &amp;lt;code&amp;gt;out/&amp;lt;/code&amp;gt; holds the integrated experiments and reflections (&amp;lt;code&amp;gt;*_integrated.expt&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;*_integrated.refl&amp;lt;/code&amp;gt;); &amp;lt;code&amp;gt;stdout/log.out&amp;lt;/code&amp;gt; is the job log; &amp;lt;code&amp;gt;all/&amp;lt;/code&amp;gt; holds every image converted to CBF when &#039;&#039;Dump all images&#039;&#039; is on (LCLS). In standalone mode with non-numeric run names the folder is named after the run instead of &amp;lt;code&amp;gt;r0012&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;r0012/003_rg005/task007/&amp;lt;/code&amp;gt; || Results of dataset task 7 (ensemble refinement or scaling) for that run, trial and block.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;&amp;lt;dataset name&amp;gt;/v001/&amp;lt;/code&amp;gt; || Merging output for version 1 of a dataset: the merged MTZ (&amp;lt;code&amp;gt;&amp;lt;name&amp;gt;_v001_all.mtz&amp;lt;/code&amp;gt;), the merging log, and the cosym embedding plots if cosym ran. Phenix tasks write here too. The dataset folder also holds the cache files of the Merging stats tab&#039;s detector drift page (&amp;lt;code&amp;gt;drift_cache_v001_*.pkl&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;averages/&amp;lt;/code&amp;gt; || Average, maximum and standard deviation images from the Runs tab &#039;&#039;Average&#039;&#039; button.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cluster/&amp;lt;/code&amp;gt; || Unit cell cluster files written by the Unit Cell tab, for use by the scaling stage of a dataset.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MySql/&amp;lt;/code&amp;gt; || Data files of a locally started database server (default location).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The GUI&#039;s own files are in &amp;lt;code&amp;gt;~/.cctbx.xfel/&amp;lt;/code&amp;gt;: the project settings bundles and a &amp;lt;code&amp;gt;cfgs/&amp;lt;/code&amp;gt; folder holding the PHIL and locator files generated for every job.&lt;br /&gt;
&lt;br /&gt;
== Starting the GUI ==&lt;br /&gt;
&amp;lt;pre&amp;gt;cctbx.xfel&amp;lt;/pre&amp;gt;&lt;br /&gt;
opens the login (Settings) dialog followed by the main window. &amp;lt;code&amp;gt;cctbx.xfel -h&amp;lt;/code&amp;gt; prints every configuration parameter with its help text; any of them can be given on the command line, for example &amp;lt;code&amp;gt;cctbx.xfel monitoring_mode=True&amp;lt;/code&amp;gt;. The GUI prints progress and error messages to the terminal it was started from, so keep that terminal visible.&lt;br /&gt;
&lt;br /&gt;
Older documentation: [http://cci.lbl.gov/publications/download/CCN_2019_p22_Brewster.pdf Brewster et al. (2019), Computational Crystallography Newsletter 10, 22].&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Main_Page&amp;diff=1803</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Main_Page&amp;diff=1803"/>
		<updated>2026-10-14T20:59:37Z</updated>

		<summary type="html">&lt;p&gt;Aaron: /* cctbx.xfel resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;News! See our [[https://doi.org/10.1101/2025.05.04.652045 new preprint]]!  This paper shows current best practices using &#039;&#039;cctbx.xfel&#039;&#039; with &#039;&#039;DIALS&#039;&#039; for serial crystallographic data.&lt;br /&gt;
&lt;br /&gt;
= Open-source tools for serial crystallographic data processing =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;cctbx.xfel&#039;&#039; is a suite of software tools designed to process diffraction data from serial femtosecond crystallography (SFX) measurements at an X-ray free-electron laser (XFEL) or a synchrotron.  Built on the Computational Crystallographic Toolbox ([https://cctbx.github.io/ &#039;&#039;cctbx&#039;&#039;]), the same toolbox on which [http://www.phenix-online.org &#039;&#039;PHENIX&#039;&#039;], and [http://dials.github.io DIALS] are built, it enables the user to solve difficult problems relating to processing serial crystallographic data.  The programs and modules provided by &#039;&#039;cctbx.xfel&#039;&#039; can reduce a large set of still diffraction images recorded at Stanford’s Linac Coherent Light Source ([http://lcls.slac.stanford.edu LCLS]), [http://sacla.xfel.jp SACLA], the [https://www.xfel.eu/ European XFEL], or a synchrotron, to a single MTZ file containing merged reflection intensities suitable for structure solution.&lt;br /&gt;
&lt;br /&gt;
== &#039;&#039;cctbx.xfel&#039;&#039; resources ==&lt;br /&gt;
&lt;br /&gt;
The current best resource is our pre-print, [https://doi.org/10.1101/2025.05.04.652045 &#039;&#039;cctbx.xfel: a suite for processing serial crystallographic data.&#039;&#039;].  This paper describes the algorithms and ideas behind the implementation and execution of the two main programs of &#039;&#039;cctbx.xfel&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
* [[Cctbx.xfel_GUI|&#039;&#039;cctbx.xfel&#039;&#039; GUI]]: this is the graphical user interface for &#039;&#039;cctbx.xfel&#039;&#039;.  Useful for auto-submitting processing and real-time feedback on hitrates and data quality.&lt;br /&gt;
* &#039;&#039;[[Dials.stills_process|dials.stills_process]]&#039;&#039;: this program runs through all the first steps of processing data using dials: import (reading image headers), spot finding, indexing, geometry refinement, and integration.  Serial images are independent from each other, so this program is optimized for massively parallel systems, but can be adapted to a variety of single and multi-processing modes.&lt;br /&gt;
* &#039;&#039;[[Cctbx.xfel.merge|cctbx.xfel.merge]]&#039;&#039;: this program runs through the remaining steps of processing: scaling and merging to produce a full dataset (.mtz file).  For documentation, see our [https://github.com/cctbx/cctbx_project/tree/master/xfel/merging Github project]&lt;br /&gt;
&lt;br /&gt;
Additional resources:&lt;br /&gt;
&lt;br /&gt;
* Our [http://cci.lbl.gov/publications/download/CCN_2019_p22_Brewster.pdf 2019 newsletter article] describes how to use the &#039;&#039;cctbx.xfel&#039;&#039; GUI, an interactive program for handling large XFEL datasets.&lt;br /&gt;
&lt;br /&gt;
* [[Overview]] to the system architecture at LCLS and real-time progress monitoring of data processing&lt;br /&gt;
* Installation: there are two ways to get &#039;&#039;cctbx.xfel&#039;&#039;:&lt;br /&gt;
** &#039;&#039;cctbx.xfel&#039;&#039; is installed for general use at SLAC.  To start using an existing installation, [[Using the pre-built cctbx at LCLS|simply source the current build]]. &lt;br /&gt;
** [https://dials.github.io/installation.html Download] a binary bundle of DIALS. Use this option if you will not be processing LCLS data because, for example, if you have serial crystallographic data from a synchrotron.&lt;br /&gt;
** Build a psana/cctbx.xfel build [https://github.com/cctbx/cctbx_project/tree/master/xfel/conda_envs from scratch]. Use this option if you want to process LCLS data outside of LCLS or want your own build.&lt;br /&gt;
* [[Tutorials]] on pre-processing, data reduction, and merging. &lt;br /&gt;
&lt;br /&gt;
Other related information:&lt;br /&gt;
&lt;br /&gt;
* [[Serial XFEL Crystallography References]]&lt;br /&gt;
&lt;br /&gt;
This project is under active development.  For any assistance, please contact the authors.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Troubleshooting&amp;diff=1802</id>
		<title>Cctbx.xfel GUI/Troubleshooting</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Troubleshooting&amp;diff=1802"/>
		<updated>2026-10-09T22:35:10Z</updated>

		<summary type="html">&lt;p&gt;Aaron: Created page with &amp;quot;{{DISPLAYTITLE:cctbx.xfel GUI/Troubleshooting}} What to check when something does not behave. The GUI prints errors and progress to the terminal it was started from, so that terminal is always the first place to look.  Back to cctbx.xfel GUI.  == A status light is red == A red light means that thread hit an exception and stopped; the traceback is in the terminal. Common causes: the database connection dropped (the server was restarted or the job running it ended), th...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Troubleshooting}}&lt;br /&gt;
What to check when something does not behave. The GUI prints errors and progress to the terminal it was started from, so that terminal is always the first place to look.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== A status light is red ==&lt;br /&gt;
A red light means that thread hit an exception and stopped; the traceback is in the terminal. Common causes: the database connection dropped (the server was restarted or the job running it ended), the queuing system command failed (&amp;lt;code&amp;gt;squeue&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;bjobs&amp;lt;/code&amp;gt; not on the path), or a run block refers to a run that no longer exists. Fix the cause, then restart the thread: toggle &#039;&#039;&#039;Watch for new runs&#039;&#039;&#039; or &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039; off and on, or switch away from and back to the tab for the tab-specific sentinels. If the database itself is gone, restart the GUI.&lt;br /&gt;
&lt;br /&gt;
== No runs appear ==&lt;br /&gt;
* &#039;&#039;Watch for new runs&#039;&#039; must be on (the Run Sentinel light green).&lt;br /&gt;
* LCLS: check the experiment name and the XTC stream location in the credentials dialog, and that the run database web service is reachable from this machine.&lt;br /&gt;
* Standalone: check the folder, the template (it is a glob, so &amp;lt;code&amp;gt;*.h5&amp;lt;/code&amp;gt;, not &amp;lt;code&amp;gt;.h5&amp;lt;/code&amp;gt;), and the completion criteria; a file younger than &#039;&#039;Minimum time since last modified&#039;&#039; or smaller than &#039;&#039;Minimum file size&#039;&#039; is not picked up yet. Folders need the status file or the required number of files.&lt;br /&gt;
&lt;br /&gt;
== Jobs are not submitted ==&lt;br /&gt;
* &#039;&#039;Auto-submit jobs&#039;&#039; must be on, the trial must be &#039;&#039;&#039;active&#039;&#039;&#039;, and it must have a run block containing the runs.&lt;br /&gt;
* In &#039;&#039;local&#039;&#039; mode only one job runs at a time; the next is submitted when it finishes.&lt;br /&gt;
* &amp;lt;code&amp;gt;mp.max_queued&amp;lt;/code&amp;gt; in the settings file limits the number of queued and running jobs.&lt;br /&gt;
* For datasets: the dataset must be active and must have at least one tag; all its tags must be in use on the trial&#039;s runs; the runs&#039; indexing jobs must be &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;; and each stage waits for the previous stage of the same run to be &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;. A failed stage (&amp;lt;code&amp;gt;EXIT&amp;lt;/code&amp;gt;) blocks the rest of the pipeline for that run until it is restarted.&lt;br /&gt;
* Watch the terminal: the job sentinel prints what it submits and why it is waiting.&lt;br /&gt;
&lt;br /&gt;
== A job fails immediately (S_FAIL or EXIT) ==&lt;br /&gt;
Open the job&#039;s log: &amp;lt;code&amp;gt;&amp;lt;output folder&amp;gt;/r&amp;lt;run&amp;gt;/&amp;lt;trial&amp;gt;_rg&amp;lt;block&amp;gt;/stdout/log.out&amp;lt;/code&amp;gt; for indexing jobs, and the queue&#039;s error file next to it. Typical causes are a wrong detector address, a mask or reference geometry file that the compute nodes cannot read, an environment script that does not set up cctbx, or a PHIL parameter that the processing program rejects. After fixing, use &#039;&#039;&#039;Restart job&#039;&#039;&#039; in the Jobs tab (or, for a run block change, let the new block&#039;s jobs run).&lt;br /&gt;
&lt;br /&gt;
== Images index poorly ==&lt;br /&gt;
* Check the unit cell and space group in the trial, and the detector distance and beam centre in the run block (an average image from the Runs tab helps with the latter).&lt;br /&gt;
* In the Run Stats tab, many grey points high in the strong spots panel are hits that did not index: look at some of those images.&lt;br /&gt;
* Too many or too few spots: adjust the spot finding thresholds in a new trial and compare.&lt;br /&gt;
&lt;br /&gt;
== The Run Stats plot is empty ==&lt;br /&gt;
A trial must be selected, and runs ticked (or &#039;&#039;Auto plot last five runs&#039;&#039; pressed). Only runs whose jobs have logged results show up; a run whose job is still pending has nothing to plot yet. If &#039;&#039;Auto update&#039;&#039; is unticked the plot does not refresh.&lt;br /&gt;
&lt;br /&gt;
== The cosym page says there is no plot ==&lt;br /&gt;
The embedding plot is only written when the merging stage runs &amp;lt;code&amp;gt;modify_cosym&amp;lt;/code&amp;gt;, and only for a single selected version. Check the merging stage&#039;s step list under &#039;&#039;Edit PHIL&#039;&#039; and that the merging job is &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== The GUI refuses to load a project ==&lt;br /&gt;
While the GUI is connected, a project with a different database connection or experiment tag cannot be loaded. Quit and start the GUI again; the login dialog can load any project.&lt;br /&gt;
&lt;br /&gt;
== Resetting an experiment ==&lt;br /&gt;
To start again with an empty database but the same experiment tag, tick &#039;&#039;Delete and regenerate all tables&#039;&#039; in the credentials dialog at login. This erases every run, trial, job and logged result for that tag (the files on disk are untouched, so delete or move the output folder as well if you want a clean slate). Using a new experiment tag instead keeps the old records available.&lt;br /&gt;
&lt;br /&gt;
== Getting help ==&lt;br /&gt;
The &#039;&#039;About&#039;&#039; entry in the Help menu lists the authors. Questions and bug reports go to the cctbx.xfel developers; include the terminal output and the relevant job log.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Workflows&amp;diff=1801</id>
		<title>Cctbx.xfel GUI/Workflows</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Workflows&amp;diff=1801"/>
		<updated>2026-10-09T22:32:28Z</updated>

		<summary type="html">&lt;p&gt;Aaron: Created page with &amp;quot;{{DISPLAYTITLE:cctbx.xfel GUI/Workflows}} Step-by-step recipes for the common things done with the cctbx.xfel GUI. Each step names the tab or dialog it happens in; see the tab pages for the details of every control.  Back to cctbx.xfel GUI.  == Setting up a new experiment == # Start &amp;lt;code&amp;gt;cctbx.xfel&amp;lt;/code&amp;gt;. In the login dialog press &amp;#039;&amp;#039;&amp;#039;DB Credentials...&amp;#039;&amp;#039;&amp;#039; and enter the database server, database, user and password. If you have no server, fill those in anyway and pres...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Workflows}}&lt;br /&gt;
Step-by-step recipes for the common things done with the cctbx.xfel GUI. Each step names the tab or dialog it happens in; see the tab pages for the details of every control.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Setting up a new experiment ==&lt;br /&gt;
# Start &amp;lt;code&amp;gt;cctbx.xfel&amp;lt;/code&amp;gt;. In the login dialog press &#039;&#039;&#039;DB Credentials...&#039;&#039;&#039; and enter the database server, database, user and password. If you have no server, fill those in anyway and press &#039;&#039;&#039;Start DB Server&#039;&#039;&#039; (see [[cctbx.xfel GUI/Settings#Starting a local database server|starting a local server]]).&lt;br /&gt;
# Enter a new &#039;&#039;&#039;Experiment Tag&#039;&#039;&#039; for this experiment, choose the &#039;&#039;&#039;Facility&#039;&#039;&#039; and, at LCLS, the &#039;&#039;&#039;Experiment&#039;&#039;&#039; name; in standalone mode press &#039;&#039;&#039;Options...&#039;&#039;&#039; and set the folder to monitor and the file template.&lt;br /&gt;
# Choose the &#039;&#039;&#039;Output&#039;&#039;&#039; folder (on a file system the compute nodes can write to).&lt;br /&gt;
# Press &#039;&#039;&#039;Advanced Settings...&#039;&#039;&#039; and set the multiprocessing method, queue, number of processors and environment script for your cluster. Press OK.&lt;br /&gt;
# Press &#039;&#039;&#039;Save Project As...&#039;&#039;&#039; and name the project, then &#039;&#039;&#039;OK&#039;&#039;&#039;. The main window opens.&lt;br /&gt;
# On the toolbar press &#039;&#039;&#039;Watch for new runs&#039;&#039;&#039;. Runs appear in the Runs tab.&lt;br /&gt;
&lt;br /&gt;
== Processing runs as they are collected ==&lt;br /&gt;
# &#039;&#039;&#039;Runs tab&#039;&#039;&#039;: press &#039;&#039;&#039;Manage Tags&#039;&#039;&#039; and create tags for your samples; press &#039;&#039;&#039;Manage Persistent Tags&#039;&#039;&#039; and tick the tag for the sample currently on the beam, so that every new run gets it. Change the persistent tags when the sample changes.&lt;br /&gt;
# &#039;&#039;&#039;Trials tab&#039;&#039;&#039;: press &#039;&#039;&#039;New Trial&#039;&#039;&#039;. Enter the unit cell and space group if known, adjust spot finding if needed, and press OK. In the new trial press &#039;&#039;&#039;New Block&#039;&#039;&#039;: set the start run, leave &#039;&#039;&#039;Auto add runs&#039;&#039;&#039; selected, enter the detector address, beam centre and distance (LCLS), any mask or reference geometry, and press OK. Tick &#039;&#039;&#039;Active Trial&#039;&#039;&#039;.&lt;br /&gt;
# On the toolbar press &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039;. The job sentinel now submits a job for every run in the block and for each new run as it arrives.&lt;br /&gt;
# &#039;&#039;&#039;Jobs tab&#039;&#039;&#039;: confirm the jobs reach &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt; and then &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;. If one shows &amp;lt;code&amp;gt;EXIT&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;S_FAIL&amp;lt;/code&amp;gt;, read its log (see [[cctbx.xfel GUI/Troubleshooting|Troubleshooting]]).&lt;br /&gt;
# &#039;&#039;&#039;Run Stats tab&#039;&#039;&#039;: select the trial and press &#039;&#039;&#039;Auto plot last five runs&#039;&#039;&#039;. Leave this tab showing during collection.&lt;br /&gt;
# &#039;&#039;&#039;Unit Cell tab&#039;&#039;&#039;: select the trial, add a tag set for the sample, and check that the cell histograms are single peaks at the expected values.&lt;br /&gt;
&lt;br /&gt;
== Tuning spot finding and indexing ==&lt;br /&gt;
# Make a new trial (it copies the previous one) and change one thing: for example lower &#039;&#039;Sigma strong&#039;&#039; or set &#039;&#039;Min spot size&#039;&#039;. Use &#039;&#039;&#039;Copy runblocks from&#039;&#039;&#039; the previous trial so both trials cover the same runs, or give the new trial a block with an explicit end run covering a few representative runs.&lt;br /&gt;
# Activate the new trial. Both trials can be active at once; jobs for the new trial appear in the Jobs tab.&lt;br /&gt;
# In the Run Stats tab switch between the two trials and compare the strong spot counts, indexing rate and resolution for the same runs.&lt;br /&gt;
# Deactivate the trial you will not use, so it stops consuming queue time on new runs.&lt;br /&gt;
&lt;br /&gt;
== Reprocessing after a change to a run block ==&lt;br /&gt;
Detector settings live in run blocks, and results are stored per block. To reprocess runs with a new geometry or mask:&lt;br /&gt;
# Trials tab: click the block, change the setting (for example &#039;&#039;Reference geometry&#039;&#039;) and press OK. Because a setting other than the end run or comment changed, the old block is deactivated and a new block is created in the trial.&lt;br /&gt;
# With the trial active and &#039;&#039;Auto-submit jobs&#039;&#039; on, jobs for the new block are submitted. The old block&#039;s results remain on disk under the old block id.&lt;br /&gt;
To instead re-run a single failed job unchanged, use &#039;&#039;&#039;Restart job&#039;&#039;&#039; in the Jobs tab.&lt;br /&gt;
&lt;br /&gt;
== Merging a dataset ==&lt;br /&gt;
# Make sure the runs to merge carry a tag that identifies them (Runs tab) and that their indexing jobs are &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;.&lt;br /&gt;
# Datasets tab: press &#039;&#039;&#039;New Dataset&#039;&#039;&#039;. Name it, choose the trial and the tag(s). Choose a reference model, or &#039;&#039;Unknown structure&#039;&#039; with the cell and space group. Keep &#039;&#039;Include ensemble refinement&#039;&#039; ticked unless time is short. Accept or change the cosym suggestion. Set the resolution limit. Finish.&lt;br /&gt;
# Tick &#039;&#039;&#039;Active Dataset&#039;&#039;&#039;. With &#039;&#039;Auto-submit jobs&#039;&#039; on, ensemble refinement and scaling jobs are submitted per run, then a merging job once some runs are through. Follow them in the Jobs tab.&lt;br /&gt;
# Merging stats tab: select the dataset. Version &#039;&#039;All&#039;&#039; shows CC1/2 and multiplicity growing as versions accumulate; a single version shows its statistics by resolution.&lt;br /&gt;
# The merged MTZ is &amp;lt;code&amp;gt;&amp;lt;output folder&amp;gt;/&amp;lt;dataset name&amp;gt;/v&amp;lt;NNN&amp;gt;/&amp;lt;name&amp;gt;_v&amp;lt;NNN&amp;gt;_all.mtz&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Merging without a reference structure ===&lt;br /&gt;
Choose &#039;&#039;Unknown structure&#039;&#039; in the wizard. The merge is a plain average without per-image scaling. Once it has produced an MTZ, create a second dataset with &#039;&#039;Known reference model&#039;&#039; pointing at that MTZ to get a properly scaled and post-refined merge. If the symmetry has an indexing ambiguity, tick cosym in both datasets; the first merge fixes an arbitrary but consistent indexing frame which the second then anchors to.&lt;br /&gt;
&lt;br /&gt;
=== Merging one crystal form out of a mixture ===&lt;br /&gt;
# Unit Cell tab: select the trial and the tag set, tick &#039;&#039;&#039;Plot clusters&#039;&#039;&#039;, and adjust &#039;&#039;Cluster epsilon&#039;&#039; until the forms separate. Note which component (0 is the largest) is the one you want. The cluster file is written to &amp;lt;code&amp;gt;cluster/&amp;lt;/code&amp;gt; in the output folder.&lt;br /&gt;
# Datasets tab: open the dataset, and in the &#039;&#039;&#039;Scaling&#039;&#039;&#039; stage tick &#039;&#039;&#039;Filter by unit-cell cluster&#039;&#039;&#039;, choose the cluster file, enter the component number and, if needed, a tighter Mahalanobis cutoff. Press OK.&lt;br /&gt;
# The next version merged (restart the scaling jobs from the Jobs tab, or wait for new runs) uses only lattices from that cluster.&lt;br /&gt;
&lt;br /&gt;
== Merging the same runs with different settings ==&lt;br /&gt;
Press the copy button on the dataset. The copy is inactive and shares the original&#039;s tasks. Open it, change what you want (resolution limit, reference model, a stage&#039;s parameters); when asked, choose &#039;&#039;&#039;Detach&#039;&#039;&#039; so the original is unaffected. Give the copy a comment saying what differs, then activate it.&lt;br /&gt;
&lt;br /&gt;
== Stopping and restarting jobs ==&lt;br /&gt;
* To stop submitting new jobs, turn off &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039; or untick the trial or dataset&#039;s &#039;&#039;Active&#039;&#039; box.&lt;br /&gt;
* To stop a running job, select it in the Jobs tab and press &#039;&#039;&#039;Stop job&#039;&#039;&#039;.&lt;br /&gt;
* To re-run a job after fixing the cause of a failure, select it, press &#039;&#039;&#039;Stop job&#039;&#039;&#039; if it is still running, then &#039;&#039;&#039;Restart job&#039;&#039;&#039;. Its old results are deleted and the job sentinel resubmits it.&lt;br /&gt;
* To throw away a trial&#039;s results, delete its jobs in the Jobs tab (untick &#039;&#039;Only display jobs from active trials/blocks&#039;&#039; to see jobs of inactive trials), and leave the trial inactive. The trial itself cannot be deleted.&lt;br /&gt;
&lt;br /&gt;
== Watching an experiment from elsewhere ==&lt;br /&gt;
Start a second GUI with the same project (copy &amp;lt;code&amp;gt;~/.cctbx.xfel/settings_&amp;lt;name&amp;gt;.phil&amp;lt;/code&amp;gt; to the other machine, or set the same credentials by hand) and &amp;lt;code&amp;gt;monitoring_mode=True&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;cctbx.xfel monitoring_mode=True&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Run Stats, Unit Cell and Merging stats tabs work as usual; nothing can be submitted from it. Keep job submission to a single GUI instance.&lt;br /&gt;
&lt;br /&gt;
== Standalone mode with files from another source ==&lt;br /&gt;
# Settings: facility &#039;&#039;Standalone&#039;&#039;; &#039;&#039;&#039;Options...&#039;&#039;&#039;: set the folder, &#039;&#039;&#039;Monitor for&#039;&#039;&#039; &#039;&#039;files&#039;&#039; or &#039;&#039;folders&#039;&#039;, the file template (for example &amp;lt;code&amp;gt;*.h5&amp;lt;/code&amp;gt;) and tick &#039;&#039;Files are composite&#039;&#039; for HDF5 or NeXus files. For one-image-per-file data, use &#039;&#039;folders&#039;&#039; with one folder per run and untick &#039;&#039;composite&#039;&#039;.&lt;br /&gt;
# Proceed as for a live experiment. Run blocks select runs by their order of discovery; the detector geometry comes from the image headers unless a reference geometry is set in the block.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Merging_Stats_tab&amp;diff=1800</id>
		<title>Cctbx.xfel GUI/Merging Stats tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Merging_Stats_tab&amp;diff=1800"/>
		<updated>2026-10-09T22:30:11Z</updated>

		<summary type="html">&lt;p&gt;Aaron: Created page with &amp;quot;{{DISPLAYTITLE:cctbx.xfel GUI/Merging Stats tab}} The &amp;#039;&amp;#039;&amp;#039;Merging stats tab&amp;#039;&amp;#039;&amp;#039; shows the merging statistics of each version of a dataset, read from the merging job&amp;#039;s log, and the cosym embedding plot when the merge resolved an indexing ambiguity. The &amp;#039;&amp;#039;Merging Stats Sentinel&amp;#039;&amp;#039; re-reads the logs every 5 seconds while the tab is showing, so a merge that is still running fills in as it goes.  Back to cctbx.xfel GUI.  == Selecting a dataset == * &amp;#039;&amp;#039;&amp;#039;Select dataset&amp;#039;&amp;#039;&amp;#039;: the...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Merging Stats tab}}&lt;br /&gt;
The &#039;&#039;&#039;Merging stats tab&#039;&#039;&#039; shows the merging statistics of each version of a dataset, read from the merging job&#039;s log, and the cosym embedding plot when the merge resolved an indexing ambiguity. The &#039;&#039;Merging Stats Sentinel&#039;&#039; re-reads the logs every 5 seconds while the tab is showing, so a merge that is still running fills in as it goes.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Selecting a dataset ==&lt;br /&gt;
* &#039;&#039;&#039;Select dataset&#039;&#039;&#039;: the list of datasets; &#039;&#039;&#039;Active only&#039;&#039;&#039; (ticked by default) hides inactive ones.&lt;br /&gt;
* &#039;&#039;&#039;Dataset version&#039;&#039;&#039;: &#039;&#039;All&#039;&#039; or a single version number. Only versions built with the dataset&#039;s current pipeline are listed; a version made before a stage was removed or detached is hidden.&lt;br /&gt;
&lt;br /&gt;
== Statistics page ==&lt;br /&gt;
For a &#039;&#039;&#039;single version&#039;&#039;&#039;, the plot shows the statistics by resolution shell, with resolution along the x axis:&lt;br /&gt;
* &#039;&#039;&#039;% accepted&#039;&#039;&#039; (orange): the fraction of lattices accepted into each resolution shell,&lt;br /&gt;
* &#039;&#039;&#039;Completeness&#039;&#039;&#039; (green) and &#039;&#039;&#039;CC1/2&#039;&#039;&#039; (blue), as percentages on the left axis,&lt;br /&gt;
* &#039;&#039;&#039;Multiplicity&#039;&#039;&#039; (red) and &#039;&#039;&#039;Merged I/sigI&#039;&#039;&#039; (purple) on the right axis.&lt;br /&gt;
&lt;br /&gt;
With &#039;&#039;&#039;All&#039;&#039;&#039; versions selected, the plot shows how the merge improves with data: overall CC1/2 and overall multiplicity against the number of images, and resolution against the number of images, one point per version. This is the plot to watch during collection to decide when enough data have been collected.&lt;br /&gt;
&lt;br /&gt;
The statistics are scraped from the merging log (the &amp;lt;code&amp;gt;*main*&amp;lt;/code&amp;gt; file in the version folder), so they match the tables printed there. Nothing is shown for a version whose merge has not yet written its tables.&lt;br /&gt;
&lt;br /&gt;
== Cosym embedding page ==&lt;br /&gt;
When the merging stage ran &amp;lt;code&amp;gt;modify_cosym&amp;lt;/code&amp;gt; to resolve an indexing ambiguity, it writes an embedding plot: each lattice is a point, and a successful resolution shows as well-separated clusters, one per indexing mode. A single blob means cosym could not separate the modes (too little signal in common between images, or no real ambiguity) and the merged data may be degraded by mis-indexed lattices. This page shows the plot for a single selected version; a selector appears when the job wrote more than one (one per plotting rank). The page explains when no plot is available.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
* Compare versions, or two datasets merged with different settings, by switching the selection; the plot is redrawn at the panel size, so enlarge the window for more detail.&lt;br /&gt;
* If CC1/2 or completeness is poor in the outer shells, lower the resolution in the dataset&#039;s shared parameters (which creates no new version by itself; a new version is merged when further runs finish, or restart the merging job from the [[cctbx.xfel GUI/Jobs tab|Jobs tab]]).&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Datasets_tab&amp;diff=1799</id>
		<title>Cctbx.xfel GUI/Datasets tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Datasets_tab&amp;diff=1799"/>
		<updated>2026-10-09T22:28:27Z</updated>

		<summary type="html">&lt;p&gt;Aaron: Created page with &amp;quot;{{DISPLAYTITLE:cctbx.xfel GUI/Datasets tab}} The &amp;#039;&amp;#039;&amp;#039;Datasets tab&amp;#039;&amp;#039;&amp;#039; takes processed runs through to a merged reflection file. A &amp;#039;&amp;#039;&amp;#039;dataset&amp;#039;&amp;#039;&amp;#039; selects runs from a trial by tag and runs a pipeline of tasks over them: optional ensemble refinement, scaling, merging, and optionally Phenix. Each merge creates a new &amp;#039;&amp;#039;&amp;#039;version&amp;#039;&amp;#039;&amp;#039; of the dataset, and new versions keep appearing as further runs finish, so merged data are available while collection is still going on.  Back to cc...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Datasets tab}}&lt;br /&gt;
The &#039;&#039;&#039;Datasets tab&#039;&#039;&#039; takes processed runs through to a merged reflection file. A &#039;&#039;&#039;dataset&#039;&#039;&#039; selects runs from a trial by tag and runs a pipeline of tasks over them: optional ensemble refinement, scaling, merging, and optionally Phenix. Each merge creates a new &#039;&#039;&#039;version&#039;&#039;&#039; of the dataset, and new versions keep appearing as further runs finish, so merged data are available while collection is still going on.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Layout ==&lt;br /&gt;
Each dataset is a box labelled with its id and name, laid out left to right. Inside it:&lt;br /&gt;
* the comment,&lt;br /&gt;
* &#039;&#039;&#039;Tags&#039;&#039;&#039;: the tags that select its runs,&lt;br /&gt;
* &#039;&#039;&#039;Trial&#039;&#039;&#039;: the trial whose results it uses,&lt;br /&gt;
* the numbered pipeline stages, with the resolution limit and reference model name for the scaling and merging stages. A link icon in front of a stage means its task is shared with another dataset; hover for the names.&lt;br /&gt;
* &#039;&#039;&#039;Latest: vNNN&#039;&#039;&#039;: the most recent version merged.&lt;br /&gt;
* The magnifying-glass button opens the full [[#The dataset dialog|dataset dialog]] to edit the dataset.&lt;br /&gt;
* The copy button &#039;&#039;&#039;duplicates&#039;&#039;&#039; the dataset: an inactive copy under a new name that shares the same tasks, tags and comment. Use it to merge the same runs with a different resolution limit or reference, after detaching the stages you want to change (see [[#Shared tasks|Shared tasks]]).&lt;br /&gt;
* &#039;&#039;&#039;Active Dataset&#039;&#039;&#039;: while ticked, the job sentinel submits the dataset&#039;s jobs. New datasets start inactive.&lt;br /&gt;
&lt;br /&gt;
Below: &#039;&#039;&#039;Filter&#039;&#039;&#039; narrows the list to names containing the text, &#039;&#039;&#039;Show Only Active Datasets&#039;&#039;&#039; hides inactive ones, and &#039;&#039;&#039;New Dataset&#039;&#039;&#039; opens the wizard.&lt;br /&gt;
&lt;br /&gt;
== How a dataset runs ==&lt;br /&gt;
With the dataset active and &#039;&#039;Auto-submit jobs&#039;&#039; on, the job sentinel does the following on every cycle:&lt;br /&gt;
# It finds the dataset&#039;s runs: the runs in the trial&#039;s run blocks that carry the dataset&#039;s tags, combined by the tag operator (&#039;&#039;intersection&#039;&#039;: all of the tags; &#039;&#039;union&#039;&#039;: any of them). A dataset must have at least one tag, and every one of its tags must be in use on the trial&#039;s runs, otherwise it is skipped.&lt;br /&gt;
# For each run it submits the next &#039;&#039;local&#039;&#039; task (ensemble refinement, then scaling) as soon as the previous one has finished with status &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;. Indexing is the trial&#039;s own integration job, so it must be &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt; for the run to enter the pipeline.&lt;br /&gt;
# Once some runs have finished every local task, it creates a new dataset version, links those runs&#039; jobs to it, and submits the &#039;&#039;global&#039;&#039; tasks (merging, then Phenix) for that version. Each time further runs finish, another version is created that includes them. Re-tagging a run out of the dataset also triggers a corrective version.&lt;br /&gt;
&lt;br /&gt;
Versions are numbered from &amp;lt;code&amp;gt;v000&amp;lt;/code&amp;gt; and their output is in &amp;lt;code&amp;gt;&amp;lt;output folder&amp;gt;/&amp;lt;dataset name&amp;gt;/v&amp;lt;NNN&amp;gt;/&amp;lt;/code&amp;gt;; the merged file is &amp;lt;code&amp;gt;&amp;lt;name&amp;gt;_v&amp;lt;NNN&amp;gt;_all.mtz&amp;lt;/code&amp;gt;. Watch the statistics of each version on the [[cctbx.xfel GUI/Merging Stats tab|Merging Stats tab]].&lt;br /&gt;
&lt;br /&gt;
== The new dataset wizard ==&lt;br /&gt;
&#039;&#039;&#039;New Dataset&#039;&#039;&#039; opens a three-step wizard that covers the usual case. Everything it sets can be changed afterwards in the full dialog.&lt;br /&gt;
&lt;br /&gt;
; Step 1, Trial &amp;amp; tags&lt;br /&gt;
: &#039;&#039;&#039;Name&#039;&#039;&#039; (must be unique), the &#039;&#039;&#039;Trial&#039;&#039;&#039; to merge, the &#039;&#039;&#039;Tags&#039;&#039;&#039; selecting its runs and the &#039;&#039;&#039;Tag operator&#039;&#039;&#039;.&lt;br /&gt;
; Step 2, Structure&lt;br /&gt;
: &#039;&#039;&#039;Known reference model&#039;&#039;&#039;: give a &#039;&#039;&#039;Reference model&#039;&#039;&#039; file (MTZ or PDB) to scale and post-refine the data against. &#039;&#039;&#039;Unknown structure&#039;&#039;&#039;: give the &#039;&#039;&#039;Unit cell&#039;&#039;&#039; and &#039;&#039;&#039;Space group&#039;&#039;&#039; instead (pre-filled from the trial). With no reference the data are merged as a plain average (a &#039;&#039;mark1&#039;&#039; merge, with no per-image scaling or post-refinement); the resulting MTZ can then serve as the reference model for a second dataset.&lt;br /&gt;
; Step 3, Options&lt;br /&gt;
: &#039;&#039;&#039;Include ensemble refinement&#039;&#039;&#039; (on by default). &#039;&#039;&#039;Resolve indexing ambiguity (cosym)&#039;&#039;&#039;: ticked automatically when the trial&#039;s symmetry has an indexing ambiguity; the label says how many indexing modes exist and how far the cell is from the higher lattice symmetry that causes them (an exact match means the ambiguity is certain, a few tenths of a degree means it is inferred and may or may not be real). &#039;&#039;&#039;High res. limit&#039;&#039;&#039; (d_min, 1.5 Å by default) and &#039;&#039;&#039;Number of bins&#039;&#039;&#039; for the statistics.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Finish&#039;&#039;&#039; creates the dataset, inactive, with an indexing stage, optionally ensemble refinement, scaling and merging.&lt;br /&gt;
&lt;br /&gt;
== The dataset dialog ==&lt;br /&gt;
The magnifying-glass button opens the full &#039;&#039;Dataset Settings&#039;&#039; dialog.&lt;br /&gt;
&lt;br /&gt;
=== Identity and run selection ===&lt;br /&gt;
&#039;&#039;&#039;Name&#039;&#039;&#039;, &#039;&#039;&#039;Comment&#039;&#039;&#039;, &#039;&#039;&#039;Trial&#039;&#039;&#039;, &#039;&#039;&#039;Tags&#039;&#039;&#039; and &#039;&#039;&#039;Tag operator&#039;&#039;&#039; as in the wizard. Changing the trial re-reads its unit cell, space group and integration parameters.&lt;br /&gt;
&lt;br /&gt;
=== Shared parameters (scaling + merging) ===&lt;br /&gt;
These apply to both the scaling and the merging stage so that they agree:&lt;br /&gt;
* &#039;&#039;&#039;Reference&#039;&#039;&#039;: &#039;&#039;Known reference model&#039;&#039; with a &#039;&#039;&#039;Reference model&#039;&#039;&#039; path, or &#039;&#039;No reference model&#039;&#039; with a &#039;&#039;&#039;Unit cell&#039;&#039;&#039; and &#039;&#039;&#039;Space group&#039;&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;High res. limit (d_min)&#039;&#039;&#039;: resolution cut-off for scaling and merging.&lt;br /&gt;
* &#039;&#039;&#039;Resolution scalar&#039;&#039;&#039; (0.96): multiplied by d_min to set the internal limit used when scaling, so that the edge bin is well populated.&lt;br /&gt;
* &#039;&#039;&#039;Number of bins&#039;&#039;&#039;: resolution shells in the statistics tables.&lt;br /&gt;
* &#039;&#039;&#039;Merge anomalous&#039;&#039;&#039;: ticked, Friedel mates are merged. Untick to keep the anomalous signal.&lt;br /&gt;
&lt;br /&gt;
=== Pipeline ===&lt;br /&gt;
Each stage is a box with an &#039;&#039;&#039;Include this stage&#039;&#039;&#039; tick box (except indexing, which is always there), a link icon (see &#039;&#039;Shared tasks&#039;&#039;), and for the PHIL-backed stages an &#039;&#039;&#039;Edit PHIL&#039;&#039;&#039; button that opens the complete parameter set for that program with the simplified controls&#039; values filled in. Anything not covered by the controls, such as the step list, error model or outlier rejection, is set there.&lt;br /&gt;
&lt;br /&gt;
==== Indexing ====&lt;br /&gt;
Uses the trial&#039;s integration results. No settings.&lt;br /&gt;
&lt;br /&gt;
==== Ensemble refinement ====&lt;br /&gt;
Time-dependent ensemble refinement (&amp;lt;code&amp;gt;cctbx.xfel.time_varying_refinement&amp;lt;/code&amp;gt;): the detector geometry and the crystal models of a run are refined together against all of its images, then the images are reintegrated. It improves the agreement between images and so the merging statistics, at the cost of an extra job per run.&lt;br /&gt;
* &#039;&#039;&#039;Pre-split experiments&#039;&#039;&#039;: split the run into chunks locally before submitting, which gives better balanced chunks; otherwise the splitting happens on the cluster, which is faster but counts chunk sizes less accurately.&lt;br /&gt;
* &#039;&#039;&#039;Expand Nave parameters on reintegration&#039;&#039;&#039;: widen the mosaicity model when reintegrating, to recruit more reflections.&lt;br /&gt;
The trial&#039;s integration parameters (gain in particular) are copied into this stage so that reintegration matches the original integration; they are visible under &#039;&#039;Edit PHIL&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Scaling ====&lt;br /&gt;
Per-run filtering and scaling against the reference (&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; up to the scaling and post-refinement steps):&lt;br /&gt;
* &#039;&#039;&#039;Min. correlation&#039;&#039;&#039;: lattices whose intensities correlate with the reference model below this are rejected (-1 keeps everything).&lt;br /&gt;
* &#039;&#039;&#039;Unit cell rel. length tol.&#039;&#039;&#039;: lattices whose cell edges differ from the reference cell by more than this fraction are rejected (0.1 = 10%).&lt;br /&gt;
* &#039;&#039;&#039;Filter by unit-cell cluster (from Unit Cells tab)&#039;&#039;&#039;: instead of the tolerance, accept only lattices within the &#039;&#039;&#039;Mahalanobis cutoff&#039;&#039;&#039; (default 4) of the chosen &#039;&#039;&#039;Cluster component&#039;&#039;&#039; (0 is the largest) of a &#039;&#039;&#039;Cluster file&#039;&#039;&#039; written by the [[cctbx.xfel GUI/Unit Cell tab|Unit Cell tab]]. Files in the output folder&#039;s &amp;lt;code&amp;gt;cluster/&amp;lt;/code&amp;gt; directory are listed; &#039;&#039;&#039;Browse...&#039;&#039;&#039; finds others.&lt;br /&gt;
* &#039;&#039;&#039;Significance filter sigma&#039;&#039;&#039;: for each image, keep reflections out to the highest resolution bin whose mean I/σ(I) is above this value.&lt;br /&gt;
With a reference model this stage scales and post-refines each run; without one it only filters, since the plain average needs neither.&lt;br /&gt;
&lt;br /&gt;
==== Merging ====&lt;br /&gt;
Merges the scaled runs into one MTZ with statistics. It takes everything from the shared parameters; &#039;&#039;Edit PHIL&#039;&#039; exposes the rest (error model, cosym settings, output options). When cosym was requested, this stage runs &amp;lt;code&amp;gt;modify_cosym&amp;lt;/code&amp;gt; to resolve the indexing ambiguity before scaling and merging; the cosym space group, number of dimensions and resolution limit are filled in from the trial&#039;s symmetry and the shared d_min, and are visible under &#039;&#039;Edit PHIL&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==== Phenix ====&lt;br /&gt;
Runs any Phenix command on the merged MTZ. The text box holds the command on the first line and PHIL parameters on the following lines; &amp;lt;code&amp;gt;&amp;lt;PREVIOUS_TASK_MTZ&amp;gt;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;&amp;lt;DATASET_NAME&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;DATASET_VERSION&amp;gt;&amp;lt;/code&amp;gt; are substituted at run time. Needs a &#039;&#039;Phenix setup script&#039;&#039; in [[cctbx.xfel GUI/Settings#Advanced settings|Advanced settings]]. Add it with &#039;&#039;&#039;Add stage&#039;&#039;&#039; at the bottom of the pipeline; a second scaling stage can be added the same way.&lt;br /&gt;
&lt;br /&gt;
=== Validation ===&lt;br /&gt;
On OK the dialog checks that a reference model or a unit cell and space group are given, that every enabled stage&#039;s parameters parse, and that a merge which resolves an indexing ambiguity and then post-refines has a reference model to anchor to (cosym fixes the indexing only up to an overall choice; without a model, remove &#039;&#039;postrefine&#039;&#039; from the merging step list instead). Datasets are only written if every check passes.&lt;br /&gt;
&lt;br /&gt;
== Shared tasks ==&lt;br /&gt;
A task can belong to more than one dataset. Duplicating a dataset creates such sharing, and the link icon on a stage can &#039;&#039;&#039;link&#039;&#039;&#039; the stage to a task from another dataset, so that two datasets differing only in their runs merge with identical settings. The icon shows a chain when the task is shared; hover to see with whom, click to link to another dataset&#039;s task or to unlink (make a private copy).&lt;br /&gt;
&lt;br /&gt;
Changing a shared stage, either with &#039;&#039;Edit PHIL&#039;&#039; or through its controls or the shared parameters, asks whether the change should &#039;&#039;&#039;apply to all&#039;&#039;&#039; datasets using the task or &#039;&#039;&#039;detach&#039;&#039;&#039; this dataset onto a private copy of the task first. Cancel leaves everything unchanged. Untick &#039;&#039;Include this stage&#039;&#039; on a shared task to drop it from this dataset only.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Unit_Cell_tab&amp;diff=1798</id>
		<title>Cctbx.xfel GUI/Unit Cell tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Unit_Cell_tab&amp;diff=1798"/>
		<updated>2026-10-09T22:19:35Z</updated>

		<summary type="html">&lt;p&gt;Aaron: Created page with &amp;quot;{{DISPLAYTITLE:cctbx.xfel GUI/Unit Cell tab}} The &amp;#039;&amp;#039;&amp;#039;Unit Cell tab&amp;#039;&amp;#039;&amp;#039; plots histograms of the unit cell parameters of every indexed lattice in a trial, so that you can check that indexing is finding the expected cell, compare samples or conditions, spot polymorphs, and define unit cell clusters for the scaling stage of a dataset to filter on. The plot is redrawn every 15 seconds by the &amp;#039;&amp;#039;Unit Cell Sentinel&amp;#039;&amp;#039; while &amp;#039;&amp;#039;Auto update&amp;#039;&amp;#039; is ticked.  Back to cctbx.xfel GUI....&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Unit Cell tab}}&lt;br /&gt;
The &#039;&#039;&#039;Unit Cell tab&#039;&#039;&#039; plots histograms of the unit cell parameters of every indexed lattice in a trial, so that you can check that indexing is finding the expected cell, compare samples or conditions, spot polymorphs, and define unit cell clusters for the scaling stage of a dataset to filter on. The plot is redrawn every 15 seconds by the &#039;&#039;Unit Cell Sentinel&#039;&#039; while &#039;&#039;Auto update&#039;&#039; is ticked.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Selecting lattices by tag ==&lt;br /&gt;
The tab compares &#039;&#039;&#039;tag sets&#039;&#039;&#039;. Each tag set is a selection of runs from one trial, and each gets its own colour in the histograms.&lt;br /&gt;
&lt;br /&gt;
# Choose the &#039;&#039;&#039;Trial&#039;&#039;&#039;. The &#039;&#039;Available tags&#039;&#039; list fills with the tags carried by that trial&#039;s runs.&lt;br /&gt;
# Tick one or more tags and choose &#039;&#039;&#039;union&#039;&#039;&#039; (runs carrying any of the tags) or &#039;&#039;&#039;intersection&#039;&#039;&#039; (runs carrying all of them). Ticking no tags selects every run in the trial (the set then shows as a blank entry in the list).&lt;br /&gt;
# Press &#039;&#039;&#039;Add selection&#039;&#039;&#039;. The set appears in &#039;&#039;Tag sets to display&#039;&#039;, named after its tags with &#039;&#039;(u)&#039;&#039; or &#039;&#039;(i)&#039;&#039; for the mode when there is more than one tag.&lt;br /&gt;
# Repeat for further sets, for example one per sample. To drop a set, tick it and press &#039;&#039;&#039;Remove selection&#039;&#039;&#039;; &#039;&#039;&#039;Reset selections&#039;&#039;&#039; clears them all.&lt;br /&gt;
&lt;br /&gt;
== Histogram mode ==&lt;br /&gt;
With &#039;&#039;Plot clusters&#039;&#039; unticked, the plot shows a histogram for each of a, b, c, α, β and γ for each tag set, with the legend giving the number of lattices and the mean and standard deviation of each parameter.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Reject outliers&#039;&#039;&#039;: drop lattices whose parameters fall outside 1.5 times the inter-quartile range before plotting, so that a few mis-indexed images do not stretch the axes.&lt;br /&gt;
* The matplotlib toolbar zooms and saves the figure, and &#039;&#039;Large text&#039;&#039; on the toolbar enlarges the labels.&lt;br /&gt;
&lt;br /&gt;
== Cluster mode ==&lt;br /&gt;
With &#039;&#039;Plot clusters&#039;&#039; ticked (available only when the &amp;lt;code&amp;gt;uc_metrics&amp;lt;/code&amp;gt; package is installed), the lattices of the &#039;&#039;&#039;first&#039;&#039;&#039; tag set are clustered with DBSCAN in the space of the independent cell parameters for the trial&#039;s space group (a, b, c for orthorhombic and lower; a, c for tetragonal, hexagonal and rhombohedral on hexagonal axes; a, α on rhombohedral axes; cubic cells cannot be clustered). The trial&#039;s space group comes from its indexing parameters, so set one in the trial for the clustering to use the right parameters.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Cluster epsilon&#039;&#039;&#039; (default 0.8): the DBSCAN neighbourhood distance. Smaller values give tighter, more numerous clusters; press Enter to apply.&lt;br /&gt;
* &#039;&#039;Reject outliers&#039;&#039; controls whether the unclustered points are drawn.&lt;br /&gt;
&lt;br /&gt;
Each clustering writes a covariance file, &amp;lt;code&amp;gt;cluster/cluster_&amp;lt;tag set name&amp;gt;.pickle&amp;lt;/code&amp;gt; in the output folder, describing the Gaussian mixture components found (component 0 is the largest). The &#039;&#039;&#039;scaling stage&#039;&#039;&#039; of a dataset can filter lattices with this file (&#039;&#039;Filter by unit-cell cluster&#039;&#039; in the [[cctbx.xfel GUI/Datasets tab#Scaling|Datasets tab]]), accepting only lattices within a chosen Mahalanobis distance of a chosen component. This is the way to merge only one polymorph when a sample indexes as a mixture.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
* A multi-modal histogram for a single sample usually means a mixture of crystal forms, or an indexing ambiguity producing permuted axes. Try cluster mode, or tighten the unit cell in the trial.&lt;br /&gt;
* Compare samples by adding one tag set per sample tag: differences in mean cell between conditions show up directly.&lt;br /&gt;
* Because the sentinel re-queries the database on every cycle, large trials can take a while to redraw; untick &#039;&#039;Auto update&#039;&#039; once the plot is as you want it.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Run_Stats_tab&amp;diff=1797</id>
		<title>Cctbx.xfel GUI/Run Stats tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Run_Stats_tab&amp;diff=1797"/>
		<updated>2026-10-09T22:18:16Z</updated>

		<summary type="html">&lt;p&gt;Aaron: Created page with &amp;quot;{{DISPLAYTITLE:cctbx.xfel GUI/Run Stats tab}} The &amp;#039;&amp;#039;&amp;#039;Run Stats tab&amp;#039;&amp;#039;&amp;#039; is the live view of how processing is going: for each image of the selected runs it shows how many strong spots were found, whether the image indexed, to what resolution, and the photon energy, together with per-run hit and indexing rates. It is the tab to keep open during data collection. The plot is redrawn every 5 seconds by the &amp;#039;&amp;#039;Run Stats Sentinel&amp;#039;&amp;#039; while &amp;#039;&amp;#039;Auto update&amp;#039;&amp;#039; is ticked.  Back to cctb...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Run Stats tab}}&lt;br /&gt;
The &#039;&#039;&#039;Run Stats tab&#039;&#039;&#039; is the live view of how processing is going: for each image of the selected runs it shows how many strong spots were found, whether the image indexed, to what resolution, and the photon energy, together with per-run hit and indexing rates. It is the tab to keep open during data collection. The plot is redrawn every 5 seconds by the &#039;&#039;Run Stats Sentinel&#039;&#039; while &#039;&#039;Auto update&#039;&#039; is ticked.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Selecting what to plot ==&lt;br /&gt;
The &#039;&#039;Statistics Options&#039;&#039; box on the lower left:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Trial&#039;&#039;&#039;: which trial&#039;s results to show. The list includes every trial; pick &#039;&#039;None&#039;&#039; to clear the plot.&lt;br /&gt;
* &#039;&#039;&#039;Selected runs&#039;&#039;&#039;: tick the runs to plot. The list contains every run in the trial&#039;s run blocks. Ticking runs by hand turns off the two automatic selections below.&lt;br /&gt;
* &#039;&#039;&#039;Auto plot last five runs&#039;&#039;&#039;: keep showing the five most recent runs in the trial, following along as new runs arrive. This is the normal setting during collection.&lt;br /&gt;
* &#039;&#039;&#039;Auto plot entire experiment&#039;&#039;&#039;: show every run in the trial in a compact three-panel form (no per-run annotations or energy panel), for an overview of a long experiment.&lt;br /&gt;
* &#039;&#039;&#039;Hide options&#039;&#039;&#039; collapses the options and image lists to give the plot the whole window.&lt;br /&gt;
* &#039;&#039;&#039;Auto update&#039;&#039;&#039;: untick to freeze the plot (and stop the sentinel), for example to zoom in with the matplotlib toolbar without the view being reset.&lt;br /&gt;
&lt;br /&gt;
The threshold fields take effect when you press &#039;&#039;&#039;Enter&#039;&#039;&#039; in the field:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field !! Default !! Used for&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;High resolution limit&#039;&#039;&#039; || 2.0 Å || An indexed image counts as &#039;&#039;high quality&#039;&#039; if its high-resolution bin (where I/σ(I) drops below the I/σ(I) cutoff) reaches this resolution. The orange line in panel 3 and the parenthesised counts in panel 4 use it.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;# multiples threshold&#039;&#039;&#039; || 2 || An image with at least this many lattices counts as a multi-lattice hit (pink line).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;two theta ratio cutoff&#039;&#039;&#039; || 1 || An image whose radial-average ratio at the run block&#039;s two 2θ angles exceeds this counts as a &#039;&#039;solvent hit&#039;&#039; (green line), that is, a shot that hit the liquid stream or drop whether or not it contained a crystal.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;# strong spots cutoff&#039;&#039;&#039; || 16 || An image with at least this many strong spots counts as a &#039;&#039;crystal hit&#039;&#039;. Also defines which images go into the two image lists below.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;I/sig(I) cutoff&#039;&#039;&#039; || 1 || Defines the high-resolution bin of each indexed image.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;# images to dump&#039;&#039;&#039; || 10 || How many images to convert and open from each list (LCLS XTC processing only).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Reading the plot ==&lt;br /&gt;
The x axis is the image timestamp, with runs laid end to end and separated by vertical lines. Each run is labelled at the top with its tags and its job status, coloured blue for &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;, green for running or queued, red for failed and black if no job was found.&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Strong spots&#039;&#039;&#039;: one point per image, the number of strong spots found. Blue points indexed, grey points did not. The y axis is clipped at 5000.&lt;br /&gt;
# &#039;&#039;&#039;Rates&#039;&#039;&#039; (running averages over a window of images): blue is the percentage of images that indexed, pink the percentage with multiple lattices, and green (right axis) the percentage of solvent hits.&lt;br /&gt;
# &#039;&#039;&#039;Resolution&#039;&#039;&#039;: orange points give each indexed image&#039;s high-resolution bin in Å; the orange line (right axis) is the percentage of images whose resolution reaches the high resolution limit.&lt;br /&gt;
# &#039;&#039;&#039;Energy&#039;&#039;&#039;: the photon energy of each image in eV, with a text summary per run: run number; images collected / crystal hits; images indexed (indexed to the resolution limit); percentage solvent hits / crystal hits; percentage indexed (to the resolution limit).&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Large text&#039;&#039; toolbar button enlarges the markers and labels.&lt;br /&gt;
&lt;br /&gt;
=== Clicking on the plot ===&lt;br /&gt;
At LCLS, clicking on a point in the strong spots or resolution panel opens that image in the DIALS image viewer, with its strong spots and, if it indexed, its indexed reflections overlaid. The viewer stays open and loads a new image on each click. The matplotlib toolbar&#039;s zoom and pan modes must be off for clicks to be interpreted this way.&lt;br /&gt;
&lt;br /&gt;
== Image lists (LCLS XTC processing) ==&lt;br /&gt;
When the processing back end is &amp;lt;code&amp;gt;cctbx.xfel.xtc_process&amp;lt;/code&amp;gt;, two lists appear on the right:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Strongest Indexed Images&#039;&#039;&#039;: images that indexed and have at least &#039;&#039;# strong spots cutoff&#039;&#039; spots, with their file paths. &#039;&#039;&#039;Open images&#039;&#039;&#039; opens the first &#039;&#039;# images to dump&#039;&#039; of them in &amp;lt;code&amp;gt;dials.image_viewer&amp;lt;/code&amp;gt; with their indexed reflections (converting them from the XTC stream first if they were not dumped).&lt;br /&gt;
* &#039;&#039;&#039;Strong Images that Didn&#039;t Index&#039;&#039;&#039;: images with many strong spots that failed to index, the ones to look at when the indexing rate is lower than the hit rate suggests it should be. &#039;&#039;&#039;Dump images&#039;&#039;&#039; extracts them from the XTC stream with &amp;lt;code&amp;gt;cctbx.xfel.xtc_dump&amp;lt;/code&amp;gt; into the job&#039;s &amp;lt;code&amp;gt;all/&amp;lt;/code&amp;gt; folder and opens them in the image viewer.&lt;br /&gt;
&lt;br /&gt;
Both commands run in the background; their output appears in the terminal. With the standard &amp;lt;code&amp;gt;cctbx.xfel.process&amp;lt;/code&amp;gt; back end these lists are hidden; use the &#039;&#039;Dump all images to disk&#039;&#039; option in [[cctbx.xfel GUI/Settings#LCLS options|LCLS options]] and look in the &amp;lt;code&amp;gt;all/&amp;lt;/code&amp;gt; folder instead.&lt;br /&gt;
&lt;br /&gt;
== Typical use ==&lt;br /&gt;
* &#039;&#039;&#039;During collection&#039;&#039;&#039;: select the current trial, press &#039;&#039;Auto plot last five runs&#039;&#039;, and watch the hit rate (grey and blue points, green line) to judge sample delivery, and the indexing rate (blue line) and resolution (orange) to judge data quality.&lt;br /&gt;
* &#039;&#039;&#039;Tuning spot finding&#039;&#039;&#039;: create a trial with &#039;&#039;Index&#039;&#039; off, and compare the strong-spot counts of a few runs between trials with different spot finding thresholds. Then open the strongest images to confirm that the spots found are real.&lt;br /&gt;
* &#039;&#039;&#039;Diagnosing indexing&#039;&#039;&#039;: if many images have plenty of strong spots but did not index (grey points high in panel 1), check the unit cell and space group in the trial, the detector distance and beam centre in the run block, and look at a few of those images.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Jobs_tab&amp;diff=1796</id>
		<title>Cctbx.xfel GUI/Jobs tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Jobs_tab&amp;diff=1796"/>
		<updated>2026-10-09T21:34:48Z</updated>

		<summary type="html">&lt;p&gt;Aaron: Created page with &amp;quot;{{DISPLAYTITLE:cctbx.xfel GUI/Jobs tab}} The &amp;#039;&amp;#039;&amp;#039;Jobs tab&amp;#039;&amp;#039;&amp;#039; lists every job the GUI has submitted, with its status in the queuing system, and provides the controls for stopping, deleting and resubmitting jobs. While the tab is showing, the &amp;#039;&amp;#039;&amp;#039;Job Monitor&amp;#039;&amp;#039;&amp;#039; thread queries the queuing system every 10 seconds and updates the statuses.  Back to cctbx.xfel GUI.  == The job table == {| class=&amp;quot;wikitable&amp;quot; ! Column !! Meaning |- | &amp;#039;&amp;#039;&amp;#039;Job&amp;#039;&amp;#039;&amp;#039; || The job&amp;#039;s id in the database. A...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Jobs tab}}&lt;br /&gt;
The &#039;&#039;&#039;Jobs tab&#039;&#039;&#039; lists every job the GUI has submitted, with its status in the queuing system, and provides the controls for stopping, deleting and resubmitting jobs. While the tab is showing, the &#039;&#039;&#039;Job Monitor&#039;&#039;&#039; thread queries the queuing system every 10 seconds and updates the statuses.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== The job table ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Column !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Job&#039;&#039;&#039; || The job&#039;s id in the database. Also used in log and error messages.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Type&#039;&#039;&#039; || Empty (&amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;) for indexing jobs submitted by a trial. For dataset jobs, the task type: &amp;lt;code&amp;gt;ensemble_refinement&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;scaling&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;merging&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;phenix&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Dataset&#039;&#039;&#039; || The dataset the job belongs to, for dataset jobs.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Trial&#039;&#039;&#039;, &#039;&#039;&#039;Run&#039;&#039;&#039;, &#039;&#039;&#039;Block&#039;&#039;&#039; || The trial number (&amp;lt;code&amp;gt;t003&amp;lt;/code&amp;gt;), run (&amp;lt;code&amp;gt;r0012&amp;lt;/code&amp;gt;) and run block (&amp;lt;code&amp;gt;rg005&amp;lt;/code&amp;gt;). These make up the job&#039;s output folder, &amp;lt;code&amp;gt;r0012/003_rg005/&amp;lt;/code&amp;gt;. Merging and Phenix jobs have no run or block.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Task&#039;&#039;&#039; || The task id for dataset jobs; its results go in &amp;lt;code&amp;gt;task&amp;lt;id&amp;gt;/&amp;lt;/code&amp;gt; under the run folder.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Version&#039;&#039;&#039; || The dataset version a merging or Phenix job produced.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Subm ID&#039;&#039;&#039; || The id assigned by the queuing system (or the process id for local jobs). Ensemble refinement jobs that run as several chunks list several ids.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Status&#039;&#039;&#039; || See below.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Click a column header to sort by it; click again to reverse. Selections survive the periodic refresh.&lt;br /&gt;
&lt;br /&gt;
=== Job statuses ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Status !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SUBMIT&amp;lt;/code&amp;gt; || Submitted; not yet seen in the queue.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;PEND&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;HOLD&amp;lt;/code&amp;gt; || Waiting in the queue.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;RUN&amp;lt;/code&amp;gt; || Running.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt; || Finished normally.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;EXIT&amp;lt;/code&amp;gt; || Finished with an error, was cancelled, or ran out of memory. Look at the job&#039;s log.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;TIMEOUT&amp;lt;/code&amp;gt; || Killed for exceeding the wall time.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;SUSP&amp;lt;/code&amp;gt; || Suspended or pre-empted by the scheduler.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ERR&amp;lt;/code&amp;gt; || The queue reported an error for the job.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;S_FAIL&amp;lt;/code&amp;gt; || The submission command itself failed; the message is in the terminal.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;UNKWN&amp;lt;/code&amp;gt; || The queue does not know the job (not yet registered, or expired from the queue&#039;s history). Jobs in this state keep being polled.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;DELETED&amp;lt;/code&amp;gt; || Its results were deleted from disk and the database with &#039;&#039;&#039;Delete job&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
In the dataset pipeline the next task for a run is only submitted when the previous one is &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;, and a merging job only includes runs whose last local task is &amp;lt;code&amp;gt;DONE&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Filters ==&lt;br /&gt;
* &#039;&#039;&#039;Filter by&#039;&#039;&#039;: &#039;&#039;All jobs&#039;&#039; or the jobs of a single trial.&lt;br /&gt;
* &#039;&#039;&#039;Only display jobs from active trials/blocks&#039;&#039;&#039;: ticked by default, so finished experiments and abandoned trials do not clutter the list. Untick it to see everything.&lt;br /&gt;
&lt;br /&gt;
== Actions ==&lt;br /&gt;
Select one or more rows first (shift-click and control-click work).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Button !! What it does&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Stop job&#039;&#039;&#039; || Cancels the selected jobs in the queuing system (&amp;lt;code&amp;gt;scancel&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bkill&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;qdel&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;condor_rm&amp;lt;/code&amp;gt;, or killing the process for local jobs). The job&#039;s status becomes &amp;lt;code&amp;gt;EXIT&amp;lt;/code&amp;gt; once the monitor sees it. The job&#039;s database record and results stay.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Delete job&#039;&#039;&#039; || Deletes the selected jobs&#039; results from disk (the job folder) and from the database (the per-image logs), and marks them &amp;lt;code&amp;gt;DELETED&amp;lt;/code&amp;gt;. Only finished jobs can be deleted; stop running jobs first. For a merging job, the version&#039;s folder is removed. You are asked to confirm.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Restart job&#039;&#039;&#039; || Deletes the job as above and then removes it from the job table, so the job sentinel sees the work as not done and submits it again on its next cycle (with &#039;&#039;Auto-submit jobs&#039;&#039; on). Use this after fixing a problem (a bad mask, a full disk, a crashed node). Stop the job first if it is still running.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
A job that has failed (&amp;lt;code&amp;gt;EXIT&amp;lt;/code&amp;gt;) is &#039;&#039;&#039;not&#039;&#039;&#039; retried automatically; the job sentinel treats every submitted job, failed or not, as done. &#039;&#039;Restart job&#039;&#039; is the way to retry it.&lt;br /&gt;
&lt;br /&gt;
== Finding a job&#039;s log ==&lt;br /&gt;
Indexing jobs log to &amp;lt;code&amp;gt;stdout/log.out&amp;lt;/code&amp;gt; in their output folder, for example &amp;lt;code&amp;gt;&amp;lt;output folder&amp;gt;/r0012/003_rg005/stdout/log.out&amp;lt;/code&amp;gt;; the submission script and queue output are in the same folder. Ensemble refinement logs are under &amp;lt;code&amp;gt;task&amp;lt;id&amp;gt;/combine_experiments_t&amp;lt;trial&amp;gt;/intermediates/&amp;lt;/code&amp;gt;, scaling under &amp;lt;code&amp;gt;task&amp;lt;id&amp;gt;/&amp;lt;/code&amp;gt;, and merging and Phenix under &amp;lt;code&amp;gt;&amp;lt;dataset&amp;gt;/v&amp;lt;version&amp;gt;/&amp;lt;/code&amp;gt;. The queue&#039;s own error output (&amp;lt;code&amp;gt;submit.err&amp;lt;/code&amp;gt; or similar) lives next to the log.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Trials_tab&amp;diff=1795</id>
		<title>Cctbx.xfel GUI/Trials tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Trials_tab&amp;diff=1795"/>
		<updated>2026-10-09T21:06:09Z</updated>

		<summary type="html">&lt;p&gt;Aaron: Created page with &amp;quot;{{DISPLAYTITLE:cctbx.xfel GUI/Trials tab}} The &amp;#039;&amp;#039;&amp;#039;Trials tab&amp;#039;&amp;#039;&amp;#039; is where processing is set up. A &amp;#039;&amp;#039;&amp;#039;trial&amp;#039;&amp;#039;&amp;#039; is a numbered set of spot finding, indexing and integration parameters; each trial owns one or more &amp;#039;&amp;#039;&amp;#039;run blocks&amp;#039;&amp;#039;&amp;#039; that say which runs it applies to and how their images should be read. Making a trial &amp;#039;&amp;#039;active&amp;#039;&amp;#039; is what causes jobs to be submitted.  Back to cctbx.xfel GUI.  == Layout == Each trial is a box labelled with its number and the start of its commen...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Trials tab}}&lt;br /&gt;
The &#039;&#039;&#039;Trials tab&#039;&#039;&#039; is where processing is set up. A &#039;&#039;&#039;trial&#039;&#039;&#039; is a numbered set of spot finding, indexing and integration parameters; each trial owns one or more &#039;&#039;&#039;run blocks&#039;&#039;&#039; that say which runs it applies to and how their images should be read. Making a trial &#039;&#039;active&#039;&#039; is what causes jobs to be submitted.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Layout ==&lt;br /&gt;
Each trial is a box labelled with its number and the start of its comment, laid out left to right (scroll horizontally when there are many). Inside each box:&lt;br /&gt;
&lt;br /&gt;
* A list of the trial&#039;s &#039;&#039;&#039;run blocks&#039;&#039;&#039;, one button each, labelled &amp;lt;code&amp;gt;[block id] runs first - last&amp;lt;/code&amp;gt;. An open block shows &amp;lt;code&amp;gt;...&amp;lt;/code&amp;gt; in place of the last run. Click a button to edit the block.&lt;br /&gt;
* &#039;&#039;&#039;New Block&#039;&#039;&#039;: create a run block for this trial (pre-filled from the trial&#039;s last block).&lt;br /&gt;
* &#039;&#039;&#039;Select Blocks&#039;&#039;&#039;: tick which of the run blocks from all trials belong to this trial. This is how a block created in one trial is reused by another. A block that no longer belongs to any trial becomes inactive.&lt;br /&gt;
* The magnifying-glass button shows the trial&#039;s parameters. Everything is read-only except the comment.&lt;br /&gt;
* &#039;&#039;&#039;Active Trial&#039;&#039;&#039;: while ticked, the job sentinel submits an indexing job for every run in every one of this trial&#039;s blocks. Untick to stop submitting new jobs; jobs already running are not affected.&lt;br /&gt;
&lt;br /&gt;
Below the trials: &#039;&#039;&#039;Show Only Active Trials&#039;&#039;&#039; hides inactive trials, and &#039;&#039;&#039;New Trial&#039;&#039;&#039; opens the trial dialog.&lt;br /&gt;
&lt;br /&gt;
== Creating a trial ==&lt;br /&gt;
&#039;&#039;&#039;New Trial&#039;&#039;&#039; opens the &#039;&#039;New Trial Settings&#039;&#039; dialog. A new trial inherits the parameters and comment of the most recent trial, so you normally change a few values and press OK. Trials are created &#039;&#039;inactive&#039;&#039;; tick &#039;&#039;Active Trial&#039;&#039; when you are ready to process.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Control !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Trial number&#039;&#039;&#039; || Allocated automatically (one more than the highest existing trial).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Import PHIL&#039;&#039;&#039; || Load parameters from a PHIL file. The file is validated against the processing program; unknown parameters are reported and the import is rejected.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Edit PHIL&#039;&#039;&#039; || Open the full parameter set as text (only the values that differ from the program&#039;s defaults are shown). Anything the simplified controls do not cover is set here, for example masks, refinement options or integration settings. Changes are validated when you press OK in the editor and the simplified controls update to match.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Comment&#039;&#039;&#039; || Free text, shown in the trial box and in job listings. Say what you changed.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Overall parameters ===&lt;br /&gt;
* &#039;&#039;&#039;Find spots&#039;&#039;&#039;, &#039;&#039;&#039;Index&#039;&#039;&#039;, &#039;&#039;&#039;Integrate&#039;&#039;&#039;: which stages to run. Untick &#039;&#039;Index&#039;&#039; and &#039;&#039;Integrate&#039;&#039; for a quick hit-finding pass, or to tune spot finding on the Run Stats tab before indexing.&lt;br /&gt;
* &#039;&#039;&#039;Min spots&#039;&#039;&#039;: the minimum number of strong spots an image needs before indexing is attempted (the hit finder threshold). Images below it are logged as non-hits and skipped.&lt;br /&gt;
&lt;br /&gt;
=== Spotfinding parameters ===&lt;br /&gt;
These map onto the DIALS spot finder:&lt;br /&gt;
* &#039;&#039;&#039;Min spot size&#039;&#039;&#039; / &#039;&#039;&#039;Max spot size&#039;&#039;&#039;: pixel count limits for a spot. The minimum removes single-pixel noise; the maximum removes ice rings and bad regions.&lt;br /&gt;
* &#039;&#039;&#039;Sigma background&#039;&#039;&#039; / &#039;&#039;&#039;Sigma strong&#039;&#039;&#039;: the dispersion algorithm&#039;s thresholds, in units of the local background standard deviation. Lower &#039;&#039;sigma strong&#039;&#039; finds weaker spots.&lt;br /&gt;
* &#039;&#039;&#039;Global threshold&#039;&#039;&#039;: absolute pixel value below which nothing counts as signal.&lt;br /&gt;
* &#039;&#039;&#039;Gain&#039;&#039;&#039;: detector gain in ADU per photon. Leave blank to use the value reported by the image format. When integration is on, the same gain is also used to scale the integrated intensity variances.&lt;br /&gt;
* &#039;&#039;&#039;Kernel size&#039;&#039;&#039;: size of the local background window in pixels (two numbers).&lt;br /&gt;
* &#039;&#039;&#039;Threshold algorithm&#039;&#039;&#039;: &#039;&#039;dispersion&#039;&#039; (standard), &#039;&#039;dispersion_extended&#039;&#039; (more sensitive at low resolution) or &#039;&#039;radial_profile&#039;&#039; (radial background subtraction).&lt;br /&gt;
&lt;br /&gt;
=== Indexing parameters ===&lt;br /&gt;
* &#039;&#039;&#039;Unit cell&#039;&#039;&#039; and &#039;&#039;&#039;Space group&#039;&#039;&#039;: the known symmetry, if any. Giving both makes indexing much more reliable; the pair is checked for compatibility.&lt;br /&gt;
* &#039;&#039;&#039;d_min indexing&#039;&#039;&#039;: high-resolution cut-off used during indexing refinement.&lt;br /&gt;
* &#039;&#039;&#039;Max lattices&#039;&#039;&#039;: more than 1 enables multi-lattice indexing of the same image.&lt;br /&gt;
* &#039;&#039;&#039;Reflection subsampling&#039;&#039;&#039;: index on a random subset of the strong spots, which can help with very dense patterns.&lt;br /&gt;
&lt;br /&gt;
=== Other options ===&lt;br /&gt;
* &#039;&#039;&#039;Copy runblocks from&#039;&#039;&#039;: give the new trial the same run blocks as an existing trial, so that a parameter change can be tried on exactly the same runs.&lt;br /&gt;
* &#039;&#039;&#039;Percent events processed&#039;&#039;&#039;: process only this percentage of the images in each run (a throttle for a quick look at a large run).&lt;br /&gt;
* &#039;&#039;&#039;Number of bins&#039;&#039;&#039; and &#039;&#039;&#039;High res. limit&#039;&#039;&#039;: used for logging resolution statistics to the database.&lt;br /&gt;
&lt;br /&gt;
== Run blocks ==&lt;br /&gt;
A run block groups a contiguous range of runs with the detector settings needed to read them. &#039;&#039;&#039;New Block&#039;&#039;&#039; and clicking an existing block open the &#039;&#039;Run Block Settings&#039;&#039; dialog.&lt;br /&gt;
&lt;br /&gt;
=== Run range ===&lt;br /&gt;
* &#039;&#039;&#039;Start run&#039;&#039;&#039;: the first run in the block.&lt;br /&gt;
* &#039;&#039;&#039;Auto add runs&#039;&#039;&#039;: the block has no end; every new run the run sentinel finds is added to it. Use this while collecting data.&lt;br /&gt;
* &#039;&#039;&#039;Specify end run&#039;&#039;&#039; / &#039;&#039;&#039;End run&#039;&#039;&#039;: a closed range.&lt;br /&gt;
&lt;br /&gt;
In standalone mode the start and end are database ids (order of discovery) rather than run numbers, since run names there need not be numeric.&lt;br /&gt;
&lt;br /&gt;
=== Run block settings ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Setting !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Extra XTC format parameters&#039;&#039;&#039; (LCLS) || PHIL text passed to the XTC image format, for example a locator override. &#039;&#039;&#039;Import PHIL&#039;&#039;&#039; loads it from a file.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Detector Address&#039;&#039;&#039; (LCLS) || The detector&#039;s address in the XTC stream, such as &amp;lt;code&amp;gt;CxiDs2.0:Cspad.0&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;MfxEndstation.0:Rayonix.0&amp;lt;/code&amp;gt;. Use the &amp;lt;code&amp;gt;detnames&amp;lt;/code&amp;gt; tool at LCLS to list them.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Beam X, Y, DetZ&#039;&#039;&#039; (LCLS) || Beam centre in pixels and detector distance in mm. Required for Rayonix detectors even when a reference geometry is given (the reference geometry then takes precedence).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;binning&#039;&#039;&#039; (LCLS) || Rayonix binning (2, 3, 4, ...).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;energy&#039;&#039;&#039; / &#039;&#039;&#039;Energy override&#039;&#039;&#039; || Fixed photon energy in eV applied to every image, overriding the per-shot values. Leave blank to use the measured energies.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;wavelength_offset&#039;&#039;&#039; (LCLS) || Offset added to each image&#039;s wavelength, in Å, from the [[cctbx.xfel GUI/Energy tab|Energy tab]] calibration.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;spectrum_eV_per_pixel&#039;&#039;&#039; / &#039;&#039;&#039;spectrum_eV_offset&#039;&#039;&#039; (LCLS) || FEE spectrometer calibration, from the [[cctbx.xfel GUI/Energy tab|Energy tab]].&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;two_theta_low&#039;&#039;&#039; / &#039;&#039;&#039;two_theta_high&#039;&#039;&#039; || Two scattering angles in degrees. The ratio of the radial average at the high angle to that at the low angle is used by the Run Stats tab to count &#039;&#039;solvent hits&#039;&#039; (the defaults are a kapton ring and the water ring).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Untrusted Pixel Mask&#039;&#039;&#039; || A DIALS mask file (&amp;lt;code&amp;gt;.mask&amp;lt;/code&amp;gt;) of pixels to ignore.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Reference geometry&#039;&#039;&#039; || An experiment file (&amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;) whose detector geometry replaces the one from the image headers, typically from a geometry refinement.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Comment&#039;&#039;&#039; || Free text.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Edit PHIL&#039;&#039;&#039; || Any other processing parameter that should apply only to this block (the reference geometry is stored this way, as &amp;lt;code&amp;gt;input.reference_geometry&amp;lt;/code&amp;gt;). Block parameters are combined with the trial&#039;s parameters when a job is submitted.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Editing an existing block ===&lt;br /&gt;
Results on disk are stored by trial and block id, so a block&#039;s settings must not change under results already produced. When you press OK on an existing block:&lt;br /&gt;
* if only the end run, the open/closed state or the comment changed, the block is updated in place (the job sentinel is paused briefly while the runs are re-synced);&lt;br /&gt;
* if anything else changed, the old block is made inactive and a &#039;&#039;&#039;new block&#039;&#039;&#039; with a new id is created and attached to the trial. Jobs for the new block are submitted afresh; the old results stay where they were.&lt;br /&gt;
&lt;br /&gt;
== What happens next ==&lt;br /&gt;
With a trial active, run blocks attached and &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039; on, the job sentinel submits one job per run in each block, each writing to &amp;lt;code&amp;gt;r&amp;lt;run&amp;gt;/&amp;lt;trial&amp;gt;_rg&amp;lt;block&amp;gt;/&amp;lt;/code&amp;gt; in the output folder. Watch them in the [[cctbx.xfel GUI/Jobs tab|Jobs tab]] and the results in the [[cctbx.xfel GUI/Run Stats tab|Run Stats tab]]. Multiple trials can be active at once, for example to compare two parameter sets on the same runs.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Energy_tab&amp;diff=1794</id>
		<title>Cctbx.xfel GUI/Energy tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Energy_tab&amp;diff=1794"/>
		<updated>2026-10-09T21:04:38Z</updated>

		<summary type="html">&lt;p&gt;Aaron: Created page with &amp;quot;{{DISPLAYTITLE:cctbx.xfel GUI/Energy tab}} The &amp;#039;&amp;#039;&amp;#039;Energy tab&amp;#039;&amp;#039;&amp;#039; calibrates the per-shot photon energy at LCLS. It is shown only when the facility is LCLS and the GUI is not in monitoring mode. The tab runs its calculations in the &amp;#039;&amp;#039;Calib Worker&amp;#039;&amp;#039; thread, whose light turns yellow while a calibration is running and green when it is idle.  Back to cctbx.xfel GUI.  == Background == At LCLS each shot&amp;#039;s photon energy can be measured two ways: from the electron beam energy...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Energy tab}}&lt;br /&gt;
The &#039;&#039;&#039;Energy tab&#039;&#039;&#039; calibrates the per-shot photon energy at LCLS. It is shown only when the facility is LCLS and the GUI is not in monitoring mode. The tab runs its calculations in the &#039;&#039;Calib Worker&#039;&#039; thread, whose light turns yellow while a calibration is running and green when it is idle.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Background ==&lt;br /&gt;
At LCLS each shot&#039;s photon energy can be measured two ways: from the electron beam energy reported by the accelerator (the &#039;&#039;ebeam&#039;&#039;), and from the &#039;&#039;FEE spectrometer&#039;&#039;, 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:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;FEE calibration&#039;&#039;&#039;: several short runs are collected with the beam energy stepped through a notch of known energy. Fitting the notch position in each run&#039;s average spectrum against the known energies gives the spectrometer&#039;s &#039;&#039;&#039;eV per pixel&#039;&#039;&#039; and &#039;&#039;&#039;eV offset&#039;&#039;&#039;.&lt;br /&gt;
# &#039;&#039;&#039;Ebeam calibration&#039;&#039;&#039;: with the spectrometer calibrated, its per-shot energies are compared with the ebeam energies over a set of ordinary runs to find the constant &#039;&#039;&#039;ebeam offset&#039;&#039;&#039; (and the equivalent wavelength offset), so that the ebeam value can be corrected on shots where the spectrometer is unusable.&lt;br /&gt;
&lt;br /&gt;
The results are entered into [[cctbx.xfel GUI/Trials tab#Run block settings|run block settings]] (&amp;lt;code&amp;gt;spectrum_eV_per_pixel&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;spectrum_eV_offset&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;wavelength_offset&amp;lt;/code&amp;gt;) so that processing jobs use the calibrated energies.&lt;br /&gt;
&lt;br /&gt;
== FEE Energy Scan Description ==&lt;br /&gt;
* &#039;&#039;&#039;Experiment&#039;&#039;&#039;: 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.&lt;br /&gt;
* &#039;&#039;&#039;Max events&#039;&#039;&#039;: how many shots of each run to average (200 by default). More shots give a cleaner spectrum but take longer.&lt;br /&gt;
* &#039;&#039;&#039;Run / Notch Energy (eV)&#039;&#039;&#039; table: one row per calibration run. Click a cell to edit it. &#039;&#039;&#039;Add Row&#039;&#039;&#039; appends a row and &#039;&#039;&#039;Clear All&#039;&#039;&#039; empties the table.&lt;br /&gt;
* &#039;&#039;&#039;Run Calibration&#039;&#039;&#039;: checks that each run exists and each energy is a number, then runs the calibration in the background. Two plots fill in when it finishes: the &#039;&#039;&#039;trendline&#039;&#039;&#039; (notch position against energy, with the fitted line) and the &#039;&#039;&#039;spectra&#039;&#039;&#039; (each run&#039;s averaged spectrum with its detected notch). Each plot has a matplotlib toolbar for zooming and saving.&lt;br /&gt;
&lt;br /&gt;
== Runs for Ebeam Calibration ==&lt;br /&gt;
* The checklist shows every run in the database; &#039;&#039;&#039;Refresh&#039;&#039;&#039; picks up runs that arrived since the tab was opened and &#039;&#039;&#039;Clear&#039;&#039;&#039; unticks everything and clears the plot.&lt;br /&gt;
* Tick the runs to compare and press &#039;&#039;&#039;Run Calibration&#039;&#039;&#039;. The FEE calibration must have been run first, and each run must belong to a run block (the detector address is taken from it). Runs that are in no run block are skipped with a message in the terminal.&lt;br /&gt;
* The plot overlays the ebeam energies with the calibrated spectrometer energies for the selected runs. The worker writes a small locator file per run to an &amp;lt;code&amp;gt;energy&amp;lt;/code&amp;gt; folder next to the output folder.&lt;br /&gt;
&lt;br /&gt;
== Calibration Results ==&lt;br /&gt;
The box shows &#039;&#039;&#039;FEE eV per pixel&#039;&#039;&#039;, &#039;&#039;&#039;FEE eV offset&#039;&#039;&#039; and &#039;&#039;&#039;Ebeam offset&#039;&#039;&#039; (in eV, with the equivalent wavelength offset in Å). &#039;&#039;&#039;Save calibration&#039;&#039;&#039; writes them as a PHIL file (default &amp;lt;code&amp;gt;fee/fee_calib.phil&amp;lt;/code&amp;gt; next to the output folder):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;spectrum_eV_per_pixel=...&lt;br /&gt;
spectrum_eV_offset=...&lt;br /&gt;
ebeam_eV_offset=...&lt;br /&gt;
wavelength_offset=...&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first two go into the &#039;&#039;spectrum_eV_per_pixel&#039;&#039; and &#039;&#039;spectrum_eV_offset&#039;&#039; fields of a run block and the wavelength offset into its &#039;&#039;wavelength_offset&#039;&#039; field. 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.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Runs_tab&amp;diff=1793</id>
		<title>Cctbx.xfel GUI/Runs tab</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Runs_tab&amp;diff=1793"/>
		<updated>2026-10-09T21:00:18Z</updated>

		<summary type="html">&lt;p&gt;Aaron: Created page with &amp;quot;{{DISPLAYTITLE:cctbx.xfel GUI/Runs tab}} The &amp;#039;&amp;#039;&amp;#039;Runs tab&amp;#039;&amp;#039;&amp;#039; lists every run the GUI knows about and the sample tags attached to each. It is where tags are created, applied and kept up to date as runs arrive. Tags are the handles that the Run Stats, Unit Cell and Datasets tabs use to select runs, so keeping them accurate pays off later.  Back to cctbx.xfel GUI.  == Where...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Runs tab}}&lt;br /&gt;
The &#039;&#039;&#039;Runs tab&#039;&#039;&#039; lists every run the GUI knows about and the sample tags attached to each. It is where tags are created, applied and kept up to date as runs arrive. Tags are the handles that the [[cctbx.xfel GUI/Run Stats tab|Run Stats]], [[cctbx.xfel GUI/Unit Cell tab|Unit Cell]] and [[cctbx.xfel GUI/Datasets tab|Datasets]] tabs use to select runs, so keeping them accurate pays off later.&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== Where runs come from ==&lt;br /&gt;
Runs appear in the list when the &#039;&#039;&#039;run sentinel&#039;&#039;&#039; finds them, so press &#039;&#039;&#039;Watch for new runs&#039;&#039;&#039; on the toolbar to populate the tab. At LCLS it queries the run database for the experiment named in Settings; in standalone mode it scans the monitored folder (see [[cctbx.xfel GUI/Settings#Standalone options|Standalone options]]). New runs are checked for every 10 seconds, and the list refreshes itself; there is no refresh button.&lt;br /&gt;
&lt;br /&gt;
When the sentinel finds new runs it also:&lt;br /&gt;
* applies the &#039;&#039;&#039;persistent tags&#039;&#039;&#039; (below) to each new run, and&lt;br /&gt;
* adds the new runs to every open (&amp;quot;Auto add runs&amp;quot;) run block, so processing starts without any further clicks if a trial is active and &#039;&#039;Auto-submit jobs&#039;&#039; is on.&lt;br /&gt;
&lt;br /&gt;
== The run list ==&lt;br /&gt;
Each row shows the run number and a wide button listing the run&#039;s tags.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Tag button&#039;&#039;&#039;: click it to open a checklist of all tags and tick the ones that apply to this run. Changes are saved immediately.&lt;br /&gt;
* &#039;&#039;&#039;Drag and drop&#039;&#039;&#039;: press on a row and drag it onto another row to copy all of the source run&#039;s tags onto the target run (the target&#039;s existing tags are kept). The target row is highlighted while you hover over it. A plain click on the tag button still opens the checklist.&lt;br /&gt;
* &#039;&#039;&#039;Average&#039;&#039;&#039;: submits an image averaging job for the run (see below).&lt;br /&gt;
&lt;br /&gt;
== Buttons ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Button !! What it does&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Change Tags on Multiple Runs&#039;&#039;&#039; || Opens a dialog with a checklist of all runs. Tick the runs, then &#039;&#039;&#039;Add tags&#039;&#039;&#039; or &#039;&#039;&#039;Remove tags&#039;&#039;&#039; to choose tags to add to, or remove from, every ticked run. The &#039;&#039;Sort tags by&#039;&#039; radio sorts the tag checklist by database id (creation order) or by name.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Manage Persistent Tags&#039;&#039;&#039; || Choose tags that the run sentinel applies automatically to every new run it discovers. Use it when starting a new sample: tick the sample&#039;s tag here, and every run collected from now on carries it. The choice lasts for this GUI session only.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Manage Tags&#039;&#039;&#039; || Create, rename, comment and delete tags. &#039;&#039;&#039;Add Tag&#039;&#039;&#039; inserts a new row with a placeholder name; click the name or comment cell to edit it. &#039;&#039;&#039;Remove Tags&#039;&#039;&#039; deletes the selected rows and &#039;&#039;&#039;Clear All&#039;&#039;&#039; deletes every tag (after a confirmation; this cannot be undone). Tag names must be unique. Nothing is written to the database until you press &#039;&#039;&#039;OK&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Image averaging ==&lt;br /&gt;
&#039;&#039;&#039;Average&#039;&#039;&#039; submits a &amp;lt;code&amp;gt;dxtbx.image_average&amp;lt;/code&amp;gt; job for the run, using the same queuing settings as processing jobs. It writes three CBF images to &amp;lt;code&amp;gt;averages/&amp;lt;/code&amp;gt; inside the output folder: the mean (&amp;lt;code&amp;gt;avg.cbf&amp;lt;/code&amp;gt;), the per-pixel maximum (&amp;lt;code&amp;gt;max.cbf&amp;lt;/code&amp;gt;) and the standard deviation (&amp;lt;code&amp;gt;std.cbf&amp;lt;/code&amp;gt;). These are useful for checking beam centre and detector distance, finding bad pixels, and making masks.&lt;br /&gt;
&lt;br /&gt;
The dialog asks how many images to &#039;&#039;&#039;skip&#039;&#039;&#039; at the start of the run and whether to &#039;&#039;&#039;use all images&#039;&#039;&#039; or a specified number. The job needs a run block for the detector settings (address, distance, binning): it uses the run&#039;s own run block if it is in one, otherwise the run block whose run range is closest. If no run block exists yet, create one in the [[cctbx.xfel GUI/Trials tab|Trials tab]] first.&lt;br /&gt;
&lt;br /&gt;
The button label changes to &#039;&#039;Running&#039;&#039; once the job is submitted. The job appears in the [[cctbx.xfel GUI/Jobs tab|Jobs tab]] like any other.&lt;br /&gt;
&lt;br /&gt;
== Tips ==&lt;br /&gt;
* Decide on a tagging scheme before the beamtime (sample, buffer, laser on/off, detector distance) and create the tags in &#039;&#039;&#039;Manage Tags&#039;&#039;&#039; at the start.&lt;br /&gt;
* Change the persistent tags every time the sample changes. Runs that arrive with the wrong tags can be fixed afterwards with &#039;&#039;&#039;Change Tags on Multiple Runs&#039;&#039;&#039;.&lt;br /&gt;
* A dataset needs at least one tag to select runs by, so even an experiment with a single sample needs one tag applied to its runs.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Settings&amp;diff=1792</id>
		<title>Cctbx.xfel GUI/Settings</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI/Settings&amp;diff=1792"/>
		<updated>2026-10-09T20:58:36Z</updated>

		<summary type="html">&lt;p&gt;Aaron: Created page with &amp;quot;{{DISPLAYTITLE:cctbx.xfel GUI/Settings}} The &amp;#039;&amp;#039;&amp;#039;Settings dialog&amp;#039;&amp;#039;&amp;#039; is the first thing the GUI shows when it starts (titled &amp;#039;&amp;#039;CCTBX.XFEL Login&amp;#039;&amp;#039;) and is also opened by the &amp;#039;&amp;#039;&amp;#039;Settings&amp;#039;&amp;#039;&amp;#039; toolbar button. It collects everything the GUI needs to connect to an experiment: the database, the experiment tag, the facility, the output folder, and how jobs are submitted. All of it is saved as a project.  Back to cctbx.xfel GUI.  == T...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI/Settings}}&lt;br /&gt;
The &#039;&#039;&#039;Settings dialog&#039;&#039;&#039; is the first thing the GUI shows when it starts (titled &#039;&#039;CCTBX.XFEL Login&#039;&#039;) and is also opened by the &#039;&#039;&#039;Settings&#039;&#039;&#039; toolbar button. It collects everything the GUI needs to connect to an experiment: the database, the experiment tag, the facility, the output folder, and how jobs are submitted. All of it is saved as a [[cctbx.xfel GUI#Projects (saved settings)|project]].&lt;br /&gt;
&lt;br /&gt;
Back to [[cctbx.xfel GUI]].&lt;br /&gt;
&lt;br /&gt;
== The Settings dialog ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Experiment Tag&#039;&#039;&#039; || Prefix for every database table belonging to this experiment. Use a new tag for a new experiment, or for a clean restart of the same experiment. Locked while the GUI is connected.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;DB Credentials...&#039;&#039;&#039; || Opens the [[#Database credentials|Database credentials]] dialog. Locked while the GUI is connected.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Facility&#039;&#039;&#039; || &#039;&#039;LCLS&#039;&#039; uses the LCLS run database and XTC streams. &#039;&#039;Standalone&#039;&#039; monitors a folder for image files from any other source. &#039;&#039;&#039;Options...&#039;&#039;&#039; opens the facility-specific settings below.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Experiment&#039;&#039;&#039; || LCLS experiment name, for example &amp;lt;code&amp;gt;cxid9114&amp;lt;/code&amp;gt;. Disabled for standalone.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Output&#039;&#039;&#039; || Folder that will receive all processing results. &#039;&#039;&#039;Browse...&#039;&#039;&#039; picks it with a folder chooser. See [[cctbx.xfel GUI#Where the results go|Where the results go]].&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Load Project...&#039;&#039;&#039; || Choose a saved project from a list (sorted by last modified). Loading a project fills in every field. While the GUI is connected, a project whose database connection or experiment tag differs from the current one is refused, since applying it would require a restart.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Save Project As...&#039;&#039;&#039; || Save the current settings under a name. The file is &amp;lt;code&amp;gt;~/.cctbx.xfel/settings_&amp;lt;name&amp;gt;.phil&amp;lt;/code&amp;gt;. The project most recently saved or loaded becomes the default for the next start.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Advanced Settings...&#039;&#039;&#039; || Opens the [[#Advanced settings|Advanced settings]] dialog: multiprocessing, queue and processing back end.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;OK&#039;&#039;&#039; || At start-up: connects to the database, creates the tables if they do not exist, and opens the main window. If no project has been named yet, you are asked to name one first. From the running GUI: applies the changes and saves them to the current project.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Database credentials ==&lt;br /&gt;
Opened with &#039;&#039;&#039;DB Credentials...&#039;&#039;&#039;. The GUI needs a MySQL server it can create tables on.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Field !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;DB Host name&#039;&#039;&#039; || Server host. The default is the LCLS user database host, &amp;lt;code&amp;gt;psdb-user.slac.stanford.edu&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;DB Port number&#039;&#039;&#039; || Usually 3306.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;DB name&#039;&#039;&#039; || The database on that server.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;DB user name&#039;&#039;&#039; / &#039;&#039;&#039;DB Password&#039;&#039;&#039; || Account with rights to create and modify tables in that database. The password is cached in plain text in the project file.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Delete and regenerate all tables&#039;&#039;&#039; || Drops every table with the current experiment tag and recreates them empty when you press OK in the Settings dialog. This destroys all records of the experiment (not the files on disk). You are asked to confirm.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;XTC stream location&#039;&#039;&#039; || LCLS only. Where the XTC files are: &amp;lt;code&amp;gt;SLAC&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;SRCF_FFB&amp;lt;/code&amp;gt; (fast feedback, active experiment only), &amp;lt;code&amp;gt;SDF&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;NERSC&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Start DB Server&#039;&#039;&#039; || Launches your own MySQL server if you do not have one. See below.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Starting a local database server ===&lt;br /&gt;
&#039;&#039;&#039;Start DB Server&#039;&#039;&#039; submits a job (&amp;lt;code&amp;gt;cctbx.xfel.ui_server&amp;lt;/code&amp;gt;) that runs a MySQL server using the queuing settings from Advanced settings. It asks for:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;DB Base Directory&#039;&#039;&#039;: where the server keeps its data files. Defaults to &amp;lt;code&amp;gt;MySql&amp;lt;/code&amp;gt; inside the output folder. If the directory already contains a database, the server reuses it.&lt;br /&gt;
* &#039;&#039;&#039;DB Root Password&#039;&#039;&#039;: only needed when the base directory is new, to initialise the server. The database, user and password typed in the credentials dialog are created at that point, so fill those in first.&lt;br /&gt;
&lt;br /&gt;
With the &#039;&#039;local&#039;&#039; multiprocessing method the server runs on this machine and the host is set to &amp;lt;code&amp;gt;127.0.0.1&amp;lt;/code&amp;gt;. With Slurm or Shifter the job runs on a compute node and the GUI fills in that node&#039;s host name once the job starts; the server lives as long as the job&#039;s wall time. The GUI waits for the server to accept connections before continuing and reports the server&#039;s error log if it fails. Make sure a server is not already running on the same base directory.&lt;br /&gt;
&lt;br /&gt;
== Facility options ==&lt;br /&gt;
&lt;br /&gt;
=== LCLS options ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Option !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Use ffb (fast feedback) file system&#039;&#039;&#039; || Read XTC data from the fast feedback system. Only for the active experiment on the priority queues.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Dump all images to disk&#039;&#039;&#039; || Write every image as CBF to the job&#039;s &amp;lt;code&amp;gt;all/&amp;lt;/code&amp;gt; folder, whether or not it indexed. Needed for the &#039;&#039;Strong images that didn&#039;t index&#039;&#039; feature of the [[cctbx.xfel GUI/Run Stats tab|Run Stats tab]] and useful when tuning spot finding. Uses a lot of disk space.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Require stream 80 / 81 (FEE spectrometer) before processing&#039;&#039;&#039; || Do not process a run until the FEE spectrometer stream is present, so that per-image wavelengths are available.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Standalone options ===&lt;br /&gt;
In standalone mode the run sentinel watches a folder for new data and turns each file or folder it finds into a run.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Option !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Folder to monitor&#039;&#039;&#039; || The directory new data appear in.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Monitor for&#039;&#039;&#039; || &#039;&#039;files&#039;&#039;: every file in the folder matching the template is a run. &#039;&#039;folders&#039;&#039;: every sub-folder is a run (or, with composite files, each matching file in each sub-folder is a run).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Run complete criteria&#039;&#039;&#039; || For folders. &#039;&#039;Status file&#039;&#039;: the folder is complete when it contains a Cheetah-style &amp;lt;code&amp;gt;status.txt&amp;lt;/code&amp;gt; whose &amp;lt;code&amp;gt;Status&amp;lt;/code&amp;gt; is &amp;lt;code&amp;gt;Finished&amp;lt;/code&amp;gt;. &#039;&#039;Number of files&#039;&#039;: complete once it holds at least &#039;&#039;&#039;Number of files per run&#039;&#039;&#039; matching files.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Minimum time since last modified&#039;&#039;&#039; / &#039;&#039;&#039;Minimum file size&#039;&#039;&#039; || For files. A file is only picked up once it has been untouched for this many seconds and is at least this many bytes, so that files still being written are not processed.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;File matching template&#039;&#039;&#039; || Glob pattern for data files, for example &amp;lt;code&amp;gt;*.h5&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;*.cbf&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Files are composite&#039;&#039;&#039; || Tick for formats where one file holds many images (HDF5, NeXus): each file becomes its own run. Untick for one-image-per-file formats, where the whole folder becomes a single run.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Run names in standalone mode are derived from the file or folder names (for example &amp;lt;code&amp;gt;run_0012_data&amp;lt;/code&amp;gt; for a composite file &amp;lt;code&amp;gt;data.h5&amp;lt;/code&amp;gt; in folder &amp;lt;code&amp;gt;run_0012&amp;lt;/code&amp;gt;). Run blocks in standalone mode therefore select runs by database id, in order of discovery, rather than by run number.&lt;br /&gt;
&lt;br /&gt;
== Advanced settings ==&lt;br /&gt;
Opened with &#039;&#039;&#039;Advanced Settings...&#039;&#039;&#039;. The controls shown depend on the chosen multiprocessing method.&lt;br /&gt;
&lt;br /&gt;
=== Multiprocessing options ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Option !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Multiprocessing&#039;&#039;&#039; || How jobs are run: &#039;&#039;local&#039;&#039; (on this machine, one job at a time), &#039;&#039;lsf&#039;&#039;, &#039;&#039;slurm&#039;&#039;, &#039;&#039;shifter&#039;&#039; (Slurm with a Shifter container, for NERSC), &#039;&#039;sge&#039;&#039;, &#039;&#039;pbs&#039;&#039;, &#039;&#039;htcondor&#039;&#039; or &#039;&#039;custom&#039;&#039; (a user-supplied submission template, set in the settings file).&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Queue&#039;&#039;&#039; || Queue or partition to submit to. A drop-down of the LCLS queues for LSF at LCLS, a free text field otherwise.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Total number of processors&#039;&#039;&#039; || Processes per job (MPI ranks). With the LCLS queues this snaps to the core count of a node.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Total number of nodes&#039;&#039;&#039; / &#039;&#039;&#039;Max Walltime&#039;&#039;&#039; || Shifter only: nodes per job and the time limit in minutes.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Number of processors per node&#039;&#039;&#039; || &#039;&#039;Auto&#039;&#039; lets the queuing system decide; otherwise an explicit count. Together with the total number of processors this determines the node count.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;MPI command&#039;&#039;&#039; || The command that launches MPI programs, for example &amp;lt;code&amp;gt;mpirun&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt;, with any extra arguments.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Environment setup script&#039;&#039;&#039; || A script that is sourced at the start of each job to set up the cctbx environment, when the compute nodes do not inherit yours.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Phenix setup script&#039;&#039;&#039; || Likewise for Phenix, used by Phenix tasks in datasets.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Nodes per job&#039;&#039;&#039; || Slurm, PBS and Shifter: a separate node count for &#039;&#039;Indexing&#039;&#039;, &#039;&#039;TDER&#039;&#039; (time-dependent ensemble refinement), &#039;&#039;Scaling&#039;&#039; and &#039;&#039;Merging&#039;&#039; jobs, since merging usually needs more nodes than indexing a single run.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Extra submission arguments&#039;&#039;&#039; || One per line; appended to the submission command (&amp;lt;code&amp;gt;sbatch&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bsub&amp;lt;/code&amp;gt;, ...). Use this for account names, memory requests and similar.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Shifter settings&#039;&#039;&#039; || Shifter image name, the sbatch and srun script templates, job name, NERSC project (&amp;lt;code&amp;gt;-A&amp;lt;/code&amp;gt;), reservation, constraint, and whether to stage logs to the DataWarp burst buffer.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;HTCondor settings&#039;&#039;&#039; || Path to the MPI executable script (&amp;lt;code&amp;gt;openmpiscript&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;mp2script&amp;lt;/code&amp;gt;) and the shared file system domain.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
One further parameter has no control: &amp;lt;code&amp;gt;mp.max_queued&amp;lt;/code&amp;gt; in the settings file limits how many jobs may be running or queued at once; the job sentinel waits when the limit is reached.&lt;br /&gt;
&lt;br /&gt;
=== Data analysis options ===&lt;br /&gt;
&#039;&#039;&#039;Processing back end&#039;&#039;&#039; chooses the program each indexing job runs:&lt;br /&gt;
* &#039;&#039;cctbx.xfel&#039;&#039; (&amp;lt;code&amp;gt;cctbx.xfel.process&amp;lt;/code&amp;gt;): DIALS spot finding, indexing, refinement and integration with stills-specific defaults. The usual choice.&lt;br /&gt;
* &#039;&#039;Small cell&#039;&#039; (&amp;lt;code&amp;gt;cctbx.xfel.small_cell_process&amp;lt;/code&amp;gt;): small-cell indexing (Brewster 2015) followed by DIALS refinement and integration.&lt;br /&gt;
* &#039;&#039;custom&#039;&#039;: any other program name. Trial parameters are validated against the chosen program&#039;s PHIL scope.&lt;br /&gt;
&lt;br /&gt;
Changing the back end after trials exist is not recommended, since the trials&#039; parameters were written for the previous program.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI&amp;diff=1791</id>
		<title>Cctbx.xfel GUI</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel_GUI&amp;diff=1791"/>
		<updated>2026-10-09T20:47:49Z</updated>

		<summary type="html">&lt;p&gt;Aaron: Created page with &amp;quot;{{DISPLAYTITLE:cctbx.xfel GUI}} The &amp;#039;&amp;#039;&amp;#039;cctbx.xfel GUI&amp;#039;&amp;#039;&amp;#039; is the graphical front end for processing serial crystallography data with cctbx.xfel and DIALS. It watches for new runs as they are collected, submits processing jobs to a cluster or to the local machine, records everything in a database, and shows live feedback on hit rates, indexing rates, unit cells and merging statistics. It can also take a finished set of runs through ensemble refinement, scaling and merging,...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:cctbx.xfel GUI}}&lt;br /&gt;
The &#039;&#039;&#039;cctbx.xfel GUI&#039;&#039;&#039; is the graphical front end for processing serial crystallography data with cctbx.xfel and DIALS. It watches for new runs as they are collected, submits processing jobs to a cluster or to the local machine, records everything in a database, and shows live feedback on hit rates, indexing rates, unit cells and merging statistics. It can also take a finished set of runs through ensemble refinement, scaling and merging, and on to Phenix.&lt;br /&gt;
&lt;br /&gt;
This page explains the ideas behind the GUI and the layout of the main window. The tabs and dialogs are documented on their own pages, and the GUI&#039;s &#039;&#039;&#039;Help&#039;&#039;&#039; toolbar button opens the page for whichever tab is showing.&lt;br /&gt;
&lt;br /&gt;
== Pages ==&lt;br /&gt;
* [[cctbx.xfel GUI/Settings|Settings and login]]: connecting to the database, choosing the facility, the output folder and the queuing system, saving projects.&lt;br /&gt;
* [[cctbx.xfel GUI/Runs tab|Runs tab]]: the list of runs and their sample tags; image averaging.&lt;br /&gt;
* [[cctbx.xfel GUI/Energy tab|Energy tab]]: FEE spectrometer and ebeam energy calibration (LCLS only).&lt;br /&gt;
* [[cctbx.xfel GUI/Trials tab|Trials tab]]: processing parameters (trials) and which runs they apply to (run blocks).&lt;br /&gt;
* [[cctbx.xfel GUI/Jobs tab|Jobs tab]]: every submitted job and its status; stopping, deleting and restarting jobs.&lt;br /&gt;
* [[cctbx.xfel GUI/Run Stats tab|Run Stats tab]]: live hit rate, indexing rate and resolution plots.&lt;br /&gt;
* [[cctbx.xfel GUI/Unit Cell tab|Unit Cell tab]]: unit cell histograms and clustering.&lt;br /&gt;
* [[cctbx.xfel GUI/Datasets tab|Datasets tab]]: the post-processing pipeline (ensemble refinement, scaling, merging, Phenix).&lt;br /&gt;
* [[cctbx.xfel GUI/Merging Stats tab|Merging Stats tab]]: merging statistics and cosym embedding plots per dataset version.&lt;br /&gt;
* [[cctbx.xfel GUI/Workflows|Workflows]]: step-by-step recipes for common tasks.&lt;br /&gt;
* [[cctbx.xfel GUI/Troubleshooting|Troubleshooting]]: what the red lights mean, where the logs are, and common problems.&lt;br /&gt;
&lt;br /&gt;
== How the GUI works ==&lt;br /&gt;
&lt;br /&gt;
=== Everything lives in a database ===&lt;br /&gt;
The GUI keeps its state in a MySQL database rather than in files. Runs, tags, trials, run blocks, jobs, datasets and the per-image results of processing (spots found, unit cells, resolution, and so on) are all database rows. This has two consequences worth knowing from the start:&lt;br /&gt;
&lt;br /&gt;
* Several copies of the GUI can be connected to the same experiment at once, for example one submitting jobs at the beamline and one just watching the statistics from an office. See &#039;&#039;Monitoring mode&#039;&#039; below.&lt;br /&gt;
* Closing and reopening the GUI loses nothing. Every trial and job is still there when you reconnect.&lt;br /&gt;
&lt;br /&gt;
All tables for one experiment share a prefix called the &#039;&#039;&#039;experiment tag&#039;&#039;&#039; (for example &amp;lt;code&amp;gt;cxi12345_v1&amp;lt;/code&amp;gt;). Changing the experiment tag is effectively starting a fresh, empty experiment in the same database. The tag and the connection settings are entered in the [[cctbx.xfel GUI/Settings|Settings dialog]] when the GUI starts, and cannot be changed without restarting.&lt;br /&gt;
&lt;br /&gt;
The processing jobs themselves write their results to the &#039;&#039;&#039;output folder&#039;&#039;&#039; on disk (see &#039;&#039;Where the results go&#039;&#039; below) and log summaries of each image back to the database as they run. The GUI&#039;s plots are drawn from those database records.&lt;br /&gt;
&lt;br /&gt;
=== Runs and tags ===&lt;br /&gt;
A &#039;&#039;&#039;run&#039;&#039;&#039; is the unit of data collection: at LCLS it is an XTC run number; in standalone mode it is a file or folder of images (see [[cctbx.xfel GUI/Settings#Standalone options|Standalone options]]). The &#039;&#039;&#039;run sentinel&#039;&#039;&#039; polls for new runs and adds them to the database.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Tags&#039;&#039;&#039; are free-form labels attached to runs, typically sample names or conditions (&amp;lt;code&amp;gt;lysozyme&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;dark&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;pump_on&amp;lt;/code&amp;gt;, ...). A run can carry any number of tags. Tags are what the later stages use to select data: the Run Stats, Unit Cell and Datasets pages all select runs by tag, so tagging runs consistently as they arrive is the single most useful habit when running the GUI live. The [[cctbx.xfel GUI/Runs tab|Runs tab]] is where tags are created and applied, and &#039;&#039;&#039;persistent tags&#039;&#039;&#039; can be applied automatically to every new run.&lt;br /&gt;
&lt;br /&gt;
=== Trials and run blocks ===&lt;br /&gt;
A &#039;&#039;&#039;trial&#039;&#039;&#039; is a set of processing parameters: spot finding, indexing and integration settings for &amp;lt;code&amp;gt;cctbx.xfel.process&amp;lt;/code&amp;gt; (or whichever back end is configured). Trials are numbered, and a new trial starts as a copy of the previous one so that tuning parameters is a matter of changing a few values and creating a new trial. Trials are never edited after creation (except for their comment); to change parameters, create a new trial. This keeps the provenance of every result unambiguous: results are stored under the trial number that produced them.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;run block&#039;&#039;&#039; (also called a rungroup, and labelled &amp;lt;code&amp;gt;rg&amp;lt;/code&amp;gt; in paths and job listings) is a contiguous range of runs together with the detector and beam settings that apply to them: detector address, beam centre and distance, binning, energy override, reference geometry, pixel mask and so on. A run block can be &#039;&#039;open&#039;&#039; (new runs are added to it automatically as they arrive) or have an explicit end run. Run blocks belong to trials, and the same run block can be shared by several trials.&lt;br /&gt;
&lt;br /&gt;
The GUI submits one processing job for every combination of &#039;&#039;active trial&#039;&#039; × &#039;&#039;run block in that trial&#039;&#039; × &#039;&#039;run in that block&#039;&#039;. Marking a trial active is therefore what starts processing, and deactivating it stops new jobs from being submitted (running jobs continue).&lt;br /&gt;
&lt;br /&gt;
=== Jobs and sentinels ===&lt;br /&gt;
&#039;&#039;&#039;Sentinels&#039;&#039;&#039; are background threads inside the GUI that poll the database and the queuing system. Each has a status light at the bottom of the window (see below). The two most important are toggled from the toolbar:&lt;br /&gt;
&lt;br /&gt;
* The &#039;&#039;&#039;run sentinel&#039;&#039;&#039; (&amp;quot;Watch for new runs&amp;quot;) looks for new runs every 10 seconds, adds them to the database, applies persistent tags, and extends open run blocks to include them.&lt;br /&gt;
* The &#039;&#039;&#039;job sentinel&#039;&#039;&#039; (&amp;quot;Auto-submit jobs&amp;quot;) looks every 10 seconds for work that has not been submitted yet: indexing jobs for active trials, and the pipeline stages of active datasets. It submits them using the multiprocessing settings from the Settings dialog (local, Slurm, LSF, ...).&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;job monitor&#039;&#039;&#039; queries the queuing system for the status of every unfinished job and records it in the database. It runs while the Jobs or Run Stats tab is showing.&lt;br /&gt;
&lt;br /&gt;
The other sentinels (run stats, unit cell, merging stats, calibration worker) redraw the plots on their tabs and run only while that tab is showing.&lt;br /&gt;
&lt;br /&gt;
=== Datasets, tasks and versions ===&lt;br /&gt;
Indexing and integration produce one result per image. To get a merged reflection file a &#039;&#039;&#039;dataset&#039;&#039;&#039; is needed. A dataset selects runs (one trial, and a set of tags combined by &#039;&#039;intersection&#039;&#039; or &#039;&#039;union&#039;&#039;) and runs a pipeline of &#039;&#039;&#039;tasks&#039;&#039;&#039; over them:&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Indexing&#039;&#039;&#039;: the trial&#039;s own integration results (nothing new is run).&lt;br /&gt;
# &#039;&#039;&#039;Ensemble refinement&#039;&#039;&#039; (optional): time-dependent ensemble refinement of detector geometry and crystal models, followed by reintegration, per run.&lt;br /&gt;
# &#039;&#039;&#039;Scaling&#039;&#039;&#039;: filters lattices (unit cell, correlation to a reference) and scales each run against a reference model, or prepares them for a reference-free merge.&lt;br /&gt;
# &#039;&#039;&#039;Merging&#039;&#039;&#039;: merges every scaled run into one MTZ file, with statistics.&lt;br /&gt;
# &#039;&#039;&#039;Phenix&#039;&#039;&#039; (optional): any Phenix command run on the merged MTZ.&lt;br /&gt;
&lt;br /&gt;
The first three are &#039;&#039;local&#039;&#039; tasks that run once per run and chain automatically: each starts when the previous task for that run has finished. Merging and Phenix are &#039;&#039;global&#039;&#039; tasks that run once over all finished runs. Each time merging runs it creates a new &#039;&#039;&#039;dataset version&#039;&#039;&#039; (&amp;lt;code&amp;gt;v000&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;v001&amp;lt;/code&amp;gt;, ...). As more runs finish during an experiment, the job sentinel keeps rolling new versions, so the merged data set grows while data are still being collected. See the [[cctbx.xfel GUI/Datasets tab|Datasets tab]].&lt;br /&gt;
&lt;br /&gt;
=== Projects (saved settings) ===&lt;br /&gt;
All of the settings entered in the Settings dialog (database connection, experiment tag, facility, output folder, queuing) are saved together as a &#039;&#039;&#039;project&#039;&#039;&#039; in &amp;lt;code&amp;gt;~/.cctbx.xfel/settings_&amp;lt;name&amp;gt;.phil&amp;lt;/code&amp;gt;. The GUI starts with the most recently used project, and the Settings dialog can load or save projects by name, so switching between experiments is a matter of loading a different project. The environment variable &amp;lt;code&amp;gt;CCTBX_XFEL_SETTINGS&amp;lt;/code&amp;gt; can point at an explicit settings file instead.&lt;br /&gt;
&lt;br /&gt;
== The main window ==&lt;br /&gt;
&lt;br /&gt;
=== Toolbar ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Button !! What it does&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Quit&#039;&#039;&#039; || Stops all sentinels, saves the settings and closes the GUI. Jobs already submitted keep running.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Watch for new runs&#039;&#039;&#039; || Starts or stops the run sentinel. The icon changes to a pause symbol while it is running and the &#039;&#039;Run Sentinel&#039;&#039; light turns green.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Auto-submit jobs&#039;&#039;&#039; || Starts or stops the job sentinel. While it runs, every active trial and dataset gets its jobs submitted automatically. The &#039;&#039;Job Sentinel&#039;&#039; light turns green.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Settings&#039;&#039;&#039; || Opens the [[cctbx.xfel GUI/Settings|Settings dialog]]. The database connection and experiment tag are locked while the GUI is connected; everything else (output folder, queue, number of processors, facility options) can be changed and takes effect for jobs submitted afterwards.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Large text&#039;&#039;&#039; || Toggles larger text and markers in the Run Stats and Unit Cell plots, for reading from across a control room. Takes effect on the next redraw.&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Help&#039;&#039;&#039; || Opens this documentation in the default web browser, at the page for the tab currently showing. Also available from the &#039;&#039;Help&#039;&#039; menu as &#039;&#039;Online help&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;Watch for new runs&#039;&#039;, &#039;&#039;Auto-submit jobs&#039;&#039; and &#039;&#039;Settings&#039;&#039; buttons are hidden in monitoring mode.&lt;br /&gt;
&lt;br /&gt;
=== Tabs ===&lt;br /&gt;
The tabs, from left to right: [[cctbx.xfel GUI/Runs tab|Runs]], [[cctbx.xfel GUI/Energy tab|Energy]] (LCLS only), [[cctbx.xfel GUI/Trials tab|Trials]], [[cctbx.xfel GUI/Jobs tab|Jobs]], [[cctbx.xfel GUI/Run Stats tab|Run Stats]], [[cctbx.xfel GUI/Unit Cell tab|Unit Cell]], [[cctbx.xfel GUI/Datasets tab|Datasets]] and [[cctbx.xfel GUI/Merging Stats tab|Merging stats]]. They follow the order of a typical experiment: tag the runs, set up a trial, watch the jobs and the statistics, build a dataset, and watch the merging statistics.&lt;br /&gt;
&lt;br /&gt;
Switching to a tab starts the sentinel that feeds it and switching away stops it, so only the visible tab costs database queries.&lt;br /&gt;
&lt;br /&gt;
=== Status lights ===&lt;br /&gt;
A row of lights along the bottom of the window shows the state of each background thread.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Colour !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| grey (off) || The thread is not running.&lt;br /&gt;
|-&lt;br /&gt;
| green (on) || The thread is running and waiting for its next cycle.&lt;br /&gt;
|-&lt;br /&gt;
| yellow || The thread is in the middle of a cycle (querying the database or the queue, or redrawing a plot).&lt;br /&gt;
|-&lt;br /&gt;
| red (alert) || The thread hit an error and has stopped. The error is printed in the terminal the GUI was started from. See [[cctbx.xfel GUI/Troubleshooting|Troubleshooting]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Light !! Thread !! Runs when&lt;br /&gt;
|-&lt;br /&gt;
| Run Sentinel || Finds new runs || &#039;&#039;Watch for new runs&#039;&#039; is on&lt;br /&gt;
|-&lt;br /&gt;
| Calib Worker || Runs FEE and ebeam calibrations || The Energy tab is showing&lt;br /&gt;
|-&lt;br /&gt;
| Job Sentinel || Submits jobs || &#039;&#039;Auto-submit jobs&#039;&#039; is on&lt;br /&gt;
|-&lt;br /&gt;
| Job Monitor || Tracks job status in the queue || The Jobs or Run Stats tab is showing&lt;br /&gt;
|-&lt;br /&gt;
| Run Stats Sentinel || Redraws the Run Stats plot (every 5 s) || The Run Stats tab is showing and &#039;&#039;Auto update&#039;&#039; is ticked&lt;br /&gt;
|-&lt;br /&gt;
| Unit Cell Sentinel || Redraws the unit cell plot (every 15 s) || The Unit Cell tab is showing and &#039;&#039;Auto update&#039;&#039; is ticked&lt;br /&gt;
|-&lt;br /&gt;
| Merging Stats Sentinel || Redraws the merging statistics (every 5 s) || The Merging stats tab is showing&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Monitoring mode ===&lt;br /&gt;
Starting the GUI with &amp;lt;code&amp;gt;monitoring_mode=True&amp;lt;/code&amp;gt; (in the settings file or on the command line) gives a read-only view of an experiment: the Runs, Trials, Jobs and Datasets tabs and the submit buttons are hidden, leaving the Run Stats, Unit Cell and Merging stats tabs. Use it for a second copy of the GUI connected to the same database, so that only one copy submits jobs.&lt;br /&gt;
&lt;br /&gt;
== Where the results go ==&lt;br /&gt;
Everything written by jobs goes under the &#039;&#039;output folder&#039;&#039; chosen in the Settings dialog.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Path !! Contents&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;r0012/003_rg005/&amp;lt;/code&amp;gt; || Indexing and integration results for run 12, trial 3, run block 5. Inside: &amp;lt;code&amp;gt;out/&amp;lt;/code&amp;gt; holds the integrated experiments and reflections (&amp;lt;code&amp;gt;*_integrated.expt&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;*_integrated.refl&amp;lt;/code&amp;gt;); &amp;lt;code&amp;gt;stdout/log.out&amp;lt;/code&amp;gt; is the job log; &amp;lt;code&amp;gt;all/&amp;lt;/code&amp;gt; holds every image converted to CBF when &#039;&#039;Dump all images&#039;&#039; is on (LCLS). In standalone mode with non-numeric run names the folder is named after the run instead of &amp;lt;code&amp;gt;r0012&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;r0012/003_rg005/task007/&amp;lt;/code&amp;gt; || Results of dataset task 7 (ensemble refinement or scaling) for that run, trial and block.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;&amp;lt;dataset name&amp;gt;/v001/&amp;lt;/code&amp;gt; || Merging output for version 1 of a dataset: the merged MTZ (&amp;lt;code&amp;gt;&amp;lt;name&amp;gt;_v001_all.mtz&amp;lt;/code&amp;gt;), the merging log, and the cosym embedding plots if cosym ran. Phenix tasks write here too.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;averages/&amp;lt;/code&amp;gt; || Average, maximum and standard deviation images from the Runs tab &#039;&#039;Average&#039;&#039; button.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;cluster/&amp;lt;/code&amp;gt; || Unit cell cluster files written by the Unit Cell tab, for use by the scaling stage of a dataset.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;MySql/&amp;lt;/code&amp;gt; || Data files of a locally started database server (default location).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The GUI&#039;s own files are in &amp;lt;code&amp;gt;~/.cctbx.xfel/&amp;lt;/code&amp;gt;: the project settings bundles and a &amp;lt;code&amp;gt;cfgs/&amp;lt;/code&amp;gt; folder holding the PHIL and locator files generated for every job.&lt;br /&gt;
&lt;br /&gt;
== Starting the GUI ==&lt;br /&gt;
&amp;lt;pre&amp;gt;cctbx.xfel&amp;lt;/pre&amp;gt;&lt;br /&gt;
opens the login (Settings) dialog followed by the main window. &amp;lt;code&amp;gt;cctbx.xfel -h&amp;lt;/code&amp;gt; prints every configuration parameter with its help text; any of them can be given on the command line, for example &amp;lt;code&amp;gt;cctbx.xfel monitoring_mode=True&amp;lt;/code&amp;gt;. The GUI prints progress and error messages to the terminal it was started from, so keep that terminal visible.&lt;br /&gt;
&lt;br /&gt;
Older documentation: [http://cci.lbl.gov/publications/download/CCN_2019_p22_Brewster.pdf Brewster et al. (2019), Computational Crystallography Newsletter 10, 22].&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1790</id>
		<title>Cctbx.xfel.merge</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1790"/>
		<updated>2026-08-21T23:44:27Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:&#039;&#039;cctbx.xfel.merge&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;cctbx.xfel.merge&#039;&#039;&#039;&#039;&#039; is the scaling, post-refinement and merging program of cctbx.xfel. It takes&lt;br /&gt;
the per-image integrated results produced by &#039;&#039;[[dials.stills_process]]&#039;&#039; — one crystal per still shot —&lt;br /&gt;
and reduces the whole ensemble to a single set of merged structure-factor intensities (an MTZ file)&lt;br /&gt;
suitable for structure solution and refinement, together with the crystallographic quality&lt;br /&gt;
statistics (completeness, multiplicity, ⟨I/σ⟩, CC½, CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R-factors, etc.).&lt;br /&gt;
&lt;br /&gt;
Because serial datasets routinely contain tens of thousands to millions of still shots,&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is built from the ground up to run under MPI across many nodes. It is&lt;br /&gt;
almost always launched with &amp;lt;code&amp;gt;mpirun&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt;.  Note that MPI uses the term &#039;ranks&#039;&lt;br /&gt;
to distinguish independent processes that are running across one or more nodes.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is organized as a sequence of &#039;&#039;&#039;workers&#039;&#039;&#039;. Each worker performs one&lt;br /&gt;
task — reading data, applying a correction, filtering, scaling, post-refining, computing a statistic,&lt;br /&gt;
or merging — and passes its (possibly modified) experiments and reflections on to the next worker.&lt;br /&gt;
The list of workers to run is the &amp;quot;step list&amp;quot;, and it is fully configurable: you can add, remove or&lt;br /&gt;
reorder steps with &amp;lt;code&amp;gt;dispatch.step_list&amp;lt;/code&amp;gt;. This is what makes the program flexible enough to&lt;br /&gt;
scale-and-merge in one pass, to scale subsets separately and merge later, or to run a reference-free&lt;br /&gt;
bootstrap.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;default&#039;&#039;&#039; step list is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! # !! Worker !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| 1 || &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; || Read integrated experiments (&amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;) and reflections (&amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt;) from disk in DIALS format.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || &amp;lt;code&amp;gt;balance&amp;lt;/code&amp;gt; || Redistribute the input load evenly across MPI ranks (needed when there are fewer or more input files than ranks).&lt;br /&gt;
|-&lt;br /&gt;
| 3 || &amp;lt;code&amp;gt;model_scaling&amp;lt;/code&amp;gt; || Build the full Miller list, model intensities from the reference, and the resolution binner used for scaling and post-refinement.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || &amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt; || Apply per-reflection modifications, e.g. polarization correction (and optionally re-indexing to resolve indexing ambiguity — see &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;reindex_to_reference&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 5 || &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; || Reject whole experiments (or reflections) by resolution, unit cell, correlation to the reference, energy, etc.&lt;br /&gt;
|-&lt;br /&gt;
| 6 || &amp;lt;code&amp;gt;scale&amp;lt;/code&amp;gt; || Scale each lattice to the reference dataset (&amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;) or simply average (&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 7 || &amp;lt;code&amp;gt;postrefine&amp;lt;/code&amp;gt; || Post-refine per-image crystal parameters and partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| 8 || &amp;lt;code&amp;gt;statistics_unitcell&amp;lt;/code&amp;gt; || Determine and store the average unit cell.&lt;br /&gt;
|-&lt;br /&gt;
| 9 || &amp;lt;code&amp;gt;statistics_beam&amp;lt;/code&amp;gt; || Determine and store the average wavelength.&lt;br /&gt;
|-&lt;br /&gt;
| 10 || &amp;lt;code&amp;gt;model_statistics&amp;lt;/code&amp;gt; || Rebuild the Miller list / binner for statistics (may use the average unit cell).&lt;br /&gt;
|-&lt;br /&gt;
| 11 || &amp;lt;code&amp;gt;statistics_resolution&amp;lt;/code&amp;gt; || Per-crystal resolution statistics.&lt;br /&gt;
|-&lt;br /&gt;
| 12 || &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt; || Redistribute reflections across ranks so that every observation of a given HKL is gathered on the same rank prior to merging.&lt;br /&gt;
|-&lt;br /&gt;
| 13 || &amp;lt;code&amp;gt;errors_merge&amp;lt;/code&amp;gt; || Correct the merged error estimates with a per-HKL error model (e.g. Ev11, Brewster 2019b, or MM24 (the default), Mittan-Moreau (2025)).&lt;br /&gt;
|-&lt;br /&gt;
| 14 || &amp;lt;code&amp;gt;statistics_intensity&amp;lt;/code&amp;gt; || Intensity statistics by resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 15 || &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; || Merge symmetry-equivalent intensities, gather all HKLs at rank 0, and write &amp;quot;odd&amp;quot;, &amp;quot;even&amp;quot; and &amp;quot;all&amp;quot; MTZ files.&lt;br /&gt;
|-&lt;br /&gt;
| 16 || &amp;lt;code&amp;gt;statistics_intensity_cxi&amp;lt;/code&amp;gt; || Correlation and R-factor statistics (ported from cxi.merge): the &amp;quot;Table of Scaling Results&amp;quot; — CC½ (half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Additional, non-default workers are available and can be&lt;br /&gt;
inserted into the step list, including &amp;lt;code&amp;gt;tdata&amp;lt;/code&amp;gt; (write out unit cells for clustering),&lt;br /&gt;
&amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; (batch MTZ for &#039;&#039;Careless&#039;&#039;), &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; (upload merged files to a&lt;br /&gt;
Google Drive folder), &amp;lt;code&amp;gt;monitor&amp;lt;/code&amp;gt; (resource-usage logging), &amp;lt;code&amp;gt;integrate&amp;lt;/code&amp;gt;&lt;br /&gt;
(on-the-fly integration), &amp;lt;code&amp;gt;prepare&amp;lt;/code&amp;gt; (SpReAD energy binning), and&lt;br /&gt;
&amp;lt;code&amp;gt;lunus&amp;lt;/code&amp;gt; (diffuse-scattering deck). A &amp;lt;code&amp;gt;deltaccint&amp;lt;/code&amp;gt; worker (ΔCC½ lattice&lt;br /&gt;
filtering) can be added after &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;. Custom workers can be supplied through the&lt;br /&gt;
&amp;lt;code&amp;gt;XFEL_CUSTOM_WORKER_PATH&amp;lt;/code&amp;gt; environment variable.&lt;br /&gt;
&lt;br /&gt;
= Basic usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is run under MPI:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mpirun cctbx.xfel.merge merge.phil&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical &amp;lt;code&amp;gt;merge.phil&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input.path=&amp;lt;path to data&amp;gt;&lt;br /&gt;
input.experiments_suffix=.expt&lt;br /&gt;
input.reflections_suffix=.refl&lt;br /&gt;
&lt;br /&gt;
filter.algorithm=unit_cell&lt;br /&gt;
filter.unit_cell.value.relative_length_tolerance=0.03&lt;br /&gt;
filter.outlier.min_corr=0.1&lt;br /&gt;
&lt;br /&gt;
select.algorithm=significance_filter&lt;br /&gt;
select.significance_filter.sigma=0.1&lt;br /&gt;
select.significance_filter.min_ct=200&lt;br /&gt;
select.significance_filter.max_ct=300&lt;br /&gt;
&lt;br /&gt;
scaling.model=&amp;lt;model.pdb or model.mtz&amp;gt;&lt;br /&gt;
scaling.resolution_scalar=0.96&lt;br /&gt;
&lt;br /&gt;
merging.d_min=1.8&lt;br /&gt;
merging.error.model=mm24&lt;br /&gt;
merging.merge_anomalous=True&lt;br /&gt;
&lt;br /&gt;
postrefinement.enable=True&lt;br /&gt;
statistics.n_bins=20&lt;br /&gt;
&lt;br /&gt;
output.output_dir=&amp;lt;output folder&amp;gt;&lt;br /&gt;
output.prefix=&amp;lt;prefix for output files&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explore the parameters with:&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c&amp;lt;/code&amp;gt; — show configurable parameters&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c -e 10 -a 2&amp;lt;/code&amp;gt; — show all parameters (expert level 10) with full help text&lt;br /&gt;
&lt;br /&gt;
= Two-stage scaling and merging =&lt;br /&gt;
&lt;br /&gt;
For large, growing datasets (the mode used by the [[cctbx.xfel GUI]]), it is more efficient to scale&lt;br /&gt;
and post-refine each subset of data &#039;&#039;&#039;once&#039;&#039;&#039;, then merge repeatedly as more data arrive. This is&lt;br /&gt;
done by running the program twice with different step lists.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 1 — scale each subset&#039;&#039;&#039; (stops after per-image work and writes intermediate DIALS files):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input balance model_scaling modify filter scale postrefine \&lt;br /&gt;
    statistics_unitcell statistics_beam model_statistics statistics_resolution&lt;br /&gt;
output.save_experiments_and_reflections=True&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;output.save_experiments_and_reflections=True&amp;lt;/code&amp;gt; dumps the scaled/post-refined data as&lt;br /&gt;
experiment lists and reflection tables that the merge stage can read back in.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 2 — merge the scaled subsets&#039;&#039;&#039; (add an &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; for each finished subset):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input model_scaling statistics_unitcell statistics_beam \&lt;br /&gt;
    model_statistics statistics_resolution group errors_merge statistics_intensity \&lt;br /&gt;
    merge statistics_intensity_cxi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Merging without a reference (bootstrap / mark1) =&lt;br /&gt;
&lt;br /&gt;
If no scaling/merging reference is available, use a bootstrap procedure. First run the&lt;br /&gt;
&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; algorithm, which simply averages the data (all per-image scale factors = 1, no&lt;br /&gt;
post-refinement), specifying the target cell and symmetry explicitly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
scaling.algorithm=mark1&lt;br /&gt;
scaling.unit_cell=&amp;lt;unit cell&amp;gt;&lt;br /&gt;
scaling.space_group=&amp;lt;space group&amp;gt;&lt;br /&gt;
merging.error.model=errors_from_sample_residuals&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting MTZ is then used as the reference (&amp;lt;code&amp;gt;scaling.model=&amp;lt;/code&amp;gt;) for subsequent regular&lt;br /&gt;
merges. Iterate a few cycles; CC½ typically improves and converges over the first few rounds.&lt;br /&gt;
&lt;br /&gt;
= Important parameters =&lt;br /&gt;
&lt;br /&gt;
Parameters are given by their full PHIL path with defaults in parentheses. The program exposes many&lt;br /&gt;
more parameters (see &amp;lt;code&amp;gt;-c -e 10 -a 2&amp;lt;/code&amp;gt;); those below are the ones most commonly set.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; || None || Path(s) to the integrated data — a folder, several folders, or individual files; wildcards allowed; may be repeated. Matching &amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt; files must both be present.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.experiments_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.expt&amp;lt;/code&amp;gt; || Only load experiment files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.reflections_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.refl&amp;lt;/code&amp;gt; || Only load reflection files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.parallel_file_load.method&amp;lt;/code&amp;gt; || uniform || &amp;lt;code&amp;gt;uniform&amp;lt;/code&amp;gt; spreads input files evenly over all ranks; &amp;lt;code&amp;gt;node_memory&amp;lt;/code&amp;gt; distributes so per-node memory limits are respected.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.alist.file&amp;lt;/code&amp;gt; || None || Path to a text file of experiment tags or filenames; combined with &amp;lt;code&amp;gt;input.alist.op=keep|reject&amp;lt;/code&amp;gt; to merge only (or exclude) a specified subset.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.persistent_refl_cols&amp;lt;/code&amp;gt; || None || Reflection-table columns to preserve through the pruning steps (and into saved tables).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Filtering whole experiments (&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;) ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;entire experiments&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;n_obs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resolution&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;unit_cell&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;energy&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bootstrap&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;experiment_prefix&amp;lt;/code&amp;gt;. Nothing is filtered unless listed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.algorithm&amp;lt;/code&amp;gt; || value || How to restrict unit cells: &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; (compare to a target), &amp;lt;code&amp;gt;range&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;cluster&amp;lt;/code&amp;gt; (use a precomputed covariance clustering).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.relative_length_tolerance&amp;lt;/code&amp;gt; || 0.1 || Fractional deviation of cell edge lengths allowed vs. the target cell. Often tightened (e.g. 0.03).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.absolute_angle_tolerance&amp;lt;/code&amp;gt; || 2.0 || Allowed cell-angle deviation (degrees) vs. the target.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.target_unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;target_space_group&amp;lt;/code&amp;gt; || Auto || Target cell/symmetry; &amp;lt;code&amp;gt;Auto&amp;lt;/code&amp;gt; uses the scaling model.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.outlier.min_corr&amp;lt;/code&amp;gt; || 0.1 || Minimum correlation of an image&#039;s intensities to the reference model; images below this are rejected. Only applied when a scaling model is present. Use &amp;lt;code&amp;gt;-1&amp;lt;/code&amp;gt; to accept all images regardless of correlation.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.resolution.d_min&amp;lt;/code&amp;gt; || None || Reject an experiment unless some of its reflections extend beyond this resolution.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Selecting individual reflections (&amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt;) ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;individual reflections&#039;&#039;&#039; (contrast with&lt;br /&gt;
&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;, which acts on whole experiments).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;significance_filter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;panel&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cspad_sensor&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;isolation_forest&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;target_energy&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.sigma&amp;lt;/code&amp;gt; || 0.5 || Trim each lattice at the resolution where the binned ⟨I/σ⟩ drops below this value.  Often reduced to 0.1.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.min_ct&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;max_ct&amp;lt;/code&amp;gt; || 10 / 50 || Target minimum/maximum mean reflections per resolution bin when choosing the number of bins. For large unit cells these are often raised (e.g. 200/300); for small cells, use the defaults.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Modifying intensities (&amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt;) ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.algorithm&amp;lt;/code&amp;gt; || polarization || Per-reflection corrections to apply (default applies the polarization correction).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt; || — || Resolve an indexing ambiguity across the ensemble using the Gildea/Winter (Brehm/Diederichs) cosym method, optionally anchored to &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.reindex_to_reference&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;reindex_to_abc&amp;lt;/code&amp;gt; || — || Alternative re-indexing operators (to a reference model, or an explicit operator).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Scaling (&amp;lt;code&amp;gt;scaling&amp;lt;/code&amp;gt;) ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt; || None || Reference dataset: a PDB file (uses the CRYST1 cell and computes model intensities, including bulk solvent) or an MTZ from a previous cycle. Required for &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt; scaling.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.algorithm&amp;lt;/code&amp;gt; || mark0 || &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;: per-image scaling against the reference. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;: no scaling, just Monte-Carlo averaging (all scale factors = 1) — used for reference-free bootstrap.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;scaling.space_group&amp;lt;/code&amp;gt; || None || Cell/symmetry to use when no model is provided (i.e. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.resolution_scalar&amp;lt;/code&amp;gt; || 0.969 || &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; is multiplied by this when deciding which reflections fall within the resolution limit, generating a few extra reference reflections to account for per-shot cell variation (e.g. set 0.96 for a few more).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.mtz.mtz_column_F&amp;lt;/code&amp;gt; || fobs || Column name in the reference MTZ containing the reference structure factors (intensities or amplitudes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Post-refinement (&amp;lt;code&amp;gt;postrefinement&amp;lt;/code&amp;gt;) ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.enable&amp;lt;/code&amp;gt; || True || Enable post-refinement of per-image parameters/partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.algorithm&amp;lt;/code&amp;gt; || rs || Post-refinement protocol: &amp;lt;code&amp;gt;rs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs_hybrid&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;eta_deff&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Merging and error model (&amp;lt;code&amp;gt;merging&amp;lt;/code&amp;gt;) ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; || None || High-resolution limit for scaling and merging.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_max&amp;lt;/code&amp;gt; || None || Low-resolution limit (currently affects only CCiso).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.merge_anomalous&amp;lt;/code&amp;gt; || False || &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; merges Bijvoet mates together (higher multiplicity); &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt; keeps them separate to preserve the anomalous signal.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.minimum_multiplicity&amp;lt;/code&amp;gt; || 2 || Do not produce a merged structure factor for HKLs measured fewer than this many times.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.error.model&amp;lt;/code&amp;gt; || mm24 || Merged-sigma error model: &amp;lt;code&amp;gt;mm24&amp;lt;/code&amp;gt; (Mittan-Moreau 2025, current default), &amp;lt;code&amp;gt;ev11&amp;lt;/code&amp;gt; (Evans 2011 / sdfac-refine), &amp;lt;code&amp;gt;ha14&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;errors_from_sample_residuals&amp;lt;/code&amp;gt; (no refined error terms — used with &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; bootstrap).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.set_average_unit_cell&amp;lt;/code&amp;gt; || True || Output MTZ adopts the average unit cell of the data rather than the reference model&#039;s cell.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Statistics (&amp;lt;code&amp;gt;statistics&amp;lt;/code&amp;gt;) ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.n_bins&amp;lt;/code&amp;gt; || 10 || Number of resolution bins in the statistics tables.  Often raised to 20.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.cciso.mtz_file&amp;lt;/code&amp;gt; || None || Isomorphous reference structure factors for R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt; / CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.report_ML&amp;lt;/code&amp;gt; || True || Report per-frame max-likelihood attributes (domain size, mosaicity).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Output (&amp;lt;code&amp;gt;output&amp;lt;/code&amp;gt;) ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.output_dir&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; || Directory for output files (created if it does not exist).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; || iobs || Prefix prepended to all output file names.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.save_experiments_and_reflections&amp;lt;/code&amp;gt; || False || Dump the final experiments/reflections from the last worker as DIALS files — used for the two-stage scale-then-merge workflow.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.do_timing&amp;lt;/code&amp;gt; || False || Log elapsed time per execution step.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.expanded_bookkeeping&amp;lt;/code&amp;gt; || False || Store extra provenance columns (input file/reflection indices, odd/even flag, original id) in the saved reflection tables.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Multiprocessing (&amp;lt;code&amp;gt;mp&amp;lt;/code&amp;gt;) ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.method&amp;lt;/code&amp;gt; || mpi || Multiprocessing method (only &amp;lt;code&amp;gt;mpi&amp;lt;/code&amp;gt; is currently supported).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.debug.cProfile&amp;lt;/code&amp;gt; || False || Enable code profiling; a &amp;lt;code&amp;gt;.prof&amp;lt;/code&amp;gt; file is written per rank.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Output files =&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; worker gathers all HKLs at rank 0 and writes three MTZ files, prefixed with&lt;br /&gt;
&amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; (default &amp;lt;code&amp;gt;iobs&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_all.mtz&amp;lt;/code&amp;gt; — the merged dataset using all observations (the main result for structure solution)&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_odd.mtz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_even.mtz&amp;lt;/code&amp;gt; — the two half-datasets used for CC½ and related half-dataset statistics&lt;br /&gt;
&lt;br /&gt;
A main log records the per-step progress and the merging statistics tables by resolution bin:&lt;br /&gt;
completeness, multiplicity and ⟨I/σ⟩, plus the &amp;quot;Table of Scaling Results&amp;quot; reporting CC½ (the&lt;br /&gt;
half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;&lt;br /&gt;
and R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.  The merged MTZ can optionally be&lt;br /&gt;
uploaded to a shared [https://github.com/cctbx/cctbx_project/tree/master/xfel/merging/application/publish Google Drive folder] by adding the &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; worker.&lt;br /&gt;
&lt;br /&gt;
= References =&lt;br /&gt;
&lt;br /&gt;
* Sauter NK (2015). &#039;&#039;J Synchrotron Radiat&#039;&#039; &#039;&#039;&#039;22&#039;&#039;&#039;, 239–48. (post-refinement)&lt;br /&gt;
* Uervirojnangkoorn M, &#039;&#039;et al.&#039;&#039; (2015). &#039;&#039;eLife&#039;&#039; 10.7554/eLife.05421. (PRIME / bootstrap)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2018). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;74&#039;&#039;&#039;, 877–894.&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019a). &#039;&#039;Computational Crystallography Newsletter&#039;&#039; &#039;&#039;&#039;10&#039;&#039;&#039;, 22–39. (XFEL GUI)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019b). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;75&#039;&#039;&#039;, 959–968. (error models)&lt;br /&gt;
* Mittan-Moreau (2025). (mm24 error model)&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
&lt;br /&gt;
* [[dials.stills_process]] — produces the integrated data that &amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; consumes&lt;br /&gt;
* [[cctbx.xfel GUI]] — orchestrates separate scaling and repeated merging as data are collected&lt;br /&gt;
* The program README at &amp;lt;code&amp;gt;xfel/merging/README.md&amp;lt;/code&amp;gt; in cctbx_project&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Main_Page&amp;diff=1789</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Main_Page&amp;diff=1789"/>
		<updated>2026-08-21T23:42:11Z</updated>

		<summary type="html">&lt;p&gt;Aaron: /* cctbx.xfel resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;News! See our [[https://doi.org/10.1101/2025.05.04.652045 new preprint]]!  This paper shows current best practices using &#039;&#039;cctbx.xfel&#039;&#039; with &#039;&#039;DIALS&#039;&#039; for serial crystallographic data.&lt;br /&gt;
&lt;br /&gt;
= Open-source tools for serial crystallographic data processing =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;cctbx.xfel&#039;&#039; is a suite of software tools designed to process diffraction data from serial femtosecond crystallography (SFX) measurements at an X-ray free-electron laser (XFEL) or a synchrotron.  Built on the Computational Crystallographic Toolbox ([https://cctbx.github.io/ &#039;&#039;cctbx&#039;&#039;]), the same toolbox on which [http://www.phenix-online.org &#039;&#039;PHENIX&#039;&#039;], and [http://dials.github.io DIALS] are built, it enables the user to solve difficult problems relating to processing serial crystallographic data.  The programs and modules provided by &#039;&#039;cctbx.xfel&#039;&#039; can reduce a large set of still diffraction images recorded at Stanford’s Linac Coherent Light Source ([http://lcls.slac.stanford.edu LCLS]), [http://sacla.xfel.jp SACLA], the [https://www.xfel.eu/ European XFEL], or a synchrotron, to a single MTZ file containing merged reflection intensities suitable for structure solution.&lt;br /&gt;
&lt;br /&gt;
== &#039;&#039;cctbx.xfel&#039;&#039; resources ==&lt;br /&gt;
&lt;br /&gt;
The current best resource is our pre-print, [https://doi.org/10.1101/2025.05.04.652045 &#039;&#039;cctbx.xfel: a suite for processing serial crystallographic data.&#039;&#039;].  This paper describes the algorithms and ideas behind the implementation and execution of the two main programs of &#039;&#039;cctbx.xfel&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[Dials.stills_process|dials.stills_process]]&#039;&#039;: this program runs through all the first steps of processing data using dials: import (reading image headers), spot finding, indexing, geometry refinement, and integration.  Serial images are independent from each other, so this program is optimized for massively parallel systems, but can be adapted to a variety of single and multi-processing modes.&lt;br /&gt;
* &#039;&#039;[[Cctbx.xfel.merge|cctbx.xfel.merge]]&#039;&#039;: this program runs through the remaining steps of processing: scaling and merging to produce a full dataset (.mtz file).  For documentation, see our [https://github.com/cctbx/cctbx_project/tree/master/xfel/merging Github project]&lt;br /&gt;
&lt;br /&gt;
Additional resources:&lt;br /&gt;
&lt;br /&gt;
* Our [http://cci.lbl.gov/publications/download/CCN_2019_p22_Brewster.pdf 2019 newsletter article] describes how to use the &#039;&#039;cctbx.xfel&#039;&#039; GUI, an interactive program for handling large XFEL datasets.&lt;br /&gt;
&lt;br /&gt;
* [[Overview]] to the system architecture at LCLS and real-time progress monitoring of data processing&lt;br /&gt;
* Installation: there are two ways to get &#039;&#039;cctbx.xfel&#039;&#039;:&lt;br /&gt;
** &#039;&#039;cctbx.xfel&#039;&#039; is installed for general use at SLAC.  To start using an existing installation, [[Using the pre-built cctbx at LCLS|simply source the current build]]. &lt;br /&gt;
** [https://dials.github.io/installation.html Download] a binary bundle of DIALS. Use this option if you will not be processing LCLS data because, for example, if you have serial crystallographic data from a synchrotron.&lt;br /&gt;
** Build a psana/cctbx.xfel build [https://github.com/cctbx/cctbx_project/tree/master/xfel/conda_envs from scratch]. Use this option if you want to process LCLS data outside of LCLS or want your own build.&lt;br /&gt;
* [[Tutorials]] on pre-processing, data reduction, and merging. &lt;br /&gt;
&lt;br /&gt;
Other related information:&lt;br /&gt;
&lt;br /&gt;
* [[Serial XFEL Crystallography References]]&lt;br /&gt;
&lt;br /&gt;
This project is under active development.  For any assistance, please contact the authors.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Dials.stills_process&amp;diff=1788</id>
		<title>Dials.stills process</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Dials.stills_process&amp;diff=1788"/>
		<updated>2026-08-21T23:40:33Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:&#039;&#039;dials.stills_process&#039;&#039;}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;dials.stills_process&#039;&#039;&#039;&#039;&#039; is a stand-alone program for processing still diffraction images and is&lt;br /&gt;
the core data-reduction program of &#039;&#039;cctbx.xfel&#039;&#039;. It takes a set of&lt;br /&gt;
still diffraction images — typically serial femtosecond crystallography (SFX) snapshots from an&lt;br /&gt;
XFEL (LCLS, SACLA, EuXFEL) or still shots from a synchrotron — and analyzes each one, independently,&lt;br /&gt;
through the full DIALS pipeline: &#039;&#039;&#039;import → spot-finding → indexing → refinement → integration&#039;&#039;&#039;.&lt;br /&gt;
Its output (integrated intensities together with the per-image experimental models) is the input to&lt;br /&gt;
the merging program &#039;&#039;[[cctbx.xfel.merge]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Because every image is a separate still exposure of a different crystal (rather than a wedge of&lt;br /&gt;
a rotation series), each image is treated as its own experiment with its own crystal model. This&lt;br /&gt;
&amp;quot;one crystal per shot&amp;quot; model is what distinguishes stills processing from conventional rotation data&lt;br /&gt;
processing (e.g. &amp;lt;code&amp;gt;dials.import&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;dials.find_spots&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;dials.index&amp;lt;/code&amp;gt;, etc.), &lt;br /&gt;
and it drives most of the stills-specific defaults described below.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
For each image, &amp;lt;code&amp;gt;dials.stills_process&amp;lt;/code&amp;gt; runs the following stages in order. Any stage can&lt;br /&gt;
be turned off with the &amp;lt;code&amp;gt;dispatch&amp;lt;/code&amp;gt; parameters; if a stage is disabled, processing stops&lt;br /&gt;
after the last enabled stage.&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Import&#039;&#039;&#039; — read the image, apply reference geometry / gain / mask overrides, and build an experiment.&lt;br /&gt;
# &#039;&#039;&#039;Spot-finding&#039;&#039;&#039; — locate strong pixels and build strong reflections (&amp;lt;code&amp;gt;dispatch.find_spots&amp;lt;/code&amp;gt;).&lt;br /&gt;
# &#039;&#039;&#039;Hit finding&#039;&#039;&#039; — reject images with too few (or optionally too many) strong spots, so that only &amp;quot;hits&amp;quot; are indexed (&amp;lt;code&amp;gt;dispatch.hit_finder&amp;lt;/code&amp;gt;).&lt;br /&gt;
# &#039;&#039;&#039;Indexing&#039;&#039;&#039; — determine the crystal orientation and (optionally constrained) unit cell (&amp;lt;code&amp;gt;dispatch.index&amp;lt;/code&amp;gt;).&lt;br /&gt;
# &#039;&#039;&#039;Refinement&#039;&#039;&#039; — refine the crystal model and re-estimate the mosaic/domain-size parameters. Detector and beam are held fixed by default (&amp;lt;code&amp;gt;dispatch.refine&amp;lt;/code&amp;gt;).&lt;br /&gt;
# &#039;&#039;&#039;Integration&#039;&#039;&#039; — predict reflections and measure their intensities using the stills integrator (&amp;lt;code&amp;gt;dispatch.integrate&amp;lt;/code&amp;gt;), with an optional significance filter.&lt;br /&gt;
&lt;br /&gt;
The program applies a set of stills-specific defaults on top of the standard DIALS parameters,&lt;br /&gt;
including: indexing method &amp;lt;code&amp;gt;fft1d&amp;lt;/code&amp;gt;; the stills integrator with profile fitting turned off&lt;br /&gt;
(summation integration with a 2-D plane background); the stills refinement weighting strategy with&lt;br /&gt;
the detector and beam models fixed; and a re-estimation of per-crystal mosaic parameters&lt;br /&gt;
(domain size and mosaic angle) after refinement. These are sensible starting points for serial data&lt;br /&gt;
and normally do not need to be changed.&lt;br /&gt;
&lt;br /&gt;
Failures on individual images are, by default, caught and logged so that processing continues to the&lt;br /&gt;
next image (&amp;lt;code&amp;gt;dispatch.squash_errors=True&amp;lt;/code&amp;gt;) — essential when reducing tens of thousands of&lt;br /&gt;
shots of which only a fraction are hits.&lt;br /&gt;
&lt;br /&gt;
= Basic usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Process a directory of CBF stills, constraining the target cell/symmetry,&lt;br /&gt;
# using 32 parallel processes on one node&lt;br /&gt;
dials.stills_process /path/to/images/*.cbf process.phil mp.nproc=32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical &amp;lt;code&amp;gt;process.phil&amp;lt;/code&amp;gt; for XFEL data looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
spotfinder.filter.min_spot_size=2&lt;br /&gt;
spotfinder.threshold.dispersion.gain=1.0&lt;br /&gt;
spotfinder.threshold.dispersion.global_threshold=100&lt;br /&gt;
&lt;br /&gt;
indexing.known_symmetry.space_group=P43212&lt;br /&gt;
indexing.known_symmetry.unit_cell=78.9,78.9,38.1,90,90,90&lt;br /&gt;
indexing.method=fft1d&lt;br /&gt;
&lt;br /&gt;
input.reference_geometry=refined.expt   # from a previous metrology refinement&lt;br /&gt;
&lt;br /&gt;
output.output_dir=out&lt;br /&gt;
mp.nproc=32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Useful command-line helpers:&lt;br /&gt;
* &amp;lt;code&amp;gt;dials.stills_process -h&amp;lt;/code&amp;gt; — help and usage&lt;br /&gt;
* &amp;lt;code&amp;gt;dials.stills_process -c -e 2&amp;lt;/code&amp;gt; — show the configurable parameters (expert level 2)&lt;br /&gt;
* &amp;lt;code&amp;gt;dials.stills_process -c -a2&amp;lt;/code&amp;gt; — include attributes (help text) for each parameter&lt;br /&gt;
* &amp;lt;code&amp;gt;dials.stills_process ... input.show_image_tags=True&amp;lt;/code&amp;gt; — list the image tags in a dataset without processing (useful for selecting subsets with &amp;lt;code&amp;gt;input.image_tag&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
= Important parameters =&lt;br /&gt;
&lt;br /&gt;
The program exposes the entire DIALS parameter set (spot-finding, indexing, refinement, integration,&lt;br /&gt;
profile modelling, prediction). The parameters below are the ones most commonly adjusted for serial&lt;br /&gt;
still data. Parameters are given by their full PHIL path with their default value.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.reference_geometry&amp;lt;/code&amp;gt; || None || Path to an &amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt; file (or image) with a single detector model. Data are processed using &#039;&#039;this&#039;&#039; geometry instead of the geometry in the image headers. This is how a refined detector metrology from &amp;lt;code&amp;gt;cctbx.xfel&amp;lt;/code&amp;gt; ensemble refinement is applied — almost always set for XFEL data.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.sync_reference_geom&amp;lt;/code&amp;gt; || True || When a reference geometry is supplied, copy its refined local frames onto the image&#039;s detector hierarchy node-by-node (the hierarchies must match in shape). If False, the reference detector replaces the image detector wholesale.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.file_list&amp;lt;/code&amp;gt; || None || Path to a text file listing image paths, one per line (alternative to listing files on the command line).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.glob&amp;lt;/code&amp;gt; || None || Wildcard path(s) for large multi-file datasets (e.g. &amp;lt;code&amp;gt;*.cbf&amp;lt;/code&amp;gt;). May be given multiple times.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.image_tag&amp;lt;/code&amp;gt; || None || Process only images with the given tag(s). For single-image files the tag is the filename; for multi-image files (HDF5) it is &amp;lt;code&amp;gt;filename_imagenumber&amp;lt;/code&amp;gt; (image number is 5 digits with leading zeroes). Use &amp;lt;code&amp;gt;input.show_image_tags=True&amp;lt;/code&amp;gt; to list them.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.max_images&amp;lt;/code&amp;gt; || None || Limit the total number of images processed.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Dispatch — controlling the pipeline ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.find_spots&amp;lt;/code&amp;gt; || True || Do spot-finding. Required for indexing/integration.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.index&amp;lt;/code&amp;gt; || True || Attempt to index. Requires &amp;lt;code&amp;gt;find_spots=True&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.integrate&amp;lt;/code&amp;gt; || True || Integrate indexed images. Ignored if indexing/spot-finding is off.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.refine&amp;lt;/code&amp;gt; || False || Run an explicit model-refinement step after indexing (the stills indexer already refines; this is an additional pass, rarely needed).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.squash_errors&amp;lt;/code&amp;gt; || True || If an image fails, log it and continue to the next image. Set False to halt and show the full error when debugging.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.hit_finder.enable&amp;lt;/code&amp;gt; || True || Enable hit-finding. If disabled, every image is passed to indexing.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.hit_finder.minimum_number_of_reflections&amp;lt;/code&amp;gt; || 16 || Images with fewer strong spots than this are discarded as non-hits before indexing.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.hit_finder.maximum_number_of_reflections&amp;lt;/code&amp;gt; || None || If set, images with more strong spots than this are discarded (e.g. ice/junk).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.process_percent&amp;lt;/code&amp;gt; || None || Process only this percentage of events (evenly sampled). Useful for a quick look at a large dataset.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.coset&amp;lt;/code&amp;gt; || False || During integration, also integrate a sublattice coset as a negative control for regions with no Bragg diffraction (see &amp;lt;code&amp;gt;integration.coset.transformation&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.pre_import&amp;lt;/code&amp;gt; || False || Import all data before processing. Only needed when processing multiple &#039;&#039;multi-image&#039;&#039; files at once (not a recommended workflow). Single-file datasets (e.g. HDF5) are always pre-imported automatically.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Spot-finding ==&lt;br /&gt;
&lt;br /&gt;
Spot-finding uses the standard DIALS dispersion thresholding. The most impactful parameters for&lt;br /&gt;
serial data:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spotfinder.filter.min_spot_size&amp;lt;/code&amp;gt; || Auto || Minimum connected pixels for a spot. Auto = 3 for pixel-array detectors (SENSOR_PAD), 6 otherwise. Often lowered to 2 for sparse serial patterns.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spotfinder.threshold.dispersion.gain&amp;lt;/code&amp;gt; || None || Detector gain used in thresholding. Set this &#039;&#039;or&#039;&#039; the detector-model gain, not both (see gain note below).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spotfinder.threshold.dispersion.sigma_strong&amp;lt;/code&amp;gt; || 3 || Number of sigma above background for a pixel to be &amp;quot;strong&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spotfinder.threshold.dispersion.sigma_background&amp;lt;/code&amp;gt; || 6 || Number of sigma for the background/dispersion test.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spotfinder.threshold.dispersion.global_threshold&amp;lt;/code&amp;gt; || 0 || Absolute pixel intensity floor; pixels below this are never considered strong. Raising it (e.g. 100) suppresses noise on many detectors.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spotfinder.threshold.dispersion.kernel_size&amp;lt;/code&amp;gt; || 3 3 || Local-area kernel (pixels) for the dispersion calculation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gain note:&#039;&#039;&#039; the detector gain should be set on the detector model &#039;&#039;or&#039;&#039; in the processing&lt;br /&gt;
parameters, never both. If a supplied gain (&amp;lt;code&amp;gt;spotfinder.threshold.dispersion.gain&amp;lt;/code&amp;gt; or&lt;br /&gt;
&amp;lt;code&amp;gt;integration.summation.detector_gain&amp;lt;/code&amp;gt;) conflicts with a non-unity gain already on the&lt;br /&gt;
detector model, the program raises an error. Override with&lt;br /&gt;
&amp;lt;code&amp;gt;input.ignore_gain_mismatch=True&amp;lt;/code&amp;gt; only if you understand the consequences.&lt;br /&gt;
&lt;br /&gt;
== Indexing ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;indexing.known_symmetry.space_group&amp;lt;/code&amp;gt; || None || Target space group. Strongly recommended for serial data — constrains indexing and improves the hit/index rate.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;indexing.known_symmetry.unit_cell&amp;lt;/code&amp;gt; || None || Target unit cell (a,b,c,α,β,γ). Used together with the space group as the indexing target.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;indexing.method&amp;lt;/code&amp;gt; || fft1d || Basis-vector search method (&amp;lt;code&amp;gt;dials.stills_process&amp;lt;/code&amp;gt; defaults to &amp;lt;code&amp;gt;fft1d&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;fft3d&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;real_space_grid_search&amp;lt;/code&amp;gt; are also available).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;indexing.stills.method_list&amp;lt;/code&amp;gt; || None || Ordered list of indexing methods to try in turn; if one fails, the next is attempted (e.g. &amp;lt;code&amp;gt;fft1d real_space_grid_search&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;indexing.stills.known_orientations&amp;lt;/code&amp;gt; || None || Paths to previously-processed experiment lists. If given, images are &#039;&#039;not&#039;&#039; re-indexed; the stored crystal orientations are reused (e.g. to re-integrate with new parameters). Supports wildcards; may be repeated.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;indexing.stills.require_known_orientation&amp;lt;/code&amp;gt; || False || When known orientations are supplied but an image is not found among them, controls whether to skip it (True) or fall back to indexing from scratch (False).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;indexing.stills.reflection_subsampling.enable&amp;lt;/code&amp;gt; || False || Retry indexing on random subsets of the strong spots (from &amp;lt;code&amp;gt;step_start&amp;lt;/code&amp;gt;% down to &amp;lt;code&amp;gt;step_stop&amp;lt;/code&amp;gt;% in &amp;lt;code&amp;gt;step_size&amp;lt;/code&amp;gt;% steps). Can rescue images that fail to index on the full spot list.  Especially valuble for multi-lattice images (multiple crystals in the beam) but does increase execution time!&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;profile.gaussian_rs.parameters.sigma_b_cutoff&amp;lt;/code&amp;gt; || 0.1 || Maximum beam divergence (sigma_b, degrees) before an indexed crystal is rejected prior to integration. Guards against over-broad, poorly-modelled lattices.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;significance_filter.enable&amp;lt;/code&amp;gt; || False || Apply the stills significance filter, which trims each crystal to the resolution at which reflections remain statistically significant (see &amp;lt;code&amp;gt;significance_filter.isigi_cutoff&amp;lt;/code&amp;gt;, default 1.0).  Defaults to false here because it is typically applied in &#039;&#039;[[cctbx.xfel.merge]]&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;integration.integration_only_overrides.trusted_range&amp;lt;/code&amp;gt; || None || Override the panel trusted range [min, max] during integration only (e.g. to include pixels the header marks as untrusted).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;integration.coset.transformation&amp;lt;/code&amp;gt; || 6 || Which modulus-2 sublattice transformation defines the coset negative control when &amp;lt;code&amp;gt;dispatch.coset=True&amp;lt;/code&amp;gt; (0–6; 6 = body centering). See Sauter &amp;amp; Zwart, &#039;&#039;Acta Cryst.&#039;&#039; D (2009) &#039;&#039;&#039;65&#039;&#039;&#039;:553.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Output ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.output_dir&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; || Directory for output files.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.composite_output&amp;lt;/code&amp;gt; || True || If True, each process writes &#039;&#039;one&#039;&#039; concatenated set of &amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt; files covering all its successful images. If False, a separate pair of files is written per image (generates a very large number of files). Composite output is strongly preferred for large serial datasets.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.logging_dir&amp;lt;/code&amp;gt; || None || Directory for log files. Under MPI, per-rank logs (&amp;lt;code&amp;gt;log_rankNNNN.out&amp;lt;/code&amp;gt;, etc.) are written here.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.logging_option&amp;lt;/code&amp;gt; || normal || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; (all logging), &amp;lt;code&amp;gt;suppressed&amp;lt;/code&amp;gt; (silences verbose DIALS refine/index output), or &amp;lt;code&amp;gt;disabled&amp;lt;/code&amp;gt; (almost no logging).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.*_filename&amp;lt;/code&amp;gt; || (templates) || Output filename templates for each stage: &amp;lt;code&amp;gt;strong&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;indexed&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;refined_experiments&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;integrated&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;integrated_experiments&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;coset&amp;lt;/code&amp;gt;. A &amp;lt;code&amp;gt;%s&amp;lt;/code&amp;gt; in the template is replaced with the process number for composite mode or the per-image tag for non-composite mode.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.integration_pickle&amp;lt;/code&amp;gt; || None || Write legacy &amp;lt;code&amp;gt;cxi.merge&amp;lt;/code&amp;gt;/PRIME integration pickle files (e.g. &amp;lt;code&amp;gt;int-%d-%s.pickle&amp;lt;/code&amp;gt;). Only needed for legacy merging workflows.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Multiprocessing ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.method&amp;lt;/code&amp;gt; || multiprocessing || Parallelization backend: &amp;lt;code&amp;gt;multiprocessing&amp;lt;/code&amp;gt; (single node), or &amp;lt;code&amp;gt;mpi&amp;lt;/code&amp;gt; for multi-node jobs (also &amp;lt;code&amp;gt;sge&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;lsf&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;pbs&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.nproc&amp;lt;/code&amp;gt; || 1 || Number of processes (for the &amp;lt;code&amp;gt;multiprocessing&amp;lt;/code&amp;gt; method). Set to the number of cores per node.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.composite_stride&amp;lt;/code&amp;gt; || None || For MPI composite output, how many ranks aggregate their results into one set of output files. Ideally set to the number of processes per node so that one composite file set is written per node rather than per rank.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Under MPI with more than two ranks, the program runs a client/server model: rank 0 (or rank 2 for&lt;br /&gt;
psana2 &amp;lt;code&amp;gt;.loc&amp;lt;/code&amp;gt; inputs) hands out images to worker ranks on demand, giving good load&lt;br /&gt;
balancing across the many fast-failing non-hits typical of serial data.&lt;br /&gt;
&lt;br /&gt;
= Output files =&lt;br /&gt;
&lt;br /&gt;
With the default composite output, each process (or each aggregating rank under MPI) writes&lt;br /&gt;
concatenated files such as:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;tag&amp;amp;gt;_strong.refl&amp;lt;/code&amp;gt; — strong spots from spot-finding&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;tag&amp;amp;gt;_indexed.refl&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;amp;lt;tag&amp;amp;gt;_refined.expt&amp;lt;/code&amp;gt; — indexed reflections and their crystal models&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;tag&amp;amp;gt;_integrated.refl&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;amp;lt;tag&amp;amp;gt;_integrated.expt&amp;lt;/code&amp;gt; — integrated intensities and final models (the input to &#039;&#039;[[cctbx.xfel.merge]]&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
Per-image progress and status codes are recorded in &amp;lt;code&amp;gt;debug/debug_&amp;amp;lt;rank&amp;amp;gt;.txt&amp;lt;/code&amp;gt;, and&lt;br /&gt;
overall logging goes to &amp;lt;code&amp;gt;dials.process.log&amp;lt;/code&amp;gt; (or per-rank logs under MPI). These integrated&lt;br /&gt;
&amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt; pairs are then scaled and merged with&lt;br /&gt;
&#039;&#039;[[cctbx.xfel.merge]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[cctbx.xfel.merge]]&#039;&#039; — scaling, post-refinement and merging of the integrated data&lt;br /&gt;
* The [http://dials.github.io DIALS documentation] for the underlying spot-finding, indexing, refinement and integration algorithms&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Dials.stills_process&amp;diff=1787</id>
		<title>Dials.stills process</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Dials.stills_process&amp;diff=1787"/>
		<updated>2026-08-21T23:39:39Z</updated>

		<summary type="html">&lt;p&gt;Aaron: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{DISPLAYTITLE:dials.stills_process}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;dials.stills_process&#039;&#039;&#039;&#039;&#039; is a stand-alone program for processing still diffraction images and is&lt;br /&gt;
the core data-reduction program of &#039;&#039;cctbx.xfel&#039;&#039;. It takes a set of&lt;br /&gt;
still diffraction images — typically serial femtosecond crystallography (SFX) snapshots from an&lt;br /&gt;
XFEL (LCLS, SACLA, EuXFEL) or still shots from a synchrotron — and analyzes each one, independently,&lt;br /&gt;
through the full DIALS pipeline: &#039;&#039;&#039;import → spot-finding → indexing → refinement → integration&#039;&#039;&#039;.&lt;br /&gt;
Its output (integrated intensities together with the per-image experimental models) is the input to&lt;br /&gt;
the merging program &#039;&#039;[[cctbx.xfel.merge]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Because every image is a separate still exposure of a different crystal (rather than a wedge of&lt;br /&gt;
a rotation series), each image is treated as its own experiment with its own crystal model. This&lt;br /&gt;
&amp;quot;one crystal per shot&amp;quot; model is what distinguishes stills processing from conventional rotation data&lt;br /&gt;
processing (e.g. &amp;lt;code&amp;gt;dials.import&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;dials.find_spots&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;dials.index&amp;lt;/code&amp;gt;, etc.), &lt;br /&gt;
and it drives most of the stills-specific defaults described below.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
For each image, &amp;lt;code&amp;gt;dials.stills_process&amp;lt;/code&amp;gt; runs the following stages in order. Any stage can&lt;br /&gt;
be turned off with the &amp;lt;code&amp;gt;dispatch&amp;lt;/code&amp;gt; parameters; if a stage is disabled, processing stops&lt;br /&gt;
after the last enabled stage.&lt;br /&gt;
&lt;br /&gt;
# &#039;&#039;&#039;Import&#039;&#039;&#039; — read the image, apply reference geometry / gain / mask overrides, and build an experiment.&lt;br /&gt;
# &#039;&#039;&#039;Spot-finding&#039;&#039;&#039; — locate strong pixels and build strong reflections (&amp;lt;code&amp;gt;dispatch.find_spots&amp;lt;/code&amp;gt;).&lt;br /&gt;
# &#039;&#039;&#039;Hit finding&#039;&#039;&#039; — reject images with too few (or optionally too many) strong spots, so that only &amp;quot;hits&amp;quot; are indexed (&amp;lt;code&amp;gt;dispatch.hit_finder&amp;lt;/code&amp;gt;).&lt;br /&gt;
# &#039;&#039;&#039;Indexing&#039;&#039;&#039; — determine the crystal orientation and (optionally constrained) unit cell (&amp;lt;code&amp;gt;dispatch.index&amp;lt;/code&amp;gt;).&lt;br /&gt;
# &#039;&#039;&#039;Refinement&#039;&#039;&#039; — refine the crystal model and re-estimate the mosaic/domain-size parameters. Detector and beam are held fixed by default (&amp;lt;code&amp;gt;dispatch.refine&amp;lt;/code&amp;gt;).&lt;br /&gt;
# &#039;&#039;&#039;Integration&#039;&#039;&#039; — predict reflections and measure their intensities using the stills integrator (&amp;lt;code&amp;gt;dispatch.integrate&amp;lt;/code&amp;gt;), with an optional significance filter.&lt;br /&gt;
&lt;br /&gt;
The program applies a set of stills-specific defaults on top of the standard DIALS parameters,&lt;br /&gt;
including: indexing method &amp;lt;code&amp;gt;fft1d&amp;lt;/code&amp;gt;; the stills integrator with profile fitting turned off&lt;br /&gt;
(summation integration with a 2-D plane background); the stills refinement weighting strategy with&lt;br /&gt;
the detector and beam models fixed; and a re-estimation of per-crystal mosaic parameters&lt;br /&gt;
(domain size and mosaic angle) after refinement. These are sensible starting points for serial data&lt;br /&gt;
and normally do not need to be changed.&lt;br /&gt;
&lt;br /&gt;
Failures on individual images are, by default, caught and logged so that processing continues to the&lt;br /&gt;
next image (&amp;lt;code&amp;gt;dispatch.squash_errors=True&amp;lt;/code&amp;gt;) — essential when reducing tens of thousands of&lt;br /&gt;
shots of which only a fraction are hits.&lt;br /&gt;
&lt;br /&gt;
= Basic usage =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Process a directory of CBF stills, constraining the target cell/symmetry,&lt;br /&gt;
# using 32 parallel processes on one node&lt;br /&gt;
dials.stills_process /path/to/images/*.cbf process.phil mp.nproc=32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical &amp;lt;code&amp;gt;process.phil&amp;lt;/code&amp;gt; for XFEL data looks like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
spotfinder.filter.min_spot_size=2&lt;br /&gt;
spotfinder.threshold.dispersion.gain=1.0&lt;br /&gt;
spotfinder.threshold.dispersion.global_threshold=100&lt;br /&gt;
&lt;br /&gt;
indexing.known_symmetry.space_group=P43212&lt;br /&gt;
indexing.known_symmetry.unit_cell=78.9,78.9,38.1,90,90,90&lt;br /&gt;
indexing.method=fft1d&lt;br /&gt;
&lt;br /&gt;
input.reference_geometry=refined.expt   # from a previous metrology refinement&lt;br /&gt;
&lt;br /&gt;
output.output_dir=out&lt;br /&gt;
mp.nproc=32&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Useful command-line helpers:&lt;br /&gt;
* &amp;lt;code&amp;gt;dials.stills_process -h&amp;lt;/code&amp;gt; — help and usage&lt;br /&gt;
* &amp;lt;code&amp;gt;dials.stills_process -c -e 2&amp;lt;/code&amp;gt; — show the configurable parameters (expert level 2)&lt;br /&gt;
* &amp;lt;code&amp;gt;dials.stills_process -c -a2&amp;lt;/code&amp;gt; — include attributes (help text) for each parameter&lt;br /&gt;
* &amp;lt;code&amp;gt;dials.stills_process ... input.show_image_tags=True&amp;lt;/code&amp;gt; — list the image tags in a dataset without processing (useful for selecting subsets with &amp;lt;code&amp;gt;input.image_tag&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
= Important parameters =&lt;br /&gt;
&lt;br /&gt;
The program exposes the entire DIALS parameter set (spot-finding, indexing, refinement, integration,&lt;br /&gt;
profile modelling, prediction). The parameters below are the ones most commonly adjusted for serial&lt;br /&gt;
still data. Parameters are given by their full PHIL path with their default value.&lt;br /&gt;
&lt;br /&gt;
== Input ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.reference_geometry&amp;lt;/code&amp;gt; || None || Path to an &amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt; file (or image) with a single detector model. Data are processed using &#039;&#039;this&#039;&#039; geometry instead of the geometry in the image headers. This is how a refined detector metrology from &amp;lt;code&amp;gt;cctbx.xfel&amp;lt;/code&amp;gt; ensemble refinement is applied — almost always set for XFEL data.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.sync_reference_geom&amp;lt;/code&amp;gt; || True || When a reference geometry is supplied, copy its refined local frames onto the image&#039;s detector hierarchy node-by-node (the hierarchies must match in shape). If False, the reference detector replaces the image detector wholesale.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.file_list&amp;lt;/code&amp;gt; || None || Path to a text file listing image paths, one per line (alternative to listing files on the command line).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.glob&amp;lt;/code&amp;gt; || None || Wildcard path(s) for large multi-file datasets (e.g. &amp;lt;code&amp;gt;*.cbf&amp;lt;/code&amp;gt;). May be given multiple times.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.image_tag&amp;lt;/code&amp;gt; || None || Process only images with the given tag(s). For single-image files the tag is the filename; for multi-image files (HDF5) it is &amp;lt;code&amp;gt;filename_imagenumber&amp;lt;/code&amp;gt; (image number is 5 digits with leading zeroes). Use &amp;lt;code&amp;gt;input.show_image_tags=True&amp;lt;/code&amp;gt; to list them.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.max_images&amp;lt;/code&amp;gt; || None || Limit the total number of images processed.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Dispatch — controlling the pipeline ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.find_spots&amp;lt;/code&amp;gt; || True || Do spot-finding. Required for indexing/integration.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.index&amp;lt;/code&amp;gt; || True || Attempt to index. Requires &amp;lt;code&amp;gt;find_spots=True&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.integrate&amp;lt;/code&amp;gt; || True || Integrate indexed images. Ignored if indexing/spot-finding is off.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.refine&amp;lt;/code&amp;gt; || False || Run an explicit model-refinement step after indexing (the stills indexer already refines; this is an additional pass, rarely needed).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.squash_errors&amp;lt;/code&amp;gt; || True || If an image fails, log it and continue to the next image. Set False to halt and show the full error when debugging.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.hit_finder.enable&amp;lt;/code&amp;gt; || True || Enable hit-finding. If disabled, every image is passed to indexing.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.hit_finder.minimum_number_of_reflections&amp;lt;/code&amp;gt; || 16 || Images with fewer strong spots than this are discarded as non-hits before indexing.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.hit_finder.maximum_number_of_reflections&amp;lt;/code&amp;gt; || None || If set, images with more strong spots than this are discarded (e.g. ice/junk).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.process_percent&amp;lt;/code&amp;gt; || None || Process only this percentage of events (evenly sampled). Useful for a quick look at a large dataset.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.coset&amp;lt;/code&amp;gt; || False || During integration, also integrate a sublattice coset as a negative control for regions with no Bragg diffraction (see &amp;lt;code&amp;gt;integration.coset.transformation&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;dispatch.pre_import&amp;lt;/code&amp;gt; || False || Import all data before processing. Only needed when processing multiple &#039;&#039;multi-image&#039;&#039; files at once (not a recommended workflow). Single-file datasets (e.g. HDF5) are always pre-imported automatically.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Spot-finding ==&lt;br /&gt;
&lt;br /&gt;
Spot-finding uses the standard DIALS dispersion thresholding. The most impactful parameters for&lt;br /&gt;
serial data:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spotfinder.filter.min_spot_size&amp;lt;/code&amp;gt; || Auto || Minimum connected pixels for a spot. Auto = 3 for pixel-array detectors (SENSOR_PAD), 6 otherwise. Often lowered to 2 for sparse serial patterns.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spotfinder.threshold.dispersion.gain&amp;lt;/code&amp;gt; || None || Detector gain used in thresholding. Set this &#039;&#039;or&#039;&#039; the detector-model gain, not both (see gain note below).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spotfinder.threshold.dispersion.sigma_strong&amp;lt;/code&amp;gt; || 3 || Number of sigma above background for a pixel to be &amp;quot;strong&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spotfinder.threshold.dispersion.sigma_background&amp;lt;/code&amp;gt; || 6 || Number of sigma for the background/dispersion test.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spotfinder.threshold.dispersion.global_threshold&amp;lt;/code&amp;gt; || 0 || Absolute pixel intensity floor; pixels below this are never considered strong. Raising it (e.g. 100) suppresses noise on many detectors.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;spotfinder.threshold.dispersion.kernel_size&amp;lt;/code&amp;gt; || 3 3 || Local-area kernel (pixels) for the dispersion calculation.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Gain note:&#039;&#039;&#039; the detector gain should be set on the detector model &#039;&#039;or&#039;&#039; in the processing&lt;br /&gt;
parameters, never both. If a supplied gain (&amp;lt;code&amp;gt;spotfinder.threshold.dispersion.gain&amp;lt;/code&amp;gt; or&lt;br /&gt;
&amp;lt;code&amp;gt;integration.summation.detector_gain&amp;lt;/code&amp;gt;) conflicts with a non-unity gain already on the&lt;br /&gt;
detector model, the program raises an error. Override with&lt;br /&gt;
&amp;lt;code&amp;gt;input.ignore_gain_mismatch=True&amp;lt;/code&amp;gt; only if you understand the consequences.&lt;br /&gt;
&lt;br /&gt;
== Indexing ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;indexing.known_symmetry.space_group&amp;lt;/code&amp;gt; || None || Target space group. Strongly recommended for serial data — constrains indexing and improves the hit/index rate.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;indexing.known_symmetry.unit_cell&amp;lt;/code&amp;gt; || None || Target unit cell (a,b,c,α,β,γ). Used together with the space group as the indexing target.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;indexing.method&amp;lt;/code&amp;gt; || fft1d || Basis-vector search method (&amp;lt;code&amp;gt;dials.stills_process&amp;lt;/code&amp;gt; defaults to &amp;lt;code&amp;gt;fft1d&amp;lt;/code&amp;gt;; &amp;lt;code&amp;gt;fft3d&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;real_space_grid_search&amp;lt;/code&amp;gt; are also available).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;indexing.stills.method_list&amp;lt;/code&amp;gt; || None || Ordered list of indexing methods to try in turn; if one fails, the next is attempted (e.g. &amp;lt;code&amp;gt;fft1d real_space_grid_search&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;indexing.stills.known_orientations&amp;lt;/code&amp;gt; || None || Paths to previously-processed experiment lists. If given, images are &#039;&#039;not&#039;&#039; re-indexed; the stored crystal orientations are reused (e.g. to re-integrate with new parameters). Supports wildcards; may be repeated.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;indexing.stills.require_known_orientation&amp;lt;/code&amp;gt; || False || When known orientations are supplied but an image is not found among them, controls whether to skip it (True) or fall back to indexing from scratch (False).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;indexing.stills.reflection_subsampling.enable&amp;lt;/code&amp;gt; || False || Retry indexing on random subsets of the strong spots (from &amp;lt;code&amp;gt;step_start&amp;lt;/code&amp;gt;% down to &amp;lt;code&amp;gt;step_stop&amp;lt;/code&amp;gt;% in &amp;lt;code&amp;gt;step_size&amp;lt;/code&amp;gt;% steps). Can rescue images that fail to index on the full spot list.  Especially valuble for multi-lattice images (multiple crystals in the beam) but does increase execution time!&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Integration ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;profile.gaussian_rs.parameters.sigma_b_cutoff&amp;lt;/code&amp;gt; || 0.1 || Maximum beam divergence (sigma_b, degrees) before an indexed crystal is rejected prior to integration. Guards against over-broad, poorly-modelled lattices.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;significance_filter.enable&amp;lt;/code&amp;gt; || False || Apply the stills significance filter, which trims each crystal to the resolution at which reflections remain statistically significant (see &amp;lt;code&amp;gt;significance_filter.isigi_cutoff&amp;lt;/code&amp;gt;, default 1.0).  Defaults to false here because it is typically applied in &#039;&#039;[[cctbx.xfel.merge]]&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;integration.integration_only_overrides.trusted_range&amp;lt;/code&amp;gt; || None || Override the panel trusted range [min, max] during integration only (e.g. to include pixels the header marks as untrusted).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;integration.coset.transformation&amp;lt;/code&amp;gt; || 6 || Which modulus-2 sublattice transformation defines the coset negative control when &amp;lt;code&amp;gt;dispatch.coset=True&amp;lt;/code&amp;gt; (0–6; 6 = body centering). See Sauter &amp;amp; Zwart, &#039;&#039;Acta Cryst.&#039;&#039; D (2009) &#039;&#039;&#039;65&#039;&#039;&#039;:553.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Output ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.output_dir&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; || Directory for output files.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.composite_output&amp;lt;/code&amp;gt; || True || If True, each process writes &#039;&#039;one&#039;&#039; concatenated set of &amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt; files covering all its successful images. If False, a separate pair of files is written per image (generates a very large number of files). Composite output is strongly preferred for large serial datasets.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.logging_dir&amp;lt;/code&amp;gt; || None || Directory for log files. Under MPI, per-rank logs (&amp;lt;code&amp;gt;log_rankNNNN.out&amp;lt;/code&amp;gt;, etc.) are written here.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.logging_option&amp;lt;/code&amp;gt; || normal || &amp;lt;code&amp;gt;normal&amp;lt;/code&amp;gt; (all logging), &amp;lt;code&amp;gt;suppressed&amp;lt;/code&amp;gt; (silences verbose DIALS refine/index output), or &amp;lt;code&amp;gt;disabled&amp;lt;/code&amp;gt; (almost no logging).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.*_filename&amp;lt;/code&amp;gt; || (templates) || Output filename templates for each stage: &amp;lt;code&amp;gt;strong&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;indexed&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;refined_experiments&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;integrated&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;integrated_experiments&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;coset&amp;lt;/code&amp;gt;. A &amp;lt;code&amp;gt;%s&amp;lt;/code&amp;gt; in the template is replaced with the process number for composite mode or the per-image tag for non-composite mode.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.integration_pickle&amp;lt;/code&amp;gt; || None || Write legacy &amp;lt;code&amp;gt;cxi.merge&amp;lt;/code&amp;gt;/PRIME integration pickle files (e.g. &amp;lt;code&amp;gt;int-%d-%s.pickle&amp;lt;/code&amp;gt;). Only needed for legacy merging workflows.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Multiprocessing ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.method&amp;lt;/code&amp;gt; || multiprocessing || Parallelization backend: &amp;lt;code&amp;gt;multiprocessing&amp;lt;/code&amp;gt; (single node), or &amp;lt;code&amp;gt;mpi&amp;lt;/code&amp;gt; for multi-node jobs (also &amp;lt;code&amp;gt;sge&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;lsf&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;pbs&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.nproc&amp;lt;/code&amp;gt; || 1 || Number of processes (for the &amp;lt;code&amp;gt;multiprocessing&amp;lt;/code&amp;gt; method). Set to the number of cores per node.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.composite_stride&amp;lt;/code&amp;gt; || None || For MPI composite output, how many ranks aggregate their results into one set of output files. Ideally set to the number of processes per node so that one composite file set is written per node rather than per rank.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Under MPI with more than two ranks, the program runs a client/server model: rank 0 (or rank 2 for&lt;br /&gt;
psana2 &amp;lt;code&amp;gt;.loc&amp;lt;/code&amp;gt; inputs) hands out images to worker ranks on demand, giving good load&lt;br /&gt;
balancing across the many fast-failing non-hits typical of serial data.&lt;br /&gt;
&lt;br /&gt;
= Output files =&lt;br /&gt;
&lt;br /&gt;
With the default composite output, each process (or each aggregating rank under MPI) writes&lt;br /&gt;
concatenated files such as:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;tag&amp;amp;gt;_strong.refl&amp;lt;/code&amp;gt; — strong spots from spot-finding&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;tag&amp;amp;gt;_indexed.refl&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;amp;lt;tag&amp;amp;gt;_refined.expt&amp;lt;/code&amp;gt; — indexed reflections and their crystal models&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;tag&amp;amp;gt;_integrated.refl&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;amp;lt;tag&amp;amp;gt;_integrated.expt&amp;lt;/code&amp;gt; — integrated intensities and final models (the input to &#039;&#039;[[cctbx.xfel.merge]]&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
Per-image progress and status codes are recorded in &amp;lt;code&amp;gt;debug/debug_&amp;amp;lt;rank&amp;amp;gt;.txt&amp;lt;/code&amp;gt;, and&lt;br /&gt;
overall logging goes to &amp;lt;code&amp;gt;dials.process.log&amp;lt;/code&amp;gt; (or per-rank logs under MPI). These integrated&lt;br /&gt;
&amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt; pairs are then scaled and merged with&lt;br /&gt;
&#039;&#039;[[cctbx.xfel.merge]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[cctbx.xfel.merge]]&#039;&#039; — scaling, post-refinement and merging of the integrated data&lt;br /&gt;
* The [http://dials.github.io DIALS documentation] for the underlying spot-finding, indexing, refinement and integration algorithms&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Main_Page&amp;diff=1786</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Main_Page&amp;diff=1786"/>
		<updated>2026-08-21T23:32:10Z</updated>

		<summary type="html">&lt;p&gt;Aaron: /* cctbx.xfel resources */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;News! See our [[https://doi.org/10.1101/2025.05.04.652045 new preprint]]!  This paper shows current best practices using &#039;&#039;cctbx.xfel&#039;&#039; with &#039;&#039;DIALS&#039;&#039; for serial crystallographic data.&lt;br /&gt;
&lt;br /&gt;
= Open-source tools for serial crystallographic data processing =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;cctbx.xfel&#039;&#039; is a suite of software tools designed to process diffraction data from serial femtosecond crystallography (SFX) measurements at an X-ray free-electron laser (XFEL) or a synchrotron.  Built on the Computational Crystallographic Toolbox ([https://cctbx.github.io/ &#039;&#039;cctbx&#039;&#039;]), the same toolbox on which [http://www.phenix-online.org &#039;&#039;PHENIX&#039;&#039;], and [http://dials.github.io DIALS] are built, it enables the user to solve difficult problems relating to processing serial crystallographic data.  The programs and modules provided by &#039;&#039;cctbx.xfel&#039;&#039; can reduce a large set of still diffraction images recorded at Stanford’s Linac Coherent Light Source ([http://lcls.slac.stanford.edu LCLS]), [http://sacla.xfel.jp SACLA], the [https://www.xfel.eu/ European XFEL], or a synchrotron, to a single MTZ file containing merged reflection intensities suitable for structure solution.&lt;br /&gt;
&lt;br /&gt;
== &#039;&#039;cctbx.xfel&#039;&#039; resources ==&lt;br /&gt;
&lt;br /&gt;
The current best resource is our pre-print, [https://doi.org/10.1101/2025.05.04.652045 &#039;&#039;cctbx.xfel: a suite for processing serial crystallographic data.&#039;&#039;].  This paper describes the algorithms and ideas behind the implementation and execution of the two main programs of &#039;&#039;cctbx.xfel&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;[[Dials.stills_process]]&#039;&#039;: this program runs through all the first steps of processing data using dials: import (reading image headers), spot finding, indexing, geometry refinement, and integration.  Serial images are independent from each other, so this program is optimized for massively parallel systems, but can be adapted to a variety of single and multi-processing modes.&lt;br /&gt;
* &#039;&#039;[[Cctbx.xfel.merge]]&#039;&#039;: this program runs through the remaining steps of processing: scaling and merging to produce a full dataset (.mtz file).  For documentation, see our [https://github.com/cctbx/cctbx_project/tree/master/xfel/merging Github project]&lt;br /&gt;
&lt;br /&gt;
Additional resources:&lt;br /&gt;
&lt;br /&gt;
* Our [http://cci.lbl.gov/publications/download/CCN_2019_p22_Brewster.pdf 2019 newsletter article] describes how to use the &#039;&#039;cctbx.xfel&#039;&#039; GUI, an interactive program for handling large XFEL datasets.&lt;br /&gt;
&lt;br /&gt;
* [[Overview]] to the system architecture at LCLS and real-time progress monitoring of data processing&lt;br /&gt;
* Installation: there are two ways to get &#039;&#039;cctbx.xfel&#039;&#039;:&lt;br /&gt;
** &#039;&#039;cctbx.xfel&#039;&#039; is installed for general use at SLAC.  To start using an existing installation, [[Using the pre-built cctbx at LCLS|simply source the current build]]. &lt;br /&gt;
** [https://dials.github.io/installation.html Download] a binary bundle of DIALS. Use this option if you will not be processing LCLS data because, for example, if you have serial crystallographic data from a synchrotron.&lt;br /&gt;
** Build a psana/cctbx.xfel build [https://github.com/cctbx/cctbx_project/tree/master/xfel/conda_envs from scratch]. Use this option if you want to process LCLS data outside of LCLS or want your own build.&lt;br /&gt;
* [[Tutorials]] on pre-processing, data reduction, and merging. &lt;br /&gt;
&lt;br /&gt;
Other related information:&lt;br /&gt;
&lt;br /&gt;
* [[Serial XFEL Crystallography References]]&lt;br /&gt;
&lt;br /&gt;
This project is under active development.  For any assistance, please contact the authors.&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1785</id>
		<title>Cctbx.xfel.merge</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1785"/>
		<updated>2026-08-21T23:26:17Z</updated>

		<summary type="html">&lt;p&gt;Aaron: /* Basic usage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &#039;&#039;cctbx.xfel.merge&#039;&#039; =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;cctbx.xfel.merge&#039;&#039;&#039;&#039;&#039; is the scaling, post-refinement and merging program of cctbx.xfel. It takes&lt;br /&gt;
the per-image integrated results produced by &#039;&#039;[[dials.stills_process]]&#039;&#039; — one crystal per still shot —&lt;br /&gt;
and reduces the whole ensemble to a single set of merged structure-factor intensities (an MTZ file)&lt;br /&gt;
suitable for structure solution and refinement, together with the crystallographic quality&lt;br /&gt;
statistics (completeness, multiplicity, ⟨I/σ⟩, CC½, CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R-factors, etc.).&lt;br /&gt;
&lt;br /&gt;
Because serial datasets routinely contain tens of thousands to millions of still shots,&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is built from the ground up to run under MPI across many nodes. It is&lt;br /&gt;
almost always launched with &amp;lt;code&amp;gt;mpirun&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt;.  Note that MPI uses the term &#039;ranks&#039;&lt;br /&gt;
to distinguish independent processes that are running across one or more nodes.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is organized as a sequence of &#039;&#039;&#039;workers&#039;&#039;&#039;. Each worker performs one&lt;br /&gt;
task — reading data, applying a correction, filtering, scaling, post-refining, computing a statistic,&lt;br /&gt;
or merging — and passes its (possibly modified) experiments and reflections on to the next worker.&lt;br /&gt;
The list of workers to run is the &amp;quot;step list&amp;quot;, and it is fully configurable: you can add, remove or&lt;br /&gt;
reorder steps with &amp;lt;code&amp;gt;dispatch.step_list&amp;lt;/code&amp;gt;. This is what makes the program flexible enough to&lt;br /&gt;
scale-and-merge in one pass, to scale subsets separately and merge later, or to run a reference-free&lt;br /&gt;
bootstrap.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;default&#039;&#039;&#039; step list is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! # !! Worker !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| 1 || &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; || Read integrated experiments (&amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;) and reflections (&amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt;) from disk in DIALS format.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || &amp;lt;code&amp;gt;balance&amp;lt;/code&amp;gt; || Redistribute the input load evenly across MPI ranks (needed when there are fewer or more input files than ranks).&lt;br /&gt;
|-&lt;br /&gt;
| 3 || &amp;lt;code&amp;gt;model_scaling&amp;lt;/code&amp;gt; || Build the full Miller list, model intensities from the reference, and the resolution binner used for scaling and post-refinement.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || &amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt; || Apply per-reflection modifications, e.g. polarization correction (and optionally re-indexing to resolve indexing ambiguity — see &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;reindex_to_reference&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 5 || &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; || Reject whole experiments (or reflections) by resolution, unit cell, correlation to the reference, energy, etc.&lt;br /&gt;
|-&lt;br /&gt;
| 6 || &amp;lt;code&amp;gt;scale&amp;lt;/code&amp;gt; || Scale each lattice to the reference dataset (&amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;) or simply average (&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 7 || &amp;lt;code&amp;gt;postrefine&amp;lt;/code&amp;gt; || Post-refine per-image crystal parameters and partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| 8 || &amp;lt;code&amp;gt;statistics_unitcell&amp;lt;/code&amp;gt; || Determine and store the average unit cell.&lt;br /&gt;
|-&lt;br /&gt;
| 9 || &amp;lt;code&amp;gt;statistics_beam&amp;lt;/code&amp;gt; || Determine and store the average wavelength.&lt;br /&gt;
|-&lt;br /&gt;
| 10 || &amp;lt;code&amp;gt;model_statistics&amp;lt;/code&amp;gt; || Rebuild the Miller list / binner for statistics (may use the average unit cell).&lt;br /&gt;
|-&lt;br /&gt;
| 11 || &amp;lt;code&amp;gt;statistics_resolution&amp;lt;/code&amp;gt; || Per-crystal resolution statistics.&lt;br /&gt;
|-&lt;br /&gt;
| 12 || &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt; || Redistribute reflections across ranks so that every observation of a given HKL is gathered on the same rank prior to merging.&lt;br /&gt;
|-&lt;br /&gt;
| 13 || &amp;lt;code&amp;gt;errors_merge&amp;lt;/code&amp;gt; || Correct the merged error estimates with a per-HKL error model (e.g. Ev11, Brewster 2019b, or MM24 (the default), Mittan-Moreau (2025)).&lt;br /&gt;
|-&lt;br /&gt;
| 14 || &amp;lt;code&amp;gt;statistics_intensity&amp;lt;/code&amp;gt; || Intensity statistics by resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 15 || &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; || Merge symmetry-equivalent intensities, gather all HKLs at rank 0, and write &amp;quot;odd&amp;quot;, &amp;quot;even&amp;quot; and &amp;quot;all&amp;quot; MTZ files.&lt;br /&gt;
|-&lt;br /&gt;
| 16 || &amp;lt;code&amp;gt;statistics_intensity_cxi&amp;lt;/code&amp;gt; || Correlation and R-factor statistics (ported from cxi.merge): the &amp;quot;Table of Scaling Results&amp;quot; — CC½ (half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Additional, non-default workers are available and can be&lt;br /&gt;
inserted into the step list, including &amp;lt;code&amp;gt;tdata&amp;lt;/code&amp;gt; (write out unit cells for clustering),&lt;br /&gt;
&amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; (batch MTZ for &#039;&#039;Careless&#039;&#039;), &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; (upload merged files to a&lt;br /&gt;
Google Drive folder), &amp;lt;code&amp;gt;monitor&amp;lt;/code&amp;gt; (resource-usage logging), &amp;lt;code&amp;gt;integrate&amp;lt;/code&amp;gt;&lt;br /&gt;
(on-the-fly integration), &amp;lt;code&amp;gt;prepare&amp;lt;/code&amp;gt; (SpReAD energy binning), and&lt;br /&gt;
&amp;lt;code&amp;gt;lunus&amp;lt;/code&amp;gt; (diffuse-scattering deck). A &amp;lt;code&amp;gt;deltaccint&amp;lt;/code&amp;gt; worker (ΔCC½ lattice&lt;br /&gt;
filtering) can be added after &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;. Custom workers can be supplied through the&lt;br /&gt;
&amp;lt;code&amp;gt;XFEL_CUSTOM_WORKER_PATH&amp;lt;/code&amp;gt; environment variable.&lt;br /&gt;
&lt;br /&gt;
== Basic usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is run under MPI:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mpirun cctbx.xfel.merge merge.phil&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical &amp;lt;code&amp;gt;merge.phil&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input.path=&amp;lt;path to data&amp;gt;&lt;br /&gt;
input.experiments_suffix=.expt&lt;br /&gt;
input.reflections_suffix=.refl&lt;br /&gt;
&lt;br /&gt;
filter.algorithm=unit_cell&lt;br /&gt;
filter.unit_cell.value.relative_length_tolerance=0.03&lt;br /&gt;
filter.outlier.min_corr=0.1&lt;br /&gt;
&lt;br /&gt;
select.algorithm=significance_filter&lt;br /&gt;
select.significance_filter.sigma=0.1&lt;br /&gt;
select.significance_filter.min_ct=200&lt;br /&gt;
select.significance_filter.max_ct=300&lt;br /&gt;
&lt;br /&gt;
scaling.model=&amp;lt;model.pdb or model.mtz&amp;gt;&lt;br /&gt;
scaling.resolution_scalar=0.96&lt;br /&gt;
&lt;br /&gt;
merging.d_min=1.8&lt;br /&gt;
merging.error.model=mm24&lt;br /&gt;
merging.merge_anomalous=True&lt;br /&gt;
&lt;br /&gt;
postrefinement.enable=True&lt;br /&gt;
statistics.n_bins=20&lt;br /&gt;
&lt;br /&gt;
output.output_dir=&amp;lt;output folder&amp;gt;&lt;br /&gt;
output.prefix=&amp;lt;prefix for output files&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explore the parameters with:&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c&amp;lt;/code&amp;gt; — show configurable parameters&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c -e 10 -a 2&amp;lt;/code&amp;gt; — show all parameters (expert level 10) with full help text&lt;br /&gt;
&lt;br /&gt;
== Two-stage scaling and merging ==&lt;br /&gt;
&lt;br /&gt;
For large, growing datasets (the mode used by the [[cctbx.xfel GUI]]), it is more efficient to scale&lt;br /&gt;
and post-refine each subset of data &#039;&#039;&#039;once&#039;&#039;&#039;, then merge repeatedly as more data arrive. This is&lt;br /&gt;
done by running the program twice with different step lists.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 1 — scale each subset&#039;&#039;&#039; (stops after per-image work and writes intermediate DIALS files):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input balance model_scaling modify filter scale postrefine \&lt;br /&gt;
    statistics_unitcell statistics_beam model_statistics statistics_resolution&lt;br /&gt;
output.save_experiments_and_reflections=True&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;output.save_experiments_and_reflections=True&amp;lt;/code&amp;gt; dumps the scaled/post-refined data as&lt;br /&gt;
experiment lists and reflection tables that the merge stage can read back in.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 2 — merge the scaled subsets&#039;&#039;&#039; (add an &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; for each finished subset):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input model_scaling statistics_unitcell statistics_beam \&lt;br /&gt;
    model_statistics statistics_resolution group errors_merge statistics_intensity \&lt;br /&gt;
    merge statistics_intensity_cxi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Merging without a reference (bootstrap / mark1) ==&lt;br /&gt;
&lt;br /&gt;
If no scaling/merging reference is available, use a bootstrap procedure. First run the&lt;br /&gt;
&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; algorithm, which simply averages the data (all per-image scale factors = 1, no&lt;br /&gt;
post-refinement), specifying the target cell and symmetry explicitly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
scaling.algorithm=mark1&lt;br /&gt;
scaling.unit_cell=&amp;lt;unit cell&amp;gt;&lt;br /&gt;
scaling.space_group=&amp;lt;space group&amp;gt;&lt;br /&gt;
merging.error.model=errors_from_sample_residuals&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting MTZ is then used as the reference (&amp;lt;code&amp;gt;scaling.model=&amp;lt;/code&amp;gt;) for subsequent regular&lt;br /&gt;
merges. Iterate a few cycles; CC½ typically improves and converges over the first few rounds.&lt;br /&gt;
&lt;br /&gt;
== Important parameters ==&lt;br /&gt;
&lt;br /&gt;
Parameters are given by their full PHIL path with defaults in parentheses. The program exposes many&lt;br /&gt;
more parameters (see &amp;lt;code&amp;gt;-c -e 10 -a 2&amp;lt;/code&amp;gt;); those below are the ones most commonly set.&lt;br /&gt;
&lt;br /&gt;
=== Input ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; || None || Path(s) to the integrated data — a folder, several folders, or individual files; wildcards allowed; may be repeated. Matching &amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt; files must both be present.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.experiments_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.expt&amp;lt;/code&amp;gt; || Only load experiment files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.reflections_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.refl&amp;lt;/code&amp;gt; || Only load reflection files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.parallel_file_load.method&amp;lt;/code&amp;gt; || uniform || &amp;lt;code&amp;gt;uniform&amp;lt;/code&amp;gt; spreads input files evenly over all ranks; &amp;lt;code&amp;gt;node_memory&amp;lt;/code&amp;gt; distributes so per-node memory limits are respected.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.alist.file&amp;lt;/code&amp;gt; || None || Path to a text file of experiment tags or filenames; combined with &amp;lt;code&amp;gt;input.alist.op=keep|reject&amp;lt;/code&amp;gt; to merge only (or exclude) a specified subset.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.persistent_refl_cols&amp;lt;/code&amp;gt; || None || Reflection-table columns to preserve through the pruning steps (and into saved tables).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Filtering whole experiments (&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;entire experiments&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;n_obs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resolution&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;unit_cell&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;energy&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bootstrap&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;experiment_prefix&amp;lt;/code&amp;gt;. Nothing is filtered unless listed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.algorithm&amp;lt;/code&amp;gt; || value || How to restrict unit cells: &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; (compare to a target), &amp;lt;code&amp;gt;range&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;cluster&amp;lt;/code&amp;gt; (use a precomputed covariance clustering).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.relative_length_tolerance&amp;lt;/code&amp;gt; || 0.1 || Fractional deviation of cell edge lengths allowed vs. the target cell. Often tightened (e.g. 0.03).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.absolute_angle_tolerance&amp;lt;/code&amp;gt; || 2.0 || Allowed cell-angle deviation (degrees) vs. the target.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.target_unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;target_space_group&amp;lt;/code&amp;gt; || Auto || Target cell/symmetry; &amp;lt;code&amp;gt;Auto&amp;lt;/code&amp;gt; uses the scaling model.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.outlier.min_corr&amp;lt;/code&amp;gt; || 0.1 || Minimum correlation of an image&#039;s intensities to the reference model; images below this are rejected. Only applied when a scaling model is present. Use &amp;lt;code&amp;gt;-1&amp;lt;/code&amp;gt; to accept all images regardless of correlation.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.resolution.d_min&amp;lt;/code&amp;gt; || None || Reject an experiment unless some of its reflections extend beyond this resolution.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Selecting individual reflections (&amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;individual reflections&#039;&#039;&#039; (contrast with&lt;br /&gt;
&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;, which acts on whole experiments).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;significance_filter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;panel&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cspad_sensor&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;isolation_forest&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;target_energy&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.sigma&amp;lt;/code&amp;gt; || 0.5 || Trim each lattice at the resolution where the binned ⟨I/σ⟩ drops below this value.  Often reduced to 0.1.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.min_ct&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;max_ct&amp;lt;/code&amp;gt; || 10 / 50 || Target minimum/maximum mean reflections per resolution bin when choosing the number of bins. For large unit cells these are often raised (e.g. 200/300); for small cells, use the defaults.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Modifying intensities (&amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.algorithm&amp;lt;/code&amp;gt; || polarization || Per-reflection corrections to apply (default applies the polarization correction).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt; || — || Resolve an indexing ambiguity across the ensemble using the Gildea/Winter (Brehm/Diederichs) cosym method, optionally anchored to &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.reindex_to_reference&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;reindex_to_abc&amp;lt;/code&amp;gt; || — || Alternative re-indexing operators (to a reference model, or an explicit operator).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Scaling (&amp;lt;code&amp;gt;scaling&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt; || None || Reference dataset: a PDB file (uses the CRYST1 cell and computes model intensities, including bulk solvent) or an MTZ from a previous cycle. Required for &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt; scaling.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.algorithm&amp;lt;/code&amp;gt; || mark0 || &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;: per-image scaling against the reference. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;: no scaling, just Monte-Carlo averaging (all scale factors = 1) — used for reference-free bootstrap.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;scaling.space_group&amp;lt;/code&amp;gt; || None || Cell/symmetry to use when no model is provided (i.e. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.resolution_scalar&amp;lt;/code&amp;gt; || 0.969 || &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; is multiplied by this when deciding which reflections fall within the resolution limit, generating a few extra reference reflections to account for per-shot cell variation (e.g. set 0.96 for a few more).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.mtz.mtz_column_F&amp;lt;/code&amp;gt; || fobs || Column name in the reference MTZ containing the reference structure factors (intensities or amplitudes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Post-refinement (&amp;lt;code&amp;gt;postrefinement&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.enable&amp;lt;/code&amp;gt; || True || Enable post-refinement of per-image parameters/partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.algorithm&amp;lt;/code&amp;gt; || rs || Post-refinement protocol: &amp;lt;code&amp;gt;rs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs_hybrid&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;eta_deff&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Merging and error model (&amp;lt;code&amp;gt;merging&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; || None || High-resolution limit for scaling and merging.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_max&amp;lt;/code&amp;gt; || None || Low-resolution limit (currently affects only CCiso).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.merge_anomalous&amp;lt;/code&amp;gt; || False || &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; merges Bijvoet mates together (higher multiplicity); &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt; keeps them separate to preserve the anomalous signal.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.minimum_multiplicity&amp;lt;/code&amp;gt; || 2 || Do not produce a merged structure factor for HKLs measured fewer than this many times.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.error.model&amp;lt;/code&amp;gt; || mm24 || Merged-sigma error model: &amp;lt;code&amp;gt;mm24&amp;lt;/code&amp;gt; (Mittan-Moreau 2025, current default), &amp;lt;code&amp;gt;ev11&amp;lt;/code&amp;gt; (Evans 2011 / sdfac-refine), &amp;lt;code&amp;gt;ha14&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;errors_from_sample_residuals&amp;lt;/code&amp;gt; (no refined error terms — used with &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; bootstrap).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.set_average_unit_cell&amp;lt;/code&amp;gt; || True || Output MTZ adopts the average unit cell of the data rather than the reference model&#039;s cell.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Statistics (&amp;lt;code&amp;gt;statistics&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.n_bins&amp;lt;/code&amp;gt; || 10 || Number of resolution bins in the statistics tables.  Often raised to 20.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.cciso.mtz_file&amp;lt;/code&amp;gt; || None || Isomorphous reference structure factors for R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt; / CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.report_ML&amp;lt;/code&amp;gt; || True || Report per-frame max-likelihood attributes (domain size, mosaicity).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Output (&amp;lt;code&amp;gt;output&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.output_dir&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; || Directory for output files (created if it does not exist).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; || iobs || Prefix prepended to all output file names.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.save_experiments_and_reflections&amp;lt;/code&amp;gt; || False || Dump the final experiments/reflections from the last worker as DIALS files — used for the two-stage scale-then-merge workflow.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.do_timing&amp;lt;/code&amp;gt; || False || Log elapsed time per execution step.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.expanded_bookkeeping&amp;lt;/code&amp;gt; || False || Store extra provenance columns (input file/reflection indices, odd/even flag, original id) in the saved reflection tables.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Multiprocessing (&amp;lt;code&amp;gt;mp&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.method&amp;lt;/code&amp;gt; || mpi || Multiprocessing method (only &amp;lt;code&amp;gt;mpi&amp;lt;/code&amp;gt; is currently supported).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.debug.cProfile&amp;lt;/code&amp;gt; || False || Enable code profiling; a &amp;lt;code&amp;gt;.prof&amp;lt;/code&amp;gt; file is written per rank.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Output files ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; worker gathers all HKLs at rank 0 and writes three MTZ files, prefixed with&lt;br /&gt;
&amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; (default &amp;lt;code&amp;gt;iobs&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_all.mtz&amp;lt;/code&amp;gt; — the merged dataset using all observations (the main result for structure solution)&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_odd.mtz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_even.mtz&amp;lt;/code&amp;gt; — the two half-datasets used for CC½ and related half-dataset statistics&lt;br /&gt;
&lt;br /&gt;
A main log records the per-step progress and the merging statistics tables by resolution bin:&lt;br /&gt;
completeness, multiplicity and ⟨I/σ⟩, plus the &amp;quot;Table of Scaling Results&amp;quot; reporting CC½ (the&lt;br /&gt;
half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;&lt;br /&gt;
and R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.  The merged MTZ can optionally be&lt;br /&gt;
uploaded to a shared [https://github.com/cctbx/cctbx_project/tree/master/xfel/merging/application/publish Google Drive folder] by adding the &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; worker.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* Sauter NK (2015). &#039;&#039;J Synchrotron Radiat&#039;&#039; &#039;&#039;&#039;22&#039;&#039;&#039;, 239–48. (post-refinement)&lt;br /&gt;
* Uervirojnangkoorn M, &#039;&#039;et al.&#039;&#039; (2015). &#039;&#039;eLife&#039;&#039; 10.7554/eLife.05421. (PRIME / bootstrap)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2018). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;74&#039;&#039;&#039;, 877–894.&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019a). &#039;&#039;Computational Crystallography Newsletter&#039;&#039; &#039;&#039;&#039;10&#039;&#039;&#039;, 22–39. (XFEL GUI)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019b). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;75&#039;&#039;&#039;, 959–968. (error models)&lt;br /&gt;
* Mittan-Moreau (2025). (mm24 error model)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[dials.stills_process]] — produces the integrated data that &amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; consumes&lt;br /&gt;
* [[cctbx.xfel GUI]] — orchestrates separate scaling and repeated merging as data are collected&lt;br /&gt;
* The program README at &amp;lt;code&amp;gt;xfel/merging/README.md&amp;lt;/code&amp;gt; in cctbx_project&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1784</id>
		<title>Cctbx.xfel.merge</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1784"/>
		<updated>2026-08-21T23:25:39Z</updated>

		<summary type="html">&lt;p&gt;Aaron: /* Statistics (statistics) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &#039;&#039;cctbx.xfel.merge&#039;&#039; =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;cctbx.xfel.merge&#039;&#039;&#039;&#039;&#039; is the scaling, post-refinement and merging program of cctbx.xfel. It takes&lt;br /&gt;
the per-image integrated results produced by &#039;&#039;[[dials.stills_process]]&#039;&#039; — one crystal per still shot —&lt;br /&gt;
and reduces the whole ensemble to a single set of merged structure-factor intensities (an MTZ file)&lt;br /&gt;
suitable for structure solution and refinement, together with the crystallographic quality&lt;br /&gt;
statistics (completeness, multiplicity, ⟨I/σ⟩, CC½, CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R-factors, etc.).&lt;br /&gt;
&lt;br /&gt;
Because serial datasets routinely contain tens of thousands to millions of still shots,&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is built from the ground up to run under MPI across many nodes. It is&lt;br /&gt;
almost always launched with &amp;lt;code&amp;gt;mpirun&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt;.  Note that MPI uses the term &#039;ranks&#039;&lt;br /&gt;
to distinguish independent processes that are running across one or more nodes.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is organized as a sequence of &#039;&#039;&#039;workers&#039;&#039;&#039;. Each worker performs one&lt;br /&gt;
task — reading data, applying a correction, filtering, scaling, post-refining, computing a statistic,&lt;br /&gt;
or merging — and passes its (possibly modified) experiments and reflections on to the next worker.&lt;br /&gt;
The list of workers to run is the &amp;quot;step list&amp;quot;, and it is fully configurable: you can add, remove or&lt;br /&gt;
reorder steps with &amp;lt;code&amp;gt;dispatch.step_list&amp;lt;/code&amp;gt;. This is what makes the program flexible enough to&lt;br /&gt;
scale-and-merge in one pass, to scale subsets separately and merge later, or to run a reference-free&lt;br /&gt;
bootstrap.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;default&#039;&#039;&#039; step list is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! # !! Worker !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| 1 || &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; || Read integrated experiments (&amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;) and reflections (&amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt;) from disk in DIALS format.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || &amp;lt;code&amp;gt;balance&amp;lt;/code&amp;gt; || Redistribute the input load evenly across MPI ranks (needed when there are fewer or more input files than ranks).&lt;br /&gt;
|-&lt;br /&gt;
| 3 || &amp;lt;code&amp;gt;model_scaling&amp;lt;/code&amp;gt; || Build the full Miller list, model intensities from the reference, and the resolution binner used for scaling and post-refinement.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || &amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt; || Apply per-reflection modifications, e.g. polarization correction (and optionally re-indexing to resolve indexing ambiguity — see &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;reindex_to_reference&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 5 || &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; || Reject whole experiments (or reflections) by resolution, unit cell, correlation to the reference, energy, etc.&lt;br /&gt;
|-&lt;br /&gt;
| 6 || &amp;lt;code&amp;gt;scale&amp;lt;/code&amp;gt; || Scale each lattice to the reference dataset (&amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;) or simply average (&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 7 || &amp;lt;code&amp;gt;postrefine&amp;lt;/code&amp;gt; || Post-refine per-image crystal parameters and partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| 8 || &amp;lt;code&amp;gt;statistics_unitcell&amp;lt;/code&amp;gt; || Determine and store the average unit cell.&lt;br /&gt;
|-&lt;br /&gt;
| 9 || &amp;lt;code&amp;gt;statistics_beam&amp;lt;/code&amp;gt; || Determine and store the average wavelength.&lt;br /&gt;
|-&lt;br /&gt;
| 10 || &amp;lt;code&amp;gt;model_statistics&amp;lt;/code&amp;gt; || Rebuild the Miller list / binner for statistics (may use the average unit cell).&lt;br /&gt;
|-&lt;br /&gt;
| 11 || &amp;lt;code&amp;gt;statistics_resolution&amp;lt;/code&amp;gt; || Per-crystal resolution statistics.&lt;br /&gt;
|-&lt;br /&gt;
| 12 || &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt; || Redistribute reflections across ranks so that every observation of a given HKL is gathered on the same rank prior to merging.&lt;br /&gt;
|-&lt;br /&gt;
| 13 || &amp;lt;code&amp;gt;errors_merge&amp;lt;/code&amp;gt; || Correct the merged error estimates with a per-HKL error model (e.g. Ev11, Brewster 2019b, or MM24 (the default), Mittan-Moreau (2025)).&lt;br /&gt;
|-&lt;br /&gt;
| 14 || &amp;lt;code&amp;gt;statistics_intensity&amp;lt;/code&amp;gt; || Intensity statistics by resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 15 || &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; || Merge symmetry-equivalent intensities, gather all HKLs at rank 0, and write &amp;quot;odd&amp;quot;, &amp;quot;even&amp;quot; and &amp;quot;all&amp;quot; MTZ files.&lt;br /&gt;
|-&lt;br /&gt;
| 16 || &amp;lt;code&amp;gt;statistics_intensity_cxi&amp;lt;/code&amp;gt; || Correlation and R-factor statistics (ported from cxi.merge): the &amp;quot;Table of Scaling Results&amp;quot; — CC½ (half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Additional, non-default workers are available and can be&lt;br /&gt;
inserted into the step list, including &amp;lt;code&amp;gt;tdata&amp;lt;/code&amp;gt; (write out unit cells for clustering),&lt;br /&gt;
&amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; (batch MTZ for &#039;&#039;Careless&#039;&#039;), &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; (upload merged files to a&lt;br /&gt;
Google Drive folder), &amp;lt;code&amp;gt;monitor&amp;lt;/code&amp;gt; (resource-usage logging), &amp;lt;code&amp;gt;integrate&amp;lt;/code&amp;gt;&lt;br /&gt;
(on-the-fly integration), &amp;lt;code&amp;gt;prepare&amp;lt;/code&amp;gt; (SpReAD energy binning), and&lt;br /&gt;
&amp;lt;code&amp;gt;lunus&amp;lt;/code&amp;gt; (diffuse-scattering deck). A &amp;lt;code&amp;gt;deltaccint&amp;lt;/code&amp;gt; worker (ΔCC½ lattice&lt;br /&gt;
filtering) can be added after &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;. Custom workers can be supplied through the&lt;br /&gt;
&amp;lt;code&amp;gt;XFEL_CUSTOM_WORKER_PATH&amp;lt;/code&amp;gt; environment variable.&lt;br /&gt;
&lt;br /&gt;
== Basic usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is run under MPI:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mpirun cctbx.xfel.merge merge.phil&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical &amp;lt;code&amp;gt;merge.phil&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input.path=&amp;lt;path to data&amp;gt;&lt;br /&gt;
input.experiments_suffix=.expt&lt;br /&gt;
input.reflections_suffix=.refl&lt;br /&gt;
&lt;br /&gt;
filter.algorithm=unit_cell&lt;br /&gt;
filter.unit_cell.value.relative_length_tolerance=0.03&lt;br /&gt;
filter.outlier.min_corr=0.1&lt;br /&gt;
&lt;br /&gt;
select.algorithm=significance_filter&lt;br /&gt;
select.significance_filter.sigma=0.1&lt;br /&gt;
select.significance_filter.min_ct=200&lt;br /&gt;
select.significance_filter.max_ct=300&lt;br /&gt;
&lt;br /&gt;
scaling.model=&amp;lt;model.pdb or model.mtz&amp;gt;&lt;br /&gt;
scaling.resolution_scalar=0.96&lt;br /&gt;
&lt;br /&gt;
merging.d_min=1.8&lt;br /&gt;
merging.error.model=mm24&lt;br /&gt;
merging.merge_anomalous=True&lt;br /&gt;
&lt;br /&gt;
postrefinement.enable=True&lt;br /&gt;
statistics.n_bins=20&lt;br /&gt;
&lt;br /&gt;
output.do_timing=True&lt;br /&gt;
output.output_dir=&amp;lt;output folder&amp;gt;&lt;br /&gt;
output.prefix=&amp;lt;prefix for output files&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explore the parameters with:&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c&amp;lt;/code&amp;gt; — show configurable parameters&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c -e 10 -a 2&amp;lt;/code&amp;gt; — show all parameters (expert level 10) with full help text&lt;br /&gt;
&lt;br /&gt;
== Two-stage scaling and merging ==&lt;br /&gt;
&lt;br /&gt;
For large, growing datasets (the mode used by the [[cctbx.xfel GUI]]), it is more efficient to scale&lt;br /&gt;
and post-refine each subset of data &#039;&#039;&#039;once&#039;&#039;&#039;, then merge repeatedly as more data arrive. This is&lt;br /&gt;
done by running the program twice with different step lists.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 1 — scale each subset&#039;&#039;&#039; (stops after per-image work and writes intermediate DIALS files):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input balance model_scaling modify filter scale postrefine \&lt;br /&gt;
    statistics_unitcell statistics_beam model_statistics statistics_resolution&lt;br /&gt;
output.save_experiments_and_reflections=True&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;output.save_experiments_and_reflections=True&amp;lt;/code&amp;gt; dumps the scaled/post-refined data as&lt;br /&gt;
experiment lists and reflection tables that the merge stage can read back in.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 2 — merge the scaled subsets&#039;&#039;&#039; (add an &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; for each finished subset):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input model_scaling statistics_unitcell statistics_beam \&lt;br /&gt;
    model_statistics statistics_resolution group errors_merge statistics_intensity \&lt;br /&gt;
    merge statistics_intensity_cxi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Merging without a reference (bootstrap / mark1) ==&lt;br /&gt;
&lt;br /&gt;
If no scaling/merging reference is available, use a bootstrap procedure. First run the&lt;br /&gt;
&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; algorithm, which simply averages the data (all per-image scale factors = 1, no&lt;br /&gt;
post-refinement), specifying the target cell and symmetry explicitly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
scaling.algorithm=mark1&lt;br /&gt;
scaling.unit_cell=&amp;lt;unit cell&amp;gt;&lt;br /&gt;
scaling.space_group=&amp;lt;space group&amp;gt;&lt;br /&gt;
merging.error.model=errors_from_sample_residuals&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting MTZ is then used as the reference (&amp;lt;code&amp;gt;scaling.model=&amp;lt;/code&amp;gt;) for subsequent regular&lt;br /&gt;
merges. Iterate a few cycles; CC½ typically improves and converges over the first few rounds.&lt;br /&gt;
&lt;br /&gt;
== Important parameters ==&lt;br /&gt;
&lt;br /&gt;
Parameters are given by their full PHIL path with defaults in parentheses. The program exposes many&lt;br /&gt;
more parameters (see &amp;lt;code&amp;gt;-c -e 10 -a 2&amp;lt;/code&amp;gt;); those below are the ones most commonly set.&lt;br /&gt;
&lt;br /&gt;
=== Input ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; || None || Path(s) to the integrated data — a folder, several folders, or individual files; wildcards allowed; may be repeated. Matching &amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt; files must both be present.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.experiments_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.expt&amp;lt;/code&amp;gt; || Only load experiment files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.reflections_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.refl&amp;lt;/code&amp;gt; || Only load reflection files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.parallel_file_load.method&amp;lt;/code&amp;gt; || uniform || &amp;lt;code&amp;gt;uniform&amp;lt;/code&amp;gt; spreads input files evenly over all ranks; &amp;lt;code&amp;gt;node_memory&amp;lt;/code&amp;gt; distributes so per-node memory limits are respected.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.alist.file&amp;lt;/code&amp;gt; || None || Path to a text file of experiment tags or filenames; combined with &amp;lt;code&amp;gt;input.alist.op=keep|reject&amp;lt;/code&amp;gt; to merge only (or exclude) a specified subset.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.persistent_refl_cols&amp;lt;/code&amp;gt; || None || Reflection-table columns to preserve through the pruning steps (and into saved tables).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Filtering whole experiments (&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;entire experiments&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;n_obs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resolution&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;unit_cell&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;energy&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bootstrap&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;experiment_prefix&amp;lt;/code&amp;gt;. Nothing is filtered unless listed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.algorithm&amp;lt;/code&amp;gt; || value || How to restrict unit cells: &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; (compare to a target), &amp;lt;code&amp;gt;range&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;cluster&amp;lt;/code&amp;gt; (use a precomputed covariance clustering).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.relative_length_tolerance&amp;lt;/code&amp;gt; || 0.1 || Fractional deviation of cell edge lengths allowed vs. the target cell. Often tightened (e.g. 0.03).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.absolute_angle_tolerance&amp;lt;/code&amp;gt; || 2.0 || Allowed cell-angle deviation (degrees) vs. the target.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.target_unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;target_space_group&amp;lt;/code&amp;gt; || Auto || Target cell/symmetry; &amp;lt;code&amp;gt;Auto&amp;lt;/code&amp;gt; uses the scaling model.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.outlier.min_corr&amp;lt;/code&amp;gt; || 0.1 || Minimum correlation of an image&#039;s intensities to the reference model; images below this are rejected. Only applied when a scaling model is present. Use &amp;lt;code&amp;gt;-1&amp;lt;/code&amp;gt; to accept all images regardless of correlation.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.resolution.d_min&amp;lt;/code&amp;gt; || None || Reject an experiment unless some of its reflections extend beyond this resolution.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Selecting individual reflections (&amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;individual reflections&#039;&#039;&#039; (contrast with&lt;br /&gt;
&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;, which acts on whole experiments).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;significance_filter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;panel&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cspad_sensor&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;isolation_forest&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;target_energy&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.sigma&amp;lt;/code&amp;gt; || 0.5 || Trim each lattice at the resolution where the binned ⟨I/σ⟩ drops below this value.  Often reduced to 0.1.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.min_ct&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;max_ct&amp;lt;/code&amp;gt; || 10 / 50 || Target minimum/maximum mean reflections per resolution bin when choosing the number of bins. For large unit cells these are often raised (e.g. 200/300); for small cells, use the defaults.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Modifying intensities (&amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.algorithm&amp;lt;/code&amp;gt; || polarization || Per-reflection corrections to apply (default applies the polarization correction).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt; || — || Resolve an indexing ambiguity across the ensemble using the Gildea/Winter (Brehm/Diederichs) cosym method, optionally anchored to &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.reindex_to_reference&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;reindex_to_abc&amp;lt;/code&amp;gt; || — || Alternative re-indexing operators (to a reference model, or an explicit operator).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Scaling (&amp;lt;code&amp;gt;scaling&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt; || None || Reference dataset: a PDB file (uses the CRYST1 cell and computes model intensities, including bulk solvent) or an MTZ from a previous cycle. Required for &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt; scaling.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.algorithm&amp;lt;/code&amp;gt; || mark0 || &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;: per-image scaling against the reference. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;: no scaling, just Monte-Carlo averaging (all scale factors = 1) — used for reference-free bootstrap.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;scaling.space_group&amp;lt;/code&amp;gt; || None || Cell/symmetry to use when no model is provided (i.e. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.resolution_scalar&amp;lt;/code&amp;gt; || 0.969 || &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; is multiplied by this when deciding which reflections fall within the resolution limit, generating a few extra reference reflections to account for per-shot cell variation (e.g. set 0.96 for a few more).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.mtz.mtz_column_F&amp;lt;/code&amp;gt; || fobs || Column name in the reference MTZ containing the reference structure factors (intensities or amplitudes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Post-refinement (&amp;lt;code&amp;gt;postrefinement&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.enable&amp;lt;/code&amp;gt; || True || Enable post-refinement of per-image parameters/partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.algorithm&amp;lt;/code&amp;gt; || rs || Post-refinement protocol: &amp;lt;code&amp;gt;rs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs_hybrid&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;eta_deff&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Merging and error model (&amp;lt;code&amp;gt;merging&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; || None || High-resolution limit for scaling and merging.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_max&amp;lt;/code&amp;gt; || None || Low-resolution limit (currently affects only CCiso).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.merge_anomalous&amp;lt;/code&amp;gt; || False || &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; merges Bijvoet mates together (higher multiplicity); &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt; keeps them separate to preserve the anomalous signal.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.minimum_multiplicity&amp;lt;/code&amp;gt; || 2 || Do not produce a merged structure factor for HKLs measured fewer than this many times.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.error.model&amp;lt;/code&amp;gt; || mm24 || Merged-sigma error model: &amp;lt;code&amp;gt;mm24&amp;lt;/code&amp;gt; (Mittan-Moreau 2025, current default), &amp;lt;code&amp;gt;ev11&amp;lt;/code&amp;gt; (Evans 2011 / sdfac-refine), &amp;lt;code&amp;gt;ha14&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;errors_from_sample_residuals&amp;lt;/code&amp;gt; (no refined error terms — used with &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; bootstrap).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.set_average_unit_cell&amp;lt;/code&amp;gt; || True || Output MTZ adopts the average unit cell of the data rather than the reference model&#039;s cell.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Statistics (&amp;lt;code&amp;gt;statistics&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.n_bins&amp;lt;/code&amp;gt; || 10 || Number of resolution bins in the statistics tables.  Often raised to 20.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.cciso.mtz_file&amp;lt;/code&amp;gt; || None || Isomorphous reference structure factors for R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt; / CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.report_ML&amp;lt;/code&amp;gt; || True || Report per-frame max-likelihood attributes (domain size, mosaicity).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Output (&amp;lt;code&amp;gt;output&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.output_dir&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; || Directory for output files (created if it does not exist).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; || iobs || Prefix prepended to all output file names.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.save_experiments_and_reflections&amp;lt;/code&amp;gt; || False || Dump the final experiments/reflections from the last worker as DIALS files — used for the two-stage scale-then-merge workflow.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.do_timing&amp;lt;/code&amp;gt; || False || Log elapsed time per execution step.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.expanded_bookkeeping&amp;lt;/code&amp;gt; || False || Store extra provenance columns (input file/reflection indices, odd/even flag, original id) in the saved reflection tables.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Multiprocessing (&amp;lt;code&amp;gt;mp&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.method&amp;lt;/code&amp;gt; || mpi || Multiprocessing method (only &amp;lt;code&amp;gt;mpi&amp;lt;/code&amp;gt; is currently supported).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.debug.cProfile&amp;lt;/code&amp;gt; || False || Enable code profiling; a &amp;lt;code&amp;gt;.prof&amp;lt;/code&amp;gt; file is written per rank.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Output files ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; worker gathers all HKLs at rank 0 and writes three MTZ files, prefixed with&lt;br /&gt;
&amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; (default &amp;lt;code&amp;gt;iobs&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_all.mtz&amp;lt;/code&amp;gt; — the merged dataset using all observations (the main result for structure solution)&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_odd.mtz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_even.mtz&amp;lt;/code&amp;gt; — the two half-datasets used for CC½ and related half-dataset statistics&lt;br /&gt;
&lt;br /&gt;
A main log records the per-step progress and the merging statistics tables by resolution bin:&lt;br /&gt;
completeness, multiplicity and ⟨I/σ⟩, plus the &amp;quot;Table of Scaling Results&amp;quot; reporting CC½ (the&lt;br /&gt;
half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;&lt;br /&gt;
and R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.  The merged MTZ can optionally be&lt;br /&gt;
uploaded to a shared [https://github.com/cctbx/cctbx_project/tree/master/xfel/merging/application/publish Google Drive folder] by adding the &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; worker.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* Sauter NK (2015). &#039;&#039;J Synchrotron Radiat&#039;&#039; &#039;&#039;&#039;22&#039;&#039;&#039;, 239–48. (post-refinement)&lt;br /&gt;
* Uervirojnangkoorn M, &#039;&#039;et al.&#039;&#039; (2015). &#039;&#039;eLife&#039;&#039; 10.7554/eLife.05421. (PRIME / bootstrap)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2018). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;74&#039;&#039;&#039;, 877–894.&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019a). &#039;&#039;Computational Crystallography Newsletter&#039;&#039; &#039;&#039;&#039;10&#039;&#039;&#039;, 22–39. (XFEL GUI)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019b). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;75&#039;&#039;&#039;, 959–968. (error models)&lt;br /&gt;
* Mittan-Moreau (2025). (mm24 error model)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[dials.stills_process]] — produces the integrated data that &amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; consumes&lt;br /&gt;
* [[cctbx.xfel GUI]] — orchestrates separate scaling and repeated merging as data are collected&lt;br /&gt;
* The program README at &amp;lt;code&amp;gt;xfel/merging/README.md&amp;lt;/code&amp;gt; in cctbx_project&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1783</id>
		<title>Cctbx.xfel.merge</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1783"/>
		<updated>2026-08-21T23:24:52Z</updated>

		<summary type="html">&lt;p&gt;Aaron: /* Merging and error model (merging) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &#039;&#039;cctbx.xfel.merge&#039;&#039; =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;cctbx.xfel.merge&#039;&#039;&#039;&#039;&#039; is the scaling, post-refinement and merging program of cctbx.xfel. It takes&lt;br /&gt;
the per-image integrated results produced by &#039;&#039;[[dials.stills_process]]&#039;&#039; — one crystal per still shot —&lt;br /&gt;
and reduces the whole ensemble to a single set of merged structure-factor intensities (an MTZ file)&lt;br /&gt;
suitable for structure solution and refinement, together with the crystallographic quality&lt;br /&gt;
statistics (completeness, multiplicity, ⟨I/σ⟩, CC½, CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R-factors, etc.).&lt;br /&gt;
&lt;br /&gt;
Because serial datasets routinely contain tens of thousands to millions of still shots,&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is built from the ground up to run under MPI across many nodes. It is&lt;br /&gt;
almost always launched with &amp;lt;code&amp;gt;mpirun&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt;.  Note that MPI uses the term &#039;ranks&#039;&lt;br /&gt;
to distinguish independent processes that are running across one or more nodes.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is organized as a sequence of &#039;&#039;&#039;workers&#039;&#039;&#039;. Each worker performs one&lt;br /&gt;
task — reading data, applying a correction, filtering, scaling, post-refining, computing a statistic,&lt;br /&gt;
or merging — and passes its (possibly modified) experiments and reflections on to the next worker.&lt;br /&gt;
The list of workers to run is the &amp;quot;step list&amp;quot;, and it is fully configurable: you can add, remove or&lt;br /&gt;
reorder steps with &amp;lt;code&amp;gt;dispatch.step_list&amp;lt;/code&amp;gt;. This is what makes the program flexible enough to&lt;br /&gt;
scale-and-merge in one pass, to scale subsets separately and merge later, or to run a reference-free&lt;br /&gt;
bootstrap.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;default&#039;&#039;&#039; step list is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! # !! Worker !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| 1 || &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; || Read integrated experiments (&amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;) and reflections (&amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt;) from disk in DIALS format.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || &amp;lt;code&amp;gt;balance&amp;lt;/code&amp;gt; || Redistribute the input load evenly across MPI ranks (needed when there are fewer or more input files than ranks).&lt;br /&gt;
|-&lt;br /&gt;
| 3 || &amp;lt;code&amp;gt;model_scaling&amp;lt;/code&amp;gt; || Build the full Miller list, model intensities from the reference, and the resolution binner used for scaling and post-refinement.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || &amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt; || Apply per-reflection modifications, e.g. polarization correction (and optionally re-indexing to resolve indexing ambiguity — see &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;reindex_to_reference&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 5 || &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; || Reject whole experiments (or reflections) by resolution, unit cell, correlation to the reference, energy, etc.&lt;br /&gt;
|-&lt;br /&gt;
| 6 || &amp;lt;code&amp;gt;scale&amp;lt;/code&amp;gt; || Scale each lattice to the reference dataset (&amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;) or simply average (&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 7 || &amp;lt;code&amp;gt;postrefine&amp;lt;/code&amp;gt; || Post-refine per-image crystal parameters and partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| 8 || &amp;lt;code&amp;gt;statistics_unitcell&amp;lt;/code&amp;gt; || Determine and store the average unit cell.&lt;br /&gt;
|-&lt;br /&gt;
| 9 || &amp;lt;code&amp;gt;statistics_beam&amp;lt;/code&amp;gt; || Determine and store the average wavelength.&lt;br /&gt;
|-&lt;br /&gt;
| 10 || &amp;lt;code&amp;gt;model_statistics&amp;lt;/code&amp;gt; || Rebuild the Miller list / binner for statistics (may use the average unit cell).&lt;br /&gt;
|-&lt;br /&gt;
| 11 || &amp;lt;code&amp;gt;statistics_resolution&amp;lt;/code&amp;gt; || Per-crystal resolution statistics.&lt;br /&gt;
|-&lt;br /&gt;
| 12 || &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt; || Redistribute reflections across ranks so that every observation of a given HKL is gathered on the same rank prior to merging.&lt;br /&gt;
|-&lt;br /&gt;
| 13 || &amp;lt;code&amp;gt;errors_merge&amp;lt;/code&amp;gt; || Correct the merged error estimates with a per-HKL error model (e.g. Ev11, Brewster 2019b, or MM24 (the default), Mittan-Moreau (2025)).&lt;br /&gt;
|-&lt;br /&gt;
| 14 || &amp;lt;code&amp;gt;statistics_intensity&amp;lt;/code&amp;gt; || Intensity statistics by resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 15 || &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; || Merge symmetry-equivalent intensities, gather all HKLs at rank 0, and write &amp;quot;odd&amp;quot;, &amp;quot;even&amp;quot; and &amp;quot;all&amp;quot; MTZ files.&lt;br /&gt;
|-&lt;br /&gt;
| 16 || &amp;lt;code&amp;gt;statistics_intensity_cxi&amp;lt;/code&amp;gt; || Correlation and R-factor statistics (ported from cxi.merge): the &amp;quot;Table of Scaling Results&amp;quot; — CC½ (half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Additional, non-default workers are available and can be&lt;br /&gt;
inserted into the step list, including &amp;lt;code&amp;gt;tdata&amp;lt;/code&amp;gt; (write out unit cells for clustering),&lt;br /&gt;
&amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; (batch MTZ for &#039;&#039;Careless&#039;&#039;), &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; (upload merged files to a&lt;br /&gt;
Google Drive folder), &amp;lt;code&amp;gt;monitor&amp;lt;/code&amp;gt; (resource-usage logging), &amp;lt;code&amp;gt;integrate&amp;lt;/code&amp;gt;&lt;br /&gt;
(on-the-fly integration), &amp;lt;code&amp;gt;prepare&amp;lt;/code&amp;gt; (SpReAD energy binning), and&lt;br /&gt;
&amp;lt;code&amp;gt;lunus&amp;lt;/code&amp;gt; (diffuse-scattering deck). A &amp;lt;code&amp;gt;deltaccint&amp;lt;/code&amp;gt; worker (ΔCC½ lattice&lt;br /&gt;
filtering) can be added after &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;. Custom workers can be supplied through the&lt;br /&gt;
&amp;lt;code&amp;gt;XFEL_CUSTOM_WORKER_PATH&amp;lt;/code&amp;gt; environment variable.&lt;br /&gt;
&lt;br /&gt;
== Basic usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is run under MPI:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mpirun cctbx.xfel.merge merge.phil&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical &amp;lt;code&amp;gt;merge.phil&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input.path=&amp;lt;path to data&amp;gt;&lt;br /&gt;
input.experiments_suffix=.expt&lt;br /&gt;
input.reflections_suffix=.refl&lt;br /&gt;
&lt;br /&gt;
filter.algorithm=unit_cell&lt;br /&gt;
filter.unit_cell.value.relative_length_tolerance=0.03&lt;br /&gt;
filter.outlier.min_corr=0.1&lt;br /&gt;
&lt;br /&gt;
select.algorithm=significance_filter&lt;br /&gt;
select.significance_filter.sigma=0.1&lt;br /&gt;
select.significance_filter.min_ct=200&lt;br /&gt;
select.significance_filter.max_ct=300&lt;br /&gt;
&lt;br /&gt;
scaling.model=&amp;lt;model.pdb or model.mtz&amp;gt;&lt;br /&gt;
scaling.resolution_scalar=0.96&lt;br /&gt;
&lt;br /&gt;
merging.d_min=1.8&lt;br /&gt;
merging.error.model=mm24&lt;br /&gt;
merging.merge_anomalous=True&lt;br /&gt;
&lt;br /&gt;
postrefinement.enable=True&lt;br /&gt;
statistics.n_bins=20&lt;br /&gt;
&lt;br /&gt;
output.do_timing=True&lt;br /&gt;
output.output_dir=&amp;lt;output folder&amp;gt;&lt;br /&gt;
output.prefix=&amp;lt;prefix for output files&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explore the parameters with:&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c&amp;lt;/code&amp;gt; — show configurable parameters&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c -e 10 -a 2&amp;lt;/code&amp;gt; — show all parameters (expert level 10) with full help text&lt;br /&gt;
&lt;br /&gt;
== Two-stage scaling and merging ==&lt;br /&gt;
&lt;br /&gt;
For large, growing datasets (the mode used by the [[cctbx.xfel GUI]]), it is more efficient to scale&lt;br /&gt;
and post-refine each subset of data &#039;&#039;&#039;once&#039;&#039;&#039;, then merge repeatedly as more data arrive. This is&lt;br /&gt;
done by running the program twice with different step lists.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 1 — scale each subset&#039;&#039;&#039; (stops after per-image work and writes intermediate DIALS files):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input balance model_scaling modify filter scale postrefine \&lt;br /&gt;
    statistics_unitcell statistics_beam model_statistics statistics_resolution&lt;br /&gt;
output.save_experiments_and_reflections=True&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;output.save_experiments_and_reflections=True&amp;lt;/code&amp;gt; dumps the scaled/post-refined data as&lt;br /&gt;
experiment lists and reflection tables that the merge stage can read back in.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 2 — merge the scaled subsets&#039;&#039;&#039; (add an &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; for each finished subset):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input model_scaling statistics_unitcell statistics_beam \&lt;br /&gt;
    model_statistics statistics_resolution group errors_merge statistics_intensity \&lt;br /&gt;
    merge statistics_intensity_cxi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Merging without a reference (bootstrap / mark1) ==&lt;br /&gt;
&lt;br /&gt;
If no scaling/merging reference is available, use a bootstrap procedure. First run the&lt;br /&gt;
&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; algorithm, which simply averages the data (all per-image scale factors = 1, no&lt;br /&gt;
post-refinement), specifying the target cell and symmetry explicitly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
scaling.algorithm=mark1&lt;br /&gt;
scaling.unit_cell=&amp;lt;unit cell&amp;gt;&lt;br /&gt;
scaling.space_group=&amp;lt;space group&amp;gt;&lt;br /&gt;
merging.error.model=errors_from_sample_residuals&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting MTZ is then used as the reference (&amp;lt;code&amp;gt;scaling.model=&amp;lt;/code&amp;gt;) for subsequent regular&lt;br /&gt;
merges. Iterate a few cycles; CC½ typically improves and converges over the first few rounds.&lt;br /&gt;
&lt;br /&gt;
== Important parameters ==&lt;br /&gt;
&lt;br /&gt;
Parameters are given by their full PHIL path with defaults in parentheses. The program exposes many&lt;br /&gt;
more parameters (see &amp;lt;code&amp;gt;-c -e 10 -a 2&amp;lt;/code&amp;gt;); those below are the ones most commonly set.&lt;br /&gt;
&lt;br /&gt;
=== Input ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; || None || Path(s) to the integrated data — a folder, several folders, or individual files; wildcards allowed; may be repeated. Matching &amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt; files must both be present.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.experiments_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.expt&amp;lt;/code&amp;gt; || Only load experiment files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.reflections_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.refl&amp;lt;/code&amp;gt; || Only load reflection files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.parallel_file_load.method&amp;lt;/code&amp;gt; || uniform || &amp;lt;code&amp;gt;uniform&amp;lt;/code&amp;gt; spreads input files evenly over all ranks; &amp;lt;code&amp;gt;node_memory&amp;lt;/code&amp;gt; distributes so per-node memory limits are respected.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.alist.file&amp;lt;/code&amp;gt; || None || Path to a text file of experiment tags or filenames; combined with &amp;lt;code&amp;gt;input.alist.op=keep|reject&amp;lt;/code&amp;gt; to merge only (or exclude) a specified subset.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.persistent_refl_cols&amp;lt;/code&amp;gt; || None || Reflection-table columns to preserve through the pruning steps (and into saved tables).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Filtering whole experiments (&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;entire experiments&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;n_obs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resolution&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;unit_cell&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;energy&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bootstrap&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;experiment_prefix&amp;lt;/code&amp;gt;. Nothing is filtered unless listed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.algorithm&amp;lt;/code&amp;gt; || value || How to restrict unit cells: &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; (compare to a target), &amp;lt;code&amp;gt;range&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;cluster&amp;lt;/code&amp;gt; (use a precomputed covariance clustering).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.relative_length_tolerance&amp;lt;/code&amp;gt; || 0.1 || Fractional deviation of cell edge lengths allowed vs. the target cell. Often tightened (e.g. 0.03).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.absolute_angle_tolerance&amp;lt;/code&amp;gt; || 2.0 || Allowed cell-angle deviation (degrees) vs. the target.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.target_unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;target_space_group&amp;lt;/code&amp;gt; || Auto || Target cell/symmetry; &amp;lt;code&amp;gt;Auto&amp;lt;/code&amp;gt; uses the scaling model.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.outlier.min_corr&amp;lt;/code&amp;gt; || 0.1 || Minimum correlation of an image&#039;s intensities to the reference model; images below this are rejected. Only applied when a scaling model is present. Use &amp;lt;code&amp;gt;-1&amp;lt;/code&amp;gt; to accept all images regardless of correlation.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.resolution.d_min&amp;lt;/code&amp;gt; || None || Reject an experiment unless some of its reflections extend beyond this resolution.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Selecting individual reflections (&amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;individual reflections&#039;&#039;&#039; (contrast with&lt;br /&gt;
&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;, which acts on whole experiments).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;significance_filter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;panel&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cspad_sensor&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;isolation_forest&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;target_energy&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.sigma&amp;lt;/code&amp;gt; || 0.5 || Trim each lattice at the resolution where the binned ⟨I/σ⟩ drops below this value.  Often reduced to 0.1.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.min_ct&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;max_ct&amp;lt;/code&amp;gt; || 10 / 50 || Target minimum/maximum mean reflections per resolution bin when choosing the number of bins. For large unit cells these are often raised (e.g. 200/300); for small cells, use the defaults.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Modifying intensities (&amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.algorithm&amp;lt;/code&amp;gt; || polarization || Per-reflection corrections to apply (default applies the polarization correction).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt; || — || Resolve an indexing ambiguity across the ensemble using the Gildea/Winter (Brehm/Diederichs) cosym method, optionally anchored to &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.reindex_to_reference&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;reindex_to_abc&amp;lt;/code&amp;gt; || — || Alternative re-indexing operators (to a reference model, or an explicit operator).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Scaling (&amp;lt;code&amp;gt;scaling&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt; || None || Reference dataset: a PDB file (uses the CRYST1 cell and computes model intensities, including bulk solvent) or an MTZ from a previous cycle. Required for &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt; scaling.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.algorithm&amp;lt;/code&amp;gt; || mark0 || &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;: per-image scaling against the reference. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;: no scaling, just Monte-Carlo averaging (all scale factors = 1) — used for reference-free bootstrap.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;scaling.space_group&amp;lt;/code&amp;gt; || None || Cell/symmetry to use when no model is provided (i.e. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.resolution_scalar&amp;lt;/code&amp;gt; || 0.969 || &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; is multiplied by this when deciding which reflections fall within the resolution limit, generating a few extra reference reflections to account for per-shot cell variation (e.g. set 0.96 for a few more).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.mtz.mtz_column_F&amp;lt;/code&amp;gt; || fobs || Column name in the reference MTZ containing the reference structure factors (intensities or amplitudes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Post-refinement (&amp;lt;code&amp;gt;postrefinement&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.enable&amp;lt;/code&amp;gt; || True || Enable post-refinement of per-image parameters/partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.algorithm&amp;lt;/code&amp;gt; || rs || Post-refinement protocol: &amp;lt;code&amp;gt;rs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs_hybrid&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;eta_deff&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Merging and error model (&amp;lt;code&amp;gt;merging&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; || None || High-resolution limit for scaling and merging.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_max&amp;lt;/code&amp;gt; || None || Low-resolution limit (currently affects only CCiso).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.merge_anomalous&amp;lt;/code&amp;gt; || False || &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; merges Bijvoet mates together (higher multiplicity); &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt; keeps them separate to preserve the anomalous signal.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.minimum_multiplicity&amp;lt;/code&amp;gt; || 2 || Do not produce a merged structure factor for HKLs measured fewer than this many times.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.error.model&amp;lt;/code&amp;gt; || mm24 || Merged-sigma error model: &amp;lt;code&amp;gt;mm24&amp;lt;/code&amp;gt; (Mittan-Moreau 2025, current default), &amp;lt;code&amp;gt;ev11&amp;lt;/code&amp;gt; (Evans 2011 / sdfac-refine), &amp;lt;code&amp;gt;ha14&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;errors_from_sample_residuals&amp;lt;/code&amp;gt; (no refined error terms — used with &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; bootstrap).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.set_average_unit_cell&amp;lt;/code&amp;gt; || True || Output MTZ adopts the average unit cell of the data rather than the reference model&#039;s cell.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Statistics (&amp;lt;code&amp;gt;statistics&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.n_bins&amp;lt;/code&amp;gt; || 10 || Number of resolution bins in the statistics tables.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.cciso.mtz_file&amp;lt;/code&amp;gt; || None || Isomorphous reference structure factors for R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt; / CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.report_ML&amp;lt;/code&amp;gt; || True || Report per-frame max-likelihood attributes (domain size, mosaicity).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Output (&amp;lt;code&amp;gt;output&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.output_dir&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; || Directory for output files (created if it does not exist).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; || iobs || Prefix prepended to all output file names.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.save_experiments_and_reflections&amp;lt;/code&amp;gt; || False || Dump the final experiments/reflections from the last worker as DIALS files — used for the two-stage scale-then-merge workflow.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.do_timing&amp;lt;/code&amp;gt; || False || Log elapsed time per execution step.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.expanded_bookkeeping&amp;lt;/code&amp;gt; || False || Store extra provenance columns (input file/reflection indices, odd/even flag, original id) in the saved reflection tables.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Multiprocessing (&amp;lt;code&amp;gt;mp&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.method&amp;lt;/code&amp;gt; || mpi || Multiprocessing method (only &amp;lt;code&amp;gt;mpi&amp;lt;/code&amp;gt; is currently supported).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.debug.cProfile&amp;lt;/code&amp;gt; || False || Enable code profiling; a &amp;lt;code&amp;gt;.prof&amp;lt;/code&amp;gt; file is written per rank.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Output files ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; worker gathers all HKLs at rank 0 and writes three MTZ files, prefixed with&lt;br /&gt;
&amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; (default &amp;lt;code&amp;gt;iobs&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_all.mtz&amp;lt;/code&amp;gt; — the merged dataset using all observations (the main result for structure solution)&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_odd.mtz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_even.mtz&amp;lt;/code&amp;gt; — the two half-datasets used for CC½ and related half-dataset statistics&lt;br /&gt;
&lt;br /&gt;
A main log records the per-step progress and the merging statistics tables by resolution bin:&lt;br /&gt;
completeness, multiplicity and ⟨I/σ⟩, plus the &amp;quot;Table of Scaling Results&amp;quot; reporting CC½ (the&lt;br /&gt;
half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;&lt;br /&gt;
and R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.  The merged MTZ can optionally be&lt;br /&gt;
uploaded to a shared [https://github.com/cctbx/cctbx_project/tree/master/xfel/merging/application/publish Google Drive folder] by adding the &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; worker.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* Sauter NK (2015). &#039;&#039;J Synchrotron Radiat&#039;&#039; &#039;&#039;&#039;22&#039;&#039;&#039;, 239–48. (post-refinement)&lt;br /&gt;
* Uervirojnangkoorn M, &#039;&#039;et al.&#039;&#039; (2015). &#039;&#039;eLife&#039;&#039; 10.7554/eLife.05421. (PRIME / bootstrap)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2018). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;74&#039;&#039;&#039;, 877–894.&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019a). &#039;&#039;Computational Crystallography Newsletter&#039;&#039; &#039;&#039;&#039;10&#039;&#039;&#039;, 22–39. (XFEL GUI)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019b). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;75&#039;&#039;&#039;, 959–968. (error models)&lt;br /&gt;
* Mittan-Moreau (2025). (mm24 error model)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[dials.stills_process]] — produces the integrated data that &amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; consumes&lt;br /&gt;
* [[cctbx.xfel GUI]] — orchestrates separate scaling and repeated merging as data are collected&lt;br /&gt;
* The program README at &amp;lt;code&amp;gt;xfel/merging/README.md&amp;lt;/code&amp;gt; in cctbx_project&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1782</id>
		<title>Cctbx.xfel.merge</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1782"/>
		<updated>2026-08-21T23:24:39Z</updated>

		<summary type="html">&lt;p&gt;Aaron: /* Merging and error model (merging) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &#039;&#039;cctbx.xfel.merge&#039;&#039; =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;cctbx.xfel.merge&#039;&#039;&#039;&#039;&#039; is the scaling, post-refinement and merging program of cctbx.xfel. It takes&lt;br /&gt;
the per-image integrated results produced by &#039;&#039;[[dials.stills_process]]&#039;&#039; — one crystal per still shot —&lt;br /&gt;
and reduces the whole ensemble to a single set of merged structure-factor intensities (an MTZ file)&lt;br /&gt;
suitable for structure solution and refinement, together with the crystallographic quality&lt;br /&gt;
statistics (completeness, multiplicity, ⟨I/σ⟩, CC½, CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R-factors, etc.).&lt;br /&gt;
&lt;br /&gt;
Because serial datasets routinely contain tens of thousands to millions of still shots,&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is built from the ground up to run under MPI across many nodes. It is&lt;br /&gt;
almost always launched with &amp;lt;code&amp;gt;mpirun&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt;.  Note that MPI uses the term &#039;ranks&#039;&lt;br /&gt;
to distinguish independent processes that are running across one or more nodes.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is organized as a sequence of &#039;&#039;&#039;workers&#039;&#039;&#039;. Each worker performs one&lt;br /&gt;
task — reading data, applying a correction, filtering, scaling, post-refining, computing a statistic,&lt;br /&gt;
or merging — and passes its (possibly modified) experiments and reflections on to the next worker.&lt;br /&gt;
The list of workers to run is the &amp;quot;step list&amp;quot;, and it is fully configurable: you can add, remove or&lt;br /&gt;
reorder steps with &amp;lt;code&amp;gt;dispatch.step_list&amp;lt;/code&amp;gt;. This is what makes the program flexible enough to&lt;br /&gt;
scale-and-merge in one pass, to scale subsets separately and merge later, or to run a reference-free&lt;br /&gt;
bootstrap.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;default&#039;&#039;&#039; step list is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! # !! Worker !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| 1 || &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; || Read integrated experiments (&amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;) and reflections (&amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt;) from disk in DIALS format.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || &amp;lt;code&amp;gt;balance&amp;lt;/code&amp;gt; || Redistribute the input load evenly across MPI ranks (needed when there are fewer or more input files than ranks).&lt;br /&gt;
|-&lt;br /&gt;
| 3 || &amp;lt;code&amp;gt;model_scaling&amp;lt;/code&amp;gt; || Build the full Miller list, model intensities from the reference, and the resolution binner used for scaling and post-refinement.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || &amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt; || Apply per-reflection modifications, e.g. polarization correction (and optionally re-indexing to resolve indexing ambiguity — see &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;reindex_to_reference&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 5 || &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; || Reject whole experiments (or reflections) by resolution, unit cell, correlation to the reference, energy, etc.&lt;br /&gt;
|-&lt;br /&gt;
| 6 || &amp;lt;code&amp;gt;scale&amp;lt;/code&amp;gt; || Scale each lattice to the reference dataset (&amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;) or simply average (&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 7 || &amp;lt;code&amp;gt;postrefine&amp;lt;/code&amp;gt; || Post-refine per-image crystal parameters and partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| 8 || &amp;lt;code&amp;gt;statistics_unitcell&amp;lt;/code&amp;gt; || Determine and store the average unit cell.&lt;br /&gt;
|-&lt;br /&gt;
| 9 || &amp;lt;code&amp;gt;statistics_beam&amp;lt;/code&amp;gt; || Determine and store the average wavelength.&lt;br /&gt;
|-&lt;br /&gt;
| 10 || &amp;lt;code&amp;gt;model_statistics&amp;lt;/code&amp;gt; || Rebuild the Miller list / binner for statistics (may use the average unit cell).&lt;br /&gt;
|-&lt;br /&gt;
| 11 || &amp;lt;code&amp;gt;statistics_resolution&amp;lt;/code&amp;gt; || Per-crystal resolution statistics.&lt;br /&gt;
|-&lt;br /&gt;
| 12 || &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt; || Redistribute reflections across ranks so that every observation of a given HKL is gathered on the same rank prior to merging.&lt;br /&gt;
|-&lt;br /&gt;
| 13 || &amp;lt;code&amp;gt;errors_merge&amp;lt;/code&amp;gt; || Correct the merged error estimates with a per-HKL error model (e.g. Ev11, Brewster 2019b, or MM24 (the default), Mittan-Moreau (2025)).&lt;br /&gt;
|-&lt;br /&gt;
| 14 || &amp;lt;code&amp;gt;statistics_intensity&amp;lt;/code&amp;gt; || Intensity statistics by resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 15 || &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; || Merge symmetry-equivalent intensities, gather all HKLs at rank 0, and write &amp;quot;odd&amp;quot;, &amp;quot;even&amp;quot; and &amp;quot;all&amp;quot; MTZ files.&lt;br /&gt;
|-&lt;br /&gt;
| 16 || &amp;lt;code&amp;gt;statistics_intensity_cxi&amp;lt;/code&amp;gt; || Correlation and R-factor statistics (ported from cxi.merge): the &amp;quot;Table of Scaling Results&amp;quot; — CC½ (half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Additional, non-default workers are available and can be&lt;br /&gt;
inserted into the step list, including &amp;lt;code&amp;gt;tdata&amp;lt;/code&amp;gt; (write out unit cells for clustering),&lt;br /&gt;
&amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; (batch MTZ for &#039;&#039;Careless&#039;&#039;), &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; (upload merged files to a&lt;br /&gt;
Google Drive folder), &amp;lt;code&amp;gt;monitor&amp;lt;/code&amp;gt; (resource-usage logging), &amp;lt;code&amp;gt;integrate&amp;lt;/code&amp;gt;&lt;br /&gt;
(on-the-fly integration), &amp;lt;code&amp;gt;prepare&amp;lt;/code&amp;gt; (SpReAD energy binning), and&lt;br /&gt;
&amp;lt;code&amp;gt;lunus&amp;lt;/code&amp;gt; (diffuse-scattering deck). A &amp;lt;code&amp;gt;deltaccint&amp;lt;/code&amp;gt; worker (ΔCC½ lattice&lt;br /&gt;
filtering) can be added after &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;. Custom workers can be supplied through the&lt;br /&gt;
&amp;lt;code&amp;gt;XFEL_CUSTOM_WORKER_PATH&amp;lt;/code&amp;gt; environment variable.&lt;br /&gt;
&lt;br /&gt;
== Basic usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is run under MPI:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mpirun cctbx.xfel.merge merge.phil&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical &amp;lt;code&amp;gt;merge.phil&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input.path=&amp;lt;path to data&amp;gt;&lt;br /&gt;
input.experiments_suffix=.expt&lt;br /&gt;
input.reflections_suffix=.refl&lt;br /&gt;
&lt;br /&gt;
filter.algorithm=unit_cell&lt;br /&gt;
filter.unit_cell.value.relative_length_tolerance=0.03&lt;br /&gt;
filter.outlier.min_corr=0.1&lt;br /&gt;
&lt;br /&gt;
select.algorithm=significance_filter&lt;br /&gt;
select.significance_filter.sigma=0.1&lt;br /&gt;
select.significance_filter.min_ct=200&lt;br /&gt;
select.significance_filter.max_ct=300&lt;br /&gt;
&lt;br /&gt;
scaling.model=&amp;lt;model.pdb or model.mtz&amp;gt;&lt;br /&gt;
scaling.resolution_scalar=0.96&lt;br /&gt;
&lt;br /&gt;
merging.d_min=1.8&lt;br /&gt;
merging.error.model=mm24&lt;br /&gt;
merging.merge_anomalous=True&lt;br /&gt;
&lt;br /&gt;
postrefinement.enable=True&lt;br /&gt;
statistics.n_bins=20&lt;br /&gt;
&lt;br /&gt;
output.do_timing=True&lt;br /&gt;
output.output_dir=&amp;lt;output folder&amp;gt;&lt;br /&gt;
output.prefix=&amp;lt;prefix for output files&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explore the parameters with:&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c&amp;lt;/code&amp;gt; — show configurable parameters&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c -e 10 -a 2&amp;lt;/code&amp;gt; — show all parameters (expert level 10) with full help text&lt;br /&gt;
&lt;br /&gt;
== Two-stage scaling and merging ==&lt;br /&gt;
&lt;br /&gt;
For large, growing datasets (the mode used by the [[cctbx.xfel GUI]]), it is more efficient to scale&lt;br /&gt;
and post-refine each subset of data &#039;&#039;&#039;once&#039;&#039;&#039;, then merge repeatedly as more data arrive. This is&lt;br /&gt;
done by running the program twice with different step lists.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 1 — scale each subset&#039;&#039;&#039; (stops after per-image work and writes intermediate DIALS files):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input balance model_scaling modify filter scale postrefine \&lt;br /&gt;
    statistics_unitcell statistics_beam model_statistics statistics_resolution&lt;br /&gt;
output.save_experiments_and_reflections=True&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;output.save_experiments_and_reflections=True&amp;lt;/code&amp;gt; dumps the scaled/post-refined data as&lt;br /&gt;
experiment lists and reflection tables that the merge stage can read back in.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 2 — merge the scaled subsets&#039;&#039;&#039; (add an &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; for each finished subset):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input model_scaling statistics_unitcell statistics_beam \&lt;br /&gt;
    model_statistics statistics_resolution group errors_merge statistics_intensity \&lt;br /&gt;
    merge statistics_intensity_cxi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Merging without a reference (bootstrap / mark1) ==&lt;br /&gt;
&lt;br /&gt;
If no scaling/merging reference is available, use a bootstrap procedure. First run the&lt;br /&gt;
&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; algorithm, which simply averages the data (all per-image scale factors = 1, no&lt;br /&gt;
post-refinement), specifying the target cell and symmetry explicitly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
scaling.algorithm=mark1&lt;br /&gt;
scaling.unit_cell=&amp;lt;unit cell&amp;gt;&lt;br /&gt;
scaling.space_group=&amp;lt;space group&amp;gt;&lt;br /&gt;
merging.error.model=errors_from_sample_residuals&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting MTZ is then used as the reference (&amp;lt;code&amp;gt;scaling.model=&amp;lt;/code&amp;gt;) for subsequent regular&lt;br /&gt;
merges. Iterate a few cycles; CC½ typically improves and converges over the first few rounds.&lt;br /&gt;
&lt;br /&gt;
== Important parameters ==&lt;br /&gt;
&lt;br /&gt;
Parameters are given by their full PHIL path with defaults in parentheses. The program exposes many&lt;br /&gt;
more parameters (see &amp;lt;code&amp;gt;-c -e 10 -a 2&amp;lt;/code&amp;gt;); those below are the ones most commonly set.&lt;br /&gt;
&lt;br /&gt;
=== Input ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; || None || Path(s) to the integrated data — a folder, several folders, or individual files; wildcards allowed; may be repeated. Matching &amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt; files must both be present.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.experiments_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.expt&amp;lt;/code&amp;gt; || Only load experiment files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.reflections_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.refl&amp;lt;/code&amp;gt; || Only load reflection files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.parallel_file_load.method&amp;lt;/code&amp;gt; || uniform || &amp;lt;code&amp;gt;uniform&amp;lt;/code&amp;gt; spreads input files evenly over all ranks; &amp;lt;code&amp;gt;node_memory&amp;lt;/code&amp;gt; distributes so per-node memory limits are respected.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.alist.file&amp;lt;/code&amp;gt; || None || Path to a text file of experiment tags or filenames; combined with &amp;lt;code&amp;gt;input.alist.op=keep|reject&amp;lt;/code&amp;gt; to merge only (or exclude) a specified subset.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.persistent_refl_cols&amp;lt;/code&amp;gt; || None || Reflection-table columns to preserve through the pruning steps (and into saved tables).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Filtering whole experiments (&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;entire experiments&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;n_obs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resolution&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;unit_cell&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;energy&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bootstrap&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;experiment_prefix&amp;lt;/code&amp;gt;. Nothing is filtered unless listed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.algorithm&amp;lt;/code&amp;gt; || value || How to restrict unit cells: &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; (compare to a target), &amp;lt;code&amp;gt;range&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;cluster&amp;lt;/code&amp;gt; (use a precomputed covariance clustering).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.relative_length_tolerance&amp;lt;/code&amp;gt; || 0.1 || Fractional deviation of cell edge lengths allowed vs. the target cell. Often tightened (e.g. 0.03).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.absolute_angle_tolerance&amp;lt;/code&amp;gt; || 2.0 || Allowed cell-angle deviation (degrees) vs. the target.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.target_unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;target_space_group&amp;lt;/code&amp;gt; || Auto || Target cell/symmetry; &amp;lt;code&amp;gt;Auto&amp;lt;/code&amp;gt; uses the scaling model.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.outlier.min_corr&amp;lt;/code&amp;gt; || 0.1 || Minimum correlation of an image&#039;s intensities to the reference model; images below this are rejected. Only applied when a scaling model is present. Use &amp;lt;code&amp;gt;-1&amp;lt;/code&amp;gt; to accept all images regardless of correlation.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.resolution.d_min&amp;lt;/code&amp;gt; || None || Reject an experiment unless some of its reflections extend beyond this resolution.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Selecting individual reflections (&amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;individual reflections&#039;&#039;&#039; (contrast with&lt;br /&gt;
&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;, which acts on whole experiments).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;significance_filter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;panel&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cspad_sensor&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;isolation_forest&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;target_energy&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.sigma&amp;lt;/code&amp;gt; || 0.5 || Trim each lattice at the resolution where the binned ⟨I/σ⟩ drops below this value.  Often reduced to 0.1.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.min_ct&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;max_ct&amp;lt;/code&amp;gt; || 10 / 50 || Target minimum/maximum mean reflections per resolution bin when choosing the number of bins. For large unit cells these are often raised (e.g. 200/300); for small cells, use the defaults.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Modifying intensities (&amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.algorithm&amp;lt;/code&amp;gt; || polarization || Per-reflection corrections to apply (default applies the polarization correction).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt; || — || Resolve an indexing ambiguity across the ensemble using the Gildea/Winter (Brehm/Diederichs) cosym method, optionally anchored to &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.reindex_to_reference&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;reindex_to_abc&amp;lt;/code&amp;gt; || — || Alternative re-indexing operators (to a reference model, or an explicit operator).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Scaling (&amp;lt;code&amp;gt;scaling&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt; || None || Reference dataset: a PDB file (uses the CRYST1 cell and computes model intensities, including bulk solvent) or an MTZ from a previous cycle. Required for &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt; scaling.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.algorithm&amp;lt;/code&amp;gt; || mark0 || &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;: per-image scaling against the reference. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;: no scaling, just Monte-Carlo averaging (all scale factors = 1) — used for reference-free bootstrap.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;scaling.space_group&amp;lt;/code&amp;gt; || None || Cell/symmetry to use when no model is provided (i.e. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.resolution_scalar&amp;lt;/code&amp;gt; || 0.969 || &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; is multiplied by this when deciding which reflections fall within the resolution limit, generating a few extra reference reflections to account for per-shot cell variation (e.g. set 0.96 for a few more).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.mtz.mtz_column_F&amp;lt;/code&amp;gt; || fobs || Column name in the reference MTZ containing the reference structure factors (intensities or amplitudes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Post-refinement (&amp;lt;code&amp;gt;postrefinement&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.enable&amp;lt;/code&amp;gt; || True || Enable post-refinement of per-image parameters/partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.algorithm&amp;lt;/code&amp;gt; || rs || Post-refinement protocol: &amp;lt;code&amp;gt;rs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs_hybrid&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;eta_deff&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Merging and error model (&amp;lt;code&amp;gt;merging&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; || None || High-resolution limit for scaling and merging.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_max&amp;lt;/code&amp;gt; || None || Low-resolution limit (currently affects only CCiso).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.merge_anomalous&amp;lt;/code&amp;gt; || False || &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; merges Bijvoet mates together (higher multiplicity); &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt; keeps them separate to preserve the anomalous signal.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.minimum_multiplicity&amp;lt;/code&amp;gt; || 2 || Do not produce a merged structure factor for HKLs measured fewer than this many times.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.error.model&amp;lt;/code&amp;gt; || mm24 || Merged-sigma error model: &amp;lt;code&amp;gt;mm24&amp;lt;/code&amp;gt; (Mittan-Moreau 2025, current default), &amp;lt;code&amp;gt;ev11&amp;lt;/code&amp;gt; (Evans 2011 / sdfac-refine), &amp;lt;code&amp;gt;ha14&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;errors_from_sample_residuals&amp;lt;/code&amp;gt; (no refined error terms — used with &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; bootstrap).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.set_average_unit_cell&amp;lt;/code&amp;gt; || True || Output MTZ adopts the (cluster-derived) average unit cell of the data rather than the reference model&#039;s cell.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Statistics (&amp;lt;code&amp;gt;statistics&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.n_bins&amp;lt;/code&amp;gt; || 10 || Number of resolution bins in the statistics tables.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.cciso.mtz_file&amp;lt;/code&amp;gt; || None || Isomorphous reference structure factors for R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt; / CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.report_ML&amp;lt;/code&amp;gt; || True || Report per-frame max-likelihood attributes (domain size, mosaicity).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Output (&amp;lt;code&amp;gt;output&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.output_dir&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; || Directory for output files (created if it does not exist).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; || iobs || Prefix prepended to all output file names.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.save_experiments_and_reflections&amp;lt;/code&amp;gt; || False || Dump the final experiments/reflections from the last worker as DIALS files — used for the two-stage scale-then-merge workflow.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.do_timing&amp;lt;/code&amp;gt; || False || Log elapsed time per execution step.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.expanded_bookkeeping&amp;lt;/code&amp;gt; || False || Store extra provenance columns (input file/reflection indices, odd/even flag, original id) in the saved reflection tables.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Multiprocessing (&amp;lt;code&amp;gt;mp&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.method&amp;lt;/code&amp;gt; || mpi || Multiprocessing method (only &amp;lt;code&amp;gt;mpi&amp;lt;/code&amp;gt; is currently supported).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.debug.cProfile&amp;lt;/code&amp;gt; || False || Enable code profiling; a &amp;lt;code&amp;gt;.prof&amp;lt;/code&amp;gt; file is written per rank.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Output files ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; worker gathers all HKLs at rank 0 and writes three MTZ files, prefixed with&lt;br /&gt;
&amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; (default &amp;lt;code&amp;gt;iobs&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_all.mtz&amp;lt;/code&amp;gt; — the merged dataset using all observations (the main result for structure solution)&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_odd.mtz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_even.mtz&amp;lt;/code&amp;gt; — the two half-datasets used for CC½ and related half-dataset statistics&lt;br /&gt;
&lt;br /&gt;
A main log records the per-step progress and the merging statistics tables by resolution bin:&lt;br /&gt;
completeness, multiplicity and ⟨I/σ⟩, plus the &amp;quot;Table of Scaling Results&amp;quot; reporting CC½ (the&lt;br /&gt;
half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;&lt;br /&gt;
and R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.  The merged MTZ can optionally be&lt;br /&gt;
uploaded to a shared [https://github.com/cctbx/cctbx_project/tree/master/xfel/merging/application/publish Google Drive folder] by adding the &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; worker.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* Sauter NK (2015). &#039;&#039;J Synchrotron Radiat&#039;&#039; &#039;&#039;&#039;22&#039;&#039;&#039;, 239–48. (post-refinement)&lt;br /&gt;
* Uervirojnangkoorn M, &#039;&#039;et al.&#039;&#039; (2015). &#039;&#039;eLife&#039;&#039; 10.7554/eLife.05421. (PRIME / bootstrap)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2018). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;74&#039;&#039;&#039;, 877–894.&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019a). &#039;&#039;Computational Crystallography Newsletter&#039;&#039; &#039;&#039;&#039;10&#039;&#039;&#039;, 22–39. (XFEL GUI)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019b). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;75&#039;&#039;&#039;, 959–968. (error models)&lt;br /&gt;
* Mittan-Moreau (2025). (mm24 error model)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[dials.stills_process]] — produces the integrated data that &amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; consumes&lt;br /&gt;
* [[cctbx.xfel GUI]] — orchestrates separate scaling and repeated merging as data are collected&lt;br /&gt;
* The program README at &amp;lt;code&amp;gt;xfel/merging/README.md&amp;lt;/code&amp;gt; in cctbx_project&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1781</id>
		<title>Cctbx.xfel.merge</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1781"/>
		<updated>2026-08-21T23:22:00Z</updated>

		<summary type="html">&lt;p&gt;Aaron: /* Selecting individual reflections (select) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &#039;&#039;cctbx.xfel.merge&#039;&#039; =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;cctbx.xfel.merge&#039;&#039;&#039;&#039;&#039; is the scaling, post-refinement and merging program of cctbx.xfel. It takes&lt;br /&gt;
the per-image integrated results produced by &#039;&#039;[[dials.stills_process]]&#039;&#039; — one crystal per still shot —&lt;br /&gt;
and reduces the whole ensemble to a single set of merged structure-factor intensities (an MTZ file)&lt;br /&gt;
suitable for structure solution and refinement, together with the crystallographic quality&lt;br /&gt;
statistics (completeness, multiplicity, ⟨I/σ⟩, CC½, CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R-factors, etc.).&lt;br /&gt;
&lt;br /&gt;
Because serial datasets routinely contain tens of thousands to millions of still shots,&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is built from the ground up to run under MPI across many nodes. It is&lt;br /&gt;
almost always launched with &amp;lt;code&amp;gt;mpirun&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt;.  Note that MPI uses the term &#039;ranks&#039;&lt;br /&gt;
to distinguish independent processes that are running across one or more nodes.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is organized as a sequence of &#039;&#039;&#039;workers&#039;&#039;&#039;. Each worker performs one&lt;br /&gt;
task — reading data, applying a correction, filtering, scaling, post-refining, computing a statistic,&lt;br /&gt;
or merging — and passes its (possibly modified) experiments and reflections on to the next worker.&lt;br /&gt;
The list of workers to run is the &amp;quot;step list&amp;quot;, and it is fully configurable: you can add, remove or&lt;br /&gt;
reorder steps with &amp;lt;code&amp;gt;dispatch.step_list&amp;lt;/code&amp;gt;. This is what makes the program flexible enough to&lt;br /&gt;
scale-and-merge in one pass, to scale subsets separately and merge later, or to run a reference-free&lt;br /&gt;
bootstrap.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;default&#039;&#039;&#039; step list is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! # !! Worker !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| 1 || &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; || Read integrated experiments (&amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;) and reflections (&amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt;) from disk in DIALS format.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || &amp;lt;code&amp;gt;balance&amp;lt;/code&amp;gt; || Redistribute the input load evenly across MPI ranks (needed when there are fewer or more input files than ranks).&lt;br /&gt;
|-&lt;br /&gt;
| 3 || &amp;lt;code&amp;gt;model_scaling&amp;lt;/code&amp;gt; || Build the full Miller list, model intensities from the reference, and the resolution binner used for scaling and post-refinement.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || &amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt; || Apply per-reflection modifications, e.g. polarization correction (and optionally re-indexing to resolve indexing ambiguity — see &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;reindex_to_reference&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 5 || &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; || Reject whole experiments (or reflections) by resolution, unit cell, correlation to the reference, energy, etc.&lt;br /&gt;
|-&lt;br /&gt;
| 6 || &amp;lt;code&amp;gt;scale&amp;lt;/code&amp;gt; || Scale each lattice to the reference dataset (&amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;) or simply average (&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 7 || &amp;lt;code&amp;gt;postrefine&amp;lt;/code&amp;gt; || Post-refine per-image crystal parameters and partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| 8 || &amp;lt;code&amp;gt;statistics_unitcell&amp;lt;/code&amp;gt; || Determine and store the average unit cell.&lt;br /&gt;
|-&lt;br /&gt;
| 9 || &amp;lt;code&amp;gt;statistics_beam&amp;lt;/code&amp;gt; || Determine and store the average wavelength.&lt;br /&gt;
|-&lt;br /&gt;
| 10 || &amp;lt;code&amp;gt;model_statistics&amp;lt;/code&amp;gt; || Rebuild the Miller list / binner for statistics (may use the average unit cell).&lt;br /&gt;
|-&lt;br /&gt;
| 11 || &amp;lt;code&amp;gt;statistics_resolution&amp;lt;/code&amp;gt; || Per-crystal resolution statistics.&lt;br /&gt;
|-&lt;br /&gt;
| 12 || &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt; || Redistribute reflections across ranks so that every observation of a given HKL is gathered on the same rank prior to merging.&lt;br /&gt;
|-&lt;br /&gt;
| 13 || &amp;lt;code&amp;gt;errors_merge&amp;lt;/code&amp;gt; || Correct the merged error estimates with a per-HKL error model (e.g. Ev11, Brewster 2019b, or MM24 (the default), Mittan-Moreau (2025)).&lt;br /&gt;
|-&lt;br /&gt;
| 14 || &amp;lt;code&amp;gt;statistics_intensity&amp;lt;/code&amp;gt; || Intensity statistics by resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 15 || &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; || Merge symmetry-equivalent intensities, gather all HKLs at rank 0, and write &amp;quot;odd&amp;quot;, &amp;quot;even&amp;quot; and &amp;quot;all&amp;quot; MTZ files.&lt;br /&gt;
|-&lt;br /&gt;
| 16 || &amp;lt;code&amp;gt;statistics_intensity_cxi&amp;lt;/code&amp;gt; || Correlation and R-factor statistics (ported from cxi.merge): the &amp;quot;Table of Scaling Results&amp;quot; — CC½ (half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Additional, non-default workers are available and can be&lt;br /&gt;
inserted into the step list, including &amp;lt;code&amp;gt;tdata&amp;lt;/code&amp;gt; (write out unit cells for clustering),&lt;br /&gt;
&amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; (batch MTZ for &#039;&#039;Careless&#039;&#039;), &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; (upload merged files to a&lt;br /&gt;
Google Drive folder), &amp;lt;code&amp;gt;monitor&amp;lt;/code&amp;gt; (resource-usage logging), &amp;lt;code&amp;gt;integrate&amp;lt;/code&amp;gt;&lt;br /&gt;
(on-the-fly integration), &amp;lt;code&amp;gt;prepare&amp;lt;/code&amp;gt; (SpReAD energy binning), and&lt;br /&gt;
&amp;lt;code&amp;gt;lunus&amp;lt;/code&amp;gt; (diffuse-scattering deck). A &amp;lt;code&amp;gt;deltaccint&amp;lt;/code&amp;gt; worker (ΔCC½ lattice&lt;br /&gt;
filtering) can be added after &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;. Custom workers can be supplied through the&lt;br /&gt;
&amp;lt;code&amp;gt;XFEL_CUSTOM_WORKER_PATH&amp;lt;/code&amp;gt; environment variable.&lt;br /&gt;
&lt;br /&gt;
== Basic usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is run under MPI:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mpirun cctbx.xfel.merge merge.phil&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical &amp;lt;code&amp;gt;merge.phil&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input.path=&amp;lt;path to data&amp;gt;&lt;br /&gt;
input.experiments_suffix=.expt&lt;br /&gt;
input.reflections_suffix=.refl&lt;br /&gt;
&lt;br /&gt;
filter.algorithm=unit_cell&lt;br /&gt;
filter.unit_cell.value.relative_length_tolerance=0.03&lt;br /&gt;
filter.outlier.min_corr=0.1&lt;br /&gt;
&lt;br /&gt;
select.algorithm=significance_filter&lt;br /&gt;
select.significance_filter.sigma=0.1&lt;br /&gt;
select.significance_filter.min_ct=200&lt;br /&gt;
select.significance_filter.max_ct=300&lt;br /&gt;
&lt;br /&gt;
scaling.model=&amp;lt;model.pdb or model.mtz&amp;gt;&lt;br /&gt;
scaling.resolution_scalar=0.96&lt;br /&gt;
&lt;br /&gt;
merging.d_min=1.8&lt;br /&gt;
merging.error.model=mm24&lt;br /&gt;
merging.merge_anomalous=True&lt;br /&gt;
&lt;br /&gt;
postrefinement.enable=True&lt;br /&gt;
statistics.n_bins=20&lt;br /&gt;
&lt;br /&gt;
output.do_timing=True&lt;br /&gt;
output.output_dir=&amp;lt;output folder&amp;gt;&lt;br /&gt;
output.prefix=&amp;lt;prefix for output files&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explore the parameters with:&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c&amp;lt;/code&amp;gt; — show configurable parameters&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c -e 10 -a 2&amp;lt;/code&amp;gt; — show all parameters (expert level 10) with full help text&lt;br /&gt;
&lt;br /&gt;
== Two-stage scaling and merging ==&lt;br /&gt;
&lt;br /&gt;
For large, growing datasets (the mode used by the [[cctbx.xfel GUI]]), it is more efficient to scale&lt;br /&gt;
and post-refine each subset of data &#039;&#039;&#039;once&#039;&#039;&#039;, then merge repeatedly as more data arrive. This is&lt;br /&gt;
done by running the program twice with different step lists.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 1 — scale each subset&#039;&#039;&#039; (stops after per-image work and writes intermediate DIALS files):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input balance model_scaling modify filter scale postrefine \&lt;br /&gt;
    statistics_unitcell statistics_beam model_statistics statistics_resolution&lt;br /&gt;
output.save_experiments_and_reflections=True&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;output.save_experiments_and_reflections=True&amp;lt;/code&amp;gt; dumps the scaled/post-refined data as&lt;br /&gt;
experiment lists and reflection tables that the merge stage can read back in.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 2 — merge the scaled subsets&#039;&#039;&#039; (add an &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; for each finished subset):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input model_scaling statistics_unitcell statistics_beam \&lt;br /&gt;
    model_statistics statistics_resolution group errors_merge statistics_intensity \&lt;br /&gt;
    merge statistics_intensity_cxi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Merging without a reference (bootstrap / mark1) ==&lt;br /&gt;
&lt;br /&gt;
If no scaling/merging reference is available, use a bootstrap procedure. First run the&lt;br /&gt;
&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; algorithm, which simply averages the data (all per-image scale factors = 1, no&lt;br /&gt;
post-refinement), specifying the target cell and symmetry explicitly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
scaling.algorithm=mark1&lt;br /&gt;
scaling.unit_cell=&amp;lt;unit cell&amp;gt;&lt;br /&gt;
scaling.space_group=&amp;lt;space group&amp;gt;&lt;br /&gt;
merging.error.model=errors_from_sample_residuals&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting MTZ is then used as the reference (&amp;lt;code&amp;gt;scaling.model=&amp;lt;/code&amp;gt;) for subsequent regular&lt;br /&gt;
merges. Iterate a few cycles; CC½ typically improves and converges over the first few rounds.&lt;br /&gt;
&lt;br /&gt;
== Important parameters ==&lt;br /&gt;
&lt;br /&gt;
Parameters are given by their full PHIL path with defaults in parentheses. The program exposes many&lt;br /&gt;
more parameters (see &amp;lt;code&amp;gt;-c -e 10 -a 2&amp;lt;/code&amp;gt;); those below are the ones most commonly set.&lt;br /&gt;
&lt;br /&gt;
=== Input ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; || None || Path(s) to the integrated data — a folder, several folders, or individual files; wildcards allowed; may be repeated. Matching &amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt; files must both be present.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.experiments_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.expt&amp;lt;/code&amp;gt; || Only load experiment files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.reflections_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.refl&amp;lt;/code&amp;gt; || Only load reflection files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.parallel_file_load.method&amp;lt;/code&amp;gt; || uniform || &amp;lt;code&amp;gt;uniform&amp;lt;/code&amp;gt; spreads input files evenly over all ranks; &amp;lt;code&amp;gt;node_memory&amp;lt;/code&amp;gt; distributes so per-node memory limits are respected.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.alist.file&amp;lt;/code&amp;gt; || None || Path to a text file of experiment tags or filenames; combined with &amp;lt;code&amp;gt;input.alist.op=keep|reject&amp;lt;/code&amp;gt; to merge only (or exclude) a specified subset.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.persistent_refl_cols&amp;lt;/code&amp;gt; || None || Reflection-table columns to preserve through the pruning steps (and into saved tables).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Filtering whole experiments (&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;entire experiments&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;n_obs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resolution&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;unit_cell&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;energy&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bootstrap&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;experiment_prefix&amp;lt;/code&amp;gt;. Nothing is filtered unless listed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.algorithm&amp;lt;/code&amp;gt; || value || How to restrict unit cells: &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; (compare to a target), &amp;lt;code&amp;gt;range&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;cluster&amp;lt;/code&amp;gt; (use a precomputed covariance clustering).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.relative_length_tolerance&amp;lt;/code&amp;gt; || 0.1 || Fractional deviation of cell edge lengths allowed vs. the target cell. Often tightened (e.g. 0.03).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.absolute_angle_tolerance&amp;lt;/code&amp;gt; || 2.0 || Allowed cell-angle deviation (degrees) vs. the target.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.target_unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;target_space_group&amp;lt;/code&amp;gt; || Auto || Target cell/symmetry; &amp;lt;code&amp;gt;Auto&amp;lt;/code&amp;gt; uses the scaling model.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.outlier.min_corr&amp;lt;/code&amp;gt; || 0.1 || Minimum correlation of an image&#039;s intensities to the reference model; images below this are rejected. Only applied when a scaling model is present. Use &amp;lt;code&amp;gt;-1&amp;lt;/code&amp;gt; to accept all images regardless of correlation.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.resolution.d_min&amp;lt;/code&amp;gt; || None || Reject an experiment unless some of its reflections extend beyond this resolution.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Selecting individual reflections (&amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;individual reflections&#039;&#039;&#039; (contrast with&lt;br /&gt;
&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;, which acts on whole experiments).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;significance_filter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;panel&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cspad_sensor&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;isolation_forest&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;target_energy&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.sigma&amp;lt;/code&amp;gt; || 0.5 || Trim each lattice at the resolution where the binned ⟨I/σ⟩ drops below this value.  Often reduced to 0.1.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.min_ct&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;max_ct&amp;lt;/code&amp;gt; || 10 / 50 || Target minimum/maximum mean reflections per resolution bin when choosing the number of bins. For large unit cells these are often raised (e.g. 200/300); for small cells, use the defaults.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Modifying intensities (&amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.algorithm&amp;lt;/code&amp;gt; || polarization || Per-reflection corrections to apply (default applies the polarization correction).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt; || — || Resolve an indexing ambiguity across the ensemble using the Gildea/Winter (Brehm/Diederichs) cosym method, optionally anchored to &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.reindex_to_reference&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;reindex_to_abc&amp;lt;/code&amp;gt; || — || Alternative re-indexing operators (to a reference model, or an explicit operator).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Scaling (&amp;lt;code&amp;gt;scaling&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt; || None || Reference dataset: a PDB file (uses the CRYST1 cell and computes model intensities, including bulk solvent) or an MTZ from a previous cycle. Required for &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt; scaling.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.algorithm&amp;lt;/code&amp;gt; || mark0 || &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;: per-image scaling against the reference. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;: no scaling, just Monte-Carlo averaging (all scale factors = 1) — used for reference-free bootstrap.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;scaling.space_group&amp;lt;/code&amp;gt; || None || Cell/symmetry to use when no model is provided (i.e. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.resolution_scalar&amp;lt;/code&amp;gt; || 0.969 || &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; is multiplied by this when deciding which reflections fall within the resolution limit, generating a few extra reference reflections to account for per-shot cell variation (e.g. set 0.96 for a few more).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.mtz.mtz_column_F&amp;lt;/code&amp;gt; || fobs || Column name in the reference MTZ containing the reference structure factors (intensities or amplitudes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Post-refinement (&amp;lt;code&amp;gt;postrefinement&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.enable&amp;lt;/code&amp;gt; || True || Enable post-refinement of per-image parameters/partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.algorithm&amp;lt;/code&amp;gt; || rs || Post-refinement protocol: &amp;lt;code&amp;gt;rs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs_hybrid&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;eta_deff&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Merging and error model (&amp;lt;code&amp;gt;merging&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; || None || High-resolution limit for scaling and merging.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_max&amp;lt;/code&amp;gt; || None || Low-resolution limit (currently affects only CCiso).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.merge_anomalous&amp;lt;/code&amp;gt; || False || &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; merges Bijvoet mates together (higher multiplicity); &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt; keeps them separate to preserve the anomalous signal.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.minimum_multiplicity&amp;lt;/code&amp;gt; || 2 || Do not produce a merged structure factor for HKLs measured fewer than this many times.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.error.model&amp;lt;/code&amp;gt; || mm24 || Merged-sigma error model: &amp;lt;code&amp;gt;mm24&amp;lt;/code&amp;gt; (Mittan-Moreau 2025, current default), &amp;lt;code&amp;gt;ev11&amp;lt;/code&amp;gt; (Evans 2011 / sdfac-refine, recommended in the README), &amp;lt;code&amp;gt;ha14&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;errors_from_sample_residuals&amp;lt;/code&amp;gt; (no refined error terms — used with &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; bootstrap).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.set_average_unit_cell&amp;lt;/code&amp;gt; || True || Output MTZ adopts the (cluster-derived) average unit cell of the data rather than the reference model&#039;s cell.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Statistics (&amp;lt;code&amp;gt;statistics&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.n_bins&amp;lt;/code&amp;gt; || 10 || Number of resolution bins in the statistics tables.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.cciso.mtz_file&amp;lt;/code&amp;gt; || None || Isomorphous reference structure factors for R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt; / CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.report_ML&amp;lt;/code&amp;gt; || True || Report per-frame max-likelihood attributes (domain size, mosaicity).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Output (&amp;lt;code&amp;gt;output&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.output_dir&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; || Directory for output files (created if it does not exist).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; || iobs || Prefix prepended to all output file names.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.save_experiments_and_reflections&amp;lt;/code&amp;gt; || False || Dump the final experiments/reflections from the last worker as DIALS files — used for the two-stage scale-then-merge workflow.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.do_timing&amp;lt;/code&amp;gt; || False || Log elapsed time per execution step.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.expanded_bookkeeping&amp;lt;/code&amp;gt; || False || Store extra provenance columns (input file/reflection indices, odd/even flag, original id) in the saved reflection tables.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Multiprocessing (&amp;lt;code&amp;gt;mp&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.method&amp;lt;/code&amp;gt; || mpi || Multiprocessing method (only &amp;lt;code&amp;gt;mpi&amp;lt;/code&amp;gt; is currently supported).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.debug.cProfile&amp;lt;/code&amp;gt; || False || Enable code profiling; a &amp;lt;code&amp;gt;.prof&amp;lt;/code&amp;gt; file is written per rank.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Output files ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; worker gathers all HKLs at rank 0 and writes three MTZ files, prefixed with&lt;br /&gt;
&amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; (default &amp;lt;code&amp;gt;iobs&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_all.mtz&amp;lt;/code&amp;gt; — the merged dataset using all observations (the main result for structure solution)&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_odd.mtz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_even.mtz&amp;lt;/code&amp;gt; — the two half-datasets used for CC½ and related half-dataset statistics&lt;br /&gt;
&lt;br /&gt;
A main log records the per-step progress and the merging statistics tables by resolution bin:&lt;br /&gt;
completeness, multiplicity and ⟨I/σ⟩, plus the &amp;quot;Table of Scaling Results&amp;quot; reporting CC½ (the&lt;br /&gt;
half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;&lt;br /&gt;
and R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.  The merged MTZ can optionally be&lt;br /&gt;
uploaded to a shared [https://github.com/cctbx/cctbx_project/tree/master/xfel/merging/application/publish Google Drive folder] by adding the &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; worker.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* Sauter NK (2015). &#039;&#039;J Synchrotron Radiat&#039;&#039; &#039;&#039;&#039;22&#039;&#039;&#039;, 239–48. (post-refinement)&lt;br /&gt;
* Uervirojnangkoorn M, &#039;&#039;et al.&#039;&#039; (2015). &#039;&#039;eLife&#039;&#039; 10.7554/eLife.05421. (PRIME / bootstrap)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2018). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;74&#039;&#039;&#039;, 877–894.&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019a). &#039;&#039;Computational Crystallography Newsletter&#039;&#039; &#039;&#039;&#039;10&#039;&#039;&#039;, 22–39. (XFEL GUI)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019b). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;75&#039;&#039;&#039;, 959–968. (error models)&lt;br /&gt;
* Mittan-Moreau (2025). (mm24 error model)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[dials.stills_process]] — produces the integrated data that &amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; consumes&lt;br /&gt;
* [[cctbx.xfel GUI]] — orchestrates separate scaling and repeated merging as data are collected&lt;br /&gt;
* The program README at &amp;lt;code&amp;gt;xfel/merging/README.md&amp;lt;/code&amp;gt; in cctbx_project&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1780</id>
		<title>Cctbx.xfel.merge</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1780"/>
		<updated>2026-08-21T23:18:48Z</updated>

		<summary type="html">&lt;p&gt;Aaron: /* Two-stage scaling and merging */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &#039;&#039;cctbx.xfel.merge&#039;&#039; =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;cctbx.xfel.merge&#039;&#039;&#039;&#039;&#039; is the scaling, post-refinement and merging program of cctbx.xfel. It takes&lt;br /&gt;
the per-image integrated results produced by &#039;&#039;[[dials.stills_process]]&#039;&#039; — one crystal per still shot —&lt;br /&gt;
and reduces the whole ensemble to a single set of merged structure-factor intensities (an MTZ file)&lt;br /&gt;
suitable for structure solution and refinement, together with the crystallographic quality&lt;br /&gt;
statistics (completeness, multiplicity, ⟨I/σ⟩, CC½, CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R-factors, etc.).&lt;br /&gt;
&lt;br /&gt;
Because serial datasets routinely contain tens of thousands to millions of still shots,&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is built from the ground up to run under MPI across many nodes. It is&lt;br /&gt;
almost always launched with &amp;lt;code&amp;gt;mpirun&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt;.  Note that MPI uses the term &#039;ranks&#039;&lt;br /&gt;
to distinguish independent processes that are running across one or more nodes.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is organized as a sequence of &#039;&#039;&#039;workers&#039;&#039;&#039;. Each worker performs one&lt;br /&gt;
task — reading data, applying a correction, filtering, scaling, post-refining, computing a statistic,&lt;br /&gt;
or merging — and passes its (possibly modified) experiments and reflections on to the next worker.&lt;br /&gt;
The list of workers to run is the &amp;quot;step list&amp;quot;, and it is fully configurable: you can add, remove or&lt;br /&gt;
reorder steps with &amp;lt;code&amp;gt;dispatch.step_list&amp;lt;/code&amp;gt;. This is what makes the program flexible enough to&lt;br /&gt;
scale-and-merge in one pass, to scale subsets separately and merge later, or to run a reference-free&lt;br /&gt;
bootstrap.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;default&#039;&#039;&#039; step list is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! # !! Worker !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| 1 || &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; || Read integrated experiments (&amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;) and reflections (&amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt;) from disk in DIALS format.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || &amp;lt;code&amp;gt;balance&amp;lt;/code&amp;gt; || Redistribute the input load evenly across MPI ranks (needed when there are fewer or more input files than ranks).&lt;br /&gt;
|-&lt;br /&gt;
| 3 || &amp;lt;code&amp;gt;model_scaling&amp;lt;/code&amp;gt; || Build the full Miller list, model intensities from the reference, and the resolution binner used for scaling and post-refinement.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || &amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt; || Apply per-reflection modifications, e.g. polarization correction (and optionally re-indexing to resolve indexing ambiguity — see &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;reindex_to_reference&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 5 || &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; || Reject whole experiments (or reflections) by resolution, unit cell, correlation to the reference, energy, etc.&lt;br /&gt;
|-&lt;br /&gt;
| 6 || &amp;lt;code&amp;gt;scale&amp;lt;/code&amp;gt; || Scale each lattice to the reference dataset (&amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;) or simply average (&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 7 || &amp;lt;code&amp;gt;postrefine&amp;lt;/code&amp;gt; || Post-refine per-image crystal parameters and partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| 8 || &amp;lt;code&amp;gt;statistics_unitcell&amp;lt;/code&amp;gt; || Determine and store the average unit cell.&lt;br /&gt;
|-&lt;br /&gt;
| 9 || &amp;lt;code&amp;gt;statistics_beam&amp;lt;/code&amp;gt; || Determine and store the average wavelength.&lt;br /&gt;
|-&lt;br /&gt;
| 10 || &amp;lt;code&amp;gt;model_statistics&amp;lt;/code&amp;gt; || Rebuild the Miller list / binner for statistics (may use the average unit cell).&lt;br /&gt;
|-&lt;br /&gt;
| 11 || &amp;lt;code&amp;gt;statistics_resolution&amp;lt;/code&amp;gt; || Per-crystal resolution statistics.&lt;br /&gt;
|-&lt;br /&gt;
| 12 || &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt; || Redistribute reflections across ranks so that every observation of a given HKL is gathered on the same rank prior to merging.&lt;br /&gt;
|-&lt;br /&gt;
| 13 || &amp;lt;code&amp;gt;errors_merge&amp;lt;/code&amp;gt; || Correct the merged error estimates with a per-HKL error model (e.g. Ev11, Brewster 2019b, or MM24 (the default), Mittan-Moreau (2025)).&lt;br /&gt;
|-&lt;br /&gt;
| 14 || &amp;lt;code&amp;gt;statistics_intensity&amp;lt;/code&amp;gt; || Intensity statistics by resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 15 || &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; || Merge symmetry-equivalent intensities, gather all HKLs at rank 0, and write &amp;quot;odd&amp;quot;, &amp;quot;even&amp;quot; and &amp;quot;all&amp;quot; MTZ files.&lt;br /&gt;
|-&lt;br /&gt;
| 16 || &amp;lt;code&amp;gt;statistics_intensity_cxi&amp;lt;/code&amp;gt; || Correlation and R-factor statistics (ported from cxi.merge): the &amp;quot;Table of Scaling Results&amp;quot; — CC½ (half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Additional, non-default workers are available and can be&lt;br /&gt;
inserted into the step list, including &amp;lt;code&amp;gt;tdata&amp;lt;/code&amp;gt; (write out unit cells for clustering),&lt;br /&gt;
&amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; (batch MTZ for &#039;&#039;Careless&#039;&#039;), &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; (upload merged files to a&lt;br /&gt;
Google Drive folder), &amp;lt;code&amp;gt;monitor&amp;lt;/code&amp;gt; (resource-usage logging), &amp;lt;code&amp;gt;integrate&amp;lt;/code&amp;gt;&lt;br /&gt;
(on-the-fly integration), &amp;lt;code&amp;gt;prepare&amp;lt;/code&amp;gt; (SpReAD energy binning), and&lt;br /&gt;
&amp;lt;code&amp;gt;lunus&amp;lt;/code&amp;gt; (diffuse-scattering deck). A &amp;lt;code&amp;gt;deltaccint&amp;lt;/code&amp;gt; worker (ΔCC½ lattice&lt;br /&gt;
filtering) can be added after &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;. Custom workers can be supplied through the&lt;br /&gt;
&amp;lt;code&amp;gt;XFEL_CUSTOM_WORKER_PATH&amp;lt;/code&amp;gt; environment variable.&lt;br /&gt;
&lt;br /&gt;
== Basic usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is run under MPI:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mpirun cctbx.xfel.merge merge.phil&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical &amp;lt;code&amp;gt;merge.phil&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input.path=&amp;lt;path to data&amp;gt;&lt;br /&gt;
input.experiments_suffix=.expt&lt;br /&gt;
input.reflections_suffix=.refl&lt;br /&gt;
&lt;br /&gt;
filter.algorithm=unit_cell&lt;br /&gt;
filter.unit_cell.value.relative_length_tolerance=0.03&lt;br /&gt;
filter.outlier.min_corr=0.1&lt;br /&gt;
&lt;br /&gt;
select.algorithm=significance_filter&lt;br /&gt;
select.significance_filter.sigma=0.1&lt;br /&gt;
select.significance_filter.min_ct=200&lt;br /&gt;
select.significance_filter.max_ct=300&lt;br /&gt;
&lt;br /&gt;
scaling.model=&amp;lt;model.pdb or model.mtz&amp;gt;&lt;br /&gt;
scaling.resolution_scalar=0.96&lt;br /&gt;
&lt;br /&gt;
merging.d_min=1.8&lt;br /&gt;
merging.error.model=mm24&lt;br /&gt;
merging.merge_anomalous=True&lt;br /&gt;
&lt;br /&gt;
postrefinement.enable=True&lt;br /&gt;
statistics.n_bins=20&lt;br /&gt;
&lt;br /&gt;
output.do_timing=True&lt;br /&gt;
output.output_dir=&amp;lt;output folder&amp;gt;&lt;br /&gt;
output.prefix=&amp;lt;prefix for output files&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explore the parameters with:&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c&amp;lt;/code&amp;gt; — show configurable parameters&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c -e 10 -a 2&amp;lt;/code&amp;gt; — show all parameters (expert level 10) with full help text&lt;br /&gt;
&lt;br /&gt;
== Two-stage scaling and merging ==&lt;br /&gt;
&lt;br /&gt;
For large, growing datasets (the mode used by the [[cctbx.xfel GUI]]), it is more efficient to scale&lt;br /&gt;
and post-refine each subset of data &#039;&#039;&#039;once&#039;&#039;&#039;, then merge repeatedly as more data arrive. This is&lt;br /&gt;
done by running the program twice with different step lists.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 1 — scale each subset&#039;&#039;&#039; (stops after per-image work and writes intermediate DIALS files):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input balance model_scaling modify filter scale postrefine \&lt;br /&gt;
    statistics_unitcell statistics_beam model_statistics statistics_resolution&lt;br /&gt;
output.save_experiments_and_reflections=True&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;output.save_experiments_and_reflections=True&amp;lt;/code&amp;gt; dumps the scaled/post-refined data as&lt;br /&gt;
experiment lists and reflection tables that the merge stage can read back in.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 2 — merge the scaled subsets&#039;&#039;&#039; (add an &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; for each finished subset):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input model_scaling statistics_unitcell statistics_beam \&lt;br /&gt;
    model_statistics statistics_resolution group errors_merge statistics_intensity \&lt;br /&gt;
    merge statistics_intensity_cxi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Merging without a reference (bootstrap / mark1) ==&lt;br /&gt;
&lt;br /&gt;
If no scaling/merging reference is available, use a bootstrap procedure. First run the&lt;br /&gt;
&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; algorithm, which simply averages the data (all per-image scale factors = 1, no&lt;br /&gt;
post-refinement), specifying the target cell and symmetry explicitly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
scaling.algorithm=mark1&lt;br /&gt;
scaling.unit_cell=&amp;lt;unit cell&amp;gt;&lt;br /&gt;
scaling.space_group=&amp;lt;space group&amp;gt;&lt;br /&gt;
merging.error.model=errors_from_sample_residuals&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting MTZ is then used as the reference (&amp;lt;code&amp;gt;scaling.model=&amp;lt;/code&amp;gt;) for subsequent regular&lt;br /&gt;
merges. Iterate a few cycles; CC½ typically improves and converges over the first few rounds.&lt;br /&gt;
&lt;br /&gt;
== Important parameters ==&lt;br /&gt;
&lt;br /&gt;
Parameters are given by their full PHIL path with defaults in parentheses. The program exposes many&lt;br /&gt;
more parameters (see &amp;lt;code&amp;gt;-c -e 10 -a 2&amp;lt;/code&amp;gt;); those below are the ones most commonly set.&lt;br /&gt;
&lt;br /&gt;
=== Input ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; || None || Path(s) to the integrated data — a folder, several folders, or individual files; wildcards allowed; may be repeated. Matching &amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt; files must both be present.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.experiments_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.expt&amp;lt;/code&amp;gt; || Only load experiment files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.reflections_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.refl&amp;lt;/code&amp;gt; || Only load reflection files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.parallel_file_load.method&amp;lt;/code&amp;gt; || uniform || &amp;lt;code&amp;gt;uniform&amp;lt;/code&amp;gt; spreads input files evenly over all ranks; &amp;lt;code&amp;gt;node_memory&amp;lt;/code&amp;gt; distributes so per-node memory limits are respected.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.alist.file&amp;lt;/code&amp;gt; || None || Path to a text file of experiment tags or filenames; combined with &amp;lt;code&amp;gt;input.alist.op=keep|reject&amp;lt;/code&amp;gt; to merge only (or exclude) a specified subset.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.persistent_refl_cols&amp;lt;/code&amp;gt; || None || Reflection-table columns to preserve through the pruning steps (and into saved tables).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Filtering whole experiments (&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;entire experiments&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;n_obs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resolution&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;unit_cell&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;energy&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bootstrap&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;experiment_prefix&amp;lt;/code&amp;gt;. Nothing is filtered unless listed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.algorithm&amp;lt;/code&amp;gt; || value || How to restrict unit cells: &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; (compare to a target), &amp;lt;code&amp;gt;range&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;cluster&amp;lt;/code&amp;gt; (use a precomputed covariance clustering).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.relative_length_tolerance&amp;lt;/code&amp;gt; || 0.1 || Fractional deviation of cell edge lengths allowed vs. the target cell. Often tightened (e.g. 0.03).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.absolute_angle_tolerance&amp;lt;/code&amp;gt; || 2.0 || Allowed cell-angle deviation (degrees) vs. the target.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.target_unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;target_space_group&amp;lt;/code&amp;gt; || Auto || Target cell/symmetry; &amp;lt;code&amp;gt;Auto&amp;lt;/code&amp;gt; uses the scaling model.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.outlier.min_corr&amp;lt;/code&amp;gt; || 0.1 || Minimum correlation of an image&#039;s intensities to the reference model; images below this are rejected. Only applied when a scaling model is present. Use &amp;lt;code&amp;gt;-1&amp;lt;/code&amp;gt; to accept all images regardless of correlation.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.resolution.d_min&amp;lt;/code&amp;gt; || None || Reject an experiment unless some of its reflections extend beyond this resolution.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Selecting individual reflections (&amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;individual reflections&#039;&#039;&#039; (contrast with&lt;br /&gt;
&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;, which acts on whole experiments).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;significance_filter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;panel&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cspad_sensor&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;isolation_forest&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;target_energy&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.sigma&amp;lt;/code&amp;gt; || 0.5 || Trim each lattice at the resolution where the binned ⟨I/σ⟩ drops below this value.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.min_ct&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;max_ct&amp;lt;/code&amp;gt; || 10 / 50 || Target minimum/maximum mean reflections per resolution bin when choosing the number of bins. For large unit cells these are often raised (e.g. 200/300); for small cells, use the defaults.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Modifying intensities (&amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.algorithm&amp;lt;/code&amp;gt; || polarization || Per-reflection corrections to apply (default applies the polarization correction).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt; || — || Resolve an indexing ambiguity across the ensemble using the Gildea/Winter (Brehm/Diederichs) cosym method, optionally anchored to &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.reindex_to_reference&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;reindex_to_abc&amp;lt;/code&amp;gt; || — || Alternative re-indexing operators (to a reference model, or an explicit operator).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Scaling (&amp;lt;code&amp;gt;scaling&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt; || None || Reference dataset: a PDB file (uses the CRYST1 cell and computes model intensities, including bulk solvent) or an MTZ from a previous cycle. Required for &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt; scaling.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.algorithm&amp;lt;/code&amp;gt; || mark0 || &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;: per-image scaling against the reference. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;: no scaling, just Monte-Carlo averaging (all scale factors = 1) — used for reference-free bootstrap.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;scaling.space_group&amp;lt;/code&amp;gt; || None || Cell/symmetry to use when no model is provided (i.e. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.resolution_scalar&amp;lt;/code&amp;gt; || 0.969 || &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; is multiplied by this when deciding which reflections fall within the resolution limit, generating a few extra reference reflections to account for per-shot cell variation (e.g. set 0.96 for a few more).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.mtz.mtz_column_F&amp;lt;/code&amp;gt; || fobs || Column name in the reference MTZ containing the reference structure factors (intensities or amplitudes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Post-refinement (&amp;lt;code&amp;gt;postrefinement&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.enable&amp;lt;/code&amp;gt; || True || Enable post-refinement of per-image parameters/partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.algorithm&amp;lt;/code&amp;gt; || rs || Post-refinement protocol: &amp;lt;code&amp;gt;rs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs_hybrid&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;eta_deff&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Merging and error model (&amp;lt;code&amp;gt;merging&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; || None || High-resolution limit for scaling and merging.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_max&amp;lt;/code&amp;gt; || None || Low-resolution limit (currently affects only CCiso).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.merge_anomalous&amp;lt;/code&amp;gt; || False || &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; merges Bijvoet mates together (higher multiplicity); &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt; keeps them separate to preserve the anomalous signal.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.minimum_multiplicity&amp;lt;/code&amp;gt; || 2 || Do not produce a merged structure factor for HKLs measured fewer than this many times.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.error.model&amp;lt;/code&amp;gt; || mm24 || Merged-sigma error model: &amp;lt;code&amp;gt;mm24&amp;lt;/code&amp;gt; (Mittan-Moreau 2025, current default), &amp;lt;code&amp;gt;ev11&amp;lt;/code&amp;gt; (Evans 2011 / sdfac-refine, recommended in the README), &amp;lt;code&amp;gt;ha14&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;errors_from_sample_residuals&amp;lt;/code&amp;gt; (no refined error terms — used with &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; bootstrap).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.set_average_unit_cell&amp;lt;/code&amp;gt; || True || Output MTZ adopts the (cluster-derived) average unit cell of the data rather than the reference model&#039;s cell.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Statistics (&amp;lt;code&amp;gt;statistics&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.n_bins&amp;lt;/code&amp;gt; || 10 || Number of resolution bins in the statistics tables.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.cciso.mtz_file&amp;lt;/code&amp;gt; || None || Isomorphous reference structure factors for R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt; / CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.report_ML&amp;lt;/code&amp;gt; || True || Report per-frame max-likelihood attributes (domain size, mosaicity).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Output (&amp;lt;code&amp;gt;output&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.output_dir&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; || Directory for output files (created if it does not exist).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; || iobs || Prefix prepended to all output file names.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.save_experiments_and_reflections&amp;lt;/code&amp;gt; || False || Dump the final experiments/reflections from the last worker as DIALS files — used for the two-stage scale-then-merge workflow.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.do_timing&amp;lt;/code&amp;gt; || False || Log elapsed time per execution step.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.expanded_bookkeeping&amp;lt;/code&amp;gt; || False || Store extra provenance columns (input file/reflection indices, odd/even flag, original id) in the saved reflection tables.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Multiprocessing (&amp;lt;code&amp;gt;mp&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.method&amp;lt;/code&amp;gt; || mpi || Multiprocessing method (only &amp;lt;code&amp;gt;mpi&amp;lt;/code&amp;gt; is currently supported).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.debug.cProfile&amp;lt;/code&amp;gt; || False || Enable code profiling; a &amp;lt;code&amp;gt;.prof&amp;lt;/code&amp;gt; file is written per rank.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Output files ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; worker gathers all HKLs at rank 0 and writes three MTZ files, prefixed with&lt;br /&gt;
&amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; (default &amp;lt;code&amp;gt;iobs&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_all.mtz&amp;lt;/code&amp;gt; — the merged dataset using all observations (the main result for structure solution)&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_odd.mtz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_even.mtz&amp;lt;/code&amp;gt; — the two half-datasets used for CC½ and related half-dataset statistics&lt;br /&gt;
&lt;br /&gt;
A main log records the per-step progress and the merging statistics tables by resolution bin:&lt;br /&gt;
completeness, multiplicity and ⟨I/σ⟩, plus the &amp;quot;Table of Scaling Results&amp;quot; reporting CC½ (the&lt;br /&gt;
half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;&lt;br /&gt;
and R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.  The merged MTZ can optionally be&lt;br /&gt;
uploaded to a shared [https://github.com/cctbx/cctbx_project/tree/master/xfel/merging/application/publish Google Drive folder] by adding the &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; worker.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* Sauter NK (2015). &#039;&#039;J Synchrotron Radiat&#039;&#039; &#039;&#039;&#039;22&#039;&#039;&#039;, 239–48. (post-refinement)&lt;br /&gt;
* Uervirojnangkoorn M, &#039;&#039;et al.&#039;&#039; (2015). &#039;&#039;eLife&#039;&#039; 10.7554/eLife.05421. (PRIME / bootstrap)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2018). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;74&#039;&#039;&#039;, 877–894.&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019a). &#039;&#039;Computational Crystallography Newsletter&#039;&#039; &#039;&#039;&#039;10&#039;&#039;&#039;, 22–39. (XFEL GUI)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019b). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;75&#039;&#039;&#039;, 959–968. (error models)&lt;br /&gt;
* Mittan-Moreau (2025). (mm24 error model)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[dials.stills_process]] — produces the integrated data that &amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; consumes&lt;br /&gt;
* [[cctbx.xfel GUI]] — orchestrates separate scaling and repeated merging as data are collected&lt;br /&gt;
* The program README at &amp;lt;code&amp;gt;xfel/merging/README.md&amp;lt;/code&amp;gt; in cctbx_project&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1779</id>
		<title>Cctbx.xfel.merge</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1779"/>
		<updated>2026-08-21T23:17:17Z</updated>

		<summary type="html">&lt;p&gt;Aaron: /* Basic usage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &#039;&#039;cctbx.xfel.merge&#039;&#039; =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;cctbx.xfel.merge&#039;&#039;&#039;&#039;&#039; is the scaling, post-refinement and merging program of cctbx.xfel. It takes&lt;br /&gt;
the per-image integrated results produced by &#039;&#039;[[dials.stills_process]]&#039;&#039; — one crystal per still shot —&lt;br /&gt;
and reduces the whole ensemble to a single set of merged structure-factor intensities (an MTZ file)&lt;br /&gt;
suitable for structure solution and refinement, together with the crystallographic quality&lt;br /&gt;
statistics (completeness, multiplicity, ⟨I/σ⟩, CC½, CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R-factors, etc.).&lt;br /&gt;
&lt;br /&gt;
Because serial datasets routinely contain tens of thousands to millions of still shots,&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is built from the ground up to run under MPI across many nodes. It is&lt;br /&gt;
almost always launched with &amp;lt;code&amp;gt;mpirun&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt;.  Note that MPI uses the term &#039;ranks&#039;&lt;br /&gt;
to distinguish independent processes that are running across one or more nodes.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is organized as a sequence of &#039;&#039;&#039;workers&#039;&#039;&#039;. Each worker performs one&lt;br /&gt;
task — reading data, applying a correction, filtering, scaling, post-refining, computing a statistic,&lt;br /&gt;
or merging — and passes its (possibly modified) experiments and reflections on to the next worker.&lt;br /&gt;
The list of workers to run is the &amp;quot;step list&amp;quot;, and it is fully configurable: you can add, remove or&lt;br /&gt;
reorder steps with &amp;lt;code&amp;gt;dispatch.step_list&amp;lt;/code&amp;gt;. This is what makes the program flexible enough to&lt;br /&gt;
scale-and-merge in one pass, to scale subsets separately and merge later, or to run a reference-free&lt;br /&gt;
bootstrap.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;default&#039;&#039;&#039; step list is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! # !! Worker !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| 1 || &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; || Read integrated experiments (&amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;) and reflections (&amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt;) from disk in DIALS format.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || &amp;lt;code&amp;gt;balance&amp;lt;/code&amp;gt; || Redistribute the input load evenly across MPI ranks (needed when there are fewer or more input files than ranks).&lt;br /&gt;
|-&lt;br /&gt;
| 3 || &amp;lt;code&amp;gt;model_scaling&amp;lt;/code&amp;gt; || Build the full Miller list, model intensities from the reference, and the resolution binner used for scaling and post-refinement.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || &amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt; || Apply per-reflection modifications, e.g. polarization correction (and optionally re-indexing to resolve indexing ambiguity — see &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;reindex_to_reference&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 5 || &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; || Reject whole experiments (or reflections) by resolution, unit cell, correlation to the reference, energy, etc.&lt;br /&gt;
|-&lt;br /&gt;
| 6 || &amp;lt;code&amp;gt;scale&amp;lt;/code&amp;gt; || Scale each lattice to the reference dataset (&amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;) or simply average (&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 7 || &amp;lt;code&amp;gt;postrefine&amp;lt;/code&amp;gt; || Post-refine per-image crystal parameters and partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| 8 || &amp;lt;code&amp;gt;statistics_unitcell&amp;lt;/code&amp;gt; || Determine and store the average unit cell.&lt;br /&gt;
|-&lt;br /&gt;
| 9 || &amp;lt;code&amp;gt;statistics_beam&amp;lt;/code&amp;gt; || Determine and store the average wavelength.&lt;br /&gt;
|-&lt;br /&gt;
| 10 || &amp;lt;code&amp;gt;model_statistics&amp;lt;/code&amp;gt; || Rebuild the Miller list / binner for statistics (may use the average unit cell).&lt;br /&gt;
|-&lt;br /&gt;
| 11 || &amp;lt;code&amp;gt;statistics_resolution&amp;lt;/code&amp;gt; || Per-crystal resolution statistics.&lt;br /&gt;
|-&lt;br /&gt;
| 12 || &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt; || Redistribute reflections across ranks so that every observation of a given HKL is gathered on the same rank prior to merging.&lt;br /&gt;
|-&lt;br /&gt;
| 13 || &amp;lt;code&amp;gt;errors_merge&amp;lt;/code&amp;gt; || Correct the merged error estimates with a per-HKL error model (e.g. Ev11, Brewster 2019b, or MM24 (the default), Mittan-Moreau (2025)).&lt;br /&gt;
|-&lt;br /&gt;
| 14 || &amp;lt;code&amp;gt;statistics_intensity&amp;lt;/code&amp;gt; || Intensity statistics by resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 15 || &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; || Merge symmetry-equivalent intensities, gather all HKLs at rank 0, and write &amp;quot;odd&amp;quot;, &amp;quot;even&amp;quot; and &amp;quot;all&amp;quot; MTZ files.&lt;br /&gt;
|-&lt;br /&gt;
| 16 || &amp;lt;code&amp;gt;statistics_intensity_cxi&amp;lt;/code&amp;gt; || Correlation and R-factor statistics (ported from cxi.merge): the &amp;quot;Table of Scaling Results&amp;quot; — CC½ (half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Additional, non-default workers are available and can be&lt;br /&gt;
inserted into the step list, including &amp;lt;code&amp;gt;tdata&amp;lt;/code&amp;gt; (write out unit cells for clustering),&lt;br /&gt;
&amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; (batch MTZ for &#039;&#039;Careless&#039;&#039;), &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; (upload merged files to a&lt;br /&gt;
Google Drive folder), &amp;lt;code&amp;gt;monitor&amp;lt;/code&amp;gt; (resource-usage logging), &amp;lt;code&amp;gt;integrate&amp;lt;/code&amp;gt;&lt;br /&gt;
(on-the-fly integration), &amp;lt;code&amp;gt;prepare&amp;lt;/code&amp;gt; (SpReAD energy binning), and&lt;br /&gt;
&amp;lt;code&amp;gt;lunus&amp;lt;/code&amp;gt; (diffuse-scattering deck). A &amp;lt;code&amp;gt;deltaccint&amp;lt;/code&amp;gt; worker (ΔCC½ lattice&lt;br /&gt;
filtering) can be added after &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;. Custom workers can be supplied through the&lt;br /&gt;
&amp;lt;code&amp;gt;XFEL_CUSTOM_WORKER_PATH&amp;lt;/code&amp;gt; environment variable.&lt;br /&gt;
&lt;br /&gt;
== Basic usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is run under MPI:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mpirun cctbx.xfel.merge merge.phil&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical &amp;lt;code&amp;gt;merge.phil&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input.path=&amp;lt;path to data&amp;gt;&lt;br /&gt;
input.experiments_suffix=.expt&lt;br /&gt;
input.reflections_suffix=.refl&lt;br /&gt;
&lt;br /&gt;
filter.algorithm=unit_cell&lt;br /&gt;
filter.unit_cell.value.relative_length_tolerance=0.03&lt;br /&gt;
filter.outlier.min_corr=0.1&lt;br /&gt;
&lt;br /&gt;
select.algorithm=significance_filter&lt;br /&gt;
select.significance_filter.sigma=0.1&lt;br /&gt;
select.significance_filter.min_ct=200&lt;br /&gt;
select.significance_filter.max_ct=300&lt;br /&gt;
&lt;br /&gt;
scaling.model=&amp;lt;model.pdb or model.mtz&amp;gt;&lt;br /&gt;
scaling.resolution_scalar=0.96&lt;br /&gt;
&lt;br /&gt;
merging.d_min=1.8&lt;br /&gt;
merging.error.model=mm24&lt;br /&gt;
merging.merge_anomalous=True&lt;br /&gt;
&lt;br /&gt;
postrefinement.enable=True&lt;br /&gt;
statistics.n_bins=20&lt;br /&gt;
&lt;br /&gt;
output.do_timing=True&lt;br /&gt;
output.output_dir=&amp;lt;output folder&amp;gt;&lt;br /&gt;
output.prefix=&amp;lt;prefix for output files&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explore the parameters with:&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c&amp;lt;/code&amp;gt; — show configurable parameters&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c -e 10 -a 2&amp;lt;/code&amp;gt; — show all parameters (expert level 10) with full help text&lt;br /&gt;
&lt;br /&gt;
== Two-stage scaling and merging ==&lt;br /&gt;
&lt;br /&gt;
For large, growing datasets (the mode used by the [[cctbx.xfel GUI]]), it is more efficient to scale&lt;br /&gt;
and post-refine each subset of data &#039;&#039;&#039;once&#039;&#039;&#039;, then merge repeatedly as more data arrive. This is&lt;br /&gt;
done by running the program twice with different step lists.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 1 — scale each subset&#039;&#039;&#039; (stops after per-image work and writes intermediate DIALS files):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input balance model_scaling modify filter scale postrefine \&lt;br /&gt;
    statistics_unitcell statistics_beam model_statistics statistics_resolution&lt;br /&gt;
input.parallel_file_load.method=uniform&lt;br /&gt;
output.save_experiments_and_reflections=True&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;output.save_experiments_and_reflections=True&amp;lt;/code&amp;gt; dumps the scaled/post-refined data as&lt;br /&gt;
experiment lists and reflection tables that the merge stage can read back in.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 2 — merge the scaled subsets&#039;&#039;&#039; (add an &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; for each finished subset):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input model_scaling statistics_unitcell statistics_beam \&lt;br /&gt;
    model_statistics statistics_resolution group errors_merge statistics_intensity \&lt;br /&gt;
    merge statistics_intensity_cxi&lt;br /&gt;
input.parallel_file_load.method=uniform&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Merging without a reference (bootstrap / mark1) ==&lt;br /&gt;
&lt;br /&gt;
If no scaling/merging reference is available, use a bootstrap procedure. First run the&lt;br /&gt;
&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; algorithm, which simply averages the data (all per-image scale factors = 1, no&lt;br /&gt;
post-refinement), specifying the target cell and symmetry explicitly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
scaling.algorithm=mark1&lt;br /&gt;
scaling.unit_cell=&amp;lt;unit cell&amp;gt;&lt;br /&gt;
scaling.space_group=&amp;lt;space group&amp;gt;&lt;br /&gt;
merging.error.model=errors_from_sample_residuals&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting MTZ is then used as the reference (&amp;lt;code&amp;gt;scaling.model=&amp;lt;/code&amp;gt;) for subsequent regular&lt;br /&gt;
merges. Iterate a few cycles; CC½ typically improves and converges over the first few rounds.&lt;br /&gt;
&lt;br /&gt;
== Important parameters ==&lt;br /&gt;
&lt;br /&gt;
Parameters are given by their full PHIL path with defaults in parentheses. The program exposes many&lt;br /&gt;
more parameters (see &amp;lt;code&amp;gt;-c -e 10 -a 2&amp;lt;/code&amp;gt;); those below are the ones most commonly set.&lt;br /&gt;
&lt;br /&gt;
=== Input ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; || None || Path(s) to the integrated data — a folder, several folders, or individual files; wildcards allowed; may be repeated. Matching &amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt; files must both be present.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.experiments_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.expt&amp;lt;/code&amp;gt; || Only load experiment files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.reflections_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.refl&amp;lt;/code&amp;gt; || Only load reflection files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.parallel_file_load.method&amp;lt;/code&amp;gt; || uniform || &amp;lt;code&amp;gt;uniform&amp;lt;/code&amp;gt; spreads input files evenly over all ranks; &amp;lt;code&amp;gt;node_memory&amp;lt;/code&amp;gt; distributes so per-node memory limits are respected.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.alist.file&amp;lt;/code&amp;gt; || None || Path to a text file of experiment tags or filenames; combined with &amp;lt;code&amp;gt;input.alist.op=keep|reject&amp;lt;/code&amp;gt; to merge only (or exclude) a specified subset.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.persistent_refl_cols&amp;lt;/code&amp;gt; || None || Reflection-table columns to preserve through the pruning steps (and into saved tables).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Filtering whole experiments (&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;entire experiments&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;n_obs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resolution&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;unit_cell&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;energy&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bootstrap&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;experiment_prefix&amp;lt;/code&amp;gt;. Nothing is filtered unless listed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.algorithm&amp;lt;/code&amp;gt; || value || How to restrict unit cells: &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; (compare to a target), &amp;lt;code&amp;gt;range&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;cluster&amp;lt;/code&amp;gt; (use a precomputed covariance clustering).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.relative_length_tolerance&amp;lt;/code&amp;gt; || 0.1 || Fractional deviation of cell edge lengths allowed vs. the target cell. Often tightened (e.g. 0.03).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.absolute_angle_tolerance&amp;lt;/code&amp;gt; || 2.0 || Allowed cell-angle deviation (degrees) vs. the target.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.target_unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;target_space_group&amp;lt;/code&amp;gt; || Auto || Target cell/symmetry; &amp;lt;code&amp;gt;Auto&amp;lt;/code&amp;gt; uses the scaling model.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.outlier.min_corr&amp;lt;/code&amp;gt; || 0.1 || Minimum correlation of an image&#039;s intensities to the reference model; images below this are rejected. Only applied when a scaling model is present. Use &amp;lt;code&amp;gt;-1&amp;lt;/code&amp;gt; to accept all images regardless of correlation.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.resolution.d_min&amp;lt;/code&amp;gt; || None || Reject an experiment unless some of its reflections extend beyond this resolution.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Selecting individual reflections (&amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;individual reflections&#039;&#039;&#039; (contrast with&lt;br /&gt;
&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;, which acts on whole experiments).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;significance_filter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;panel&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cspad_sensor&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;isolation_forest&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;target_energy&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.sigma&amp;lt;/code&amp;gt; || 0.5 || Trim each lattice at the resolution where the binned ⟨I/σ⟩ drops below this value.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.min_ct&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;max_ct&amp;lt;/code&amp;gt; || 10 / 50 || Target minimum/maximum mean reflections per resolution bin when choosing the number of bins. For large unit cells these are often raised (e.g. 200/300); for small cells, use the defaults.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Modifying intensities (&amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.algorithm&amp;lt;/code&amp;gt; || polarization || Per-reflection corrections to apply (default applies the polarization correction).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt; || — || Resolve an indexing ambiguity across the ensemble using the Gildea/Winter (Brehm/Diederichs) cosym method, optionally anchored to &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.reindex_to_reference&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;reindex_to_abc&amp;lt;/code&amp;gt; || — || Alternative re-indexing operators (to a reference model, or an explicit operator).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Scaling (&amp;lt;code&amp;gt;scaling&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt; || None || Reference dataset: a PDB file (uses the CRYST1 cell and computes model intensities, including bulk solvent) or an MTZ from a previous cycle. Required for &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt; scaling.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.algorithm&amp;lt;/code&amp;gt; || mark0 || &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;: per-image scaling against the reference. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;: no scaling, just Monte-Carlo averaging (all scale factors = 1) — used for reference-free bootstrap.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;scaling.space_group&amp;lt;/code&amp;gt; || None || Cell/symmetry to use when no model is provided (i.e. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.resolution_scalar&amp;lt;/code&amp;gt; || 0.969 || &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; is multiplied by this when deciding which reflections fall within the resolution limit, generating a few extra reference reflections to account for per-shot cell variation (e.g. set 0.96 for a few more).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.mtz.mtz_column_F&amp;lt;/code&amp;gt; || fobs || Column name in the reference MTZ containing the reference structure factors (intensities or amplitudes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Post-refinement (&amp;lt;code&amp;gt;postrefinement&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.enable&amp;lt;/code&amp;gt; || True || Enable post-refinement of per-image parameters/partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.algorithm&amp;lt;/code&amp;gt; || rs || Post-refinement protocol: &amp;lt;code&amp;gt;rs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs_hybrid&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;eta_deff&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Merging and error model (&amp;lt;code&amp;gt;merging&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; || None || High-resolution limit for scaling and merging.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_max&amp;lt;/code&amp;gt; || None || Low-resolution limit (currently affects only CCiso).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.merge_anomalous&amp;lt;/code&amp;gt; || False || &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; merges Bijvoet mates together (higher multiplicity); &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt; keeps them separate to preserve the anomalous signal.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.minimum_multiplicity&amp;lt;/code&amp;gt; || 2 || Do not produce a merged structure factor for HKLs measured fewer than this many times.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.error.model&amp;lt;/code&amp;gt; || mm24 || Merged-sigma error model: &amp;lt;code&amp;gt;mm24&amp;lt;/code&amp;gt; (Mittan-Moreau 2025, current default), &amp;lt;code&amp;gt;ev11&amp;lt;/code&amp;gt; (Evans 2011 / sdfac-refine, recommended in the README), &amp;lt;code&amp;gt;ha14&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;errors_from_sample_residuals&amp;lt;/code&amp;gt; (no refined error terms — used with &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; bootstrap).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.set_average_unit_cell&amp;lt;/code&amp;gt; || True || Output MTZ adopts the (cluster-derived) average unit cell of the data rather than the reference model&#039;s cell.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Statistics (&amp;lt;code&amp;gt;statistics&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.n_bins&amp;lt;/code&amp;gt; || 10 || Number of resolution bins in the statistics tables.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.cciso.mtz_file&amp;lt;/code&amp;gt; || None || Isomorphous reference structure factors for R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt; / CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.report_ML&amp;lt;/code&amp;gt; || True || Report per-frame max-likelihood attributes (domain size, mosaicity).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Output (&amp;lt;code&amp;gt;output&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.output_dir&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; || Directory for output files (created if it does not exist).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; || iobs || Prefix prepended to all output file names.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.save_experiments_and_reflections&amp;lt;/code&amp;gt; || False || Dump the final experiments/reflections from the last worker as DIALS files — used for the two-stage scale-then-merge workflow.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.do_timing&amp;lt;/code&amp;gt; || False || Log elapsed time per execution step.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.expanded_bookkeeping&amp;lt;/code&amp;gt; || False || Store extra provenance columns (input file/reflection indices, odd/even flag, original id) in the saved reflection tables.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Multiprocessing (&amp;lt;code&amp;gt;mp&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.method&amp;lt;/code&amp;gt; || mpi || Multiprocessing method (only &amp;lt;code&amp;gt;mpi&amp;lt;/code&amp;gt; is currently supported).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.debug.cProfile&amp;lt;/code&amp;gt; || False || Enable code profiling; a &amp;lt;code&amp;gt;.prof&amp;lt;/code&amp;gt; file is written per rank.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Output files ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; worker gathers all HKLs at rank 0 and writes three MTZ files, prefixed with&lt;br /&gt;
&amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; (default &amp;lt;code&amp;gt;iobs&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_all.mtz&amp;lt;/code&amp;gt; — the merged dataset using all observations (the main result for structure solution)&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_odd.mtz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_even.mtz&amp;lt;/code&amp;gt; — the two half-datasets used for CC½ and related half-dataset statistics&lt;br /&gt;
&lt;br /&gt;
A main log records the per-step progress and the merging statistics tables by resolution bin:&lt;br /&gt;
completeness, multiplicity and ⟨I/σ⟩, plus the &amp;quot;Table of Scaling Results&amp;quot; reporting CC½ (the&lt;br /&gt;
half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;&lt;br /&gt;
and R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.  The merged MTZ can optionally be&lt;br /&gt;
uploaded to a shared [https://github.com/cctbx/cctbx_project/tree/master/xfel/merging/application/publish Google Drive folder] by adding the &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; worker.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* Sauter NK (2015). &#039;&#039;J Synchrotron Radiat&#039;&#039; &#039;&#039;&#039;22&#039;&#039;&#039;, 239–48. (post-refinement)&lt;br /&gt;
* Uervirojnangkoorn M, &#039;&#039;et al.&#039;&#039; (2015). &#039;&#039;eLife&#039;&#039; 10.7554/eLife.05421. (PRIME / bootstrap)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2018). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;74&#039;&#039;&#039;, 877–894.&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019a). &#039;&#039;Computational Crystallography Newsletter&#039;&#039; &#039;&#039;&#039;10&#039;&#039;&#039;, 22–39. (XFEL GUI)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019b). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;75&#039;&#039;&#039;, 959–968. (error models)&lt;br /&gt;
* Mittan-Moreau (2025). (mm24 error model)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[dials.stills_process]] — produces the integrated data that &amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; consumes&lt;br /&gt;
* [[cctbx.xfel GUI]] — orchestrates separate scaling and repeated merging as data are collected&lt;br /&gt;
* The program README at &amp;lt;code&amp;gt;xfel/merging/README.md&amp;lt;/code&amp;gt; in cctbx_project&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1778</id>
		<title>Cctbx.xfel.merge</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1778"/>
		<updated>2026-08-21T23:15:21Z</updated>

		<summary type="html">&lt;p&gt;Aaron: /* Merging and error model (merging) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &#039;&#039;cctbx.xfel.merge&#039;&#039; =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;cctbx.xfel.merge&#039;&#039;&#039;&#039;&#039; is the scaling, post-refinement and merging program of cctbx.xfel. It takes&lt;br /&gt;
the per-image integrated results produced by &#039;&#039;[[dials.stills_process]]&#039;&#039; — one crystal per still shot —&lt;br /&gt;
and reduces the whole ensemble to a single set of merged structure-factor intensities (an MTZ file)&lt;br /&gt;
suitable for structure solution and refinement, together with the crystallographic quality&lt;br /&gt;
statistics (completeness, multiplicity, ⟨I/σ⟩, CC½, CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R-factors, etc.).&lt;br /&gt;
&lt;br /&gt;
Because serial datasets routinely contain tens of thousands to millions of still shots,&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is built from the ground up to run under MPI across many nodes. It is&lt;br /&gt;
almost always launched with &amp;lt;code&amp;gt;mpirun&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt;.  Note that MPI uses the term &#039;ranks&#039;&lt;br /&gt;
to distinguish independent processes that are running across one or more nodes.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is organized as a sequence of &#039;&#039;&#039;workers&#039;&#039;&#039;. Each worker performs one&lt;br /&gt;
task — reading data, applying a correction, filtering, scaling, post-refining, computing a statistic,&lt;br /&gt;
or merging — and passes its (possibly modified) experiments and reflections on to the next worker.&lt;br /&gt;
The list of workers to run is the &amp;quot;step list&amp;quot;, and it is fully configurable: you can add, remove or&lt;br /&gt;
reorder steps with &amp;lt;code&amp;gt;dispatch.step_list&amp;lt;/code&amp;gt;. This is what makes the program flexible enough to&lt;br /&gt;
scale-and-merge in one pass, to scale subsets separately and merge later, or to run a reference-free&lt;br /&gt;
bootstrap.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;default&#039;&#039;&#039; step list is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! # !! Worker !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| 1 || &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; || Read integrated experiments (&amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;) and reflections (&amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt;) from disk in DIALS format.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || &amp;lt;code&amp;gt;balance&amp;lt;/code&amp;gt; || Redistribute the input load evenly across MPI ranks (needed when there are fewer or more input files than ranks).&lt;br /&gt;
|-&lt;br /&gt;
| 3 || &amp;lt;code&amp;gt;model_scaling&amp;lt;/code&amp;gt; || Build the full Miller list, model intensities from the reference, and the resolution binner used for scaling and post-refinement.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || &amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt; || Apply per-reflection modifications, e.g. polarization correction (and optionally re-indexing to resolve indexing ambiguity — see &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;reindex_to_reference&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 5 || &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; || Reject whole experiments (or reflections) by resolution, unit cell, correlation to the reference, energy, etc.&lt;br /&gt;
|-&lt;br /&gt;
| 6 || &amp;lt;code&amp;gt;scale&amp;lt;/code&amp;gt; || Scale each lattice to the reference dataset (&amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;) or simply average (&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 7 || &amp;lt;code&amp;gt;postrefine&amp;lt;/code&amp;gt; || Post-refine per-image crystal parameters and partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| 8 || &amp;lt;code&amp;gt;statistics_unitcell&amp;lt;/code&amp;gt; || Determine and store the average unit cell.&lt;br /&gt;
|-&lt;br /&gt;
| 9 || &amp;lt;code&amp;gt;statistics_beam&amp;lt;/code&amp;gt; || Determine and store the average wavelength.&lt;br /&gt;
|-&lt;br /&gt;
| 10 || &amp;lt;code&amp;gt;model_statistics&amp;lt;/code&amp;gt; || Rebuild the Miller list / binner for statistics (may use the average unit cell).&lt;br /&gt;
|-&lt;br /&gt;
| 11 || &amp;lt;code&amp;gt;statistics_resolution&amp;lt;/code&amp;gt; || Per-crystal resolution statistics.&lt;br /&gt;
|-&lt;br /&gt;
| 12 || &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt; || Redistribute reflections across ranks so that every observation of a given HKL is gathered on the same rank prior to merging.&lt;br /&gt;
|-&lt;br /&gt;
| 13 || &amp;lt;code&amp;gt;errors_merge&amp;lt;/code&amp;gt; || Correct the merged error estimates with a per-HKL error model (e.g. Ev11, Brewster 2019b, or MM24 (the default), Mittan-Moreau (2025)).&lt;br /&gt;
|-&lt;br /&gt;
| 14 || &amp;lt;code&amp;gt;statistics_intensity&amp;lt;/code&amp;gt; || Intensity statistics by resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 15 || &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; || Merge symmetry-equivalent intensities, gather all HKLs at rank 0, and write &amp;quot;odd&amp;quot;, &amp;quot;even&amp;quot; and &amp;quot;all&amp;quot; MTZ files.&lt;br /&gt;
|-&lt;br /&gt;
| 16 || &amp;lt;code&amp;gt;statistics_intensity_cxi&amp;lt;/code&amp;gt; || Correlation and R-factor statistics (ported from cxi.merge): the &amp;quot;Table of Scaling Results&amp;quot; — CC½ (half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Additional, non-default workers are available and can be&lt;br /&gt;
inserted into the step list, including &amp;lt;code&amp;gt;tdata&amp;lt;/code&amp;gt; (write out unit cells for clustering),&lt;br /&gt;
&amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; (batch MTZ for &#039;&#039;Careless&#039;&#039;), &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; (upload merged files to a&lt;br /&gt;
Google Drive folder), &amp;lt;code&amp;gt;monitor&amp;lt;/code&amp;gt; (resource-usage logging), &amp;lt;code&amp;gt;integrate&amp;lt;/code&amp;gt;&lt;br /&gt;
(on-the-fly integration), &amp;lt;code&amp;gt;prepare&amp;lt;/code&amp;gt; (SpReAD energy binning), and&lt;br /&gt;
&amp;lt;code&amp;gt;lunus&amp;lt;/code&amp;gt; (diffuse-scattering deck). A &amp;lt;code&amp;gt;deltaccint&amp;lt;/code&amp;gt; worker (ΔCC½ lattice&lt;br /&gt;
filtering) can be added after &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;. Custom workers can be supplied through the&lt;br /&gt;
&amp;lt;code&amp;gt;XFEL_CUSTOM_WORKER_PATH&amp;lt;/code&amp;gt; environment variable.&lt;br /&gt;
&lt;br /&gt;
== Basic usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is run under MPI:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mpirun cctbx.xfel.merge merge.phil&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical &amp;lt;code&amp;gt;merge.phil&amp;lt;/code&amp;gt; (from the program README):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input.path=&amp;lt;path to data&amp;gt;&lt;br /&gt;
input.experiments_suffix=.expt&lt;br /&gt;
input.reflections_suffix=.refl&lt;br /&gt;
&lt;br /&gt;
filter.algorithm=unit_cell&lt;br /&gt;
filter.unit_cell.value.relative_length_tolerance=0.03&lt;br /&gt;
filter.outlier.min_corr=0.1&lt;br /&gt;
&lt;br /&gt;
select.algorithm=significance_filter&lt;br /&gt;
select.significance_filter.sigma=0.1&lt;br /&gt;
select.significance_filter.min_ct=200&lt;br /&gt;
select.significance_filter.max_ct=300&lt;br /&gt;
&lt;br /&gt;
scaling.model=&amp;lt;model.pdb or model.mtz&amp;gt;&lt;br /&gt;
scaling.resolution_scalar=0.96&lt;br /&gt;
&lt;br /&gt;
merging.d_min=1.8&lt;br /&gt;
merging.error.model=ev11&lt;br /&gt;
merging.merge_anomalous=True&lt;br /&gt;
&lt;br /&gt;
postrefinement.enable=True&lt;br /&gt;
statistics.n_bins=20&lt;br /&gt;
&lt;br /&gt;
output.do_timing=True&lt;br /&gt;
output.output_dir=&amp;lt;output folder&amp;gt;&lt;br /&gt;
output.prefix=&amp;lt;prefix for output files&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explore the parameters with:&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c&amp;lt;/code&amp;gt; — show configurable parameters&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c -e 10 -a 2&amp;lt;/code&amp;gt; — show all parameters (expert level 10) with full help text&lt;br /&gt;
&lt;br /&gt;
== Two-stage scaling and merging ==&lt;br /&gt;
&lt;br /&gt;
For large, growing datasets (the mode used by the [[cctbx.xfel GUI]]), it is more efficient to scale&lt;br /&gt;
and post-refine each subset of data &#039;&#039;&#039;once&#039;&#039;&#039;, then merge repeatedly as more data arrive. This is&lt;br /&gt;
done by running the program twice with different step lists.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 1 — scale each subset&#039;&#039;&#039; (stops after per-image work and writes intermediate DIALS files):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input balance model_scaling modify filter scale postrefine \&lt;br /&gt;
    statistics_unitcell statistics_beam model_statistics statistics_resolution&lt;br /&gt;
input.parallel_file_load.method=uniform&lt;br /&gt;
output.save_experiments_and_reflections=True&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;output.save_experiments_and_reflections=True&amp;lt;/code&amp;gt; dumps the scaled/post-refined data as&lt;br /&gt;
experiment lists and reflection tables that the merge stage can read back in.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 2 — merge the scaled subsets&#039;&#039;&#039; (add an &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; for each finished subset):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input model_scaling statistics_unitcell statistics_beam \&lt;br /&gt;
    model_statistics statistics_resolution group errors_merge statistics_intensity \&lt;br /&gt;
    merge statistics_intensity_cxi&lt;br /&gt;
input.parallel_file_load.method=uniform&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Merging without a reference (bootstrap / mark1) ==&lt;br /&gt;
&lt;br /&gt;
If no scaling/merging reference is available, use a bootstrap procedure. First run the&lt;br /&gt;
&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; algorithm, which simply averages the data (all per-image scale factors = 1, no&lt;br /&gt;
post-refinement), specifying the target cell and symmetry explicitly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
scaling.algorithm=mark1&lt;br /&gt;
scaling.unit_cell=&amp;lt;unit cell&amp;gt;&lt;br /&gt;
scaling.space_group=&amp;lt;space group&amp;gt;&lt;br /&gt;
merging.error.model=errors_from_sample_residuals&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting MTZ is then used as the reference (&amp;lt;code&amp;gt;scaling.model=&amp;lt;/code&amp;gt;) for subsequent regular&lt;br /&gt;
merges. Iterate a few cycles; CC½ typically improves and converges over the first few rounds.&lt;br /&gt;
&lt;br /&gt;
== Important parameters ==&lt;br /&gt;
&lt;br /&gt;
Parameters are given by their full PHIL path with defaults in parentheses. The program exposes many&lt;br /&gt;
more parameters (see &amp;lt;code&amp;gt;-c -e 10 -a 2&amp;lt;/code&amp;gt;); those below are the ones most commonly set.&lt;br /&gt;
&lt;br /&gt;
=== Input ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; || None || Path(s) to the integrated data — a folder, several folders, or individual files; wildcards allowed; may be repeated. Matching &amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt; files must both be present.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.experiments_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.expt&amp;lt;/code&amp;gt; || Only load experiment files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.reflections_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.refl&amp;lt;/code&amp;gt; || Only load reflection files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.parallel_file_load.method&amp;lt;/code&amp;gt; || uniform || &amp;lt;code&amp;gt;uniform&amp;lt;/code&amp;gt; spreads input files evenly over all ranks; &amp;lt;code&amp;gt;node_memory&amp;lt;/code&amp;gt; distributes so per-node memory limits are respected.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.alist.file&amp;lt;/code&amp;gt; || None || Path to a text file of experiment tags or filenames; combined with &amp;lt;code&amp;gt;input.alist.op=keep|reject&amp;lt;/code&amp;gt; to merge only (or exclude) a specified subset.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.persistent_refl_cols&amp;lt;/code&amp;gt; || None || Reflection-table columns to preserve through the pruning steps (and into saved tables).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Filtering whole experiments (&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;entire experiments&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;n_obs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resolution&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;unit_cell&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;energy&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bootstrap&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;experiment_prefix&amp;lt;/code&amp;gt;. Nothing is filtered unless listed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.algorithm&amp;lt;/code&amp;gt; || value || How to restrict unit cells: &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; (compare to a target), &amp;lt;code&amp;gt;range&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;cluster&amp;lt;/code&amp;gt; (use a precomputed covariance clustering).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.relative_length_tolerance&amp;lt;/code&amp;gt; || 0.1 || Fractional deviation of cell edge lengths allowed vs. the target cell. Often tightened (e.g. 0.03).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.absolute_angle_tolerance&amp;lt;/code&amp;gt; || 2.0 || Allowed cell-angle deviation (degrees) vs. the target.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.target_unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;target_space_group&amp;lt;/code&amp;gt; || Auto || Target cell/symmetry; &amp;lt;code&amp;gt;Auto&amp;lt;/code&amp;gt; uses the scaling model.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.outlier.min_corr&amp;lt;/code&amp;gt; || 0.1 || Minimum correlation of an image&#039;s intensities to the reference model; images below this are rejected. Only applied when a scaling model is present. Use &amp;lt;code&amp;gt;-1&amp;lt;/code&amp;gt; to accept all images regardless of correlation.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.resolution.d_min&amp;lt;/code&amp;gt; || None || Reject an experiment unless some of its reflections extend beyond this resolution.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Selecting individual reflections (&amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;individual reflections&#039;&#039;&#039; (contrast with&lt;br /&gt;
&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;, which acts on whole experiments).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;significance_filter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;panel&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cspad_sensor&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;isolation_forest&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;target_energy&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.sigma&amp;lt;/code&amp;gt; || 0.5 || Trim each lattice at the resolution where the binned ⟨I/σ⟩ drops below this value.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.min_ct&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;max_ct&amp;lt;/code&amp;gt; || 10 / 50 || Target minimum/maximum mean reflections per resolution bin when choosing the number of bins. For large unit cells these are often raised (e.g. 200/300); for small cells, use the defaults.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Modifying intensities (&amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.algorithm&amp;lt;/code&amp;gt; || polarization || Per-reflection corrections to apply (default applies the polarization correction).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt; || — || Resolve an indexing ambiguity across the ensemble using the Gildea/Winter (Brehm/Diederichs) cosym method, optionally anchored to &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.reindex_to_reference&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;reindex_to_abc&amp;lt;/code&amp;gt; || — || Alternative re-indexing operators (to a reference model, or an explicit operator).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Scaling (&amp;lt;code&amp;gt;scaling&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt; || None || Reference dataset: a PDB file (uses the CRYST1 cell and computes model intensities, including bulk solvent) or an MTZ from a previous cycle. Required for &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt; scaling.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.algorithm&amp;lt;/code&amp;gt; || mark0 || &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;: per-image scaling against the reference. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;: no scaling, just Monte-Carlo averaging (all scale factors = 1) — used for reference-free bootstrap.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;scaling.space_group&amp;lt;/code&amp;gt; || None || Cell/symmetry to use when no model is provided (i.e. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.resolution_scalar&amp;lt;/code&amp;gt; || 0.969 || &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; is multiplied by this when deciding which reflections fall within the resolution limit, generating a few extra reference reflections to account for per-shot cell variation (e.g. set 0.96 for a few more).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.mtz.mtz_column_F&amp;lt;/code&amp;gt; || fobs || Column name in the reference MTZ containing the reference structure factors (intensities or amplitudes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Post-refinement (&amp;lt;code&amp;gt;postrefinement&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.enable&amp;lt;/code&amp;gt; || True || Enable post-refinement of per-image parameters/partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.algorithm&amp;lt;/code&amp;gt; || rs || Post-refinement protocol: &amp;lt;code&amp;gt;rs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs_hybrid&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;eta_deff&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Merging and error model (&amp;lt;code&amp;gt;merging&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; || None || High-resolution limit for scaling and merging.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_max&amp;lt;/code&amp;gt; || None || Low-resolution limit (currently affects only CCiso).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.merge_anomalous&amp;lt;/code&amp;gt; || False || &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; merges Bijvoet mates together (higher multiplicity); &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt; keeps them separate to preserve the anomalous signal.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.minimum_multiplicity&amp;lt;/code&amp;gt; || 2 || Do not produce a merged structure factor for HKLs measured fewer than this many times.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.error.model&amp;lt;/code&amp;gt; || mm24 || Merged-sigma error model: &amp;lt;code&amp;gt;mm24&amp;lt;/code&amp;gt; (Mittan-Moreau 2025, current default), &amp;lt;code&amp;gt;ev11&amp;lt;/code&amp;gt; (Evans 2011 / sdfac-refine, recommended in the README), &amp;lt;code&amp;gt;ha14&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;errors_from_sample_residuals&amp;lt;/code&amp;gt; (no refined error terms — used with &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; bootstrap).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.set_average_unit_cell&amp;lt;/code&amp;gt; || True || Output MTZ adopts the (cluster-derived) average unit cell of the data rather than the reference model&#039;s cell.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Statistics (&amp;lt;code&amp;gt;statistics&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.n_bins&amp;lt;/code&amp;gt; || 10 || Number of resolution bins in the statistics tables.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.cciso.mtz_file&amp;lt;/code&amp;gt; || None || Isomorphous reference structure factors for R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt; / CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.report_ML&amp;lt;/code&amp;gt; || True || Report per-frame max-likelihood attributes (domain size, mosaicity).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Output (&amp;lt;code&amp;gt;output&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.output_dir&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; || Directory for output files (created if it does not exist).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; || iobs || Prefix prepended to all output file names.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.save_experiments_and_reflections&amp;lt;/code&amp;gt; || False || Dump the final experiments/reflections from the last worker as DIALS files — used for the two-stage scale-then-merge workflow.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.do_timing&amp;lt;/code&amp;gt; || False || Log elapsed time per execution step.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.expanded_bookkeeping&amp;lt;/code&amp;gt; || False || Store extra provenance columns (input file/reflection indices, odd/even flag, original id) in the saved reflection tables.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Multiprocessing (&amp;lt;code&amp;gt;mp&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.method&amp;lt;/code&amp;gt; || mpi || Multiprocessing method (only &amp;lt;code&amp;gt;mpi&amp;lt;/code&amp;gt; is currently supported).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.debug.cProfile&amp;lt;/code&amp;gt; || False || Enable code profiling; a &amp;lt;code&amp;gt;.prof&amp;lt;/code&amp;gt; file is written per rank.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Output files ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; worker gathers all HKLs at rank 0 and writes three MTZ files, prefixed with&lt;br /&gt;
&amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; (default &amp;lt;code&amp;gt;iobs&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_all.mtz&amp;lt;/code&amp;gt; — the merged dataset using all observations (the main result for structure solution)&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_odd.mtz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_even.mtz&amp;lt;/code&amp;gt; — the two half-datasets used for CC½ and related half-dataset statistics&lt;br /&gt;
&lt;br /&gt;
A main log records the per-step progress and the merging statistics tables by resolution bin:&lt;br /&gt;
completeness, multiplicity and ⟨I/σ⟩, plus the &amp;quot;Table of Scaling Results&amp;quot; reporting CC½ (the&lt;br /&gt;
half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;&lt;br /&gt;
and R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.  The merged MTZ can optionally be&lt;br /&gt;
uploaded to a shared [https://github.com/cctbx/cctbx_project/tree/master/xfel/merging/application/publish Google Drive folder] by adding the &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; worker.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* Sauter NK (2015). &#039;&#039;J Synchrotron Radiat&#039;&#039; &#039;&#039;&#039;22&#039;&#039;&#039;, 239–48. (post-refinement)&lt;br /&gt;
* Uervirojnangkoorn M, &#039;&#039;et al.&#039;&#039; (2015). &#039;&#039;eLife&#039;&#039; 10.7554/eLife.05421. (PRIME / bootstrap)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2018). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;74&#039;&#039;&#039;, 877–894.&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019a). &#039;&#039;Computational Crystallography Newsletter&#039;&#039; &#039;&#039;&#039;10&#039;&#039;&#039;, 22–39. (XFEL GUI)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019b). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;75&#039;&#039;&#039;, 959–968. (error models)&lt;br /&gt;
* Mittan-Moreau (2025). (mm24 error model)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[dials.stills_process]] — produces the integrated data that &amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; consumes&lt;br /&gt;
* [[cctbx.xfel GUI]] — orchestrates separate scaling and repeated merging as data are collected&lt;br /&gt;
* The program README at &amp;lt;code&amp;gt;xfel/merging/README.md&amp;lt;/code&amp;gt; in cctbx_project&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1777</id>
		<title>Cctbx.xfel.merge</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1777"/>
		<updated>2026-08-21T23:14:53Z</updated>

		<summary type="html">&lt;p&gt;Aaron: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &#039;&#039;cctbx.xfel.merge&#039;&#039; =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;cctbx.xfel.merge&#039;&#039;&#039;&#039;&#039; is the scaling, post-refinement and merging program of cctbx.xfel. It takes&lt;br /&gt;
the per-image integrated results produced by &#039;&#039;[[dials.stills_process]]&#039;&#039; — one crystal per still shot —&lt;br /&gt;
and reduces the whole ensemble to a single set of merged structure-factor intensities (an MTZ file)&lt;br /&gt;
suitable for structure solution and refinement, together with the crystallographic quality&lt;br /&gt;
statistics (completeness, multiplicity, ⟨I/σ⟩, CC½, CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R-factors, etc.).&lt;br /&gt;
&lt;br /&gt;
Because serial datasets routinely contain tens of thousands to millions of still shots,&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is built from the ground up to run under MPI across many nodes. It is&lt;br /&gt;
almost always launched with &amp;lt;code&amp;gt;mpirun&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt;.  Note that MPI uses the term &#039;ranks&#039;&lt;br /&gt;
to distinguish independent processes that are running across one or more nodes.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is organized as a sequence of &#039;&#039;&#039;workers&#039;&#039;&#039;. Each worker performs one&lt;br /&gt;
task — reading data, applying a correction, filtering, scaling, post-refining, computing a statistic,&lt;br /&gt;
or merging — and passes its (possibly modified) experiments and reflections on to the next worker.&lt;br /&gt;
The list of workers to run is the &amp;quot;step list&amp;quot;, and it is fully configurable: you can add, remove or&lt;br /&gt;
reorder steps with &amp;lt;code&amp;gt;dispatch.step_list&amp;lt;/code&amp;gt;. This is what makes the program flexible enough to&lt;br /&gt;
scale-and-merge in one pass, to scale subsets separately and merge later, or to run a reference-free&lt;br /&gt;
bootstrap.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;default&#039;&#039;&#039; step list is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! # !! Worker !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| 1 || &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; || Read integrated experiments (&amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;) and reflections (&amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt;) from disk in DIALS format.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || &amp;lt;code&amp;gt;balance&amp;lt;/code&amp;gt; || Redistribute the input load evenly across MPI ranks (needed when there are fewer or more input files than ranks).&lt;br /&gt;
|-&lt;br /&gt;
| 3 || &amp;lt;code&amp;gt;model_scaling&amp;lt;/code&amp;gt; || Build the full Miller list, model intensities from the reference, and the resolution binner used for scaling and post-refinement.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || &amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt; || Apply per-reflection modifications, e.g. polarization correction (and optionally re-indexing to resolve indexing ambiguity — see &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;reindex_to_reference&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 5 || &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; || Reject whole experiments (or reflections) by resolution, unit cell, correlation to the reference, energy, etc.&lt;br /&gt;
|-&lt;br /&gt;
| 6 || &amp;lt;code&amp;gt;scale&amp;lt;/code&amp;gt; || Scale each lattice to the reference dataset (&amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;) or simply average (&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 7 || &amp;lt;code&amp;gt;postrefine&amp;lt;/code&amp;gt; || Post-refine per-image crystal parameters and partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| 8 || &amp;lt;code&amp;gt;statistics_unitcell&amp;lt;/code&amp;gt; || Determine and store the average unit cell.&lt;br /&gt;
|-&lt;br /&gt;
| 9 || &amp;lt;code&amp;gt;statistics_beam&amp;lt;/code&amp;gt; || Determine and store the average wavelength.&lt;br /&gt;
|-&lt;br /&gt;
| 10 || &amp;lt;code&amp;gt;model_statistics&amp;lt;/code&amp;gt; || Rebuild the Miller list / binner for statistics (may use the average unit cell).&lt;br /&gt;
|-&lt;br /&gt;
| 11 || &amp;lt;code&amp;gt;statistics_resolution&amp;lt;/code&amp;gt; || Per-crystal resolution statistics.&lt;br /&gt;
|-&lt;br /&gt;
| 12 || &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt; || Redistribute reflections across ranks so that every observation of a given HKL is gathered on the same rank prior to merging.&lt;br /&gt;
|-&lt;br /&gt;
| 13 || &amp;lt;code&amp;gt;errors_merge&amp;lt;/code&amp;gt; || Correct the merged error estimates with a per-HKL error model (e.g. Ev11, Brewster 2019b, or MM24 (the default), Mittan-Moreau (2025)).&lt;br /&gt;
|-&lt;br /&gt;
| 14 || &amp;lt;code&amp;gt;statistics_intensity&amp;lt;/code&amp;gt; || Intensity statistics by resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 15 || &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; || Merge symmetry-equivalent intensities, gather all HKLs at rank 0, and write &amp;quot;odd&amp;quot;, &amp;quot;even&amp;quot; and &amp;quot;all&amp;quot; MTZ files.&lt;br /&gt;
|-&lt;br /&gt;
| 16 || &amp;lt;code&amp;gt;statistics_intensity_cxi&amp;lt;/code&amp;gt; || Correlation and R-factor statistics (ported from cxi.merge): the &amp;quot;Table of Scaling Results&amp;quot; — CC½ (half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Additional, non-default workers are available and can be&lt;br /&gt;
inserted into the step list, including &amp;lt;code&amp;gt;tdata&amp;lt;/code&amp;gt; (write out unit cells for clustering),&lt;br /&gt;
&amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; (batch MTZ for &#039;&#039;Careless&#039;&#039;), &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; (upload merged files to a&lt;br /&gt;
Google Drive folder), &amp;lt;code&amp;gt;monitor&amp;lt;/code&amp;gt; (resource-usage logging), &amp;lt;code&amp;gt;integrate&amp;lt;/code&amp;gt;&lt;br /&gt;
(on-the-fly integration), &amp;lt;code&amp;gt;prepare&amp;lt;/code&amp;gt; (SpReAD energy binning), and&lt;br /&gt;
&amp;lt;code&amp;gt;lunus&amp;lt;/code&amp;gt; (diffuse-scattering deck). A &amp;lt;code&amp;gt;deltaccint&amp;lt;/code&amp;gt; worker (ΔCC½ lattice&lt;br /&gt;
filtering) can be added after &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;. Custom workers can be supplied through the&lt;br /&gt;
&amp;lt;code&amp;gt;XFEL_CUSTOM_WORKER_PATH&amp;lt;/code&amp;gt; environment variable.&lt;br /&gt;
&lt;br /&gt;
== Basic usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is run under MPI:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mpirun cctbx.xfel.merge merge.phil&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical &amp;lt;code&amp;gt;merge.phil&amp;lt;/code&amp;gt; (from the program README):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input.path=&amp;lt;path to data&amp;gt;&lt;br /&gt;
input.experiments_suffix=.expt&lt;br /&gt;
input.reflections_suffix=.refl&lt;br /&gt;
&lt;br /&gt;
filter.algorithm=unit_cell&lt;br /&gt;
filter.unit_cell.value.relative_length_tolerance=0.03&lt;br /&gt;
filter.outlier.min_corr=0.1&lt;br /&gt;
&lt;br /&gt;
select.algorithm=significance_filter&lt;br /&gt;
select.significance_filter.sigma=0.1&lt;br /&gt;
select.significance_filter.min_ct=200&lt;br /&gt;
select.significance_filter.max_ct=300&lt;br /&gt;
&lt;br /&gt;
scaling.model=&amp;lt;model.pdb or model.mtz&amp;gt;&lt;br /&gt;
scaling.resolution_scalar=0.96&lt;br /&gt;
&lt;br /&gt;
merging.d_min=1.8&lt;br /&gt;
merging.error.model=ev11&lt;br /&gt;
merging.merge_anomalous=True&lt;br /&gt;
&lt;br /&gt;
postrefinement.enable=True&lt;br /&gt;
statistics.n_bins=20&lt;br /&gt;
&lt;br /&gt;
output.do_timing=True&lt;br /&gt;
output.output_dir=&amp;lt;output folder&amp;gt;&lt;br /&gt;
output.prefix=&amp;lt;prefix for output files&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explore the parameters with:&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c&amp;lt;/code&amp;gt; — show configurable parameters&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c -e 10 -a 2&amp;lt;/code&amp;gt; — show all parameters (expert level 10) with full help text&lt;br /&gt;
&lt;br /&gt;
== Two-stage scaling and merging ==&lt;br /&gt;
&lt;br /&gt;
For large, growing datasets (the mode used by the [[cctbx.xfel GUI]]), it is more efficient to scale&lt;br /&gt;
and post-refine each subset of data &#039;&#039;&#039;once&#039;&#039;&#039;, then merge repeatedly as more data arrive. This is&lt;br /&gt;
done by running the program twice with different step lists.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 1 — scale each subset&#039;&#039;&#039; (stops after per-image work and writes intermediate DIALS files):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input balance model_scaling modify filter scale postrefine \&lt;br /&gt;
    statistics_unitcell statistics_beam model_statistics statistics_resolution&lt;br /&gt;
input.parallel_file_load.method=uniform&lt;br /&gt;
output.save_experiments_and_reflections=True&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;output.save_experiments_and_reflections=True&amp;lt;/code&amp;gt; dumps the scaled/post-refined data as&lt;br /&gt;
experiment lists and reflection tables that the merge stage can read back in.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 2 — merge the scaled subsets&#039;&#039;&#039; (add an &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; for each finished subset):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input model_scaling statistics_unitcell statistics_beam \&lt;br /&gt;
    model_statistics statistics_resolution group errors_merge statistics_intensity \&lt;br /&gt;
    merge statistics_intensity_cxi&lt;br /&gt;
input.parallel_file_load.method=uniform&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Merging without a reference (bootstrap / mark1) ==&lt;br /&gt;
&lt;br /&gt;
If no scaling/merging reference is available, use a bootstrap procedure. First run the&lt;br /&gt;
&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; algorithm, which simply averages the data (all per-image scale factors = 1, no&lt;br /&gt;
post-refinement), specifying the target cell and symmetry explicitly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
scaling.algorithm=mark1&lt;br /&gt;
scaling.unit_cell=&amp;lt;unit cell&amp;gt;&lt;br /&gt;
scaling.space_group=&amp;lt;space group&amp;gt;&lt;br /&gt;
merging.error.model=errors_from_sample_residuals&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting MTZ is then used as the reference (&amp;lt;code&amp;gt;scaling.model=&amp;lt;/code&amp;gt;) for subsequent regular&lt;br /&gt;
merges. Iterate a few cycles; CC½ typically improves and converges over the first few rounds.&lt;br /&gt;
&lt;br /&gt;
== Important parameters ==&lt;br /&gt;
&lt;br /&gt;
Parameters are given by their full PHIL path with defaults in parentheses. The program exposes many&lt;br /&gt;
more parameters (see &amp;lt;code&amp;gt;-c -e 10 -a 2&amp;lt;/code&amp;gt;); those below are the ones most commonly set.&lt;br /&gt;
&lt;br /&gt;
=== Input ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; || None || Path(s) to the integrated data — a folder, several folders, or individual files; wildcards allowed; may be repeated. Matching &amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt; files must both be present.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.experiments_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.expt&amp;lt;/code&amp;gt; || Only load experiment files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.reflections_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.refl&amp;lt;/code&amp;gt; || Only load reflection files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.parallel_file_load.method&amp;lt;/code&amp;gt; || uniform || &amp;lt;code&amp;gt;uniform&amp;lt;/code&amp;gt; spreads input files evenly over all ranks; &amp;lt;code&amp;gt;node_memory&amp;lt;/code&amp;gt; distributes so per-node memory limits are respected.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.alist.file&amp;lt;/code&amp;gt; || None || Path to a text file of experiment tags or filenames; combined with &amp;lt;code&amp;gt;input.alist.op=keep|reject&amp;lt;/code&amp;gt; to merge only (or exclude) a specified subset.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.persistent_refl_cols&amp;lt;/code&amp;gt; || None || Reflection-table columns to preserve through the pruning steps (and into saved tables).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Filtering whole experiments (&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;entire experiments&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;n_obs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resolution&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;unit_cell&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;energy&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bootstrap&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;experiment_prefix&amp;lt;/code&amp;gt;. Nothing is filtered unless listed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.algorithm&amp;lt;/code&amp;gt; || value || How to restrict unit cells: &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; (compare to a target), &amp;lt;code&amp;gt;range&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;cluster&amp;lt;/code&amp;gt; (use a precomputed covariance clustering).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.relative_length_tolerance&amp;lt;/code&amp;gt; || 0.1 || Fractional deviation of cell edge lengths allowed vs. the target cell. Often tightened (e.g. 0.03).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.absolute_angle_tolerance&amp;lt;/code&amp;gt; || 2.0 || Allowed cell-angle deviation (degrees) vs. the target.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.target_unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;target_space_group&amp;lt;/code&amp;gt; || Auto || Target cell/symmetry; &amp;lt;code&amp;gt;Auto&amp;lt;/code&amp;gt; uses the scaling model.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.outlier.min_corr&amp;lt;/code&amp;gt; || 0.1 || Minimum correlation of an image&#039;s intensities to the reference model; images below this are rejected. Only applied when a scaling model is present. Use &amp;lt;code&amp;gt;-1&amp;lt;/code&amp;gt; to accept all images regardless of correlation.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.resolution.d_min&amp;lt;/code&amp;gt; || None || Reject an experiment unless some of its reflections extend beyond this resolution.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Selecting individual reflections (&amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;individual reflections&#039;&#039;&#039; (contrast with&lt;br /&gt;
&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;, which acts on whole experiments).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;significance_filter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;panel&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cspad_sensor&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;isolation_forest&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;target_energy&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.sigma&amp;lt;/code&amp;gt; || 0.5 || Trim each lattice at the resolution where the binned ⟨I/σ⟩ drops below this value.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.min_ct&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;max_ct&amp;lt;/code&amp;gt; || 10 / 50 || Target minimum/maximum mean reflections per resolution bin when choosing the number of bins. For large unit cells these are often raised (e.g. 200/300); for small cells, use the defaults.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Modifying intensities (&amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.algorithm&amp;lt;/code&amp;gt; || polarization || Per-reflection corrections to apply (default applies the polarization correction).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt; || — || Resolve an indexing ambiguity across the ensemble using the Gildea/Winter (Brehm/Diederichs) cosym method, optionally anchored to &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.reindex_to_reference&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;reindex_to_abc&amp;lt;/code&amp;gt; || — || Alternative re-indexing operators (to a reference model, or an explicit operator).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Scaling (&amp;lt;code&amp;gt;scaling&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt; || None || Reference dataset: a PDB file (uses the CRYST1 cell and computes model intensities, including bulk solvent) or an MTZ from a previous cycle. Required for &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt; scaling.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.algorithm&amp;lt;/code&amp;gt; || mark0 || &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;: per-image scaling against the reference. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;: no scaling, just Monte-Carlo averaging (all scale factors = 1) — used for reference-free bootstrap.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;scaling.space_group&amp;lt;/code&amp;gt; || None || Cell/symmetry to use when no model is provided (i.e. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.resolution_scalar&amp;lt;/code&amp;gt; || 0.969 || &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; is multiplied by this when deciding which reflections fall within the resolution limit, generating a few extra reference reflections to account for per-shot cell variation (e.g. set 0.96 for a few more).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.mtz.mtz_column_F&amp;lt;/code&amp;gt; || fobs || Column name in the reference MTZ containing the reference structure factors (intensities or amplitudes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Post-refinement (&amp;lt;code&amp;gt;postrefinement&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.enable&amp;lt;/code&amp;gt; || True || Enable post-refinement of per-image parameters/partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.algorithm&amp;lt;/code&amp;gt; || rs || Post-refinement protocol: &amp;lt;code&amp;gt;rs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs_hybrid&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;eta_deff&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Merging and error model (&amp;lt;code&amp;gt;merging&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; || None || High-resolution limit for scaling and merging.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_max&amp;lt;/code&amp;gt; || None || Low-resolution limit (currently affects only CCiso).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.merge_anomalous&amp;lt;/code&amp;gt; || False || &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; merges Bijvoet mates together (higher multiplicity); &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt; keeps them separate to preserve the anomalous signal.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.minimum_multiplicity&amp;lt;/code&amp;gt; || 2 || Do not produce a merged structure factor for HKLs measured fewer than this many times.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.error.model&amp;lt;/code&amp;gt; || mm24 || Merged-sigma error model: &amp;lt;code&amp;gt;mm24&amp;lt;/code&amp;gt; (Mittan-Moreau 2024, current default), &amp;lt;code&amp;gt;ev11&amp;lt;/code&amp;gt; (Evans 2011 / sdfac-refine, recommended in the README), &amp;lt;code&amp;gt;ha14&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;errors_from_sample_residuals&amp;lt;/code&amp;gt; (no refined error terms — used with &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; bootstrap).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.set_average_unit_cell&amp;lt;/code&amp;gt; || True || Output MTZ adopts the (cluster-derived) average unit cell of the data rather than the reference model&#039;s cell.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Statistics (&amp;lt;code&amp;gt;statistics&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.n_bins&amp;lt;/code&amp;gt; || 10 || Number of resolution bins in the statistics tables.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.cciso.mtz_file&amp;lt;/code&amp;gt; || None || Isomorphous reference structure factors for R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt; / CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.report_ML&amp;lt;/code&amp;gt; || True || Report per-frame max-likelihood attributes (domain size, mosaicity).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Output (&amp;lt;code&amp;gt;output&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.output_dir&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; || Directory for output files (created if it does not exist).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; || iobs || Prefix prepended to all output file names.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.save_experiments_and_reflections&amp;lt;/code&amp;gt; || False || Dump the final experiments/reflections from the last worker as DIALS files — used for the two-stage scale-then-merge workflow.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.do_timing&amp;lt;/code&amp;gt; || False || Log elapsed time per execution step.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.expanded_bookkeeping&amp;lt;/code&amp;gt; || False || Store extra provenance columns (input file/reflection indices, odd/even flag, original id) in the saved reflection tables.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Multiprocessing (&amp;lt;code&amp;gt;mp&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.method&amp;lt;/code&amp;gt; || mpi || Multiprocessing method (only &amp;lt;code&amp;gt;mpi&amp;lt;/code&amp;gt; is currently supported).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.debug.cProfile&amp;lt;/code&amp;gt; || False || Enable code profiling; a &amp;lt;code&amp;gt;.prof&amp;lt;/code&amp;gt; file is written per rank.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Output files ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; worker gathers all HKLs at rank 0 and writes three MTZ files, prefixed with&lt;br /&gt;
&amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; (default &amp;lt;code&amp;gt;iobs&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_all.mtz&amp;lt;/code&amp;gt; — the merged dataset using all observations (the main result for structure solution)&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_odd.mtz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_even.mtz&amp;lt;/code&amp;gt; — the two half-datasets used for CC½ and related half-dataset statistics&lt;br /&gt;
&lt;br /&gt;
A main log records the per-step progress and the merging statistics tables by resolution bin:&lt;br /&gt;
completeness, multiplicity and ⟨I/σ⟩, plus the &amp;quot;Table of Scaling Results&amp;quot; reporting CC½ (the&lt;br /&gt;
half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;&lt;br /&gt;
and R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.  The merged MTZ can optionally be&lt;br /&gt;
uploaded to a shared [https://github.com/cctbx/cctbx_project/tree/master/xfel/merging/application/publish Google Drive folder] by adding the &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; worker.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* Sauter NK (2015). &#039;&#039;J Synchrotron Radiat&#039;&#039; &#039;&#039;&#039;22&#039;&#039;&#039;, 239–48. (post-refinement)&lt;br /&gt;
* Uervirojnangkoorn M, &#039;&#039;et al.&#039;&#039; (2015). &#039;&#039;eLife&#039;&#039; 10.7554/eLife.05421. (PRIME / bootstrap)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2018). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;74&#039;&#039;&#039;, 877–894.&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019a). &#039;&#039;Computational Crystallography Newsletter&#039;&#039; &#039;&#039;&#039;10&#039;&#039;&#039;, 22–39. (XFEL GUI)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019b). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;75&#039;&#039;&#039;, 959–968. (error models)&lt;br /&gt;
* Mittan-Moreau (2025). (mm24 error model)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[dials.stills_process]] — produces the integrated data that &amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; consumes&lt;br /&gt;
* [[cctbx.xfel GUI]] — orchestrates separate scaling and repeated merging as data are collected&lt;br /&gt;
* The program README at &amp;lt;code&amp;gt;xfel/merging/README.md&amp;lt;/code&amp;gt; in cctbx_project&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
	<entry>
		<id>http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1776</id>
		<title>Cctbx.xfel.merge</title>
		<link rel="alternate" type="text/html" href="http://viper.lbl.gov:8080/cctbx.xfel/index.php?title=Cctbx.xfel.merge&amp;diff=1776"/>
		<updated>2026-08-21T23:14:17Z</updated>

		<summary type="html">&lt;p&gt;Aaron: /* Output files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= &#039;&#039;cctbx.xfel.merge&#039;&#039; =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;cctbx.xfel.merge&#039;&#039;&#039;&#039;&#039; is the scaling, post-refinement and merging program of cctbx.xfel. It takes&lt;br /&gt;
the per-image integrated results produced by &#039;&#039;[[dials.stills_process]]&#039;&#039; — one crystal per still shot —&lt;br /&gt;
and reduces the whole ensemble to a single set of merged structure-factor intensities (an MTZ file)&lt;br /&gt;
suitable for structure solution and refinement, together with the crystallographic quality&lt;br /&gt;
statistics (completeness, multiplicity, ⟨I/σ⟩, CC½, CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R-factors, etc.).&lt;br /&gt;
&lt;br /&gt;
Because serial datasets routinely contain tens of thousands to millions of still shots,&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is built from the ground up to run under MPI across many nodes. It is&lt;br /&gt;
almost always launched with &amp;lt;code&amp;gt;mpirun&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;srun&amp;lt;/code&amp;gt;.  Note that MPI uses the term &#039;ranks&#039;&lt;br /&gt;
to distinguish independent processes that are running across one or more nodes.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is organized as a sequence of &#039;&#039;&#039;workers&#039;&#039;&#039;. Each worker performs one&lt;br /&gt;
task — reading data, applying a correction, filtering, scaling, post-refining, computing a statistic,&lt;br /&gt;
or merging — and passes its (possibly modified) experiments and reflections on to the next worker.&lt;br /&gt;
The list of workers to run is the &amp;quot;step list&amp;quot;, and it is fully configurable: you can add, remove or&lt;br /&gt;
reorder steps with &amp;lt;code&amp;gt;dispatch.step_list&amp;lt;/code&amp;gt;. This is what makes the program flexible enough to&lt;br /&gt;
scale-and-merge in one pass, to scale subsets separately and merge later, or to run a reference-free&lt;br /&gt;
bootstrap.&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;default&#039;&#039;&#039; step list is:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! # !! Worker !! Purpose&lt;br /&gt;
|-&lt;br /&gt;
| 1 || &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; || Read integrated experiments (&amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt;) and reflections (&amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt;) from disk in DIALS format.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || &amp;lt;code&amp;gt;balance&amp;lt;/code&amp;gt; || Redistribute the input load evenly across MPI ranks (needed when there are fewer or more input files than ranks).&lt;br /&gt;
|-&lt;br /&gt;
| 3 || &amp;lt;code&amp;gt;model_scaling&amp;lt;/code&amp;gt; || Build the full Miller list, model intensities from the reference, and the resolution binner used for scaling and post-refinement.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || &amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt; || Apply per-reflection modifications, e.g. polarization correction (and optionally re-indexing to resolve indexing ambiguity — see &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;reindex_to_reference&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 5 || &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; || Reject whole experiments (or reflections) by resolution, unit cell, correlation to the reference, energy, etc.&lt;br /&gt;
|-&lt;br /&gt;
| 6 || &amp;lt;code&amp;gt;scale&amp;lt;/code&amp;gt; || Scale each lattice to the reference dataset (&amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;) or simply average (&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| 7 || &amp;lt;code&amp;gt;postrefine&amp;lt;/code&amp;gt; || Post-refine per-image crystal parameters and partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| 8 || &amp;lt;code&amp;gt;statistics_unitcell&amp;lt;/code&amp;gt; || Determine and store the average unit cell.&lt;br /&gt;
|-&lt;br /&gt;
| 9 || &amp;lt;code&amp;gt;statistics_beam&amp;lt;/code&amp;gt; || Determine and store the average wavelength.&lt;br /&gt;
|-&lt;br /&gt;
| 10 || &amp;lt;code&amp;gt;model_statistics&amp;lt;/code&amp;gt; || Rebuild the Miller list / binner for statistics (may use the average unit cell).&lt;br /&gt;
|-&lt;br /&gt;
| 11 || &amp;lt;code&amp;gt;statistics_resolution&amp;lt;/code&amp;gt; || Per-crystal resolution statistics.&lt;br /&gt;
|-&lt;br /&gt;
| 12 || &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt; || Redistribute reflections across ranks so that every observation of a given HKL is gathered on the same rank prior to merging.&lt;br /&gt;
|-&lt;br /&gt;
| 13 || &amp;lt;code&amp;gt;errors_merge&amp;lt;/code&amp;gt; || Correct the merged error estimates with a per-HKL error model (e.g. Ev11, Brewster 2019b, or MM24 (the default), Mittan-Moreau (2025)).&lt;br /&gt;
|-&lt;br /&gt;
| 14 || &amp;lt;code&amp;gt;statistics_intensity&amp;lt;/code&amp;gt; || Intensity statistics by resolution.&lt;br /&gt;
|-&lt;br /&gt;
| 15 || &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; || Merge symmetry-equivalent intensities, gather all HKLs at rank 0, and write &amp;quot;odd&amp;quot;, &amp;quot;even&amp;quot; and &amp;quot;all&amp;quot; MTZ files.&lt;br /&gt;
|-&lt;br /&gt;
| 16 || &amp;lt;code&amp;gt;statistics_intensity_cxi&amp;lt;/code&amp;gt; || Correlation and R-factor statistics (ported from cxi.merge): the &amp;quot;Table of Scaling Results&amp;quot; — CC½ (half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Additional, non-default workers are available and can be&lt;br /&gt;
inserted into the step list, including &amp;lt;code&amp;gt;tdata&amp;lt;/code&amp;gt; (write out unit cells for clustering),&lt;br /&gt;
&amp;lt;code&amp;gt;export&amp;lt;/code&amp;gt; (batch MTZ for &#039;&#039;Careless&#039;&#039;), &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; (upload merged files to a&lt;br /&gt;
Google Drive folder), &amp;lt;code&amp;gt;monitor&amp;lt;/code&amp;gt; (resource-usage logging), &amp;lt;code&amp;gt;integrate&amp;lt;/code&amp;gt;&lt;br /&gt;
(on-the-fly integration), &amp;lt;code&amp;gt;prepare&amp;lt;/code&amp;gt; (SpReAD energy binning), and&lt;br /&gt;
&amp;lt;code&amp;gt;lunus&amp;lt;/code&amp;gt; (diffuse-scattering deck). A &amp;lt;code&amp;gt;deltaccint&amp;lt;/code&amp;gt; worker (ΔCC½ lattice&lt;br /&gt;
filtering) can be added after &amp;lt;code&amp;gt;group&amp;lt;/code&amp;gt;. Custom workers can be supplied through the&lt;br /&gt;
&amp;lt;code&amp;gt;XFEL_CUSTOM_WORKER_PATH&amp;lt;/code&amp;gt; environment variable.&lt;br /&gt;
&lt;br /&gt;
== Basic usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; is run under MPI:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mpirun cctbx.xfel.merge merge.phil&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A typical &amp;lt;code&amp;gt;merge.phil&amp;lt;/code&amp;gt; (from the program README):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
input.path=&amp;lt;path to data&amp;gt;&lt;br /&gt;
input.experiments_suffix=.expt&lt;br /&gt;
input.reflections_suffix=.refl&lt;br /&gt;
&lt;br /&gt;
filter.algorithm=unit_cell&lt;br /&gt;
filter.unit_cell.value.relative_length_tolerance=0.03&lt;br /&gt;
filter.outlier.min_corr=0.1&lt;br /&gt;
&lt;br /&gt;
select.algorithm=significance_filter&lt;br /&gt;
select.significance_filter.sigma=0.1&lt;br /&gt;
select.significance_filter.min_ct=200&lt;br /&gt;
select.significance_filter.max_ct=300&lt;br /&gt;
&lt;br /&gt;
scaling.model=&amp;lt;model.pdb or model.mtz&amp;gt;&lt;br /&gt;
scaling.resolution_scalar=0.96&lt;br /&gt;
&lt;br /&gt;
merging.d_min=1.8&lt;br /&gt;
merging.error.model=ev11&lt;br /&gt;
merging.merge_anomalous=True&lt;br /&gt;
&lt;br /&gt;
postrefinement.enable=True&lt;br /&gt;
statistics.n_bins=20&lt;br /&gt;
&lt;br /&gt;
output.do_timing=True&lt;br /&gt;
output.output_dir=&amp;lt;output folder&amp;gt;&lt;br /&gt;
output.prefix=&amp;lt;prefix for output files&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Explore the parameters with:&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c&amp;lt;/code&amp;gt; — show configurable parameters&lt;br /&gt;
* &amp;lt;code&amp;gt;cctbx.xfel.merge -c -e 10 -a 2&amp;lt;/code&amp;gt; — show all parameters (expert level 10) with full help text&lt;br /&gt;
&lt;br /&gt;
== Two-stage scaling and merging ==&lt;br /&gt;
&lt;br /&gt;
For large, growing datasets (the mode used by the [[cctbx.xfel GUI]]), it is more efficient to scale&lt;br /&gt;
and post-refine each subset of data &#039;&#039;&#039;once&#039;&#039;&#039;, then merge repeatedly as more data arrive. This is&lt;br /&gt;
done by running the program twice with different step lists.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 1 — scale each subset&#039;&#039;&#039; (stops after per-image work and writes intermediate DIALS files):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input balance model_scaling modify filter scale postrefine \&lt;br /&gt;
    statistics_unitcell statistics_beam model_statistics statistics_resolution&lt;br /&gt;
input.parallel_file_load.method=uniform&lt;br /&gt;
output.save_experiments_and_reflections=True&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;output.save_experiments_and_reflections=True&amp;lt;/code&amp;gt; dumps the scaled/post-refined data as&lt;br /&gt;
experiment lists and reflection tables that the merge stage can read back in.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Stage 2 — merge the scaled subsets&#039;&#039;&#039; (add an &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; for each finished subset):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dispatch.step_list=input model_scaling statistics_unitcell statistics_beam \&lt;br /&gt;
    model_statistics statistics_resolution group errors_merge statistics_intensity \&lt;br /&gt;
    merge statistics_intensity_cxi&lt;br /&gt;
input.parallel_file_load.method=uniform&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Merging without a reference (bootstrap / mark1) ==&lt;br /&gt;
&lt;br /&gt;
If no scaling/merging reference is available, use a bootstrap procedure. First run the&lt;br /&gt;
&amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; algorithm, which simply averages the data (all per-image scale factors = 1, no&lt;br /&gt;
post-refinement), specifying the target cell and symmetry explicitly:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
scaling.algorithm=mark1&lt;br /&gt;
scaling.unit_cell=&amp;lt;unit cell&amp;gt;&lt;br /&gt;
scaling.space_group=&amp;lt;space group&amp;gt;&lt;br /&gt;
merging.error.model=errors_from_sample_residuals&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting MTZ is then used as the reference (&amp;lt;code&amp;gt;scaling.model=&amp;lt;/code&amp;gt;) for subsequent regular&lt;br /&gt;
merges. Iterate a few cycles; CC½ typically improves and converges over the first few rounds.&lt;br /&gt;
&lt;br /&gt;
== Important parameters ==&lt;br /&gt;
&lt;br /&gt;
Parameters are given by their full PHIL path with defaults in parentheses. The program exposes many&lt;br /&gt;
more parameters (see &amp;lt;code&amp;gt;-c -e 10 -a 2&amp;lt;/code&amp;gt;); those below are the ones most commonly set.&lt;br /&gt;
&lt;br /&gt;
=== Input ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.path&amp;lt;/code&amp;gt; || None || Path(s) to the integrated data — a folder, several folders, or individual files; wildcards allowed; may be repeated. Matching &amp;lt;code&amp;gt;.expt&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;.refl&amp;lt;/code&amp;gt; files must both be present.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.experiments_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.expt&amp;lt;/code&amp;gt; || Only load experiment files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.reflections_suffix&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;_integrated.refl&amp;lt;/code&amp;gt; || Only load reflection files ending with this suffix.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.parallel_file_load.method&amp;lt;/code&amp;gt; || uniform || &amp;lt;code&amp;gt;uniform&amp;lt;/code&amp;gt; spreads input files evenly over all ranks; &amp;lt;code&amp;gt;node_memory&amp;lt;/code&amp;gt; distributes so per-node memory limits are respected.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.alist.file&amp;lt;/code&amp;gt; || None || Path to a text file of experiment tags or filenames; combined with &amp;lt;code&amp;gt;input.alist.op=keep|reject&amp;lt;/code&amp;gt; to merge only (or exclude) a specified subset.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;input.persistent_refl_cols&amp;lt;/code&amp;gt; || None || Reflection-table columns to preserve through the pruning steps (and into saved tables).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Filtering whole experiments (&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;entire experiments&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;n_obs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;resolution&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;unit_cell&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;energy&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;bootstrap&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;experiment_prefix&amp;lt;/code&amp;gt;. Nothing is filtered unless listed.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.algorithm&amp;lt;/code&amp;gt; || value || How to restrict unit cells: &amp;lt;code&amp;gt;value&amp;lt;/code&amp;gt; (compare to a target), &amp;lt;code&amp;gt;range&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;cluster&amp;lt;/code&amp;gt; (use a precomputed covariance clustering).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.relative_length_tolerance&amp;lt;/code&amp;gt; || 0.1 || Fractional deviation of cell edge lengths allowed vs. the target cell. Often tightened (e.g. 0.03).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.absolute_angle_tolerance&amp;lt;/code&amp;gt; || 2.0 || Allowed cell-angle deviation (degrees) vs. the target.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.unit_cell.value.target_unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;target_space_group&amp;lt;/code&amp;gt; || Auto || Target cell/symmetry; &amp;lt;code&amp;gt;Auto&amp;lt;/code&amp;gt; uses the scaling model.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.outlier.min_corr&amp;lt;/code&amp;gt; || 0.1 || Minimum correlation of an image&#039;s intensities to the reference model; images below this are rejected. Only applied when a scaling model is present. Use &amp;lt;code&amp;gt;-1&amp;lt;/code&amp;gt; to accept all images regardless of correlation.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;filter.resolution.d_min&amp;lt;/code&amp;gt; || None || Reject an experiment unless some of its reflections extend beyond this resolution.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Selecting individual reflections (&amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;select&amp;lt;/code&amp;gt; section accepts or rejects &#039;&#039;&#039;individual reflections&#039;&#039;&#039; (contrast with&lt;br /&gt;
&amp;lt;code&amp;gt;filter&amp;lt;/code&amp;gt;, which acts on whole experiments).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.algorithm&amp;lt;/code&amp;gt; || (none) || One or more of &amp;lt;code&amp;gt;significance_filter&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;panel&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;cspad_sensor&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;isolation_forest&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;target_energy&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.sigma&amp;lt;/code&amp;gt; || 0.5 || Trim each lattice at the resolution where the binned ⟨I/σ⟩ drops below this value.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;select.significance_filter.min_ct&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;max_ct&amp;lt;/code&amp;gt; || 10 / 50 || Target minimum/maximum mean reflections per resolution bin when choosing the number of bins. For large unit cells these are often raised (e.g. 200/300); for small cells, use the defaults.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Modifying intensities (&amp;lt;code&amp;gt;modify&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.algorithm&amp;lt;/code&amp;gt; || polarization || Per-reflection corrections to apply (default applies the polarization correction).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.cosym&amp;lt;/code&amp;gt; || — || Resolve an indexing ambiguity across the ensemble using the Gildea/Winter (Brehm/Diederichs) cosym method, optionally anchored to &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;modify.reindex_to_reference&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;reindex_to_abc&amp;lt;/code&amp;gt; || — || Alternative re-indexing operators (to a reference model, or an explicit operator).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Scaling (&amp;lt;code&amp;gt;scaling&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.model&amp;lt;/code&amp;gt; || None || Reference dataset: a PDB file (uses the CRYST1 cell and computes model intensities, including bulk solvent) or an MTZ from a previous cycle. Required for &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt; scaling.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.algorithm&amp;lt;/code&amp;gt; || mark0 || &amp;lt;code&amp;gt;mark0&amp;lt;/code&amp;gt;: per-image scaling against the reference. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;: no scaling, just Monte-Carlo averaging (all scale factors = 1) — used for reference-free bootstrap.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.unit_cell&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;scaling.space_group&amp;lt;/code&amp;gt; || None || Cell/symmetry to use when no model is provided (i.e. &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt;).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.resolution_scalar&amp;lt;/code&amp;gt; || 0.969 || &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; is multiplied by this when deciding which reflections fall within the resolution limit, generating a few extra reference reflections to account for per-shot cell variation (e.g. set 0.96 for a few more).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;scaling.mtz.mtz_column_F&amp;lt;/code&amp;gt; || fobs || Column name in the reference MTZ containing the reference structure factors (intensities or amplitudes).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Post-refinement (&amp;lt;code&amp;gt;postrefinement&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.enable&amp;lt;/code&amp;gt; || True || Enable post-refinement of per-image parameters/partialities (Sauter 2015).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postrefinement.algorithm&amp;lt;/code&amp;gt; || rs || Post-refinement protocol: &amp;lt;code&amp;gt;rs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;rs_hybrid&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;eta_deff&amp;lt;/code&amp;gt;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Merging and error model (&amp;lt;code&amp;gt;merging&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_min&amp;lt;/code&amp;gt; || None || High-resolution limit for scaling and merging.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.d_max&amp;lt;/code&amp;gt; || None || Low-resolution limit (currently affects only CCiso).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.merge_anomalous&amp;lt;/code&amp;gt; || False || &amp;lt;code&amp;gt;True&amp;lt;/code&amp;gt; merges Bijvoet mates together (higher multiplicity); &amp;lt;code&amp;gt;False&amp;lt;/code&amp;gt; keeps them separate to preserve the anomalous signal.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.minimum_multiplicity&amp;lt;/code&amp;gt; || 2 || Do not produce a merged structure factor for HKLs measured fewer than this many times.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.error.model&amp;lt;/code&amp;gt; || mm24 || Merged-sigma error model: &amp;lt;code&amp;gt;mm24&amp;lt;/code&amp;gt; (Mittan-Moreau 2024, current default), &amp;lt;code&amp;gt;ev11&amp;lt;/code&amp;gt; (Evans 2011 / sdfac-refine, recommended in the README), &amp;lt;code&amp;gt;ha14&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;errors_from_sample_residuals&amp;lt;/code&amp;gt; (no refined error terms — used with &amp;lt;code&amp;gt;mark1&amp;lt;/code&amp;gt; bootstrap).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;merging.set_average_unit_cell&amp;lt;/code&amp;gt; || True || Output MTZ adopts the (cluster-derived) average unit cell of the data rather than the reference model&#039;s cell.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Statistics (&amp;lt;code&amp;gt;statistics&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.n_bins&amp;lt;/code&amp;gt; || 10 || Number of resolution bins in the statistics tables.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.cciso.mtz_file&amp;lt;/code&amp;gt; || None || Isomorphous reference structure factors for R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt; / CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;statistics.report_ML&amp;lt;/code&amp;gt; || True || Report per-frame max-likelihood attributes (domain size, mosaicity).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Output (&amp;lt;code&amp;gt;output&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.output_dir&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;.&amp;lt;/code&amp;gt; || Directory for output files (created if it does not exist).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; || iobs || Prefix prepended to all output file names.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.save_experiments_and_reflections&amp;lt;/code&amp;gt; || False || Dump the final experiments/reflections from the last worker as DIALS files — used for the two-stage scale-then-merge workflow.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.do_timing&amp;lt;/code&amp;gt; || False || Log elapsed time per execution step.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;output.expanded_bookkeeping&amp;lt;/code&amp;gt; || False || Store extra provenance columns (input file/reflection indices, odd/even flag, original id) in the saved reflection tables.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Multiprocessing (&amp;lt;code&amp;gt;mp&amp;lt;/code&amp;gt;) ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.method&amp;lt;/code&amp;gt; || mpi || Multiprocessing method (only &amp;lt;code&amp;gt;mpi&amp;lt;/code&amp;gt; is currently supported).&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mp.debug.cProfile&amp;lt;/code&amp;gt; || False || Enable code profiling; a &amp;lt;code&amp;gt;.prof&amp;lt;/code&amp;gt; file is written per rank.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Output files ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;merge&amp;lt;/code&amp;gt; worker gathers all HKLs at rank 0 and writes three MTZ files, prefixed with&lt;br /&gt;
&amp;lt;code&amp;gt;output.prefix&amp;lt;/code&amp;gt; (default &amp;lt;code&amp;gt;iobs&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_all.mtz&amp;lt;/code&amp;gt; — the merged dataset using all observations (the main result for structure solution)&lt;br /&gt;
* &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_odd.mtz&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;amp;lt;prefix&amp;amp;gt;_even.mtz&amp;lt;/code&amp;gt; — the two half-datasets used for CC½ and related half-dataset statistics&lt;br /&gt;
&lt;br /&gt;
A main log records the per-step progress and the merging statistics tables by resolution bin:&lt;br /&gt;
completeness, multiplicity and ⟨I/σ⟩, plus the &amp;quot;Table of Scaling Results&amp;quot; reporting CC½ (the&lt;br /&gt;
half-dataset correlation, labelled &amp;quot;CC int&amp;quot;), CC&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;int&amp;lt;/sub&amp;gt;, R&amp;lt;sub&amp;gt;split&amp;lt;/sub&amp;gt;&lt;br /&gt;
and R&amp;lt;sub&amp;gt;iso&amp;lt;/sub&amp;gt;.  The merged MTZ can optionally be&lt;br /&gt;
uploaded to a shared [https://github.com/cctbx/cctbx_project/tree/master/xfel/merging/application/publish Google Drive folder] by adding the &amp;lt;code&amp;gt;publish&amp;lt;/code&amp;gt; worker.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&lt;br /&gt;
* Sauter NK (2015). &#039;&#039;J Synchrotron Radiat&#039;&#039; &#039;&#039;&#039;22&#039;&#039;&#039;, 239–48. (post-refinement)&lt;br /&gt;
* Uervirojnangkoorn M, &#039;&#039;et al.&#039;&#039; (2015). &#039;&#039;eLife&#039;&#039; 10.7554/eLife.05421. (PRIME / bootstrap)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2018). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;74&#039;&#039;&#039;, 877–894.&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019a). &#039;&#039;Computational Crystallography Newsletter&#039;&#039; &#039;&#039;&#039;10&#039;&#039;&#039;, 22–39. (XFEL GUI)&lt;br /&gt;
* Brewster AS, &#039;&#039;et al.&#039;&#039; (2019b). &#039;&#039;Acta Cryst.&#039;&#039; D &#039;&#039;&#039;75&#039;&#039;&#039;, 959–968. (error models)&lt;br /&gt;
* Mittan-Moreau (2024). (mm24 error model)&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[dials.stills_process]] — produces the integrated data that &amp;lt;code&amp;gt;cctbx.xfel.merge&amp;lt;/code&amp;gt; consumes&lt;br /&gt;
* [[cctbx.xfel GUI]] — orchestrates separate scaling and repeated merging as data are collected&lt;br /&gt;
* The program README at &amp;lt;code&amp;gt;xfel/merging/README.md&amp;lt;/code&amp;gt; in cctbx_project&lt;/div&gt;</summary>
		<author><name>Aaron</name></author>
	</entry>
</feed>