Content
In this note we show how peak finder versions v2,3,4 work on fiber diffraction experiment exp=cxif5315:run=169 data.
Test data
exp=cxif5315:run=169
Use of peak finders
See for detail
- Hit/Peak Finding Details - description of algorithms
- ImgAlgos.PyAlgos - interface methods
We work with peak finder versions v2,3,4. Data processing and peak finding is done in
cxif5315/proc-cxif5315-r0169-data-pfvn-2016-03-28.py
from ImgAlgos.PyAlgos import PyAlgos alg_arc = PyAlgos(windows=winds_arc, mask=mask_arc, pbits=2) alg_arc.set_peak_selection_pars(npix_min=4, npix_max=500, amax_thr=0, atot_thr=600, son_min=5) # for pfv2,4 #alg_arc.set_peak_selection_pars(npix_min=4, npix_max=500, amax_thr=0, atot_thr=600, son_min=10) # for pfv3 alg_equ = # all parameters are the same as for alg_arc peaks_arc = alg_arc.peak_finder_v2(nda, thr=10, r0=6, dr=0.5) # Flood-filling #peaks_arc = alg_arc.peak_finder_v3(nda, rank=6, r0=6, dr=0.5) # Ranker #peaks_arc = alg_arc.peak_finder_v4(nda, thr_low=10, thr_high=150, rank=5, r0=6, dr=0.5) # Droplet-finder
This script saves a peak list:
# Exp Run Date Time time(sec) time(nsec) fiduc Evnum Reg Seg Row Col Npix Amax Atot rcent ccent rsigma csigma rmin rmax cmin cmax bkgd rms son imrow imcol x[um] y[um] r[um] phi[deg] cxif5315 169 2015-02-22 02:20:47 1424600447 478050876 104418 0 EQU 1 162 30 38 257.1 2901.5 160.8 29.7 2.21 1.25 157 168 25 36 9.42 26.64 9.30 574 640 7582 550 7601 4.15 cxif5315 169 2015-02-22 02:20:47 1424600447 486382070 104421 1 ARC 7 126 386 22 153.6 818.7 126.5 383.6 2.76 1.77 121 132 381 388 1.80 19.08 7.95 143 618 5157 47858 48135 83.85 cxif5315 169 2015-02-22 02:20:47 1424600447 486382070 104421 1 EQU 1 159 28 50 172.0 2808.5 159.3 28.0 2.93 1.68 154 165 23 34 3.37 27.07 6.23 576 643 7912 331 7919 2.40 cxif5315 169 2015-02-22 02:20:47 1424600447 494719789 104424 2 EQU 1 150 33 44 154.4 1624.7 150.5 32.8 3.07 1.72 145 156 28 39 4.33 21.19 7.08 571 652 8900 883 8943 5.67
Peak list processing
For further peak list processing we use script:
cxif5315/proc-cxif5315-r0169-peaks-from-file-v4.py
which uses peak selectors.
Peak Selectors
In this section we list distribution of peak parameters right after peak finders and discuss parameter range for further selection stage in
and
We process Data of cxif5315-r0169 for peaks in ARC and Equatorial region separately. Each triplet of histograms represents peak finder v2, v3, v4, respectively.
peak_finder_v2, v3, v4: ARC
- Amax is only used in pfv4 as
thr_high=150
that helps to reduce a number of seed peaks
- Atot is used in all peak-finders as
atot_thr=600
if pk.atot<1200 : return False
most likely can be harmlessly increased to 1500-1800ADU
- rms is used in all peak-finders at processing in peak selector
if pk.rms>60 : return False
- bkgd is used in all peak-finders at processing in peak selector
if math.fabs(pk.bkgd)>20 : return False
- npix is used in all peak-finders in peak selector
npix_min=4, npix_max=500
if pk.npix>200 : return False
- S/N is used as
son_min=5 # for pfv2,4
son_min=10 # for pfv3
- Ranker - to eliminate large number of purely statistical seed peaks
- S/N evaluated for all pixels
if pk.sonc<5 : return False
if pk.r<435 : return False if pk.r>443 : return False
peak_finder_v2, v3, v4: EQU
- Amax is only used in pfv4 as
thr_high=150
- Atot is used in all peak-finders as
atot_thr=600
if pk.atot<1800 : return False
if pk.rms>60 : return False
- bkgd is used in all peak-finders at processing in peak selector
if math.fabs(pk.bkgd)>20 : return False
- npix is used in all peak finders in peak selector
npix_min=4, npix_max=500
if pk.npix>200 : return False
son_min=5
# for pfv2,4
son_min=10# for pfv3
- Ranker - to eliminate large number of purely statistical seed peaks
if pk.r<100 : return False
if pk.r>454 : return False
- Peak azimuthal angle is not used in selectors
Comparison of the pfv2 with Cheetah list of peaks
Code for comparison: cxif5315/peak-list-comp-cheetah.py
Peak lists for comparison:
- peakfinder:
pfv2-cxif5315-r0169-2016-03-28T15:02:47.txt
- cheetah: r0169-cheetah-peaks.txt - with unknown origin...
Comparison algorithm and conditions
Use pyimgalgos.TDFileContainer for both peakfinder and cheetah
fc_ch = TDFileContainer(fncheet, indhdr='frameNumber', objtype=TDCheetahPeakRecord) # , pbits=256) fc_pf = TDFileContainer(fnpeaks, indhdr='Evnum', objtype=TDPeakRecord) #, pbits=256)
- Loop over all groups (frames/events) in cheetah
- Find associated peak-finder group: gr_pf = fc_pf.group(evnum-1) # accounts for -1 offset in event numeration in Cheetah and pf.
- count cases when peak-finder group does not exist (peaks not found)
- discard frames if fidelity do not match
- discard frames with more than 5 peaks
- loop over cheetah peaks
- discard cheetah peaks outside ROI mask
- loop over pf-peaks and check that cheetah peak can be matched with one of them by location (s, r, c)
- if not-matched - print peak main features
Statistics for number of peaks:
- total in Cheetah: 14002
- matched: 10593
- not-matched: 3409
- fraction of matched: 0.757
Plots for number of peaks in peak-finder, Cheetah, and number of non-matched:matched Cheetah peaks.
Peak-finder number of peaks accounts for arc region.