Detector and pixel corrections

Some detectors are better than others.  All results trace back to the detectors, and errors in the detector propagate through all results. A little effort goes a long way towards improving results. 

 

dark calibration file

Signal on the detector with no incident photons.


Usually electronic offsets.  Detector offsets can change, especially when detector systems are swapped or per-pixel gain settings are adjusted.  It is good practice to use a new dark calibration for each new experiment.   The weaker your signals the more important this becomes - single photon signals are only a few detector values (ADU) in size and can get easily lost when using the wrong dark calibration file. In extreme cases, more frequent darkcals may be needed.


In the .ini file:

    # Dark calibration

    darkcal=../../calib/darkcal/current-darkcal.h5



Configuration for producing a darkcal file is in: darkcal.ini

> less /reg/g/cfel/cheetah/template/cheetah/process/darkcal.ini

    [front]

    detectorType=cspad

    detectorName=CxiDs1

    saveDetectorRaw=0

    saveDetectorCorrected=1

    saveDetectorAndPhotonCorrected=0

    saveAssembled=0


    []

    hitfinder=0

    generateDarkcal=1

    powderSumHits=1

    powderSumBlanks=1

    saveInterval=500

    nThreads=16


Note: the mean and standard deviation contained in the *-class0-sum.h5 file is very useful for finding bad pixels.

bad pixel mask

Bad pixels are flagged in the pixel mask and set to zero at the start of analysis. Bad pixels are always ignored in analysis (radial averages, peak finding, images etc). Zeroing the pixels solves problems with auto-ranging viewers displaying the image on a useful image scale (outliers throw off autoranging and these pixels are definitely bad so kill them).


In the .ini file:

    # Bad pixel maps

    badpixelmap=../../calib/mask/current-badpix.h5


Every detector has bad pixels.  These need to be identified so that they can be avoided during analysis.


Bad pixels can be identified from dark frames as pixels that are either excessively noisy or have offsets significantly different to their neighbours.  Use darkcal.ini to process a dark run, then “Tools-->Make bad pixel mask from Darkcal” to identify misbehaving pixels.


Dead pixels behave the same whether or not they are illuminated and are therefore useless for signal measurement.  However they can’t be identified from the dark calibration file because they look identical to normal pixels when not illuminated.  Dead pixels can be identified from runs in which photons are incident on each pixel (for example, water scattering).  Use brightfield.ini to sum up one such run, then “Tools--> Make bad pixel mask from brightfield” to identify pixels which remain dark even when illuminated.  There are corner cases which go wrong - the results of this need to be inspected.


Masks can be combined using the “Tools-->Combine masks” utility.  Use ‘Shift’ to select the masks to be combined.

geometry

Is absolutely critical for analysis, although hit finding itself is normally not very sensitive to a perfect geometry.


Unlike crystal indexing, and Cheetah can happily run using the provided default geometry files.  Indeed this is often adequate.  However, radial background subtraction is sensitive to geometry, and can be quite so in the presence of concentric ‘powder rings’ from ice or other polycrystalline sample in the beam.  SAXS/WAXS traces also benefit from use of a refined geometry so that radial averages are averaged across the same scattering angles.


In the .ini file:

    # Detector geometry

    geometry=../../calib/geometry/current-geometry.h5


Accurate geometry files are best obtained using the results of crystal indexing.  Geometry refinement is extensively discussed on the CrystFEL web pages.

Peak mask (‘Do not analyse data here’)

Badly named variable called peakmask because it (initially) defined the regions to ignore for peak finding, for example jet streaks or shadows on the detector. Also used to define regions to be excluded from other analysis (single particle hit finding, radial averages, etc).  Defines regions to ignore in analysis, but pass data through to the final image (as opposed to bad pixels, which are zeroed).


In the .ini file:

   # Peakfinding region mask

   peakmask=../../calib/mask/current-peakmask.h5


In practice this is pretty important: Shadowed pixels should not be included in radial averages, for example; while jet regions often result in false peaks and will also give bad values if you try to integrate reflectoins on top of the jet. 


Peak mask regions are flagged in the pixel mask array using a different value so they can be treated differently in subsequent analysis (eg: do not integrate reflections in shadows or the jet region).  Masks can be combined using the “Tools-->Combine masks” utility.  Use ‘Shift’ to select the masks to be combined.