Table of Contents
- Package ImgAlgos
- Module ImgAlgos.CorAnaPars
- Module ImgAlgos.CorAnaSubmit
- Function ImgAlgos.CorAnaSubmit.batch_job_status
- Function ImgAlgos.CorAnaSubmit.batch_job_status_and_nodename
- Function ImgAlgos.CorAnaSubmit.batch_job_submit
- Function ImgAlgos.CorAnaSubmit.check_list_of_files
- Function ImgAlgos.CorAnaSubmit.check_the_file
- Function ImgAlgos.CorAnaSubmit.do_main
- Function ImgAlgos.CorAnaSubmit.get_array_from_file
- Function ImgAlgos.CorAnaSubmit.get_dirname_from_path
- Function ImgAlgos.CorAnaSubmit.get_list_of_files_in_dir
- Function ImgAlgos.CorAnaSubmit.get_parameter_from_cfg_file
- Function ImgAlgos.CorAnaSubmit.get_parameter_from_cfg_file_line
- Function ImgAlgos.CorAnaSubmit.get_xtc_fname_from_cfg_file
- Function ImgAlgos.CorAnaSubmit.init_pars
- Function ImgAlgos.CorAnaSubmit.input_option_parser
- Function ImgAlgos.CorAnaSubmit.one_batch_job_submit_and_wait
- Function ImgAlgos.CorAnaSubmit.parse_path
- Function ImgAlgos.CorAnaSubmit.parse_xtc_fname
- Function ImgAlgos.CorAnaSubmit.print_all_files_in_dir
- Function ImgAlgos.CorAnaSubmit.print_list_of_files_in_dir
- Function ImgAlgos.CorAnaSubmit.print_parsed_path
- Function ImgAlgos.CorAnaSubmit.print_subproc_attributes
- Function ImgAlgos.CorAnaSubmit.remove_file
- Function ImgAlgos.CorAnaSubmit.remove_file_for_tail
- Function ImgAlgos.CorAnaSubmit.remove_split_files
- Function ImgAlgos.CorAnaSubmit.split_string
- Function ImgAlgos.CorAnaSubmit.submit_job_for_merging
- Function ImgAlgos.CorAnaSubmit.submit_job_for_merging_interactive
- Function ImgAlgos.CorAnaSubmit.submit_job_for_proc_results
- Function ImgAlgos.CorAnaSubmit.submit_job_for_proc_results_interactive
- Function ImgAlgos.CorAnaSubmit.submit_job_for_splitter
- Function ImgAlgos.CorAnaSubmit.submit_job_for_splitter_interactive
- Function ImgAlgos.CorAnaSubmit.submit_jobs_for_cor_proc
- Function ImgAlgos.CorAnaSubmit.submit_jobs_for_cor_proc_interactive
- Module ImgAlgos.PyAlgos
- Function ImgAlgos.PyAlgos.photons
- Function ImgAlgos.PyAlgos.photons_2d
- Function ImgAlgos.PyAlgos.print_arr
- Function ImgAlgos.PyAlgos.print_arr_attr
- Function ImgAlgos.PyAlgos.reshape_nda_to_2d
- Function ImgAlgos.PyAlgos.reshape_nda_to_3d
- Function ImgAlgos.PyAlgos.subtract_bkgd
- Function ImgAlgos.PyAlgos.test_photons_2d
- Function ImgAlgos.PyAlgos.test_photons_3d
- Function ImgAlgos.PyAlgos.test_pyalgos
- Module ImgAlgos.SvnProps
Package ImgAlgos¶
Module ImgAlgos.CorAnaPars¶
Project: Evaluation of the Image Auto-Correlation Function CorAnaPars work as a part of the python file managing script in the process of evaluation of the Image Auto-Correlation Function.
CorAnaPars is a singleton class object to hold common parameters.
This software was developed for the SIT project. If you use all or part of it, please give an appropriate acknowledgment.
See also: RelatedModule: CorAnaSubmit.py CorAnaPars.py CorAna*.cpp
Version: $Id: 2012-09-26 15:00:00Z dubrovin$
Author: Mikhail Dubrovin
Module ImgAlgos.CorAnaSubmit¶
Project: Evaluation of the Image Auto-Correlation Function CorAnaSubmit work as a part of the python file managing script in the process of evaluation of the Image Auto-Correlation Function.
CorAnaSubmit.py contains global methods for file management.
This software was developed for the SIT project. If you use all or part of it, please give an appropriate acknowledgment.
See also: RelatedModule: CorAnaSubmit.py CorAnaPars.py CorAna*.cpp
Version: $Id: 2012-09-26 15:00:00Z dubrovin$
Author: Mikhail Dubrovin
Module ImgAlgos.PyAlgos¶
Class provides access to C++ algorithms from python.
Usage:
# !!! None is returned whenever requested information is missing.
# IMPORT
# ======
import psana
from ImgAlgos.PyAlgos import PyAlgos
# INPUT PARAMETERS
# ================
# List of windows
winds = None # entire size of all segments will be used for peak finding
winds = (( 0, 0, 185, 0, 388), ( 1, 20, 160, 30, 300), ( 7, 0, 185, 0, 388))
# Mask
mask = None # (default) all pixels in windows will be used for peak finding
mask = det.mask() # see class Detector.PyDetector
mask = np.loadtxt(fname_mask) #
mask.shape = (32,185,388) # should be the same as shape of data n-d array
# Data n-d array
nda = det.calib() # see class Detector.PyDetector
# INITIALIZATION
# ==============
# create object:
alg = PyAlgos(windows=winds, mask=mask, pbits=0)
# where pbits - is a print info control bit-word:
# pbits = 0 - print nothing
# + 1 - main results, list of peaks
# + 2 - input parameters, index matrix of pixels for S/N algorithm
# + 128 - tracking and all details in class PyAlgos.py
# + 256 - tracking and all details in class AlgArrProc
# + 512 - tracking and all details in class AlgImgProc
# set peak-selector parameters:
alg.set_peak_selection_pars(npix_min=5, npix_max=5000, amax_thr=0, atot_thr=0, son_min=10)
# HIT FINDERS
# ===========
# Hit finders return simple values for decision on event selection.
# get number of pixels above threshold
npix = alg.number_of_pix_above_thr(data, thr=10)
# get total intensity of pixels above threshold
intensity = alg.intensity_of_pix_above_thr(data, thr=12)
# PEAK FINDERS
# ============
# Peak finders return list (numpy.array) of records with found peak parameters.
# v1 - aka Droplet Finder - two-threshold peak-finding algorithm in restricted region
# around pixel with maximal intensity.
peaks = alg.peak_finder_v1(nda, thr_low=10, thr_high=150, radius=5, dr=0.05)
# v2 - define peaks for regoins of connected pixels above threshold
peaks = alg.peak_finder_v2(nda, thr=10, r0=7.0, dr=2.0)
# v3 - define peaks in local maximums of specified rank (radius),
# for example rank=2 means 5x5 pixel region around central pixel.
# nsigm - optional threshold (number of noise rms) for pixel selection
peaks = alg.peak_finder_v3(nda, rank=2, r0=7.0, dr=2.0, nsigm=0)
peaks = alg.peak_finder_v3r2(nda, rank=2, r0=7.0, dr=2.0, nsigm=0) # test version for connected pixels
# v4 - aka Droplet Finder - the same as v1, but uses rank and r0 parameters in stead of common radius.
peaks = alg.peak_finder_v4(nda, thr_low=10, thr_high=150, rank=4, r0=7.0, dr=2.0)
peaks = alg.peak_finder_v4r2(nda, thr_low=10, thr_high=150, rank=5, r0=7.0, dr=2.0) # test version for connected pixels
# OPTIONAL METHODS
# ================
# print info
alg.print_attributes() # attributes of the PyAlgos object
alg.print_input_pars() # member data of C++ objects
# set parameters for S/N evaluation algorithm
alg.set_son_pars(r0=5, dr=0.05)
# set mask
alg.set_mask(mask)
# set windows in segments to search for peaks
alg.set_windows(winds)
# Call after alg.peak_finder_v2, v4r2 ONLY! Returns n-d array with 2-d maps of pixel status
maps = alg.maps_of_pixel_status()
# Call after alg.peak_finder_v2 ONLY! Returns n-d array with 2-d maps of connected pixels
maps = alg.maps_of_connected_pixels()
# Call after alg.peak_finder_v3 ONLY! Returns n-d array with 2-d maps of local maximums
maps = alg.maps_of_local_maximums()
# GLOBAL METHODS
# ==============
# Subtracts numpy array of bkgd from data using normalization in windows.
# Each window is specified by 5 parameters: (segment, rowmin, rowmax, colmin, colmax)
# For 2-d arrays segment is not used, but still 5 parameters needs to be specified.
cdata = subtract_bkgd(data, bkgd, mask=None, winds=None, pbits=0)
# Merges photons split among pixels and returns n-d array with integer number of photons per pixel.
nphotons_nda = photons(fphotons_nda, mask)
See also: classes
Detector.AreaDetector
- acess to detector data
This software was developed for the LCLS project. If you use all or part of it, please give an appropriate acknowledgment.
Version: $Id: PyAlgos.py 12917 2016-11-29 20:14:54Z dubrovin@SLAC.STANFORD.EDU $
Author: Mikhail S. Dubrovin
Function ImgAlgos.PyAlgos.subtract_bkgd¶
-
ImgAlgos.PyAlgos.
subtract_bkgd
(data, bkgd, mask=None, winds=None, pbits=0)[source]¶ Subtracts numpy array of bkgd from data using normalization in windows. Each window is specified by 5 parameters: (segment, rowmin, rowmax, colmin, colmax) For 2-d arrays segment is not used, but still 5 parameters needs to be specified.
Module ImgAlgos.SvnProps¶
Class SvnProps stores updated by svn properties.
NOTE: To update revision number in this file when revision changes, use command: psvn mktxtprop src/SvnProps.py or svn propset svn:keywords “Revision” src/SvnProps.py Also see: ~/.subversion/config
This software was developed for the SIT project. If you use all or part of it, please give an appropriate acknowledgment.
Version: $Id: SvnProps.py 9224 2014-11-10 18:41:00Z dubrovin@SLAC.STANFORD.EDU $
Author: Mikhai S. Dubrovin