Versions Compared

Key

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

...

  • pdscalibdata/include/PnccdBaseV1.h                   - baseclass for pnCCD parameters, defines Segs, Rows, Cols, Size
  • pdscalibdata/include/PnccdPedestalsV1.h            - loads pedestals from file, returns ndarray of pedestals
  • pdscalibdata/include/PnccdCommonModeV1.h     - the same for common mode
  • pdscalibdata/include/PnccdPixelGainV1.h            h             - the same for pixel gain
  • pdscalibdata/include/PnccdPixelRmsV1.h            h             - the same for pixel rms
  • pdscalibdata/include/PnccdPixelStatusV1.h         h          - the same for pixel status
  • PSCalib::PnccdCalibPars                                        - wrapper for all pnCCD types

...

  • Interface is declared in the abstract base class PSCalib::CalibPars
  • Access to all detector-dependent classes is hidden in the static factory class PSCalib::CalibParsStore
  • Note

    Factory is implemented for pnCCD only. CSPAD and CSPAD2x2 will be added soon.

Code Block
#include "PSCalib/CalibPars.h"
#include "PSCalib/CalibParsStore.h"

// Instatiation
//Here we assume that code is working inside psana module where evt and env variables are defined through input parameters of call-back methods.
//Code below instateates calibpars object using factory static method PSCalib::CalibParsStore::Create:

std::string calib_dir = env.calibDir(); // or "/reg/d/psdm/<INS>/<experiment>/calib"
std::string  group = std::string(); // or something like "PNCCD::CalibV1";
const std::string source = "Camp.0:pnCCD.1";
const std::string key = ""; // key for raw data
Pds::Src src; env.get(source, key, &src);
PSCalib::CalibPars* calibpars = PSCalib::CalibParsStore::Create(calib_dir, group, src, PSCalib::getRunNumber(evt));

// Access methods
 *  calibpars->printCalibPars();
 *  const PSCalib::CalibPars::pedestals_t*    peds_data = calibpars->pedestals();
 *  const PSCalib::CalibPars::pixel_gain_t*   gain_data = calibpars->pixel_gain();
 *  const PSCalib::CalibPars::pixel_rms_t*    rms_data  = calibpars->pixel_rms();
 *  const PSCalib::CalibPars::pixel_status_t* maskstat_data = calibpars->pixel_status();
 *  const PSCalib::CalibPars::common_mode_t*  cmod_data = calibpars->common_mode();

...

In order to get rid of detector dependent types of calibration parameters we need to add metadata in the calibration file. All metadata can be listed in the header of the calibration files, for example, using keyward mapping /(dictionary):

Code Block
# RULES:
# Lines starting with # in the beginning of the file are considered as comments or pseudo-comments for metadata
# Lines without # with space-separated values are used for input of parameters
# Empty lines are ignored

# Optional fields:
# TITLE:      This is a file with pedestals
# DATE_TIME:  2014-01-30 10:21:23
# AUTHOR:     someone
# EXPERIMENT: amotut13
# DETECTOR:   Camp.0:pnCCD.1
# CALIB_TYPE: pedestals

# Mandatory fields to define the ndarray<TYPE,NDIMS> and its shape as unsigned shape[NDIMS] = {DIM1,DIM2,DIM3}
# TYPE:       float
# NDIMS:      3
# DIM1:       4
# DIM2:       255
# DIM3:       255

973.941639 881.189675 1050.211 773.263749 899.241302 981.805836 1150.72615 993.084175 1121.15488 1029.76319 1220.14927 903.278339 1097.49944 1066.94949 1263.71044 1053.53872 1194.35915 935.320988 1317 ...

...

This proves that common mode should be evaluated for horizontal stripes.

 

...

Data corrections in module ImgAlgos.NDArrCalib

List of parameters in configuration file

Notecode
[ImgAlgos.NDArrCalib]


source = DetInfo(Camp.0:pnCCD.0)


key_in = pnccd-ndarr

  
key_out = calibrated

  
do_peds = yes

 
do_cmod = no 
do_stat = no

 
do_mask = no

 
do_bkgd = no

 
do_gain = no

  
do_nrms = no

 
do_thre = yes

 
fname_
peds =
fname_
bkgd
=
fname_gain =
 =  
fname_mask =

fname_rms = 

masked_value = 0
threshold_nrms = 0

  
threshold = 100.0

  
below_thre_value =
50
 50
bkgd_ind_min = 0
bkgd_ind_max = 1000
bkgd_ind_inc = 2
print_bits =
255
 11

 

Pedestals subtraction

Calibration type: pedestals

...

Apply common gain factor = 0.5:

 

...

Pixel status mask

Calibration type: pixel_status (0-good, 1,2,4,...-bad)

...