Skip to content

Averages and masking

Aaron S. Brewster edited this page Sep 3, 2019 · 5 revisions

Averaging

Let $calib be the calibration folder for L785 and $scratch be a working directory. Follow these steps to create average images:

cd $calib/geometry
<verify 0-end.data contains the proper calibration information>

Unrefined, original metrology is in file 1. Quadrant corrected metrology is in file 2. Final refined metrology is in file 3. Softlink the desired metrology to 0-end.data

ln -fns file1.dat 0-end.data

Now do the averaging on the cluster. Here, LCLS's LSF cluster is used. Adapt the bsub command to your own queuing environment.

cd $scratch
mkdir averages; cd averages
mkdir ds1; cd ds1; mkdir avg_logs
for i in `seq 11 22` `seq 26 29`; do bsub -n 12 -q psanaq -o avg_logs/r_00$i.out mpirun -n 12 cxi.mpi_average -x cxi78513 -r $i -a CxiDs1.0:Cspad.0 -d 580; done
cd ..; mkdir dsd; cd dsd; mkdir avg_logs
for i in `seq 11 22` `seq 26 29`; do bsub -n 12 -q psanaq -o avg_logs/r_00$i.out mpirun -n 12 cxi.mpi_average -x cxi78513 -r $i -a CxiDsd.0:Cspad.0 -d 2550; done

These commands use cxi.mpi_average to average the front and back detectors for all the runs. Documentation for cxi.mpi_average is available using the -h parameter. For more, see Brewster 2016.

Untrusted pixel mask

Generate a raw image (I.E. without pedestal correction) of run 10, which is a dark run (a.k.a. a run with no photons) by using cxi.mpi_average with the -R option.

cd $scratch/averages/ds1
bsub -n 12 -q psanaq -o avg_logs/r_0010.out mpirun -n 12 cxi.mpi_average -x cxi78513 -r 10 -a CxiDs1.0:Cspad.0 -d 580 -R

Now generate the mask, including masking one pixel around the border of each tile, using the dark average from run 10 and the light standard deviations and maximums from run 14. Again see Brewster 2016 for details.

cxi.make_dials_mask cxi78513_avg-r0010.cbf cxi78513_stddev-r0010.cbf cxi78513_max-r0014.cbf -m 10 -b 1
cd ../..; mkdir masks; cd masks
mv ../averages/ds1/mask.pickle .
Clone this wiki locally