Versions Compared

Key

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

...

Most generic way to subtract the CSPad pedestals is to use Translator, as described in CsPad calibration in translator. In this case the HDF5 file has the CSPad image data with already subtracted pedestals. If the job execution time is not an issue, the pedestals can be subtracted directly in code, as explained in this section.

How to find the files with CSPad pedestals

...

  • cspad-pedestals.dat – for average values, and
  • cspad-noise.dat – for standard deviation values.
    These files can be accessible in code as explained below.

...

The file with pedestal values can be read in code as a [numpy] array:

Code Block
import numpy as np
ped_fname = '/reg/d/psdm/<INS>/<experiment>/calib/<calib-version>/<source>/pedestals/<run-range>.dat'
ped_arr = np.loadtxt(ped_fname, dtype=np.float32)
ped_arr.shape = (32, 185, 388) # raw shape is (5920, 388)

...

Assuming that the CSPad event array [ds1ev] and the pedestal array ped_arr are available,
the pedestals can be subtracted by the single operation for [numpy] arrays:

Code Block
if ds1ev.shape == ped_arr.shape : ds1ev -= ped_arr

...