bm2ph : X photons counting with CCD

A small program, called wv2ph or edf2ph has been writen for this purpose. It take profit that a X-ray photons create a lot of charge on direct illumination CCD. If the number of photons on each frame is quite low (typically up to one photon for ten pixels), it is possible to locate each photon using the CCD as a real 2D counter. As a result the amount of storage space is strongly reduced : the large amount of images which are usefull for kinetics studies can be collected, no more problems occur in processing or transerring them.

Method (to be writen)

Application (to be writen)

Manual (to be writen)

Short examples

Processing winview CCD images (.spe).

The following lines show how photons in wv_2.spe files are extracted using a dark current file named wv_1.spe. This example is run under hpux but a Window95 release of the same program works also, in this case it is easier to run it without argument on the command line and to supply them in request to question.
d2mat(berar)~/Progs/wv/flivet> wv2ph wv_1 wv_2
 wv2ph :  extracting photons from Winview CCD images
flivet and berar@esrf.fr (d2am),  Mar 29 2000 using file 'wv2ph.ini'
     Z_PEAK= 180
       TRIG= 20
     Z_TRIG= 0.300000
       MODE= gtt
# file  'wv_1.spe' : images size 384 * 576, frames 10
# data_type (INT16U)  swapping used
# effective image : (384-0)/1 * (576-0)/1 => 384 * 576 = 221184
# wv_1.spe : frame 0
# wv_1.spe : frame 1
...
# wv_1.spe : 10 frames used
...
# wv_1 : 10 frame(s), mean 53033.9 sigma 47.5 [52921@142*482 - 54770@20*1] 221184!=0
 normalising dark image to one frame
 adding 2 to all points in dark image
# wv_1 : 1 frame(s), mean 5305.4 sigma 4.8 [5294@1*429 - 5479@20*1] 221184!=0

 image file name :  wv_2
 output of result in wv_2.gtt
# file  'wv_2.spe' : images size 384 * 576, frames 50
# data_type (INT16U)  swapping used

 'wv_2.spe'  image 1  mean 5313.0 (87.7) bg_cor 7.6
 2465 droplets with 27564 pixels (trig=20), z : mean=1027.3, max=7933
 14730 photons with z peak 180 (z_trig=54, z_cosmic=0)
 dark :  183861 pixel, mean -3.8 (6.9) max 19  time 2s

....
 'wv_2.spe'  image 20  mean 5319.7 (102.2) bg_cor 14.3
 3411 droplets with 40311 pixels (trig=20), z : mean=1062.3, max=6647
 21034 photons with z peak 180 (z_trig=54, z_cosmic=0)
 dark :  170361 pixel, mean -2.1 (6.5) max 19  time 61s


 411962 photons have been located adding 20 frames!
# wv_2 : 1 frame(s), mean 1.9 sigma 2.7 [0@0*0 - 28@131*288] 122410!=0
 writing wv_2.tif grayscale with 16 bits
The detailled results are stored in the wv_2.gtt file which contain only the number of photons per frames and their coordinates :
 14730
289   1
288   1
289   1
288   1
 79   3
 78   3
......
If a pixel was marked by more than one photon, it is only repeated. The wv_2.tif file is a 16 bits standard TIFF file which contain the sum of all photons and allow a direct visualisation of the experimental result.

Processing esrf CCD images (.edf).

Similarly the following lines show how photons in id1_0010.edf to id1_0022.edffiles are extracted using a dark current files named wid1_0057.edf to id1_0063.edf. The synthax is slightly different as only one frame is stored on each image.
d2mat(berar)~/Progs/wv/flivet> edf2ph id1_0057.edf,A7 id1_0010.edf,A13
 edf2ph :  extracting photons from Edf (esrf data file)
flivet and berar@esrf.fr (d2am),  Mar 29 2000 using file 'edf2ph.ini'
   ADD_DARK= 2
     Z_PEAK= 180
       TRIG= 20
     Z_TRIG= 0.300000
       MODE= gtt
