Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

See also Example for Module ImgAlgos::ImgPeakFinderAB.

Module ImgAlgos::ImgHitFinder

ImgHitFinder is created by request for amo74213. It works pretty similar to ImgCalib, but the threshold algorithms are extended and background subtraction is removed.
It gets the raw image from data and process it as follows:

  1. subtracts pedestals,
  2. apply gain factors,
  3. apply mask, and
  4. apply one of the threshold algorithms
    and saves the corrected image or hit-pixel map in the event.

Functionality:

  • ImgHitFinder uses the source and key_in parameters to get the input raw image (as ndarray<T,2> object), where T stands for uint16_t, int, float, uint8_t, or double,
  • gets the calibration parameters from files fname_peds, fname_gain, fname_mask, and fname_thre, if their names are specified,
  • the specified by the file name corrections are applied per-pixel to raw data image as follows:
    Code Block
    bgColor#F7F7ED
    
    A_cor = A_raw
            (1) - pedestal              | if the file name is specified in the parameter "fname_peds"
            (2) * gain                  | if the file name is specified in the parameter "fname_gain"
            (3) apply mask              | if the file name is specified in the parameter "fname_mask"
            (4) apply threshold         | if the file name is specified in the parameter "fname_thre"
    
  • corrected image is saved in the event with key key_out as double (or unsigned for pixel map) type.

Details:

  • All files with input calibration parameters should have the same shape as image and formatted as regular text file containing 2d matrix (table) of float (or integer) values, with columns separated by space(s), ' ', and rows(lines) terminated by the '\n'.
  • Masking algorithm assumes that good pixels in the fname_mask file should be marked by '1' (ones) and bad pixels – by '0' (zeros). The bad masked pixel amplitudes are substituted by the masked_value.

parameter

default value

description

source

"DetInfo(:Camera)"

source of data

key_in

 

key for input image

key_out

"calibrated"

output key for calibrated image saved in event

fname_peds

 

input file name for pedestals, applied if the file name is specified

fname_mask

 

input file name for mask, applied if the file name is specified

fname_gain

 

input file name for gain, applied if the file name is specified

fname_thre

 

input file name for threshold, applied if the file name is specified and thre_mode is not zero

masked_value

0.

amplitude value (in ADU) substituted for masked pixels

thre_mode

1

threshold mode: 0 - is not applied; 1 - constant level threshold defined by thre_param in ADU; 2 - apply threshold from file fname_thre multiplied by thre_param; 3 - the same as 2 but local peak finding algorithm is on

thre_param

def

threshold parameter - its meaning depends on thre_mode

thre_below_value

0.

the amplitude substituted in pixels below threshold

thre_above_value

def

the amplitude substituted in pixels below threshold, by default - amplitude above threshold is not substituted

win_row_min

1

the window in image, which is used to make hit map

win_row_max

def

the window in image, which is used to make hit map, by default - use all rows-1

win_col_min

1

the window in image, which is used to make hit map

win_col_max

def

the window in image, which is used to make hit map, by default - use all columns-1

print_bits

0

verbosity:

  • =0 - print nothing
  • +1 - input pars
  • +2 - time stamp for each event
  • +4 - detailed info about input files for pedestals, mask, background, and gain
  • +8 - first 10 elements of the raw image data
  • +16 - first 10 elements of the calibrated image data

Corrections are not applied by default or with empty file names.

See also Example for Module ImgAlgos::ImgHitFinder.

Module ImgAlgos::ImgSpectra

This module is motivated by the discussion with Josef Frisch, Ryan Coffee, Nick Hartmann. In xppi0412 etc. experiments they need to extract two spectra from Opal1000 camera image for signal and reference, evaluate their relative difference, and find peak position in the differential spectrum.
Module mgAlgos::ImgSpectra works as follows:

...

parameter

default value

description

source

"DetInfo(:Cspad)"

input source of data

inputKey

 

key for input data, by default use raw data

outputKey

"bkgd_subtracted"

output key for the next data processing stage

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="421e0d91b197d294-13fe4fce-47664f19-b704ae7a-535a7efe1c4e4cf5b21347f0"><ac:plain-text-body><![CDATA[

bkgd_fname

"cspad_background.dat"

file with CSPad array [4*8*185][388] of averaged background

]]></ac:plain-text-body></ac:structured-macro>

norm_sector

0

CSPad sector in quad from 0 to 7

print_bits

0

module verbosity:

  • =0 - print nothing
  • +1 - input pars
  • +2 - event ID
  • +4 - normalization factor for each event
  • +8 - part of the background array

...

parameter

default value

description

source

"DetInfo(:Cspad)"

input source of data

inkey

 

key for input data, by default use raw data

outkey

"bkgd_subtracted"

output key for the next data processing stage

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="348a548043cdd63c-04840a2c-4ff442b2-ad6b87be-22d369743289697aec910bcc"><ac:plain-text-body><![CDATA[

mask_fname

"cspad_mask.dat"

file with CSPad mask array [4*8*185][388]

]]></ac:plain-text-body></ac:structured-macro>

masked_amp

0

this amplitude will replace the amplitude in each masked pixel

mask_control_bits

1

control bits for applied mask:

  • =0 - do not apply any mask
  • +1 - apply mask from file
  • +2 - mask two long edges of 2x1
  • +4 - mask two short edges of 2x1
  • +8 - mask two short rows in the middle of 2x1 (rows with wide pixels)

print_bits

0

module verbosity:

  • =0 - print nothing
  • +1 - input pars (in beginJob)
  • +2 - event ID (in event)
  • +4 - mask statistics (in beginJob)
  • +8 - part of the mask array (in beginJob)

...