User Tools

Site Tools


processing:backgroundgeneral

Background evaluation and subtraction

Diffraction data typically include multiple contributions. These include

  • noise, from the detector, the source, etc
  • diffraction from anything within the path of the x-ray beam, which is not your sample,
  • diffraction from the larger sample grains, that give rise to well-defined diffraction spots,
  • diffraction from the smaller sample grains (i.e. a fine matrix), that does not show up as well-defined diffraction spots but rather continuous diffraction rings.

Most of these should be removed before further processing. Multigrain crystallography relies on the indexing of well-defined diffraction spots.

Average and median images

Background evaluation always involve the calculation of average and median images. In the average image, the intensity at each pixel is the average of the intensity at this pixels for all images in the ω scan. In the median image, the intensity at each pixel is the median of the intensity at this pixels for all images in the ω scan.

The average image is a representation of the data that includes

  • the background,
  • the diffraction from the surrounding matrix (the powder portion of the sample) that gives rise to continuous diffraction rings,
  • the diffraction from the sample grains, that give rise to well-defined diffraction spots.

The median image is a representation of the data that includes

  • the background,
  • the diffraction from the surrounding matrix (the powder portion of the sample) that gives rise to continuous diffraction rings in the image.

The diffraction from the sample grains, that give rise to well-defined diffraction spots are removed and do not contribute to the median image!

Creating an average image can be done with timelessMeanFileSeries which is part of the TIMEleSS tools. Creating the median can be done with median.py which comes with Fabian. You can also calculate median and average images with ImageMath but we have not used it in a while. There is an issue with file formats.

The median image is less affected by outliers than the average and is probably a better representation of your background. For some purposes you might still need to use the average image.

Testing and subtracting the background

The most efficient way is to test your background with Fabian. You can

  • load an example diffraction image,
  • select Image > Correction > Background image
  • select Image > Correction > Subtract background

You will be able to visualize the effect you the background subtraction and whether your evaluation is satisfactory.

Typically, subtracting the ω-median from a single ω-step diffraction image will be efficient at removing

  • noise, from the detector, the source, etc
  • diffraction from anything within the path of the x-ray beam, which is not your sample, as long as it is in the form of a powder,
  • diffraction from the smaller sample grains (i.e. a fine matrix), that does not show up as well-defined diffraction spots but rather continuous diffraction rings.

It will not work, however, for complex environments such as diamond anvil cells for which the diamond anvils give rise to strong and well defined diamond diffraction spots.

When to subtract the background?

There are several options to subtract the background. It depends on your data and your goal which way you take. But whichever way you choose, only subtract the background once!

Some of the tools (such as timelessDiamondSpotRemoval) subtract a background image anyway. So, if you have to use the DiamondSpotRemoval, make sure not to use the other tools (or switch their background subtraction off, if possible).

DiamondSpotRemoval

timelessDiamondSpotRemoval is part of the TIMEleSS tools. It is specific to diamond anvil cell experiments.

For more information on how and when to use it, check out the page for how to clean up your diamond anvil cell data. timelessDiamondSpotRemoval requires a background image as input. In the process, the background you selected is subtracted from each of your images .

I don't want to subtract the background - What can I do?

It might be a rare case but sometimes it might be necessary to perform the the Diamond Spot Removal but no background subtraction (for example if the intensity after subtracting the background is too low for further processing). Luckily, there is a way to trick the script: You can create an empty image (there is a TIMEleSS tool for this) and use it as an input for the background. However, this has also a downside: The Diamond Spot Removal does not work as well. So do this only if it is really necessary.

Peaksearch

Peaksearch also has an option for background subtraction. In the input of the command line, you have to add an option -d somebackgroundimage.edf which will then subtract somebackgroundimage.edf from each of the images before applying the peaksearch algorithm.

processing/backgroundgeneral.txt · Last modified: 2019/09/05 12:55 by smerkel