Content

Analysis of cxif5315

New peakfinder

New peakfinder peak_finder_v2 from  class ImgAlgos.PyAlgos is used in this analysis with functionality as follows

  • raw detector data is corrected for pedestals, background, and common mode,
  • algorithm works in windows for good pixels defined in mask,
  • each group of connected pixels above threshold thr are considered as a peak candidate, which parameters are evaluated and saved in the text file along with experiment, run, event time stamp information

    # 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]

Example of peakfinder in the data processing script:

# initialization
winds_arc  = [ (s, 0, 185, 0, 388) for s in (0,1,7,8,9,15,16,17,23,24,25,31)]

alg_arc = PyAlgos(windows=winds_arc, mask=mask_arc, pbits=0)
alg_arc.set_peak_selection_pars(npix_min=5, npix_max=500, amax_thr=0, atot_thr=1000, son_min=6)
...

# in the event loop:
peaks_arc = alg_arc.peak_finder_v2(nda, thr=20, r0=5, dr=0.05)

#similar for EQUatorial region:
peaks_equ = alg_equ.peak_finder_v2(nda, thr=20, r0=5, dr=0.05)

 

 

Background subtraction algorithm

Averaged n-d array for (data) cxif5315-r0169 is used as a background. Normalization between data and background is done in four rectangular windows, highlighted in the plot:

from pyimgalgos.GlobalUtils import subtract_bkgd

# use part of segments 4 and 20 to subtr bkgd
winds_bkgd = [ (s, 10, 100, 270, 370) for s in (4,12,20,28)] 

        #calibration of raw data
        nda =  np.array(nda_raw, dtype=np.float32, copy=True)
        nda -= nda_peds
        nda =  subtract_bkgd(nda, nda_bkgd, mask=nda_smask, winds=winds_bkgd, pbits=0)
        nda *= nda_smask
        det.common_mode_apply(evt, nda)

 

Scripts

Data processing script uses direct access to data. Example is available since release ana-0.16.1 in

ImgAlgos/examples/ex_peakfinder_cspad.py

 

Results

Arc region

Peak data processing script is under development. Results for ARC region:

Plots for all peaks found by peakfinder in ARC region before selection:

Good peaks are selected as

def peakIsSelectedArc() :
    """Apply peak selection criteria to each peak from file
    """
    if sp.sonc<9    : return False
    if sp.atot<1800 : return False
    if sp.r<434     : return False
    if sp.r>442     : return False
    return True

where all threshold parameters were optimized to select maximum signal events at minimal background in two-peak distance distribution.

Plots for selected peaks

Single-peak events:

Two-peak events:

New peakfinder more than doubles the number of signal events in the distance distribution.

Equ region

Peak selection in equatorial region

def peakIsSelectedEqu() :
    """Apply peak selection criteria to each peak from file
    """
    if sp.sonc<9    : return False
    if sp.atot<1800 : return False
    if sp.r<100     : return False
    if sp.r>450     : return False
    return True

Event selection

def eventIsSelected() :
    """Apply selection criteria to entire event, based on list of peaks 
    """
    sp.event_is_selected = False
    if sp.count_arc_pks_sel  > 2 : return False
    if sp.count_equ_pks_sel  > 5 : return False
    #if sp.count_equ_pks_sel  < 0 : return False
    # Require all peaks in the narrow range of dphi[deg] 
    for pk in sp.lst_equ_evt_peaks :
        if math.fabs(pk.dphicmb) > 6 : return False
    sp.event_is_selected = True
    return True

Plots for raw peak data

Delta phi

delta phi for peaks around 0°, 180°, and combined distribution

combined Δφ distribution is obtained for each peak, depending on its location in the left or right hand side, small offset from 0 and 180° is subtracted:

   pk.dphicmb = pk.dphi000-1.5 if -90<pk.phi and pk.phi<90 else pk.dphi180-4.8

 

Example of selected event

Angles phi and beta

Evaluated for 2-peak events using equations similar to Kurtik's

Fitted for 2-peak events - these histograms are almost identical to evaluated

Fitted for >2-peak events

Fitted for ≥2-peak events

These fitted angles will be used for Fraser transformation for central part of distributions. Events selected for fitted angles phi and beta are within [-3*sigma,+3*sigma] of their central values,|Δφ|≤8° and |Δβ|≤26°, respectively:

 

Phi angle corrected image

Image rotation is done in the GeometryAcess.py object through the Detector package. Detector package needs in update. In order to apply rotation pixel geometry need to be re-evaluated that slow down processing.

 

Averaged image in q-space

q-space image is averaged over 1825 selected events of the cxif5315-r0169 dataset:

 

How to run examples

First time session

Analysis example scripts from package cxif5315 can be run from release directory, which in this example is named as "rel-cxif5315". To initialize release directory one has to use commands listed below.

ssh psana
kinit

cd <any-directory>
newrel ana-current rel-cxif5315
cd rel-cxif5315
sit_setup

addpkg Detector HEAD
addpkg PSCalib HEAD
addpkg pyimgalgos HEAD
addpkg -u cxif5315 HEAD
scons

python ./cxif5315/proc-cxif5315-r0169-data.py
python ./cxif5315/proc-cxif5315-r0169-peaks-from-file.py

Package cxif5315 always needs to be added. Packages Detector, PSCalib, and pyimgalgos need to be added for current release ana-current=ana-0.16.4 only.

Regular session

ssh psana

cd <path>.rel-cxif5315
sit_setup

python ./cxif5315/proc-cxif5315-r0169-data.py
python ./cxif5315/proc-cxif5315-r0169-peaks-from-file.py

Indexing look-up table

References

  • No labels