Skip to content

Stitching

etortorici edited this page May 21, 2024 · 2 revisions

The XRDpy stitching should be utilized instead of the system's built in stitched image if you plan on fitting the data with appropriate weights.

Built in stitching

The system utilizes a Dectris Eiger R 1M CCD array to produce images of the X-ray scattering for WAXS/SAXS/GIWAXS/GISAXS experiments. The detector has 1065 rows and 1030 columns of pixels. However, there is a band of 37 pixel rows that are not active in the middle of the array. The eiger_stitch command for the saxs program produces raw TIFF files with the file format R_C_S where R represents a row, C a column, and S is a number either 1 or 2 for the two images used to stitch together data in the band of inactive pixels. A motor moves the detector to two positions per stitch so that the two images overlap in a way to fill in the band. Any additional rows or columns of stitching will have a 10 pixel overlap. This causes 3 distinct regions in the stitch:

  • Regions that get half the counts (54 rows of pixels in the middle, and 37 rows at the top and bottom)
  • Regions that get the normal amount of counts (parts where the two stitched images overlap)
  • Regions that get double counts (10 columns of pixels where separate stitch images overlap)

eiger_stitch will produce a stitched image which accounts for these regions by multiplying the half-count regions by 2 and the double-count regions by 0.5; however, there are some issues with this if you care about getting appropriate error bars and want to avoid some visual artifacts.

XRDpy stitching

XRDpy stitching requires you save the raw R_C_S files. The XRDpy stitching algorithm will:

  • locate dead, hot, and problematic pixels and mask them in each individual raw image
  • stitch the masked, raw images together
  • instead of adjusting the counts, it will track how many images contributed to the counts of each pixel.
  • save an image without having the counts adjusted by relative exposure time (called "raw-stitched-data.tif").
  • produce a "flat field" (called "flat_field.tif") which can tell your analysis software how sensitive each pixel is
    • Pixels which only had 1 image contribute to it are considered "half-sensitive"
    • Pixels which have 2 images contributing to it are considered "full-sensitive"
    • Pixels with $x$ images contributing to it are $\frac{x}{2}$ sensitive

This is consistent with the convention of eiger_stitch, which when you tell it to run for $t$ seconds, it will expose each individual detector position for $t/2$ seconds, so "full-sensitivity" refers to pixels that were exposed for $t$ seconds.

In general, flat fields are produces by flooding a detector with even intensity so that you can establish the relative sensitivity of pixels. The "flat_field.tif" file then can be used as if it were a real flat field in any analysis software to accommodate the fact that different pixels had different exposure times. This allows you to get correct error-bars on data reductions for more accurate fitting.

How to use

  • When you run an experiment using eiger_stitch, make sure to note the exposure time given to the program (this can be put in the file name).
  • After the experiment, save the R_C_S files (f you do a eiger_stitch 1 3 there should be 6 files) in a folder where you store all your data. It can be useful to store the stitched image eiger_stitch produced as well in this folder, but it is not necessary.
  • Open an Anaconda prompt
  • Activate your XRD environment that you made for installation conda activate xrd
  • cd into the directory the data is stored. You can do this by copying the path from the File Explorer and pasting it after cd in your prompt (you may need to put quotes around the path if there are spaces in any directory names).
  • dir (Windows) or ls (Unix) to list the files to confirm the data is there.
  • WAXS [exposure time] or SAXS [exposure time] where [exposure time] is the same time (in seconds) that you gave eiger_stitch to run the experiment (this is the time it takes for two exposures).

This will produce "raw-stitched-data.tif" and "flat_field.tif" in the same directory; it will also copy a Jupyter Notebook template for data reduction. You can edit this template (called "reduce-WAXS.ipynb") by locating it in "Documents\XRDpy\Jupyter-Notebooks".

Clone this wiki locally