# Peak Finding

## Introduction

Peak finding algorithms locate regions of charge in an area detector. In LCLS data all area detectors are represented by n-d arrays (typically a 2-dimensional array for image, or a 3-dimensional array for multi-panel detectors) so these python-callable algorithms will work on n-d arrays.

This is a short overview.  Additional details are here and simple examples are here.

## Algorithms

All peak finders and a few other image processing algorithms are available in a single class suite supporting common infrastructure. All algorithms work with good pixels defined by a mask and inside specified rectangular windows. Both these mechanisms (windows and mask) can be used to describe a region of interest. By default, if mask or/and windows are not specified, all pixels are processed. A few versions of the peak finder use different approach to the peak definition (finding group of pixels forming a peak) at a first stage, but can use the same algorithms at final stage for evaluation of peak parameters, as explained below.

##### Peak Finder "V1"

This algorithm uses a "seed" threshold to start finding peaks, and then a lower "neighbor" threshold to add additional pixels to the peak inside the square region defined by the radial parameter.

##### Peak Finder "V2"

This algorithm uses a single low threshold and joins contiguous pixels with intensity above threshold using a "flood-fill" algorithm.

##### Peak Finder "V3"

This algorithm first finds the largest intensity pixel in a square region set by a "rank" parameter:  peaks include all pixels with intensity above zero in the square region spanning from −rank to +rank in both the row and column directions relative to the maximal intensity pixel.

##### Peak Finder "V4"

The same algorithm as Peak Finder V1, but the radial parameter for peak finder is separated form the radial parameter for background estimation, which is done in the second stage.

In a second stage, all pixels associated with a peak are used to evaluate the row and column of the peak maximum, total intensity, center of gravity coordinates, and edges of the peak region.  A surrounding user-specified ring-region of pixels around the peak is used to evaluate average background level, its rms spread, and signal-over-noise ratio. The user will typically reduce the number of peaks returned from these algorithms by applying cuts to signal levels or signal-over-noise ratio.

• No labels