75 lines
4.8 KiB
Markdown
75 lines
4.8 KiB
Markdown
# FPGA data analysis
|
|
|
|
Jungfraujoch FPGA design has incorporated X-ray diffraction image analysis capabilities.
|
|
|
|
## Pixel mask
|
|
Pixels can be masked. For each module a 32-bit map of pixels is loaded to FPGA, with non-zero value meaning masked pixels.
|
|
According to this map, pixels will be assigned a special value (minimum number for signed types and maximum number for non-signed types)
|
|
and will be excluded from a subsequent analysis.
|
|
|
|
## ADU histogram
|
|
Before conversion to photons/energy, an ADU histogram can be calculated for a module. This allows to preserve some signature
|
|
of unconverted values. This is done on a module-basis and works with bins with 32 ADU width.
|
|
|
|
For EIGER this can be used as just a histogram procedure.
|
|
|
|
## JUNGFRAU conversion
|
|
For JUNGFRAU module images are converted from ADUs to energy value and divided by a given number to keV units.
|
|
Result of the operation is rounded to integers.
|
|
|
|
## Pixel thresholding
|
|
Pixel range can be specified.
|
|
Pixels below a minimum threshold will be assigned zero.
|
|
Pixels above a maximum threshold will be assigned saturated pixel value (the largest number for a given bit-width and sign type).
|
|
This is specifically designed to operate on unsummed frames, so frame-specific parameters (overload/noise) can be handled.
|
|
|
|
## Frame summation
|
|
Frames can be summed together (on a per-module basis) in Jungfraujoch, with a limit of 256 frames added together.
|
|
|
|
## Azimuthal integration
|
|
To implement azimuthal integration, FPGA is able to sum pixels based on a provided integration map and per-pixel corrections.
|
|
This way Jungfraujoch implements azimuthal integration with solid angle and polarization corrections.
|
|
Corrections were implemented according to formulas developed by [Jensen et al. (J. Synchr. Rad., 29, 1420-1428, 2022)](https://journals.iucr.org/s/issues/2022/06/00/fv5148/).
|
|
|
|
Given FPGA limitations, split-pixels cannot be implemented and number of bins is limited as 1024 per detector module.
|
|
This way 2D azimuthal integration, as needed for example by SAS-TT, cannot be currently implemented with the FPGA card and needs to be done on a CPU.
|
|
One needs to be careful with per-pixel corrections - their acceptable range is constrained by 16-bit pixed point integer implementation
|
|
and is tuned for standard SAXS/WAXS range.
|
|
|
|
## Spot finding
|
|
Jungfraujoch FPGA implements a built-in spot finder. Spot finder allows to apply the following criteria for finding strong pixels:
|
|
1. Resolution criterion - pixels only within a provided resolution range can be considered as strong pixels (calculating resolution map needs to happen on CPU before data collection run).
|
|
2. Bad pixels - pixels marked as bad, as well as chip edges and module edges are excluded from spot finding,
|
|
3. Overloads - pixels marked as overloads on JUNGFRAU are always included in the strong pixel output, but are excluded for signal-to-noise ratio calculation,
|
|
4. Pixel value - pixels above certain threshold value can be marked as strong,
|
|
5. Signal-to-noise (SNR) ratio - pixels with SNR above a threshold can be marked as strong,
|
|
6. Connected pixels - strong pixels can be discarded if they are "alone", so their 8 directly neighboring pixels are not counted as strong pixels.
|
|
|
|
While besides bad pixels criterion, all the above are optional (can be turned off), only pixels that fulfill all enabled criteria are selected as strong pixels.
|
|
|
|
### SNR ratio calculation
|
|
Signal-to-noise ratio is calculated for a rectangular area.
|
|
In horizontal direction the area is fixed - line of 1024 pixels is divided into 32 areas each of 32 pixels.
|
|
This is dictated by the data flow within the FPGA.
|
|
In vertical direction the area is flexible - it is 15 lines above and below of the given pixel.
|
|
Given very large box size, approximation are made, for example that `N ≈ N-1` in calculating standard deviation.
|
|
|
|
## Region-of-interest (ROI) integration
|
|
Each pixel in a module can be assigned to one of 64 ROIs. For each ROIs, sum, sum of squares, max count, and number of valid pixels will be calculated.
|
|
Jungfraujoch also calculates X and Y values weighted by pixel values, though this feature is not properly tested at the moment and not integrated in downstream analysis.
|
|
|
|
## Pixel statisitics
|
|
The following statistics are collected for each module:
|
|
* Number of masked pixels
|
|
* Number of saturated pixels (excl.masked)
|
|
* Number of error pixels (excl. masked)
|
|
* Sum of valid pixels in the module
|
|
* Minimum value of valid pixels in the module
|
|
* Maximum value of valid pixels in the module
|
|
Valid pixels are not masked, not saturated, not error pixels.
|
|
|
|
## Square root compression
|
|
Jungfraujoch FPGA includes lossy compression preserving counting statistic properties of X-ray image, while reducing bit width of an image.
|
|
Scheme was described in [Wakonig et al., J. Appl. Cryst., 53, 574-586, 2020](https://doi.org/10.1107/S1600576720001776).
|
|
Pixel value `X` is replaced with `sqrt(N*X)`, where `N` is integer constant in range 1 to 16.
|