# file  'id1_0057.edf' : images size 384 * 576, frames 1
# data_type (INT16U)  no swapping used
# effective image : (384-0)/1 * (576-0)/1 => 384 * 576 = 221184
# id1_0057.edf : frame 0
# id1_0057.edf : frame 1
# id1_0057.edf : 1 frames used
# 0 saturated pixels found
# id1_0057.edf,A7 : 1 frame(s), mean 826.2 sigma 3.1 [791@0*62 - 858@23*1] 221184!=0
.....
# id1_0063.edf : 1 frames used
# 0 saturated pixels found
# id1_0057.edf,A7 : 7 frame(s), mean 5783.3 sigma 13.1 [5559@0*0 - 5978@23*1] 221184!=0
 normalising dark image to one frame
 adding 2 to all points in dark image
# id1_0057.edf,A7 : 1 frame(s), mean 828.2 sigma 1.9 [796@0*0 - 856@23*1] 221184!=0

 image file name :  id1_0010.edf,A13
 output of result in id1_0010.gtt
# file  'id1_0010.edf' : images size 384 * 576, frames 1
# data_type (INT16U)  no swapping used

 'id1_0010.edf'  image 1  mean 826.1 (8.8) bg_cor -2.1
 771 droplets with 4589 pixels (trig=20), z : mean=142.8, max=330
 768 photons with z peak 180 (z_trig=54, z_cosmic=0)
 dark :  197343 pixel, mean -2.6 (2.9) max 19  time 1s
# file  'id1_0011.edf' : images size 384 * 576, frames 1
# data_type (INT16U)  no swapping used

 'id1_0011.edf'  image 1  mean 826.1 (8.6) bg_cor -2.1
.....
 'id1_0022.edf'  image 1  mean 825.8 (9.0) bg_cor -2.4
 798 droplets with 4801 pixels (trig=20), z : mean=144.3, max=339
 813 photons with z peak 180 (z_trig=54, z_cosmic=0)
 dark :  199048 pixel, mean -3.0 (2.9) max 18  time 2s


 9819 photons have been located adding 13 frames!
# id1_0010 : 1 frame(s), mean 0.0 sigma 0.2 [0@0*0 - 3@89*127] 9600!=0
 writing id1_0010.tif grayscale with 16 bits

Inline Help

d2mat2(berar)~/Progs/wv/flivet> edf2ph -h
 edf2ph :  extracting photons from Edf (esrf data file)
flivet and berar@esrf.fr (d2am),  Mar 29 2000 using file 'edf2ph.ini'
       TRIG= 20
   ADD_DARK= 2
  PRINT_KEY= -1
   LAST_IMG= 20
     Z_PEAK= 180
       TRIG= 20
     Z_TRIG= 0.300000
       MODE= gtt
usage : edf2ph [dark_file img_file [img...]]
valid options in edf2ph.ini files are : 
  TRIG = set trig level, default is 4 times the dark sigma
  FIRST_DARK = first image
  LAST_DARK  = last image
  FIRST_IMG  = first image
  LAST_IMG   = last image
  ADD_DARK   = offset to add to dark curent
  PRINT_MAP  = relative scale for pixels to print
  PRINT_KEY  = 0/1 print all droplets, -1 avoid 
  REALTIME   = 0 ; file must exist else wait at least REALTIME seconds before opening (integer)
  Z_PEAK     = if not automatic
  Z_TRIG     = if not .5
  Z_COSMIC   = if used ratio to z_peak
 Items used in the .ini file
  X_MIN = 
  Y_MIN = 
  X_MAX = 
  Y_MAX = 
  X_BIND = 
  Y_BIND = 
  BEG_FRAME = 
  END_FRAME = 
  MULT   = 
  DIR = full path to search for data file
  OUT = full path for result (.gtt) file
  MODE = sum or gtt, default sum : a 16bits tif 
edf2ph

Make and archive(to be writen)


Updated by berar@esrf.fr on Mar. 29, 2000