Skip to content

Run diagnostics

apeck12 edited this page Mar 31, 2022 · 4 revisions

Below we describe a few tools to aid analyzing experimental runs.

Powder calculation

The following computes a powder pattern and visualizes the intensity distribution, including spatially to identify regions of the detector with problematic pixels:

from sfx_utils.diagnostics.run import RunDiagnostics

rd = RunDiagnostics(exp='cxip20719', run=34, det_type='jungfrau4M')
rd.compute_run_stats(n_images=1500, powder_only=True)
rd.visualize_powder()

151268716-e335a91b-356c-4c29-8011-f2b9f282c13b

Trajectory of event statistics

The following can be used to track various event/image statistics over the course of the run:

from sfx_utils.diagnostics.run import RunDiagnostics

rd = RunDiagnostics(exp='mfxp19619', run=19, det_type='epix10k2M')
rd.compute_run_stats(n_images=1500, batch_size=50, max_devs=100)
rd.plot_run_stats(output="run.png") # plots from calibrated images

which produces the plot:

150620406-8e60181f-4dbe-4711-97f3-238fab5fa15b

As with the powder calculation, setting n_images to an absurdly high number will retrieve statistics for all events from the run, and the function will terminate once the end of the run is reached. The statistics are stored in the class variable rd.run_stats for further analysis. The compute_run_stats function performs a step of pixel outlier rejection, with the threshold determined by max_devs. Statistics from the 'clean' run can be plotted as follows:

rd.plot_run_stats(output="run_clean.png", tag='_sel') # plots with additional outlier rejection step