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

Compare with Current View Page History

« Previous Version 8 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 : str - selects the algorithm of the "seed" peak definition:

'Droplet' - uses keyword arguments thr_low, thr_high, rank, 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 : numpy.array(shape,dtype=np.uint16) | None - expected the same structure as data - pixel mask with 0/1 for bad/good pixel

rank : int -  radial size of the region (2*rank+1 rows and columns) around pixel for peak finding

thr_low : float low threshold on pixel intensity for 'Droplet'finder

thr_high : float - high threshold on pixel intensity for 'Droplet'finder

 r0 : float - internal radius of the ring for evaluation of background and noise rms

dr : float - width of the ring for evaluation of background and noise rms

nsigm : float - threshold in number of noise rms

keyword arguments for peak selection:   
 

npix_min : int- minimal number of pixels in the peak  

npix_max : int -   maximal number of pixels in the peak 

amax_thr : float -  threshold on pixel with maximal intensity   

atot_thr : float - threshold on total peak intensity  

son_min  : float   - threshold on S/N value

Output

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

peak attributes:

    • seg : int - 2-d segment index beginning from 0, e.g. in CSPAD this index should be in the range from 0 to 31
    • row : int - row (beginning from 0) of the pixel with maximal intensity
    • col : int - column (beginning from 0) of the pixel with maximal intensity
    • npix : int - number of pixels accounted in the peak
    • amp_max : float - maximal intensity among peak pixels
    • amp_total : float - total intensity of all pixels accounted in the peak
    • row_cgrav : float - row coordinate of the peak evaluated as a "center of gravity" over pixels accounted in the peak using their intensities as weights
    • col_cgrav : float - column coordinate of the peak evaluated as a "center of gravity" over pixels accounted in the peak using their intensities as weights
    • raw_sigma : float - row coordinate spread rms evaluated in the "center of gravity" algorithm
    • col_sigma : float - column coordinate spread rms evaluated in the "center of gravity" algorithm
    • row_min : int - minimal row of the pixel group accounted in the peak
    • row_max : int - maximal row of the pixel group accounted in the peak
    • col_min : int - minimal column of the pixel group accounted in the peak
    • col_max : int- maximal column of the pixel group accounted in the peak
    • bkgd : float - background averaged level estimated for pixels in the ring region (parameters r0, dr)  around peak center
    • noise : float - r.m.s. of the background estimated for pixels in the ring region (parameters r0, dr) around peak center
    • son : float - signal over noise ratio estimated for pixels in the ring region (parameters r0, dr) around peak center
    • pixinds : list - list of peak index tuple (seg, row, col) for pixels accounted in the peak

Peak-finding algorithms

Method peakfinder is a wrapper around a few algorithms. 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 - or droplet-finder is a two-threshold algorithm searching for a group of connected pixels with intensity above thr_low around central pixel with group-maximal intensity exceeding thr_high in the region restricted by the radial parameter rank. In the loop over all pixels each pixel with intensity grater or equal thr_high is considered as a peak candidate. For each candidate recursive algorithm is launched and searches for a group of connected pixels with intensity grater or equal thr_low in the square region (2*rank+1 pixels in rows and columns). Pixels of the group are marked as busy on 2-d map. Pixel-candidate should have maximal intensity in the group of connected pixels, otherwise recursion is terminated and all group pixels released for further search. Two neighbor pixels with intensity above thr_low and having common boarder are assumed connected. Pixels having a single common vertex are assumed disconnected.
  • Ranker - searches peak candidate among local pixel intensity maximums of specified rank

    in the square region of specified radial parameter rank (2*rank+1 pixels in rows and columns). Group of connected pixels above nsigm threshold in the rank restricted region is used to form the peak.

Other stages of all algorithms are about the same.

  • background mean value bkgd and noise are estimated using pixels in the ring with internal radius r0 and width dr,
  • returned values of  amp_max and amp_total are background corrected,
  • signal over noise son is evaluated as amp_total/noise,
  • output list of peaks is generated from the list of seed peaks using selection parameters.

References


  • No labels