You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Peakfinder

A set of peak-finding algorithms developed for analysis of data from LCLS pixel array detectors.

Interface

from ... import peakfinder

peaks = peakfinder(*args, **kwargs)
peaks = peakfinder(mode, data, mask=mask, **kwargs)

Input

arguments:

mode

       selects the algorithm of the "seed" peak definition:

'Droplet' - uses keyword arguments thr, thr_high, rank, r0, dr, and peak selection parameters

'FloodFilling' - uses keyword arguments thr, r0, dr, and peak selection parameters

'Ranker' - uses keyword arguments rank, r0, dr, nsigm, and peak selection parameters

data

2-d numpy.array - data for processing

n-d numpy.array - (n>2) a set of 2-d arrays of data for processing. Last two indexes are used as 2-d row and column

[2-d numpy.array] - list of 2-d arrays of data for processing

keyword arguments for peak finding:

mask

None | the same structure as data - pixel mask with 0/1 for bad/good pixel

rank

 3 | radial size of the region (2*rank+1 rows and columns) around pixel for peak finding.

thr

 10 | threshold on pixel intensity

thr_high

 100 | high threshold on pixel intensity for 'Droplet' finder

 r0 

 7 |  internal radius of the ring for evaluation of background and noise rms

dr 

  2 |  width of the ring for evaluation of background and noise rms

nsigm

 10 | threshold in number of noise rms

keyword arguments for peak selection:   
 

npix_min 

  5  | minimal number of pixels in the peak  

npix_max 

 5000  | maximal number of pixels in the peak 

amax_thr 

 0  |  threshold on pixel with maximal intensity   

atot_thr  

0  |  threshold on total peak intensity  

son_min 

 10  |  threshold on S/N value

Output

peaks

list of peak objects, where peak is a container of attributes.

peak attributes:

    • seg - segment index beginning from 0, e.g. in CSPAD this index should be in the range (0,32)
    • row - index of row beginning from 0
    • col - index of column beginning from 0
    • npix - number of pixels accounted in the peak
    • amp_max - pixel with maximal intensity
    • amp_total - total intensity of all pixels accounted in the peak
    • row_cgrav - row coordinate of the peak evaluated as a "center of gravity" over pixels accounted in the peak using their intensities as weights
    • col_cgrav - column coordinate of the peak evaluated as a "center of gravity" over pixels accounted in the peak using their intensities as weights
    • raw_sigma - row sigma evaluated in the "center of gravity" algorithm
    • col_sigma - column sigma evaluated in the "center of gravity" algorithm
    • row_min - minimal row of the pixel group accounted in the peak
    • row_max - maximal row of the pixel group accounted in the peak
    • col_min - minimal column of the pixel group accounted in the peak
    • col_max - maximal column of the pixel group accounted in the peak
    • bkgd - background level estimated as explained in section below
    • noise - r.m.s. of the background estimated  as explained in  section below
    • son - signal over noise ratio estimated  as explained in  section below

Peak-finding algorithms

Method peakfinder is a wrapper around a few algorithms described in this section. First argument mode switches between different peak-finding algorithms. Each algorithm works in a few stages. First stage is a search for peak candidates or "seed" peaks and this is a most distinctive part between algorithms:

  • Droplet - two-threshold peak-finding algorithm in restricted by rank region around pixel with maximal intensity. It is assumed that only pixels with intensity above thr_high are pretending to be peak candidate centers. Candidate is considered as a peak if their intensity is maximal in the (square) region of radius around them. Low threshold in the same region is used to account for contributing to peak pixels.
  • Flood Filling - defines peaks for regions of connected pixels above threshold thr. Two neighbor pixels are assumed connected if have common side.
  • Ranker - define peaks in local maximums of specified rank (radius), for example rank=2 means 5x5 pixel region around central pixel.

Other stages for all algorithms are about the same.

  • background mean value and rms are estimated using pixels in the ring with internal radius r0 and width dr,
  • peak parameters are updated with background information; intensity is corrected, signal over noise (S/N) is evaluated,
  • output list of peaks is generated from the list of seed peaks using selection parameters.

References


  • No labels